Method: Spree::PaymentMethod::StoreCredit#credit

Defined in:
app/models/spree/payment_method/store_credit.rb

#credit(amount_in_cents, auth_code, gateway_options) ⇒ Object



66
67
68
69
70
71
72
73
74
75
# File 'app/models/spree/payment_method/store_credit.rb', line 66

def credit(amount_in_cents, auth_code, gateway_options)
  action = -> (store_credit) do
    currency = gateway_options[:currency] || store_credit.currency
    originator = gateway_options[:originator]

    store_credit.credit(amount_in_cents / 100.0.to_d, auth_code, currency, action_originator: originator)
  end

  handle_action(action, :credit, auth_code)
end