activemerchant 1.105.0 → 1.107.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +99 -1
  3. data/README.md +2 -2
  4. data/lib/active_merchant/billing/credit_card_methods.rb +12 -3
  5. data/lib/active_merchant/billing/gateway.rb +22 -22
  6. data/lib/active_merchant/billing/gateways/adyen.rb +18 -7
  7. data/lib/active_merchant/billing/gateways/allied_wallet.rb +2 -2
  8. data/lib/active_merchant/billing/gateways/authorize_net.rb +19 -19
  9. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +11 -11
  10. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +35 -35
  11. data/lib/active_merchant/billing/gateways/axcessms.rb +3 -3
  12. data/lib/active_merchant/billing/gateways/bambora_apac.rb +1 -1
  13. data/lib/active_merchant/billing/gateways/bank_frick.rb +1 -1
  14. data/lib/active_merchant/billing/gateways/banwire.rb +2 -2
  15. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +5 -5
  16. data/lib/active_merchant/billing/gateways/be2bill.rb +4 -4
  17. data/lib/active_merchant/billing/gateways/beanstream.rb +1 -1
  18. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +27 -27
  19. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -1
  20. data/lib/active_merchant/billing/gateways/blue_pay.rb +8 -8
  21. data/lib/active_merchant/billing/gateways/blue_snap.rb +5 -2
  22. data/lib/active_merchant/billing/gateways/bogus.rb +20 -20
  23. data/lib/active_merchant/billing/gateways/borgun.rb +17 -6
  24. data/lib/active_merchant/billing/gateways/bpoint.rb +1 -1
  25. data/lib/active_merchant/billing/gateways/braintree_blue.rb +81 -77
  26. data/lib/active_merchant/billing/gateways/bridge_pay.rb +3 -3
  27. data/lib/active_merchant/billing/gateways/card_connect.rb +1 -1
  28. data/lib/active_merchant/billing/gateways/card_stream.rb +19 -19
  29. data/lib/active_merchant/billing/gateways/cc5.rb +7 -7
  30. data/lib/active_merchant/billing/gateways/cecabank.rb +3 -3
  31. data/lib/active_merchant/billing/gateways/cenpos.rb +3 -3
  32. data/lib/active_merchant/billing/gateways/checkout_v2.rb +20 -9
  33. data/lib/active_merchant/billing/gateways/clearhaus.rb +1 -1
  34. data/lib/active_merchant/billing/gateways/commercegate.rb +2 -2
  35. data/lib/active_merchant/billing/gateways/conekta.rb +1 -1
  36. data/lib/active_merchant/billing/gateways/creditcall.rb +4 -4
  37. data/lib/active_merchant/billing/gateways/ct_payment.rb +1 -1
  38. data/lib/active_merchant/billing/gateways/culqi.rb +2 -2
  39. data/lib/active_merchant/billing/gateways/cyber_source.rb +154 -91
  40. data/lib/active_merchant/billing/gateways/d_local.rb +4 -2
  41. data/lib/active_merchant/billing/gateways/data_cash.rb +33 -33
  42. data/lib/active_merchant/billing/gateways/decidir.rb +7 -2
  43. data/lib/active_merchant/billing/gateways/ebanx.rb +14 -2
  44. data/lib/active_merchant/billing/gateways/efsnet.rb +23 -23
  45. data/lib/active_merchant/billing/gateways/elavon.rb +70 -18
  46. data/lib/active_merchant/billing/gateways/element.rb +12 -4
  47. data/lib/active_merchant/billing/gateways/epay.rb +40 -40
  48. data/lib/active_merchant/billing/gateways/evo_ca.rb +11 -11
  49. data/lib/active_merchant/billing/gateways/eway.rb +3 -3
  50. data/lib/active_merchant/billing/gateways/eway_managed.rb +40 -40
  51. data/lib/active_merchant/billing/gateways/eway_rapid.rb +7 -7
  52. data/lib/active_merchant/billing/gateways/exact.rb +11 -11
  53. data/lib/active_merchant/billing/gateways/fat_zebra.rb +3 -2
  54. data/lib/active_merchant/billing/gateways/federated_canada.rb +5 -5
  55. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +21 -21
  56. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +20 -20
  57. data/lib/active_merchant/billing/gateways/flo2cash.rb +4 -4
  58. data/lib/active_merchant/billing/gateways/forte.rb +8 -7
  59. data/lib/active_merchant/billing/gateways/garanti.rb +8 -8
  60. data/lib/active_merchant/billing/gateways/global_collect.rb +30 -24
  61. data/lib/active_merchant/billing/gateways/hdfc.rb +3 -3
  62. data/lib/active_merchant/billing/gateways/hps.rb +5 -3
  63. data/lib/active_merchant/billing/gateways/iats_payments.rb +32 -15
  64. data/lib/active_merchant/billing/gateways/inspire.rb +7 -7
  65. data/lib/active_merchant/billing/gateways/instapay.rb +3 -3
  66. data/lib/active_merchant/billing/gateways/ipp.rb +1 -1
  67. data/lib/active_merchant/billing/gateways/iridium.rb +12 -10
  68. data/lib/active_merchant/billing/gateways/itransact.rb +7 -7
  69. data/lib/active_merchant/billing/gateways/iveri.rb +6 -3
  70. data/lib/active_merchant/billing/gateways/ixopay.rb +22 -0
  71. data/lib/active_merchant/billing/gateways/jetpay.rb +4 -4
  72. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +5 -5
  73. data/lib/active_merchant/billing/gateways/kushki.rb +34 -5
  74. data/lib/active_merchant/billing/gateways/latitude19.rb +2 -2
  75. data/lib/active_merchant/billing/gateways/linkpoint.rb +62 -62
  76. data/lib/active_merchant/billing/gateways/litle.rb +8 -3
  77. data/lib/active_merchant/billing/gateways/mastercard.rb +2 -2
  78. data/lib/active_merchant/billing/gateways/mercado_pago.rb +1 -0
  79. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +5 -5
  80. data/lib/active_merchant/billing/gateways/merchant_one.rb +2 -2
  81. data/lib/active_merchant/billing/gateways/merchant_partners.rb +4 -4
  82. data/lib/active_merchant/billing/gateways/merchant_ware.rb +12 -12
  83. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +11 -11
  84. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +12 -2
  85. data/lib/active_merchant/billing/gateways/mercury.rb +9 -9
  86. data/lib/active_merchant/billing/gateways/metrics_global.rb +15 -15
  87. data/lib/active_merchant/billing/gateways/migs.rb +13 -13
  88. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +7 -7
  89. data/lib/active_merchant/billing/gateways/monei.rb +19 -19
  90. data/lib/active_merchant/billing/gateways/moneris.rb +10 -10
  91. data/lib/active_merchant/billing/gateways/money_movers.rb +5 -5
  92. data/lib/active_merchant/billing/gateways/mundipagg.rb +1 -1
  93. data/lib/active_merchant/billing/gateways/nab_transact.rb +15 -15
  94. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +1 -1
  95. data/lib/active_merchant/billing/gateways/net_registry.rb +6 -6
  96. data/lib/active_merchant/billing/gateways/netaxept.rb +4 -4
  97. data/lib/active_merchant/billing/gateways/netbanx.rb +14 -14
  98. data/lib/active_merchant/billing/gateways/netbilling.rb +12 -12
  99. data/lib/active_merchant/billing/gateways/netpay.rb +2 -2
  100. data/lib/active_merchant/billing/gateways/network_merchants.rb +5 -5
  101. data/lib/active_merchant/billing/gateways/ogone.rb +7 -7
  102. data/lib/active_merchant/billing/gateways/openpay.rb +2 -2
  103. data/lib/active_merchant/billing/gateways/opp.rb +13 -7
  104. data/lib/active_merchant/billing/gateways/optimal_payment.rb +13 -9
  105. data/lib/active_merchant/billing/gateways/orbital.rb +54 -12
  106. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +7 -7
  107. data/lib/active_merchant/billing/gateways/pay_conex.rb +2 -2
  108. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +16 -16
  109. data/lib/active_merchant/billing/gateways/pay_junction.rb +16 -16
  110. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +18 -2
  111. data/lib/active_merchant/billing/gateways/pay_secure.rb +6 -6
  112. data/lib/active_merchant/billing/gateways/paybox_direct.rb +36 -36
  113. data/lib/active_merchant/billing/gateways/payflow.rb +7 -7
  114. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +12 -12
  115. data/lib/active_merchant/billing/gateways/payflow_express.rb +4 -4
  116. data/lib/active_merchant/billing/gateways/payment_express.rb +9 -9
  117. data/lib/active_merchant/billing/gateways/paymill.rb +3 -3
  118. data/lib/active_merchant/billing/gateways/paypal.rb +1 -1
  119. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +5 -5
  120. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
  121. data/lib/active_merchant/billing/gateways/payscout.rb +5 -5
  122. data/lib/active_merchant/billing/gateways/paystation.rb +2 -2
  123. data/lib/active_merchant/billing/gateways/payu_latam.rb +3 -3
  124. data/lib/active_merchant/billing/gateways/payway.rb +12 -12
  125. data/lib/active_merchant/billing/gateways/pin.rb +16 -16
  126. data/lib/active_merchant/billing/gateways/plugnpay.rb +10 -10
  127. data/lib/active_merchant/billing/gateways/psigate.rb +26 -26
  128. data/lib/active_merchant/billing/gateways/psl_card.rb +4 -4
  129. data/lib/active_merchant/billing/gateways/qbms.rb +23 -23
  130. data/lib/active_merchant/billing/gateways/quantum.rb +4 -4
  131. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +95 -95
  132. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +9 -9
  133. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +2 -2
  134. data/lib/active_merchant/billing/gateways/qvalent.rb +1 -1
  135. data/lib/active_merchant/billing/gateways/realex.rb +17 -10
  136. data/lib/active_merchant/billing/gateways/redsys.rb +24 -16
  137. data/lib/active_merchant/billing/gateways/safe_charge.rb +1 -1
  138. data/lib/active_merchant/billing/gateways/sage.rb +10 -10
  139. data/lib/active_merchant/billing/gateways/sage_pay.rb +35 -35
  140. data/lib/active_merchant/billing/gateways/sallie_mae.rb +2 -2
  141. data/lib/active_merchant/billing/gateways/secure_net.rb +9 -9
  142. data/lib/active_merchant/billing/gateways/secure_pay.rb +13 -13
  143. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +16 -16
  144. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +2 -2
  145. data/lib/active_merchant/billing/gateways/skip_jack.rb +8 -8
  146. data/lib/active_merchant/billing/gateways/smart_ps.rb +16 -16
  147. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +6 -6
  148. data/lib/active_merchant/billing/gateways/spreedly_core.rb +4 -4
  149. data/lib/active_merchant/billing/gateways/stripe.rb +15 -10
  150. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +50 -9
  151. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +2 -2
  152. data/lib/active_merchant/billing/gateways/trans_first.rb +4 -4
  153. data/lib/active_merchant/billing/gateways/trust_commerce.rb +19 -19
  154. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +110 -110
  155. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +29 -29
  156. data/lib/active_merchant/billing/gateways/verifi.rb +10 -10
  157. data/lib/active_merchant/billing/gateways/viaklix.rb +6 -6
  158. data/lib/active_merchant/billing/gateways/visanet_peru.rb +6 -6
  159. data/lib/active_merchant/billing/gateways/webpay.rb +2 -2
  160. data/lib/active_merchant/billing/gateways/wirecard.rb +6 -6
  161. data/lib/active_merchant/billing/gateways/worldpay.rb +22 -20
  162. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +32 -32
  163. data/lib/active_merchant/billing/gateways/worldpay_us.rb +2 -2
  164. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +1 -1
  165. data/lib/active_merchant/connection.rb +1 -1
  166. data/lib/active_merchant/network_connection_retries.rb +3 -3
  167. data/lib/active_merchant/post_data.rb +1 -1
  168. data/lib/active_merchant/version.rb +1 -1
  169. data/lib/certs/cacert.pem +75 -0
  170. data/lib/support/ssl_verify.rb +2 -2
  171. data/lib/support/ssl_version.rb +2 -2
  172. metadata +4 -4
  173. data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -352
@@ -33,49 +33,49 @@ module ActiveMerchant #:nodoc:
33
33
  AUTHORIZE_NET_CIM_NAMESPACE = 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'
34
34
 
35
35
  CIM_ACTIONS = {
36
- :create_customer_profile => 'createCustomerProfile',
37
- :create_customer_payment_profile => 'createCustomerPaymentProfile',
38
- :create_customer_shipping_address => 'createCustomerShippingAddress',
39
- :get_customer_profile => 'getCustomerProfile',
40
- :get_customer_profile_ids => 'getCustomerProfileIds',
41
- :get_customer_payment_profile => 'getCustomerPaymentProfile',
42
- :get_customer_shipping_address => 'getCustomerShippingAddress',
43
- :delete_customer_profile => 'deleteCustomerProfile',
44
- :delete_customer_payment_profile => 'deleteCustomerPaymentProfile',
45
- :delete_customer_shipping_address => 'deleteCustomerShippingAddress',
46
- :update_customer_profile => 'updateCustomerProfile',
47
- :update_customer_payment_profile => 'updateCustomerPaymentProfile',
48
- :update_customer_shipping_address => 'updateCustomerShippingAddress',
49
- :create_customer_profile_transaction => 'createCustomerProfileTransaction',
50
- :validate_customer_payment_profile => 'validateCustomerPaymentProfile'
36
+ create_customer_profile: 'createCustomerProfile',
37
+ create_customer_payment_profile: 'createCustomerPaymentProfile',
38
+ create_customer_shipping_address: 'createCustomerShippingAddress',
39
+ get_customer_profile: 'getCustomerProfile',
40
+ get_customer_profile_ids: 'getCustomerProfileIds',
41
+ get_customer_payment_profile: 'getCustomerPaymentProfile',
42
+ get_customer_shipping_address: 'getCustomerShippingAddress',
43
+ delete_customer_profile: 'deleteCustomerProfile',
44
+ delete_customer_payment_profile: 'deleteCustomerPaymentProfile',
45
+ delete_customer_shipping_address: 'deleteCustomerShippingAddress',
46
+ update_customer_profile: 'updateCustomerProfile',
47
+ update_customer_payment_profile: 'updateCustomerPaymentProfile',
48
+ update_customer_shipping_address: 'updateCustomerShippingAddress',
49
+ create_customer_profile_transaction: 'createCustomerProfileTransaction',
50
+ validate_customer_payment_profile: 'validateCustomerPaymentProfile'
51
51
  }
52
52
 
53
53
  CIM_TRANSACTION_TYPES = {
54
- :auth_capture => 'profileTransAuthCapture',
55
- :auth_only => 'profileTransAuthOnly',
56
- :capture_only => 'profileTransCaptureOnly',
57
- :prior_auth_capture => 'profileTransPriorAuthCapture',
58
- :refund => 'profileTransRefund',
59
- :void => 'profileTransVoid'
54
+ auth_capture: 'profileTransAuthCapture',
55
+ auth_only: 'profileTransAuthOnly',
56
+ capture_only: 'profileTransCaptureOnly',
57
+ prior_auth_capture: 'profileTransPriorAuthCapture',
58
+ refund: 'profileTransRefund',
59
+ void: 'profileTransVoid'
60
60
  }
61
61
 
62
62
  CIM_VALIDATION_MODES = {
63
- :none => 'none',
64
- :test => 'testMode',
65
- :live => 'liveMode',
66
- :old => 'oldLiveMode'
63
+ none: 'none',
64
+ test: 'testMode',
65
+ live: 'liveMode',
66
+ old: 'oldLiveMode'
67
67
  }
68
68
 
69
69
  BANK_ACCOUNT_TYPES = {
70
- :checking => 'checking',
71
- :savings => 'savings',
72
- :business_checking => 'businessChecking'
70
+ checking: 'checking',
71
+ savings: 'savings',
72
+ business_checking: 'businessChecking'
73
73
  }
74
74
 
75
75
  ECHECK_TYPES = {
76
- :ccd => 'CCD',
77
- :ppd => 'PPD',
78
- :web => 'WEB'
76
+ ccd: 'CCD',
77
+ ppd: 'PPD',
78
+ web: 'WEB'
79
79
  }
80
80
 
81
81
  self.homepage_url = 'http://www.authorize.net/'
@@ -487,9 +487,9 @@ module ActiveMerchant #:nodoc:
487
487
  def build_request(action, options = {})
488
488
  raise StandardError, "Invalid Customer Information Manager Action: #{action}" unless CIM_ACTIONS.include?(action)
489
489
 
490
- xml = Builder::XmlMarkup.new(:indent => 2)
491
- xml.instruct!(:xml, :version => '1.0', :encoding => 'utf-8')
492
- xml.tag!("#{CIM_ACTIONS[action]}Request", :xmlns => AUTHORIZE_NET_CIM_NAMESPACE) do
490
+ xml = Builder::XmlMarkup.new(indent: 2)
491
+ xml.instruct!(:xml, version: '1.0', encoding: 'utf-8')
492
+ xml.tag!("#{CIM_ACTIONS[action]}Request", xmlns: AUTHORIZE_NET_CIM_NAMESPACE) do
493
493
  add_merchant_authentication(xml)
494
494
  # Merchant-assigned reference ID for the request
495
495
  xml.tag!('refId', options[:ref_id]) if options[:ref_id]
@@ -852,7 +852,7 @@ module ActiveMerchant #:nodoc:
852
852
 
853
853
  response_params = parse(action, xml)
854
854
 
855
- message_element= response_params['messages']['message']
855
+ message_element = response_params['messages']['message']
856
856
  first_error = message_element.is_a?(Array) ? message_element.first : message_element
857
857
  message = first_error['text']
858
858
  test_mode = @options[:test_requests] || message =~ /Test Mode/
@@ -72,8 +72,8 @@ module ActiveMerchant #:nodoc:
72
72
  authorization = response[:unique_id]
73
73
 
74
74
  Response.new(success, message, response,
75
- :authorization => authorization,
76
- :test => (response[:mode] != 'LIVE')
75
+ authorization: authorization,
76
+ test: (response[:mode] != 'LIVE')
77
77
  )
78
78
  end
79
79
 
@@ -103,7 +103,7 @@ module ActiveMerchant #:nodoc:
103
103
  end
104
104
 
105
105
  def build_request(payment_code, money, payment, options)
106
- xml = Builder::XmlMarkup.new :indent => 2
106
+ xml = Builder::XmlMarkup.new indent: 2
107
107
  xml.instruct!
108
108
  xml.tag! 'Request', 'version' => API_VERSION do
109
109
  xml.tag! 'Header' do
@@ -132,7 +132,7 @@ module ActiveMerchant #:nodoc:
132
132
  end
133
133
 
134
134
  def add_credit_card(xml, payment)
135
- xml.CreditCard :Registered => 'False' do
135
+ xml.CreditCard Registered: 'False' do
136
136
  xml.CardNumber payment.number
137
137
  xml.ExpM format(payment.month, :two_digits)
138
138
  xml.ExpY format(payment.year, :four_digits)
@@ -166,7 +166,7 @@ module ActiveMerchant #:nodoc:
166
166
  end
167
167
 
168
168
  def build_xml_request(action, data)
169
- xml = Builder::XmlMarkup.new :indent => 2
169
+ xml = Builder::XmlMarkup.new indent: 2
170
170
  xml.Request(version: '1.0') do
171
171
  xml.Header do
172
172
  xml.Security(sender: @options[:sender], type: 'MERCHANT')
@@ -92,8 +92,8 @@ module ActiveMerchant #:nodoc:
92
92
  Response.new(success?(response),
93
93
  response['message'],
94
94
  response,
95
- :test => test?,
96
- :authorization => response['code_auth'])
95
+ test: test?,
96
+ authorization: response['code_auth'])
97
97
  end
98
98
 
99
99
  def success?(response)
@@ -108,7 +108,7 @@ module ActiveMerchant #:nodoc:
108
108
  def store(creditcard, options = {})
109
109
  post = store_request(options)
110
110
  post[:card] = credit_card_hash(creditcard)
111
- post[:recurring] = {:contract => 'RECURRING'}
111
+ post[:recurring] = {contract: 'RECURRING'}
112
112
 
113
113
  commit('store', post)
114
114
  end
@@ -161,20 +161,20 @@ module ActiveMerchant #:nodoc:
161
161
  message_from(response),
162
162
  response,
163
163
  test: test?,
164
- avs_result: AVSResult.new(:code => parse_avs_code(response)),
164
+ avs_result: AVSResult.new(code: parse_avs_code(response)),
165
165
  authorization: response['recurringDetailReference'] || authorization_from(post, response)
166
166
  )
167
167
  rescue ResponseError => e
168
168
  case e.response.code
169
169
  when '401'
170
- return Response.new(false, 'Invalid credentials', {}, :test => test?)
170
+ return Response.new(false, 'Invalid credentials', {}, test: test?)
171
171
  when '403'
172
- return Response.new(false, 'Not allowed', {}, :test => test?)
172
+ return Response.new(false, 'Not allowed', {}, test: test?)
173
173
  when '422', '500'
174
174
  if e.response.body.split(/\W+/).any? { |word| %w(validation configuration security).include?(word) }
175
175
  error_message = e.response.body[/#{Regexp.escape('message=')}(.*?)#{Regexp.escape('&')}/m, 1].tr('+', ' ')
176
176
  error_code = e.response.body[/#{Regexp.escape('errorCode=')}(.*?)#{Regexp.escape('&')}/m, 1]
177
- return Response.new(false, error_code + ': ' + error_message, {}, :test => test?)
177
+ return Response.new(false, error_code + ': ' + error_message, {}, test: test?)
178
178
  end
179
179
  end
180
180
  raise
@@ -92,8 +92,8 @@ module ActiveMerchant #:nodoc:
92
92
  successful?(response),
93
93
  message_from(response),
94
94
  response,
95
- :authorization => response['TRANSACTIONID'],
96
- :test => test?
95
+ authorization: response['TRANSACTIONID'],
96
+ test: test?
97
97
  )
98
98
  end
99
99
 
@@ -111,8 +111,8 @@ module ActiveMerchant #:nodoc:
111
111
 
112
112
  def post_data(action, parameters = {})
113
113
  {
114
- :method => action,
115
- :params => parameters.merge(HASH: signature(parameters, action))
114
+ method: action,
115
+ params: parameters.merge(HASH: signature(parameters, action))
116
116
  }.to_query
117
117
  end
118
118
 
@@ -175,7 +175,7 @@ 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
181
  alias_method :unstore, :delete
@@ -9,20 +9,20 @@ module ActiveMerchant #:nodoc:
9
9
  SP_SERVICE_VERSION = '1.1'
10
10
 
11
11
  TRANSACTIONS = {
12
- :authorization => 'PA',
13
- :purchase => 'P',
14
- :capture => 'PAC',
15
- :refund => 'R',
16
- :void => 'VP',
17
- :check_purchase => 'D',
18
- :check_refund => 'C',
19
- :void_purchase => 'VP',
20
- :void_refund => 'VR'
12
+ authorization: 'PA',
13
+ purchase: 'P',
14
+ capture: 'PAC',
15
+ refund: 'R',
16
+ void: 'VP',
17
+ check_purchase: 'D',
18
+ check_refund: 'C',
19
+ void_purchase: 'VP',
20
+ void_refund: 'VR'
21
21
  }
22
22
 
23
23
  PROFILE_OPERATIONS = {
24
- :new => 'N',
25
- :modify => 'M'
24
+ new: 'N',
25
+ modify: 'M'
26
26
  }
27
27
 
28
28
  CVD_CODES = {
@@ -41,24 +41,24 @@ module ActiveMerchant #:nodoc:
41
41
  }
42
42
 
43
43
  PERIODS = {
44
- :days => 'D',
45
- :weeks => 'W',
46
- :months => 'M',
47
- :years => 'Y'
44
+ days: 'D',
45
+ weeks: 'W',
46
+ months: 'M',
47
+ years: 'Y'
48
48
  }
49
49
 
50
50
  PERIODICITIES = {
51
- :daily => [:days, 1],
52
- :weekly => [:weeks, 1],
53
- :biweekly => [:weeks, 2],
54
- :monthly => [:months, 1],
55
- :bimonthly => [:months, 2],
56
- :yearly => [:years, 1]
51
+ daily: [:days, 1],
52
+ weekly: [:weeks, 1],
53
+ biweekly: [:weeks, 2],
54
+ monthly: [:months, 1],
55
+ bimonthly: [:months, 2],
56
+ yearly: [:years, 1]
57
57
  }
58
58
 
59
59
  RECURRING_OPERATION = {
60
- :update => 'M',
61
- :cancel => 'C'
60
+ update: 'M',
61
+ cancel: 'C'
62
62
  }
63
63
 
64
64
  STATES = {
@@ -414,10 +414,10 @@ module ActiveMerchant #:nodoc:
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
- :test => test? || response[:authCode] == 'TEST',
418
- :authorization => authorization_from(response),
419
- :cvv_result => CVD_CODES[response[:cvdId]],
420
- :avs_result => { :code => AVS_CODES.include?(response[:avsId]) ? AVS_CODES[response[:avsId]] : response[:avsId] }
417
+ test: test? || response[:authCode] == 'TEST',
418
+ authorization: authorization_from(response),
419
+ cvv_result: CVD_CODES[response[:cvdId]],
420
+ avs_result: { code: AVS_CODES.include?(response[:avsId]) ? AVS_CODES[response[:avsId]] : response[:avsId] }
421
421
  )
422
422
  end
423
423
 
@@ -18,7 +18,7 @@ module ActiveMerchant #:nodoc:
18
18
  # post back is for until the response of the confirmation is
19
19
  # received, which contains the order number.
20
20
  def self.confirm(transaction)
21
- gateway = new(:login => '')
21
+ gateway = new(login: '')
22
22
  gateway.confirm(transaction)
23
23
  end
24
24
 
@@ -18,7 +18,7 @@ module ActiveMerchant #:nodoc:
18
18
  'TRANS_ID' => :transaction_id,
19
19
  'STATUS' => :response_code,
20
20
  'AVS' => :avs_result_code,
21
- 'CVV2'=> :card_code,
21
+ 'CVV2' => :card_code,
22
22
  'AUTH_CODE' => :authorization,
23
23
  'MESSAGE' => :message,
24
24
  'REBID' => :rebid,
@@ -29,7 +29,7 @@ module ActiveMerchant #:nodoc:
29
29
 
30
30
  REBILL_FIELD_MAP = {
31
31
  'REBILL_ID' => :rebill_id,
32
- 'ACCOUNT_ID'=> :account_id,
32
+ 'ACCOUNT_ID' => :account_id,
33
33
  'USER_ID' => :user_id,
34
34
  'TEMPLATE_ID' => :template_id,
35
35
  'STATUS' => :status,
@@ -343,8 +343,8 @@ module ActiveMerchant #:nodoc:
343
343
  message = parsed[:status]
344
344
 
345
345
  Response.new(success, message, parsed,
346
- :test => test?,
347
- :authorization => parsed[:rebill_id])
346
+ test: test?,
347
+ authorization: parsed[:rebill_id])
348
348
  end
349
349
 
350
350
  def parse(body)
@@ -363,10 +363,10 @@ module ActiveMerchant #:nodoc:
363
363
  message = message_from(parsed)
364
364
  success = parsed[:response_code] == '1'
365
365
  Response.new(success, message, parsed,
366
- :test => test?,
367
- :authorization => (parsed[:rebid] && parsed[:rebid] != '' ? parsed[:rebid] : parsed[:transaction_id]),
368
- :avs_result => { :code => parsed[:avs_result_code] },
369
- :cvv_result => parsed[:card_code]
366
+ test: test?,
367
+ authorization: (parsed[:rebid] && parsed[:rebid] != '' ? parsed[:rebid] : parsed[:transaction_id]),
368
+ avs_result: { code: parsed[:avs_result_code] },
369
+ cvv_result: parsed[:card_code]
370
370
  )
371
371
  end
372
372
 
@@ -9,6 +9,8 @@ module ActiveMerchant
9
9
 
10
10
  self.default_currency = 'USD'
11
11
  self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb, :diners_club, :maestro, :naranja, :cabal]
12
+ self.currencies_without_fractions = %w(BYR CLP ILS JPY KRW VND XOF)
13
+ self.currencies_with_three_decimal_places = %w(BHD JOD KWD OMR TND)
12
14
 
13
15
  self.homepage_url = 'https://home.bluesnap.com/'
14
16
  self.display_name = 'BlueSnap'
@@ -188,8 +190,9 @@ module ActiveMerchant
188
190
  end
189
191
 
190
192
  def add_amount(doc, money, options)
191
- doc.amount(amount(money))
192
- doc.currency(options[:currency] || currency(money))
193
+ currency = options[:currency] || currency(money)
194
+ doc.amount(localized_amount(money, currency))
195
+ doc.currency(currency)
193
196
  end
194
197
 
195
198
  def add_personal_info(doc, payment_method, 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
@@ -104,9 +104,9 @@ module ActiveMerchant #:nodoc:
104
104
  def unstore(reference, options = {})
105
105
  case reference
106
106
  when /1$/
107
- Response.new(true, SUCCESS_MESSAGE, {}, :test => true)
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