Sha256: 0f93c5480082784637fd31c57547c65757646b18f8df12143da9944a1aecb52f

Contents?: true

Size: 824 Bytes

Versions: 29

Compression:

Stored size: 824 Bytes

Contents

Factory.define :payment do |f|
  f.amount 45.75
  f.payment_method { Factory(:bogus_payment_method) }
  f.source { Factory.build(:creditcard) }
  f.order { Factory(:order) }
  f.state 'pending'
  f.response_code '12345'

  # limit the payment amount to order's remaining balance, to avoid over-pay exceptions
  f.after_create do |pmt|
      #pmt.update_attribute(:amount, [pmt.amount, pmt.order.outstanding_balance].min)
  end
end

# Factory.define :creditcard_txn do |f|
#   f.association :payment
#   f.amount 45.75
#   f.response_code 12345
#   f.txn_type CreditcardTxn::TxnType::AUTHORIZE
#
#   # match the payment amount to the payment's value
#   f.after_create do |txn|
#     # txn.update_attribute(:amount, [txn.amount, txn.payment.payment].min)
#     txn.update_attribute(:amount, txn.payment.amount)
#   end
# end

Version data entries

29 entries across 29 versions & 6 rubygems

Version Path
spree_core-0.70.7 lib/spree_core/testing_support/factories/payment_factory.rb
spree_core-0.70.6 lib/spree_core/testing_support/factories/payment_factory.rb
apispree_core-0.0.0 lib/spree_core/testing_support/factories/payment_factory.rb
My-Commerce_core-1.1.0 lib/spree_core/testing_support/factories/payment_factory.rb
My-Commerce_core-1.0.0 lib/spree_core/testing_support/factories/payment_factory.rb
MyCommerceapi-1.0.0 core/lib/spree_core/testing_support/factories/payment_factory.rb
MyCommerce-0.0.3 core/lib/spree_core/testing_support/factories/payment_factory.rb
rfcommerce_core-0.0.3 lib/spree_core/testing_support/factories/payment_factory.rb
spree_core-0.60.6 lib/spree_core/testing_support/factories/payment_factory.rb
spree_core-0.70.5 lib/spree_core/testing_support/factories/payment_factory.rb
spree_core-0.70.4 lib/spree_core/testing_support/factories/payment_factory.rb
spree_core-0.60.5 lib/spree_core/testing_support/factories/payment_factory.rb
spree_core-0.70.3 lib/spree_core/testing_support/factories/payment_factory.rb
spree_core-0.70.2 lib/spree_core/testing_support/factories/payment_factory.rb
spree_core-0.50.4 lib/spree_core/testing_support/factories/payment_factory.rb
spree_core-0.60.4 lib/spree_core/testing_support/factories/payment_factory.rb
spree_core-0.50.3 lib/spree_core/testing_support/factories/payment_factory.rb
spree_core-0.60.3 lib/spree_core/testing_support/factories/payment_factory.rb
spree_core-0.70.1 lib/spree_core/testing_support/factories/payment_factory.rb
spree_core-0.70.0 lib/spree_core/testing_support/factories/payment_factory.rb