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
@@ -122,14 +122,14 @@ module ActiveMerchant #:nodoc:
122
122
  test_mode = test? || message =~ /TESTMODE/
123
123
 
124
124
  Response.new(success?(response), message, response,
125
- :test => test_mode,
126
- :authorization => response['TrackingNumber'],
127
- :fraud_review => fraud_review?(response),
128
- :avs_result => {
129
- :postal_match => AVS_POSTAL_CODES[response['AVSPostalResponseCode']],
130
- :street_match => AVS_ADDRESS_CODES[response['AVSAddressResponseCode']]
125
+ test: test_mode,
126
+ authorization: response['TrackingNumber'],
127
+ fraud_review: fraud_review?(response),
128
+ avs_result: {
129
+ postal_match: AVS_POSTAL_CODES[response['AVSPostalResponseCode']],
130
+ street_match: AVS_ADDRESS_CODES[response['AVSAddressResponseCode']]
131
131
  },
132
- :cvv_result => CVV2_CODES[response['CVV2ResponseCode']]
132
+ cvv_result: CVV2_CODES[response['CVV2ResponseCode']]
133
133
  )
134
134
  end
135
135
 
@@ -208,8 +208,8 @@ module ActiveMerchant #:nodoc:
208
208
  message_from(response),
209
209
  response,
210
210
  authorization: response['transaction_id'],
211
- :avs_result => AVSResult.new(code: response['avs_response']),
212
- :cvv_result => CVVResult.new(response['cvv2_response']),
211
+ avs_result: AVSResult.new(code: response['avs_response']),
212
+ cvv_result: CVVResult.new(response['cvv2_response']),
213
213
  test: test?
214
214
  )
215
215
  rescue JSON::ParserError
@@ -201,7 +201,7 @@ module ActiveMerchant #:nodoc:
201
201
  xml = Builder::XmlMarkup.new
202
202
  xml.instruct!
203
203
 
204
- xml.tag! 'protocol', :ver => API_VERSION, :pgid => (test? ? TEST_ID : @options[:login]), :pwd => @options[:password] do |protocol|
204
+ xml.tag! 'protocol', ver: API_VERSION, pgid: (test? ? TEST_ID : @options[:login]), pwd: @options[:password] do |protocol|
205
205
  money = options.delete(:money)
206
206
  authorization = options.delete(:authorization)
207
207
  creditcard = options.delete(:creditcard)
@@ -222,29 +222,29 @@ module ActiveMerchant #:nodoc:
222
222
 
223
223
  def build_authorization(xml, money, creditcard, options={})
224
224
  xml.tag! 'authtx', {
225
- :cref => options[:order_id],
226
- :cname => creditcard.name,
227
- :cc => creditcard.number,
228
- :exp => "#{format(creditcard.month, :two_digits)}#{format(creditcard.year, :four_digits)}",
229
- :budp => 0,
230
- :amt => amount(money),
231
- :cur => (options[:currency] || currency(money)),
232
- :cvv => creditcard.verification_value,
233
- :email => options[:email],
234
- :ip => options[:ip]
225
+ cref: options[:order_id],
226
+ cname: creditcard.name,
227
+ cc: creditcard.number,
228
+ exp: "#{format(creditcard.month, :two_digits)}#{format(creditcard.year, :four_digits)}",
229
+ budp: 0,
230
+ amt: amount(money),
231
+ cur: (options[:currency] || currency(money)),
232
+ cvv: creditcard.verification_value,
233
+ email: options[:email],
234
+ ip: options[:ip]
235
235
  }
236
236
  end
237
237
 
238
238
  def build_capture(xml, money, authorization, options={})
239
239
  xml.tag! 'settletx', {
240
- :tid => authorization
240
+ tid: authorization
241
241
  }
242
242
  end
243
243
 
244
244
  def build_refund(xml, money, authorization, options={})
245
245
  xml.tag! 'refundtx', {
246
- :tid => authorization,
247
- :amt => amount(money)
246
+ tid: authorization,
247
+ amt: amount(money)
248
248
  }
249
249
  end
250
250
 
@@ -265,8 +265,8 @@ module ActiveMerchant #:nodoc:
265
265
  def commit(action, request, authorization = nil)
266
266
  response = parse(action, ssl_post(self.live_url, request))
267
267
  Response.new(successful?(response), message_from(response), response,
268
- :test => test?,
269
- :authorization => authorization || response[:tid]
268
+ test: test?,
269
+ authorization: authorization || response[:tid]
270
270
  )
271
271
  end
272
272
 
@@ -165,7 +165,7 @@ module ActiveMerchant #:nodoc:
165
165
  # transaction_id that can be used later to postauthorize (capture) the funds.
166
166
  def authorize(money, payment_source, options = {})
167
167
  parameters = {
168
- :transaction_amount => amount(money),
168
+ transaction_amount: amount(money),
169
169
  }
170
170
 
171
171
  add_payment_source(parameters, payment_source)
@@ -178,7 +178,7 @@ module ActiveMerchant #:nodoc:
178
178
  # Execute authorization and capture in a single step.
179
179
  def purchase(money, payment_source, options = {})
180
180
  parameters = {
181
- :transaction_amount => amount(money),
181
+ transaction_amount: amount(money),
182
182
  }
183
183
 
184
184
  add_payment_source(parameters, payment_source)
@@ -191,8 +191,8 @@ module ActiveMerchant #:nodoc:
191
191
  # Retrieve funds that have been previously authorized with _authorization_
192
192
  def capture(money, authorization, options = {})
193
193
  parameters = {
194
- :transaction_id => authorization,
195
- :posture => 'capture'
194
+ transaction_id: authorization,
195
+ posture: 'capture'
196
196
  }
197
197
 
198
198
  add_optional_fields(parameters, options)
@@ -203,8 +203,8 @@ module ActiveMerchant #:nodoc:
203
203
  # _authorization_ should be the transaction id of the transaction we are returning.
204
204
  def refund(money, authorization, options = {})
205
205
  parameters = {
206
- :transaction_amount => amount(money),
207
- :transaction_id => authorization
206
+ transaction_amount: amount(money),
207
+ transaction_id: authorization
208
208
  }
209
209
 
210
210
  commit('CREDIT', parameters)
@@ -219,8 +219,8 @@ module ActiveMerchant #:nodoc:
219
219
  # through the batch process.
220
220
  def void(authorization, options = {})
221
221
  parameters = {
222
- :transaction_id => authorization,
223
- :posture => 'void'
222
+ transaction_id: authorization,
223
+ posture: 'void'
224
224
  }
225
225
 
226
226
  add_optional_fields(parameters, options)
@@ -263,12 +263,12 @@ module ActiveMerchant #:nodoc:
263
263
  end
264
264
 
265
265
  parameters = {
266
- :transaction_amount => amount(money),
267
- :schedule_periodic_type => periodic_type,
268
- :schedule_create => 'true',
269
- :schedule_limit => options[:payments].to_i > 1 ? options[:payments] : 1,
270
- :schedule_periodic_number => 1,
271
- :schedule_start => start_date
266
+ transaction_amount: amount(money),
267
+ schedule_periodic_type: periodic_type,
268
+ schedule_create: 'true',
269
+ schedule_limit: options[:payments].to_i > 1 ? options[:payments] : 1,
270
+ schedule_periodic_number: 1,
271
+ schedule_start: start_date
272
272
  }
273
273
 
274
274
  add_payment_source(parameters, payment_source)
@@ -338,8 +338,8 @@ module ActiveMerchant #:nodoc:
338
338
  response = parse(ssl_post(url, post_data(action, parameters)))
339
339
 
340
340
  Response.new(successful?(response), message_from(response), response,
341
- :test => test?,
342
- :authorization => response[:transaction_id] || parameters[:transaction_id]
341
+ test: test?,
342
+ authorization: response[:transaction_id] || parameters[:transaction_id]
343
343
  )
344
344
  end
345
345
 
@@ -21,6 +21,7 @@ module ActiveMerchant #:nodoc:
21
21
  post = {}
22
22
  add_invoice(post, amount, options)
23
23
  add_payment_method(post, payment_method)
24
+ add_address(post, options)
24
25
 
25
26
  commit('purchase', post)
26
27
  end
@@ -30,6 +31,7 @@ module ActiveMerchant #:nodoc:
30
31
  post[:status] = 'HOLD'
31
32
  add_invoice(post, amount, options)
32
33
  add_payment_method(post, payment_method)
34
+ add_address(post, options)
33
35
 
34
36
  commit('authorize', post)
35
37
  end
@@ -110,6 +112,20 @@ module ActiveMerchant #:nodoc:
110
112
  end
111
113
  end
112
114
 
115
+ def add_address(post, options)
116
+ if address = options[:billing_address]
117
+ post[:billingFirstName] = address[:first_name] if address[:first_name]
118
+ post[:billingLastName] = address[:last_name] if address[:last_name]
119
+ post[:billingCompanyName] = address[:company] if address[:company]
120
+ post[:billingPhone] = address[:phone_number] if address[:phone_number]
121
+ post[:billingAddress] = address[:address1] if address[:address1]
122
+ post[:billingCity] = address[:city] if address[:city]
123
+ post[:billingState] = address[:state] if address[:state]
124
+ post[:billingCountry] = address[:country] if address[:country]
125
+ post[:billingZip] = address[:zip] if address[:zip]
126
+ end
127
+ end
128
+
113
129
  def commit(action, params)
114
130
  response =
115
131
  begin
@@ -141,8 +157,8 @@ module ActiveMerchant #:nodoc:
141
157
  {
142
158
  'Authorization' => 'Basic ' + Base64.encode64("#{@options[:api_login]}:#{@options[:api_password]}").strip,
143
159
  'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8',
144
- 'Accept' => 'application/json',
145
- 'X-PJ-Application-Key' => @options[:api_key].to_s
160
+ 'Accept' => 'application/json',
161
+ 'X-PJ-Application-Key' => @options[:api_key].to_s
146
162
  }
147
163
  end
148
164
 
@@ -8,10 +8,10 @@ module ActiveMerchant #:nodoc:
8
8
  # Currently Authorization and Capture is not implemented because
9
9
  # capturing requires the original credit card information
10
10
  TRANSACTIONS = {
11
- :purchase => 'PURCHASE',
12
- :authorization => 'AUTHORISE',
13
- :capture => 'ADVICE',
14
- :credit => 'REFUND'
11
+ purchase: 'PURCHASE',
12
+ authorization: 'AUTHORISE',
13
+ capture: 'ADVICE',
14
+ credit: 'REFUND'
15
15
  }
16
16
 
17
17
  SUCCESS = 'Accepted'
@@ -69,8 +69,8 @@ module ActiveMerchant #:nodoc:
69
69
  response = parse(ssl_post(self.live_url, post_data(action, parameters)))
70
70
 
71
71
  Response.new(successful?(response), message_from(response), response,
72
- :test => test_response?(response),
73
- :authorization => authorization_from(response)
72
+ test: test_response?(response),
73
+ authorization: authorization_from(response)
74
74
  )
75
75
  end
76
76
 
@@ -12,30 +12,30 @@ module ActiveMerchant #:nodoc:
12
12
 
13
13
  # Transactions hash
14
14
  TRANSACTIONS = {
15
- :authorization => '00001',
16
- :capture => '00002',
17
- :purchase => '00003',
18
- :unreferenced_credit => '00004',
19
- :void => '00005',
20
- :refund => '00014'
15
+ authorization: '00001',
16
+ capture: '00002',
17
+ purchase: '00003',
18
+ unreferenced_credit: '00004',
19
+ void: '00005',
20
+ refund: '00014'
21
21
  }
22
22
 
23
23
  CURRENCY_CODES = {
24
- 'AUD'=> '036',
25
- 'CAD'=> '124',
26
- 'CZK'=> '203',
27
- 'DKK'=> '208',
28
- 'HKD'=> '344',
29
- 'ICK'=> '352',
30
- 'JPY'=> '392',
31
- 'NOK'=> '578',
32
- 'SGD'=> '702',
33
- 'SEK'=> '752',
34
- 'CHF'=> '756',
35
- 'GBP'=> '826',
36
- 'USD'=> '840',
37
- 'EUR'=> '978',
38
- 'XPF'=> '953'
24
+ 'AUD' => '036',
25
+ 'CAD' => '124',
26
+ 'CZK' => '203',
27
+ 'DKK' => '208',
28
+ 'HKD' => '344',
29
+ 'ICK' => '352',
30
+ 'JPY' => '392',
31
+ 'NOK' => '578',
32
+ 'SGD' => '702',
33
+ 'SEK' => '752',
34
+ 'CHF' => '756',
35
+ 'GBP' => '826',
36
+ 'USD' => '840',
37
+ 'EUR' => '978',
38
+ 'XPF' => '953'
39
39
  }
40
40
 
41
41
  SUCCESS_CODES = ['00000']
@@ -95,7 +95,7 @@ module ActiveMerchant #:nodoc:
95
95
 
96
96
  def void(identification, options = {})
97
97
  requires!(options, :order_id, :amount)
98
- post ={}
98
+ post = {}
99
99
  add_invoice(post, options)
100
100
  add_reference(post, identification)
101
101
  add_amount(post, options[:amount], options)
@@ -156,11 +156,11 @@ module ActiveMerchant #:nodoc:
156
156
  Response.new(
157
157
  success?(response),
158
158
  message_from(response),
159
- response.merge(:timestamp => parameters[:dateq]),
160
- :test => test?,
161
- :authorization => response[:numappel].to_s + response[:numtrans].to_s,
162
- :fraud_review => false,
163
- :sent_params => parameters.delete_if { |key, value| ['porteur', 'dateval', 'cvv'].include?(key.to_s) }
159
+ response.merge(timestamp: parameters[:dateq]),
160
+ test: test?,
161
+ authorization: response[:numappel].to_s + response[:numtrans].to_s,
162
+ fraud_review: false,
163
+ sent_params: parameters.delete_if { |key, value| ['porteur', 'dateval', 'cvv'].include?(key.to_s) }
164
164
  )
165
165
  end
166
166
 
@@ -178,15 +178,15 @@ module ActiveMerchant #:nodoc:
178
178
 
179
179
  def post_data(action, parameters = {})
180
180
  parameters.update(
181
- :version => API_VERSION,
182
- :type => TRANSACTIONS[action.to_sym],
183
- :dateq => Time.now.strftime('%d%m%Y%H%M%S'),
184
- :numquestion => unique_id(parameters[:order_id]),
185
- :site => @options[:login].to_s[0, 7],
186
- :rang => @options[:rang] || @options[:login].to_s[7..-1],
187
- :cle => @options[:password],
188
- :pays => '',
189
- :archivage => parameters[:order_id]
181
+ version: API_VERSION,
182
+ type: TRANSACTIONS[action.to_sym],
183
+ dateq: Time.now.strftime('%d%m%Y%H%M%S'),
184
+ numquestion: unique_id(parameters[:order_id]),
185
+ site: @options[:login].to_s[0, 7],
186
+ rang: @options[:rang] || @options[:login].to_s[7..-1],
187
+ cle: @options[:password],
188
+ pays: '',
189
+ archivage: parameters[:order_id]
190
190
  )
191
191
 
192
192
  parameters.collect { |key, value| "#{key.to_s.upcase}=#{CGI.escape(value.to_s)}" }.join('&')
@@ -80,21 +80,21 @@ module ActiveMerchant #:nodoc:
80
80
  request = build_recurring_request(options[:profile_id] ? :modify : :add, money, options) do |xml|
81
81
  add_credit_card(xml, credit_card, options) if credit_card
82
82
  end
83
- commit(request, options.merge(:request_type => :recurring))
83
+ commit(request, options.merge(request_type: :recurring))
84
84
  end
85
85
 
86
86
  def cancel_recurring(profile_id)
87
87
  ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE
88
88
 
89
- request = build_recurring_request(:cancel, 0, :profile_id => profile_id)
90
- commit(request, options.merge(:request_type => :recurring))
89
+ request = build_recurring_request(:cancel, 0, profile_id: profile_id)
90
+ commit(request, options.merge(request_type: :recurring))
91
91
  end
92
92
 
93
93
  def recurring_inquiry(profile_id, options = {})
94
94
  ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE
95
95
 
96
- request = build_recurring_request(:inquiry, nil, options.update(:profile_id => profile_id))
97
- commit(request, options.merge(:request_type => :recurring))
96
+ request = build_recurring_request(:inquiry, nil, options.update(profile_id: profile_id))
97
+ commit(request, options.merge(request_type: :recurring))
98
98
  end
99
99
 
100
100
  def express
@@ -136,7 +136,7 @@ module ActiveMerchant #:nodoc:
136
136
  xml.tag! 'Description', options[:description] unless options[:description].blank?
137
137
  xml.tag! 'OrderDesc', options[:order_desc] unless options[:order_desc].blank?
138
138
  xml.tag! 'Comment', options[:comment] unless options[:comment].blank?
139
- xml.tag!('ExtData', 'Name'=> 'COMMENT2', 'Value'=> options[:comment2]) unless options[:comment2].blank?
139
+ xml.tag!('ExtData', 'Name' => 'COMMENT2', 'Value' => options[:comment2]) unless options[:comment2].blank?
140
140
  xml.tag! 'TaxAmt', options[:taxamt] unless options[:taxamt].blank?
141
141
  xml.tag! 'FreightAmt', options[:freightamt] unless options[:freightamt].blank?
142
142
  xml.tag! 'DutyAmt', options[:dutyamt] unless options[:dutyamt].blank?
@@ -169,7 +169,7 @@ module ActiveMerchant #:nodoc:
169
169
  xml.tag! 'OrderDesc', options[:order_desc] unless options[:order_desc].blank?
170
170
  # Comment and Comment2 will show up in manager.paypal.com as Comment1 and Comment2
171
171
  xml.tag! 'Comment', options[:comment] unless options[:comment].blank?
172
- xml.tag!('ExtData', 'Name'=> 'COMMENT2', 'Value'=> options[:comment2]) unless options[:comment2].blank?
172
+ xml.tag!('ExtData', 'Name' => 'COMMENT2', 'Value' => options[:comment2]) unless options[:comment2].blank?
173
173
  xml.tag! 'TaxAmt', options[:taxamt] unless options[:taxamt].blank?
174
174
  xml.tag! 'FreightAmt', options[:freightamt] unless options[:freightamt].blank?
175
175
  xml.tag! 'DutyAmt', options[:dutyamt] unless options[:dutyamt].blank?
@@ -37,20 +37,20 @@ module ActiveMerchant #:nodoc:
37
37
  XMLNS = 'http://www.paypal.com/XMLPay'
38
38
 
39
39
  CARD_MAPPING = {
40
- :visa => 'Visa',
41
- :master => 'MasterCard',
42
- :discover => 'Discover',
43
- :american_express => 'Amex',
44
- :jcb => 'JCB',
45
- :diners_club => 'DinersClub',
40
+ visa: 'Visa',
41
+ master: 'MasterCard',
42
+ discover: 'Discover',
43
+ american_express: 'Amex',
44
+ jcb: 'JCB',
45
+ diners_club: 'DinersClub',
46
46
  }
47
47
 
48
48
  TRANSACTIONS = {
49
- :purchase => 'Sale',
50
- :authorization => 'Authorization',
51
- :capture => 'Capture',
52
- :void => 'Void',
53
- :credit => 'Credit'
49
+ purchase: 'Sale',
50
+ authorization: 'Authorization',
51
+ capture: 'Capture',
52
+ void: 'Void',
53
+ credit: 'Credit'
54
54
  }
55
55
 
56
56
  CVV_CODE = {
@@ -117,7 +117,7 @@ module ActiveMerchant #:nodoc:
117
117
  xml.tag!('TotalAmt', amount(money), 'Currency' => options[:currency] || currency(money))
118
118
  xml.tag!('Description', options[:description]) unless options[:description].blank?
119
119
  xml.tag!('Comment', options[:comment]) unless options[:comment].blank?
120
- xml.tag!('ExtData', 'Name'=> 'COMMENT2', 'Value'=> options[:comment2]) unless options[:comment2].blank?
120
+ xml.tag!('ExtData', 'Name' => 'COMMENT2', 'Value' => options[:comment2]) unless options[:comment2].blank?
121
121
  xml.tag!(
122
122
  'ExtData',
123
123
  'Name' => 'CAPTURECOMPLETE',
@@ -110,7 +110,7 @@ module ActiveMerchant #:nodoc:
110
110
  private
111
111
 
112
112
  def build_get_express_details_request(token)
113
- xml = Builder::XmlMarkup.new :indent => 2
113
+ xml = Builder::XmlMarkup.new indent: 2
114
114
  xml.tag! 'GetExpressCheckout' do
115
115
  xml.tag! 'Authorization' do
116
116
  xml.tag! 'PayData' do
@@ -126,7 +126,7 @@ module ActiveMerchant #:nodoc:
126
126
  end
127
127
 
128
128
  def build_setup_express_sale_or_authorization_request(action, money, options = {})
129
- xml = Builder::XmlMarkup.new :indent => 2
129
+ xml = Builder::XmlMarkup.new indent: 2
130
130
  xml.tag! 'SetExpressCheckout' do
131
131
  xml.tag! action do
132
132
  add_pay_data xml, money, options
@@ -136,7 +136,7 @@ module ActiveMerchant #:nodoc:
136
136
  end
137
137
 
138
138
  def build_sale_or_authorization_request(action, money, options)
139
- xml = Builder::XmlMarkup.new :indent => 2
139
+ xml = Builder::XmlMarkup.new indent: 2
140
140
  xml.tag! 'DoExpressCheckout' do
141
141
  xml.tag! action do
142
142
  add_pay_data xml, money, options
@@ -155,7 +155,7 @@ module ActiveMerchant #:nodoc:
155
155
  # Comment, Comment2 should make it to the backend at manager.paypal.com, as with Payflow credit card transactions
156
156
  # but that doesn't seem to work (yet?). See: https://www.x.com/thread/51908?tstart=0
157
157
  xml.tag! 'Comment', options[:comment] unless options[:comment].nil?
158
- xml.tag!('ExtData', 'Name'=> 'COMMENT2', 'Value'=> options[:comment2]) unless options[:comment2].nil?
158
+ xml.tag!('ExtData', 'Name' => 'COMMENT2', 'Value' => options[:comment2]) unless options[:comment2].nil?
159
159
 
160
160
  billing_address = options[:billing_address] || options[:address]
161
161
  add_address(xml, 'BillTo', billing_address, options) if billing_address