Sha256: f05744386e5f17e1de0fdaf97beea41109ee36dba8162026467953e09a8770cf

Contents?: true

Size: 786 Bytes

Versions: 5

Compression:

Stored size: 786 Bytes

Contents

module Workarea
  class Payment
    module Purchase
      class Paypal
        include OperationImplementation
        include CreditCardOperation

        delegate :gateway, to: Workarea::Paypal

        def complete!
          transaction.response = handle_active_merchant_errors do
            gateway.purchase(
              transaction.amount.cents,
              token: tender.token,
              payer_id: tender.payer_id,
              currency: transaction.amount.currency
            )
          end
        end

        def cancel!
          return unless transaction.success?

          transaction.cancellation = handle_active_merchant_errors do
            gateway.void(transaction.response.params['transaction_id'])
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
workarea-paypal-2.0.12 app/models/workarea/payment/purchase/paypal.rb
workarea-paypal-2.0.11 app/models/workarea/payment/purchase/paypal.rb
workarea-paypal-2.0.10 app/models/workarea/payment/purchase/paypal.rb
workarea-paypal-2.0.9 app/models/workarea/payment/purchase/paypal.rb
workarea-paypal-2.0.8 app/models/workarea/payment/purchase/paypal.rb