activemerchant 1.83.0 → 1.84.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +19 -0
- data/lib/active_merchant/billing/base.rb +1 -1
- data/lib/active_merchant/billing/check.rb +3 -2
- data/lib/active_merchant/billing/compatibility.rb +2 -4
- data/lib/active_merchant/billing/credit_card.rb +6 -39
- data/lib/active_merchant/billing/credit_card_formatting.rb +0 -1
- data/lib/active_merchant/billing/credit_card_methods.rb +67 -44
- data/lib/active_merchant/billing/gateway.rb +1 -8
- data/lib/active_merchant/billing/gateways/adyen.rb +1 -1
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +0 -1
- data/lib/active_merchant/billing/gateways/authorize_net.rb +0 -1
- data/lib/active_merchant/billing/gateways/axcessms.rb +1 -1
- data/lib/active_merchant/billing/gateways/balanced.rb +9 -9
- data/lib/active_merchant/billing/gateways/banwire.rb +5 -5
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +1 -1
- data/lib/active_merchant/billing/gateways/beanstream.rb +1 -0
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +0 -1
- data/lib/active_merchant/billing/gateways/blue_snap.rb +5 -7
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +12 -6
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +0 -1
- data/lib/active_merchant/billing/gateways/card_connect.rb +2 -2
- data/lib/active_merchant/billing/gateways/card_save.rb +1 -1
- data/lib/active_merchant/billing/gateways/card_stream.rb +9 -18
- data/lib/active_merchant/billing/gateways/cardknox.rb +8 -9
- data/lib/active_merchant/billing/gateways/cc5.rb +0 -1
- data/lib/active_merchant/billing/gateways/cecabank.rb +0 -1
- data/lib/active_merchant/billing/gateways/cenpos.rb +1 -1
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +6 -6
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -1
- data/lib/active_merchant/billing/gateways/commercegate.rb +0 -1
- data/lib/active_merchant/billing/gateways/conekta.rb +6 -8
- data/lib/active_merchant/billing/gateways/creditcall.rb +1 -2
- data/lib/active_merchant/billing/gateways/ct_payment.rb +1 -1
- data/lib/active_merchant/billing/gateways/culqi.rb +8 -10
- data/lib/active_merchant/billing/gateways/cyber_source.rb +1 -2
- data/lib/active_merchant/billing/gateways/data_cash.rb +16 -29
- data/lib/active_merchant/billing/gateways/dibs.rb +1 -7
- data/lib/active_merchant/billing/gateways/digitzs.rb +1 -1
- data/lib/active_merchant/billing/gateways/efsnet.rb +0 -4
- data/lib/active_merchant/billing/gateways/element.rb +1 -1
- data/lib/active_merchant/billing/gateways/epay.rb +8 -9
- data/lib/active_merchant/billing/gateways/eway.rb +1 -0
- data/lib/active_merchant/billing/gateways/eway_managed.rb +2 -3
- data/lib/active_merchant/billing/gateways/exact.rb +0 -2
- data/lib/active_merchant/billing/gateways/ezic.rb +0 -1
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +9 -11
- data/lib/active_merchant/billing/gateways/federated_canada.rb +1 -1
- data/lib/active_merchant/billing/gateways/first_giving.rb +3 -3
- data/lib/active_merchant/billing/gateways/first_pay.rb +5 -0
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +2 -2
- data/lib/active_merchant/billing/gateways/garanti.rb +4 -5
- data/lib/active_merchant/billing/gateways/global_collect.rb +6 -7
- data/lib/active_merchant/billing/gateways/iats_payments.rb +1 -1
- data/lib/active_merchant/billing/gateways/inspire.rb +2 -2
- data/lib/active_merchant/billing/gateways/ipp.rb +1 -1
- data/lib/active_merchant/billing/gateways/iridium.rb +3 -3
- data/lib/active_merchant/billing/gateways/iveri.rb +1 -1
- data/lib/active_merchant/billing/gateways/komoju.rb +1 -1
- data/lib/active_merchant/billing/gateways/kushki.rb +7 -9
- data/lib/active_merchant/billing/gateways/latitude19.rb +29 -34
- data/lib/active_merchant/billing/gateways/linkpoint.rb +1 -3
- data/lib/active_merchant/billing/gateways/litle.rb +1 -1
- data/lib/active_merchant/billing/gateways/mastercard.rb +1 -2
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +0 -1
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +0 -1
- data/lib/active_merchant/billing/gateways/merchant_one.rb +1 -1
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +3 -3
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +3 -3
- data/lib/active_merchant/billing/gateways/mercury.rb +1 -1
- data/lib/active_merchant/billing/gateways/micropayment.rb +0 -2
- data/lib/active_merchant/billing/gateways/modern_payments.rb +1 -0
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +4 -3
- data/lib/active_merchant/billing/gateways/moneris.rb +0 -1
- data/lib/active_merchant/billing/gateways/moneris_us.rb +1 -2
- data/lib/active_merchant/billing/gateways/money_movers.rb +1 -1
- data/lib/active_merchant/billing/gateways/mundipagg.rb +9 -9
- data/lib/active_merchant/billing/gateways/nab_transact.rb +0 -1
- data/lib/active_merchant/billing/gateways/net_registry.rb +1 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +1 -2
- data/lib/active_merchant/billing/gateways/ogone.rb +9 -10
- data/lib/active_merchant/billing/gateways/openpay.rb +7 -8
- data/lib/active_merchant/billing/gateways/opp.rb +110 -112
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +1 -4
- data/lib/active_merchant/billing/gateways/orbital.rb +1 -2
- data/lib/active_merchant/billing/gateways/pagarme.rb +3 -5
- data/lib/active_merchant/billing/gateways/pay_conex.rb +0 -1
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +10 -12
- data/lib/active_merchant/billing/gateways/pay_secure.rb +1 -1
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +0 -1
- data/lib/active_merchant/billing/gateways/payeezy.rb +15 -4
- data/lib/active_merchant/billing/gateways/payex.rb +5 -6
- data/lib/active_merchant/billing/gateways/payflow.rb +0 -4
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -2
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +1 -1
- data/lib/active_merchant/billing/gateways/payflow_express.rb +54 -55
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -1
- data/lib/active_merchant/billing/gateways/payment_express.rb +0 -6
- data/lib/active_merchant/billing/gateways/paymill.rb +0 -2
- data/lib/active_merchant/billing/gateways/paypal.rb +0 -8
- data/lib/active_merchant/billing/gateways/payscout.rb +0 -1
- data/lib/active_merchant/billing/gateways/paystation.rb +2 -2
- data/lib/active_merchant/billing/gateways/payu_latam.rb +37 -32
- data/lib/active_merchant/billing/gateways/pin.rb +2 -2
- data/lib/active_merchant/billing/gateways/plugnpay.rb +1 -0
- data/lib/active_merchant/billing/gateways/psl_card.rb +3 -10
- data/lib/active_merchant/billing/gateways/quantum.rb +4 -4
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +0 -3
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +3 -7
- data/lib/active_merchant/billing/gateways/realex.rb +6 -8
- data/lib/active_merchant/billing/gateways/redsys.rb +1 -0
- data/lib/active_merchant/billing/gateways/s5.rb +0 -1
- data/lib/active_merchant/billing/gateways/safe_charge.rb +4 -4
- data/lib/active_merchant/billing/gateways/sage.rb +16 -13
- data/lib/active_merchant/billing/gateways/sage_pay.rb +2 -9
- data/lib/active_merchant/billing/gateways/secure_net.rb +0 -1
- data/lib/active_merchant/billing/gateways/securion_pay.rb +3 -6
- data/lib/active_merchant/billing/gateways/skip_jack.rb +2 -2
- data/lib/active_merchant/billing/gateways/smart_ps.rb +2 -4
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +5 -5
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +1 -2
- data/lib/active_merchant/billing/gateways/stripe.rb +60 -15
- data/lib/active_merchant/billing/gateways/telr.rb +5 -6
- data/lib/active_merchant/billing/gateways/tns.rb +1 -1
- data/lib/active_merchant/billing/gateways/trans_first.rb +0 -1
- data/lib/active_merchant/billing/gateways/trexle.rb +6 -5
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +1 -0
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +2 -2
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +0 -1
- data/lib/active_merchant/billing/gateways/vanco.rb +1 -1
- data/lib/active_merchant/billing/gateways/viaklix.rb +1 -0
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +28 -32
- data/lib/active_merchant/billing/gateways/wepay.rb +0 -1
- data/lib/active_merchant/billing/gateways/wirecard.rb +2 -1
- data/lib/active_merchant/billing/gateways/worldpay.rb +1 -4
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +5 -8
- data/lib/active_merchant/connection.rb +0 -2
- data/lib/active_merchant/country.rb +1 -0
- data/lib/active_merchant/net_http_ssl_connection.rb +1 -1
- data/lib/active_merchant/network_connection_retries.rb +1 -0
- data/lib/active_merchant/post_data.rb +1 -0
- data/lib/active_merchant/posts_data.rb +0 -2
- data/lib/active_merchant/version.rb +1 -1
- data/lib/support/gateway_support.rb +3 -4
- data/lib/support/ssl_verify.rb +0 -1
- metadata +2 -2
@@ -63,7 +63,7 @@ module ActiveMerchant #:nodoc:
|
|
63
63
|
post[:card_num] = creditcard.number
|
64
64
|
post[:card_name] = creditcard.name
|
65
65
|
post[:card_type] = card_brand(creditcard)
|
66
|
-
post[:card_exp] = "#{sprintf("%02d", creditcard.month)}/#{
|
66
|
+
post[:card_exp] = "#{sprintf("%02d", creditcard.month)}/#{creditcard.year.to_s[-2, 2]}"
|
67
67
|
post[:card_ccv2] = creditcard.verification_value
|
68
68
|
end
|
69
69
|
|
@@ -90,10 +90,10 @@ module ActiveMerchant #:nodoc:
|
|
90
90
|
end
|
91
91
|
|
92
92
|
Response.new(success?(response),
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
93
|
+
response['message'],
|
94
|
+
response,
|
95
|
+
:test => test?,
|
96
|
+
:authorization => response['code_auth'])
|
97
97
|
end
|
98
98
|
|
99
99
|
def success?(response)
|
@@ -141,7 +141,6 @@ module ActiveMerchant #:nodoc:
|
|
141
141
|
avs_result: AVSResult.new(:code => parse_avs_code(response)),
|
142
142
|
authorization: response['recurringDetailReference'] || authorization_from(post, response)
|
143
143
|
)
|
144
|
-
|
145
144
|
rescue ResponseError => e
|
146
145
|
case e.response.code
|
147
146
|
when '401'
|
@@ -308,6 +307,7 @@ module ActiveMerchant #:nodoc:
|
|
308
307
|
hash[:shopperIP] = options[:ip] if options[:ip]
|
309
308
|
hash[:shopperReference] = options[:customer] if options[:customer]
|
310
309
|
hash[:shopperInteraction] = options[:shopper_interaction] if options[:shopper_interaction]
|
310
|
+
hash[:deviceFingerprint] = options[:device_fingerprint] if options[:device_fingerprint]
|
311
311
|
hash.keep_if { |_, v| v }
|
312
312
|
end
|
313
313
|
|
@@ -215,7 +215,7 @@ module ActiveMerchant
|
|
215
215
|
parsed = {}
|
216
216
|
doc = Nokogiri::XML(response.body)
|
217
217
|
doc.root.xpath('*').each do |node|
|
218
|
-
if
|
218
|
+
if node.elements.empty?
|
219
219
|
parsed[node.name.downcase] = node.text
|
220
220
|
else
|
221
221
|
node.elements.each do |childnode|
|
@@ -237,11 +237,9 @@ module ActiveMerchant
|
|
237
237
|
end
|
238
238
|
|
239
239
|
def api_request(action, request, verb)
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
e.response
|
244
|
-
end
|
240
|
+
ssl_request(verb, url(action), request, headers)
|
241
|
+
rescue ResponseError => e
|
242
|
+
e.response
|
245
243
|
end
|
246
244
|
|
247
245
|
def commit(action, verb = :post)
|
@@ -258,7 +256,7 @@ module ActiveMerchant
|
|
258
256
|
avs_result: avs_result(parsed),
|
259
257
|
cvv_result: cvv_result(parsed),
|
260
258
|
error_code: error_code_from(parsed),
|
261
|
-
test: test
|
259
|
+
test: test?
|
262
260
|
)
|
263
261
|
end
|
264
262
|
|
@@ -66,7 +66,7 @@ module ActiveMerchant #:nodoc:
|
|
66
66
|
:private_key => options[:private_key],
|
67
67
|
:environment => (options[:environment] || (test? ? :sandbox : :production)).to_sym,
|
68
68
|
:custom_user_agent => "ActiveMerchant #{ActiveMerchant::VERSION}",
|
69
|
-
:logger => options[:logger] || logger
|
69
|
+
:logger => options[:logger] || logger
|
70
70
|
)
|
71
71
|
|
72
72
|
@braintree_gateway = Braintree::Gateway.new( @configuration )
|
@@ -140,7 +140,7 @@ module ActiveMerchant #:nodoc:
|
|
140
140
|
def update(vault_id, creditcard, options = {})
|
141
141
|
braintree_credit_card = nil
|
142
142
|
commit do
|
143
|
-
braintree_credit_card = @braintree_gateway.customer.find(vault_id).credit_cards.detect
|
143
|
+
braintree_credit_card = @braintree_gateway.customer.find(vault_id).credit_cards.detect(&:default?)
|
144
144
|
return Response.new(false, 'Braintree::NotFoundError') if braintree_credit_card.nil?
|
145
145
|
|
146
146
|
options.merge!(:update_existing_token => braintree_credit_card.token)
|
@@ -347,10 +347,15 @@ module ActiveMerchant #:nodoc:
|
|
347
347
|
end
|
348
348
|
|
349
349
|
def response_from_result(result)
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
350
|
+
response_hash = { braintree_transaction: transaction_hash(result) }
|
351
|
+
|
352
|
+
Response.new(
|
353
|
+
result.success?,
|
354
|
+
message_from_result(result),
|
355
|
+
response_hash,
|
356
|
+
authorization: (result.transaction.id if result.transaction),
|
357
|
+
test: test?
|
358
|
+
)
|
354
359
|
end
|
355
360
|
|
356
361
|
def response_params(result)
|
@@ -367,6 +372,7 @@ module ActiveMerchant #:nodoc:
|
|
367
372
|
options[:avs_result] = { code: avs_code_from(result.transaction) }
|
368
373
|
options[:cvv_result] = result.transaction.cvv_response_code
|
369
374
|
end
|
375
|
+
options[:test] = test?
|
370
376
|
options
|
371
377
|
end
|
372
378
|
|
@@ -141,8 +141,8 @@ module ActiveMerchant #:nodoc:
|
|
141
141
|
def unstore(authorization, options = {})
|
142
142
|
account_id, profile_id = authorization.split('|')
|
143
143
|
commit('profile', {},
|
144
|
-
|
145
|
-
|
144
|
+
verb: :delete,
|
145
|
+
path: "/#{profile_id}/#{account_id}/#{@options[:merchant_id]}")
|
146
146
|
end
|
147
147
|
|
148
148
|
def supports_scrubbing?
|
@@ -6,7 +6,7 @@ module ActiveMerchant #:nodoc:
|
|
6
6
|
|
7
7
|
self.money_format = :cents
|
8
8
|
self.default_currency = 'GBP'
|
9
|
-
self.supported_cardtypes = [ :visa, :
|
9
|
+
self.supported_cardtypes = [ :visa, :maestro, :master, :american_express, :jcb ]
|
10
10
|
self.supported_countries = [ 'GB' ]
|
11
11
|
self.homepage_url = 'http://www.cardsave.net/'
|
12
12
|
self.display_name = 'CardSave'
|
@@ -8,7 +8,7 @@ module ActiveMerchant #:nodoc:
|
|
8
8
|
self.money_format = :cents
|
9
9
|
self.default_currency = 'GBP'
|
10
10
|
self.supported_countries = ['GB', 'US', 'CH', 'SE', 'SG', 'NO', 'JP', 'IS', 'HK', 'NL', 'CZ', 'CA', 'AU']
|
11
|
-
self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :discover, :jcb, :maestro
|
11
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :discover, :jcb, :maestro]
|
12
12
|
self.homepage_url = 'http://www.cardstream.com/'
|
13
13
|
self.display_name = 'CardStream'
|
14
14
|
|
@@ -272,17 +272,8 @@ module ActiveMerchant #:nodoc:
|
|
272
272
|
def add_credit_card(post, credit_card)
|
273
273
|
add_pair(post, :customerName, credit_card.name, :required => true)
|
274
274
|
add_pair(post, :cardNumber, credit_card.number, :required => true)
|
275
|
-
|
276
275
|
add_pair(post, :cardExpiryMonth, format(credit_card.month, :two_digits), :required => true)
|
277
276
|
add_pair(post, :cardExpiryYear, format(credit_card.year, :two_digits), :required => true)
|
278
|
-
|
279
|
-
if requires_start_date_or_issue_number?(credit_card)
|
280
|
-
add_pair(post, :cardStartMonth, format(credit_card.start_month, :two_digits))
|
281
|
-
add_pair(post, :cardStartYear, format(credit_card.start_year, :two_digits))
|
282
|
-
|
283
|
-
add_pair(post, :cardIssueNumber, credit_card.issue_number)
|
284
|
-
end
|
285
|
-
|
286
277
|
add_pair(post, :cardCVV, credit_card.verification_value)
|
287
278
|
end
|
288
279
|
|
@@ -327,13 +318,14 @@ module ActiveMerchant #:nodoc:
|
|
327
318
|
|
328
319
|
response = parse(ssl_post(self.live_url, post_data(action, parameters)))
|
329
320
|
|
330
|
-
Response.new(
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
321
|
+
Response.new(
|
322
|
+
response[:responseCode] == '0',
|
323
|
+
response[:responseCode] == '0' ? 'APPROVED' : response[:responseMessage],
|
324
|
+
response,
|
325
|
+
:test => test?,
|
326
|
+
:authorization => response[:xref],
|
327
|
+
:cvv_result => CVV_CODE[response[:avscv2ResponseCode].to_s[0, 1]],
|
328
|
+
:avs_result => avs_from(response)
|
337
329
|
)
|
338
330
|
end
|
339
331
|
|
@@ -358,7 +350,6 @@ module ActiveMerchant #:nodoc:
|
|
358
350
|
})
|
359
351
|
end
|
360
352
|
|
361
|
-
|
362
353
|
def currency_code(currency)
|
363
354
|
CURRENCY_CODES[currency]
|
364
355
|
end
|
@@ -279,18 +279,17 @@ module ActiveMerchant #:nodoc:
|
|
279
279
|
}.delete_if{|k, v| v.nil?}
|
280
280
|
end
|
281
281
|
|
282
|
-
|
283
282
|
def commit(action, source_type, parameters)
|
284
283
|
response = parse(ssl_post(live_url, post_data(COMMANDS[source_type][action], parameters)))
|
285
284
|
|
286
285
|
Response.new(
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
286
|
+
(response[:status] == 'Approved'),
|
287
|
+
message_from(response),
|
288
|
+
response,
|
289
|
+
authorization: authorization_from(response, source_type),
|
290
|
+
avs_result: { code: response[:avs_result_code] },
|
291
|
+
cvv_result: response[:cvv_result_code]
|
292
|
+
)
|
294
293
|
end
|
295
294
|
|
296
295
|
def message_from(response)
|
@@ -312,7 +311,7 @@ module ActiveMerchant #:nodoc:
|
|
312
311
|
Key: @options[:api_key],
|
313
312
|
Version: '4.5.4',
|
314
313
|
SoftwareName: 'Active Merchant',
|
315
|
-
SoftwareVersion:
|
314
|
+
SoftwareVersion: ActiveMerchant::VERSION.to_s,
|
316
315
|
Command: command,
|
317
316
|
}
|
318
317
|
|
@@ -313,7 +313,7 @@ module ActiveMerchant #:nodoc:
|
|
313
313
|
def validation_result_element_text(element)
|
314
314
|
result_text = element.elements.detect { |elem|
|
315
315
|
elem.name == 'Result'
|
316
|
-
}.children.detect
|
316
|
+
}.children.detect(&:text).text
|
317
317
|
|
318
318
|
result_text.split(';').collect(&:strip)
|
319
319
|
end
|
@@ -22,7 +22,7 @@ module ActiveMerchant #:nodoc:
|
|
22
22
|
r.process { capture(amount, r.authorization, options) }
|
23
23
|
end
|
24
24
|
|
25
|
-
merged_params = multi.responses.map
|
25
|
+
merged_params = multi.responses.map(&:params).reduce({}, :merge)
|
26
26
|
succeeded = success_from(merged_params)
|
27
27
|
|
28
28
|
response(:purchase, succeeded, merged_params)
|
@@ -180,11 +180,11 @@ module ActiveMerchant #:nodoc:
|
|
180
180
|
|
181
181
|
def parse(body)
|
182
182
|
JSON.parse(body)
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
183
|
+
rescue JSON::ParserError
|
184
|
+
{
|
185
|
+
'message' => 'Invalid JSON response received from CheckoutV2Gateway. Please contact CheckoutV2Gateway if you continue to receive this message.',
|
186
|
+
'raw_response' => scrub(body)
|
187
|
+
}
|
188
188
|
end
|
189
189
|
|
190
190
|
def success_from(response)
|
@@ -15,7 +15,7 @@ module ActiveMerchant
|
|
15
15
|
self.homepage_url = 'http://www.citruspay.com/'
|
16
16
|
self.supported_countries = %w(AR AU BR FR DE HK MX NZ SG GB US)
|
17
17
|
self.default_currency = 'USD'
|
18
|
-
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb, :maestro
|
18
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb, :maestro]
|
19
19
|
|
20
20
|
end
|
21
21
|
end
|
@@ -4,7 +4,7 @@ module ActiveMerchant #:nodoc:
|
|
4
4
|
self.live_url = 'https://api.conekta.io/'
|
5
5
|
|
6
6
|
self.supported_countries = ['MX']
|
7
|
-
self.supported_cardtypes = [:visa, :master, :american_express]
|
7
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :carnet]
|
8
8
|
self.homepage_url = 'https://conekta.io/'
|
9
9
|
self.display_name = 'Conekta Gateway'
|
10
10
|
self.money_format = :cents
|
@@ -162,8 +162,8 @@ module ActiveMerchant #:nodoc:
|
|
162
162
|
post[:card][:name] = payment_source.name
|
163
163
|
post[:card][:cvc] = payment_source.verification_value
|
164
164
|
post[:card][:number] = payment_source.number
|
165
|
-
post[:card][:exp_month] =
|
166
|
-
post[:card][:exp_year] =
|
165
|
+
post[:card][:exp_month] = sprintf('%02d', payment_source.month)
|
166
|
+
post[:card][:exp_year] = payment_source.year.to_s[-2, 2]
|
167
167
|
add_address(post[:card], options)
|
168
168
|
end
|
169
169
|
end
|
@@ -211,11 +211,9 @@ module ActiveMerchant #:nodoc:
|
|
211
211
|
end
|
212
212
|
|
213
213
|
def response_error(raw_response)
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
json_error(raw_response)
|
218
|
-
end
|
214
|
+
parse(raw_response)
|
215
|
+
rescue JSON::ParserError
|
216
|
+
json_error(raw_response)
|
219
217
|
end
|
220
218
|
|
221
219
|
def json_error(raw_response)
|
@@ -52,7 +52,7 @@ module ActiveMerchant #:nodoc:
|
|
52
52
|
r.process { capture(money, r.authorization, options) }
|
53
53
|
end
|
54
54
|
|
55
|
-
merged_params = multi_response.responses.map
|
55
|
+
merged_params = multi_response.responses.map(&:params).reduce({}, :merge)
|
56
56
|
|
57
57
|
Response.new(
|
58
58
|
multi_response.primary_response.success?,
|
@@ -214,7 +214,6 @@ module ActiveMerchant #:nodoc:
|
|
214
214
|
end
|
215
215
|
end
|
216
216
|
|
217
|
-
|
218
217
|
response
|
219
218
|
end
|
220
219
|
|
@@ -172,7 +172,7 @@ module ActiveMerchant #:nodoc:
|
|
172
172
|
|
173
173
|
def add_address(post, creditcard, options)
|
174
174
|
if address = options[:billing_address] || options[:address]
|
175
|
-
post[:CardHolderAddress] =
|
175
|
+
post[:CardHolderAddress] = "#{address[:address1]} #{address[:address2]} #{address[:city]} #{address[:state]}".rjust(20, ' ')
|
176
176
|
post[:CardHolderPostalCode] = address[:zip].gsub(/\s+/, '').rjust(9, ' ')
|
177
177
|
end
|
178
178
|
end
|
@@ -243,16 +243,14 @@ module ActiveMerchant #:nodoc:
|
|
243
243
|
end
|
244
244
|
|
245
245
|
def parse(body)
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
}
|
255
|
-
end
|
246
|
+
JSON.parse(body)
|
247
|
+
rescue JSON::ParserError
|
248
|
+
message = 'Invalid JSON response received from CulqiGateway. Please contact CulqiGateway if you continue to receive this message.'
|
249
|
+
message += "(The raw response returned by the API was #{body.inspect})"
|
250
|
+
{
|
251
|
+
'status' => 'N',
|
252
|
+
'statusdescription' => message
|
253
|
+
}
|
256
254
|
end
|
257
255
|
|
258
256
|
def success_from(response)
|
@@ -26,7 +26,7 @@ module ActiveMerchant #:nodoc:
|
|
26
26
|
|
27
27
|
XSD_VERSION = '1.121'
|
28
28
|
|
29
|
-
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb, :
|
29
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb, :dankort, :maestro]
|
30
30
|
self.supported_countries = %w(US BR CA CN DK FI FR DE JP MX NO SE GB SG LB)
|
31
31
|
|
32
32
|
self.default_currency = 'USD'
|
@@ -42,7 +42,6 @@ module ActiveMerchant #:nodoc:
|
|
42
42
|
:discover => '004',
|
43
43
|
:diners_club => '005',
|
44
44
|
:jcb => '007',
|
45
|
-
:switch => '024',
|
46
45
|
:dankort => '034',
|
47
46
|
:maestro => '042'
|
48
47
|
}
|
@@ -6,7 +6,7 @@ module ActiveMerchant
|
|
6
6
|
self.default_currency = 'GBP'
|
7
7
|
self.supported_countries = ['GB']
|
8
8
|
|
9
|
-
self.supported_cardtypes = [ :visa, :master, :american_express, :discover, :diners_club, :jcb, :maestro
|
9
|
+
self.supported_cardtypes = [ :visa, :master, :american_express, :discover, :diners_club, :jcb, :maestro ]
|
10
10
|
|
11
11
|
self.homepage_url = 'http://www.datacash.com/'
|
12
12
|
self.display_name = 'DataCash'
|
@@ -214,23 +214,11 @@ module ActiveMerchant
|
|
214
214
|
end
|
215
215
|
|
216
216
|
def add_credit_card(xml, credit_card, address)
|
217
|
-
|
218
217
|
xml.tag! :Card do
|
219
|
-
|
220
218
|
# DataCash calls the CC number 'pan'
|
221
219
|
xml.tag! :pan, credit_card.number
|
222
220
|
xml.tag! :expirydate, format_date(credit_card.month, credit_card.year)
|
223
221
|
|
224
|
-
# optional values - for Solo etc
|
225
|
-
if [ 'switch', 'solo' ].include?(card_brand(credit_card).to_s)
|
226
|
-
|
227
|
-
xml.tag! :issuenumber, credit_card.issue_number unless credit_card.issue_number.blank?
|
228
|
-
|
229
|
-
if !credit_card.start_month.blank? && !credit_card.start_year.blank?
|
230
|
-
xml.tag! :startdate, format_date(credit_card.start_month, credit_card.start_year)
|
231
|
-
end
|
232
|
-
end
|
233
|
-
|
234
222
|
xml.tag! :Cv2Avs do
|
235
223
|
xml.tag! :cv2, credit_card.verification_value if credit_card.verification_value?
|
236
224
|
if address
|
@@ -249,23 +237,23 @@ module ActiveMerchant
|
|
249
237
|
# a predefined one
|
250
238
|
xml.tag! :ExtendedPolicy do
|
251
239
|
xml.tag! :cv2_policy,
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
240
|
+
:notprovided => POLICY_REJECT,
|
241
|
+
:notchecked => POLICY_REJECT,
|
242
|
+
:matched => POLICY_ACCEPT,
|
243
|
+
:notmatched => POLICY_REJECT,
|
244
|
+
:partialmatch => POLICY_REJECT
|
257
245
|
xml.tag! :postcode_policy,
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
246
|
+
:notprovided => POLICY_ACCEPT,
|
247
|
+
:notchecked => POLICY_ACCEPT,
|
248
|
+
:matched => POLICY_ACCEPT,
|
249
|
+
:notmatched => POLICY_REJECT,
|
250
|
+
:partialmatch => POLICY_ACCEPT
|
263
251
|
xml.tag! :address_policy,
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
252
|
+
:notprovided => POLICY_ACCEPT,
|
253
|
+
:notchecked => POLICY_ACCEPT,
|
254
|
+
:matched => POLICY_ACCEPT,
|
255
|
+
:notmatched => POLICY_REJECT,
|
256
|
+
:partialmatch => POLICY_ACCEPT
|
269
257
|
end
|
270
258
|
end
|
271
259
|
end
|
@@ -285,7 +273,6 @@ module ActiveMerchant
|
|
285
273
|
end
|
286
274
|
|
287
275
|
def parse(body)
|
288
|
-
|
289
276
|
response = {}
|
290
277
|
xml = REXML::Document.new(body)
|
291
278
|
root = REXML::XPath.first(xml, '//Response')
|