Class: Workarea::Payment::Purchase::CreditCard
- Inherits:
-
Object
- Object
- Workarea::Payment::Purchase::CreditCard
- Includes:
- CreditCardOperation, OperationImplementation
- Defined in:
- app/models/workarea/payment/purchase/credit_card.rb
Instance Method Summary collapse
Methods included from CreditCardOperation
#gateway, #handle_active_merchant_errors
Methods included from OperationImplementation
#initialize, #validate_reference!
Instance Method Details
#cancel! ⇒ Object
26 27 28 29 30 31 32 |
# File 'app/models/workarea/payment/purchase/credit_card.rb', line 26 def cancel! return unless transaction.success? transaction.cancellation = handle_active_merchant_errors do gateway.void(transaction.response.) end end |
#complete! ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/models/workarea/payment/purchase/credit_card.rb', line 10 def complete! # Some gateways will tokenize in the same request as the auth/capture. # If that is the case for the gateway you are implementing, omit the # following line, and save the token on the tender after doing the # gateway authorization. return unless StoreCreditCard.new(tender, ).save! transaction.response = handle_active_merchant_errors do gateway.purchase( transaction.amount.cents, tender.to_token_or_active_merchant, ) end end |