Method: ActiveMerchant::Billing::SafeChargeGateway#refund

Defined in:
lib/active_merchant/billing/gateways/safe_charge.rb

#refund(money, authorization, options = {}) ⇒ Object



71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/active_merchant/billing/gateways/safe_charge.rb', line 71

def refund(money, authorization, options = {})
  post = {}
  auth, transaction_id, token, exp_month, exp_year, _, original_currency = authorization.split('|')
  add_transaction_data('Credit', post, money, options.merge!({ currency: original_currency }))
  post[:sg_CreditType] = 2
  post[:sg_AuthCode] = auth
  post[:sg_CCToken] = token
  post[:sg_ExpMonth] = exp_month
  post[:sg_ExpYear] = exp_year
  post[:sg_TransactionID] = transaction_id unless options[:unreferenced_refund]

  commit(post)
end