activemerchant 1.113.0 → 1.119.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (201) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +114 -0
  3. data/README.md +1 -1
  4. data/lib/active_merchant.rb +1 -1
  5. data/lib/active_merchant/billing/avs_result.rb +1 -1
  6. data/lib/active_merchant/billing/compatibility.rb +3 -3
  7. data/lib/active_merchant/billing/credit_card.rb +3 -0
  8. data/lib/active_merchant/billing/credit_card_methods.rb +72 -13
  9. data/lib/active_merchant/billing/gateways/adyen.rb +24 -14
  10. data/lib/active_merchant/billing/gateways/allied_wallet.rb +7 -7
  11. data/lib/active_merchant/billing/gateways/authorize_net.rb +44 -12
  12. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -4
  13. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +2 -1
  14. data/lib/active_merchant/billing/gateways/axcessms.rb +8 -9
  15. data/lib/active_merchant/billing/gateways/balanced.rb +4 -3
  16. data/lib/active_merchant/billing/gateways/bambora_apac.rb +7 -7
  17. data/lib/active_merchant/billing/gateways/bank_frick.rb +7 -7
  18. data/lib/active_merchant/billing/gateways/banwire.rb +1 -1
  19. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +6 -4
  20. data/lib/active_merchant/billing/gateways/beanstream.rb +3 -3
  21. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +4 -5
  22. data/lib/active_merchant/billing/gateways/blue_pay.rb +2 -3
  23. data/lib/active_merchant/billing/gateways/blue_snap.rb +37 -12
  24. data/lib/active_merchant/billing/gateways/bogus.rb +19 -19
  25. data/lib/active_merchant/billing/gateways/borgun.rb +11 -11
  26. data/lib/active_merchant/billing/gateways/bpoint.rb +8 -8
  27. data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
  28. data/lib/active_merchant/billing/gateways/braintree_blue.rb +13 -10
  29. data/lib/active_merchant/billing/gateways/bridge_pay.rb +7 -7
  30. data/lib/active_merchant/billing/gateways/cams.rb +8 -8
  31. data/lib/active_merchant/billing/gateways/card_connect.rb +1 -1
  32. data/lib/active_merchant/billing/gateways/card_save.rb +1 -1
  33. data/lib/active_merchant/billing/gateways/card_stream.rb +2 -2
  34. data/lib/active_merchant/billing/gateways/cardknox.rb +7 -7
  35. data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
  36. data/lib/active_merchant/billing/gateways/cecabank.rb +5 -5
  37. data/lib/active_merchant/billing/gateways/cenpos.rb +10 -10
  38. data/lib/active_merchant/billing/gateways/checkout.rb +2 -2
  39. data/lib/active_merchant/billing/gateways/checkout_v2.rb +17 -20
  40. data/lib/active_merchant/billing/gateways/clearhaus.rb +7 -7
  41. data/lib/active_merchant/billing/gateways/commercegate.rb +1 -1
  42. data/lib/active_merchant/billing/gateways/conekta.rb +2 -2
  43. data/lib/active_merchant/billing/gateways/creditcall.rb +10 -10
  44. data/lib/active_merchant/billing/gateways/credorax.rb +26 -15
  45. data/lib/active_merchant/billing/gateways/ct_payment.rb +10 -10
  46. data/lib/active_merchant/billing/gateways/culqi.rb +9 -9
  47. data/lib/active_merchant/billing/gateways/cyber_source.rb +58 -36
  48. data/lib/active_merchant/billing/gateways/d_local.rb +11 -11
  49. data/lib/active_merchant/billing/gateways/data_cash.rb +2 -3
  50. data/lib/active_merchant/billing/gateways/decidir.rb +31 -10
  51. data/lib/active_merchant/billing/gateways/dibs.rb +8 -8
  52. data/lib/active_merchant/billing/gateways/digitzs.rb +5 -5
  53. data/lib/active_merchant/billing/gateways/ebanx.rb +9 -9
  54. data/lib/active_merchant/billing/gateways/efsnet.rb +2 -3
  55. data/lib/active_merchant/billing/gateways/elavon.rb +286 -225
  56. data/lib/active_merchant/billing/gateways/element.rb +8 -8
  57. data/lib/active_merchant/billing/gateways/evo_ca.rb +5 -6
  58. data/lib/active_merchant/billing/gateways/eway.rb +3 -4
  59. data/lib/active_merchant/billing/gateways/eway_managed.rb +6 -7
  60. data/lib/active_merchant/billing/gateways/eway_rapid.rb +19 -6
  61. data/lib/active_merchant/billing/gateways/exact.rb +8 -9
  62. data/lib/active_merchant/billing/gateways/ezic.rb +7 -7
  63. data/lib/active_merchant/billing/gateways/fat_zebra.rb +4 -4
  64. data/lib/active_merchant/billing/gateways/federated_canada.rb +2 -3
  65. data/lib/active_merchant/billing/gateways/first_giving.rb +1 -1
  66. data/lib/active_merchant/billing/gateways/first_pay.rb +6 -6
  67. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +7 -7
  68. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +21 -10
  69. data/lib/active_merchant/billing/gateways/flo2cash.rb +8 -8
  70. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
  71. data/lib/active_merchant/billing/gateways/forte.rb +14 -8
  72. data/lib/active_merchant/billing/gateways/global_collect.rb +35 -16
  73. data/lib/active_merchant/billing/gateways/global_transport.rb +7 -7
  74. data/lib/active_merchant/billing/gateways/hdfc.rb +9 -9
  75. data/lib/active_merchant/billing/gateways/hps.rb +17 -8
  76. data/lib/active_merchant/billing/gateways/iats_payments.rb +9 -4
  77. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
  78. data/lib/active_merchant/billing/gateways/inspire.rb +3 -4
  79. data/lib/active_merchant/billing/gateways/instapay.rb +1 -2
  80. data/lib/active_merchant/billing/gateways/ipp.rb +5 -5
  81. data/lib/active_merchant/billing/gateways/iridium.rb +14 -15
  82. data/lib/active_merchant/billing/gateways/iveri.rb +7 -7
  83. data/lib/active_merchant/billing/gateways/ixopay.rb +7 -7
  84. data/lib/active_merchant/billing/gateways/jetpay.rb +1 -2
  85. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +4 -5
  86. data/lib/active_merchant/billing/gateways/kushki.rb +6 -6
  87. data/lib/active_merchant/billing/gateways/latitude19.rb +14 -14
  88. data/lib/active_merchant/billing/gateways/linkpoint.rb +4 -5
  89. data/lib/active_merchant/billing/gateways/litle.rb +31 -15
  90. data/lib/active_merchant/billing/gateways/mastercard.rb +10 -10
  91. data/lib/active_merchant/billing/gateways/mercado_pago.rb +7 -7
  92. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +1 -2
  93. data/lib/active_merchant/billing/gateways/merchant_one.rb +1 -1
  94. data/lib/active_merchant/billing/gateways/merchant_partners.rb +10 -10
  95. data/lib/active_merchant/billing/gateways/merchant_ware.rb +5 -7
  96. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +4 -6
  97. data/lib/active_merchant/billing/gateways/mercury.rb +4 -4
  98. data/lib/active_merchant/billing/gateways/metrics_global.rb +4 -5
  99. data/lib/active_merchant/billing/gateways/micropayment.rb +8 -8
  100. data/lib/active_merchant/billing/gateways/migs.rb +3 -4
  101. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +2 -4
  102. data/lib/active_merchant/billing/gateways/monei.rb +7 -7
  103. data/lib/active_merchant/billing/gateways/moneris.rb +4 -3
  104. data/lib/active_merchant/billing/gateways/money_movers.rb +2 -3
  105. data/lib/active_merchant/billing/gateways/mundipagg.rb +37 -10
  106. data/lib/active_merchant/billing/gateways/nab_transact.rb +2 -4
  107. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +7 -7
  108. data/lib/active_merchant/billing/gateways/net_registry.rb +1 -2
  109. data/lib/active_merchant/billing/gateways/netaxept.rb +6 -6
  110. data/lib/active_merchant/billing/gateways/netbanx.rb +19 -8
  111. data/lib/active_merchant/billing/gateways/netbilling.rb +4 -5
  112. data/lib/active_merchant/billing/gateways/network_merchants.rb +2 -3
  113. data/lib/active_merchant/billing/gateways/nmi.rb +21 -7
  114. data/lib/active_merchant/billing/gateways/ogone.rb +3 -3
  115. data/lib/active_merchant/billing/gateways/omise.rb +13 -13
  116. data/lib/active_merchant/billing/gateways/openpay.rb +3 -4
  117. data/lib/active_merchant/billing/gateways/opp.rb +9 -9
  118. data/lib/active_merchant/billing/gateways/optimal_payment.rb +2 -3
  119. data/lib/active_merchant/billing/gateways/orbital.rb +196 -85
  120. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +3 -4
  121. data/lib/active_merchant/billing/gateways/pagarme.rb +8 -8
  122. data/lib/active_merchant/billing/gateways/pago_facil.rb +2 -2
  123. data/lib/active_merchant/billing/gateways/pay_conex.rb +8 -8
  124. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +6 -7
  125. data/lib/active_merchant/billing/gateways/pay_hub.rb +7 -8
  126. data/lib/active_merchant/billing/gateways/pay_junction.rb +2 -3
  127. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +9 -9
  128. data/lib/active_merchant/billing/gateways/pay_secure.rb +2 -3
  129. data/lib/active_merchant/billing/gateways/paybox_direct.rb +23 -1
  130. data/lib/active_merchant/billing/gateways/payeezy.rb +32 -14
  131. data/lib/active_merchant/billing/gateways/payex.rb +6 -7
  132. data/lib/active_merchant/billing/gateways/payflow.rb +1 -1
  133. data/lib/active_merchant/billing/gateways/payment_express.rb +8 -4
  134. data/lib/active_merchant/billing/gateways/paymentez.rb +26 -6
  135. data/lib/active_merchant/billing/gateways/paymill.rb +7 -7
  136. data/lib/active_merchant/billing/gateways/paypal.rb +10 -2
  137. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +1 -0
  138. data/lib/active_merchant/billing/gateways/paypal_express.rb +1 -1
  139. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
  140. data/lib/active_merchant/billing/gateways/payscout.rb +1 -2
  141. data/lib/active_merchant/billing/gateways/paystation.rb +3 -4
  142. data/lib/active_merchant/billing/gateways/payu_in.rb +3 -3
  143. data/lib/active_merchant/billing/gateways/payu_latam.rb +17 -10
  144. data/lib/active_merchant/billing/gateways/payway.rb +8 -9
  145. data/lib/active_merchant/billing/gateways/pin.rb +11 -0
  146. data/lib/active_merchant/billing/gateways/plugnpay.rb +1 -2
  147. data/lib/active_merchant/billing/gateways/pro_pay.rb +8 -8
  148. data/lib/active_merchant/billing/gateways/psigate.rb +2 -3
  149. data/lib/active_merchant/billing/gateways/psl_card.rb +1 -2
  150. data/lib/active_merchant/billing/gateways/qbms.rb +1 -2
  151. data/lib/active_merchant/billing/gateways/quantum.rb +1 -2
  152. data/lib/active_merchant/billing/gateways/quickbooks.rb +1 -1
  153. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +3 -4
  154. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -2
  155. data/lib/active_merchant/billing/gateways/qvalent.rb +8 -8
  156. data/lib/active_merchant/billing/gateways/realex.rb +1 -1
  157. data/lib/active_merchant/billing/gateways/redsys.rb +86 -5
  158. data/lib/active_merchant/billing/gateways/s5.rb +7 -7
  159. data/lib/active_merchant/billing/gateways/safe_charge.rb +40 -14
  160. data/lib/active_merchant/billing/gateways/sage.rb +3 -5
  161. data/lib/active_merchant/billing/gateways/sage_pay.rb +2 -3
  162. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
  163. data/lib/active_merchant/billing/gateways/secure_net.rb +1 -2
  164. data/lib/active_merchant/billing/gateways/secure_pay.rb +3 -4
  165. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +2 -4
  166. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -2
  167. data/lib/active_merchant/billing/gateways/securion_pay.rb +5 -6
  168. data/lib/active_merchant/billing/gateways/skip_jack.rb +2 -3
  169. data/lib/active_merchant/billing/gateways/smart_ps.rb +5 -6
  170. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +7 -7
  171. data/lib/active_merchant/billing/gateways/spreedly_core.rb +6 -6
  172. data/lib/active_merchant/billing/gateways/stripe.rb +10 -10
  173. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +30 -0
  174. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +3 -4
  175. data/lib/active_merchant/billing/gateways/telr.rb +8 -8
  176. data/lib/active_merchant/billing/gateways/trans_first.rb +2 -2
  177. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +12 -12
  178. data/lib/active_merchant/billing/gateways/transact_pro.rb +9 -9
  179. data/lib/active_merchant/billing/gateways/trust_commerce.rb +1 -2
  180. data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -1
  181. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +32 -32
  182. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +3 -4
  183. data/lib/active_merchant/billing/gateways/vanco.rb +3 -3
  184. data/lib/active_merchant/billing/gateways/verifi.rb +1 -2
  185. data/lib/active_merchant/billing/gateways/viaklix.rb +1 -2
  186. data/lib/active_merchant/billing/gateways/visanet_peru.rb +10 -10
  187. data/lib/active_merchant/billing/gateways/webpay.rb +2 -2
  188. data/lib/active_merchant/billing/gateways/wepay.rb +3 -2
  189. data/lib/active_merchant/billing/gateways/wirecard.rb +1 -2
  190. data/lib/active_merchant/billing/gateways/worldpay.rb +19 -11
  191. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +14 -16
  192. data/lib/active_merchant/billing/gateways/worldpay_us.rb +7 -7
  193. data/lib/active_merchant/billing/response.rb +3 -2
  194. data/lib/active_merchant/country.rb +1 -1
  195. data/lib/active_merchant/network_connection_retries.rb +2 -2
  196. data/lib/active_merchant/post_data.rb +1 -1
  197. data/lib/active_merchant/posts_data.rb +1 -1
  198. data/lib/active_merchant/version.rb +1 -1
  199. data/lib/support/ssl_verify.rb +2 -2
  200. data/lib/support/ssl_version.rb +2 -2
  201. metadata +2 -2
@@ -22,12 +22,12 @@ module ActiveMerchant #:nodoc:
22
22
  'store' => 'CC.RG'
23
23
  }
24
24
 
25
- def initialize(options={})
25
+ def initialize(options = {})
26
26
  requires!(options, :sender, :channel, :login, :password)
27
27
  super
28
28
  end
29
29
 
30
- def purchase(money, payment, options={})
30
+ def purchase(money, payment, options = {})
31
31
  request = build_xml_request do |xml|
32
32
  add_identification(xml, options)
33
33
  add_payment(xml, money, 'sale', options)
@@ -39,7 +39,7 @@ module ActiveMerchant #:nodoc:
39
39
  commit(request)
40
40
  end
41
41
 
42
- def refund(money, authorization, options={})
42
+ def refund(money, authorization, options = {})
43
43
  request = build_xml_request do |xml|
44
44
  add_identification(xml, options, authorization)
45
45
  add_payment(xml, money, 'refund', options)
@@ -48,7 +48,7 @@ module ActiveMerchant #:nodoc:
48
48
  commit(request)
49
49
  end
50
50
 
51
- def authorize(money, payment, options={})
51
+ def authorize(money, payment, options = {})
52
52
  request = build_xml_request do |xml|
53
53
  add_identification(xml, options)
54
54
  add_payment(xml, money, 'authonly', options)
@@ -60,7 +60,7 @@ module ActiveMerchant #:nodoc:
60
60
  commit(request)
61
61
  end
62
62
 
63
- def capture(money, authorization, options={})
63
+ def capture(money, authorization, options = {})
64
64
  request = build_xml_request do |xml|
65
65
  add_identification(xml, options, authorization)
66
66
  add_payment(xml, money, 'capture', options)
@@ -69,7 +69,7 @@ module ActiveMerchant #:nodoc:
69
69
  commit(request)
70
70
  end
71
71
 
72
- def void(authorization, options={})
72
+ def void(authorization, options = {})
73
73
  request = build_xml_request do |xml|
74
74
  add_identification(xml, options, authorization)
75
75
  add_payment(xml, nil, 'void', options)
@@ -89,7 +89,7 @@ module ActiveMerchant #:nodoc:
89
89
  commit(request)
90
90
  end
91
91
 
92
- def verify(credit_card, options={})
92
+ def verify(credit_card, options = {})
93
93
  MultiResponse.run(:use_first_response) do |r|
94
94
  r.process { authorize(100, credit_card, options) }
95
95
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -15,15 +15,26 @@ module ActiveMerchant #:nodoc:
15
15
 
16
16
  VERSION = '4.1.0'
17
17
 
18
- def initialize(options={})
18
+ def initialize(options = {})
19
19
  requires!(options, :client_login_id, :client_password)
20
20
  super
21
21
  end
22
22
 
23
- def purchase(money, payment, options={})
23
+ def purchase(money, payment, options = {})
24
24
  post = {}
25
- post[:sg_APIType] = 1 if options[:three_d_secure]
26
- trans_type = options[:three_d_secure] ? 'Sale3D' : 'Sale'
25
+
26
+ # Determine if 3DS is requested, or there is standard external MPI data
27
+ if options[:three_d_secure]
28
+ if options[:three_d_secure].is_a?(Hash)
29
+ add_external_mpi_data(post, options)
30
+ else
31
+ post[:sg_APIType] = 1
32
+ trans_type = 'Sale3D'
33
+ end
34
+ end
35
+
36
+ trans_type ||= 'Sale'
37
+
27
38
  add_transaction_data(trans_type, post, money, options)
28
39
  add_payment(post, payment, options)
29
40
  add_customer_details(post, payment, options)
@@ -31,8 +42,10 @@ module ActiveMerchant #:nodoc:
31
42
  commit(post)
32
43
  end
33
44
 
34
- def authorize(money, payment, options={})
45
+ def authorize(money, payment, options = {})
35
46
  post = {}
47
+
48
+ add_external_mpi_data(post, options) if options[:three_d_secure]&.is_a?(Hash)
36
49
  add_transaction_data('Auth', post, money, options)
37
50
  add_payment(post, payment, options)
38
51
  add_customer_details(post, payment, options)
@@ -40,10 +53,10 @@ module ActiveMerchant #:nodoc:
40
53
  commit(post)
41
54
  end
42
55
 
43
- def capture(money, authorization, options={})
56
+ def capture(money, authorization, options = {})
44
57
  post = {}
45
58
  auth, transaction_id, token, exp_month, exp_year, _, original_currency = authorization.split('|')
46
- add_transaction_data('Settle', post, money, options.merge!({currency: original_currency}))
59
+ add_transaction_data('Settle', post, money, options.merge!({ currency: original_currency }))
47
60
  post[:sg_AuthCode] = auth
48
61
  post[:sg_TransactionID] = transaction_id
49
62
  post[:sg_CCToken] = token
@@ -53,10 +66,10 @@ module ActiveMerchant #:nodoc:
53
66
  commit(post)
54
67
  end
55
68
 
56
- def refund(money, authorization, options={})
69
+ def refund(money, authorization, options = {})
57
70
  post = {}
58
71
  auth, transaction_id, token, exp_month, exp_year, _, original_currency = authorization.split('|')
59
- add_transaction_data('Credit', post, money, options.merge!({currency: original_currency}))
72
+ add_transaction_data('Credit', post, money, options.merge!({ currency: original_currency }))
60
73
  post[:sg_CreditType] = 2
61
74
  post[:sg_AuthCode] = auth
62
75
  post[:sg_TransactionID] = transaction_id
@@ -67,19 +80,21 @@ module ActiveMerchant #:nodoc:
67
80
  commit(post)
68
81
  end
69
82
 
70
- def credit(money, payment, options={})
83
+ def credit(money, payment, options = {})
71
84
  post = {}
85
+
72
86
  add_payment(post, payment, options)
73
87
  add_transaction_data('Credit', post, money, options)
88
+
74
89
  post[:sg_CreditType] = 1
75
90
 
76
91
  commit(post)
77
92
  end
78
93
 
79
- def void(authorization, options={})
94
+ def void(authorization, options = {})
80
95
  post = {}
81
96
  auth, transaction_id, token, exp_month, exp_year, original_amount, original_currency = authorization.split('|')
82
- add_transaction_data('Void', post, (original_amount.to_f * 100), options.merge!({currency: original_currency}))
97
+ add_transaction_data('Void', post, (original_amount.to_f * 100), options.merge!({ currency: original_currency }))
83
98
  post[:sg_CreditType] = 2
84
99
  post[:sg_AuthCode] = auth
85
100
  post[:sg_TransactionID] = transaction_id
@@ -90,7 +105,7 @@ module ActiveMerchant #:nodoc:
90
105
  commit(post)
91
106
  end
92
107
 
93
- def verify(credit_card, options={})
108
+ def verify(credit_card, options = {})
94
109
  MultiResponse.run(:use_first_response) do |r|
95
110
  r.process { authorize(100, credit_card, options) }
96
111
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -130,7 +145,7 @@ module ActiveMerchant #:nodoc:
130
145
  post[:sg_MerchantName] = options[:merchant_name] if options[:merchant_name]
131
146
  end
132
147
 
133
- def add_payment(post, payment, options={})
148
+ def add_payment(post, payment, options = {})
134
149
  post[:sg_NameOnCard] = payment.name
135
150
  post[:sg_CardNumber] = payment.number
136
151
  post[:sg_ExpMonth] = format(payment.month, :two_digits)
@@ -154,6 +169,17 @@ module ActiveMerchant #:nodoc:
154
169
  post[:sg_Email] = options[:email]
155
170
  end
156
171
 
172
+ def add_external_mpi_data(post, options)
173
+ version = options[:three_d_secure][:ds_transaction_id] ? '2' : '1'
174
+
175
+ post[:sg_eci] = options[:three_d_secure][:eci] if options[:three_d_secure][:eci]
176
+ post[:sg_cavv] = options[:three_d_secure][:cavv] if options[:three_d_secure][:cavv]
177
+ post[:sg_dsTransID] = options[:three_d_secure][:ds_transaction_id] if version == '2'
178
+ post[:sg_threeDSProtocolVersion] = version
179
+ post[:sg_xid] = options[:three_d_secure][:xid] if version == '1'
180
+ post[:sg_IsExternalMPI] = 1
181
+ end
182
+
157
183
  def parse(xml)
158
184
  response = {}
159
185
 
@@ -77,7 +77,7 @@ module ActiveMerchant #:nodoc:
77
77
  commit(:credit, post, source)
78
78
  end
79
79
 
80
- def refund(money, reference, options={})
80
+ def refund(money, reference, options = {})
81
81
  post = {}
82
82
  add_reference(post, reference)
83
83
  add_transaction_data(post, money, options)
@@ -264,8 +264,7 @@ module ActiveMerchant #:nodoc:
264
264
  test: test?,
265
265
  authorization: authorization_from(response, source),
266
266
  avs_result: { code: response[:avs_result] },
267
- cvv_result: response[:cvv_result]
268
- )
267
+ cvv_result: response[:cvv_result])
269
268
  end
270
269
 
271
270
  def url(params, source)
@@ -382,8 +381,7 @@ module ActiveMerchant #:nodoc:
382
381
  end
383
382
 
384
383
  Response.new(success, message, response,
385
- authorization: response[:guid]
386
- )
384
+ authorization: response[:guid])
387
385
  end
388
386
 
389
387
  ENVELOPE_NAMESPACES = {
@@ -162,7 +162,7 @@ module ActiveMerchant #:nodoc:
162
162
  commit(:unstore, post)
163
163
  end
164
164
 
165
- def verify(credit_card, options={})
165
+ def verify(credit_card, options = {})
166
166
  MultiResponse.run(:use_first_response) do |r|
167
167
  r.process { authorize(100, credit_card, options) }
168
168
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -353,8 +353,7 @@ module ActiveMerchant #:nodoc:
353
353
  street_match: AVS_CODE[response['AddressResult']],
354
354
  postal_match: AVS_CODE[response['PostCodeResult']]
355
355
  },
356
- cvv_result: CVV_CODE[response['CV2Result']]
357
- )
356
+ cvv_result: CVV_CODE[response['CV2Result']])
358
357
  end
359
358
 
360
359
  def authorization_from(response, params, action)
@@ -122,8 +122,7 @@ module ActiveMerchant #:nodoc:
122
122
  response = parse(ssl_post(self.live_url, parameters.to_post_data) || '')
123
123
  Response.new(successful?(response), message_from(response), response,
124
124
  test: test?,
125
- authorization: response['refcode']
126
- )
125
+ authorization: response['refcode'])
127
126
  end
128
127
 
129
128
  def successful?(response)
@@ -83,8 +83,7 @@ module ActiveMerchant #:nodoc:
83
83
  test: test?,
84
84
  authorization: build_authorization(response),
85
85
  avs_result: { code: response[:avs_result_code] },
86
- cvv_result: response[:card_code_response_code]
87
- )
86
+ cvv_result: response[:card_code_response_code])
88
87
  end
89
88
 
90
89
  def build_request(request)
@@ -61,8 +61,7 @@ module ActiveMerchant #:nodoc:
61
61
  authorization: response[:transaction_id],
62
62
  fraud_review: fraud_review?(response),
63
63
  avs_result: { code: response[:avs_result_code] },
64
- cvv_result: response[:card_code]
65
- )
64
+ cvv_result: response[:card_code])
66
65
  end
67
66
 
68
67
  def success?(response)
@@ -115,7 +114,7 @@ module ActiveMerchant #:nodoc:
115
114
  post[:description] = options[:description]
116
115
  end
117
116
 
118
- def add_creditcard(post, creditcard, options={})
117
+ def add_creditcard(post, creditcard, options = {})
119
118
  post[:card_num] = creditcard.number
120
119
  post[:card_code] = creditcard.verification_value if creditcard.verification_value?
121
120
  post[:exp_date] = expdate(creditcard)
@@ -123,7 +122,7 @@ module ActiveMerchant #:nodoc:
123
122
  post[:last_name] = creditcard.last_name
124
123
  end
125
124
 
126
- def add_payment_source(params, source, options={})
125
+ def add_payment_source(params, source, options = {})
127
126
  add_creditcard(params, source, options)
128
127
  end
129
128
 
@@ -185,8 +185,7 @@ module ActiveMerchant #:nodoc:
185
185
 
186
186
  Response.new(success?(response), message_from(response), response,
187
187
  test: test?,
188
- authorization: authorization_from(response)
189
- )
188
+ authorization: authorization_from(response))
190
189
  end
191
190
 
192
191
  def build_periodic_item(action, money, credit_card, options)
@@ -242,8 +241,7 @@ module ActiveMerchant #:nodoc:
242
241
 
243
242
  Response.new(success?(response), message_from(response), response,
244
243
  test: test?,
245
- authorization: authorization_from(response)
246
- )
244
+ authorization: authorization_from(response))
247
245
  end
248
246
 
249
247
  def success?(response)
@@ -86,8 +86,7 @@ module ActiveMerchant #:nodoc:
86
86
 
87
87
  Response.new(response[:result_code] == 1, message_from(response), response,
88
88
  test: test?,
89
- authorization: response[:merchant_transaction_reference]
90
- )
89
+ authorization: response[:merchant_transaction_reference])
91
90
  end
92
91
 
93
92
  def message_from(result)
@@ -31,17 +31,17 @@ module ActiveMerchant #:nodoc:
31
31
  'expired_token' => STANDARD_ERROR_CODE[:card_declined]
32
32
  }
33
33
 
34
- def initialize(options={})
34
+ def initialize(options = {})
35
35
  requires!(options, :secret_key)
36
36
  super
37
37
  end
38
38
 
39
- def purchase(money, payment, options={})
39
+ def purchase(money, payment, options = {})
40
40
  post = create_post_for_auth_or_purchase(money, payment, options)
41
41
  commit('charges', post, options)
42
42
  end
43
43
 
44
- def authorize(money, payment, options={})
44
+ def authorize(money, payment, options = {})
45
45
  post = create_post_for_auth_or_purchase(money, payment, options)
46
46
  post[:captured] = 'false'
47
47
  commit('charges', post, options)
@@ -63,7 +63,7 @@ module ActiveMerchant #:nodoc:
63
63
  commit("charges/#{CGI.escape(authorization)}/refund", {}, options)
64
64
  end
65
65
 
66
- def verify(credit_card, options={})
66
+ def verify(credit_card, options = {})
67
67
  MultiResponse.run(:use_first_response) do |r|
68
68
  r.process { authorize(100, credit_card, options) }
69
69
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -190,8 +190,7 @@ module ActiveMerchant #:nodoc:
190
190
  response,
191
191
  test: test?,
192
192
  authorization: (success ? response['id'] : response['error']['charge']),
193
- error_code: (success ? nil : STANDARD_ERROR_CODE_MAPPING[response['error']['code']])
194
- )
193
+ error_code: (success ? nil : STANDARD_ERROR_CODE_MAPPING[response['error']['code']]))
195
194
  end
196
195
 
197
196
  def headers(options = {})
@@ -213,7 +213,7 @@ module ActiveMerchant #:nodoc:
213
213
  #
214
214
  # * <tt>:force_settlement</tt> -- Force the settlement to occur as soon as possible. This option is not supported by other gateways. See the SkipJack API reference for more details
215
215
  def capture(money, authorization, options = {})
216
- post = { }
216
+ post = {}
217
217
  add_status_action(post, 'SETTLE')
218
218
  add_forced_settlement(post, options)
219
219
  add_transaction_id(post, authorization)
@@ -267,8 +267,7 @@ module ActiveMerchant #:nodoc:
267
267
  test: test?,
268
268
  authorization: response[:szTransactionFileName] || parameters[:szTransactionId],
269
269
  avs_result: { code: response[:szAVSResponseCode] },
270
- cvv_result: response[:szCVV2ResponseCode]
271
- )
270
+ cvv_result: response[:szCVV2ResponseCode])
272
271
  end
273
272
 
274
273
  def url_for(action)
@@ -123,7 +123,7 @@ module ActiveMerchant #:nodoc:
123
123
  commit(nil, nil, post)
124
124
  end
125
125
 
126
- alias_method :unstore, :delete
126
+ alias unstore delete
127
127
 
128
128
  private
129
129
 
@@ -133,9 +133,9 @@ module ActiveMerchant #:nodoc:
133
133
  post[:ipaddress] = options[:ip] if options.has_key? :ip
134
134
  end
135
135
 
136
- def add_address(post, address, prefix='')
136
+ def add_address(post, address, prefix = '')
137
137
  prefix += '_' unless prefix.blank?
138
- unless address.blank? or address.values.blank?
138
+ unless address.blank? || address.values.blank?
139
139
  post[prefix + 'address1'] = address[:address1].to_s
140
140
  post[prefix + 'address2'] = address[:address2].to_s unless address[:address2].blank?
141
141
  post[prefix + 'company'] = address[:company].to_s
@@ -163,7 +163,7 @@ module ActiveMerchant #:nodoc:
163
163
  post[:orderid] = options[:order_id].to_s.gsub(/[^\w.]/, '')
164
164
  end
165
165
 
166
- def add_payment_source(params, source, options={})
166
+ def add_payment_source(params, source, options = {})
167
167
  case determine_funding_source(source)
168
168
  when :vault then add_customer_vault_id(params, source)
169
169
  when :credit_card then add_creditcard(params, source, options)
@@ -230,8 +230,7 @@ module ActiveMerchant #:nodoc:
230
230
  authorization: (response['transactionid'] || response['customer_vault_id']),
231
231
  test: test?,
232
232
  cvv_result: response['cvvresponse'],
233
- avs_result: { code: response['avsresponse'] }
234
- )
233
+ avs_result: { code: response['avsresponse'] })
235
234
  end
236
235
 
237
236
  def expdate(creditcard)
@@ -39,11 +39,11 @@ module ActiveMerchant #:nodoc:
39
39
  commit('CaptureTransaction', do_capture(money, authorization, options), options)
40
40
  end
41
41
 
42
- def refund(money, authorization, options={})
42
+ def refund(money, authorization, options = {})
43
43
  commit('RefundTransaction', do_refund(money, authorization, options), options)
44
44
  end
45
45
 
46
- def void(authorization, options={})
46
+ def void(authorization, options = {})
47
47
  commit('CancelTransaction', do_void(authorization, options), options)
48
48
  end
49
49
 
@@ -139,7 +139,7 @@ module ActiveMerchant #:nodoc:
139
139
  soap.tag!('cardExpireYear', card.year.to_s)
140
140
  end
141
141
 
142
- def fill_order_info(soap, money, options, skip_currency=false)
142
+ def fill_order_info(soap, money, options, skip_currency = false)
143
143
  soap.tag!('orderID', options[:order_id].to_s)
144
144
  soap.tag!('orderDescription', "Order #{options[:order_id]}")
145
145
  soap.tag!('amount', amount(money).to_s)
@@ -157,8 +157,8 @@ module ActiveMerchant #:nodoc:
157
157
  end
158
158
 
159
159
  def commit(soap_action, soap, options)
160
- headers = {'SOAPAction' => "\"urn:Interface##{soap_action}\"",
161
- 'Content-Type' => 'text/xml; charset=utf-8'}
160
+ headers = { 'SOAPAction' => "\"urn:Interface##{soap_action}\"",
161
+ 'Content-Type' => 'text/xml; charset=utf-8' }
162
162
  response_string = ssl_post(test? ? self.test_url : self.live_url, soap, headers)
163
163
  response = parse(response_string, soap_action)
164
164
  return Response.new(response['errorcode'] == '000',
@@ -179,9 +179,9 @@ module ActiveMerchant #:nodoc:
179
179
  'xmlns:types' => 'urn:Interface/encodedTypes',
180
180
  'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/'
181
181
  }) do
182
- retval.tag!('soap:Body', {'soap:encodingStyle' => 'http://schemas.xmlsoap.org/soap/encoding/'}) do
182
+ retval.tag!('soap:Body', { 'soap:encodingStyle' => 'http://schemas.xmlsoap.org/soap/encoding/' }) do
183
183
  retval.tag!("tns:#{request}") do
184
- retval.tag!("#{request}Request", {'xsi:type' => "tns:#{request}Request"}) do
184
+ retval.tag!("#{request}Request", { 'xsi:type' => "tns:#{request}Request" }) do
185
185
  yield retval
186
186
  end
187
187
  end