Sha256: f45f4ace9244da78b6d3cf8f380bf0cc817e825274e4594bbddc78cc13eaf519
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
module Workarea class Payment module Authorize class Affirm include OperationImplementation include CreditCardOperation def complete! response = gateway.authorize(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 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 private def gateway Workarea::Affirm.gateway end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
workarea-affirm-1.0.0 | app/models/workarea/payment/authorize/affirm.rb |