Module: SolidusNexio::NexioPaymentCommons

Included in:
AlternativePaymentMethod, PaymentMethod
Defined in:
app/models/solidus_nexio/nexio_payment_commons.rb

Instance Method Summary collapse

Instance Method Details

#authorize(money, source, options = {}) ⇒ Object



9
10
11
# File 'app/models/solidus_nexio/nexio_payment_commons.rb', line 9

def authorize(money, source, options = {})
  super(money, source, add_transaction_options(source, options))
end

#cancel(id) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'app/models/solidus_nexio/nexio_payment_commons.rb', line 13

def cancel(id)
  transaction = gateway.get_transaction(id)
  return error_response(id, 'not found') unless transaction

  if Mappings.settled?(transaction.status)
    credit(transaction.amount.to_money.cents, id)
  else
    void(id)
  end
end

#purchase(money, source, options = {}) ⇒ Object



5
6
7
# File 'app/models/solidus_nexio/nexio_payment_commons.rb', line 5

def purchase(money, source, options = {})
  super(money, source, add_transaction_options(source, options))
end