activemerchant 1.85.0 → 1.86.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +15 -3
- data/lib/active_merchant/billing/avs_result.rb +12 -12
- data/lib/active_merchant/billing/compatibility.rb +1 -2
- data/lib/active_merchant/billing/gateways/adyen.rb +1 -1
- data/lib/active_merchant/billing/gateways/authorize_net.rb +12 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +1 -2
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +45 -22
- data/lib/active_merchant/billing/gateways/beanstream.rb +2 -2
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +4 -6
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +0 -1
- data/lib/active_merchant/billing/gateways/blue_pay.rb +1 -1
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +6 -4
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +3 -3
- data/lib/active_merchant/billing/gateways/card_connect.rb +6 -6
- data/lib/active_merchant/billing/gateways/card_save.rb +5 -6
- data/lib/active_merchant/billing/gateways/cardprocess.rb +4 -4
- data/lib/active_merchant/billing/gateways/cashnet.rb +4 -4
- data/lib/active_merchant/billing/gateways/cecabank.rb +1 -1
- data/lib/active_merchant/billing/gateways/checkout.rb +8 -8
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +0 -1
- data/lib/active_merchant/billing/gateways/creditcall.rb +3 -3
- data/lib/active_merchant/billing/gateways/credorax.rb +1 -1
- data/lib/active_merchant/billing/gateways/ct_payment.rb +1 -1
- data/lib/active_merchant/billing/gateways/cyber_source.rb +5 -5
- data/lib/active_merchant/billing/gateways/efsnet.rb +9 -9
- data/lib/active_merchant/billing/gateways/elavon.rb +3 -5
- data/lib/active_merchant/billing/gateways/eway_managed.rb +1 -1
- data/lib/active_merchant/billing/gateways/exact.rb +0 -1
- data/lib/active_merchant/billing/gateways/federated_canada.rb +0 -1
- data/lib/active_merchant/billing/gateways/finansbank.rb +0 -1
- data/lib/active_merchant/billing/gateways/first_giving.rb +0 -1
- data/lib/active_merchant/billing/gateways/first_pay.rb +3 -3
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +7 -7
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +6 -6
- data/lib/active_merchant/billing/gateways/garanti.rb +0 -1
- data/lib/active_merchant/billing/gateways/global_collect.rb +21 -6
- data/lib/active_merchant/billing/gateways/hdfc.rb +0 -1
- data/lib/active_merchant/billing/gateways/hps.rb +1 -1
- data/lib/active_merchant/billing/gateways/inspire.rb +0 -1
- data/lib/active_merchant/billing/gateways/instapay.rb +1 -2
- data/lib/active_merchant/billing/gateways/itransact.rb +0 -1
- data/lib/active_merchant/billing/gateways/jetpay.rb +1 -1
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +1 -1
- data/lib/active_merchant/billing/gateways/linkpoint.rb +3 -3
- data/lib/active_merchant/billing/gateways/litle.rb +1 -1
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +7 -1
- data/lib/active_merchant/billing/gateways/merchant_one.rb +0 -1
- data/lib/active_merchant/billing/gateways/mercury.rb +1 -1
- data/lib/active_merchant/billing/gateways/migs.rb +5 -5
- data/lib/active_merchant/billing/gateways/modern_payments.rb +0 -1
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +0 -1
- data/lib/active_merchant/billing/gateways/money_movers.rb +0 -1
- data/lib/active_merchant/billing/gateways/mundipagg.rb +4 -4
- data/lib/active_merchant/billing/gateways/nab_transact.rb +8 -8
- data/lib/active_merchant/billing/gateways/net_registry.rb +1 -1
- data/lib/active_merchant/billing/gateways/netaxept.rb +0 -1
- data/lib/active_merchant/billing/gateways/netbanx.rb +4 -3
- data/lib/active_merchant/billing/gateways/netpay.rb +0 -1
- data/lib/active_merchant/billing/gateways/network_merchants.rb +0 -1
- data/lib/active_merchant/billing/gateways/omise.rb +1 -1
- data/lib/active_merchant/billing/gateways/opp.rb +0 -1
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +20 -20
- data/lib/active_merchant/billing/gateways/orbital.rb +1 -1
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +0 -1
- data/lib/active_merchant/billing/gateways/pagarme.rb +1 -1
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +1 -1
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +1 -1
- data/lib/active_merchant/billing/gateways/pay_secure.rb +0 -1
- data/lib/active_merchant/billing/gateways/payeezy.rb +1 -1
- data/lib/active_merchant/billing/gateways/payex.rb +2 -3
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +5 -1
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +2 -2
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +0 -1
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +0 -1
- data/lib/active_merchant/billing/gateways/payment_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/paymentez.rb +4 -4
- data/lib/active_merchant/billing/gateways/payscout.rb +1 -2
- data/lib/active_merchant/billing/gateways/psigate.rb +1 -1
- data/lib/active_merchant/billing/gateways/psl_card.rb +6 -6
- data/lib/active_merchant/billing/gateways/quickbooks.rb +2 -2
- data/lib/active_merchant/billing/gateways/quickpay.rb +0 -1
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +7 -8
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -2
- data/lib/active_merchant/billing/gateways/s5.rb +1 -1
- data/lib/active_merchant/billing/gateways/sage_pay.rb +5 -5
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +0 -1
- data/lib/active_merchant/billing/gateways/secure_pay.rb +0 -1
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +0 -1
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +0 -1
- data/lib/active_merchant/billing/gateways/securion_pay.rb +5 -5
- data/lib/active_merchant/billing/gateways/smart_ps.rb +0 -1
- data/lib/active_merchant/billing/gateways/stripe.rb +1 -1
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +4 -8
- data/lib/active_merchant/billing/gateways/telr.rb +2 -2
- data/lib/active_merchant/billing/gateways/transax.rb +4 -5
- data/lib/active_merchant/billing/gateways/transnational.rb +0 -1
- data/lib/active_merchant/billing/gateways/trexle.rb +6 -6
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +5 -5
- data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -1
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +1 -1
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +3 -2
- data/lib/active_merchant/billing/gateways/world_net.rb +3 -3
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +15 -15
- data/lib/active_merchant/connection.rb +2 -2
- data/lib/active_merchant/network_connection_retries.rb +1 -1
- data/lib/active_merchant/posts_data.rb +2 -2
- data/lib/active_merchant/version.rb +1 -1
- data/lib/activemerchant.rb +1 -1
- data/lib/support/gateway_support.rb +0 -1
- metadata +2 -2
@@ -1,23 +1,22 @@
|
|
1
1
|
module ActiveMerchant #:nodoc:
|
2
2
|
module Billing #:nodoc:
|
3
3
|
class CardSaveGateway < IridiumGateway
|
4
|
-
#CardSave lets you handle failovers on payments by providing 3 gateways in case one happens to be down
|
5
|
-
#URLS = ['https://gw1.cardsaveonlinepayments.com:4430/','https://gw2.cardsaveonlinepayments.com:4430/','https://gw3.cardsaveonlinepayments.com:4430/']
|
6
|
-
|
4
|
+
# CardSave lets you handle failovers on payments by providing 3 gateways in case one happens to be down
|
5
|
+
# URLS = ['https://gw1.cardsaveonlinepayments.com:4430/','https://gw2.cardsaveonlinepayments.com:4430/','https://gw3.cardsaveonlinepayments.com:4430/']
|
6
|
+
|
7
7
|
self.money_format = :cents
|
8
8
|
self.default_currency = 'GBP'
|
9
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'
|
13
|
-
|
13
|
+
|
14
14
|
def initialize(options={})
|
15
15
|
super
|
16
16
|
@test_url = 'https://gw1.cardsaveonlinepayments.com:4430/'
|
17
17
|
@live_url = 'https://gw1.cardsaveonlinepayments.com:4430/'
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
@@ -99,10 +99,10 @@ module ActiveMerchant #:nodoc:
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def scrub(transcript)
|
102
|
-
transcript
|
103
|
-
|
104
|
-
|
105
|
-
|
102
|
+
transcript.
|
103
|
+
gsub(%r{(authentication\.[^=]+=)[^&]+}, '\1[FILTERED]').
|
104
|
+
gsub(%r{(card\.number=)\d+}, '\1[FILTERED]').
|
105
|
+
gsub(%r{(cvv=)\d{3,4}}, '\1[FILTERED]\2')
|
106
106
|
end
|
107
107
|
|
108
108
|
private
|
@@ -60,10 +60,10 @@ module ActiveMerchant #:nodoc:
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def scrub(transcript)
|
63
|
-
transcript
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
transcript.
|
64
|
+
gsub(%r{(password=)[^&]+}, '\1[FILTERED]').
|
65
|
+
gsub(%r{(cardno=)[^&]+}, '\1[FILTERED]').
|
66
|
+
gsub(%r{(cid=)[^&]+}, '\1[FILTERED]')
|
67
67
|
end
|
68
68
|
|
69
69
|
private
|
@@ -19,7 +19,7 @@ module ActiveMerchant #:nodoc:
|
|
19
19
|
CECA_UI_LESS_LANGUAGE = 'XML'
|
20
20
|
CECA_UI_LESS_LANGUAGE_REFUND = '1'
|
21
21
|
CECA_UI_LESS_REFUND_PAGE = 'anulacion_xml'
|
22
|
-
CECA_ACTION_REFUND = 'tpvanularparcialmente' #use partial refund's URL to avoid time frame limitations and decision logic on client side
|
22
|
+
CECA_ACTION_REFUND = 'tpvanularparcialmente' # use partial refund's URL to avoid time frame limitations and decision logic on client side
|
23
23
|
CECA_ACTION_PURCHASE = 'tpv'
|
24
24
|
CECA_CURRENCIES_DICTIONARY = {'EUR' => 978, 'USD' => 840, 'GBP' => 826}
|
25
25
|
|
@@ -125,13 +125,13 @@ module ActiveMerchant #:nodoc:
|
|
125
125
|
|
126
126
|
def add_shipping_info(xml, options)
|
127
127
|
if options[:shipping_address]
|
128
|
-
xml.ship_address_
|
129
|
-
xml.ship_address2_
|
130
|
-
xml.ship_city_
|
131
|
-
xml.ship_state_
|
132
|
-
xml.ship_postal_
|
133
|
-
xml.ship_country_
|
134
|
-
xml.ship_phone_
|
128
|
+
xml.ship_address_ options[:shipping_address][:address1]
|
129
|
+
xml.ship_address2_ options[:shipping_address][:address2]
|
130
|
+
xml.ship_city_ options[:shipping_address][:city]
|
131
|
+
xml.ship_state_ options[:shipping_address][:state]
|
132
|
+
xml.ship_postal_ options[:shipping_address][:zip]
|
133
|
+
xml.ship_country_ options[:shipping_address][:country]
|
134
|
+
xml.ship_phone_ options[:shipping_address][:phone]
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
@@ -144,7 +144,7 @@ module ActiveMerchant #:nodoc:
|
|
144
144
|
end
|
145
145
|
|
146
146
|
def add_other_fields(xml, options)
|
147
|
-
xml.bill_email_
|
147
|
+
xml.bill_email_ options[:email]
|
148
148
|
xml.bill_customerip_ options[:ip]
|
149
149
|
xml.merchantcustomerid_ options[:customer]
|
150
150
|
xml.descriptor_name options[:descriptor_name]
|
@@ -14,14 +14,14 @@ module ActiveMerchant #:nodoc:
|
|
14
14
|
|
15
15
|
self.homepage_url = 'https://www.creditcall.com'
|
16
16
|
self.display_name = 'Creditcall'
|
17
|
-
|
17
|
+
|
18
18
|
CVV_CODE = {
|
19
19
|
'matched' => 'M',
|
20
20
|
'notmatched' => 'N',
|
21
21
|
'notchecked' => 'P',
|
22
22
|
'partialmatch' => 'N'
|
23
23
|
}
|
24
|
-
|
24
|
+
|
25
25
|
AVS_CODE = {
|
26
26
|
'matched;matched' => 'D',
|
27
27
|
'matched;notchecked' =>'B',
|
@@ -53,7 +53,7 @@ module ActiveMerchant #:nodoc:
|
|
53
53
|
end
|
54
54
|
|
55
55
|
merged_params = multi_response.responses.map(&:params).reduce({}, :merge)
|
56
|
-
|
56
|
+
|
57
57
|
Response.new(
|
58
58
|
multi_response.primary_response.success?,
|
59
59
|
multi_response.primary_response.message,
|
@@ -242,7 +242,7 @@ module ActiveMerchant #:nodoc:
|
|
242
242
|
end
|
243
243
|
|
244
244
|
def message_from(response)
|
245
|
-
response['errorDescription'] ||
|
245
|
+
response['errorDescription'] || response['terminalDisp']&.strip
|
246
246
|
end
|
247
247
|
|
248
248
|
def authorization_from(response)
|
@@ -48,7 +48,7 @@ module ActiveMerchant #:nodoc:
|
|
48
48
|
|
49
49
|
@@response_codes = {
|
50
50
|
:r100 => 'Successful transaction',
|
51
|
-
:r101 => 'Request is missing one or more required fields'
|
51
|
+
:r101 => 'Request is missing one or more required fields',
|
52
52
|
:r102 => 'One or more fields contains invalid data',
|
53
53
|
:r150 => 'General failure',
|
54
54
|
:r151 => 'The request was received but a server time-out occurred',
|
@@ -432,9 +432,9 @@ module ActiveMerchant #:nodoc:
|
|
432
432
|
def add_merchant_data(xml, options)
|
433
433
|
xml.tag! 'merchantID', @options[:login]
|
434
434
|
xml.tag! 'merchantReferenceCode', options[:order_id] || generate_unique_id
|
435
|
-
xml.tag! 'clientLibrary'
|
435
|
+
xml.tag! 'clientLibrary','Ruby Active Merchant'
|
436
436
|
xml.tag! 'clientLibraryVersion', VERSION
|
437
|
-
xml.tag! 'clientEnvironment'
|
437
|
+
xml.tag! 'clientEnvironment', RUBY_PLATFORM
|
438
438
|
end
|
439
439
|
|
440
440
|
def add_purchase_data(xml, money = 0, include_grand_total = false, options={})
|
@@ -663,7 +663,7 @@ module ActiveMerchant #:nodoc:
|
|
663
663
|
end
|
664
664
|
|
665
665
|
def add_validate_pinless_debit_service(xml)
|
666
|
-
xml.tag!'pinlessDebitValidateService', {'run' => 'true'}
|
666
|
+
xml.tag! 'pinlessDebitValidateService', {'run' => 'true'}
|
667
667
|
end
|
668
668
|
|
669
669
|
def add_threeds_services(xml, options)
|
@@ -677,7 +677,7 @@ module ActiveMerchant #:nodoc:
|
|
677
677
|
|
678
678
|
def lookup_country_code(country_field)
|
679
679
|
country_code = Country.find(country_field) rescue nil
|
680
|
-
country_code
|
680
|
+
country_code&.code(:alpha2)
|
681
681
|
end
|
682
682
|
|
683
683
|
# Where we actually build the full SOAP request using builder
|
@@ -200,15 +200,15 @@ module ActiveMerchant #:nodoc:
|
|
200
200
|
CREDIT_CARD_FIELDS = %w(AuthorizationNumber ClientIpAddress BillingAddress BillingCity BillingState BillingPostalCode BillingCountry BillingName CardVerificationValue ExpirationMonth ExpirationYear ReferenceNumber TransactionAmount AccountNumber )
|
201
201
|
|
202
202
|
ACTIONS = {
|
203
|
-
:credit_card_authorize
|
204
|
-
:credit_card_charge
|
205
|
-
:credit_card_voice_authorize
|
206
|
-
:credit_card_capture
|
207
|
-
:credit_card_credit
|
208
|
-
:credit_card_refund
|
209
|
-
:void_transaction
|
210
|
-
:credit_card_settle
|
211
|
-
:system_check
|
203
|
+
:credit_card_authorize => CREDIT_CARD_FIELDS,
|
204
|
+
:credit_card_charge => CREDIT_CARD_FIELDS,
|
205
|
+
:credit_card_voice_authorize => CREDIT_CARD_FIELDS,
|
206
|
+
:credit_card_capture => CREDIT_CARD_FIELDS,
|
207
|
+
:credit_card_credit => CREDIT_CARD_FIELDS + ['OriginalTransactionAmount'],
|
208
|
+
:credit_card_refund => %w(ReferenceNumber TransactionAmount OriginalTransactionAmount OriginalTransactionID ClientIpAddress),
|
209
|
+
:void_transaction => %w(ReferenceNumber TransactionID),
|
210
|
+
:credit_card_settle => %w(ReferenceNumber TransactionAmount OriginalTransactionAmount OriginalTransactionID ClientIpAddress),
|
211
|
+
:system_check => %w(SystemCheck),
|
212
212
|
}
|
213
213
|
end
|
214
214
|
end
|
@@ -191,10 +191,8 @@ module ActiveMerchant #:nodoc:
|
|
191
191
|
form[:email] = truncate(options[:email], 100) unless empty?(options[:email])
|
192
192
|
form[:customer_code] = truncate(options[:customer], 10) unless empty?(options[:customer])
|
193
193
|
form[:customer_number] = options[:customer_number] unless empty?(options[:customer_number])
|
194
|
-
|
195
|
-
|
196
|
-
form[key.to_s] = value
|
197
|
-
end
|
194
|
+
options[:custom_fields]&.each do |key, value|
|
195
|
+
form[key.to_s] = value
|
198
196
|
end
|
199
197
|
end
|
200
198
|
|
@@ -283,7 +281,7 @@ module ActiveMerchant #:nodoc:
|
|
283
281
|
end
|
284
282
|
|
285
283
|
def custom_field?(field_name, options)
|
286
|
-
return true if options[:custom_fields]
|
284
|
+
return true if options[:custom_fields]&.include?(field_name.to_sym)
|
287
285
|
field_name == :customer_number
|
288
286
|
end
|
289
287
|
|
@@ -119,9 +119,9 @@ module ActiveMerchant #:nodoc:
|
|
119
119
|
response = {}
|
120
120
|
|
121
121
|
doc = Nokogiri::XML(xml)
|
122
|
-
doc.root
|
122
|
+
doc.root&.xpath('//RESPONSE/FIELDS/FIELD')&.each do |field|
|
123
123
|
response[field['KEY']] = field.text
|
124
|
-
end
|
124
|
+
end
|
125
125
|
|
126
126
|
response
|
127
127
|
end
|
@@ -149,7 +149,7 @@ module ActiveMerchant #:nodoc:
|
|
149
149
|
def message_from(response)
|
150
150
|
# Silly inconsistent gateway. Always make capitalized (but not all caps)
|
151
151
|
msg = (response['auth_response'] || response['response1'])
|
152
|
-
msg
|
152
|
+
msg&.downcase&.capitalize
|
153
153
|
end
|
154
154
|
|
155
155
|
def error_code_from(response)
|
@@ -141,12 +141,12 @@ module ActiveMerchant #:nodoc:
|
|
141
141
|
end
|
142
142
|
|
143
143
|
def scrub(transcript)
|
144
|
-
transcript
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
144
|
+
transcript.
|
145
|
+
gsub(%r((<Card_Number>).+(</Card_Number>)), '\1[FILTERED]\2').
|
146
|
+
gsub(%r((<VerificationStr2>).+(</VerificationStr2>)), '\1[FILTERED]\2').
|
147
|
+
gsub(%r((<Password>).+(</Password>))i, '\1[FILTERED]\2').
|
148
|
+
gsub(%r((<CAVV>).+(</CAVV>)), '\1[FILTERED]\2').
|
149
|
+
gsub(%r((Card Number : ).*\d)i, '\1[FILTERED]')
|
150
150
|
end
|
151
151
|
|
152
152
|
def supports_network_tokenization?
|
@@ -394,7 +394,7 @@ module ActiveMerchant #:nodoc:
|
|
394
394
|
credit_card.last_name,
|
395
395
|
credit_card.month,
|
396
396
|
credit_card.year
|
397
|
-
|
397
|
+
].map { |value| value.to_s.gsub(/;/, '') }.join(';')
|
398
398
|
else
|
399
399
|
raise StandardError, "TransArmor support is not enabled on your #{display_name} account"
|
400
400
|
end
|
@@ -112,12 +112,12 @@ module ActiveMerchant #:nodoc:
|
|
112
112
|
end
|
113
113
|
|
114
114
|
def scrub(transcript)
|
115
|
-
transcript
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
115
|
+
transcript.
|
116
|
+
gsub(%r((<Card_Number>).+(</Card_Number>)), '\1[FILTERED]\2').
|
117
|
+
gsub(%r((<CVDCode>).+(</CVDCode>)), '\1[FILTERED]\2').
|
118
|
+
gsub(%r((<Password>).+(</Password>))i, '\1[FILTERED]\2').
|
119
|
+
gsub(%r((<CAVV>).+(</CAVV>)), '\1[FILTERED]\2').
|
120
|
+
gsub(%r((CARD NUMBER\s+: )#+\d+), '\1[FILTERED]')
|
121
121
|
end
|
122
122
|
|
123
123
|
def supports_network_tokenization?
|
@@ -72,8 +72,8 @@ module ActiveMerchant #:nodoc:
|
|
72
72
|
def scrub(transcript)
|
73
73
|
transcript.
|
74
74
|
gsub(%r((Authorization: )[^\\]*)i, '\1[FILTERED]').
|
75
|
-
gsub(%r(("cardNumber
|
76
|
-
gsub(%r(("cvv
|
75
|
+
gsub(%r(("cardNumber\\+":\\+")\d+), '\1[FILTERED]').
|
76
|
+
gsub(%r(("cvv\\+":\\+")\d+), '\1[FILTERED]')
|
77
77
|
end
|
78
78
|
|
79
79
|
private
|
@@ -230,11 +230,14 @@ module ActiveMerchant #:nodoc:
|
|
230
230
|
|
231
231
|
def commit(action, post, authorization = nil)
|
232
232
|
begin
|
233
|
-
|
233
|
+
raw_response = ssl_post(url(action, authorization), post.to_json, headers(action, post, authorization))
|
234
|
+
response = parse(raw_response)
|
234
235
|
rescue ResponseError => e
|
235
236
|
if e.response.code.to_i >= 400
|
236
237
|
response = parse(e.response.body)
|
237
238
|
end
|
239
|
+
rescue JSON::ParserError
|
240
|
+
response = json_error(raw_response)
|
238
241
|
end
|
239
242
|
|
240
243
|
succeeded = success_from(response)
|
@@ -248,6 +251,14 @@ module ActiveMerchant #:nodoc:
|
|
248
251
|
)
|
249
252
|
end
|
250
253
|
|
254
|
+
def json_error(raw_response)
|
255
|
+
{
|
256
|
+
'error_message' => 'Invalid response received from the Ingenico ePayments (formerly GlobalCollect) API. Please contact Ingenico ePayments if you continue to receive this message.' \
|
257
|
+
" (The raw response returned by the API was #{raw_response.inspect})",
|
258
|
+
'status' => 'REJECTED'
|
259
|
+
}
|
260
|
+
end
|
261
|
+
|
251
262
|
def headers(action, post, authorization = nil)
|
252
263
|
{
|
253
264
|
'Content-Type' => content_type,
|
@@ -286,8 +297,10 @@ EOS
|
|
286
297
|
else
|
287
298
|
if errors = response['errors']
|
288
299
|
errors.first.try(:[], 'message')
|
289
|
-
elsif
|
290
|
-
'
|
300
|
+
elsif response['error_message']
|
301
|
+
response['error_message']
|
302
|
+
elsif response['status']
|
303
|
+
'Status: ' + response['status']
|
291
304
|
else
|
292
305
|
'No message available'
|
293
306
|
end
|
@@ -297,8 +310,10 @@ EOS
|
|
297
310
|
def authorization_from(succeeded, response)
|
298
311
|
if succeeded
|
299
312
|
response['id'] || response['payment']['id'] || response['paymentResult']['payment']['id']
|
300
|
-
|
313
|
+
elsif response['errorId']
|
301
314
|
response['errorId']
|
315
|
+
else
|
316
|
+
'GATEWAY ERROR'
|
302
317
|
end
|
303
318
|
end
|
304
319
|
|
@@ -140,7 +140,7 @@ module ActiveMerchant #:nodoc:
|
|
140
140
|
data = ssl_post self.live_url, post_data(action, parameters)
|
141
141
|
response = parse(data)
|
142
142
|
|
143
|
-
Response.new(response[:success]
|
143
|
+
Response.new(response[:success], response[:message], response,
|
144
144
|
:authorization => response[:transaction_id],
|
145
145
|
:avs_result => { :code => response[:avs_result] },
|
146
146
|
:cvv_result => response[:cvv_result]
|
@@ -160,4 +160,3 @@ module ActiveMerchant #:nodoc:
|
|
160
160
|
end
|
161
161
|
end
|
162
162
|
end
|
163
|
-
|