activemerchant 1.114.0 → 1.116.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +45 -0
  3. data/lib/active_merchant.rb +1 -1
  4. data/lib/active_merchant/billing/avs_result.rb +1 -1
  5. data/lib/active_merchant/billing/compatibility.rb +3 -3
  6. data/lib/active_merchant/billing/credit_card_methods.rb +5 -5
  7. data/lib/active_merchant/billing/gateways/adyen.rb +23 -13
  8. data/lib/active_merchant/billing/gateways/allied_wallet.rb +7 -7
  9. data/lib/active_merchant/billing/gateways/authorize_net.rb +13 -11
  10. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -4
  11. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +1 -1
  12. data/lib/active_merchant/billing/gateways/axcessms.rb +8 -9
  13. data/lib/active_merchant/billing/gateways/balanced.rb +4 -3
  14. data/lib/active_merchant/billing/gateways/bambora_apac.rb +7 -7
  15. data/lib/active_merchant/billing/gateways/bank_frick.rb +7 -7
  16. data/lib/active_merchant/billing/gateways/banwire.rb +1 -1
  17. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +6 -4
  18. data/lib/active_merchant/billing/gateways/beanstream.rb +3 -3
  19. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +4 -5
  20. data/lib/active_merchant/billing/gateways/blue_pay.rb +2 -3
  21. data/lib/active_merchant/billing/gateways/blue_snap.rb +19 -17
  22. data/lib/active_merchant/billing/gateways/bogus.rb +19 -19
  23. data/lib/active_merchant/billing/gateways/borgun.rb +11 -11
  24. data/lib/active_merchant/billing/gateways/bpoint.rb +8 -8
  25. data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
  26. data/lib/active_merchant/billing/gateways/braintree_blue.rb +7 -10
  27. data/lib/active_merchant/billing/gateways/bridge_pay.rb +7 -7
  28. data/lib/active_merchant/billing/gateways/cams.rb +8 -8
  29. data/lib/active_merchant/billing/gateways/card_connect.rb +1 -1
  30. data/lib/active_merchant/billing/gateways/card_save.rb +1 -1
  31. data/lib/active_merchant/billing/gateways/card_stream.rb +2 -2
  32. data/lib/active_merchant/billing/gateways/cardknox.rb +7 -7
  33. data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
  34. data/lib/active_merchant/billing/gateways/cecabank.rb +5 -5
  35. data/lib/active_merchant/billing/gateways/cenpos.rb +10 -10
  36. data/lib/active_merchant/billing/gateways/checkout.rb +2 -2
  37. data/lib/active_merchant/billing/gateways/checkout_v2.rb +16 -19
  38. data/lib/active_merchant/billing/gateways/clearhaus.rb +7 -7
  39. data/lib/active_merchant/billing/gateways/commercegate.rb +1 -1
  40. data/lib/active_merchant/billing/gateways/conekta.rb +2 -2
  41. data/lib/active_merchant/billing/gateways/creditcall.rb +10 -10
  42. data/lib/active_merchant/billing/gateways/credorax.rb +9 -9
  43. data/lib/active_merchant/billing/gateways/ct_payment.rb +10 -10
  44. data/lib/active_merchant/billing/gateways/culqi.rb +9 -9
  45. data/lib/active_merchant/billing/gateways/cyber_source.rb +30 -31
  46. data/lib/active_merchant/billing/gateways/d_local.rb +11 -11
  47. data/lib/active_merchant/billing/gateways/data_cash.rb +2 -3
  48. data/lib/active_merchant/billing/gateways/decidir.rb +9 -8
  49. data/lib/active_merchant/billing/gateways/dibs.rb +8 -8
  50. data/lib/active_merchant/billing/gateways/digitzs.rb +5 -5
  51. data/lib/active_merchant/billing/gateways/ebanx.rb +9 -9
  52. data/lib/active_merchant/billing/gateways/efsnet.rb +2 -3
  53. data/lib/active_merchant/billing/gateways/elavon.rb +251 -232
  54. data/lib/active_merchant/billing/gateways/element.rb +8 -8
  55. data/lib/active_merchant/billing/gateways/evo_ca.rb +5 -6
  56. data/lib/active_merchant/billing/gateways/eway.rb +3 -4
  57. data/lib/active_merchant/billing/gateways/eway_managed.rb +6 -7
  58. data/lib/active_merchant/billing/gateways/eway_rapid.rb +6 -6
  59. data/lib/active_merchant/billing/gateways/exact.rb +8 -9
  60. data/lib/active_merchant/billing/gateways/ezic.rb +7 -7
  61. data/lib/active_merchant/billing/gateways/fat_zebra.rb +4 -4
  62. data/lib/active_merchant/billing/gateways/federated_canada.rb +2 -3
  63. data/lib/active_merchant/billing/gateways/first_giving.rb +1 -1
  64. data/lib/active_merchant/billing/gateways/first_pay.rb +6 -6
  65. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +7 -7
  66. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +4 -4
  67. data/lib/active_merchant/billing/gateways/flo2cash.rb +8 -8
  68. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
  69. data/lib/active_merchant/billing/gateways/forte.rb +14 -8
  70. data/lib/active_merchant/billing/gateways/global_collect.rb +10 -10
  71. data/lib/active_merchant/billing/gateways/global_transport.rb +7 -7
  72. data/lib/active_merchant/billing/gateways/hdfc.rb +9 -9
  73. data/lib/active_merchant/billing/gateways/hps.rb +7 -7
  74. data/lib/active_merchant/billing/gateways/iats_payments.rb +9 -4
  75. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
  76. data/lib/active_merchant/billing/gateways/inspire.rb +3 -4
  77. data/lib/active_merchant/billing/gateways/instapay.rb +1 -2
  78. data/lib/active_merchant/billing/gateways/ipp.rb +5 -5
  79. data/lib/active_merchant/billing/gateways/iridium.rb +14 -15
  80. data/lib/active_merchant/billing/gateways/iveri.rb +7 -7
  81. data/lib/active_merchant/billing/gateways/ixopay.rb +7 -7
  82. data/lib/active_merchant/billing/gateways/jetpay.rb +1 -2
  83. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +4 -5
  84. data/lib/active_merchant/billing/gateways/kushki.rb +6 -6
  85. data/lib/active_merchant/billing/gateways/latitude19.rb +14 -14
  86. data/lib/active_merchant/billing/gateways/linkpoint.rb +4 -5
  87. data/lib/active_merchant/billing/gateways/litle.rb +11 -11
  88. data/lib/active_merchant/billing/gateways/mastercard.rb +10 -10
  89. data/lib/active_merchant/billing/gateways/mercado_pago.rb +7 -7
  90. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +1 -2
  91. data/lib/active_merchant/billing/gateways/merchant_one.rb +1 -1
  92. data/lib/active_merchant/billing/gateways/merchant_partners.rb +10 -10
  93. data/lib/active_merchant/billing/gateways/merchant_ware.rb +5 -7
  94. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +4 -6
  95. data/lib/active_merchant/billing/gateways/mercury.rb +4 -4
  96. data/lib/active_merchant/billing/gateways/metrics_global.rb +4 -5
  97. data/lib/active_merchant/billing/gateways/micropayment.rb +8 -8
  98. data/lib/active_merchant/billing/gateways/migs.rb +3 -4
  99. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +2 -4
  100. data/lib/active_merchant/billing/gateways/monei.rb +7 -7
  101. data/lib/active_merchant/billing/gateways/moneris.rb +4 -3
  102. data/lib/active_merchant/billing/gateways/money_movers.rb +2 -3
  103. data/lib/active_merchant/billing/gateways/mundipagg.rb +37 -10
  104. data/lib/active_merchant/billing/gateways/nab_transact.rb +2 -4
  105. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +7 -7
  106. data/lib/active_merchant/billing/gateways/net_registry.rb +1 -2
  107. data/lib/active_merchant/billing/gateways/netaxept.rb +6 -6
  108. data/lib/active_merchant/billing/gateways/netbanx.rb +8 -8
  109. data/lib/active_merchant/billing/gateways/netbilling.rb +4 -5
  110. data/lib/active_merchant/billing/gateways/network_merchants.rb +2 -3
  111. data/lib/active_merchant/billing/gateways/nmi.rb +21 -7
  112. data/lib/active_merchant/billing/gateways/ogone.rb +3 -3
  113. data/lib/active_merchant/billing/gateways/omise.rb +13 -13
  114. data/lib/active_merchant/billing/gateways/openpay.rb +3 -4
  115. data/lib/active_merchant/billing/gateways/opp.rb +9 -9
  116. data/lib/active_merchant/billing/gateways/optimal_payment.rb +2 -3
  117. data/lib/active_merchant/billing/gateways/orbital.rb +61 -66
  118. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +3 -4
  119. data/lib/active_merchant/billing/gateways/pagarme.rb +8 -8
  120. data/lib/active_merchant/billing/gateways/pago_facil.rb +2 -2
  121. data/lib/active_merchant/billing/gateways/pay_conex.rb +8 -8
  122. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +6 -7
  123. data/lib/active_merchant/billing/gateways/pay_hub.rb +7 -8
  124. data/lib/active_merchant/billing/gateways/pay_junction.rb +2 -3
  125. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +9 -9
  126. data/lib/active_merchant/billing/gateways/pay_secure.rb +2 -3
  127. data/lib/active_merchant/billing/gateways/paybox_direct.rb +23 -1
  128. data/lib/active_merchant/billing/gateways/payeezy.rb +9 -9
  129. data/lib/active_merchant/billing/gateways/payex.rb +6 -7
  130. data/lib/active_merchant/billing/gateways/payflow.rb +1 -1
  131. data/lib/active_merchant/billing/gateways/payment_express.rb +1 -2
  132. data/lib/active_merchant/billing/gateways/paymentez.rb +5 -5
  133. data/lib/active_merchant/billing/gateways/paymill.rb +7 -7
  134. data/lib/active_merchant/billing/gateways/paypal_express.rb +1 -1
  135. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
  136. data/lib/active_merchant/billing/gateways/payscout.rb +1 -2
  137. data/lib/active_merchant/billing/gateways/paystation.rb +3 -4
  138. data/lib/active_merchant/billing/gateways/payu_in.rb +3 -3
  139. data/lib/active_merchant/billing/gateways/payu_latam.rb +17 -10
  140. data/lib/active_merchant/billing/gateways/payway.rb +8 -9
  141. data/lib/active_merchant/billing/gateways/plugnpay.rb +1 -2
  142. data/lib/active_merchant/billing/gateways/pro_pay.rb +8 -8
  143. data/lib/active_merchant/billing/gateways/psigate.rb +2 -3
  144. data/lib/active_merchant/billing/gateways/psl_card.rb +1 -2
  145. data/lib/active_merchant/billing/gateways/qbms.rb +1 -2
  146. data/lib/active_merchant/billing/gateways/quantum.rb +1 -2
  147. data/lib/active_merchant/billing/gateways/quickbooks.rb +1 -1
  148. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +3 -4
  149. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -2
  150. data/lib/active_merchant/billing/gateways/qvalent.rb +8 -8
  151. data/lib/active_merchant/billing/gateways/realex.rb +1 -1
  152. data/lib/active_merchant/billing/gateways/redsys.rb +4 -4
  153. data/lib/active_merchant/billing/gateways/s5.rb +7 -7
  154. data/lib/active_merchant/billing/gateways/safe_charge.rb +12 -12
  155. data/lib/active_merchant/billing/gateways/sage.rb +3 -5
  156. data/lib/active_merchant/billing/gateways/sage_pay.rb +2 -3
  157. data/lib/active_merchant/billing/gateways/sallie_mae.rb +1 -2
  158. data/lib/active_merchant/billing/gateways/secure_net.rb +1 -2
  159. data/lib/active_merchant/billing/gateways/secure_pay.rb +3 -4
  160. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +2 -4
  161. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -2
  162. data/lib/active_merchant/billing/gateways/securion_pay.rb +5 -6
  163. data/lib/active_merchant/billing/gateways/skip_jack.rb +2 -3
  164. data/lib/active_merchant/billing/gateways/smart_ps.rb +5 -6
  165. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +7 -7
  166. data/lib/active_merchant/billing/gateways/spreedly_core.rb +6 -6
  167. data/lib/active_merchant/billing/gateways/stripe.rb +9 -9
  168. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +9 -0
  169. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +3 -4
  170. data/lib/active_merchant/billing/gateways/telr.rb +8 -8
  171. data/lib/active_merchant/billing/gateways/trans_first.rb +2 -2
  172. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +12 -12
  173. data/lib/active_merchant/billing/gateways/transact_pro.rb +9 -9
  174. data/lib/active_merchant/billing/gateways/trust_commerce.rb +1 -2
  175. data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -1
  176. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +32 -32
  177. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +3 -4
  178. data/lib/active_merchant/billing/gateways/vanco.rb +3 -3
  179. data/lib/active_merchant/billing/gateways/verifi.rb +1 -2
  180. data/lib/active_merchant/billing/gateways/viaklix.rb +1 -2
  181. data/lib/active_merchant/billing/gateways/visanet_peru.rb +10 -10
  182. data/lib/active_merchant/billing/gateways/webpay.rb +2 -2
  183. data/lib/active_merchant/billing/gateways/wepay.rb +3 -2
  184. data/lib/active_merchant/billing/gateways/wirecard.rb +1 -2
  185. data/lib/active_merchant/billing/gateways/worldpay.rb +12 -8
  186. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +14 -16
  187. data/lib/active_merchant/billing/gateways/worldpay_us.rb +7 -7
  188. data/lib/active_merchant/billing/response.rb +1 -1
  189. data/lib/active_merchant/country.rb +1 -1
  190. data/lib/active_merchant/network_connection_retries.rb +2 -2
  191. data/lib/active_merchant/post_data.rb +1 -1
  192. data/lib/active_merchant/posts_data.rb +1 -1
  193. data/lib/active_merchant/version.rb +1 -1
  194. data/lib/support/ssl_verify.rb +2 -2
  195. data/lib/support/ssl_version.rb +2 -2
  196. metadata +2 -2
@@ -99,7 +99,7 @@ module ActiveMerchant #:nodoc:
99
99
  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
 
@@ -21,12 +21,12 @@ module ActiveMerchant #:nodoc:
21
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
@@ -27,12 +27,12 @@ module ActiveMerchant #:nodoc:
27
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)
@@ -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
 
@@ -329,16 +329,18 @@ module ActiveMerchant
329
329
  end
330
330
 
331
331
  def add_shipping_contact_info(doc, payment_method, options)
332
- # https://developers.bluesnap.com/v8976-XML/docs/shipping-contact-info
333
- doc.send('first-name', payment_method.first_name)
334
- doc.send('last-name', payment_method.last_name)
335
-
336
- doc.country(options[:shipping_country]) if options[:shipping_country]
337
- doc.state(options[:shipping_state]) if options[:shipping_state] && STATE_CODE_COUNTRIES.include?(options[:shipping_country])
338
- doc.address1(options[:shipping_address1]) if options[:shipping_address1]
339
- doc.address2(options[:shipping_address2]) if options[:shipping_address2]
340
- doc.city(options[:shipping_city]) if options[:shipping_city]
341
- doc.zip(options[:shipping_zip]) if options[:shipping_zip]
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]
343
+ end
342
344
  end
343
345
 
344
346
  def add_alt_transaction_purchase(doc, money, payment_method_details, options)
@@ -47,9 +47,9 @@ module ActiveMerchant #:nodoc:
47
47
  money = amount(money)
48
48
  case normalize(paysource)
49
49
  when /1$/
50
- Response.new(true, SUCCESS_MESSAGE, {paid_amount: money}, test: true)
50
+ Response.new(true, SUCCESS_MESSAGE, { paid_amount: money }, test: true)
51
51
  when /2$/
52
- Response.new(false, FAILURE_MESSAGE, {paid_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
52
+ Response.new(false, FAILURE_MESSAGE, { paid_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
53
53
  else
54
54
  raise Error, error_message(paysource)
55
55
  end
@@ -61,9 +61,9 @@ module ActiveMerchant #:nodoc:
61
61
  when /1$/
62
62
  raise Error, REFUND_ERROR_MESSAGE
63
63
  when /2$/
64
- Response.new(false, FAILURE_MESSAGE, {paid_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
64
+ Response.new(false, FAILURE_MESSAGE, { paid_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
65
65
  else
66
- Response.new(true, SUCCESS_MESSAGE, {paid_amount: money}, test: true)
66
+ Response.new(true, SUCCESS_MESSAGE, { paid_amount: money }, test: true)
67
67
  end
68
68
  end
69
69
 
@@ -73,9 +73,9 @@ module ActiveMerchant #:nodoc:
73
73
  when /1$/
74
74
  raise Error, CAPTURE_ERROR_MESSAGE
75
75
  when /2$/
76
- Response.new(false, FAILURE_MESSAGE, {paid_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
76
+ Response.new(false, FAILURE_MESSAGE, { paid_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
77
77
  else
78
- Response.new(true, SUCCESS_MESSAGE, {paid_amount: money}, test: true)
78
+ Response.new(true, SUCCESS_MESSAGE, { paid_amount: money }, test: true)
79
79
  end
80
80
  end
81
81
 
@@ -84,18 +84,18 @@ module ActiveMerchant #:nodoc:
84
84
  when /1$/
85
85
  raise Error, VOID_ERROR_MESSAGE
86
86
  when /2$/
87
- Response.new(false, FAILURE_MESSAGE, {authorization: reference, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
87
+ Response.new(false, FAILURE_MESSAGE, { authorization: reference, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
88
88
  else
89
- Response.new(true, SUCCESS_MESSAGE, {authorization: reference}, test: true)
89
+ Response.new(true, SUCCESS_MESSAGE, { authorization: reference }, test: true)
90
90
  end
91
91
  end
92
92
 
93
93
  def store(paysource, options = {})
94
94
  case normalize(paysource)
95
95
  when /1$/
96
- Response.new(true, SUCCESS_MESSAGE, {billingid: '1'}, test: true, authorization: AUTHORIZATION)
96
+ Response.new(true, SUCCESS_MESSAGE, { billingid: '1' }, test: true, authorization: AUTHORIZATION)
97
97
  when /2$/
98
- Response.new(false, FAILURE_MESSAGE, {billingid: nil, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
98
+ Response.new(false, FAILURE_MESSAGE, { billingid: nil, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
99
99
  else
100
100
  raise Error, error_message(paysource)
101
101
  end
@@ -106,7 +106,7 @@ module ActiveMerchant #:nodoc:
106
106
  when /1$/
107
107
  Response.new(true, SUCCESS_MESSAGE, {}, test: true)
108
108
  when /2$/
109
- Response.new(false, FAILURE_MESSAGE, {error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
109
+ Response.new(false, FAILURE_MESSAGE, { error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
110
110
  else
111
111
  raise Error, UNSTORE_ERROR_MESSAGE
112
112
  end
@@ -118,9 +118,9 @@ module ActiveMerchant #:nodoc:
118
118
  money = amount(money)
119
119
  case money
120
120
  when /00$/
121
- Response.new(true, SUCCESS_MESSAGE, {authorized_amount: money}, test: true, authorization: AUTHORIZATION, emv_authorization: AUTHORIZATION_EMV_SUCCESS)
121
+ Response.new(true, SUCCESS_MESSAGE, { authorized_amount: money }, test: true, authorization: AUTHORIZATION, emv_authorization: AUTHORIZATION_EMV_SUCCESS)
122
122
  when /05$/
123
- Response.new(false, FAILURE_MESSAGE, {authorized_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error], emv_authorization: AUTHORIZATION_EMV_DECLINE)
123
+ Response.new(false, FAILURE_MESSAGE, { authorized_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error], emv_authorization: AUTHORIZATION_EMV_DECLINE)
124
124
  else
125
125
  raise Error, error_message(paysource)
126
126
  end
@@ -130,9 +130,9 @@ module ActiveMerchant #:nodoc:
130
130
  money = amount(money)
131
131
  case normalize(paysource)
132
132
  when /1$/, AUTHORIZATION
133
- Response.new(true, SUCCESS_MESSAGE, {authorized_amount: money}, test: true, authorization: AUTHORIZATION)
133
+ Response.new(true, SUCCESS_MESSAGE, { authorized_amount: money }, test: true, authorization: AUTHORIZATION)
134
134
  when /2$/
135
- Response.new(false, FAILURE_MESSAGE, {authorized_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
135
+ Response.new(false, FAILURE_MESSAGE, { authorized_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
136
136
  else
137
137
  raise Error, error_message(paysource)
138
138
  end
@@ -142,9 +142,9 @@ module ActiveMerchant #:nodoc:
142
142
  money = amount(money)
143
143
  case money
144
144
  when /00$/
145
- Response.new(true, SUCCESS_MESSAGE, {paid_amount: money}, test: true, authorization: AUTHORIZATION, emv_authorization: AUTHORIZATION_EMV_SUCCESS)
145
+ Response.new(true, SUCCESS_MESSAGE, { paid_amount: money }, test: true, authorization: AUTHORIZATION, emv_authorization: AUTHORIZATION_EMV_SUCCESS)
146
146
  when /05$/
147
- Response.new(false, FAILURE_MESSAGE, {paid_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error], emv_authorization: AUTHORIZATION_EMV_DECLINE)
147
+ Response.new(false, FAILURE_MESSAGE, { paid_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error], emv_authorization: AUTHORIZATION_EMV_DECLINE)
148
148
  else
149
149
  raise Error, error_message(paysource)
150
150
  end
@@ -154,9 +154,9 @@ module ActiveMerchant #:nodoc:
154
154
  money = amount(money)
155
155
  case normalize(paysource)
156
156
  when /1$/, AUTHORIZATION
157
- Response.new(true, SUCCESS_MESSAGE, {paid_amount: money}, test: true, authorization: AUTHORIZATION)
157
+ Response.new(true, SUCCESS_MESSAGE, { paid_amount: money }, test: true, authorization: AUTHORIZATION)
158
158
  when /2$/
159
- Response.new(false, FAILURE_MESSAGE, {paid_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
159
+ Response.new(false, FAILURE_MESSAGE, { paid_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
160
160
  else
161
161
  raise Error, error_message(paysource)
162
162
  end