Method: ActiveMerchant::Billing::VposGateway#credit

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

#credit(money, payment, options = {}) ⇒ Object



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/active_merchant/billing/gateways/vpos.rb', line 77

def credit(money, payment, options = {})
  # Not permitted for foreign cards.
  commerce = options[:commerce] || @options[:commerce]
  commerce_branch = options[:commerce_branch] || @options[:commerce_branch]

  token = generate_token(@shop_process_id, 'refund', commerce, commerce_branch, amount(money), currency(money))
  post = {}
  post[:token] = token
  post[:commerce] = commerce.to_i
  post[:commerce_branch] = commerce_branch.to_i
  post[:shop_process_id] = @shop_process_id
  add_invoice(post, money, options)
  add_card_data(post, payment)
  add_customer_data(post, options)
  post[:origin_shop_process_id] = options[:original_shop_process_id] if options[:original_shop_process_id]
  commit(:refund, post)
end