activemerchant 1.114.0 → 1.116.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +45 -0
  3. data/lib/active_merchant.rb +1 -1
  4. data/lib/active_merchant/billing/avs_result.rb +1 -1
  5. data/lib/active_merchant/billing/compatibility.rb +3 -3
  6. data/lib/active_merchant/billing/credit_card_methods.rb +5 -5
  7. data/lib/active_merchant/billing/gateways/adyen.rb +23 -13
  8. data/lib/active_merchant/billing/gateways/allied_wallet.rb +7 -7
  9. data/lib/active_merchant/billing/gateways/authorize_net.rb +13 -11
  10. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -4
  11. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +1 -1
  12. data/lib/active_merchant/billing/gateways/axcessms.rb +8 -9
  13. data/lib/active_merchant/billing/gateways/balanced.rb +4 -3
  14. data/lib/active_merchant/billing/gateways/bambora_apac.rb +7 -7
  15. data/lib/active_merchant/billing/gateways/bank_frick.rb +7 -7
  16. data/lib/active_merchant/billing/gateways/banwire.rb +1 -1
  17. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +6 -4
  18. data/lib/active_merchant/billing/gateways/beanstream.rb +3 -3
  19. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +4 -5
  20. data/lib/active_merchant/billing/gateways/blue_pay.rb +2 -3
  21. data/lib/active_merchant/billing/gateways/blue_snap.rb +19 -17
  22. data/lib/active_merchant/billing/gateways/bogus.rb +19 -19
  23. data/lib/active_merchant/billing/gateways/borgun.rb +11 -11
  24. data/lib/active_merchant/billing/gateways/bpoint.rb +8 -8
  25. data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
  26. data/lib/active_merchant/billing/gateways/braintree_blue.rb +7 -10
  27. data/lib/active_merchant/billing/gateways/bridge_pay.rb +7 -7
  28. data/lib/active_merchant/billing/gateways/cams.rb +8 -8
  29. data/lib/active_merchant/billing/gateways/card_connect.rb +1 -1
  30. data/lib/active_merchant/billing/gateways/card_save.rb +1 -1
  31. data/lib/active_merchant/billing/gateways/card_stream.rb +2 -2
  32. data/lib/active_merchant/billing/gateways/cardknox.rb +7 -7
  33. data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
  34. data/lib/active_merchant/billing/gateways/cecabank.rb +5 -5
  35. data/lib/active_merchant/billing/gateways/cenpos.rb +10 -10
  36. data/lib/active_merchant/billing/gateways/checkout.rb +2 -2
  37. data/lib/active_merchant/billing/gateways/checkout_v2.rb +16 -19
  38. data/lib/active_merchant/billing/gateways/clearhaus.rb +7 -7
  39. data/lib/active_merchant/billing/gateways/commercegate.rb +1 -1
  40. data/lib/active_merchant/billing/gateways/conekta.rb +2 -2
  41. data/lib/active_merchant/billing/gateways/creditcall.rb +10 -10
  42. data/lib/active_merchant/billing/gateways/credorax.rb +9 -9
  43. data/lib/active_merchant/billing/gateways/ct_payment.rb +10 -10
  44. data/lib/active_merchant/billing/gateways/culqi.rb +9 -9
  45. data/lib/active_merchant/billing/gateways/cyber_source.rb +30 -31
  46. data/lib/active_merchant/billing/gateways/d_local.rb +11 -11
  47. data/lib/active_merchant/billing/gateways/data_cash.rb +2 -3
  48. data/lib/active_merchant/billing/gateways/decidir.rb +9 -8
  49. data/lib/active_merchant/billing/gateways/dibs.rb +8 -8
  50. data/lib/active_merchant/billing/gateways/digitzs.rb +5 -5
  51. data/lib/active_merchant/billing/gateways/ebanx.rb +9 -9
  52. data/lib/active_merchant/billing/gateways/efsnet.rb +2 -3
  53. data/lib/active_merchant/billing/gateways/elavon.rb +251 -232
  54. data/lib/active_merchant/billing/gateways/element.rb +8 -8
  55. data/lib/active_merchant/billing/gateways/evo_ca.rb +5 -6
  56. data/lib/active_merchant/billing/gateways/eway.rb +3 -4
  57. data/lib/active_merchant/billing/gateways/eway_managed.rb +6 -7
  58. data/lib/active_merchant/billing/gateways/eway_rapid.rb +6 -6
  59. data/lib/active_merchant/billing/gateways/exact.rb +8 -9
  60. data/lib/active_merchant/billing/gateways/ezic.rb +7 -7
  61. data/lib/active_merchant/billing/gateways/fat_zebra.rb +4 -4
  62. data/lib/active_merchant/billing/gateways/federated_canada.rb +2 -3
  63. data/lib/active_merchant/billing/gateways/first_giving.rb +1 -1
  64. data/lib/active_merchant/billing/gateways/first_pay.rb +6 -6
  65. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +7 -7
  66. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +4 -4
  67. data/lib/active_merchant/billing/gateways/flo2cash.rb +8 -8
  68. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
  69. data/lib/active_merchant/billing/gateways/forte.rb +14 -8
  70. data/lib/active_merchant/billing/gateways/global_collect.rb +10 -10
  71. data/lib/active_merchant/billing/gateways/global_transport.rb +7 -7
  72. data/lib/active_merchant/billing/gateways/hdfc.rb +9 -9
  73. data/lib/active_merchant/billing/gateways/hps.rb +7 -7
  74. data/lib/active_merchant/billing/gateways/iats_payments.rb +9 -4
  75. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
  76. data/lib/active_merchant/billing/gateways/inspire.rb +3 -4
  77. data/lib/active_merchant/billing/gateways/instapay.rb +1 -2
  78. data/lib/active_merchant/billing/gateways/ipp.rb +5 -5
  79. data/lib/active_merchant/billing/gateways/iridium.rb +14 -15
  80. data/lib/active_merchant/billing/gateways/iveri.rb +7 -7
  81. data/lib/active_merchant/billing/gateways/ixopay.rb +7 -7
  82. data/lib/active_merchant/billing/gateways/jetpay.rb +1 -2
  83. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +4 -5
  84. data/lib/active_merchant/billing/gateways/kushki.rb +6 -6
  85. data/lib/active_merchant/billing/gateways/latitude19.rb +14 -14
  86. data/lib/active_merchant/billing/gateways/linkpoint.rb +4 -5
  87. data/lib/active_merchant/billing/gateways/litle.rb +11 -11
  88. data/lib/active_merchant/billing/gateways/mastercard.rb +10 -10
  89. data/lib/active_merchant/billing/gateways/mercado_pago.rb +7 -7
  90. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +1 -2
  91. data/lib/active_merchant/billing/gateways/merchant_one.rb +1 -1
  92. data/lib/active_merchant/billing/gateways/merchant_partners.rb +10 -10
  93. data/lib/active_merchant/billing/gateways/merchant_ware.rb +5 -7
  94. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +4 -6
  95. data/lib/active_merchant/billing/gateways/mercury.rb +4 -4
  96. data/lib/active_merchant/billing/gateways/metrics_global.rb +4 -5
  97. data/lib/active_merchant/billing/gateways/micropayment.rb +8 -8
  98. data/lib/active_merchant/billing/gateways/migs.rb +3 -4
  99. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +2 -4
  100. data/lib/active_merchant/billing/gateways/monei.rb +7 -7
  101. data/lib/active_merchant/billing/gateways/moneris.rb +4 -3
  102. data/lib/active_merchant/billing/gateways/money_movers.rb +2 -3
  103. data/lib/active_merchant/billing/gateways/mundipagg.rb +37 -10
  104. data/lib/active_merchant/billing/gateways/nab_transact.rb +2 -4
  105. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +7 -7
  106. data/lib/active_merchant/billing/gateways/net_registry.rb +1 -2
  107. data/lib/active_merchant/billing/gateways/netaxept.rb +6 -6
  108. data/lib/active_merchant/billing/gateways/netbanx.rb +8 -8
  109. data/lib/active_merchant/billing/gateways/netbilling.rb +4 -5
  110. data/lib/active_merchant/billing/gateways/network_merchants.rb +2 -3
  111. data/lib/active_merchant/billing/gateways/nmi.rb +21 -7
  112. data/lib/active_merchant/billing/gateways/ogone.rb +3 -3
  113. data/lib/active_merchant/billing/gateways/omise.rb +13 -13
  114. data/lib/active_merchant/billing/gateways/openpay.rb +3 -4
  115. data/lib/active_merchant/billing/gateways/opp.rb +9 -9
  116. data/lib/active_merchant/billing/gateways/optimal_payment.rb +2 -3
  117. data/lib/active_merchant/billing/gateways/orbital.rb +61 -66
  118. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +3 -4
  119. data/lib/active_merchant/billing/gateways/pagarme.rb +8 -8
  120. data/lib/active_merchant/billing/gateways/pago_facil.rb +2 -2
  121. data/lib/active_merchant/billing/gateways/pay_conex.rb +8 -8
  122. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +6 -7
  123. data/lib/active_merchant/billing/gateways/pay_hub.rb +7 -8
  124. data/lib/active_merchant/billing/gateways/pay_junction.rb +2 -3
  125. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +9 -9
  126. data/lib/active_merchant/billing/gateways/pay_secure.rb +2 -3
  127. data/lib/active_merchant/billing/gateways/paybox_direct.rb +23 -1
  128. data/lib/active_merchant/billing/gateways/payeezy.rb +9 -9
  129. data/lib/active_merchant/billing/gateways/payex.rb +6 -7
  130. data/lib/active_merchant/billing/gateways/payflow.rb +1 -1
  131. data/lib/active_merchant/billing/gateways/payment_express.rb +1 -2
  132. data/lib/active_merchant/billing/gateways/paymentez.rb +5 -5
  133. data/lib/active_merchant/billing/gateways/paymill.rb +7 -7
  134. data/lib/active_merchant/billing/gateways/paypal_express.rb +1 -1
  135. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
  136. data/lib/active_merchant/billing/gateways/payscout.rb +1 -2
  137. data/lib/active_merchant/billing/gateways/paystation.rb +3 -4
  138. data/lib/active_merchant/billing/gateways/payu_in.rb +3 -3
  139. data/lib/active_merchant/billing/gateways/payu_latam.rb +17 -10
  140. data/lib/active_merchant/billing/gateways/payway.rb +8 -9
  141. data/lib/active_merchant/billing/gateways/plugnpay.rb +1 -2
  142. data/lib/active_merchant/billing/gateways/pro_pay.rb +8 -8
  143. data/lib/active_merchant/billing/gateways/psigate.rb +2 -3
  144. data/lib/active_merchant/billing/gateways/psl_card.rb +1 -2
  145. data/lib/active_merchant/billing/gateways/qbms.rb +1 -2
  146. data/lib/active_merchant/billing/gateways/quantum.rb +1 -2
  147. data/lib/active_merchant/billing/gateways/quickbooks.rb +1 -1
  148. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +3 -4
  149. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -2
  150. data/lib/active_merchant/billing/gateways/qvalent.rb +8 -8
  151. data/lib/active_merchant/billing/gateways/realex.rb +1 -1
  152. data/lib/active_merchant/billing/gateways/redsys.rb +4 -4
  153. data/lib/active_merchant/billing/gateways/s5.rb +7 -7
  154. data/lib/active_merchant/billing/gateways/safe_charge.rb +12 -12
  155. data/lib/active_merchant/billing/gateways/sage.rb +3 -5
  156. data/lib/active_merchant/billing/gateways/sage_pay.rb +2 -3
  157. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
  158. data/lib/active_merchant/billing/gateways/secure_net.rb +1 -2
  159. data/lib/active_merchant/billing/gateways/secure_pay.rb +3 -4
  160. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +2 -4
  161. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -2
  162. data/lib/active_merchant/billing/gateways/securion_pay.rb +5 -6
  163. data/lib/active_merchant/billing/gateways/skip_jack.rb +2 -3
  164. data/lib/active_merchant/billing/gateways/smart_ps.rb +5 -6
  165. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +7 -7
  166. data/lib/active_merchant/billing/gateways/spreedly_core.rb +6 -6
  167. data/lib/active_merchant/billing/gateways/stripe.rb +9 -9
  168. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +9 -0
  169. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +3 -4
  170. data/lib/active_merchant/billing/gateways/telr.rb +8 -8
  171. data/lib/active_merchant/billing/gateways/trans_first.rb +2 -2
  172. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +12 -12
  173. data/lib/active_merchant/billing/gateways/transact_pro.rb +9 -9
  174. data/lib/active_merchant/billing/gateways/trust_commerce.rb +1 -2
  175. data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -1
  176. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +32 -32
  177. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +3 -4
  178. data/lib/active_merchant/billing/gateways/vanco.rb +3 -3
  179. data/lib/active_merchant/billing/gateways/verifi.rb +1 -2
  180. data/lib/active_merchant/billing/gateways/viaklix.rb +1 -2
  181. data/lib/active_merchant/billing/gateways/visanet_peru.rb +10 -10
  182. data/lib/active_merchant/billing/gateways/webpay.rb +2 -2
  183. data/lib/active_merchant/billing/gateways/wepay.rb +3 -2
  184. data/lib/active_merchant/billing/gateways/wirecard.rb +1 -2
  185. data/lib/active_merchant/billing/gateways/worldpay.rb +12 -8
  186. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +14 -16
  187. data/lib/active_merchant/billing/gateways/worldpay_us.rb +7 -7
  188. data/lib/active_merchant/billing/response.rb +1 -1
  189. data/lib/active_merchant/country.rb +1 -1
  190. data/lib/active_merchant/network_connection_retries.rb +2 -2
  191. data/lib/active_merchant/post_data.rb +1 -1
  192. data/lib/active_merchant/posts_data.rb +1 -1
  193. data/lib/active_merchant/version.rb +1 -1
  194. data/lib/support/ssl_verify.rb +2 -2
  195. data/lib/support/ssl_version.rb +2 -2
  196. metadata +2 -2
@@ -99,7 +99,7 @@ module ActiveMerchant #:nodoc:
99
99
  # * <tt>money</tt> -- The amount to be captured as an Integer value in cents.
100
100
  # * <tt>authorization</tt> -- The authorization returned from the previous authorize request.
101
101
  def capture(money, authorization, options = {})
102
- post = {trans_id: authorization}
102
+ post = { trans_id: authorization }
103
103
  add_customer_data(post, options)
104
104
  commit('PRIOR_AUTH_CAPTURE', money, post)
105
105
  end
@@ -110,7 +110,7 @@ module ActiveMerchant #:nodoc:
110
110
  #
111
111
  # * <tt>authorization</tt> - The authorization returned from the previous authorize request.
112
112
  def void(authorization, options = {})
113
- post = {trans_id: authorization}
113
+ post = { trans_id: authorization }
114
114
  add_duplicate_window(post)
115
115
  commit('VOID', nil, post)
116
116
  end
@@ -136,7 +136,7 @@ module ActiveMerchant #:nodoc:
136
136
  requires!(options, :card_number)
137
137
 
138
138
  post = { trans_id: identification,
139
- card_num: options[:card_number]}
139
+ card_num: options[:card_number] }
140
140
 
141
141
  post[:first_name] = options[:first_name] if options[:first_name]
142
142
  post[:last_name] = options[:last_name] if options[:last_name]
@@ -180,8 +180,7 @@ module ActiveMerchant #:nodoc:
180
180
  authorization: response[:transaction_id],
181
181
  fraud_review: fraud_review?(response),
182
182
  avs_result: { code: response[:avs_result_code] },
183
- cvv_result: response[:card_code]
184
- )
183
+ cvv_result: response[:card_code])
185
184
  end
186
185
 
187
186
  def success?(response)
@@ -11,12 +11,12 @@ module ActiveMerchant #:nodoc:
11
11
  self.money_format = :cents
12
12
  self.supported_cardtypes = %i[visa master american_express]
13
13
 
14
- def initialize(options={})
14
+ def initialize(options = {})
15
15
  requires!(options, :access_key)
16
16
  super
17
17
  end
18
18
 
19
- def purchase(amount, payment_method, options={})
19
+ def purchase(amount, payment_method, options = {})
20
20
  post = {}
21
21
  add_invoice(post, amount, options)
22
22
  add_payment_method(post, payment_method, options)
@@ -25,7 +25,7 @@ module ActiveMerchant #:nodoc:
25
25
  commit('purchase', post)
26
26
  end
27
27
 
28
- def authorize(amount, payment_method, options={})
28
+ def authorize(amount, payment_method, options = {})
29
29
  post = {}
30
30
  add_invoice(post, amount, options)
31
31
  add_payment_method(post, payment_method, options)
@@ -34,27 +34,27 @@ module ActiveMerchant #:nodoc:
34
34
  commit('authorize', post)
35
35
  end
36
36
 
37
- def capture(amount, authorization, options={})
37
+ def capture(amount, authorization, options = {})
38
38
  post = {}
39
39
  add_reference(post, authorization)
40
40
  add_invoice(post, amount, options)
41
41
  commit('capture', post)
42
42
  end
43
43
 
44
- def void(authorization, options={})
44
+ def void(authorization, options = {})
45
45
  post = {}
46
46
  add_reference(post, authorization)
47
47
  commit('void', post)
48
48
  end
49
49
 
50
- def refund(amount, authorization, options={})
50
+ def refund(amount, authorization, options = {})
51
51
  post = {}
52
52
  add_reference(post, authorization)
53
53
  add_invoice(post, amount, options)
54
54
  commit('refund', post)
55
55
  end
56
56
 
57
- def verify(credit_card, options={})
57
+ def verify(credit_card, options = {})
58
58
  MultiResponse.run(:use_first_response) do |r|
59
59
  r.process { authorize(250, credit_card, options) }
60
60
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -83,7 +83,7 @@ module ActiveMerchant #:nodoc:
83
83
  post['params[title]'] = options[:description] if options[:description]
84
84
  end
85
85
 
86
- def add_payment_method(post, payment_method, options={})
86
+ def add_payment_method(post, payment_method, options = {})
87
87
  post[:number] = payment_method.number
88
88
  post[:recurring] = 1 if options[:recurring] == true
89
89
  post[:cvc2] = payment_method.verification_value
@@ -70,7 +70,7 @@ module ActiveMerchant #:nodoc:
70
70
 
71
71
  # MiGS works by merchants being either purchase only or authorize/capture
72
72
  # So authorize is the same as purchase when in authorize mode
73
- alias_method :authorize, :purchase
73
+ alias authorize purchase
74
74
 
75
75
  # ==== Options
76
76
  #
@@ -123,7 +123,7 @@ module ActiveMerchant #:nodoc:
123
123
  refund(money, authorization, options)
124
124
  end
125
125
 
126
- def verify(credit_card, options={})
126
+ def verify(credit_card, options = {})
127
127
  MultiResponse.run do |r|
128
128
  r.process { authorize(100, credit_card, options) }
129
129
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -286,8 +286,7 @@ module ActiveMerchant #:nodoc:
286
286
  authorization: response[:TransactionNo],
287
287
  fraud_review: fraud_review?(response),
288
288
  avs_result: { code: avs_response_code },
289
- cvv_result: cvv_result_code
290
- )
289
+ cvv_result: cvv_result_code)
291
290
  end
292
291
 
293
292
  def success?(response)
@@ -148,15 +148,13 @@ module ActiveMerchant #:nodoc:
148
148
  def commit(action, params)
149
149
  data = ssl_post(url(action), build_request(action, params),
150
150
  { 'Content-Type' => 'text/xml; charset=utf-8',
151
- 'SOAPAction' => "#{xmlns(action)}#{action}" }
152
- )
151
+ 'SOAPAction' => "#{xmlns(action)}#{action}" })
153
152
 
154
153
  response = parse(action, data)
155
154
  Response.new(successful?(action, response), message_from(action, response), response,
156
155
  test: test?,
157
156
  authorization: authorization_from(action, response),
158
- avs_result: { code: response[:avs_code] }
159
- )
157
+ avs_result: { code: response[:avs_code] })
160
158
  end
161
159
 
162
160
  def authorization_from(action, response)
@@ -29,7 +29,7 @@ module ActiveMerchant #:nodoc:
29
29
  # :login User login
30
30
  # :pwd User password
31
31
  #
32
- def initialize(options={})
32
+ def initialize(options = {})
33
33
  requires!(options, :sender_id, :channel_id, :login, :pwd)
34
34
  super
35
35
  end
@@ -45,7 +45,7 @@ module ActiveMerchant #:nodoc:
45
45
  # :currency Sale currency to override money object or default (optional)
46
46
  #
47
47
  # Returns Active Merchant response object
48
- def purchase(money, credit_card, options={})
48
+ def purchase(money, credit_card, options = {})
49
49
  execute_new_order(:purchase, money, credit_card, options)
50
50
  end
51
51
 
@@ -60,7 +60,7 @@ module ActiveMerchant #:nodoc:
60
60
  # :currency Sale currency to override money object or default (optional)
61
61
  #
62
62
  # Returns Active Merchant response object
63
- def authorize(money, credit_card, options={})
63
+ def authorize(money, credit_card, options = {})
64
64
  execute_new_order(:authorize, money, credit_card, options)
65
65
  end
66
66
 
@@ -76,7 +76,7 @@ module ActiveMerchant #:nodoc:
76
76
  # Note: you should pass either order_id or description
77
77
  #
78
78
  # Returns Active Merchant response object
79
- def capture(money, authorization, options={})
79
+ def capture(money, authorization, options = {})
80
80
  execute_dependant(:capture, money, authorization, options)
81
81
  end
82
82
 
@@ -92,7 +92,7 @@ module ActiveMerchant #:nodoc:
92
92
  # Note: you should pass either order_id or description
93
93
  #
94
94
  # Returns Active Merchant response object
95
- def refund(money, authorization, options={})
95
+ def refund(money, authorization, options = {})
96
96
  execute_dependant(:refund, money, authorization, options)
97
97
  end
98
98
 
@@ -103,7 +103,7 @@ module ActiveMerchant #:nodoc:
103
103
  # :order_id Merchant created id for the authorization (optional)
104
104
  #
105
105
  # Returns Active Merchant response object
106
- def void(authorization, options={})
106
+ def void(authorization, options = {})
107
107
  execute_dependant(:void, nil, authorization, options)
108
108
  end
109
109
 
@@ -117,7 +117,7 @@ module ActiveMerchant #:nodoc:
117
117
  # :currency Sale currency to override money object or default (optional)
118
118
  #
119
119
  # Returns Active Merchant response object of Authorization operation
120
- def verify(credit_card, options={})
120
+ def verify(credit_card, options = {})
121
121
  MultiResponse.run(:use_first_response) do |r|
122
122
  r.process { authorize(100, credit_card, options) }
123
123
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -133,7 +133,7 @@ module ActiveMerchant #:nodoc:
133
133
  commit 'refund', crediting_params(authorization, amount: amount(money))
134
134
  end
135
135
 
136
- def verify(credit_card, options={})
136
+ def verify(credit_card, options = {})
137
137
  requires!(options, :order_id)
138
138
  post = {}
139
139
  add_payment_source(post, credit_card, options)
@@ -302,9 +302,10 @@ module ActiveMerchant #:nodoc:
302
302
  message_from(response[:message]),
303
303
  response,
304
304
  test: test?,
305
- avs_result: {code: response[:avs_result_code]},
305
+ avs_result: { code: response[:avs_result_code] },
306
306
  cvv_result: response[:cvd_result_code] && response[:cvd_result_code][-1, 1],
307
- authorization: authorization_from(response))
307
+ authorization: authorization_from(response)
308
+ )
308
309
  end
309
310
 
310
311
  # Generates a Moneris authorization string of the form 'trans_id;receipt_id'.
@@ -116,9 +116,8 @@ module ActiveMerchant #:nodoc:
116
116
  Response.new(success?(response), message, response,
117
117
  test: test?,
118
118
  authorization: response['transactionid'],
119
- avs_result: {code: response['avsresponse']},
120
- cvv_result: response['cvvresponse']
121
- )
119
+ avs_result: { code: response['avsresponse'] },
120
+ cvv_result: response['cvvresponse'])
122
121
  end
123
122
 
124
123
  def success?(response)
@@ -28,48 +28,50 @@ module ActiveMerchant #:nodoc:
28
28
  '500' => 'An internal error occurred;'
29
29
  }
30
30
 
31
- def initialize(options={})
31
+ def initialize(options = {})
32
32
  requires!(options, :api_key)
33
33
  super
34
34
  end
35
35
 
36
- def purchase(money, payment, options={})
36
+ def purchase(money, payment, options = {})
37
37
  post = {}
38
38
  add_invoice(post, money, options)
39
39
  add_customer_data(post, options) unless payment.is_a?(String)
40
40
  add_shipping_address(post, options)
41
41
  add_payment(post, payment, options)
42
+ add_submerchant(post, options)
42
43
 
43
44
  commit('sale', post)
44
45
  end
45
46
 
46
- def authorize(money, payment, options={})
47
+ def authorize(money, payment, options = {})
47
48
  post = {}
48
49
  add_invoice(post, money, options)
49
50
  add_customer_data(post, options) unless payment.is_a?(String)
50
51
  add_shipping_address(post, options)
51
52
  add_payment(post, payment, options)
52
53
  add_capture_flag(post, payment)
54
+ add_submerchant(post, options)
53
55
  commit('authonly', post)
54
56
  end
55
57
 
56
- def capture(money, authorization, options={})
58
+ def capture(money, authorization, options = {})
57
59
  post = {}
58
60
  post[:code] = authorization
59
61
  add_invoice(post, money, options)
60
62
  commit('capture', post, authorization)
61
63
  end
62
64
 
63
- def refund(money, authorization, options={})
65
+ def refund(money, authorization, options = {})
64
66
  add_invoice(post = {}, money, options)
65
67
  commit('refund', post, authorization)
66
68
  end
67
69
 
68
- def void(authorization, options={})
70
+ def void(authorization, options = {})
69
71
  commit('void', nil, authorization)
70
72
  end
71
73
 
72
- def store(payment, options={})
74
+ def store(payment, options = {})
73
75
  post = {}
74
76
  options.update(name: payment.name)
75
77
  options = add_customer(options) unless options[:customer_id]
@@ -77,7 +79,7 @@ module ActiveMerchant #:nodoc:
77
79
  commit('store', post, options[:customer_id])
78
80
  end
79
81
 
80
- def verify(credit_card, options={})
82
+ def verify(credit_card, options = {})
81
83
  MultiResponse.run(:use_first_response) do |r|
82
84
  r.process { authorize(100, credit_card, options) }
83
85
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -202,6 +204,31 @@ module ActiveMerchant #:nodoc:
202
204
  %w[sodexo vr].include? card_brand(payment)
203
205
  end
204
206
 
207
+ def add_submerchant(post, options)
208
+ if submerchant = options[:submerchant]
209
+ post[:SubMerchant] = {}
210
+ post[:SubMerchant][:Merchant_Category_Code] = submerchant[:merchant_category_code] if submerchant[:merchant_category_code]
211
+ post[:SubMerchant][:Payment_Facilitator_Code] = submerchant[:payment_facilitator_code] if submerchant[:payment_facilitator_code]
212
+ post[:SubMerchant][:Code] = submerchant[:code] if submerchant[:code]
213
+ post[:SubMerchant][:Name] = submerchant[:name] if submerchant[:name]
214
+ post[:SubMerchant][:Document] = submerchant[:document] if submerchant[:document]
215
+ post[:SubMerchant][:Type] = submerchant[:type] if submerchant[:type]
216
+ post[:SubMerchant][:Phone] = {}
217
+ post[:SubMerchant][:Phone][:Country_Code] = submerchant[:phone][:country_code] if submerchant.dig(:phone, :country_code)
218
+ post[:SubMerchant][:Phone][:Number] = submerchant[:phone][:number] if submerchant.dig(:phone, :number)
219
+ post[:SubMerchant][:Phone][:Area_Code] = submerchant[:phone][:area_code] if submerchant.dig(:phone, :area_code)
220
+ post[:SubMerchant][:Address] = {}
221
+ post[:SubMerchant][:Address][:Street] = submerchant[:address][:street] if submerchant.dig(:address, :street)
222
+ post[:SubMerchant][:Address][:Number] = submerchant[:address][:number] if submerchant.dig(:address, :number)
223
+ post[:SubMerchant][:Address][:Complement] = submerchant[:address][:complement] if submerchant.dig(:address, :complement)
224
+ post[:SubMerchant][:Address][:Neighborhood] = submerchant[:address][:neighborhood] if submerchant.dig(:address, :neighborhood)
225
+ post[:SubMerchant][:Address][:City] = submerchant[:address][:city] if submerchant.dig(:address, :city)
226
+ post[:SubMerchant][:Address][:State] = submerchant[:address][:state] if submerchant.dig(:address, :state)
227
+ post[:SubMerchant][:Address][:Country] = submerchant[:address][:country] if submerchant.dig(:address, :country)
228
+ post[:SubMerchant][:Address][:Zip_Code] = submerchant[:address][:zip_code] if submerchant.dig(:address, :zip_code)
229
+ end
230
+ end
231
+
205
232
  def headers
206
233
  {
207
234
  'Authorization' => 'Basic ' + Base64.strict_encode64("#{@options[:api_key]}:"),
@@ -275,7 +302,7 @@ module ActiveMerchant #:nodoc:
275
302
  parsed_response_body = parse(error.response.body)
276
303
  message = parsed_response_body['message']
277
304
 
278
- parsed_response_body['errors']&.each do |type, descriptions|
305
+ parsed_response_body['errors']&.each do |_type, descriptions|
279
306
  message += ' | '
280
307
  message += descriptions.join(', ')
281
308
  end
@@ -291,7 +318,7 @@ module ActiveMerchant #:nodoc:
291
318
  error_string = ''
292
319
 
293
320
  response['last_transaction']['gateway_response']['errors']&.each do |error|
294
- error.each do |key, value|
321
+ error.each do |_key, value|
295
322
  error_string += ' | ' unless error_string.blank?
296
323
  error_string += value
297
324
  end
@@ -235,16 +235,14 @@ module ActiveMerchant #:nodoc:
235
235
 
236
236
  Response.new(success?(response), message_from(response), response,
237
237
  test: test?,
238
- authorization: authorization_from(action, response)
239
- )
238
+ authorization: authorization_from(action, response))
240
239
  end
241
240
 
242
241
  def commit_periodic(action, request)
243
242
  response = parse(ssl_post(test? ? self.test_periodic_url : self.live_periodic_url, build_periodic_request(action, request)))
244
243
  Response.new(success?(response), message_from(response), response,
245
244
  test: test?,
246
- authorization: authorization_from(action, response)
247
- )
245
+ authorization: authorization_from(action, response))
248
246
  end
249
247
 
250
248
  def success?(response)
@@ -13,12 +13,12 @@ module ActiveMerchant #:nodoc:
13
13
  self.homepage_url = 'http://www.ncrretailonline.com'
14
14
  self.display_name = 'NCR Secure Pay'
15
15
 
16
- def initialize(options={})
16
+ def initialize(options = {})
17
17
  requires!(options, :username, :password)
18
18
  super
19
19
  end
20
20
 
21
- def purchase(money, payment, options={})
21
+ def purchase(money, payment, options = {})
22
22
  post = {}
23
23
  add_invoice(post, money, options)
24
24
  add_payment(post, payment)
@@ -27,7 +27,7 @@ module ActiveMerchant #:nodoc:
27
27
  commit('sale', post)
28
28
  end
29
29
 
30
- def authorize(money, payment, options={})
30
+ def authorize(money, payment, options = {})
31
31
  post = {}
32
32
  add_invoice(post, money, options)
33
33
  add_payment(post, payment)
@@ -36,7 +36,7 @@ module ActiveMerchant #:nodoc:
36
36
  commit('preauth', post)
37
37
  end
38
38
 
39
- def capture(money, authorization, options={})
39
+ def capture(money, authorization, options = {})
40
40
  post = {}
41
41
  add_reference(post, authorization)
42
42
  add_invoice(post, money, options)
@@ -44,7 +44,7 @@ module ActiveMerchant #:nodoc:
44
44
  commit('preauthcomplete', post)
45
45
  end
46
46
 
47
- def refund(money, authorization, options={})
47
+ def refund(money, authorization, options = {})
48
48
  post = {}
49
49
  add_reference(post, authorization)
50
50
  add_invoice(post, money, options)
@@ -52,13 +52,13 @@ module ActiveMerchant #:nodoc:
52
52
  commit('credit', post)
53
53
  end
54
54
 
55
- def void(authorization, options={})
55
+ def void(authorization, options = {})
56
56
  post = {}
57
57
  add_reference(post, authorization)
58
58
  commit('void', post)
59
59
  end
60
60
 
61
- def verify(credit_card, options={})
61
+ def verify(credit_card, options = {})
62
62
  MultiResponse.run(:use_first_response) do |r|
63
63
  r.process { authorize(100, credit_card, options) }
64
64
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -145,8 +145,7 @@ module ActiveMerchant
145
145
  response = parse(ssl_post(self.live_url, post_data(action, params)))
146
146
 
147
147
  Response.new(response['status'] == 'approved', message_from(response), response,
148
- authorization: authorization_from(response, action)
149
- )
148
+ authorization: authorization_from(response, action))
150
149
  end
151
150
 
152
151
  def post_data(action, params)
@@ -94,12 +94,12 @@ module ActiveMerchant #:nodoc:
94
94
  commit('Netaxept/query.aspx', post)
95
95
  end
96
96
 
97
- def add_credentials(post, options, secure=true)
97
+ def add_credentials(post, options, secure = true)
98
98
  post[:merchantId] = @options[:login]
99
99
  post[:token] = @options[:password] if secure
100
100
  end
101
101
 
102
- def add_authorization(post, authorization, money=nil)
102
+ def add_authorization(post, authorization, money = nil)
103
103
  post[:transactionId] = authorization
104
104
  post[:transactionAmount] = amount(money) if money
105
105
  end
@@ -118,7 +118,7 @@ module ActiveMerchant #:nodoc:
118
118
  post[:securityCode] = options.verification_value
119
119
  end
120
120
 
121
- def commit(path, parameters, xml=true)
121
+ def commit(path, parameters, xml = true)
122
122
  raw = parse(ssl_get(build_url(path, parameters)), xml)
123
123
 
124
124
  success = false
@@ -141,12 +141,12 @@ module ActiveMerchant #:nodoc:
141
141
  )
142
142
  end
143
143
 
144
- def parse(result, expects_xml=true)
144
+ def parse(result, expects_xml = true)
145
145
  if expects_xml
146
146
  doc = REXML::Document.new(result)
147
147
  extract_xml(doc.root).merge(container: doc.root.name)
148
148
  else
149
- {result: result}
149
+ { result: result }
150
150
  end
151
151
  end
152
152
 
@@ -162,7 +162,7 @@ module ActiveMerchant #:nodoc:
162
162
  end
163
163
  end
164
164
 
165
- def build_url(base, parameters=nil)
165
+ def build_url(base, parameters = nil)
166
166
  url = (test? ? self.test_url : self.live_url).dup
167
167
  url << base
168
168
  if parameters