Sha256: 15fb17ccf60b589e1a82f0f3ca00edbaca92deee7c08587d0cfedcc38717a7ca

Contents?: true

Size: 844 Bytes

Versions: 2

Compression:

Stored size: 844 Bytes

Contents

module Workarea
  decorate Payment::Authorize::CreditCard, with: :usaepay do #[2]
    decorated do
      include Payment::CreditCardData
      delegate :address, to: :tender
    end

    def complete! #[3]
      return unless Payment::StoreCreditCard.new(tender, options).save! #[4]

      transaction.response = #[5][6]
        handle_active_merchant_errors do #[7]
          gateway.authorize( #[8]
            transaction.amount.cents, #[9]
            payment_source,
            transaction_args
          )
        end

      transaction.success?
    end

    def cancel! #[11]
      return unless transaction.success? #[12]

      transaction.cancellation = #[13][6]
        handle_active_merchant_errors do #[7]
          gateway.void( #[14]
            transaction.response.authorization #[15]
          )
        end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-usaepay-1.2.0 app/models/workarea/payment/authorize/credit_card.decorator
workarea-usaepay-1.1.1 app/models/workarea/payment/authorize/credit_card.decorator