activemerchant 1.112.0 → 1.118.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (204) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +115 -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 -1
  8. data/lib/active_merchant/billing/credit_card_methods.rb +58 -11
  9. data/lib/active_merchant/billing/gateway.rb +1 -1
  10. data/lib/active_merchant/billing/gateways/adyen.rb +26 -16
  11. data/lib/active_merchant/billing/gateways/allied_wallet.rb +7 -7
  12. data/lib/active_merchant/billing/gateways/authorize_net.rb +50 -18
  13. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -4
  14. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +3 -2
  15. data/lib/active_merchant/billing/gateways/axcessms.rb +8 -9
  16. data/lib/active_merchant/billing/gateways/balanced.rb +5 -4
  17. data/lib/active_merchant/billing/gateways/bambora_apac.rb +8 -8
  18. data/lib/active_merchant/billing/gateways/bank_frick.rb +8 -8
  19. data/lib/active_merchant/billing/gateways/banwire.rb +1 -1
  20. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +6 -4
  21. data/lib/active_merchant/billing/gateways/beanstream.rb +3 -3
  22. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +4 -5
  23. data/lib/active_merchant/billing/gateways/blue_pay.rb +2 -3
  24. data/lib/active_merchant/billing/gateways/blue_snap.rb +85 -23
  25. data/lib/active_merchant/billing/gateways/bogus.rb +19 -19
  26. data/lib/active_merchant/billing/gateways/borgun.rb +12 -12
  27. data/lib/active_merchant/billing/gateways/bpoint.rb +8 -8
  28. data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
  29. data/lib/active_merchant/billing/gateways/braintree_blue.rb +20 -17
  30. data/lib/active_merchant/billing/gateways/bridge_pay.rb +7 -7
  31. data/lib/active_merchant/billing/gateways/cams.rb +8 -8
  32. data/lib/active_merchant/billing/gateways/card_connect.rb +1 -1
  33. data/lib/active_merchant/billing/gateways/card_save.rb +1 -1
  34. data/lib/active_merchant/billing/gateways/card_stream.rb +2 -2
  35. data/lib/active_merchant/billing/gateways/cardknox.rb +8 -8
  36. data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
  37. data/lib/active_merchant/billing/gateways/cecabank.rb +5 -5
  38. data/lib/active_merchant/billing/gateways/cenpos.rb +11 -11
  39. data/lib/active_merchant/billing/gateways/checkout.rb +2 -2
  40. data/lib/active_merchant/billing/gateways/checkout_v2.rb +18 -21
  41. data/lib/active_merchant/billing/gateways/clearhaus.rb +7 -7
  42. data/lib/active_merchant/billing/gateways/commercegate.rb +1 -1
  43. data/lib/active_merchant/billing/gateways/conekta.rb +2 -2
  44. data/lib/active_merchant/billing/gateways/creditcall.rb +10 -10
  45. data/lib/active_merchant/billing/gateways/credorax.rb +32 -15
  46. data/lib/active_merchant/billing/gateways/ct_payment.rb +10 -10
  47. data/lib/active_merchant/billing/gateways/culqi.rb +10 -10
  48. data/lib/active_merchant/billing/gateways/cyber_source.rb +61 -37
  49. data/lib/active_merchant/billing/gateways/d_local.rb +11 -11
  50. data/lib/active_merchant/billing/gateways/data_cash.rb +2 -3
  51. data/lib/active_merchant/billing/gateways/decidir.rb +24 -9
  52. data/lib/active_merchant/billing/gateways/dibs.rb +8 -8
  53. data/lib/active_merchant/billing/gateways/digitzs.rb +6 -6
  54. data/lib/active_merchant/billing/gateways/ebanx.rb +9 -9
  55. data/lib/active_merchant/billing/gateways/efsnet.rb +3 -4
  56. data/lib/active_merchant/billing/gateways/elavon.rb +279 -227
  57. data/lib/active_merchant/billing/gateways/element.rb +8 -8
  58. data/lib/active_merchant/billing/gateways/evo_ca.rb +5 -6
  59. data/lib/active_merchant/billing/gateways/eway.rb +3 -4
  60. data/lib/active_merchant/billing/gateways/eway_managed.rb +6 -7
  61. data/lib/active_merchant/billing/gateways/eway_rapid.rb +8 -8
  62. data/lib/active_merchant/billing/gateways/exact.rb +8 -9
  63. data/lib/active_merchant/billing/gateways/ezic.rb +8 -8
  64. data/lib/active_merchant/billing/gateways/fat_zebra.rb +4 -4
  65. data/lib/active_merchant/billing/gateways/federated_canada.rb +2 -3
  66. data/lib/active_merchant/billing/gateways/first_giving.rb +1 -1
  67. data/lib/active_merchant/billing/gateways/first_pay.rb +6 -6
  68. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +7 -7
  69. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +21 -10
  70. data/lib/active_merchant/billing/gateways/flo2cash.rb +9 -9
  71. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
  72. data/lib/active_merchant/billing/gateways/forte.rb +14 -8
  73. data/lib/active_merchant/billing/gateways/global_collect.rb +29 -10
  74. data/lib/active_merchant/billing/gateways/global_transport.rb +7 -7
  75. data/lib/active_merchant/billing/gateways/hdfc.rb +10 -10
  76. data/lib/active_merchant/billing/gateways/hps.rb +17 -14
  77. data/lib/active_merchant/billing/gateways/iats_payments.rb +9 -4
  78. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
  79. data/lib/active_merchant/billing/gateways/inspire.rb +3 -4
  80. data/lib/active_merchant/billing/gateways/instapay.rb +1 -2
  81. data/lib/active_merchant/billing/gateways/ipp.rb +7 -7
  82. data/lib/active_merchant/billing/gateways/iridium.rb +16 -17
  83. data/lib/active_merchant/billing/gateways/iveri.rb +7 -7
  84. data/lib/active_merchant/billing/gateways/ixopay.rb +7 -7
  85. data/lib/active_merchant/billing/gateways/jetpay.rb +1 -2
  86. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +4 -5
  87. data/lib/active_merchant/billing/gateways/kushki.rb +6 -6
  88. data/lib/active_merchant/billing/gateways/latitude19.rb +14 -14
  89. data/lib/active_merchant/billing/gateways/linkpoint.rb +5 -6
  90. data/lib/active_merchant/billing/gateways/litle.rb +28 -12
  91. data/lib/active_merchant/billing/gateways/mastercard.rb +12 -12
  92. data/lib/active_merchant/billing/gateways/mercado_pago.rb +8 -8
  93. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +1 -2
  94. data/lib/active_merchant/billing/gateways/merchant_one.rb +1 -1
  95. data/lib/active_merchant/billing/gateways/merchant_partners.rb +10 -10
  96. data/lib/active_merchant/billing/gateways/merchant_ware.rb +5 -7
  97. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +4 -6
  98. data/lib/active_merchant/billing/gateways/mercury.rb +4 -4
  99. data/lib/active_merchant/billing/gateways/metrics_global.rb +4 -5
  100. data/lib/active_merchant/billing/gateways/micropayment.rb +8 -8
  101. data/lib/active_merchant/billing/gateways/migs.rb +3 -4
  102. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +2 -4
  103. data/lib/active_merchant/billing/gateways/monei.rb +7 -7
  104. data/lib/active_merchant/billing/gateways/moneris.rb +4 -3
  105. data/lib/active_merchant/billing/gateways/money_movers.rb +2 -3
  106. data/lib/active_merchant/billing/gateways/mundipagg.rb +37 -10
  107. data/lib/active_merchant/billing/gateways/nab_transact.rb +2 -4
  108. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +7 -7
  109. data/lib/active_merchant/billing/gateways/net_registry.rb +1 -2
  110. data/lib/active_merchant/billing/gateways/netaxept.rb +6 -6
  111. data/lib/active_merchant/billing/gateways/netbanx.rb +12 -10
  112. data/lib/active_merchant/billing/gateways/netbilling.rb +4 -5
  113. data/lib/active_merchant/billing/gateways/network_merchants.rb +2 -3
  114. data/lib/active_merchant/billing/gateways/nmi.rb +21 -7
  115. data/lib/active_merchant/billing/gateways/ogone.rb +3 -3
  116. data/lib/active_merchant/billing/gateways/omise.rb +13 -13
  117. data/lib/active_merchant/billing/gateways/openpay.rb +4 -5
  118. data/lib/active_merchant/billing/gateways/opp.rb +12 -12
  119. data/lib/active_merchant/billing/gateways/optimal_payment.rb +3 -4
  120. data/lib/active_merchant/billing/gateways/orbital.rb +175 -81
  121. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +3 -4
  122. data/lib/active_merchant/billing/gateways/pagarme.rb +9 -9
  123. data/lib/active_merchant/billing/gateways/pago_facil.rb +2 -2
  124. data/lib/active_merchant/billing/gateways/pay_conex.rb +8 -8
  125. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +6 -7
  126. data/lib/active_merchant/billing/gateways/pay_hub.rb +7 -8
  127. data/lib/active_merchant/billing/gateways/pay_junction.rb +4 -5
  128. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +9 -9
  129. data/lib/active_merchant/billing/gateways/pay_secure.rb +2 -3
  130. data/lib/active_merchant/billing/gateways/paybox_direct.rb +23 -1
  131. data/lib/active_merchant/billing/gateways/payeezy.rb +35 -17
  132. data/lib/active_merchant/billing/gateways/payex.rb +11 -12
  133. data/lib/active_merchant/billing/gateways/payflow.rb +4 -1
  134. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -1
  135. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +1 -1
  136. data/lib/active_merchant/billing/gateways/payment_express.rb +1 -2
  137. data/lib/active_merchant/billing/gateways/paymentez.rb +26 -6
  138. data/lib/active_merchant/billing/gateways/paymill.rb +10 -10
  139. data/lib/active_merchant/billing/gateways/paypal.rb +10 -2
  140. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +1 -0
  141. data/lib/active_merchant/billing/gateways/paypal_express.rb +1 -1
  142. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
  143. data/lib/active_merchant/billing/gateways/payscout.rb +1 -2
  144. data/lib/active_merchant/billing/gateways/paystation.rb +3 -4
  145. data/lib/active_merchant/billing/gateways/payu_in.rb +3 -3
  146. data/lib/active_merchant/billing/gateways/payu_latam.rb +17 -10
  147. data/lib/active_merchant/billing/gateways/payway.rb +8 -9
  148. data/lib/active_merchant/billing/gateways/pin.rb +11 -0
  149. data/lib/active_merchant/billing/gateways/plugnpay.rb +2 -3
  150. data/lib/active_merchant/billing/gateways/pro_pay.rb +8 -8
  151. data/lib/active_merchant/billing/gateways/psigate.rb +3 -4
  152. data/lib/active_merchant/billing/gateways/psl_card.rb +1 -2
  153. data/lib/active_merchant/billing/gateways/qbms.rb +4 -5
  154. data/lib/active_merchant/billing/gateways/quantum.rb +1 -2
  155. data/lib/active_merchant/billing/gateways/quickbooks.rb +4 -3
  156. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +3 -4
  157. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -2
  158. data/lib/active_merchant/billing/gateways/qvalent.rb +9 -9
  159. data/lib/active_merchant/billing/gateways/realex.rb +1 -1
  160. data/lib/active_merchant/billing/gateways/redsys.rb +87 -7
  161. data/lib/active_merchant/billing/gateways/s5.rb +7 -7
  162. data/lib/active_merchant/billing/gateways/safe_charge.rb +40 -14
  163. data/lib/active_merchant/billing/gateways/sage.rb +3 -5
  164. data/lib/active_merchant/billing/gateways/sage_pay.rb +6 -7
  165. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
  166. data/lib/active_merchant/billing/gateways/secure_net.rb +1 -2
  167. data/lib/active_merchant/billing/gateways/secure_pay.rb +3 -4
  168. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +2 -4
  169. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -2
  170. data/lib/active_merchant/billing/gateways/securion_pay.rb +5 -6
  171. data/lib/active_merchant/billing/gateways/skip_jack.rb +3 -4
  172. data/lib/active_merchant/billing/gateways/smart_ps.rb +5 -6
  173. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +7 -7
  174. data/lib/active_merchant/billing/gateways/spreedly_core.rb +6 -6
  175. data/lib/active_merchant/billing/gateways/stripe.rb +12 -12
  176. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +30 -0
  177. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +3 -4
  178. data/lib/active_merchant/billing/gateways/telr.rb +9 -9
  179. data/lib/active_merchant/billing/gateways/trans_first.rb +3 -3
  180. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +14 -14
  181. data/lib/active_merchant/billing/gateways/transact_pro.rb +9 -9
  182. data/lib/active_merchant/billing/gateways/trust_commerce.rb +8 -9
  183. data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -1
  184. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +36 -36
  185. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +4 -5
  186. data/lib/active_merchant/billing/gateways/vanco.rb +3 -3
  187. data/lib/active_merchant/billing/gateways/verifi.rb +1 -2
  188. data/lib/active_merchant/billing/gateways/viaklix.rb +1 -2
  189. data/lib/active_merchant/billing/gateways/visanet_peru.rb +10 -10
  190. data/lib/active_merchant/billing/gateways/webpay.rb +2 -2
  191. data/lib/active_merchant/billing/gateways/wepay.rb +3 -2
  192. data/lib/active_merchant/billing/gateways/wirecard.rb +1 -2
  193. data/lib/active_merchant/billing/gateways/worldpay.rb +18 -10
  194. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +14 -16
  195. data/lib/active_merchant/billing/gateways/worldpay_us.rb +9 -9
  196. data/lib/active_merchant/billing/response.rb +3 -2
  197. data/lib/active_merchant/country.rb +1 -1
  198. data/lib/active_merchant/network_connection_retries.rb +2 -2
  199. data/lib/active_merchant/post_data.rb +1 -1
  200. data/lib/active_merchant/posts_data.rb +1 -1
  201. data/lib/active_merchant/version.rb +1 -1
  202. data/lib/support/ssl_verify.rb +2 -2
  203. data/lib/support/ssl_version.rb +2 -2
  204. metadata +2 -2
@@ -204,7 +204,7 @@ module ActiveMerchant #:nodoc:
204
204
  perform_reference_credit(money, reference, options)
205
205
  end
206
206
 
207
- def verify(credit_card, options={})
207
+ def verify(credit_card, options = {})
208
208
  MultiResponse.run(:use_first_response) do |r|
209
209
  r.process { authorize(100, credit_card, options) }
210
210
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -432,9 +432,9 @@ module ActiveMerchant #:nodoc:
432
432
  raise "Unknown signature algorithm #{algorithm}"
433
433
  end
434
434
 
435
- filtered_params = signed_parameters.select { |k, v| !v.blank? }
435
+ filtered_params = signed_parameters.select { |_k, v| !v.blank? }
436
436
  sha_encryptor.hexdigest(
437
- filtered_params.sort_by { |k, v| k.upcase }.map { |k, v| "#{k.upcase}=#{v}#{secret}" }.join('')
437
+ filtered_params.sort_by { |k, _v| k.upcase }.map { |k, v| "#{k.upcase}=#{v}#{secret}" }.join('')
438
438
  ).upcase
439
439
  end
440
440
 
@@ -46,7 +46,7 @@ module ActiveMerchant #:nodoc:
46
46
  # * <tt>:api_version</tt> -- Omise's API Version (OPTIONAL), default version is '2014-07-27'
47
47
  # See version at page https://dashboard.omise.co/api-version/edit
48
48
 
49
- def initialize(options={})
49
+ def initialize(options = {})
50
50
  requires!(options, :public_key, :secret_key)
51
51
  @public_key = options[:public_key]
52
52
  @secret_key = options[:secret_key]
@@ -79,7 +79,7 @@ module ActiveMerchant #:nodoc:
79
79
  #
80
80
  # purchase(money, nil, { :customer_id => customer_id })
81
81
 
82
- def purchase(money, payment_method, options={})
82
+ def purchase(money, payment_method, options = {})
83
83
  create_charge(money, payment_method, options)
84
84
  end
85
85
 
@@ -91,7 +91,7 @@ module ActiveMerchant #:nodoc:
91
91
  # * <tt>payment_method</tt> -- The CreditCard object
92
92
  # * <tt>options</tt> -- An optional parameters, such as token or capture
93
93
 
94
- def authorize(money, payment_method, options={})
94
+ def authorize(money, payment_method, options = {})
95
95
  options[:capture] = 'false'
96
96
  create_charge(money, payment_method, options)
97
97
  end
@@ -104,7 +104,7 @@ module ActiveMerchant #:nodoc:
104
104
  # * <tt>charge_id</tt> -- The CreditCard object
105
105
  # * <tt>options</tt> -- An optional parameters, such as token or capture
106
106
 
107
- def capture(money, charge_id, options={})
107
+ def capture(money, charge_id, options = {})
108
108
  post = {}
109
109
  add_amount(post, money, options)
110
110
  commit(:post, "charges/#{CGI.escape(charge_id)}/capture", post, options)
@@ -118,7 +118,7 @@ module ActiveMerchant #:nodoc:
118
118
  # * <tt>charge_id</tt> -- The CreditCard object
119
119
  # * <tt>options</tt> -- An optional parameters, such as token or capture
120
120
 
121
- def refund(money, charge_id, options={})
121
+ def refund(money, charge_id, options = {})
122
122
  options[:amount] = money if money
123
123
  commit(:post, "charges/#{CGI.escape(charge_id)}/refunds", options)
124
124
  end
@@ -132,7 +132,7 @@ module ActiveMerchant #:nodoc:
132
132
  # 'email' (A customer email)
133
133
  # 'description' (A customer description)
134
134
 
135
- def store(payment_method, options={})
135
+ def store(payment_method, options = {})
136
136
  post, card_params = {}, {}
137
137
  add_customer_data(post, options)
138
138
  add_token(card_params, payment_method, options)
@@ -145,7 +145,7 @@ module ActiveMerchant #:nodoc:
145
145
  #
146
146
  # * <tt>customer_id</tt> -- The Customer identifier (REQUIRED).
147
147
 
148
- def unstore(customer_id, options={})
148
+ def unstore(customer_id, options = {})
149
149
  commit(:delete, "customers/#{CGI.escape(customer_id)}")
150
150
  end
151
151
 
@@ -178,7 +178,7 @@ module ActiveMerchant #:nodoc:
178
178
  commit(:post, 'charges', post, options)
179
179
  end
180
180
 
181
- def headers(options={})
181
+ def headers(options = {})
182
182
  key = options[:key] || @secret_key
183
183
  {
184
184
  'Content-Type' => 'application/json;utf-8',
@@ -197,7 +197,7 @@ module ActiveMerchant #:nodoc:
197
197
  parameters.present? ? parameters.to_json : nil
198
198
  end
199
199
 
200
- def https_request(method, endpoint, parameters=nil, options={})
200
+ def https_request(method, endpoint, parameters = nil, options = {})
201
201
  raw_response = response = nil
202
202
  begin
203
203
  raw_response = ssl_request(method, url_for(endpoint), post_data(parameters), headers(options))
@@ -221,7 +221,7 @@ module ActiveMerchant #:nodoc:
221
221
  { message: msg }
222
222
  end
223
223
 
224
- def commit(method, endpoint, params=nil, options={})
224
+ def commit(method, endpoint, params = nil, options = {})
225
225
  response = https_request(method, endpoint, params, options)
226
226
  Response.new(
227
227
  successful?(response),
@@ -284,7 +284,7 @@ module ActiveMerchant #:nodoc:
284
284
  commit(:post, 'tokens', post, { key: @public_key })
285
285
  end
286
286
 
287
- def add_token(post, credit_card, options={})
287
+ def add_token(post, credit_card, options = {})
288
288
  if options[:token_id].present?
289
289
  post[:card] = options[:token_id]
290
290
  else
@@ -304,11 +304,11 @@ module ActiveMerchant #:nodoc:
304
304
  post[:card] = card
305
305
  end
306
306
 
307
- def add_customer(post, options={})
307
+ def add_customer(post, options = {})
308
308
  post[:customer] = options[:customer_id] if options[:customer_id]
309
309
  end
310
310
 
311
- def add_customer_data(post, options={})
311
+ def add_customer_data(post, options = {})
312
312
  post[:description] = options[:description] if options[:description]
313
313
  post[:email] = options[:email] if options[:email]
314
314
  end
@@ -4,7 +4,7 @@ module ActiveMerchant #:nodoc:
4
4
  self.live_url = 'https://api.openpay.mx/v1/'
5
5
  self.test_url = 'https://sandbox-api.openpay.mx/v1/'
6
6
 
7
- self.supported_countries = ['MX']
7
+ self.supported_countries = %w(CO MX)
8
8
  self.supported_cardtypes = %i[visa master american_express carnet]
9
9
  self.homepage_url = 'http://www.openpay.mx/'
10
10
  self.display_name = 'Openpay'
@@ -116,7 +116,7 @@ module ActiveMerchant #:nodoc:
116
116
  post[:device_session_id] = options[:device_session_id]
117
117
  post[:currency] = (options[:currency] || currency(money)).upcase
118
118
  post[:use_card_points] = options[:use_card_points] if options[:use_card_points]
119
- post[:payment_plan] = {payments: options[:payments]} if options[:payments]
119
+ post[:payment_plan] = { payments: options[:payments] } if options[:payments]
120
120
  add_creditcard(post, creditcard, options)
121
121
  post
122
122
  end
@@ -188,11 +188,10 @@ module ActiveMerchant #:nodoc:
188
188
  (success ? response['error_code'] : response['description']),
189
189
  response,
190
190
  test: test?,
191
- authorization: response['id']
192
- )
191
+ authorization: response['id'])
193
192
  end
194
193
 
195
- def http_request(method, resource, parameters={}, options={})
194
+ def http_request(method, resource, parameters = {}, options = {})
196
195
  url = (test? ? self.test_url : self.live_url) + @merchant_id + '/' + resource
197
196
  raw_response = nil
198
197
  begin
@@ -117,39 +117,39 @@ module ActiveMerchant #:nodoc:
117
117
  self.homepage_url = 'https://docs.oppwa.com'
118
118
  self.display_name = 'Open Payment Platform'
119
119
 
120
- def initialize(options={})
120
+ def initialize(options = {})
121
121
  requires!(options, :access_token, :entity_id)
122
122
  super
123
123
  end
124
124
 
125
- def purchase(money, payment, options={})
125
+ def purchase(money, payment, options = {})
126
126
  # debit
127
127
  options[:registrationId] = payment if payment.is_a?(String)
128
128
  execute_dbpa(options[:risk_workflow] ? 'PA.CP' : 'DB',
129
129
  money, payment, options)
130
130
  end
131
131
 
132
- def authorize(money, payment, options={})
132
+ def authorize(money, payment, options = {})
133
133
  # preauthorization PA
134
134
  execute_dbpa('PA', money, payment, options)
135
135
  end
136
136
 
137
- def capture(money, authorization, options={})
137
+ def capture(money, authorization, options = {})
138
138
  # capture CP
139
139
  execute_referencing('CP', money, authorization, options)
140
140
  end
141
141
 
142
- def refund(money, authorization, options={})
142
+ def refund(money, authorization, options = {})
143
143
  # refund RF
144
144
  execute_referencing('RF', money, authorization, options)
145
145
  end
146
146
 
147
- def void(authorization, options={})
147
+ def void(authorization, options = {})
148
148
  # reversal RV
149
149
  execute_referencing('RV', nil, authorization, options)
150
150
  end
151
151
 
152
- def verify(credit_card, options={})
152
+ def verify(credit_card, options = {})
153
153
  MultiResponse.run(:use_first_response) do |r|
154
154
  r.process { authorize(100, credit_card, options) }
155
155
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -243,7 +243,7 @@ module ActiveMerchant #:nodoc:
243
243
  city: address[:city],
244
244
  state: address[:state],
245
245
  postcode: address[:zip],
246
- country: address[:country],
246
+ country: address[:country]
247
247
  }
248
248
  end
249
249
 
@@ -260,7 +260,7 @@ module ActiveMerchant #:nodoc:
260
260
 
261
261
  if options[:registrationId]
262
262
  post[:card] = {
263
- cvv: payment.verification_value,
263
+ cvv: payment.verification_value
264
264
  }
265
265
  else
266
266
  post[:paymentBrand] = payment.brand.upcase
@@ -269,7 +269,7 @@ module ActiveMerchant #:nodoc:
269
269
  number: payment.number,
270
270
  expiryMonth: '%02d' % payment.month,
271
271
  expiryYear: payment.year,
272
- cvv: payment.verification_value,
272
+ cvv: payment.verification_value
273
273
  }
274
274
  end
275
275
  end
@@ -287,7 +287,7 @@ module ActiveMerchant #:nodoc:
287
287
  def add_options(post, options)
288
288
  post[:createRegistration] = options[:create_registration] if options[:create_registration] && !options[:registrationId]
289
289
  post[:testMode] = options[:test_mode] if test? && options[:test_mode]
290
- options.each { |key, value| post[key] = value if key.to_s.match('customParameters\[[a-zA-Z0-9\._]{3,64}\]') }
290
+ options.each { |key, value| post[key] = value if key.to_s =~ /'customParameters\[[a-zA-Z0-9\._]{3,64}\]'/ }
291
291
  post['customParameters[SHOPPER_pluginId]'] = 'activemerchant'
292
292
  post['customParameters[custom_disable3DSecure]'] = options[:disable_3d_secure] if options[:disable_3d_secure]
293
293
  end
@@ -349,7 +349,7 @@ module ActiveMerchant #:nodoc:
349
349
 
350
350
  def json_error(body)
351
351
  message = "Invalid response received #{body.inspect}"
352
- { 'result' => {'description' => message, 'code' => 'unknown' } }
352
+ { 'result' => { 'description' => message, 'code' => 'unknown' } }
353
353
  end
354
354
 
355
355
  def success_from(response)
@@ -125,8 +125,7 @@ module ActiveMerchant #:nodoc:
125
125
  test: test?,
126
126
  authorization: authorization_from(response),
127
127
  avs_result: { code: avs_result_from(response) },
128
- cvv_result: cvv_result_from(response)
129
- )
128
+ cvv_result: cvv_result_from(response))
130
129
  end
131
130
 
132
131
  # The upstream is picky and so we can't use CGI.escape like we want to
@@ -257,7 +256,7 @@ module ActiveMerchant #:nodoc:
257
256
  def schema
258
257
  { 'xmlns' => 'http://www.optimalpayments.com/creditcard/xmlschema/v1',
259
258
  'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
260
- 'xsi:schemaLocation' => 'http://www.optimalpayments.com/creditcard/xmlschema/v1'}
259
+ 'xsi:schemaLocation' => 'http://www.optimalpayments.com/creditcard/xmlschema/v1' }
261
260
  end
262
261
 
263
262
  def build_merchant_account(xml)
@@ -325,7 +324,7 @@ module ActiveMerchant #:nodoc:
325
324
  'master' => 'MC',
326
325
  'american_express' => 'AM',
327
326
  'discover' => 'DI',
328
- 'diners_club' => 'DC', }[key]
327
+ 'diners_club' => 'DC' }[key]
329
328
  end
330
329
  end
331
330
  end
@@ -30,11 +30,11 @@ module ActiveMerchant #:nodoc:
30
30
  class OrbitalGateway < Gateway
31
31
  include Empty
32
32
 
33
- API_VERSION = '7.7'
33
+ API_VERSION = '8.1'
34
34
 
35
35
  POST_HEADERS = {
36
36
  'MIME-Version' => '1.1',
37
- 'Content-Type' => "application/PTI#{API_VERSION.gsub(/\./, '')}",
37
+ 'Content-Type' => "application/PTI#{API_VERSION.delete('.')}",
38
38
  'Content-transfer-encoding' => 'text',
39
39
  'Request-number' => '1',
40
40
  'Document-type' => 'Request',
@@ -183,6 +183,37 @@ module ActiveMerchant #:nodoc:
183
183
 
184
184
  SENSITIVE_FIELDS = %i[account_num cc_account_num]
185
185
 
186
+ # Bank account types to be used for check processing
187
+ ACCOUNT_TYPE = {
188
+ 'savings' => 'S',
189
+ 'checking' => 'C'
190
+ }
191
+
192
+ # Fixed possible values for orbital ECP attributes
193
+ # Auth methods for electronic checks can be:
194
+ # Written, Internet, Telephonic, Account Receivable, Point of Purchase.
195
+ # Default auth method for ECP is Internet (I).
196
+ # Bank payment delivery can be either ACH (Automated Clearing House) or Best Possible.
197
+ # Default Bank Payment Delivery is Best Possible (B).
198
+ # Action codes to be used for Early Warning System and additional validations.
199
+ # Valid combinations of Message Type and Action Code to be used are:
200
+ # A W1
201
+ # AC W1
202
+ # FC W4
203
+ # R W6
204
+ # FC W8
205
+ # A W3
206
+ # AC W3
207
+ # FC W5
208
+ # R W7
209
+ # Default Action code for ECP is nil.
210
+ # Electronic check to be processed on same day (Y) or next day (N).
211
+ # Default ECP Same Day Index is Yes (Y).
212
+ ECP_AUTH_METHODS = %w[W I T A P]
213
+ ECP_BANK_PAYMENT = %w[A B]
214
+ ECP_ACTION_CODES = %w[LO ND NC W1 W3 W4 W5 W6 W7 W8 W9]
215
+ ECP_SAME_DAY = %w[Y N]
216
+
186
217
  def initialize(options = {})
187
218
  requires!(options, :merchant_id)
188
219
  requires!(options, :login, :password) unless options[:ip_authentication]
@@ -191,12 +222,12 @@ module ActiveMerchant #:nodoc:
191
222
  end
192
223
 
193
224
  # A – Authorization request
194
- def authorize(money, creditcard, options = {})
195
- order = build_new_order_xml(AUTH_ONLY, money, creditcard, options) do |xml|
196
- add_creditcard(xml, creditcard, options[:currency])
197
- add_address(xml, creditcard, options)
225
+ def authorize(money, payment_source, options = {})
226
+ order = build_new_order_xml(AUTH_ONLY, money, payment_source, options) do |xml|
227
+ add_payment_source(xml, payment_source, options)
228
+ add_address(xml, payment_source, options)
198
229
  if @options[:customer_profiles]
199
- add_customer_data(xml, creditcard, options)
230
+ add_customer_data(xml, payment_source, options)
200
231
  add_managed_billing(xml, options)
201
232
  end
202
233
  end
@@ -211,12 +242,12 @@ module ActiveMerchant #:nodoc:
211
242
  end
212
243
 
213
244
  # AC – Authorization and Capture
214
- def purchase(money, creditcard, options = {})
215
- order = build_new_order_xml(AUTH_AND_CAPTURE, money, creditcard, options) do |xml|
216
- add_creditcard(xml, creditcard, options[:currency])
217
- add_address(xml, creditcard, options)
245
+ def purchase(money, payment_source, options = {})
246
+ order = build_new_order_xml(options[:force_capture] ? FORCE_AUTH_AND_CAPTURE : AUTH_AND_CAPTURE, money, payment_source, options) do |xml|
247
+ add_payment_source(xml, payment_source, options)
248
+ add_address(xml, payment_source, options)
218
249
  if @options[:customer_profiles]
219
- add_customer_data(xml, creditcard, options)
250
+ add_customer_data(xml, payment_source, options)
220
251
  add_managed_billing(xml, options)
221
252
  end
222
253
  end
@@ -237,7 +268,7 @@ module ActiveMerchant #:nodoc:
237
268
  commit(order, :refund, options[:trace_number])
238
269
  end
239
270
 
240
- def credit(money, authorization, options= {})
271
+ def credit(money, authorization, options = {})
241
272
  ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
242
273
  refund(money, authorization, options)
243
274
  end
@@ -286,13 +317,13 @@ module ActiveMerchant #:nodoc:
286
317
  end
287
318
 
288
319
  def retrieve_customer_profile(customer_ref_num)
289
- options = {customer_profile_action: RETRIEVE, customer_ref_num: customer_ref_num}
320
+ options = { customer_profile_action: RETRIEVE, customer_ref_num: customer_ref_num }
290
321
  order = build_customer_request_xml(nil, options)
291
322
  commit(order, :retrieve_customer_profile)
292
323
  end
293
324
 
294
325
  def delete_customer_profile(customer_ref_num)
295
- options = {customer_profile_action: DELETE, customer_ref_num: customer_ref_num}
326
+ options = { customer_profile_action: DELETE, customer_ref_num: customer_ref_num }
296
327
  order = build_customer_request_xml(nil, options)
297
328
  commit(order, :delete_customer_profile)
298
329
  end
@@ -355,61 +386,61 @@ module ActiveMerchant #:nodoc:
355
386
  xml.tag! :SDMerchantEmail, soft_desc[:merchant_email] || nil
356
387
  end
357
388
 
358
- def add_level_2_tax(xml, options={})
359
- if (level_2 = options[:level_2_data])
360
- xml.tag! :TaxInd, level_2[:tax_indicator] if [TAX_NOT_PROVIDED, TAX_INCLUDED, NON_TAXABLE_TRANSACTION].include?(level_2[:tax_indicator].to_i)
361
- xml.tag! :Tax, level_2[:tax].to_i if level_2[:tax]
389
+ def add_level2_tax(xml, options = {})
390
+ if (level2 = options[:level_2_data])
391
+ xml.tag! :TaxInd, level2[:tax_indicator] if [TAX_NOT_PROVIDED, TAX_INCLUDED, NON_TAXABLE_TRANSACTION].include?(level2[:tax_indicator].to_i)
392
+ xml.tag! :Tax, level2[:tax].to_i if level2[:tax]
362
393
  end
363
394
  end
364
395
 
365
- def add_level_3_tax(xml, options={})
366
- if (level_3 = options[:level_3_data])
367
- xml.tag! :PC3VATtaxAmt, byte_limit(level_3[:vat_tax], 12) if level_3[:vat_tax]
368
- xml.tag! :PC3AltTaxAmt, byte_limit(level_3[:alt_tax], 9) if level_3[:alt_tax]
369
- xml.tag! :PC3VATtaxRate, byte_limit(level_3[:vat_rate], 4) if level_3[:vat_rate]
370
- xml.tag! :PC3AltTaxInd, byte_limit(level_3[:alt_ind], 15) if level_3[:alt_ind]
396
+ def add_level3_tax(xml, options = {})
397
+ if (level3 = options[:level_3_data])
398
+ xml.tag! :PC3VATtaxAmt, byte_limit(level3[:vat_tax], 12) if level3[:vat_tax]
399
+ xml.tag! :PC3AltTaxAmt, byte_limit(level3[:alt_tax], 9) if level3[:alt_tax]
400
+ xml.tag! :PC3VATtaxRate, byte_limit(level3[:vat_rate], 4) if level3[:vat_rate]
401
+ xml.tag! :PC3AltTaxInd, byte_limit(level3[:alt_ind], 15) if level3[:alt_ind]
371
402
  end
372
403
  end
373
404
 
374
- def add_level_2_advice_addendum(xml, options={})
375
- if (level_2 = options[:level_2_data])
376
- xml.tag! :AMEXTranAdvAddn1, byte_limit(level_2[:advice_addendum_1], 40) if level_2[:advice_addendum_1]
377
- xml.tag! :AMEXTranAdvAddn2, byte_limit(level_2[:advice_addendum_2], 40) if level_2[:advice_addendum_2]
378
- xml.tag! :AMEXTranAdvAddn3, byte_limit(level_2[:advice_addendum_3], 40) if level_2[:advice_addendum_3]
379
- xml.tag! :AMEXTranAdvAddn4, byte_limit(level_2[:advice_addendum_4], 40) if level_2[:advice_addendum_4]
405
+ def add_level2_advice_addendum(xml, options = {})
406
+ if (level2 = options[:level_2_data])
407
+ xml.tag! :AMEXTranAdvAddn1, byte_limit(level2[:advice_addendum_1], 40) if level2[:advice_addendum_1]
408
+ xml.tag! :AMEXTranAdvAddn2, byte_limit(level2[:advice_addendum_2], 40) if level2[:advice_addendum_2]
409
+ xml.tag! :AMEXTranAdvAddn3, byte_limit(level2[:advice_addendum_3], 40) if level2[:advice_addendum_3]
410
+ xml.tag! :AMEXTranAdvAddn4, byte_limit(level2[:advice_addendum_4], 40) if level2[:advice_addendum_4]
380
411
  end
381
412
  end
382
413
 
383
- def add_level_2_purchase(xml, options={})
384
- if (level_2 = options[:level_2_data])
385
- xml.tag! :PCOrderNum, byte_limit(level_2[:purchase_order], 17) if level_2[:purchase_order]
386
- xml.tag! :PCDestZip, byte_limit(format_address_field(level_2[:zip]), 10) if level_2[:zip]
387
- xml.tag! :PCDestName, byte_limit(format_address_field(level_2[:name]), 30) if level_2[:name]
388
- xml.tag! :PCDestAddress1, byte_limit(format_address_field(level_2[:address1]), 30) if level_2[:address1]
389
- xml.tag! :PCDestAddress2, byte_limit(format_address_field(level_2[:address2]), 30) if level_2[:address2]
390
- xml.tag! :PCDestCity, byte_limit(format_address_field(level_2[:city]), 20) if level_2[:city]
391
- xml.tag! :PCDestState, byte_limit(format_address_field(level_2[:state]), 2) if level_2[:state]
414
+ def add_level2_purchase(xml, options = {})
415
+ if (level2 = options[:level_2_data])
416
+ xml.tag! :PCOrderNum, byte_limit(level2[:purchase_order], 17) if level2[:purchase_order]
417
+ xml.tag! :PCDestZip, byte_limit(format_address_field(level2[:zip]), 10) if level2[:zip]
418
+ xml.tag! :PCDestName, byte_limit(format_address_field(level2[:name]), 30) if level2[:name]
419
+ xml.tag! :PCDestAddress1, byte_limit(format_address_field(level2[:address1]), 30) if level2[:address1]
420
+ xml.tag! :PCDestAddress2, byte_limit(format_address_field(level2[:address2]), 30) if level2[:address2]
421
+ xml.tag! :PCDestCity, byte_limit(format_address_field(level2[:city]), 20) if level2[:city]
422
+ xml.tag! :PCDestState, byte_limit(format_address_field(level2[:state]), 2) if level2[:state]
392
423
  end
393
424
  end
394
425
 
395
- def add_level_3_purchase(xml, options={})
396
- if (level_3 = options[:level_3_data])
397
- xml.tag! :PC3FreightAmt, byte_limit(level_3[:freight_amount], 12) if level_3[:freight_amount]
398
- xml.tag! :PC3DutyAmt, byte_limit(level_3[:duty_amount], 12) if level_3[:duty_amount]
399
- xml.tag! :PC3DestCountryCd, byte_limit(level_3[:dest_country], 3) if level_3[:dest_country]
400
- xml.tag! :PC3ShipFromZip, byte_limit(level_3[:ship_from_zip], 10) if level_3[:ship_from_zip]
401
- xml.tag! :PC3DiscAmt, byte_limit(level_3[:discount_amount], 12) if level_3[:discount_amount]
426
+ def add_level3_purchase(xml, options = {})
427
+ if (level3 = options[:level_3_data])
428
+ xml.tag! :PC3FreightAmt, byte_limit(level3[:freight_amount], 12) if level3[:freight_amount]
429
+ xml.tag! :PC3DutyAmt, byte_limit(level3[:duty_amount], 12) if level3[:duty_amount]
430
+ xml.tag! :PC3DestCountryCd, byte_limit(level3[:dest_country], 3) if level3[:dest_country]
431
+ xml.tag! :PC3ShipFromZip, byte_limit(level3[:ship_from_zip], 10) if level3[:ship_from_zip]
432
+ xml.tag! :PC3DiscAmt, byte_limit(level3[:discount_amount], 12) if level3[:discount_amount]
402
433
  end
403
434
  end
404
435
 
405
- def add_line_items(xml, options={})
436
+ def add_line_items(xml, options = {})
406
437
  xml.tag! :PC3LineItemCount, byte_limit(options[:line_items].count, 2)
407
438
  xml.tag! :PC3LineItemArray do
408
439
  options[:line_items].each_with_index do |line_item, index|
409
440
  xml.tag! :PC3LineItem do
410
441
  xml.tag! :PC3DtlIndex, byte_limit(index + 1, 2)
411
442
  line_item.each do |key, value|
412
- if key == :line_tot
443
+ if [:line_tot, 'line_tot'].include? key
413
444
  formatted_key = :PC3Dtllinetot
414
445
  else
415
446
  formatted_key = "PC3Dtl#{key.to_s.camelize}".to_sym
@@ -421,6 +452,10 @@ module ActiveMerchant #:nodoc:
421
452
  end
422
453
  end
423
454
 
455
+ def add_card_indicators(xml, options)
456
+ xml.tag! :CardIndicators, options[:card_indicators] if options[:card_indicators]
457
+ end
458
+
424
459
  def add_address(xml, creditcard, options)
425
460
  if (address = (options[:billing_address] || options[:address]))
426
461
  avs_supported = AVS_SUPPORTED_COUNTRIES.include?(address[:country].to_s) || empty?(address[:country])
@@ -474,7 +509,32 @@ module ActiveMerchant #:nodoc:
474
509
  end
475
510
  end
476
511
 
477
- def add_creditcard(xml, creditcard, currency=nil)
512
+ # Payment can be done through either Credit Card or Electronic Check
513
+ def add_payment_source(xml, payment_source, options = {})
514
+ if payment_source.instance_of?(ActiveMerchant::Billing::Check)
515
+ add_echeck(xml, payment_source, options)
516
+ else
517
+ add_creditcard(xml, payment_source, options[:currency])
518
+ end
519
+ end
520
+
521
+ # Adds Electronic Check attributes
522
+ def add_echeck(xml, check, options = {})
523
+ xml.tag! :CardBrand, 'EC'
524
+ xml.tag! :CurrencyCode, currency_code(options[:currency])
525
+ xml.tag! :CurrencyExponent, currency_exponents(options[:currency])
526
+ unless check.nil?
527
+
528
+ xml.tag! :BCRtNum, check.routing_number
529
+ xml.tag! :CheckDDA, check.account_number if check.account_number
530
+ xml.tag! :BankAccountType, ACCOUNT_TYPE[check.account_type] if ACCOUNT_TYPE[check.account_type]
531
+ xml.tag! :ECPAuthMethod, options[:auth_method] if options[:auth_method] && ECP_AUTH_METHODS.include?(options[:auth_method])
532
+ xml.tag! :BankPmtDelv, options[:payment_delivery] if options[:payment_delivery] && ECP_BANK_PAYMENT.include?(options[:payment_delivery])
533
+ end
534
+ end
535
+
536
+ # Adds Credit Card attributes
537
+ def add_creditcard(xml, creditcard, currency = nil)
478
538
  unless creditcard.nil?
479
539
  xml.tag! :AccountNum, creditcard.number
480
540
  xml.tag! :Exp, expiry_date(creditcard)
@@ -511,13 +571,9 @@ module ActiveMerchant #:nodoc:
511
571
  end
512
572
 
513
573
  def add_xid(xml, creditcard, three_d_secure)
514
- xid = if three_d_secure && creditcard.brand == 'visa'
515
- three_d_secure[:xid]
516
- elsif creditcard.is_a?(NetworkTokenizationCreditCard)
517
- creditcard.transaction_id
518
- end
574
+ return unless three_d_secure && creditcard.brand == 'visa'
519
575
 
520
- xml.tag!(:XID, xid) if xid
576
+ xml.tag!(:XID, three_d_secure[:xid]) if three_d_secure[:xid]
521
577
  end
522
578
 
523
579
  def add_cavv(xml, creditcard, three_d_secure)
@@ -532,6 +588,24 @@ module ActiveMerchant #:nodoc:
532
588
  xml.tag!(:AAV, three_d_secure[:cavv])
533
589
  end
534
590
 
591
+ def add_mc_program_protocol(xml, creditcard, three_d_secure)
592
+ return unless three_d_secure && creditcard.brand == 'master'
593
+
594
+ xml.tag!(:MCProgramProtocol, three_d_secure[:version]) if three_d_secure[:version]
595
+ end
596
+
597
+ def add_mc_directory_trans_id(xml, creditcard, three_d_secure)
598
+ return unless three_d_secure && creditcard.brand == 'master'
599
+
600
+ xml.tag!(:MCDirectoryTransID, three_d_secure[:ds_transaction_id]) if three_d_secure[:ds_transaction_id]
601
+ end
602
+
603
+ def add_ucafind(xml, creditcard, three_d_secure)
604
+ return unless three_d_secure && creditcard.brand == 'master'
605
+
606
+ xml.tag! :UCAFInd, '4'
607
+ end
608
+
535
609
  def add_dpanind(xml, creditcard)
536
610
  return unless creditcard.is_a?(NetworkTokenizationCreditCard)
537
611
 
@@ -556,7 +630,7 @@ module ActiveMerchant #:nodoc:
556
630
  xml.tag!(:PymtBrandProgramCode, 'ASK')
557
631
  end
558
632
 
559
- def add_refund(xml, currency=nil)
633
+ def add_refund(xml, currency = nil)
560
634
  xml.tag! :AccountNum, nil
561
635
 
562
636
  xml.tag! :CurrencyCode, currency_code(currency)
@@ -587,6 +661,18 @@ module ActiveMerchant #:nodoc:
587
661
  end
588
662
  end
589
663
 
664
+ # Adds ECP conditional attributes depending on other attribute values
665
+ def add_ecp_details(xml, parameters = {})
666
+ requires!(parameters, :check_serial_number) if parameters[:auth_method]&.eql?('A') || parameters[:auth_method]&.eql?('P')
667
+ xml.tag! :ECPActionCode, parameters[:action_code] if parameters[:action_code] && ECP_ACTION_CODES.include?(parameters[:action_code])
668
+ xml.tag! :ECPCheckSerialNumber, parameters[:check_serial_number] if parameters[:auth_method]&.eql?('A') || parameters[:auth_method]&.eql?('P')
669
+ if parameters[:auth_method]&.eql?('P')
670
+ xml.tag! :ECPTerminalCity, parameters[:terminal_city] if parameters[:terminal_city]
671
+ xml.tag! :ECPTerminalState, parameters[:terminal_state] if parameters[:terminal_state]
672
+ xml.tag! :ECPImageReferenceNumber, parameters[:image_reference_number] if parameters[:image_reference_number]
673
+ end
674
+ end
675
+
590
676
  def add_stored_credentials(xml, parameters)
591
677
  return unless parameters[:mit_stored_credential_ind] == 'Y' || parameters[:stored_credential] && !parameters[:stored_credential].values.all?(&:nil?)
592
678
 
@@ -643,7 +729,7 @@ module ActiveMerchant #:nodoc:
643
729
  end
644
730
  end
645
731
 
646
- def commit(order, message_type, trace_number=nil)
732
+ def commit(order, message_type, trace_number = nil)
647
733
  headers = POST_HEADERS.merge('Content-length' => order.size.to_s)
648
734
  if @options[:retry_logic] && trace_number
649
735
  headers['Trace-number'] = trace_number.to_s
@@ -665,11 +751,10 @@ module ActiveMerchant #:nodoc:
665
751
  test: self.test?,
666
752
  avs_result: OrbitalGateway::AVSResult.new(response[:avs_resp_code]),
667
753
  cvv_result: OrbitalGateway::CVVResult.new(response[:cvv2_resp_code])
668
- }
669
- )
754
+ })
670
755
  end
671
756
 
672
- def remote_url(url=:primary)
757
+ def remote_url(url = :primary)
673
758
  if url == :primary
674
759
  (self.test? ? self.test_url : self.live_url)
675
760
  else
@@ -696,7 +781,7 @@ module ActiveMerchant #:nodoc:
696
781
  @options[:ip_authentication] == true
697
782
  end
698
783
 
699
- def build_new_order_xml(action, money, creditcard, parameters = {})
784
+ def build_new_order_xml(action, money, payment_source, parameters = {})
700
785
  requires!(parameters, :order_id)
701
786
  xml = xml_envelope
702
787
  xml.tag! :Request do
@@ -721,30 +806,32 @@ module ActiveMerchant #:nodoc:
721
806
 
722
807
  three_d_secure = parameters[:three_d_secure]
723
808
 
724
- add_eci(xml, creditcard, three_d_secure)
725
- add_cavv(xml, creditcard, three_d_secure)
726
- add_xid(xml, creditcard, three_d_secure)
809
+ add_eci(xml, payment_source, three_d_secure)
810
+ add_cavv(xml, payment_source, three_d_secure)
811
+ add_xid(xml, payment_source, three_d_secure)
727
812
 
728
813
  xml.tag! :OrderID, format_order_id(parameters[:order_id])
729
814
  xml.tag! :Amount, amount(money)
730
815
  xml.tag! :Comments, parameters[:comments] if parameters[:comments]
731
816
 
732
- add_level_2_tax(xml, parameters)
733
- add_level_2_advice_addendum(xml, parameters)
817
+ add_level2_tax(xml, parameters)
818
+ add_level2_advice_addendum(xml, parameters)
734
819
 
735
- add_aav(xml, creditcard, three_d_secure)
820
+ add_aav(xml, payment_source, three_d_secure)
736
821
  # CustomerAni, AVSPhoneType and AVSDestPhoneType could be added here.
737
822
 
738
- add_dpanind(xml, creditcard)
739
- add_aevv(xml, creditcard, three_d_secure)
740
- add_digital_token_cryptogram(xml, creditcard)
741
-
742
823
  if parameters[:soft_descriptors].is_a?(OrbitalSoftDescriptors)
743
824
  add_soft_descriptors(xml, parameters[:soft_descriptors])
744
825
  elsif parameters[:soft_descriptors].is_a?(Hash)
745
826
  add_soft_descriptors_from_hash(xml, parameters[:soft_descriptors])
746
827
  end
747
828
 
829
+ add_dpanind(xml, payment_source)
830
+ add_aevv(xml, payment_source, three_d_secure)
831
+ add_digital_token_cryptogram(xml, payment_source)
832
+
833
+ xml.tag! :ECPSameDayInd, parameters[:same_day] if parameters[:same_day] && ECP_SAME_DAY.include?(parameters[:same_day]) && payment_source.instance_of?(ActiveMerchant::Billing::Check)
834
+
748
835
  set_recurring_ind(xml, parameters)
749
836
 
750
837
  # Append Transaction Reference Number at the end for Refund transactions
@@ -753,12 +840,17 @@ module ActiveMerchant #:nodoc:
753
840
  xml.tag! :TxRefNum, tx_ref_num
754
841
  end
755
842
 
756
- add_level_2_purchase(xml, parameters)
757
- add_level_3_purchase(xml, parameters)
758
- add_level_3_tax(xml, parameters)
843
+ add_level2_purchase(xml, parameters)
844
+ add_level3_purchase(xml, parameters)
845
+ add_level3_tax(xml, parameters)
759
846
  add_line_items(xml, parameters) if parameters[:line_items]
847
+ add_ecp_details(xml, parameters) if payment_source.instance_of?(ActiveMerchant::Billing::Check)
848
+ add_card_indicators(xml, parameters)
760
849
  add_stored_credentials(xml, parameters)
761
- add_pymt_brand_program_code(xml, creditcard, three_d_secure)
850
+ add_pymt_brand_program_code(xml, payment_source, three_d_secure)
851
+ add_mc_program_protocol(xml, payment_source, three_d_secure)
852
+ add_mc_directory_trans_id(xml, payment_source, three_d_secure)
853
+ add_ucafind(xml, payment_source, three_d_secure)
762
854
  end
763
855
  end
764
856
  xml.target!
@@ -783,11 +875,13 @@ module ActiveMerchant #:nodoc:
783
875
  add_xml_credentials(xml)
784
876
  xml.tag! :OrderID, format_order_id(order_id)
785
877
  xml.tag! :Amount, amount(money)
786
- add_level_2_tax(xml, parameters)
878
+ add_level2_tax(xml, parameters)
787
879
  add_bin_merchant_and_terminal(xml, parameters)
788
880
  xml.tag! :TxRefNum, tx_ref_num
789
- add_level_2_purchase(xml, parameters)
790
- add_level_2_advice_addendum(xml, parameters)
881
+ add_level2_purchase(xml, parameters)
882
+ add_level2_advice_addendum(xml, parameters)
883
+ add_level3_purchase(xml, parameters)
884
+ add_level3_tax(xml, parameters)
791
885
  end
792
886
  end
793
887
  xml.target!
@@ -857,7 +951,7 @@ module ActiveMerchant #:nodoc:
857
951
  # 3. PINless Debit transactions can only use uppercase and lowercase alpha (A-Z, a-z) and numeric (0-9)
858
952
  def format_order_id(order_id)
859
953
  illegal_characters = /[^,$@&\- \w]/
860
- order_id = order_id.to_s.gsub(/\./, '-')
954
+ order_id = order_id.to_s.tr('.', '-')
861
955
  order_id.gsub!(illegal_characters, '')
862
956
  order_id.lstrip!
863
957
  order_id[0...22]
@@ -979,7 +1073,7 @@ module ActiveMerchant #:nodoc:
979
1073
  'R' => 'Issuer does not participate in AVS',
980
1074
  'UK' => 'Unknown',
981
1075
  'X' => 'Zip Match/Zip 4 Match/Address Match',
982
- 'Z' => 'Zip Match/Locale no match',
1076
+ 'Z' => 'Zip Match/Locale no match'
983
1077
  }
984
1078
 
985
1079
  # Map vendor's AVS result code to a postal match code