activemerchant 1.110.0 → 1.116.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (200) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +82 -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.rb +1 -1
  7. data/lib/active_merchant/billing/credit_card_methods.rb +6 -6
  8. data/lib/active_merchant/billing/gateway.rb +1 -1
  9. data/lib/active_merchant/billing/gateways/adyen.rb +30 -15
  10. data/lib/active_merchant/billing/gateways/allied_wallet.rb +7 -7
  11. data/lib/active_merchant/billing/gateways/authorize_net.rb +19 -17
  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 -2
  14. data/lib/active_merchant/billing/gateways/axcessms.rb +8 -9
  15. data/lib/active_merchant/billing/gateways/balanced.rb +5 -4
  16. data/lib/active_merchant/billing/gateways/bambora_apac.rb +8 -8
  17. data/lib/active_merchant/billing/gateways/bank_frick.rb +8 -8
  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 +83 -23
  24. data/lib/active_merchant/billing/gateways/bogus.rb +19 -19
  25. data/lib/active_merchant/billing/gateways/borgun.rb +12 -12
  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 +14 -17
  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 +8 -8
  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 +11 -11
  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 +15 -9
  45. data/lib/active_merchant/billing/gateways/ct_payment.rb +10 -10
  46. data/lib/active_merchant/billing/gateways/culqi.rb +10 -10
  47. data/lib/active_merchant/billing/gateways/cyber_source.rb +58 -37
  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 +10 -9
  51. data/lib/active_merchant/billing/gateways/dibs.rb +8 -8
  52. data/lib/active_merchant/billing/gateways/digitzs.rb +6 -6
  53. data/lib/active_merchant/billing/gateways/ebanx.rb +9 -9
  54. data/lib/active_merchant/billing/gateways/efsnet.rb +3 -4
  55. data/lib/active_merchant/billing/gateways/elavon.rb +251 -232
  56. data/lib/active_merchant/billing/gateways/element.rb +12 -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 +8 -8
  61. data/lib/active_merchant/billing/gateways/exact.rb +8 -9
  62. data/lib/active_merchant/billing/gateways/ezic.rb +8 -8
  63. data/lib/active_merchant/billing/gateways/fat_zebra.rb +9 -7
  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 +4 -4
  69. data/lib/active_merchant/billing/gateways/flo2cash.rb +9 -9
  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 +15 -10
  73. data/lib/active_merchant/billing/gateways/global_transport.rb +7 -7
  74. data/lib/active_merchant/billing/gateways/hdfc.rb +10 -10
  75. data/lib/active_merchant/billing/gateways/hps.rb +16 -13
  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 +7 -7
  81. data/lib/active_merchant/billing/gateways/iridium.rb +16 -17
  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 +5 -6
  89. data/lib/active_merchant/billing/gateways/litle.rb +12 -12
  90. data/lib/active_merchant/billing/gateways/mastercard.rb +12 -12
  91. data/lib/active_merchant/billing/gateways/mercado_pago.rb +8 -8
  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 +12 -10
  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 +4 -5
  117. data/lib/active_merchant/billing/gateways/opp.rb +12 -12
  118. data/lib/active_merchant/billing/gateways/optimal_payment.rb +3 -4
  119. data/lib/active_merchant/billing/gateways/orbital.rb +66 -64
  120. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +3 -4
  121. data/lib/active_merchant/billing/gateways/pagarme.rb +9 -9
  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 +4 -5
  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 +12 -12
  131. data/lib/active_merchant/billing/gateways/payex.rb +11 -12
  132. data/lib/active_merchant/billing/gateways/payflow.rb +4 -1
  133. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -1
  134. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +1 -1
  135. data/lib/active_merchant/billing/gateways/payment_express.rb +1 -2
  136. data/lib/active_merchant/billing/gateways/paymentez.rb +5 -5
  137. data/lib/active_merchant/billing/gateways/paymill.rb +10 -10
  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 +21 -11
  144. data/lib/active_merchant/billing/gateways/payway.rb +8 -9
  145. data/lib/active_merchant/billing/gateways/plugnpay.rb +2 -3
  146. data/lib/active_merchant/billing/gateways/pro_pay.rb +8 -8
  147. data/lib/active_merchant/billing/gateways/psigate.rb +3 -4
  148. data/lib/active_merchant/billing/gateways/psl_card.rb +1 -2
  149. data/lib/active_merchant/billing/gateways/qbms.rb +4 -5
  150. data/lib/active_merchant/billing/gateways/quantum.rb +1 -2
  151. data/lib/active_merchant/billing/gateways/quickbooks.rb +4 -3
  152. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +3 -4
  153. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -2
  154. data/lib/active_merchant/billing/gateways/qvalent.rb +9 -9
  155. data/lib/active_merchant/billing/gateways/realex.rb +2 -1
  156. data/lib/active_merchant/billing/gateways/redsys.rb +7 -7
  157. data/lib/active_merchant/billing/gateways/s5.rb +7 -7
  158. data/lib/active_merchant/billing/gateways/safe_charge.rb +12 -12
  159. data/lib/active_merchant/billing/gateways/sage.rb +3 -5
  160. data/lib/active_merchant/billing/gateways/sage_pay.rb +6 -7
  161. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
  162. data/lib/active_merchant/billing/gateways/secure_net.rb +1 -2
  163. data/lib/active_merchant/billing/gateways/secure_pay.rb +3 -4
  164. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +2 -4
  165. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -2
  166. data/lib/active_merchant/billing/gateways/securion_pay.rb +5 -6
  167. data/lib/active_merchant/billing/gateways/skip_jack.rb +3 -4
  168. data/lib/active_merchant/billing/gateways/smart_ps.rb +5 -6
  169. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +7 -7
  170. data/lib/active_merchant/billing/gateways/spreedly_core.rb +6 -6
  171. data/lib/active_merchant/billing/gateways/stripe.rb +11 -11
  172. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +9 -0
  173. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +3 -4
  174. data/lib/active_merchant/billing/gateways/telr.rb +9 -9
  175. data/lib/active_merchant/billing/gateways/trans_first.rb +3 -3
  176. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +14 -14
  177. data/lib/active_merchant/billing/gateways/transact_pro.rb +9 -9
  178. data/lib/active_merchant/billing/gateways/trust_commerce.rb +8 -9
  179. data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -1
  180. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +36 -36
  181. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +4 -5
  182. data/lib/active_merchant/billing/gateways/vanco.rb +3 -3
  183. data/lib/active_merchant/billing/gateways/verifi.rb +1 -2
  184. data/lib/active_merchant/billing/gateways/viaklix.rb +1 -2
  185. data/lib/active_merchant/billing/gateways/visanet_peru.rb +10 -10
  186. data/lib/active_merchant/billing/gateways/webpay.rb +2 -2
  187. data/lib/active_merchant/billing/gateways/wepay.rb +3 -2
  188. data/lib/active_merchant/billing/gateways/wirecard.rb +1 -2
  189. data/lib/active_merchant/billing/gateways/worldpay.rb +12 -8
  190. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +14 -16
  191. data/lib/active_merchant/billing/gateways/worldpay_us.rb +9 -9
  192. data/lib/active_merchant/billing/response.rb +1 -1
  193. data/lib/active_merchant/country.rb +1 -1
  194. data/lib/active_merchant/network_connection_retries.rb +2 -2
  195. data/lib/active_merchant/post_data.rb +1 -1
  196. data/lib/active_merchant/posts_data.rb +1 -1
  197. data/lib/active_merchant/version.rb +1 -1
  198. data/lib/support/ssl_verify.rb +2 -2
  199. data/lib/support/ssl_version.rb +2 -2
  200. metadata +16 -2
@@ -45,7 +45,7 @@ module ActiveMerchant
45
45
  end
46
46
 
47
47
  def authorize(amount, payment_method, options = {})
48
- params = {transaction_type: 'authorize'}
48
+ params = { transaction_type: 'authorize' }
49
49
 
50
50
  add_invoice(params, options)
51
51
  add_reversal_id(params, options)
@@ -59,7 +59,7 @@ module ActiveMerchant
59
59
  end
60
60
 
61
61
  def capture(amount, authorization, options = {})
62
- params = {transaction_type: 'capture'}
62
+ params = { transaction_type: 'capture' }
63
63
 
64
64
  add_authorization_info(params, authorization)
65
65
  add_amount(params, amount, options)
@@ -69,7 +69,7 @@ module ActiveMerchant
69
69
  end
70
70
 
71
71
  def refund(amount, authorization, options = {})
72
- params = {transaction_type: 'refund'}
72
+ params = { transaction_type: 'refund' }
73
73
 
74
74
  add_authorization_info(params, authorization)
75
75
  add_amount(params, (amount || amount_from_authorization(authorization)), options)
@@ -78,7 +78,7 @@ module ActiveMerchant
78
78
  end
79
79
 
80
80
  def store(payment_method, options = {})
81
- params = {transaction_type: 'store'}
81
+ params = { transaction_type: 'store' }
82
82
 
83
83
  add_creditcard_for_tokenization(params, payment_method, options)
84
84
 
@@ -86,7 +86,7 @@ module ActiveMerchant
86
86
  end
87
87
 
88
88
  def void(authorization, options = {})
89
- params = {transaction_type: 'void'}
89
+ params = { transaction_type: 'void' }
90
90
 
91
91
  add_authorization_info(params, authorization, options)
92
92
  add_amount(params, amount_from_authorization(authorization), options)
@@ -94,7 +94,7 @@ module ActiveMerchant
94
94
  commit(params, options)
95
95
  end
96
96
 
97
- def verify(credit_card, options={})
97
+ def verify(credit_card, options = {})
98
98
  MultiResponse.run(:use_first_response) do |r|
99
99
  r.process { authorize(0, credit_card, options) }
100
100
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -155,7 +155,7 @@ module ActiveMerchant
155
155
  params[:auth] = 'false'
156
156
  end
157
157
 
158
- def is_store_action?(params)
158
+ def store_action?(params)
159
159
  params[:transaction_type] == 'store'
160
160
  end
161
161
 
@@ -278,7 +278,7 @@ module ActiveMerchant
278
278
  response,
279
279
  test: test?,
280
280
  authorization: authorization_from(params, response),
281
- avs_result: {code: response['avs']},
281
+ avs_result: { code: response['avs'] },
282
282
  cvv_result: response['cvv2'],
283
283
  error_code: error_code(response, success_from(response))
284
284
  )
@@ -295,7 +295,7 @@ module ActiveMerchant
295
295
  end
296
296
 
297
297
  def endpoint(params)
298
- is_store_action?(params) ? '/transactions/tokens' : '/transactions'
298
+ store_action?(params) ? '/transactions/tokens' : '/transactions'
299
299
  end
300
300
 
301
301
  def api_request(url, params)
@@ -306,7 +306,7 @@ module ActiveMerchant
306
306
  def post_data(params)
307
307
  return nil unless params
308
308
 
309
- params.reject { |k, v| v.blank? }.collect { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
309
+ params.reject { |_k, v| v.blank? }.collect { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
310
310
  end
311
311
 
312
312
  def generate_hmac(nonce, current_timestamp, payload)
@@ -373,7 +373,7 @@ module ActiveMerchant
373
373
  end
374
374
 
375
375
  def authorization_from(params, response)
376
- if is_store_action?(params)
376
+ if store_action?(params)
377
377
  if success_from(response)
378
378
  [
379
379
  response['token']['type'],
@@ -405,7 +405,7 @@ module ActiveMerchant
405
405
  end
406
406
 
407
407
  def json_error(raw_response)
408
- {'error' => "Unable to parse response: #{raw_response.inspect}"}
408
+ { 'error' => "Unable to parse response: #{raw_response.inspect}" }
409
409
  end
410
410
  end
411
411
  end
@@ -25,18 +25,18 @@ module ActiveMerchant #:nodoc:
25
25
  authorize: '3',
26
26
  cancel: '4',
27
27
  failure: '5',
28
- capture: '6',
28
+ capture: '6'
29
29
  }
30
30
 
31
31
  SOAP_ACTIONS = {
32
32
  initialize: { name: 'Initialize8', url: 'pxorder/pxorder.asmx', xmlns: 'http://external.payex.com/PxOrder/' },
33
- purchasecc: { name: 'PurchaseCC', url: 'pxconfined/pxorder.asmx', xmlns: 'http://confined.payex.com/PxOrder/', confined: true},
33
+ purchasecc: { name: 'PurchaseCC', url: 'pxconfined/pxorder.asmx', xmlns: 'http://confined.payex.com/PxOrder/', confined: true },
34
34
  cancel: { name: 'Cancel2', url: 'pxorder/pxorder.asmx', xmlns: 'http://external.payex.com/PxOrder/' },
35
35
  capture: { name: 'Capture5', url: 'pxorder/pxorder.asmx', xmlns: 'http://external.payex.com/PxOrder/' },
36
36
  credit: { name: 'Credit5', url: 'pxorder/pxorder.asmx', xmlns: 'http://external.payex.com/PxOrder/' },
37
37
  create_agreement: { name: 'CreateAgreement3', url: 'pxagreement/pxagreement.asmx', xmlns: 'http://external.payex.com/PxAgreement/' },
38
38
  delete_agreement: { name: 'DeleteAgreement', url: 'pxagreement/pxagreement.asmx', xmlns: 'http://external.payex.com/PxAgreement/' },
39
- autopay: { name: 'AutoPay3', url: 'pxagreement/pxagreement.asmx', xmlns: 'http://external.payex.com/PxAgreement/' },
39
+ autopay: { name: 'AutoPay3', url: 'pxagreement/pxagreement.asmx', xmlns: 'http://external.payex.com/PxAgreement/' }
40
40
  }
41
41
 
42
42
  def initialize(options = {})
@@ -117,7 +117,7 @@ module ActiveMerchant #:nodoc:
117
117
  # options - A standard ActiveMerchant options hash
118
118
  #
119
119
  # Returns an ActiveMerchant::Billing::Response object
120
- def void(authorization, options={})
120
+ def void(authorization, options = {})
121
121
  send_cancel(authorization)
122
122
  end
123
123
 
@@ -155,7 +155,7 @@ module ActiveMerchant #:nodoc:
155
155
  amount = amount(1) # 1 cent for authorization
156
156
  MultiResponse.run(:first) do |r|
157
157
  r.process { send_create_agreement(options) }
158
- r.process { send_initialize(amount, true, options.merge({agreement_ref: r.authorization})) }
158
+ r.process { send_initialize(amount, true, options.merge({ agreement_ref: r.authorization })) }
159
159
  order_ref = r.params['orderref']
160
160
  r.process { send_purchasecc(creditcard, order_ref) }
161
161
  end
@@ -231,7 +231,7 @@ module ActiveMerchant #:nodoc:
231
231
  description: options[:description] || options[:order_id],
232
232
  orderId: options[:order_id],
233
233
  purchaseOperation: is_auth ? 'AUTHORIZATION' : 'SALE',
234
- currency: (options[:currency] || default_currency),
234
+ currency: (options[:currency] || default_currency)
235
235
  }
236
236
  hash_fields = %i[accountNumber agreementRef price productNumber description orderId purchaseOperation currency]
237
237
  add_request_hash(properties, hash_fields)
@@ -278,7 +278,7 @@ module ActiveMerchant #:nodoc:
278
278
  def send_cancel(transaction_number)
279
279
  properties = {
280
280
  accountNumber: @options[:account],
281
- transactionNumber: transaction_number,
281
+ transactionNumber: transaction_number
282
282
  }
283
283
  hash_fields = %i[accountNumber transactionNumber]
284
284
  add_request_hash(properties, hash_fields)
@@ -310,7 +310,7 @@ module ActiveMerchant #:nodoc:
310
310
  def send_delete_agreement(authorization)
311
311
  properties = {
312
312
  accountNumber: @options[:account],
313
- agreementRef: authorization,
313
+ agreementRef: authorization
314
314
  }
315
315
  hash_fields = %i[accountNumber agreementRef]
316
316
  add_request_hash(properties, hash_fields)
@@ -341,9 +341,9 @@ module ActiveMerchant #:nodoc:
341
341
 
342
342
  def build_xml_request(soap_action, properties)
343
343
  builder = Nokogiri::XML::Builder.new
344
- builder.__send__('soap12:Envelope', {'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
344
+ builder.__send__('soap12:Envelope', { 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
345
345
  'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
346
- 'xmlns:soap12' => 'http://www.w3.org/2003/05/soap-envelope'}) do |root|
346
+ 'xmlns:soap12' => 'http://www.w3.org/2003/05/soap-envelope' }) do |root|
347
347
  root.__send__('soap12:Body') do |body|
348
348
  body.__send__(soap_action[:name], xmlns: soap_action[:xmlns]) do |doc|
349
349
  properties.each do |key, val|
@@ -389,8 +389,7 @@ module ActiveMerchant #:nodoc:
389
389
  message_from(response),
390
390
  response,
391
391
  test: test?,
392
- authorization: build_authorization(response)
393
- )
392
+ authorization: build_authorization(response))
394
393
  end
395
394
 
396
395
  def build_authorization(response)
@@ -45,7 +45,7 @@ module ActiveMerchant #:nodoc:
45
45
  commit(build_reference_request(:credit, money, reference, options), options)
46
46
  end
47
47
 
48
- def verify(payment, options={})
48
+ def verify(payment, options = {})
49
49
  if credit_card_type(payment) == 'Amex'
50
50
  MultiResponse.run(:use_first_response) do |r|
51
51
  r.process { authorize(100, payment, options) }
@@ -154,6 +154,7 @@ module ActiveMerchant #:nodoc:
154
154
  end
155
155
  end
156
156
  end
157
+ xml.tag! 'ExtData', 'Name' => 'BUTTONSOURCE', 'Value' => application_id unless application_id.blank?
157
158
  end
158
159
  xml.target!
159
160
  end
@@ -187,6 +188,7 @@ module ActiveMerchant #:nodoc:
187
188
  add_credit_card(xml, credit_card, options)
188
189
  end
189
190
  end
191
+ xml.tag! 'ExtData', 'Name' => 'BUTTONSOURCE', 'Value' => application_id unless application_id.blank?
190
192
  end
191
193
  add_level_two_three_fields(xml.target!, options)
192
194
  end
@@ -250,6 +252,7 @@ module ActiveMerchant #:nodoc:
250
252
  end
251
253
  end
252
254
  end
255
+ xml.tag! 'ExtData', 'Name' => 'BUTTONSOURCE', 'Value' => application_id unless application_id.blank?
253
256
  end
254
257
  add_level_two_three_fields(xml.target!, options)
255
258
  end
@@ -42,7 +42,7 @@ module ActiveMerchant #:nodoc:
42
42
  discover: 'Discover',
43
43
  american_express: 'Amex',
44
44
  jcb: 'JCB',
45
- diners_club: 'DinersClub',
45
+ diners_club: 'DinersClub'
46
46
  }
47
47
 
48
48
  TRANSACTIONS = {
@@ -35,7 +35,7 @@ module ActiveMerchant #:nodoc:
35
35
  'state' => @params['state'],
36
36
  'country' => @params['country'],
37
37
  'zip' => @params['zip'],
38
- 'phone' => phone, }
38
+ 'phone' => phone }
39
39
  end
40
40
  end
41
41
  end
@@ -303,8 +303,7 @@ module ActiveMerchant #:nodoc:
303
303
  # Return a response
304
304
  PaymentExpressResponse.new(response[:success] == APPROVED, message_from(response), response,
305
305
  test: response[:test_mode] == '1',
306
- authorization: authorization_from(action, response)
307
- )
306
+ authorization: authorization_from(action, response))
308
307
  end
309
308
 
310
309
  # Response XML documentation: http://www.paymentexpress.com/technical_resources/ecommerce_nonhosted/pxpost.html#XMLTxnOutput
@@ -74,14 +74,14 @@ module ActiveMerchant #:nodoc:
74
74
  post = {
75
75
  transaction: { id: authorization }
76
76
  }
77
- post[:order] = {amount: amount(money).to_f} if money
77
+ post[:order] = { amount: amount(money).to_f } if money
78
78
 
79
79
  commit_transaction('capture', post)
80
80
  end
81
81
 
82
82
  def refund(money, authorization, options = {})
83
- post = {transaction: {id: authorization}}
84
- post[:order] = {amount: amount(money).to_f} if money
83
+ post = { transaction: { id: authorization } }
84
+ post[:order] = { amount: amount(money).to_f } if money
85
85
 
86
86
  commit_transaction('refund', post)
87
87
  end
@@ -113,7 +113,7 @@ module ActiveMerchant #:nodoc:
113
113
  end
114
114
 
115
115
  def unstore(identification, options = {})
116
- post = { card: { token: identification }, user: { id: options[:user_id] }}
116
+ post = { card: { token: identification }, user: { id: options[:user_id] } }
117
117
  commit_card('delete', post)
118
118
  end
119
119
 
@@ -194,7 +194,7 @@ module ActiveMerchant #:nodoc:
194
194
  begin
195
195
  parse(raw_response)
196
196
  rescue JSON::ParserError
197
- {'status' => 'Internal server error'}
197
+ { 'status' => 'Internal server error' }
198
198
  end
199
199
  end
200
200
 
@@ -17,7 +17,7 @@ module ActiveMerchant #:nodoc:
17
17
  super
18
18
  end
19
19
 
20
- def purchase(money, payment_method, options={})
20
+ def purchase(money, payment_method, options = {})
21
21
  action_with_token(:purchase, money, payment_method, options)
22
22
  end
23
23
 
@@ -35,7 +35,7 @@ module ActiveMerchant #:nodoc:
35
35
  commit(:post, 'transactions', post)
36
36
  end
37
37
 
38
- def refund(money, authorization, options={})
38
+ def refund(money, authorization, options = {})
39
39
  post = {}
40
40
 
41
41
  post[:amount] = amount(money)
@@ -43,11 +43,11 @@ module ActiveMerchant #:nodoc:
43
43
  commit(:post, "refunds/#{transaction_id(authorization)}", post)
44
44
  end
45
45
 
46
- def void(authorization, options={})
46
+ def void(authorization, options = {})
47
47
  commit(:delete, "preauthorizations/#{preauth(authorization)}")
48
48
  end
49
49
 
50
- def store(credit_card, options={})
50
+ def store(credit_card, options = {})
51
51
  # The store request requires a currency and amount of at least $1 USD.
52
52
  # This is used for an authorization that is handled internally by Paymill.
53
53
  options[:currency] = 'USD'
@@ -94,7 +94,7 @@ module ActiveMerchant #:nodoc:
94
94
  { 'Authorization' => ('Basic ' + Base64.strict_encode64("#{@options[:private_key]}:X").chomp) }
95
95
  end
96
96
 
97
- def commit(method, action, parameters=nil)
97
+ def commit(method, action, parameters = nil)
98
98
  begin
99
99
  raw_response = ssl_request(method, live_url + action, post_data(parameters), headers)
100
100
  rescue ResponseError => e
@@ -113,7 +113,7 @@ module ActiveMerchant #:nodoc:
113
113
  parsed = JSON.parse(raw_response)
114
114
  options = {
115
115
  authorization: authorization_from(parsed),
116
- test: (parsed['mode'] == 'test'),
116
+ test: (parsed['mode'] == 'test')
117
117
  }
118
118
 
119
119
  succeeded = (parsed['data'] == []) || (parsed['data']['response_code'].to_i == 20000)
@@ -198,7 +198,7 @@ module ActiveMerchant #:nodoc:
198
198
  def post_data(params)
199
199
  return nil unless params
200
200
 
201
- no_blanks = params.reject { |key, value| value.blank? }
201
+ no_blanks = params.reject { |_key, value| value.blank? }
202
202
  no_blanks.map { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
203
203
  end
204
204
 
@@ -328,7 +328,7 @@ module ActiveMerchant #:nodoc:
328
328
  class ResponseParser
329
329
  attr_reader :raw_response, :parsed, :succeeded, :message, :options
330
330
 
331
- def initialize(raw_response='', options={})
331
+ def initialize(raw_response = '', options = {})
332
332
  @raw_response = raw_response
333
333
  @options = options
334
334
  end
@@ -357,10 +357,10 @@ module ActiveMerchant #:nodoc:
357
357
 
358
358
  def handle_response_correct_parsing
359
359
  @message = parsed['transaction']['processing']['return']['message']
360
- @options[:authorization] = parsed['transaction']['identification']['uniqueId'] if @succeeded = is_ack?
360
+ @options[:authorization] = parsed['transaction']['identification']['uniqueId'] if @succeeded = ack?
361
361
  end
362
362
 
363
- def is_ack?
363
+ def ack?
364
364
  parsed['transaction']['processing']['result'] == 'ACK'
365
365
  end
366
366
  end
@@ -73,7 +73,7 @@ module ActiveMerchant #:nodoc:
73
73
  end
74
74
 
75
75
  def authorize_reference_transaction(money, options = {})
76
- requires!(options, :reference_id, :payment_type, :invoice_id, :description, :ip)
76
+ requires!(options, :reference_id)
77
77
 
78
78
  commit 'DoReferenceTransaction', build_reference_transaction_request('Authorization', money, options)
79
79
  end
@@ -17,7 +17,7 @@ module ActiveMerchant
17
17
  end
18
18
 
19
19
  def redirect_url_for(token, options = {})
20
- options = {review: true, mobile: false}.update(options)
20
+ options = { review: true, mobile: false }.update(options)
21
21
 
22
22
  cmd = options[:mobile] ? '_express-checkout-mobile' : '_express-checkout'
23
23
  url = "#{redirect_url}?cmd=#{cmd}&token=#{token}"
@@ -120,8 +120,7 @@ module ActiveMerchant #:nodoc:
120
120
  authorization: response['transactionid'],
121
121
  fraud_review: fraud_review?(response),
122
122
  avs_result: { code: response['avsresponse'] },
123
- cvv_result: response['cvvresponse']
124
- )
123
+ cvv_result: response['cvvresponse'])
125
124
  end
126
125
 
127
126
  def message_from(response)
@@ -74,7 +74,7 @@ module ActiveMerchant #:nodoc:
74
74
  commit(post)
75
75
  end
76
76
 
77
- def refund(money, authorization, options={})
77
+ def refund(money, authorization, options = {})
78
78
  post = new_request
79
79
  add_amount(post, money, options)
80
80
  add_invoice(post, options)
@@ -83,7 +83,7 @@ module ActiveMerchant #:nodoc:
83
83
  commit(post)
84
84
  end
85
85
 
86
- def verify(credit_card, options={})
86
+ def verify(credit_card, options = {})
87
87
  authorize(0, credit_card, options)
88
88
  end
89
89
 
@@ -179,8 +179,7 @@ module ActiveMerchant #:nodoc:
179
179
 
180
180
  PaystationResponse.new(success?(response), message, response,
181
181
  test: (response[:tm]&.casecmp('t')&.zero?),
182
- authorization: response[:paystation_transaction_id]
183
- )
182
+ authorization: response[:paystation_transaction_id])
184
183
  end
185
184
 
186
185
  def success?(response)
@@ -16,12 +16,12 @@ module ActiveMerchant #:nodoc:
16
16
  self.homepage_url = 'https://www.payu.in/'
17
17
  self.display_name = 'PayU India'
18
18
 
19
- def initialize(options={})
19
+ def initialize(options = {})
20
20
  requires!(options, :key, :salt)
21
21
  super
22
22
  end
23
23
 
24
- def purchase(money, payment, options={})
24
+ def purchase(money, payment, options = {})
25
25
  requires!(options, :order_id)
26
26
 
27
27
  post = {}
@@ -41,7 +41,7 @@ module ActiveMerchant #:nodoc:
41
41
  end
42
42
  end
43
43
 
44
- def refund(money, authorization, options={})
44
+ def refund(money, authorization, options = {})
45
45
  raise ArgumentError, 'Amount is required' unless money
46
46
 
47
47
  post = {}
@@ -30,24 +30,24 @@ module ActiveMerchant #:nodoc:
30
30
  'PEN' => 500
31
31
  }
32
32
 
33
- def initialize(options={})
33
+ def initialize(options = {})
34
34
  requires!(options, :merchant_id, :account_id, :api_login, :api_key, :payment_country)
35
35
  super
36
36
  end
37
37
 
38
- def purchase(amount, payment_method, options={})
38
+ def purchase(amount, payment_method, options = {})
39
39
  post = {}
40
40
  auth_or_sale(post, 'AUTHORIZATION_AND_CAPTURE', amount, payment_method, options)
41
41
  commit('purchase', post)
42
42
  end
43
43
 
44
- def authorize(amount, payment_method, options={})
44
+ def authorize(amount, payment_method, options = {})
45
45
  post = {}
46
46
  auth_or_sale(post, 'AUTHORIZATION', amount, payment_method, options)
47
47
  commit('auth', post)
48
48
  end
49
49
 
50
- def capture(amount, authorization, options={})
50
+ def capture(amount, authorization, options = {})
51
51
  post = {}
52
52
 
53
53
  add_credentials(post, 'SUBMIT_TRANSACTION', options)
@@ -62,7 +62,7 @@ module ActiveMerchant #:nodoc:
62
62
  commit('capture', post)
63
63
  end
64
64
 
65
- def void(authorization, options={})
65
+ def void(authorization, options = {})
66
66
  post = {}
67
67
 
68
68
  add_credentials(post, 'SUBMIT_TRANSACTION', options)
@@ -72,17 +72,24 @@ module ActiveMerchant #:nodoc:
72
72
  commit('void', post)
73
73
  end
74
74
 
75
- def refund(amount, authorization, options={})
75
+ def refund(amount, authorization, options = {})
76
76
  post = {}
77
77
 
78
78
  add_credentials(post, 'SUBMIT_TRANSACTION', options)
79
- add_transaction_elements(post, 'REFUND', options)
80
- add_reference(post, authorization)
81
79
 
80
+ if options[:partial_refund]
81
+ add_transaction_elements(post, 'PARTIAL_REFUND', options)
82
+ post[:transaction][:additionalValues] ||= {}
83
+ post[:transaction][:additionalValues][:TX_VALUE] = invoice_for(amount, options)[:TX_VALUE]
84
+ else
85
+ add_transaction_elements(post, 'REFUND', options)
86
+ end
87
+
88
+ add_reference(post, authorization)
82
89
  commit('refund', post)
83
90
  end
84
91
 
85
- def verify(credit_card, options={})
92
+ def verify(credit_card, options = {})
86
93
  minimum = MINIMUMS[options[:currency].upcase] if options[:currency]
87
94
  amount = options[:verify_amount] || minimum || 100
88
95
 
@@ -133,7 +140,7 @@ module ActiveMerchant #:nodoc:
133
140
  add_extra_parameters(post, options)
134
141
  end
135
142
 
136
- def add_credentials(post, command, options={})
143
+ def add_credentials(post, command, options = {})
137
144
  post[:test] = test? unless command == 'CREATE_TOKEN'
138
145
  post[:language] = options[:language] || 'en'
139
146
  post[:command] = command
@@ -391,11 +398,14 @@ module ActiveMerchant #:nodoc:
391
398
  else
392
399
  if response['transactionResponse']
393
400
  response_message = response['transactionResponse']['responseMessage']
401
+
394
402
  response_code = response['transactionResponse']['responseCode'] || response['transactionResponse']['pendingReason']
403
+
404
+ response_message = response_code + ' | ' + response['transactionResponse']['paymentNetworkResponseErrorMessage'] unless response['transactionResponse']['paymentNetworkResponseErrorMessage'].nil?
395
405
  end
396
406
  return response_code if success
397
407
 
398
- response['error'] || response_message || response_code || 'FAILED'
408
+ response_message || response['error'] || response_code || 'FAILED'
399
409
  end
400
410
  end
401
411