Sha256: 4f3bb757f9a95f08076cbb7362ada5999077861fea7a3755a32cf7e9a0d65997

Contents?: true

Size: 928 Bytes

Versions: 1

Compression:

Stored size: 928 Bytes

Contents

module Workarea
  class Payment
    class Capture
      class Afterpay
        include OperationImplementation
        include CreditCardOperation
        include AfterpayPaymentGateway

        def complete!
          response = gateway.capture(tender.token, tender.payment.id)
          if response.success?
            transaction.response = ActiveMerchant::Billing::Response.new(
              true,
              I18n.t(
                'workarea.afterpay.capture',
                amount: transaction.amount
              ),
              response.body
            )
          else
             transaction.response = ActiveMerchant::Billing::Response.new(
               false,
              I18n.t('workarea.afterpay.capture_failure'),
              response.body
            )
          end
        end

        def cancel!
          # No op - no cancel functionality available.
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
workarea-afterpay-2.0.2 app/models/workarea/payment/capture/afterpay.rb