Method: ActiveMerchant::Billing::MitGateway#capture

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

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



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/active_merchant/billing/gateways/mit.rb', line 101

def capture(money, authorization, options = {})
  post = {
    operation: 'Capture',
    commerce_id: @options[:commerce_id],
    user: @options[:user],
    apikey: @options[:api_key],
    testMode: (test? ? 'YES' : 'NO'),
    transaction_id: authorization,
    amount: amount(money)
  }
  post[:key_session] = @options[:key_session]

  post_to_json = post.to_json
  post_to_json_encrypt = encrypt(post_to_json, @options[:key_session])

  final_post = '<capture>' + post_to_json_encrypt + '</capture><dataID>' + @options[:user] + '</dataID>'
  json_post = final_post
  commit('capture', json_post)
end