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
@@ -30,7 +30,7 @@ module ActiveMerchant #:nodoc:
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/' },
@@ -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
@@ -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) }
@@ -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
@@ -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
@@ -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
@@ -83,7 +83,7 @@ module ActiveMerchant
83
83
  store: 'registerAccount'
84
84
  }
85
85
 
86
- def initialize(options={})
86
+ def initialize(options = {})
87
87
  @options = options
88
88
 
89
89
  @options[:merchant] ||= 'TEST' if test?
@@ -92,7 +92,7 @@ module ActiveMerchant
92
92
  @options[:eci] ||= 'SSL'
93
93
  end
94
94
 
95
- def authorize(amount, payment_method, options={})
95
+ def authorize(amount, payment_method, options = {})
96
96
  requires!(options, :order_id)
97
97
 
98
98
  post = {}
@@ -101,7 +101,7 @@ module ActiveMerchant
101
101
  commit(:authorize, post)
102
102
  end
103
103
 
104
- def capture(amount, authorization, options={})
104
+ def capture(amount, authorization, options = {})
105
105
  requires!(options, :order_id)
106
106
 
107
107
  post = {}
@@ -110,7 +110,7 @@ module ActiveMerchant
110
110
  commit(:capture, post)
111
111
  end
112
112
 
113
- def purchase(amount, payment_method, options={})
113
+ def purchase(amount, payment_method, options = {})
114
114
  requires!(options, :order_id)
115
115
 
116
116
  post = {}
@@ -119,7 +119,7 @@ module ActiveMerchant
119
119
  commit(:purchase, post)
120
120
  end
121
121
 
122
- def refund(amount, authorization, options={})
122
+ def refund(amount, authorization, options = {})
123
123
  requires!(options, :order_id)
124
124
 
125
125
  post = {}
@@ -128,7 +128,7 @@ module ActiveMerchant
128
128
  commit(:refund, post)
129
129
  end
130
130
 
131
- def store(credit_card, options={})
131
+ def store(credit_card, options = {})
132
132
  requires!(options, :billing_id)
133
133
 
134
134
  post = {}
@@ -137,7 +137,7 @@ module ActiveMerchant
137
137
  commit(:store, post)
138
138
  end
139
139
 
140
- def status(options={})
140
+ def status(options = {})
141
141
  requires!(options, :order_id)
142
142
 
143
143
  commit(:status, 'customer.orderNumber' => options[:order_id])
@@ -194,8 +194,7 @@ module ActiveMerchant
194
194
 
195
195
  Response.new(success, message, params,
196
196
  test: (@options[:merchant].to_s == 'TEST'),
197
- authorization: post[:order_number]
198
- )
197
+ authorization: post[:order_number])
199
198
  rescue ActiveMerchant::ResponseError => e
200
199
  raise unless e.response.code == '403'
201
200
 
@@ -182,8 +182,7 @@ module ActiveMerchant
182
182
  test: test?,
183
183
  authorization: response[:orderid],
184
184
  avs_result: { code: response[:avs_code] },
185
- cvv_result: response[:cvvresp]
186
- )
185
+ cvv_result: response[:cvvresp])
187
186
  end
188
187
 
189
188
  def parse(body)
@@ -133,12 +133,12 @@ module ActiveMerchant #:nodoc:
133
133
  '99' => 'Generic decline or unable to parse issuer response code'
134
134
  }
135
135
 
136
- def initialize(options={})
136
+ def initialize(options = {})
137
137
  requires!(options, :cert_str)
138
138
  super
139
139
  end
140
140
 
141
- def purchase(money, payment, options={})
141
+ def purchase(money, payment, options = {})
142
142
  request = build_xml_request do |xml|
143
143
  add_invoice(xml, money, options)
144
144
  add_payment(xml, payment, options)
@@ -151,7 +151,7 @@ module ActiveMerchant #:nodoc:
151
151
  commit(request)
152
152
  end
153
153
 
154
- def authorize(money, payment, options={})
154
+ def authorize(money, payment, options = {})
155
155
  request = build_xml_request do |xml|
156
156
  add_invoice(xml, money, options)
157
157
  add_payment(xml, payment, options)
@@ -164,7 +164,7 @@ module ActiveMerchant #:nodoc:
164
164
  commit(request)
165
165
  end
166
166
 
167
- def capture(money, authorization, options={})
167
+ def capture(money, authorization, options = {})
168
168
  request = build_xml_request do |xml|
169
169
  add_invoice(xml, money, options)
170
170
  add_account(xml, options)
@@ -175,7 +175,7 @@ module ActiveMerchant #:nodoc:
175
175
  commit(request)
176
176
  end
177
177
 
178
- def refund(money, authorization, options={})
178
+ def refund(money, authorization, options = {})
179
179
  request = build_xml_request do |xml|
180
180
  add_invoice(xml, money, options)
181
181
  add_account(xml, options)
@@ -186,11 +186,11 @@ module ActiveMerchant #:nodoc:
186
186
  commit(request)
187
187
  end
188
188
 
189
- def void(authorization, options={})
189
+ def void(authorization, options = {})
190
190
  refund(nil, authorization, options)
191
191
  end
192
192
 
193
- def credit(money, payment, options={})
193
+ def credit(money, payment, options = {})
194
194
  request = build_xml_request do |xml|
195
195
  add_invoice(xml, money, options)
196
196
  add_payment(xml, payment, options)
@@ -201,7 +201,7 @@ module ActiveMerchant #:nodoc:
201
201
  commit(request)
202
202
  end
203
203
 
204
- def verify(credit_card, options={})
204
+ def verify(credit_card, options = {})
205
205
  MultiResponse.run(:use_first_response) do |r|
206
206
  r.process { authorize(100, credit_card, options) }
207
207
  r.process(:ignore_result) { void(r.authorization, options) }