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
@@ -21,6 +21,8 @@ module ActiveMerchant #:nodoc:
21
21
  visa: 'Visa 3DSecure',
22
22
  american_express: 'AMEX 3DSecure',
23
23
  discover: 'Discover 3DSecure',
24
+ android_pay: 'GooglePayApp',
25
+ google_pay: 'GooglePayApp'
24
26
  }
25
27
 
26
28
  def initialize(options={})
@@ -162,7 +164,7 @@ module ActiveMerchant #:nodoc:
162
164
  xml.hps :CardData do
163
165
  if card_or_token.respond_to?(:number)
164
166
  if card_or_token.track_data
165
- xml.tag!('hps:TrackData', 'method'=>'swipe') do
167
+ xml.tag!('hps:TrackData', 'method' => 'swipe') do
166
168
  xml.text! card_or_token.track_data
167
169
  end
168
170
  if options[:encryption_type]
@@ -199,9 +201,9 @@ module ActiveMerchant #:nodoc:
199
201
  xml.hps :RoutingNumber, check.routing_number
200
202
  xml.hps :AccountNumber, check.account_number
201
203
  xml.hps :CheckNumber, check.number
202
- xml.hps :AccountType, check.account_type.upcase
204
+ xml.hps :AccountType, check.account_type&.upcase
203
205
  end
204
- xml.hps :CheckType, check.account_holder_type.upcase
206
+ xml.hps :CheckType, check.account_holder_type&.upcase
205
207
  end
206
208
 
207
209
  def add_details(xml, options)
@@ -14,12 +14,13 @@ module ActiveMerchant #:nodoc:
14
14
  self.display_name = 'iATS Payments'
15
15
 
16
16
  ACTIONS = {
17
- purchase: 'ProcessCreditCardV1',
18
- purchase_check: 'ProcessACHEFTV1',
19
- refund: 'ProcessCreditCardRefundWithTransactionIdV1',
20
- refund_check: 'ProcessACHEFTRefundWithTransactionIdV1',
21
- store: 'CreateCreditCardCustomerCodeV1',
22
- unstore: 'DeleteCustomerCodeV1'
17
+ purchase: 'ProcessCreditCard',
18
+ purchase_check: 'ProcessACHEFT',
19
+ purchase_customer_code: 'ProcessCreditCardWithCustomerCode',
20
+ refund: 'ProcessCreditCardRefundWithTransactionId',
21
+ refund_check: 'ProcessACHEFTRefundWithTransactionId',
22
+ store: 'CreateCreditCardCustomerCode',
23
+ unstore: 'DeleteCustomerCode'
23
24
  }
24
25
 
25
26
  def initialize(options={})
@@ -42,7 +43,7 @@ module ActiveMerchant #:nodoc:
42
43
  add_ip(post, options)
43
44
  add_description(post, options)
44
45
 
45
- commit((payment.is_a?(Check) ? :purchase_check : :purchase), post)
46
+ commit(determine_purchase_type(payment), post)
46
47
  end
47
48
 
48
49
  def refund(money, authorization, options={})
@@ -90,6 +91,16 @@ module ActiveMerchant #:nodoc:
90
91
 
91
92
  private
92
93
 
94
+ def determine_purchase_type(payment)
95
+ if payment.is_a?(String)
96
+ :purchase_customer_code
97
+ elsif payment.is_a?(Check)
98
+ :purchase_check
99
+ else
100
+ :purchase
101
+ end
102
+ end
103
+
93
104
  def add_ip(post, options)
94
105
  post[:customer_ip_address] = options[:ip] if options.has_key?(:ip)
95
106
  end
@@ -101,6 +112,9 @@ module ActiveMerchant #:nodoc:
101
112
  post[:city] = billing_address[:city]
102
113
  post[:state] = billing_address[:state]
103
114
  post[:zip_code] = billing_address[:zip]
115
+ post[:phone] = billing_address[:phone] if billing_address[:phone]
116
+ post[:email] = billing_address[:email] if billing_address[:email]
117
+ post[:country] = billing_address[:country] if billing_address[:country]
104
118
  end
105
119
  end
106
120
 
@@ -114,7 +128,9 @@ module ActiveMerchant #:nodoc:
114
128
  end
115
129
 
116
130
  def add_payment(post, payment)
117
- if payment.is_a?(Check)
131
+ if payment.is_a?(String)
132
+ post[:customer_code] = payment
133
+ elsif payment.is_a?(Check)
118
134
  add_check(post, payment)
119
135
  else
120
136
  add_credit_card(post, payment)
@@ -178,12 +194,13 @@ module ActiveMerchant #:nodoc:
178
194
 
179
195
  def endpoints
180
196
  {
181
- purchase: 'ProcessLink.asmx',
182
- purchase_check: 'ProcessLink.asmx',
183
- refund: 'ProcessLink.asmx',
184
- refund_check: 'ProcessLink.asmx',
185
- store: 'CustomerLink.asmx',
186
- unstore: 'CustomerLink.asmx'
197
+ purchase: 'ProcessLinkv3.asmx',
198
+ purchase_check: 'ProcessLinkv3.asmx',
199
+ purchase_customer_code: 'ProcessLinkv3.asmx',
200
+ refund: 'ProcessLinkv3.asmx',
201
+ refund_check: 'ProcessLinkv3.asmx',
202
+ store: 'CustomerLinkv3.asmx',
203
+ unstore: 'CustomerLinkv3.asmx'
187
204
  }
188
205
  end
189
206
 
@@ -266,7 +283,7 @@ module ActiveMerchant #:nodoc:
266
283
 
267
284
  def post_data(action, parameters = {})
268
285
  xml = Builder::XmlMarkup.new
269
- xml.instruct!(:xml, :version => '1.0', :encoding => 'utf-8')
286
+ xml.instruct!(:xml, version: '1.0', encoding: 'utf-8')
270
287
  xml.tag! 'soap12:Envelope', envelope_namespaces do
271
288
  xml.tag! 'soap12:Body' do
272
289
  xml.tag! ACTIONS[action], { 'xmlns' => 'https://www.iatspayments.com/NetGate/' } do
@@ -51,13 +51,13 @@ module ActiveMerchant #:nodoc:
51
51
  end
52
52
 
53
53
  def capture(money, authorization, options = {})
54
- post ={}
54
+ post = {}
55
55
  post[:transactionid] = authorization
56
56
  commit('capture', money, post)
57
57
  end
58
58
 
59
59
  def void(authorization, options = {})
60
- post ={}
60
+ post = {}
61
61
  post[:transactionid] = authorization
62
62
  commit('void', nil, post)
63
63
  end
@@ -93,7 +93,7 @@ module ActiveMerchant #:nodoc:
93
93
  # store and unstore need to be defined
94
94
  def store(creditcard, options = {})
95
95
  billing_id = options.delete(:billing_id).to_s || true
96
- authorize(100, creditcard, options.merge(:store => billing_id))
96
+ authorize(100, creditcard, options.merge(store: billing_id))
97
97
  end
98
98
 
99
99
  alias_method :unstore, :delete
@@ -173,10 +173,10 @@ module ActiveMerchant #:nodoc:
173
173
  response = parse(ssl_post(self.live_url, post_data(action, parameters)))
174
174
 
175
175
  Response.new(response['response'] == '1', message_from(response), response,
176
- :authorization => response['transactionid'],
177
- :test => test?,
178
- :cvv_result => response['cvvresponse'],
179
- :avs_result => { :code => response['avsresponse'] }
176
+ authorization: response['transactionid'],
177
+ test: test?,
178
+ cvv_result: response['cvvresponse'],
179
+ avs_result: { code: response['avsresponse'] }
180
180
  )
181
181
  end
182
182
 
@@ -141,9 +141,9 @@ module ActiveMerchant #:nodoc:
141
141
  response = parse(data)
142
142
 
143
143
  Response.new(response[:success], response[:message], response,
144
- :authorization => response[:transaction_id],
145
- :avs_result => { :code => response[:avs_result] },
146
- :cvv_result => response[:cvv_result]
144
+ authorization: response[:transaction_id],
145
+ avs_result: { code: response[:avs_result] },
146
+ cvv_result: response[:cvv_result]
147
147
  )
148
148
  end
149
149
 
@@ -98,7 +98,7 @@ module ActiveMerchant #:nodoc:
98
98
  end
99
99
 
100
100
  def add_credit_card(xml, payment)
101
- xml.CreditCard :Registered => 'False' do
101
+ xml.CreditCard Registered: 'False' do
102
102
  xml.CardNumber payment.number
103
103
  xml.ExpM format(payment.month, :two_digits)
104
104
  xml.ExpY format(payment.year, :four_digits)
@@ -291,7 +291,8 @@ module ActiveMerchant #:nodoc:
291
291
  order_id, cross_reference, _ = authorization.split(';')
292
292
  build_request(options) do |xml|
293
293
  if money
294
- details = {'CurrencyCode' => currency_code(options[:currency] || default_currency), 'Amount' => amount(money)}
294
+ currency = options[:currency] || currency(money)
295
+ details = {'CurrencyCode' => currency_code(currency), 'Amount' => localized_amount(money, currency)}
295
296
  else
296
297
  details = {'CurrencyCode' => currency_code(default_currency), 'Amount' => '0'}
297
298
  end
@@ -304,8 +305,8 @@ module ActiveMerchant #:nodoc:
304
305
 
305
306
  def build_request(options)
306
307
  requires!(options, :action)
307
- xml = Builder::XmlMarkup.new :indent => 2
308
- xml.instruct!(:xml, :version => '1.0', :encoding => 'utf-8')
308
+ xml = Builder::XmlMarkup.new indent: 2
309
+ xml.instruct!(:xml, version: '1.0', encoding: 'utf-8')
309
310
  xml.tag! 'soap:Envelope', { 'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/',
310
311
  'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
311
312
  'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema'} do
@@ -327,8 +328,9 @@ module ActiveMerchant #:nodoc:
327
328
  end
328
329
 
329
330
  def add_purchase_data(xml, type, money, options)
331
+ currency = options[:currency] || currency(money)
330
332
  requires!(options, :order_id)
331
- xml.tag! 'TransactionDetails', {'Amount' => amount(money), 'CurrencyCode' => currency_code(options[:currency] || currency(money))} do
333
+ xml.tag! 'TransactionDetails', {'Amount' => localized_amount(money, currency), 'CurrencyCode' => currency_code(currency)} do
332
334
  xml.tag! 'MessageDetails', {'TransactionType' => type}
333
335
  xml.tag! 'OrderID', options[:order_id]
334
336
  xml.tag! 'TransactionControl' do
@@ -383,13 +385,13 @@ module ActiveMerchant #:nodoc:
383
385
  authorization = success ? [options[:order_id], response[:transaction_output_data][:cross_reference], response[:transaction_output_data][:auth_code]].compact.join(';') : nil
384
386
 
385
387
  Response.new(success, message, response,
386
- :test => test?,
387
- :authorization => authorization,
388
- :avs_result => {
389
- :street_match => AVS_CODE[ response[:transaction_output_data][:address_numeric_check_result] ],
390
- :postal_match => AVS_CODE[ response[:transaction_output_data][:post_code_check_result] ],
388
+ test: test?,
389
+ authorization: authorization,
390
+ avs_result: {
391
+ street_match: AVS_CODE[ response[:transaction_output_data][:address_numeric_check_result] ],
392
+ postal_match: AVS_CODE[ response[:transaction_output_data][:post_code_check_result] ],
391
393
  },
392
- :cvv_result => CVV_CODE[ response[:transaction_output_data][:cv2_check_result] ]
394
+ cvv_result: CVV_CODE[ response[:transaction_output_data][:cv2_check_result] ]
393
395
  )
394
396
  end
395
397
 
@@ -388,14 +388,14 @@ module ActiveMerchant #:nodoc:
388
388
  response = parse(ssl_post(self.live_url, post_data(payload), 'Content-Type' => 'text/xml'))
389
389
 
390
390
  Response.new(successful?(response), response[:error_message], response,
391
- :test => test?,
392
- :authorization => response[:xid],
393
- :avs_result => { :code => response[:avs_response] },
394
- :cvv_result => response[:cvv_response])
391
+ test: test?,
392
+ authorization: response[:xid],
393
+ avs_result: { code: response[:avs_response] },
394
+ cvv_result: response[:cvv_response])
395
395
  end
396
396
 
397
397
  def post_data(payload)
398
- payload_xml = payload.root.to_xml(:indent => 0)
398
+ payload_xml = payload.root.to_xml(indent: 0)
399
399
 
400
400
  payload_signature = sign_payload(payload_xml)
401
401
 
@@ -410,7 +410,7 @@ module ActiveMerchant #:nodoc:
410
410
  end.doc
411
411
 
412
412
  request.root.children.first.after payload.root
413
- request.to_xml(:indent => 0)
413
+ request.to_xml(indent: 0)
414
414
  end
415
415
 
416
416
  def parse(raw_xml)
@@ -439,7 +439,7 @@ module ActiveMerchant #:nodoc:
439
439
 
440
440
  def sign_payload(payload)
441
441
  key = @options[:password].to_s
442
- digest=OpenSSL::HMAC.digest(OpenSSL::Digest::SHA1.new(key), key, payload)
442
+ digest = OpenSSL::HMAC.digest(OpenSSL::Digest::SHA1.new(key), key, payload)
443
443
  signature = Base64.encode64(digest)
444
444
  signature.chomp!
445
445
  end
@@ -60,7 +60,10 @@ module ActiveMerchant #:nodoc:
60
60
  end
61
61
 
62
62
  def verify(credit_card, options={})
63
- authorize(0, credit_card, options)
63
+ MultiResponse.run(:use_first_response) do |r|
64
+ r.process { authorize(100, credit_card, options) }
65
+ r.process(:ignore_result) { void(r.authorization, options) }
66
+ end
64
67
  end
65
68
 
66
69
  def verify_credentials
@@ -84,7 +87,7 @@ module ActiveMerchant #:nodoc:
84
87
  private
85
88
 
86
89
  def build_xml_envelope(vxml)
87
- builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
90
+ builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
88
91
  xml[:soap].Envelope 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema', 'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/' do
89
92
  xml[:soap].Body do
90
93
  xml.Execute 'xmlns' => 'http://iveri.com/' do
@@ -203,7 +206,7 @@ module ActiveMerchant #:nodoc:
203
206
  def parse_element(parsed, node)
204
207
  if !node.attributes.empty?
205
208
  node.attributes.each do |a|
206
- parsed[underscore(node.name)+ '_' + underscore(a[1].name)] = a[1].value
209
+ parsed[underscore(node.name) + '_' + underscore(a[1].name)] = a[1].value
207
210
  end
208
211
  end
209
212
 
@@ -8,6 +8,7 @@ module ActiveMerchant #:nodoc:
8
8
 
9
9
  self.supported_countries = %w(AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS YE YT ZA ZM ZW)
10
10
  self.default_currency = 'EUR'
11
+ self.currencies_with_three_decimal_places = %w(BHD IQD JOD KWD LWD OMR TND)
11
12
  self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb, :maestro]
12
13
 
13
14
  self.homepage_url = 'https://www.ixopay.com'
@@ -151,6 +152,7 @@ module ActiveMerchant #:nodoc:
151
152
  xml.currency currency
152
153
  xml.description description
153
154
  xml.callbackUrl(options[:callback_url])
155
+ add_stored_credentials(xml, options)
154
156
  end
155
157
  end
156
158
 
@@ -169,6 +171,7 @@ module ActiveMerchant #:nodoc:
169
171
  xml.currency currency
170
172
  xml.description description
171
173
  xml.callbackUrl callback_url
174
+ add_stored_credentials(xml, options)
172
175
  end
173
176
  end
174
177
 
@@ -251,6 +254,25 @@ module ActiveMerchant #:nodoc:
251
254
  SecureRandom.uuid
252
255
  end
253
256
 
257
+ # Ixopay does not pass any parameters for cardholder/merchant initiated.
258
+ # Ixopay also doesn't support installment transactions, only recurring
259
+ # ("RECURRING") and unscheduled ("CARDONFILE").
260
+ #
261
+ # Furthermore, Ixopay is slightly unusual in its application of stored
262
+ # credentials in that the gateway does not return a true
263
+ # network_transaction_id that can be sent on subsequent transactions.
264
+ def add_stored_credentials(xml, options)
265
+ return unless stored_credential = options[:stored_credential]
266
+
267
+ if stored_credential[:initial_transaction]
268
+ xml.transactionIndicator 'INITIAL'
269
+ elsif stored_credential[:reason_type] == 'recurring'
270
+ xml.transactionIndicator 'RECURRING'
271
+ elsif stored_credential[:reason_type] == 'unscheduled'
272
+ xml.transactionIndicator 'CARDONFILE'
273
+ end
274
+ end
275
+
254
276
  def add_extra_data(xml, extra_data)
255
277
  extra_data.each do |k, v|
256
278
  xml.extraData(v, key: k)
@@ -287,10 +287,10 @@ module ActiveMerchant #:nodoc:
287
287
  Response.new(success,
288
288
  success ? 'APPROVED' : message_from(response),
289
289
  response,
290
- :test => test?,
291
- :authorization => authorization_from(response, money, token),
292
- :avs_result => { :code => response[:avs] },
293
- :cvv_result => response[:cvv2]
290
+ test: test?,
291
+ authorization: authorization_from(response, money, token),
292
+ avs_result: { code: response[:avs] },
293
+ cvv_result: response[:cvv2]
294
294
  )
295
295
  end
296
296
 
@@ -298,11 +298,11 @@ module ActiveMerchant #:nodoc:
298
298
  Response.new(success,
299
299
  success ? 'APPROVED' : message_from(response),
300
300
  response,
301
- :test => test?,
302
- :authorization => authorization_from(response, money, token),
303
- :avs_result => AVSResult.new(:code => response[:avs]),
304
- :cvv_result => CVVResult.new(response[:cvv2]),
305
- :error_code => success ? nil : error_code_from(response)
301
+ test: test?,
302
+ authorization: authorization_from(response, money, token),
303
+ avs_result: AVSResult.new(code: response[:avs]),
304
+ cvv_result: CVVResult.new(response[:cvv2]),
305
+ error_code: success ? nil : error_code_from(response)
306
306
  )
307
307
  end
308
308
 
@@ -4,8 +4,8 @@ module ActiveMerchant #:nodoc:
4
4
  self.display_name = 'Kushki'
5
5
  self.homepage_url = 'https://www.kushkipagos.com'
6
6
 
7
- self.test_url = 'https://api-uat.kushkipagos.com/v1/'
8
- self.live_url = 'https://api.kushkipagos.com/v1/'
7
+ self.test_url = 'https://api-uat.kushkipagos.com/'
8
+ self.live_url = 'https://api.kushkipagos.com/'
9
9
 
10
10
  self.supported_countries = ['CL', 'CO', 'EC', 'MX', 'PE']
11
11
  self.default_currency = 'USD'
@@ -24,6 +24,23 @@ module ActiveMerchant #:nodoc:
24
24
  end
25
25
  end
26
26
 
27
+ def authorize(amount, payment_method, options={})
28
+ MultiResponse.run() do |r|
29
+ r.process { tokenize(amount, payment_method, options) }
30
+ r.process { preauthorize(amount, r.authorization, options) }
31
+ end
32
+ end
33
+
34
+ def capture(amount, authorization, options={})
35
+ action = 'capture'
36
+
37
+ post = {}
38
+ post[:ticketNumber] = authorization
39
+ add_invoice(action, post, amount, options)
40
+
41
+ commit(action, post)
42
+ end
43
+
27
44
  def refund(amount, authorization, options={})
28
45
  action = 'refund'
29
46
 
@@ -75,6 +92,16 @@ module ActiveMerchant #:nodoc:
75
92
  commit(action, post)
76
93
  end
77
94
 
95
+ def preauthorize(amount, authorization, options)
96
+ action = 'preAuthorization'
97
+
98
+ post = {}
99
+ add_reference(post, authorization, options)
100
+ add_invoice(action, post, amount, options)
101
+
102
+ commit(action, post)
103
+ end
104
+
78
105
  def add_invoice(action, post, money, options)
79
106
  if action == 'tokenize'
80
107
  post[:totalAmount] = amount(money).to_f
@@ -131,7 +158,9 @@ module ActiveMerchant #:nodoc:
131
158
  'tokenize' => 'tokens',
132
159
  'charge' => 'charges',
133
160
  'void' => 'charges',
134
- 'refund' => 'refund'
161
+ 'refund' => 'refund',
162
+ 'preAuthorization' => 'preAuthorization',
163
+ 'capture' => 'capture'
135
164
  }
136
165
 
137
166
  def commit(action, params)
@@ -178,9 +207,9 @@ module ActiveMerchant #:nodoc:
178
207
  base_url = test? ? test_url : live_url
179
208
 
180
209
  if ['void', 'refund'].include?(action)
181
- base_url + ENDPOINT[action] + '/' + params[:ticketNumber].to_s
210
+ base_url + 'v1/' + ENDPOINT[action] + '/' + params[:ticketNumber].to_s
182
211
  else
183
- base_url + ENDPOINT[action]
212
+ base_url + 'card/v1/' + ENDPOINT[action]
184
213
  end
185
214
  end
186
215