Class: Workarea::Payment::Authorize::Affirm
- Inherits:
-
Object
- Object
- Workarea::Payment::Authorize::Affirm
- Includes:
- CreditCardOperation, OperationImplementation
- Defined in:
- app/models/workarea/payment/authorize/affirm.rb
Instance Method Summary collapse
Instance Method Details
#cancel! ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/models/workarea/payment/authorize/affirm.rb', line 28 def cancel! return unless transaction.success? payment_id = transaction.response.params['id'] response = gateway.void(payment_id) transaction.cancellation = ActiveMerchant::Billing::Response.new( true, I18n.t('workarea.affirm.void'), response.body ) end |
#complete! ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/workarea/payment/authorize/affirm.rb', line 8 def complete! response = gateway.(tender.checkout_token, tender.payment.id) if response.success? transaction.response = ActiveMerchant::Billing::Response.new( true, I18n.t( 'workarea.affirm.authorize', amount: transaction.amount ), response.body ) else transaction.response = ActiveMerchant::Billing::Response.new( false, I18n.t('workarea.affirm.authorize_failure'), response.body ) end end |