module Workarea::Factories::Payment
Public Instance Methods
capture_order(order)
click to toggle source
# File lib/workarea/testing/factories/payment.rb, line 26 def capture_order(order) payment = Workarea::Payment.find(order.id) capture = Workarea::Payment::Capture.new( payment: payment, amounts: payment.tenders.reduce({}) { |m, t| m.merge(t.id => t.capturable_amount) } ) capture.complete! end
create_payment(overrides = {})
click to toggle source
# File lib/workarea/testing/factories/payment.rb, line 6 def create_payment(overrides = {}) attributes = factory_defaults(:payment).merge(overrides) Workarea::Payment.create!(attributes) end
create_payment_profile(overrides = {})
click to toggle source
# File lib/workarea/testing/factories/payment.rb, line 11 def create_payment_profile(overrides = {}) attributes = factory_defaults(:payment_profile).merge(overrides) Workarea::Payment::Profile.create!(attributes) end
create_saved_credit_card(overrides = {})
click to toggle source
# File lib/workarea/testing/factories/payment.rb, line 16 def create_saved_credit_card(overrides = {}) attributes = factory_defaults(:saved_credit_card).merge(overrides) Workarea::Payment::SavedCreditCard.create!(attributes) end
create_transaction(overrides = {})
click to toggle source
# File lib/workarea/testing/factories/payment.rb, line 21 def create_transaction(overrides = {}) attributes = factory_defaults(:transaction).merge(overrides) Workarea::Payment::Transaction.create!(attributes) end
next_year()
click to toggle source
# File lib/workarea/testing/factories/payment.rb, line 36 def next_year 1.year.from_now.year end