activemerchant 1.105.0 → 1.106.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +31 -1
  3. data/README.md +1 -1
  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 +17 -6
  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 +2 -2
  24. data/lib/active_merchant/billing/gateways/bpoint.rb +1 -1
  25. data/lib/active_merchant/billing/gateways/braintree_blue.rb +74 -74
  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 +1 -1
  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 +86 -72
  40. data/lib/active_merchant/billing/gateways/data_cash.rb +33 -33
  41. data/lib/active_merchant/billing/gateways/decidir.rb +2 -2
  42. data/lib/active_merchant/billing/gateways/ebanx.rb +1 -1
  43. data/lib/active_merchant/billing/gateways/efsnet.rb +23 -23
  44. data/lib/active_merchant/billing/gateways/elavon.rb +13 -13
  45. data/lib/active_merchant/billing/gateways/epay.rb +40 -40
  46. data/lib/active_merchant/billing/gateways/evo_ca.rb +11 -11
  47. data/lib/active_merchant/billing/gateways/eway.rb +3 -3
  48. data/lib/active_merchant/billing/gateways/eway_managed.rb +40 -40
  49. data/lib/active_merchant/billing/gateways/eway_rapid.rb +7 -7
  50. data/lib/active_merchant/billing/gateways/exact.rb +11 -11
  51. data/lib/active_merchant/billing/gateways/fat_zebra.rb +3 -2
  52. data/lib/active_merchant/billing/gateways/federated_canada.rb +5 -5
  53. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +20 -20
  54. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +19 -19
  55. data/lib/active_merchant/billing/gateways/flo2cash.rb +4 -4
  56. data/lib/active_merchant/billing/gateways/forte.rb +1 -1
  57. data/lib/active_merchant/billing/gateways/garanti.rb +8 -8
  58. data/lib/active_merchant/billing/gateways/hdfc.rb +3 -3
  59. data/lib/active_merchant/billing/gateways/hps.rb +1 -1
  60. data/lib/active_merchant/billing/gateways/iats_payments.rb +1 -1
  61. data/lib/active_merchant/billing/gateways/inspire.rb +7 -7
  62. data/lib/active_merchant/billing/gateways/instapay.rb +3 -3
  63. data/lib/active_merchant/billing/gateways/ipp.rb +1 -1
  64. data/lib/active_merchant/billing/gateways/iridium.rb +8 -8
  65. data/lib/active_merchant/billing/gateways/itransact.rb +7 -7
  66. data/lib/active_merchant/billing/gateways/iveri.rb +2 -2
  67. data/lib/active_merchant/billing/gateways/ixopay.rb +21 -0
  68. data/lib/active_merchant/billing/gateways/jetpay.rb +4 -4
  69. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +5 -5
  70. data/lib/active_merchant/billing/gateways/latitude19.rb +2 -2
  71. data/lib/active_merchant/billing/gateways/linkpoint.rb +62 -62
  72. data/lib/active_merchant/billing/gateways/litle.rb +2 -2
  73. data/lib/active_merchant/billing/gateways/mastercard.rb +2 -2
  74. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +5 -5
  75. data/lib/active_merchant/billing/gateways/merchant_one.rb +2 -2
  76. data/lib/active_merchant/billing/gateways/merchant_partners.rb +4 -4
  77. data/lib/active_merchant/billing/gateways/merchant_ware.rb +12 -12
  78. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +11 -11
  79. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +12 -2
  80. data/lib/active_merchant/billing/gateways/mercury.rb +9 -9
  81. data/lib/active_merchant/billing/gateways/metrics_global.rb +15 -15
  82. data/lib/active_merchant/billing/gateways/migs.rb +13 -13
  83. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +7 -7
  84. data/lib/active_merchant/billing/gateways/monei.rb +19 -19
  85. data/lib/active_merchant/billing/gateways/moneris.rb +10 -10
  86. data/lib/active_merchant/billing/gateways/money_movers.rb +5 -5
  87. data/lib/active_merchant/billing/gateways/mundipagg.rb +1 -1
  88. data/lib/active_merchant/billing/gateways/nab_transact.rb +15 -15
  89. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +1 -1
  90. data/lib/active_merchant/billing/gateways/net_registry.rb +6 -6
  91. data/lib/active_merchant/billing/gateways/netaxept.rb +4 -4
  92. data/lib/active_merchant/billing/gateways/netbanx.rb +14 -14
  93. data/lib/active_merchant/billing/gateways/netbilling.rb +12 -12
  94. data/lib/active_merchant/billing/gateways/netpay.rb +2 -2
  95. data/lib/active_merchant/billing/gateways/network_merchants.rb +5 -5
  96. data/lib/active_merchant/billing/gateways/ogone.rb +7 -7
  97. data/lib/active_merchant/billing/gateways/openpay.rb +2 -2
  98. data/lib/active_merchant/billing/gateways/opp.rb +1 -1
  99. data/lib/active_merchant/billing/gateways/optimal_payment.rb +9 -9
  100. data/lib/active_merchant/billing/gateways/orbital.rb +10 -10
  101. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +7 -7
  102. data/lib/active_merchant/billing/gateways/pay_conex.rb +2 -2
  103. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +16 -16
  104. data/lib/active_merchant/billing/gateways/pay_junction.rb +16 -16
  105. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +18 -2
  106. data/lib/active_merchant/billing/gateways/pay_secure.rb +6 -6
  107. data/lib/active_merchant/billing/gateways/paybox_direct.rb +36 -36
  108. data/lib/active_merchant/billing/gateways/payflow.rb +7 -7
  109. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +12 -12
  110. data/lib/active_merchant/billing/gateways/payflow_express.rb +4 -4
  111. data/lib/active_merchant/billing/gateways/payment_express.rb +7 -7
  112. data/lib/active_merchant/billing/gateways/paymill.rb +3 -3
  113. data/lib/active_merchant/billing/gateways/paypal.rb +1 -1
  114. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +5 -5
  115. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
  116. data/lib/active_merchant/billing/gateways/payscout.rb +5 -5
  117. data/lib/active_merchant/billing/gateways/paystation.rb +2 -2
  118. data/lib/active_merchant/billing/gateways/payu_latam.rb +3 -3
  119. data/lib/active_merchant/billing/gateways/payway.rb +12 -12
  120. data/lib/active_merchant/billing/gateways/pin.rb +16 -16
  121. data/lib/active_merchant/billing/gateways/plugnpay.rb +10 -10
  122. data/lib/active_merchant/billing/gateways/psigate.rb +26 -26
  123. data/lib/active_merchant/billing/gateways/psl_card.rb +4 -4
  124. data/lib/active_merchant/billing/gateways/qbms.rb +23 -23
  125. data/lib/active_merchant/billing/gateways/quantum.rb +4 -4
  126. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +95 -95
  127. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +9 -9
  128. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +2 -2
  129. data/lib/active_merchant/billing/gateways/qvalent.rb +1 -1
  130. data/lib/active_merchant/billing/gateways/realex.rb +8 -8
  131. data/lib/active_merchant/billing/gateways/redsys.rb +24 -16
  132. data/lib/active_merchant/billing/gateways/safe_charge.rb +1 -1
  133. data/lib/active_merchant/billing/gateways/sage.rb +10 -10
  134. data/lib/active_merchant/billing/gateways/sage_pay.rb +35 -35
  135. data/lib/active_merchant/billing/gateways/sallie_mae.rb +2 -2
  136. data/lib/active_merchant/billing/gateways/secure_net.rb +9 -9
  137. data/lib/active_merchant/billing/gateways/secure_pay.rb +13 -13
  138. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +15 -15
  139. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +2 -2
  140. data/lib/active_merchant/billing/gateways/skip_jack.rb +8 -8
  141. data/lib/active_merchant/billing/gateways/smart_ps.rb +16 -16
  142. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +6 -6
  143. data/lib/active_merchant/billing/gateways/spreedly_core.rb +4 -4
  144. data/lib/active_merchant/billing/gateways/stripe.rb +8 -8
  145. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +10 -3
  146. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +2 -2
  147. data/lib/active_merchant/billing/gateways/trans_first.rb +4 -4
  148. data/lib/active_merchant/billing/gateways/trust_commerce.rb +19 -19
  149. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +110 -110
  150. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +29 -29
  151. data/lib/active_merchant/billing/gateways/verifi.rb +10 -10
  152. data/lib/active_merchant/billing/gateways/viaklix.rb +6 -6
  153. data/lib/active_merchant/billing/gateways/visanet_peru.rb +6 -6
  154. data/lib/active_merchant/billing/gateways/webpay.rb +2 -2
  155. data/lib/active_merchant/billing/gateways/wirecard.rb +6 -6
  156. data/lib/active_merchant/billing/gateways/worldpay.rb +15 -15
  157. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +32 -32
  158. data/lib/active_merchant/billing/gateways/worldpay_us.rb +2 -2
  159. data/lib/active_merchant/connection.rb +1 -1
  160. data/lib/active_merchant/network_connection_retries.rb +3 -3
  161. data/lib/active_merchant/post_data.rb +1 -1
  162. data/lib/active_merchant/version.rb +1 -1
  163. data/lib/certs/cacert.pem +75 -0
  164. data/lib/support/ssl_verify.rb +2 -2
  165. data/lib/support/ssl_version.rb +2 -2
  166. metadata +2 -3
  167. data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -352
@@ -230,7 +230,7 @@ module ActiveMerchant #:nodoc:
230
230
 
231
231
  # R – Refund request
232
232
  def refund(money, authorization, options = {})
233
- order = build_new_order_xml(REFUND, money, nil, options.merge(:authorization => authorization)) do |xml|
233
+ order = build_new_order_xml(REFUND, money, nil, options.merge(authorization: authorization)) do |xml|
234
234
  add_refund(xml, options[:currency])
235
235
  xml.tag! :CustomerRefNum, options[:customer_ref_num] if @options[:customer_profiles] && options[:profile_txn]
236
236
  end
@@ -245,7 +245,7 @@ module ActiveMerchant #:nodoc:
245
245
  def void(authorization, options = {}, deprecated = {})
246
246
  if !options.kind_of?(Hash)
247
247
  ActiveMerchant.deprecated('Calling the void method with an amount parameter is deprecated and will be removed in a future version.')
248
- return void(options, deprecated.merge(:amount => authorization))
248
+ return void(options, deprecated.merge(amount: authorization))
249
249
  end
250
250
 
251
251
  order = build_void_request_xml(authorization, options)
@@ -286,13 +286,13 @@ module ActiveMerchant #:nodoc:
286
286
  end
287
287
 
288
288
  def retrieve_customer_profile(customer_ref_num)
289
- options = {:customer_profile_action => RETRIEVE, :customer_ref_num => customer_ref_num}
289
+ options = {customer_profile_action: RETRIEVE, customer_ref_num: customer_ref_num}
290
290
  order = build_customer_request_xml(nil, options)
291
291
  commit(order, :retrieve_customer_profile)
292
292
  end
293
293
 
294
294
  def delete_customer_profile(customer_ref_num)
295
- options = {:customer_profile_action => DELETE, :customer_ref_num => customer_ref_num}
295
+ options = {customer_profile_action: DELETE, customer_ref_num: customer_ref_num}
296
296
  order = build_customer_request_xml(nil, options)
297
297
  commit(order, :delete_customer_profile)
298
298
  end
@@ -622,10 +622,10 @@ module ActiveMerchant #:nodoc:
622
622
 
623
623
  Response.new(success?(response, message_type), message_from(response), response,
624
624
  {
625
- :authorization => authorization_string(response[:tx_ref_num], response[:order_id]),
626
- :test => self.test?,
627
- :avs_result => OrbitalGateway::AVSResult.new(response[:avs_resp_code]),
628
- :cvv_result => OrbitalGateway::CVVResult.new(response[:cvv2_resp_code])
625
+ authorization: authorization_string(response[:tx_ref_num], response[:order_id]),
626
+ test: self.test?,
627
+ avs_result: OrbitalGateway::AVSResult.new(response[:avs_resp_code]),
628
+ cvv_result: OrbitalGateway::CVVResult.new(response[:cvv2_resp_code])
629
629
  }
630
630
  )
631
631
  end
@@ -786,8 +786,8 @@ module ActiveMerchant #:nodoc:
786
786
  end
787
787
 
788
788
  def xml_envelope
789
- xml = Builder::XmlMarkup.new(:indent => 2)
790
- xml.instruct!(:xml, :version => '1.0', :encoding => 'UTF-8')
789
+ xml = Builder::XmlMarkup.new(indent: 2)
790
+ xml.instruct!(:xml, version: '1.0', encoding: 'UTF-8')
791
791
  xml
792
792
  end
793
793
 
@@ -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?