activemerchant 1.104.0 → 1.105.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +22 -1
  3. data/README.md +1 -1
  4. data/lib/active_merchant/billing/gateways/authorize_net.rb +3 -2
  5. data/lib/active_merchant/billing/gateways/balanced.rb +4 -4
  6. data/lib/active_merchant/billing/gateways/bambora_apac.rb +6 -10
  7. data/lib/active_merchant/billing/gateways/bpoint.rb +6 -4
  8. data/lib/active_merchant/billing/gateways/credorax.rb +22 -3
  9. data/lib/active_merchant/billing/gateways/decidir.rb +17 -1
  10. data/lib/active_merchant/billing/gateways/ebanx.rb +3 -2
  11. data/lib/active_merchant/billing/gateways/efsnet.rb +9 -9
  12. data/lib/active_merchant/billing/gateways/global_collect.rb +8 -8
  13. data/lib/active_merchant/billing/gateways/hps.rb +75 -25
  14. data/lib/active_merchant/billing/gateways/litle.rb +15 -15
  15. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +15 -2
  16. data/lib/active_merchant/billing/gateways/monei.rb +18 -18
  17. data/lib/active_merchant/billing/gateways/moneris.rb +21 -21
  18. data/lib/active_merchant/billing/gateways/openpay.rb +3 -3
  19. data/lib/active_merchant/billing/gateways/orbital.rb +51 -51
  20. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +3 -3
  21. data/lib/active_merchant/billing/gateways/paymentez.rb +1 -1
  22. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +5 -5
  23. data/lib/active_merchant/billing/gateways/redsys.rb +2 -0
  24. data/lib/active_merchant/billing/gateways/secure_net.rb +3 -3
  25. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +6 -6
  26. data/lib/active_merchant/billing/gateways/stripe.rb +13 -4
  27. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +7 -14
  28. data/lib/active_merchant/billing/gateways/worldpay.rb +158 -69
  29. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +1 -1
  30. data/lib/active_merchant/version.rb +1 -1
  31. metadata +2 -2
@@ -164,21 +164,21 @@ module ActiveMerchant #:nodoc:
164
164
  }
165
165
 
166
166
  AVS_RESPONSE_CODE = {
167
- '00' => 'Y',
168
- '01' => 'X',
169
- '02' => 'D',
170
- '10' => 'Z',
171
- '11' => 'W',
172
- '12' => 'A',
173
- '13' => 'A',
174
- '14' => 'P',
175
- '20' => 'N',
176
- '30' => 'S',
177
- '31' => 'R',
178
- '32' => 'U',
179
- '33' => 'R',
180
- '34' => 'I',
181
- '40' => 'E'
167
+ '00' => 'Y',
168
+ '01' => 'X',
169
+ '02' => 'D',
170
+ '10' => 'Z',
171
+ '11' => 'W',
172
+ '12' => 'A',
173
+ '13' => 'A',
174
+ '14' => 'P',
175
+ '20' => 'N',
176
+ '30' => 'S',
177
+ '31' => 'R',
178
+ '32' => 'U',
179
+ '33' => 'R',
180
+ '34' => 'I',
181
+ '40' => 'E'
182
182
  }
183
183
 
184
184
  def void_type(kind)
@@ -60,9 +60,12 @@ module ActiveMerchant #:nodoc:
60
60
  commit('refundCard', post)
61
61
  end
62
62
 
63
- def void(money, identification, options = {})
63
+ def void(identification, options = {})
64
64
  post = {}
65
- add_amount(post, money, options)
65
+ # The amount parameter is required for void transactions
66
+ # on the Merchant Warrior gateway.
67
+ post['transactionAmount'] = options[:amount]
68
+ post['hash'] = void_verification_hash(identification)
66
69
  add_transaction(post, identification)
67
70
  commit('processVoid', post)
68
71
  end
@@ -161,6 +164,16 @@ module ActiveMerchant #:nodoc:
161
164
  )
162
165
  end
163
166
 
167
+ def void_verification_hash(transaction_id)
168
+ Digest::MD5.hexdigest(
169
+ (
170
+ @options[:api_passphrase].to_s +
171
+ @options[:merchant_uuid].to_s +
172
+ transaction_id
173
+ ).downcase
174
+ )
175
+ end
176
+
164
177
  def parse(body)
165
178
  xml = REXML::Document.new(body)
166
179
 
@@ -260,10 +260,10 @@ module ActiveMerchant #:nodoc:
260
260
  def parse(body)
261
261
  xml = Nokogiri::XML(body)
262
262
  {
263
- :unique_id => xml.xpath('//Response/Transaction/Identification/UniqueID').text,
264
- :status => translate_status_code(xml.xpath('//Response/Transaction/Processing/Status/@code').text),
265
- :reason => translate_status_code(xml.xpath('//Response/Transaction/Processing/Reason/@code').text),
266
- :message => xml.xpath('//Response/Transaction/Processing/Return').text
263
+ :unique_id => xml.xpath('//Response/Transaction/Identification/UniqueID').text,
264
+ :status => translate_status_code(xml.xpath('//Response/Transaction/Processing/Status/@code').text),
265
+ :reason => translate_status_code(xml.xpath('//Response/Transaction/Processing/Reason/@code').text),
266
+ :message => xml.xpath('//Response/Transaction/Processing/Return').text
267
267
  }
268
268
  end
269
269
 
@@ -311,26 +311,26 @@ module ActiveMerchant #:nodoc:
311
311
  # Private: Translate Monei status code to native ruby symbols
312
312
  def translate_status_code(code)
313
313
  {
314
- '00' => :success,
315
- '40' => :neutral,
316
- '59' => :waiting_bank,
317
- '60' => :rejected_bank,
318
- '64' => :waiting_risk,
319
- '65' => :rejected_risk,
320
- '70' => :rejected_validation,
321
- '80' => :waiting,
322
- '90' => :new
314
+ '00' => :success,
315
+ '40' => :neutral,
316
+ '59' => :waiting_bank,
317
+ '60' => :rejected_bank,
318
+ '64' => :waiting_risk,
319
+ '65' => :rejected_risk,
320
+ '70' => :rejected_validation,
321
+ '80' => :waiting,
322
+ '90' => :new
323
323
  }[code]
324
324
  end
325
325
 
326
326
  # Private: Translate AM operations to Monei operations codes
327
327
  def tanslate_payment_code(action)
328
328
  {
329
- :purchase => 'CC.DB',
330
- :authorize => 'CC.PA',
331
- :capture => 'CC.CP',
332
- :refund => 'CC.RF',
333
- :void => 'CC.RV'
329
+ :purchase => 'CC.DB',
330
+ :authorize => 'CC.PA',
331
+ :capture => 'CC.CP',
332
+ :refund => 'CC.RF',
333
+ :void => 'CC.RV'
334
334
  }[action]
335
335
  end
336
336
  end
@@ -417,27 +417,27 @@ module ActiveMerchant #:nodoc:
417
417
 
418
418
  def actions
419
419
  {
420
- 'purchase' => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type, :avs_info, :cvd_info, :track2, :pos_code, :cof_info],
421
- 'preauth' => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type, :avs_info, :cvd_info, :track2, :pos_code, :cof_info],
422
- 'command' => [:order_id],
423
- 'refund' => [:order_id, :amount, :txn_number, :crypt_type],
424
- 'indrefund' => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type],
425
- 'completion' => [:order_id, :comp_amount, :txn_number, :crypt_type],
426
- 'purchasecorrection' => [:order_id, :txn_number, :crypt_type],
427
- 'cavv_preauth' => [:order_id, :cust_id, :amount, :pan, :expdate, :cavv, :crypt_type, :wallet_indicator],
428
- 'cavv_purchase' => [:order_id, :cust_id, :amount, :pan, :expdate, :cavv, :crypt_type, :wallet_indicator],
429
- 'card_verification' => [:order_id, :cust_id, :pan, :expdate, :crypt_type, :avs_info, :cvd_info, :cof_info],
430
- 'transact' => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type],
431
- 'Batchcloseall' => [],
432
- 'opentotals' => [:ecr_number],
433
- 'batchclose' => [:ecr_number],
434
- 'res_add_cc' => [:pan, :expdate, :crypt_type, :avs_info, :cof_info],
435
- 'res_temp_add' => [:pan, :expdate, :crypt_type, :duration],
436
- 'res_delete' => [:data_key],
437
- 'res_update_cc' => [:data_key, :pan, :expdate, :crypt_type, :avs_info, :cof_info],
438
- 'res_purchase_cc' => [:data_key, :order_id, :cust_id, :amount, :crypt_type, :cof_info],
439
- 'res_preauth_cc' => [:data_key, :order_id, :cust_id, :amount, :crypt_type, :cof_info],
440
- 'res_card_verification_cc' => [:order_id, :data_key, :expdate, :crypt_type, :cof_info]
420
+ 'purchase' => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type, :avs_info, :cvd_info, :track2, :pos_code, :cof_info],
421
+ 'preauth' => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type, :avs_info, :cvd_info, :track2, :pos_code, :cof_info],
422
+ 'command' => [:order_id],
423
+ 'refund' => [:order_id, :amount, :txn_number, :crypt_type],
424
+ 'indrefund' => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type],
425
+ 'completion' => [:order_id, :comp_amount, :txn_number, :crypt_type],
426
+ 'purchasecorrection' => [:order_id, :txn_number, :crypt_type],
427
+ 'cavv_preauth' => [:order_id, :cust_id, :amount, :pan, :expdate, :cavv, :crypt_type, :wallet_indicator],
428
+ 'cavv_purchase' => [:order_id, :cust_id, :amount, :pan, :expdate, :cavv, :crypt_type, :wallet_indicator],
429
+ 'card_verification' => [:order_id, :cust_id, :pan, :expdate, :crypt_type, :avs_info, :cvd_info, :cof_info],
430
+ 'transact' => [:order_id, :cust_id, :amount, :pan, :expdate, :crypt_type],
431
+ 'Batchcloseall' => [],
432
+ 'opentotals' => [:ecr_number],
433
+ 'batchclose' => [:ecr_number],
434
+ 'res_add_cc' => [:pan, :expdate, :crypt_type, :avs_info, :cof_info],
435
+ 'res_temp_add' => [:pan, :expdate, :crypt_type, :duration],
436
+ 'res_delete' => [:data_key],
437
+ 'res_update_cc' => [:data_key, :pan, :expdate, :crypt_type, :avs_info, :cof_info],
438
+ 'res_purchase_cc' => [:data_key, :order_id, :cust_id, :amount, :crypt_type, :cof_info],
439
+ 'res_preauth_cc' => [:data_key, :order_id, :cust_id, :amount, :crypt_type, :cof_info],
440
+ 'res_card_verification_cc' => [:order_id, :data_key, :expdate, :crypt_type, :cof_info]
441
441
  }
442
442
  end
443
443
  end
@@ -220,9 +220,9 @@ module ActiveMerchant #:nodoc:
220
220
  msg = 'Invalid response received from the Openpay API. Please contact soporte@openpay.mx if you continue to receive this message.'
221
221
  msg += " (The raw response returned by the API was #{raw_response.inspect})"
222
222
  {
223
- 'category' => 'request',
224
- 'error_code' => '9999',
225
- 'description' => msg
223
+ 'category' => 'request',
224
+ 'error_code' => '9999',
225
+ 'description' => msg
226
226
  }
227
227
  end
228
228
  end
@@ -622,10 +622,10 @@ module ActiveMerchant #:nodoc:
622
622
 
623
623
  Response.new(success?(response, message_type), message_from(response), response,
624
624
  {
625
- :authorization => authorization_string(response[:tx_ref_num], response[:order_id]),
626
- :test => self.test?,
627
- :avs_result => OrbitalGateway::AVSResult.new(response[:avs_resp_code]),
628
- :cvv_result => OrbitalGateway::CVVResult.new(response[:cvv2_resp_code])
625
+ :authorization => authorization_string(response[:tx_ref_num], response[:order_id]),
626
+ :test => self.test?,
627
+ :avs_result => OrbitalGateway::AVSResult.new(response[:avs_resp_code]),
628
+ :cvv_result => OrbitalGateway::CVVResult.new(response[:cvv2_resp_code])
629
629
  }
630
630
  )
631
631
  end
@@ -897,54 +897,54 @@ module ActiveMerchant #:nodoc:
897
897
  #
898
898
  class AVSResult < ActiveMerchant::Billing::AVSResult
899
899
  CODES = {
900
- '1' => 'No address supplied',
901
- '2' => 'Bill-to address did not pass Auth Host edit checks',
902
- '3' => 'AVS not performed',
903
- '4' => 'Issuer does not participate in AVS',
904
- '5' => 'Edit-error - AVS data is invalid',
905
- '6' => 'System unavailable or time-out',
906
- '7' => 'Address information unavailable',
907
- '8' => 'Transaction Ineligible for AVS',
908
- '9' => 'Zip Match/Zip 4 Match/Locale match',
909
- 'A' => 'Zip Match/Zip 4 Match/Locale no match',
910
- 'B' => 'Zip Match/Zip 4 no Match/Locale match',
911
- 'C' => 'Zip Match/Zip 4 no Match/Locale no match',
912
- 'D' => 'Zip No Match/Zip 4 Match/Locale match',
913
- 'E' => 'Zip No Match/Zip 4 Match/Locale no match',
914
- 'F' => 'Zip No Match/Zip 4 No Match/Locale match',
915
- 'G' => 'No match at all',
916
- 'H' => 'Zip Match/Locale match',
917
- 'J' => 'Issuer does not participate in Global AVS',
918
- 'JA' => 'International street address and postal match',
919
- 'JB' => 'International street address match. Postal code not verified',
920
- 'JC' => 'International street address and postal code not verified',
921
- 'JD' => 'International postal code match. Street address not verified',
922
- 'M1' => 'Cardholder name matches',
923
- 'M2' => 'Cardholder name, billing address, and postal code matches',
924
- 'M3' => 'Cardholder name and billing code matches',
925
- 'M4' => 'Cardholder name and billing address match',
926
- 'M5' => 'Cardholder name incorrect, billing address and postal code match',
927
- 'M6' => 'Cardholder name incorrect, billing postal code matches',
928
- 'M7' => 'Cardholder name incorrect, billing address matches',
929
- 'M8' => 'Cardholder name, billing address and postal code are all incorrect',
930
- 'N3' => 'Address matches, ZIP not verified',
931
- 'N4' => 'Address and ZIP code not verified due to incompatible formats',
932
- 'N5' => 'Address and ZIP code match (International only)',
933
- 'N6' => 'Address not verified (International only)',
934
- 'N7' => 'ZIP matches, address not verified',
935
- 'N8' => 'Address and ZIP code match (International only)',
936
- 'N9' => 'Address and ZIP code match (UK only)',
937
- 'R' => 'Issuer does not participate in AVS',
938
- 'UK' => 'Unknown',
939
- 'X' => 'Zip Match/Zip 4 Match/Address Match',
940
- 'Z' => 'Zip Match/Locale no match',
900
+ '1' => 'No address supplied',
901
+ '2' => 'Bill-to address did not pass Auth Host edit checks',
902
+ '3' => 'AVS not performed',
903
+ '4' => 'Issuer does not participate in AVS',
904
+ '5' => 'Edit-error - AVS data is invalid',
905
+ '6' => 'System unavailable or time-out',
906
+ '7' => 'Address information unavailable',
907
+ '8' => 'Transaction Ineligible for AVS',
908
+ '9' => 'Zip Match/Zip 4 Match/Locale match',
909
+ 'A' => 'Zip Match/Zip 4 Match/Locale no match',
910
+ 'B' => 'Zip Match/Zip 4 no Match/Locale match',
911
+ 'C' => 'Zip Match/Zip 4 no Match/Locale no match',
912
+ 'D' => 'Zip No Match/Zip 4 Match/Locale match',
913
+ 'E' => 'Zip No Match/Zip 4 Match/Locale no match',
914
+ 'F' => 'Zip No Match/Zip 4 No Match/Locale match',
915
+ 'G' => 'No match at all',
916
+ 'H' => 'Zip Match/Locale match',
917
+ 'J' => 'Issuer does not participate in Global AVS',
918
+ 'JA' => 'International street address and postal match',
919
+ 'JB' => 'International street address match. Postal code not verified',
920
+ 'JC' => 'International street address and postal code not verified',
921
+ 'JD' => 'International postal code match. Street address not verified',
922
+ 'M1' => 'Cardholder name matches',
923
+ 'M2' => 'Cardholder name, billing address, and postal code matches',
924
+ 'M3' => 'Cardholder name and billing code matches',
925
+ 'M4' => 'Cardholder name and billing address match',
926
+ 'M5' => 'Cardholder name incorrect, billing address and postal code match',
927
+ 'M6' => 'Cardholder name incorrect, billing postal code matches',
928
+ 'M7' => 'Cardholder name incorrect, billing address matches',
929
+ 'M8' => 'Cardholder name, billing address and postal code are all incorrect',
930
+ 'N3' => 'Address matches, ZIP not verified',
931
+ 'N4' => 'Address and ZIP code not verified due to incompatible formats',
932
+ 'N5' => 'Address and ZIP code match (International only)',
933
+ 'N6' => 'Address not verified (International only)',
934
+ 'N7' => 'ZIP matches, address not verified',
935
+ 'N8' => 'Address and ZIP code match (International only)',
936
+ 'N9' => 'Address and ZIP code match (UK only)',
937
+ 'R' => 'Issuer does not participate in AVS',
938
+ 'UK' => 'Unknown',
939
+ 'X' => 'Zip Match/Zip 4 Match/Address Match',
940
+ 'Z' => 'Zip Match/Locale no match',
941
941
  }
942
942
 
943
943
  # Map vendor's AVS result code to a postal match code
944
944
  ORBITAL_POSTAL_MATCH_CODE = {
945
- 'Y' => %w(9 A B C H JA JD M2 M3 M5 N5 N8 N9 X Z),
946
- 'N' => %w(D E F G M8),
947
- 'X' => %w(4 J R),
945
+ 'Y' => %w(9 A B C H JA JD M2 M3 M5 N5 N8 N9 X Z),
946
+ 'N' => %w(D E F G M8),
947
+ 'X' => %w(4 J R),
948
948
  nil => %w(1 2 3 5 6 7 8 JB JC M1 M4 M6 M7 N3 N4 N6 N7 UK)
949
949
  }.inject({}) do |map, (type, codes)|
950
950
  codes.each { |code| map[code] = type }
@@ -953,9 +953,9 @@ module ActiveMerchant #:nodoc:
953
953
 
954
954
  # Map vendor's AVS result code to a street match code
955
955
  ORBITAL_STREET_MATCH_CODE = {
956
- 'Y' => %w(9 B D F H JA JB M2 M4 M5 M6 M7 N3 N5 N7 N8 N9 X),
957
- 'N' => %w(A C E G M8 Z),
958
- 'X' => %w(4 J R),
956
+ 'Y' => %w(9 B D F H JA JB M2 M4 M5 M6 M7 N3 N5 N7 N8 N9 X),
957
+ 'N' => %w(A C E G M8 Z),
958
+ 'X' => %w(4 J R),
959
959
  nil => %w(1 2 3 5 6 7 8 JC JD M1 M3 N4 N6 UK)
960
960
  }.inject({}) do |map, (type, codes)|
961
961
  codes.each { |code| map[code] = type }
@@ -126,9 +126,9 @@ module ActiveMerchant #:nodoc:
126
126
  :authorization => response['TrackingNumber'],
127
127
  :fraud_review => fraud_review?(response),
128
128
  :avs_result => {
129
- :postal_match => AVS_POSTAL_CODES[response['AVSPostalResponseCode']],
130
- :street_match => AVS_ADDRESS_CODES[response['AVSAddressResponseCode']]
131
- },
129
+ :postal_match => AVS_POSTAL_CODES[response['AVSPostalResponseCode']],
130
+ :street_match => AVS_ADDRESS_CODES[response['AVSAddressResponseCode']]
131
+ },
132
132
  :cvv_result => CVV2_CODES[response['CVV2ResponseCode']]
133
133
  )
134
134
  end
@@ -72,7 +72,7 @@ module ActiveMerchant #:nodoc:
72
72
 
73
73
  def capture(money, authorization, _options = {})
74
74
  post = {
75
- transaction: { id: authorization }
75
+ transaction: { id: authorization }
76
76
  }
77
77
  post[:order] = {amount: amount(money).to_f} if money
78
78
 
@@ -586,11 +586,11 @@ module ActiveMerchant #:nodoc:
586
586
  xml.tag! 'n2:OrderTotal', localized_amount(money, currency_code), 'currencyID' => currency_code
587
587
 
588
588
  # All of the values must be included together and add up to the order total
589
- if [:subtotal, :shipping, :handling, :tax].all?{ |o| options.has_key?(o) }
590
- xml.tag! 'n2:ItemTotal', localized_amount(options[:subtotal], currency_code), 'currencyID' => currency_code
591
- xml.tag! 'n2:ShippingTotal', localized_amount(options[:shipping], currency_code),'currencyID' => currency_code
592
- xml.tag! 'n2:HandlingTotal', localized_amount(options[:handling], currency_code),'currencyID' => currency_code
593
- xml.tag! 'n2:TaxTotal', localized_amount(options[:tax], currency_code), 'currencyID' => currency_code
589
+ if [:subtotal, :shipping, :handling, :tax].all?{ |o| options[o].present?}
590
+ xml.tag! 'n2:ItemTotal', localized_amount(options[:subtotal].to_i, currency_code), 'currencyID' => currency_code
591
+ xml.tag! 'n2:ShippingTotal', localized_amount(options[:shipping].to_i, currency_code),'currencyID' => currency_code
592
+ xml.tag! 'n2:HandlingTotal', localized_amount(options[:handling].to_i, currency_code),'currencyID' => currency_code
593
+ xml.tag! 'n2:TaxTotal', localized_amount(options[:tax].to_i, currency_code), 'currencyID' => currency_code
594
594
  end
595
595
 
596
596
  xml.tag! 'n2:InsuranceTotal', localized_amount(options[:insurance_total], currency_code),'currencyID' => currency_code unless options[:insurance_total].blank?
@@ -270,8 +270,10 @@ module ActiveMerchant #:nodoc:
270
270
  gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
271
271
  gsub(%r((%3CDS_MERCHANT_PAN%3E)\d+(%3C%2FDS_MERCHANT_PAN%3E))i, '\1[FILTERED]\2').
272
272
  gsub(%r((%3CDS_MERCHANT_CVV2%3E)\d+(%3C%2FDS_MERCHANT_CVV2%3E))i, '\1[FILTERED]\2').
273
+ gsub(%r((&lt;DS_MERCHANT_PAN&gt;)\d+(&lt;/DS_MERCHANT_PAN&gt;))i, '\1[FILTERED]\2').
273
274
  gsub(%r((<DS_MERCHANT_PAN>)\d+(</DS_MERCHANT_PAN>))i, '\1[FILTERED]\2').
274
275
  gsub(%r((<DS_MERCHANT_CVV2>)\d+(</DS_MERCHANT_CVV2>))i, '\1[FILTERED]\2').
276
+ gsub(%r((&lt;DS_MERCHANT_CVV2&gt;)\d+(&lt;/DS_MERCHANT_CVV2&gt;))i, '\1[FILTERED]\2').
275
277
  gsub(%r((DS_MERCHANT_CVV2)%2F%3E%0A%3C%2F)i, '\1[BLANK]').
276
278
  gsub(%r((DS_MERCHANT_CVV2)%2F%3E%3C)i, '\1[BLANK]').
277
279
  gsub(%r((DS_MERCHANT_CVV2%3E)(%3C%2FDS_MERCHANT_CVV2))i, '\1[BLANK]\2').
@@ -12,9 +12,9 @@ module ActiveMerchant #:nodoc:
12
12
  }
13
13
 
14
14
  XML_ATTRIBUTES = {
15
- 'xmlns' => 'http://gateway.securenet.com/API/Contracts',
16
- 'xmlns:i' => 'http://www.w3.org/2001/XMLSchema-instance'
17
- }
15
+ 'xmlns' => 'http://gateway.securenet.com/API/Contracts',
16
+ 'xmlns:i' => 'http://www.w3.org/2001/XMLSchema-instance'
17
+ }
18
18
  NIL_ATTRIBUTE = { 'i:nil' => 'true' }
19
19
 
20
20
  self.supported_countries = ['US']
@@ -172,12 +172,12 @@ module ActiveMerchant #:nodoc:
172
172
  retval = Builder::XmlMarkup.new(:indent => 2)
173
173
  retval.instruct!(:xml, :version => '1.0', :encoding => 'utf-8')
174
174
  retval.tag!('soap:Envelope', {
175
- 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
176
- 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
177
- 'xmlns:soapenc' => 'http://schemas.xmlsoap.org/soap/encoding/',
178
- 'xmlns:tns' => 'urn:Interface',
179
- 'xmlns:types' => 'urn:Interface/encodedTypes',
180
- 'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/'
175
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
176
+ 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
177
+ 'xmlns:soapenc' => 'http://schemas.xmlsoap.org/soap/encoding/',
178
+ 'xmlns:tns' => 'urn:Interface',
179
+ 'xmlns:types' => 'urn:Interface/encodedTypes',
180
+ 'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/'
181
181
  }) do
182
182
  retval.tag!('soap:Body', {'soap:encodingStyle'=>'http://schemas.xmlsoap.org/soap/encoding/'}) do
183
183
  retval.tag!("tns:#{request}") do
@@ -362,6 +362,7 @@ module ActiveMerchant #:nodoc:
362
362
  add_customer_data(post, options)
363
363
  post[:description] = options[:description]
364
364
  post[:statement_descriptor] = options[:statement_description]
365
+ post[:statement_descriptor_suffix] = options[:statement_descriptor_suffix] if options[:statement_descriptor_suffix]
365
366
  post[:receipt_email] = options[:receipt_email] if options[:receipt_email]
366
367
  add_customer(post, payment, options)
367
368
  add_flags(post, options)
@@ -372,6 +373,7 @@ module ActiveMerchant #:nodoc:
372
373
  add_exchange_rate(post, options)
373
374
  add_destination(post, options)
374
375
  add_level_three(post, options)
376
+ add_connected_account(post, options)
375
377
  post
376
378
  end
377
379
 
@@ -512,10 +514,7 @@ module ActiveMerchant #:nodoc:
512
514
  end
513
515
 
514
516
  def add_customer(post, payment, options)
515
- if options[:customer] && !payment.respond_to?(:number)
516
- ActiveMerchant.deprecated 'Passing the customer in the options is deprecated. Just use the response.authorization instead.'
517
- post[:customer] = options[:customer]
518
- end
517
+ post[:customer] = options[:customer] if options[:customer] && !payment.respond_to?(:number)
519
518
  end
520
519
 
521
520
  def add_flags(post, options)
@@ -555,6 +554,16 @@ module ActiveMerchant #:nodoc:
555
554
  end
556
555
  end
557
556
 
557
+ def add_connected_account(post, options = {})
558
+ return unless options[:transfer_destination]
559
+
560
+ post[:transfer_data] = { destination: options[:transfer_destination] }
561
+ post[:transfer_data][:amount] = options[:transfer_amount] if options[:transfer_amount]
562
+ post[:on_behalf_of] = options[:on_behalf_of] if options[:on_behalf_of]
563
+ post[:transfer_group] = options[:transfer_group] if options[:transfer_group]
564
+ post[:application_fee_amount] = options[:application_fee_amount] if options[:application_fee_amount]
565
+ end
566
+
558
567
  def parse(body)
559
568
  JSON.parse(body)
560
569
  end