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
@@ -82,7 +82,7 @@ module ActiveMerchant #:nodoc:
82
82
  # +:interval => { :unit => :months, :length => 3 }+ (REQUIRED)
83
83
  # * <tt>:duration</tt> -- A hash containing keys for the <tt>:start_date</tt> the subscription begins (also the date the
84
84
  # initial billing occurs) and the total number of billing <tt>:occurrences</tt> or payments for the subscription. (REQUIRED)
85
- def recurring(money, creditcard, options={})
85
+ def recurring(money, creditcard, options = {})
86
86
  requires!(options, :interval, :duration, :billing_address)
87
87
  requires!(options[:interval], :length, %i[unit days months])
88
88
  requires!(options[:duration], :start_date, :occurrences)
@@ -110,7 +110,7 @@ module ActiveMerchant #:nodoc:
110
110
  #
111
111
  # * <tt>:subscription_id</tt> -- A string containing the <tt>:subscription_id</tt> of the recurring payment already in place
112
112
  # for a given credit card. (REQUIRED)
113
- def update_recurring(options={})
113
+ def update_recurring(options = {})
114
114
  requires!(options, :subscription_id)
115
115
  request = build_recurring_request(:update, options)
116
116
  recurring_commit(:update, request)
@@ -395,8 +395,7 @@ module ActiveMerchant #:nodoc:
395
395
 
396
396
  Response.new(success, message, response,
397
397
  test: test_mode,
398
- authorization: response[:subscription_id]
399
- )
398
+ authorization: response[:subscription_id])
400
399
  end
401
400
 
402
401
  def recurring_parse(action, xml)
@@ -878,7 +878,7 @@ module ActiveMerchant #:nodoc:
878
878
 
879
879
  def parse_direct_response(params)
880
880
  delimiter = @options[:delimiter] || ','
881
- direct_response = {'raw' => params}
881
+ direct_response = { 'raw' => params }
882
882
  direct_response_fields = params.split(delimiter)
883
883
  direct_response.merge(
884
884
  {
@@ -928,7 +928,7 @@ module ActiveMerchant #:nodoc:
928
928
  'card_type' => direct_response_fields[51] || '',
929
929
  'split_tender_id' => direct_response_fields[52] || '',
930
930
  'requested_amount' => direct_response_fields[53] || '',
931
- 'balance_on_card' => direct_response_fields[54] || '',
931
+ 'balance_on_card' => direct_response_fields[54] || ''
932
932
  }
933
933
  )
934
934
  end
@@ -23,33 +23,33 @@ module ActiveMerchant #:nodoc:
23
23
  PAYMENT_CODE_REFUND = 'CC.RF'
24
24
  PAYMENT_CODE_REBILL = 'CC.RB'
25
25
 
26
- def initialize(options={})
26
+ def initialize(options = {})
27
27
  requires!(options, :sender, :login, :password, :channel)
28
28
  super
29
29
  end
30
30
 
31
- def purchase(money, payment, options={})
31
+ def purchase(money, payment, options = {})
32
32
  payment_code = payment.respond_to?(:number) ? PAYMENT_CODE_DEBIT : PAYMENT_CODE_REBILL
33
33
  commit(payment_code, money, payment, options)
34
34
  end
35
35
 
36
- def authorize(money, authorization, options={})
36
+ def authorize(money, authorization, options = {})
37
37
  commit(PAYMENT_CODE_PREAUTHORIZATION, money, authorization, options)
38
38
  end
39
39
 
40
- def capture(money, authorization, options={})
40
+ def capture(money, authorization, options = {})
41
41
  commit(PAYMENT_CODE_CAPTURE, money, authorization, options)
42
42
  end
43
43
 
44
- def refund(money, authorization, options={})
44
+ def refund(money, authorization, options = {})
45
45
  commit(PAYMENT_CODE_REFUND, money, authorization, options)
46
46
  end
47
47
 
48
- def void(authorization, options={})
48
+ def void(authorization, options = {})
49
49
  commit(PAYMENT_CODE_REVERSAL, nil, authorization, options)
50
50
  end
51
51
 
52
- def verify(credit_card, options={})
52
+ def verify(credit_card, options = {})
53
53
  MultiResponse.run(:use_first_response) do |r|
54
54
  r.process { authorize(100, credit_card, options) }
55
55
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -73,8 +73,7 @@ module ActiveMerchant #:nodoc:
73
73
 
74
74
  Response.new(success, message, response,
75
75
  authorization: authorization,
76
- test: (response[:mode] != 'LIVE')
77
- )
76
+ test: (response[:mode] != 'LIVE'))
78
77
  end
79
78
 
80
79
  def parse(body)
@@ -99,7 +99,7 @@ module ActiveMerchant #:nodoc:
99
99
  commit('refunds', "debits/#{reference_identifier_from(identifier)}/refunds", post)
100
100
  end
101
101
 
102
- def store(credit_card, options={})
102
+ def store(credit_card, options = {})
103
103
  post = {}
104
104
 
105
105
  post[:number] = credit_card.number
@@ -156,7 +156,7 @@ module ActiveMerchant #:nodoc:
156
156
  post[:meta] = options[:meta]
157
157
  end
158
158
 
159
- def commit(entity_name, path, post, method=:post)
159
+ def commit(entity_name, path, post, method = :post)
160
160
  raw_response =
161
161
  begin
162
162
  parse(
@@ -165,7 +165,8 @@ module ActiveMerchant #:nodoc:
165
165
  live_url + "/#{path}",
166
166
  post_data(post),
167
167
  headers
168
- ))
168
+ )
169
+ )
169
170
  rescue ResponseError => e
170
171
  raise unless e.response.code.to_s =~ /4\d\d/
171
172
 
@@ -254,7 +255,7 @@ module ActiveMerchant #:nodoc:
254
255
  'Authorization' => 'Basic ' + Base64.encode64(@options[:login].to_s + ':').strip,
255
256
  'User-Agent' => "Balanced/v1.1 ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
256
257
  'Accept' => 'application/vnd.api+json;revision=1.1',
257
- 'X-Balanced-User-Agent' => @@ua,
258
+ 'X-Balanced-User-Agent' => @@ua
258
259
  }
259
260
  end
260
261
  end
@@ -18,15 +18,15 @@ module ActiveMerchant #:nodoc:
18
18
  '05' => STANDARD_ERROR_CODE[:card_declined],
19
19
  '06' => STANDARD_ERROR_CODE[:processing_error],
20
20
  '14' => STANDARD_ERROR_CODE[:invalid_number],
21
- '54' => STANDARD_ERROR_CODE[:expired_card],
21
+ '54' => STANDARD_ERROR_CODE[:expired_card]
22
22
  }
23
23
 
24
- def initialize(options={})
24
+ def initialize(options = {})
25
25
  requires!(options, :username, :password)
26
26
  super
27
27
  end
28
28
 
29
- def purchase(money, payment, options={})
29
+ def purchase(money, payment, options = {})
30
30
  commit('SubmitSinglePayment') do |xml|
31
31
  xml.Transaction do
32
32
  xml.CustRef options[:order_id]
@@ -39,7 +39,7 @@ module ActiveMerchant #:nodoc:
39
39
  end
40
40
  end
41
41
 
42
- def authorize(money, payment, options={})
42
+ def authorize(money, payment, options = {})
43
43
  commit('SubmitSinglePayment') do |xml|
44
44
  xml.Transaction do
45
45
  xml.CustRef options[:order_id]
@@ -52,7 +52,7 @@ module ActiveMerchant #:nodoc:
52
52
  end
53
53
  end
54
54
 
55
- def capture(money, authorization, options={})
55
+ def capture(money, authorization, options = {})
56
56
  commit('SubmitSingleCapture') do |xml|
57
57
  xml.Capture do
58
58
  xml.Receipt authorization
@@ -62,7 +62,7 @@ module ActiveMerchant #:nodoc:
62
62
  end
63
63
  end
64
64
 
65
- def refund(money, authorization, options={})
65
+ def refund(money, authorization, options = {})
66
66
  commit('SubmitSingleRefund') do |xml|
67
67
  xml.Refund do
68
68
  xml.Receipt authorization
@@ -72,7 +72,7 @@ module ActiveMerchant #:nodoc:
72
72
  end
73
73
  end
74
74
 
75
- def void(authorization, options={})
75
+ def void(authorization, options = {})
76
76
  commit('SubmitSingleVoid') do |xml|
77
77
  xml.Void do
78
78
  xml.Receipt authorization
@@ -82,7 +82,7 @@ module ActiveMerchant #:nodoc:
82
82
  end
83
83
  end
84
84
 
85
- def store(payment, options={})
85
+ def store(payment, options = {})
86
86
  commit('TokeniseCreditCard') do |xml|
87
87
  xml.TokeniseCreditCard do
88
88
  xml.CardNumber payment.number
@@ -24,15 +24,15 @@ module ActiveMerchant #:nodoc:
24
24
  'authonly' => 'CC.PA',
25
25
  'capture' => 'CC.CP',
26
26
  'refund' => 'CC.RF',
27
- 'void' => 'CC.RV',
27
+ 'void' => 'CC.RV'
28
28
  }
29
29
 
30
- def initialize(options={})
30
+ def initialize(options = {})
31
31
  requires!(options, :sender, :channel, :userid, :userpwd)
32
32
  super
33
33
  end
34
34
 
35
- def purchase(money, payment, options={})
35
+ def purchase(money, payment, options = {})
36
36
  post = {}
37
37
  add_invoice(post, money, options)
38
38
  add_payment(post, payment)
@@ -42,7 +42,7 @@ module ActiveMerchant #:nodoc:
42
42
  commit('sale', post)
43
43
  end
44
44
 
45
- def authorize(money, payment, options={})
45
+ def authorize(money, payment, options = {})
46
46
  post = {}
47
47
  add_invoice(post, money, options)
48
48
  add_payment(post, payment)
@@ -52,7 +52,7 @@ module ActiveMerchant #:nodoc:
52
52
  commit('authonly', post)
53
53
  end
54
54
 
55
- def capture(money, authorization, options={})
55
+ def capture(money, authorization, options = {})
56
56
  post = {}
57
57
  post[:authorization] = authorization
58
58
  add_invoice(post, money, options)
@@ -60,7 +60,7 @@ module ActiveMerchant #:nodoc:
60
60
  commit('capture', post)
61
61
  end
62
62
 
63
- def refund(money, authorization, options={})
63
+ def refund(money, authorization, options = {})
64
64
  post = {}
65
65
  post[:authorization] = authorization
66
66
  add_invoice(post, money, options)
@@ -68,14 +68,14 @@ module ActiveMerchant #:nodoc:
68
68
  commit('refund', post)
69
69
  end
70
70
 
71
- def void(authorization, options={})
71
+ def void(authorization, options = {})
72
72
  post = {}
73
73
  post[:authorization] = authorization
74
74
 
75
75
  commit('void', post)
76
76
  end
77
77
 
78
- def verify(credit_card, options={})
78
+ def verify(credit_card, options = {})
79
79
  MultiResponse.run(:use_first_response) do |r|
80
80
  r.process { authorize(100, credit_card, options) }
81
81
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -74,7 +74,7 @@ module ActiveMerchant #:nodoc:
74
74
 
75
75
  def card_brand(card)
76
76
  brand = super
77
- ({'master' => 'mastercard', 'american_express' => 'amex'}[brand] || brand)
77
+ ({ 'master' => 'mastercard', 'american_express' => 'amex' }[brand] || brand)
78
78
  end
79
79
 
80
80
  def parse(body)
@@ -71,21 +71,23 @@ module ActiveMerchant #:nodoc:
71
71
  post[:shopperName] = options[:shopper_name] if options[:shopper_name]
72
72
 
73
73
  if options[:third_party_payout]
74
- post[:recurring] = options[:recurring_contract] || {contract: 'PAYOUT'}
74
+ post[:recurring] = options[:recurring_contract] || { contract: 'PAYOUT' }
75
75
  MultiResponse.run do |r|
76
76
  r.process {
77
77
  commit(
78
78
  'storeDetailAndSubmitThirdParty',
79
79
  post,
80
80
  @options[:store_payout_account],
81
- @options[:store_payout_password])
81
+ @options[:store_payout_password]
82
+ )
82
83
  }
83
84
  r.process {
84
85
  commit(
85
86
  'confirmThirdParty',
86
87
  modification_request(r.authorization, @options),
87
88
  @options[:review_payout_account],
88
- @options[:review_payout_password])
89
+ @options[:review_payout_password]
90
+ )
89
91
  }
90
92
  end
91
93
  else
@@ -108,7 +110,7 @@ module ActiveMerchant #:nodoc:
108
110
  def store(creditcard, options = {})
109
111
  post = store_request(options)
110
112
  post[:card] = credit_card_hash(creditcard)
111
- post[:recurring] = {contract: 'RECURRING'}
113
+ post[:recurring] = { contract: 'RECURRING' }
112
114
 
113
115
  commit('store', post)
114
116
  end
@@ -104,7 +104,7 @@ module ActiveMerchant #:nodoc:
104
104
  end
105
105
  end
106
106
 
107
- def verify(source, options={})
107
+ def verify(source, options = {})
108
108
  MultiResponse.run(:use_first_response) do |r|
109
109
  r.process { authorize(100, source, options) }
110
110
  r.process(:ignore_result) { void(r.authorization, options) }
@@ -175,10 +175,10 @@ module ActiveMerchant #:nodoc:
175
175
  # can't actually delete a secure profile with the supplicated API. This function sets the status of the profile to closed (C).
176
176
  # Closed profiles will have to removed manually.
177
177
  def delete(vault_id)
178
- update(vault_id, false, {status: 'C'})
178
+ update(vault_id, false, { status: 'C' })
179
179
  end
180
180
 
181
- alias_method :unstore, :delete
181
+ alias unstore delete
182
182
 
183
183
  # Update the values (such as CC expiration) stored at
184
184
  # the gateway. The CC number must be supplied in the
@@ -410,15 +410,14 @@ module ActiveMerchant #:nodoc:
410
410
  recurring_post(post_data(params, false))
411
411
  end
412
412
 
413
- def post(data, use_profile_api=nil)
413
+ def post(data, use_profile_api = nil)
414
414
  response = parse(ssl_post((use_profile_api ? SECURE_PROFILE_URL : self.live_url), data))
415
415
  response[:customer_vault_id] = response[:customerCode] if response[:customerCode]
416
416
  build_response(success?(response), message_from(response), response,
417
417
  test: test? || response[:authCode] == 'TEST',
418
418
  authorization: authorization_from(response),
419
419
  cvv_result: CVD_CODES[response[:cvdId]],
420
- avs_result: { code: AVS_CODES.include?(response[:avsId]) ? AVS_CODES[response[:avsId]] : response[:avsId] }
421
- )
420
+ avs_result: { code: AVS_CODES.include?(response[:avsId]) ? AVS_CODES[response[:avsId]] : response[:avsId] })
422
421
  end
423
422
 
424
423
  def recurring_post(data)
@@ -443,7 +442,7 @@ module ActiveMerchant #:nodoc:
443
442
  end
444
443
 
445
444
  def add_source(post, source)
446
- if source.is_a?(String) or source.is_a?(Integer)
445
+ if source.is_a?(String) || source.is_a?(Integer)
447
446
  post[:customerCode] = source
448
447
  else
449
448
  card_brand(source) == 'check' ? add_check(post, source) : add_credit_card(post, source)
@@ -468,7 +467,7 @@ module ActiveMerchant #:nodoc:
468
467
  params[:vbvEnabled] = '0'
469
468
  params[:scEnabled] = '0'
470
469
 
471
- params.reject { |k, v| v.blank? }.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
470
+ params.reject { |_k, v| v.blank? }.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
472
471
  end
473
472
  end
474
473
  end
@@ -332,7 +332,7 @@ module ActiveMerchant #:nodoc:
332
332
  parse(ssl_post(url, post_data(action, fields)))
333
333
  end
334
334
 
335
- def parse_recurring(response_fields, opts={}) # expected status?
335
+ def parse_recurring(response_fields, opts = {}) # expected status?
336
336
  parsed = {}
337
337
  response_fields.each do |k, v|
338
338
  mapped_key = REBILL_FIELD_MAP.include?(k) ? REBILL_FIELD_MAP[k] : k
@@ -366,8 +366,7 @@ module ActiveMerchant #:nodoc:
366
366
  test: test?,
367
367
  authorization: (parsed[:rebid] && parsed[:rebid] != '' ? parsed[:rebid] : parsed[:transaction_id]),
368
368
  avs_result: { code: parsed[:avs_result_code] },
369
- cvv_result: parsed[:card_code]
370
- )
369
+ cvv_result: parsed[:card_code])
371
370
  end
372
371
 
373
372
  def message_from(parsed)
@@ -58,7 +58,7 @@ module ActiveMerchant
58
58
  'line1: N, zip: M, name: N' => 'W',
59
59
  'line1: N, zip: N, name: U' => 'N',
60
60
  'line1: N, zip: N, name: M' => 'K',
61
- 'line1: N, zip: N, name: N' => 'N',
61
+ 'line1: N, zip: N, name: N' => 'N'
62
62
  }
63
63
 
64
64
  BANK_ACCOUNT_TYPE_MAPPING = {
@@ -70,12 +70,12 @@ module ActiveMerchant
70
70
 
71
71
  STATE_CODE_COUNTRIES = %w(US CA)
72
72
 
73
- def initialize(options={})
73
+ def initialize(options = {})
74
74
  requires!(options, :api_username, :api_password)
75
75
  super
76
76
  end
77
77
 
78
- def purchase(money, payment_method, options={})
78
+ def purchase(money, payment_method, options = {})
79
79
  payment_method_details = PaymentMethodDetails.new(payment_method)
80
80
 
81
81
  commit(:purchase, :post, payment_method_details) do |doc|
@@ -87,13 +87,13 @@ module ActiveMerchant
87
87
  end
88
88
  end
89
89
 
90
- def authorize(money, payment_method, options={})
90
+ def authorize(money, payment_method, options = {})
91
91
  commit(:authorize) do |doc|
92
92
  add_auth_purchase(doc, money, payment_method, options)
93
93
  end
94
94
  end
95
95
 
96
- def capture(money, authorization, options={})
96
+ def capture(money, authorization, options = {})
97
97
  commit(:capture, :put) do |doc|
98
98
  add_authorization(doc, authorization)
99
99
  add_order(doc, options)
@@ -101,7 +101,7 @@ module ActiveMerchant
101
101
  end
102
102
  end
103
103
 
104
- def refund(money, authorization, options={})
104
+ def refund(money, authorization, options = {})
105
105
  commit(:refund, :put) do |doc|
106
106
  add_authorization(doc, authorization)
107
107
  add_amount(doc, money, options)
@@ -109,14 +109,14 @@ module ActiveMerchant
109
109
  end
110
110
  end
111
111
 
112
- def void(authorization, options={})
112
+ def void(authorization, options = {})
113
113
  commit(:void, :put) do |doc|
114
114
  add_authorization(doc, authorization)
115
115
  add_order(doc, options)
116
116
  end
117
117
  end
118
118
 
119
- def verify(payment_method, options={})
119
+ def verify(payment_method, options = {})
120
120
  authorize(0, payment_method, options)
121
121
  end
122
122
 
@@ -177,7 +177,7 @@ module ActiveMerchant
177
177
  add_order(doc, options)
178
178
  doc.send('store-card', options[:store_card] || false)
179
179
  add_amount(doc, money, options)
180
- add_fraud_info(doc, options)
180
+ add_fraud_info(doc, payment_method, options)
181
181
 
182
182
  if payment_method.is_a?(String)
183
183
  doc.send('vaulted-shopper-id', payment_method)
@@ -200,6 +200,7 @@ module ActiveMerchant
200
200
  doc.send('last-name', payment_method.last_name)
201
201
  doc.send('personal-identification-number', options[:personal_identification_number]) if options[:personal_identification_number]
202
202
  doc.email(options[:email]) if options[:email]
203
+ doc.phone(options[:phone_number]) if options[:phone_number]
203
204
  add_address(doc, options)
204
205
  end
205
206
 
@@ -212,12 +213,28 @@ module ActiveMerchant
212
213
  end
213
214
  end
214
215
 
215
- def add_description(doc, description)
216
+ def add_metadata(doc, options)
217
+ transaction_meta_data = options[:transaction_meta_data] || []
218
+ return if transaction_meta_data.empty? && !options[:description]
219
+
216
220
  doc.send('transaction-meta-data') do
217
- doc.send('meta-data') do
218
- doc.send('meta-key', 'description')
219
- doc.send('meta-value', truncate(description, 500))
220
- doc.send('meta-description', 'Description')
221
+ # ensure backwards compatibility for calls expecting :description
222
+ # to become meta-data fields.
223
+ if options[:description]
224
+ doc.send('meta-data') do
225
+ doc.send('meta-key', 'description')
226
+ doc.send('meta-value', truncate(options[:description], 500))
227
+ doc.send('meta-description', 'Description')
228
+ end
229
+ end
230
+
231
+ # https://developers.bluesnap.com/v8976-XML/docs/meta-data
232
+ transaction_meta_data.each do |entry|
233
+ doc.send('meta-data') do
234
+ doc.send('meta-key', truncate(entry[:meta_key], 40))
235
+ doc.send('meta-value', truncate(entry[:meta_value], 500))
236
+ doc.send('meta-description', truncate(entry[:meta_description], 40))
237
+ end
221
238
  end
222
239
  end
223
240
  end
@@ -225,7 +242,7 @@ module ActiveMerchant
225
242
  def add_order(doc, options)
226
243
  doc.send('merchant-transaction-id', truncate(options[:order_id], 50)) if options[:order_id]
227
244
  doc.send('soft-descriptor', options[:soft_descriptor]) if options[:soft_descriptor]
228
- add_description(doc, options[:description]) if options[:description]
245
+ add_metadata(doc, options)
229
246
  add_3ds(doc, options[:three_d_secure]) if options[:three_d_secure]
230
247
  add_level_3_data(doc, options)
231
248
  end
@@ -236,7 +253,8 @@ module ActiveMerchant
236
253
 
237
254
  doc.country(address[:country]) if address[:country]
238
255
  doc.state(address[:state]) if address[:state] && STATE_CODE_COUNTRIES.include?(address[:country])
239
- doc.address(address[:address]) if address[:address]
256
+ doc.address(address[:address1]) if address[:address1]
257
+ doc.address2(address[:address2]) if address[:address2]
240
258
  doc.city(address[:city]) if address[:city]
241
259
  doc.zip(address[:zip]) if address[:zip]
242
260
  end
@@ -298,9 +316,30 @@ module ActiveMerchant
298
316
  doc.send('transaction-id', authorization)
299
317
  end
300
318
 
301
- def add_fraud_info(doc, options)
319
+ def add_fraud_info(doc, payment_method, options)
302
320
  doc.send('transaction-fraud-info') do
303
321
  doc.send('shopper-ip-address', options[:ip]) if options[:ip]
322
+
323
+ unless payment_method.is_a? String
324
+ doc.send('shipping-contact-info') do
325
+ add_shipping_contact_info(doc, payment_method, options)
326
+ end
327
+ end
328
+ end
329
+ end
330
+
331
+ def add_shipping_contact_info(doc, payment_method, options)
332
+ if address = options[:shipping_address]
333
+ # https://developers.bluesnap.com/v8976-XML/docs/shipping-contact-info
334
+ doc.send('first-name', payment_method.first_name)
335
+ doc.send('last-name', payment_method.last_name)
336
+
337
+ doc.country(address[:country]) if address[:country]
338
+ doc.state(address[:state]) if address[:state] && STATE_CODE_COUNTRIES.include?(address[:country])
339
+ doc.address1(address[:address1]) if address[:address1]
340
+ doc.address2(address[:address2]) if address[:address2]
341
+ doc.city(address[:city]) if address[:city]
342
+ doc.zip(address[:zip]) if address[:zip]
304
343
  end
305
344
  end
306
345
 
@@ -314,8 +353,8 @@ module ActiveMerchant
314
353
 
315
354
  add_echeck_transaction(doc, payment_method_details.payment_method, options, vaulted_shopper_id.present?) if payment_method_details.check?
316
355
 
317
- add_fraud_info(doc, options)
318
- add_description(doc, options)
356
+ add_fraud_info(doc, payment_method_details.payment_method, options)
357
+ add_metadata(doc, options)
319
358
  end
320
359
 
321
360
  def add_echeck_transaction(doc, check, options, vaulted_shopper)
@@ -350,12 +389,21 @@ module ActiveMerchant
350
389
  parsed = {}
351
390
  doc = Nokogiri::XML(response.body)
352
391
  doc.root.xpath('*').each do |node|
392
+ name = node.name.downcase
393
+
353
394
  if node.elements.empty?
354
- parsed[node.name.downcase] = node.text
395
+ parsed[name] = node.text
396
+ elsif name == 'transaction-meta-data'
397
+ metadata = []
398
+ node.elements.each { |m|
399
+ metadata.push parse_metadata_entry(m)
400
+ }
401
+
402
+ parsed['transaction-meta-data'] = metadata
355
403
  else
356
- node.elements.each do |childnode|
404
+ node.elements.each { |childnode|
357
405
  parse_element(parsed, childnode)
358
- end
406
+ }
359
407
  end
360
408
  end
361
409
 
@@ -363,6 +411,18 @@ module ActiveMerchant
363
411
  parsed
364
412
  end
365
413
 
414
+ def parse_metadata_entry(node)
415
+ entry = {}
416
+
417
+ node.elements.each { |e|
418
+ entry = entry.merge({
419
+ e.name => e.text
420
+ })
421
+ }
422
+
423
+ entry
424
+ end
425
+
366
426
  def parse_element(parsed, node)
367
427
  if !node.elements.empty?
368
428
  node.elements.each { |e| parse_element(parsed, e) }
@@ -476,7 +536,7 @@ module ActiveMerchant
476
536
  def headers
477
537
  {
478
538
  'Content-Type' => 'application/xml',
479
- 'Authorization' => ('Basic ' + Base64.strict_encode64("#{@options[:api_username]}:#{@options[:api_password]}").strip),
539
+ 'Authorization' => ('Basic ' + Base64.strict_encode64("#{@options[:api_username]}:#{@options[:api_password]}").strip)
480
540
  }
481
541
  end
482
542