activemerchant 1.105.0 → 1.107.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +99 -1
- data/README.md +2 -2
- data/lib/active_merchant/billing/credit_card_methods.rb +12 -3
- data/lib/active_merchant/billing/gateway.rb +22 -22
- data/lib/active_merchant/billing/gateways/adyen.rb +18 -7
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +2 -2
- data/lib/active_merchant/billing/gateways/authorize_net.rb +19 -19
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +11 -11
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +35 -35
- data/lib/active_merchant/billing/gateways/axcessms.rb +3 -3
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +1 -1
- data/lib/active_merchant/billing/gateways/bank_frick.rb +1 -1
- data/lib/active_merchant/billing/gateways/banwire.rb +2 -2
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +5 -5
- data/lib/active_merchant/billing/gateways/be2bill.rb +4 -4
- data/lib/active_merchant/billing/gateways/beanstream.rb +1 -1
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +27 -27
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -1
- data/lib/active_merchant/billing/gateways/blue_pay.rb +8 -8
- data/lib/active_merchant/billing/gateways/blue_snap.rb +5 -2
- data/lib/active_merchant/billing/gateways/bogus.rb +20 -20
- data/lib/active_merchant/billing/gateways/borgun.rb +17 -6
- data/lib/active_merchant/billing/gateways/bpoint.rb +1 -1
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +81 -77
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +3 -3
- data/lib/active_merchant/billing/gateways/card_connect.rb +1 -1
- data/lib/active_merchant/billing/gateways/card_stream.rb +19 -19
- data/lib/active_merchant/billing/gateways/cc5.rb +7 -7
- data/lib/active_merchant/billing/gateways/cecabank.rb +3 -3
- data/lib/active_merchant/billing/gateways/cenpos.rb +3 -3
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +20 -9
- data/lib/active_merchant/billing/gateways/clearhaus.rb +1 -1
- data/lib/active_merchant/billing/gateways/commercegate.rb +2 -2
- data/lib/active_merchant/billing/gateways/conekta.rb +1 -1
- data/lib/active_merchant/billing/gateways/creditcall.rb +4 -4
- data/lib/active_merchant/billing/gateways/ct_payment.rb +1 -1
- data/lib/active_merchant/billing/gateways/culqi.rb +2 -2
- data/lib/active_merchant/billing/gateways/cyber_source.rb +154 -91
- data/lib/active_merchant/billing/gateways/d_local.rb +4 -2
- data/lib/active_merchant/billing/gateways/data_cash.rb +33 -33
- data/lib/active_merchant/billing/gateways/decidir.rb +7 -2
- data/lib/active_merchant/billing/gateways/ebanx.rb +14 -2
- data/lib/active_merchant/billing/gateways/efsnet.rb +23 -23
- data/lib/active_merchant/billing/gateways/elavon.rb +70 -18
- data/lib/active_merchant/billing/gateways/element.rb +12 -4
- data/lib/active_merchant/billing/gateways/epay.rb +40 -40
- data/lib/active_merchant/billing/gateways/evo_ca.rb +11 -11
- data/lib/active_merchant/billing/gateways/eway.rb +3 -3
- data/lib/active_merchant/billing/gateways/eway_managed.rb +40 -40
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +7 -7
- data/lib/active_merchant/billing/gateways/exact.rb +11 -11
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +3 -2
- data/lib/active_merchant/billing/gateways/federated_canada.rb +5 -5
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +21 -21
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +20 -20
- data/lib/active_merchant/billing/gateways/flo2cash.rb +4 -4
- data/lib/active_merchant/billing/gateways/forte.rb +8 -7
- data/lib/active_merchant/billing/gateways/garanti.rb +8 -8
- data/lib/active_merchant/billing/gateways/global_collect.rb +30 -24
- data/lib/active_merchant/billing/gateways/hdfc.rb +3 -3
- data/lib/active_merchant/billing/gateways/hps.rb +5 -3
- data/lib/active_merchant/billing/gateways/iats_payments.rb +32 -15
- data/lib/active_merchant/billing/gateways/inspire.rb +7 -7
- data/lib/active_merchant/billing/gateways/instapay.rb +3 -3
- data/lib/active_merchant/billing/gateways/ipp.rb +1 -1
- data/lib/active_merchant/billing/gateways/iridium.rb +12 -10
- data/lib/active_merchant/billing/gateways/itransact.rb +7 -7
- data/lib/active_merchant/billing/gateways/iveri.rb +6 -3
- data/lib/active_merchant/billing/gateways/ixopay.rb +22 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +4 -4
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +5 -5
- data/lib/active_merchant/billing/gateways/kushki.rb +34 -5
- data/lib/active_merchant/billing/gateways/latitude19.rb +2 -2
- data/lib/active_merchant/billing/gateways/linkpoint.rb +62 -62
- data/lib/active_merchant/billing/gateways/litle.rb +8 -3
- data/lib/active_merchant/billing/gateways/mastercard.rb +2 -2
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +1 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +5 -5
- data/lib/active_merchant/billing/gateways/merchant_one.rb +2 -2
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +4 -4
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +12 -12
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +11 -11
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +12 -2
- data/lib/active_merchant/billing/gateways/mercury.rb +9 -9
- data/lib/active_merchant/billing/gateways/metrics_global.rb +15 -15
- data/lib/active_merchant/billing/gateways/migs.rb +13 -13
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +7 -7
- data/lib/active_merchant/billing/gateways/monei.rb +19 -19
- data/lib/active_merchant/billing/gateways/moneris.rb +10 -10
- data/lib/active_merchant/billing/gateways/money_movers.rb +5 -5
- data/lib/active_merchant/billing/gateways/mundipagg.rb +1 -1
- data/lib/active_merchant/billing/gateways/nab_transact.rb +15 -15
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +1 -1
- data/lib/active_merchant/billing/gateways/net_registry.rb +6 -6
- data/lib/active_merchant/billing/gateways/netaxept.rb +4 -4
- data/lib/active_merchant/billing/gateways/netbanx.rb +14 -14
- data/lib/active_merchant/billing/gateways/netbilling.rb +12 -12
- data/lib/active_merchant/billing/gateways/netpay.rb +2 -2
- data/lib/active_merchant/billing/gateways/network_merchants.rb +5 -5
- data/lib/active_merchant/billing/gateways/ogone.rb +7 -7
- data/lib/active_merchant/billing/gateways/openpay.rb +2 -2
- data/lib/active_merchant/billing/gateways/opp.rb +13 -7
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +13 -9
- data/lib/active_merchant/billing/gateways/orbital.rb +54 -12
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +7 -7
- data/lib/active_merchant/billing/gateways/pay_conex.rb +2 -2
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +16 -16
- data/lib/active_merchant/billing/gateways/pay_junction.rb +16 -16
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +18 -2
- data/lib/active_merchant/billing/gateways/pay_secure.rb +6 -6
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +36 -36
- data/lib/active_merchant/billing/gateways/payflow.rb +7 -7
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +12 -12
- data/lib/active_merchant/billing/gateways/payflow_express.rb +4 -4
- data/lib/active_merchant/billing/gateways/payment_express.rb +9 -9
- data/lib/active_merchant/billing/gateways/paymill.rb +3 -3
- data/lib/active_merchant/billing/gateways/paypal.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +5 -5
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
- data/lib/active_merchant/billing/gateways/payscout.rb +5 -5
- data/lib/active_merchant/billing/gateways/paystation.rb +2 -2
- data/lib/active_merchant/billing/gateways/payu_latam.rb +3 -3
- data/lib/active_merchant/billing/gateways/payway.rb +12 -12
- data/lib/active_merchant/billing/gateways/pin.rb +16 -16
- data/lib/active_merchant/billing/gateways/plugnpay.rb +10 -10
- data/lib/active_merchant/billing/gateways/psigate.rb +26 -26
- data/lib/active_merchant/billing/gateways/psl_card.rb +4 -4
- data/lib/active_merchant/billing/gateways/qbms.rb +23 -23
- data/lib/active_merchant/billing/gateways/quantum.rb +4 -4
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +95 -95
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +9 -9
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +2 -2
- data/lib/active_merchant/billing/gateways/qvalent.rb +1 -1
- data/lib/active_merchant/billing/gateways/realex.rb +17 -10
- data/lib/active_merchant/billing/gateways/redsys.rb +24 -16
- data/lib/active_merchant/billing/gateways/safe_charge.rb +1 -1
- data/lib/active_merchant/billing/gateways/sage.rb +10 -10
- data/lib/active_merchant/billing/gateways/sage_pay.rb +35 -35
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +2 -2
- data/lib/active_merchant/billing/gateways/secure_net.rb +9 -9
- data/lib/active_merchant/billing/gateways/secure_pay.rb +13 -13
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +16 -16
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +2 -2
- data/lib/active_merchant/billing/gateways/skip_jack.rb +8 -8
- data/lib/active_merchant/billing/gateways/smart_ps.rb +16 -16
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +6 -6
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +4 -4
- data/lib/active_merchant/billing/gateways/stripe.rb +15 -10
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +50 -9
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +2 -2
- data/lib/active_merchant/billing/gateways/trans_first.rb +4 -4
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +19 -19
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +110 -110
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +29 -29
- data/lib/active_merchant/billing/gateways/verifi.rb +10 -10
- data/lib/active_merchant/billing/gateways/viaklix.rb +6 -6
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +6 -6
- data/lib/active_merchant/billing/gateways/webpay.rb +2 -2
- data/lib/active_merchant/billing/gateways/wirecard.rb +6 -6
- data/lib/active_merchant/billing/gateways/worldpay.rb +22 -20
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +32 -32
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +2 -2
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +1 -1
- data/lib/active_merchant/connection.rb +1 -1
- data/lib/active_merchant/network_connection_retries.rb +3 -3
- data/lib/active_merchant/post_data.rb +1 -1
- data/lib/active_merchant/version.rb +1 -1
- data/lib/certs/cacert.pem +75 -0
- data/lib/support/ssl_verify.rb +2 -2
- data/lib/support/ssl_version.rb +2 -2
- metadata +4 -4
- data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -352
@@ -93,8 +93,10 @@ module ActiveMerchant #:nodoc:
|
|
93
93
|
post[:country] = lookup_country_code(address[:country])
|
94
94
|
end
|
95
95
|
|
96
|
-
def lookup_country_code(
|
97
|
-
Country.find(
|
96
|
+
def lookup_country_code(country_field)
|
97
|
+
Country.find(country_field).code(:alpha2).value
|
98
|
+
rescue InvalidCountryCodeError
|
99
|
+
nil
|
98
100
|
end
|
99
101
|
|
100
102
|
def add_payer(post, card, options)
|
@@ -92,9 +92,9 @@ module ActiveMerchant
|
|
92
92
|
|
93
93
|
def build_void_or_capture_request(type, money, authorization, options)
|
94
94
|
parsed_authorization = parse_authorization_string(authorization)
|
95
|
-
xml = Builder::XmlMarkup.new :
|
95
|
+
xml = Builder::XmlMarkup.new indent: 2
|
96
96
|
xml.instruct!
|
97
|
-
xml.tag! :Request, :
|
97
|
+
xml.tag! :Request, version: '2' do
|
98
98
|
add_authentication(xml)
|
99
99
|
|
100
100
|
xml.tag! :Transaction do
|
@@ -107,7 +107,7 @@ module ActiveMerchant
|
|
107
107
|
if money
|
108
108
|
xml.tag! :TxnDetails do
|
109
109
|
xml.tag! :merchantreference, format_reference_number(options[:order_id])
|
110
|
-
xml.tag! :amount, amount(money), :
|
110
|
+
xml.tag! :amount, amount(money), currency: options[:currency] || currency(money)
|
111
111
|
xml.tag! :capturemethod, 'ecomm'
|
112
112
|
end
|
113
113
|
end
|
@@ -117,20 +117,20 @@ module ActiveMerchant
|
|
117
117
|
end
|
118
118
|
|
119
119
|
def build_purchase_or_authorization_request_with_credit_card_request(type, money, credit_card, options)
|
120
|
-
xml = Builder::XmlMarkup.new :
|
120
|
+
xml = Builder::XmlMarkup.new indent: 2
|
121
121
|
xml.instruct!
|
122
|
-
xml.tag! :Request, :
|
122
|
+
xml.tag! :Request, version: '2' do
|
123
123
|
add_authentication(xml)
|
124
124
|
|
125
125
|
xml.tag! :Transaction do
|
126
|
-
xml.tag! :ContAuthTxn, :
|
126
|
+
xml.tag! :ContAuthTxn, type: 'setup' if options[:set_up_continuous_authority]
|
127
127
|
xml.tag! :CardTxn do
|
128
128
|
xml.tag! :method, type
|
129
129
|
add_credit_card(xml, credit_card, options[:billing_address])
|
130
130
|
end
|
131
131
|
xml.tag! :TxnDetails do
|
132
132
|
xml.tag! :merchantreference, format_reference_number(options[:order_id])
|
133
|
-
xml.tag! :amount, amount(money), :
|
133
|
+
xml.tag! :amount, amount(money), currency: options[:currency] || currency(money)
|
134
134
|
xml.tag! :capturemethod, 'ecomm'
|
135
135
|
end
|
136
136
|
end
|
@@ -142,19 +142,19 @@ module ActiveMerchant
|
|
142
142
|
parsed_authorization = parse_authorization_string(authorization)
|
143
143
|
raise ArgumentError, 'The continuous authority reference is required for continuous authority transactions' if parsed_authorization[:ca_reference].blank?
|
144
144
|
|
145
|
-
xml = Builder::XmlMarkup.new :
|
145
|
+
xml = Builder::XmlMarkup.new indent: 2
|
146
146
|
xml.instruct!
|
147
|
-
xml.tag! :Request, :
|
147
|
+
xml.tag! :Request, version: '2' do
|
148
148
|
add_authentication(xml)
|
149
149
|
xml.tag! :Transaction do
|
150
|
-
xml.tag! :ContAuthTxn, :
|
150
|
+
xml.tag! :ContAuthTxn, type: 'historic'
|
151
151
|
xml.tag! :HistoricTxn do
|
152
152
|
xml.tag! :reference, parsed_authorization[:ca_reference]
|
153
153
|
xml.tag! :method, type
|
154
154
|
end
|
155
155
|
xml.tag! :TxnDetails do
|
156
156
|
xml.tag! :merchantreference, format_reference_number(options[:order_id])
|
157
|
-
xml.tag! :amount, amount(money), :
|
157
|
+
xml.tag! :amount, amount(money), currency: options[:currency] || currency(money)
|
158
158
|
xml.tag! :capturemethod, 'cont_auth'
|
159
159
|
end
|
160
160
|
end
|
@@ -164,9 +164,9 @@ module ActiveMerchant
|
|
164
164
|
|
165
165
|
def build_transaction_refund_request(money, authorization)
|
166
166
|
parsed_authorization = parse_authorization_string(authorization)
|
167
|
-
xml = Builder::XmlMarkup.new :
|
167
|
+
xml = Builder::XmlMarkup.new indent: 2
|
168
168
|
xml.instruct!
|
169
|
-
xml.tag! :Request, :
|
169
|
+
xml.tag! :Request, version: '2' do
|
170
170
|
add_authentication(xml)
|
171
171
|
xml.tag! :Transaction do
|
172
172
|
xml.tag! :HistoricTxn do
|
@@ -185,9 +185,9 @@ module ActiveMerchant
|
|
185
185
|
end
|
186
186
|
|
187
187
|
def build_credit_request(money, credit_card, options)
|
188
|
-
xml = Builder::XmlMarkup.new :
|
188
|
+
xml = Builder::XmlMarkup.new indent: 2
|
189
189
|
xml.instruct!
|
190
|
-
xml.tag! :Request, :
|
190
|
+
xml.tag! :Request, version: '2' do
|
191
191
|
add_authentication(xml)
|
192
192
|
xml.tag! :Transaction do
|
193
193
|
xml.tag! :CardTxn do
|
@@ -235,23 +235,23 @@ module ActiveMerchant
|
|
235
235
|
# a predefined one
|
236
236
|
xml.tag! :ExtendedPolicy do
|
237
237
|
xml.tag! :cv2_policy,
|
238
|
-
:
|
239
|
-
:
|
240
|
-
:
|
241
|
-
:
|
242
|
-
:
|
238
|
+
notprovided: POLICY_REJECT,
|
239
|
+
notchecked: POLICY_REJECT,
|
240
|
+
matched: POLICY_ACCEPT,
|
241
|
+
notmatched: POLICY_REJECT,
|
242
|
+
partialmatch: POLICY_REJECT
|
243
243
|
xml.tag! :postcode_policy,
|
244
|
-
:
|
245
|
-
:
|
246
|
-
:
|
247
|
-
:
|
248
|
-
:
|
244
|
+
notprovided: POLICY_ACCEPT,
|
245
|
+
notchecked: POLICY_ACCEPT,
|
246
|
+
matched: POLICY_ACCEPT,
|
247
|
+
notmatched: POLICY_REJECT,
|
248
|
+
partialmatch: POLICY_ACCEPT
|
249
249
|
xml.tag! :address_policy,
|
250
|
-
:
|
251
|
-
:
|
252
|
-
:
|
253
|
-
:
|
254
|
-
:
|
250
|
+
notprovided: POLICY_ACCEPT,
|
251
|
+
notchecked: POLICY_ACCEPT,
|
252
|
+
matched: POLICY_ACCEPT,
|
253
|
+
notmatched: POLICY_REJECT,
|
254
|
+
partialmatch: POLICY_ACCEPT
|
255
255
|
end
|
256
256
|
end
|
257
257
|
end
|
@@ -261,8 +261,8 @@ module ActiveMerchant
|
|
261
261
|
response = parse(ssl_post(test? ? self.test_url : self.live_url, request))
|
262
262
|
|
263
263
|
Response.new(response[:status] == '1', response[:reason], response,
|
264
|
-
:
|
265
|
-
:
|
264
|
+
test: test?,
|
265
|
+
authorization: "#{response[:datacash_reference]};#{response[:authcode]};#{response[:ca_reference]}"
|
266
266
|
)
|
267
267
|
end
|
268
268
|
|
@@ -296,7 +296,7 @@ module ActiveMerchant
|
|
296
296
|
|
297
297
|
def parse_authorization_string(authorization)
|
298
298
|
reference, auth_code, ca_reference = authorization.to_s.split(';')
|
299
|
-
{:
|
299
|
+
{reference: reference, auth_code: auth_code, ca_reference: ca_reference}
|
300
300
|
end
|
301
301
|
end
|
302
302
|
end
|
@@ -37,6 +37,7 @@ module ActiveMerchant #:nodoc:
|
|
37
37
|
56 => STANDARD_ERROR_CODE[:card_declined],
|
38
38
|
57 => STANDARD_ERROR_CODE[:card_declined],
|
39
39
|
76 => STANDARD_ERROR_CODE[:call_issuer],
|
40
|
+
91 => STANDARD_ERROR_CODE[:call_issuer],
|
40
41
|
96 => STANDARD_ERROR_CODE[:processing_error],
|
41
42
|
97 => STANDARD_ERROR_CODE[:processing_error],
|
42
43
|
}
|
@@ -239,9 +240,8 @@ module ActiveMerchant #:nodoc:
|
|
239
240
|
return response['message'] if response['message']
|
240
241
|
|
241
242
|
message = nil
|
242
|
-
|
243
243
|
if error = response.dig('status_details', 'error')
|
244
|
-
message = error.dig('reason', 'description')
|
244
|
+
message = "#{error.dig('reason', 'description')} | #{error['type']}"
|
245
245
|
elsif response['error_type']
|
246
246
|
message = response['validation_errors'].map { |errors| "#{errors['code']}: #{errors['param']}" }.join(', ') if response['validation_errors']
|
247
247
|
message ||= response['error_type']
|
@@ -266,6 +266,11 @@ module ActiveMerchant #:nodoc:
|
|
266
266
|
error_code ||= error['type']
|
267
267
|
elsif response['error_type']
|
268
268
|
error_code = response['error_type'] if response['validation_errors']
|
269
|
+
elsif error = response.dig('error')
|
270
|
+
validation_errors = error.dig('validation_errors', 0)
|
271
|
+
code = validation_errors['code'] if validation_errors && validation_errors['code']
|
272
|
+
param = validation_errors['param'] if validation_errors && validation_errors['param']
|
273
|
+
error_code = "#{error['error_type']} | #{code} | #{param}" if error['error_type']
|
269
274
|
end
|
270
275
|
|
271
276
|
error_code || STANDARD_ERROR_CODE[:processing_error]
|
@@ -37,6 +37,15 @@ module ActiveMerchant #:nodoc:
|
|
37
37
|
store: :post
|
38
38
|
}
|
39
39
|
|
40
|
+
VERIFY_AMOUNT_PER_COUNTRY = {
|
41
|
+
'br' => 100,
|
42
|
+
'ar' => 100,
|
43
|
+
'co' => 100,
|
44
|
+
'pe' => 300,
|
45
|
+
'mx' => 300,
|
46
|
+
'cl' => 5000
|
47
|
+
}
|
48
|
+
|
40
49
|
def initialize(options={})
|
41
50
|
requires!(options, :integration_key)
|
42
51
|
super
|
@@ -65,6 +74,7 @@ module ActiveMerchant #:nodoc:
|
|
65
74
|
add_card_or_token(post, payment)
|
66
75
|
add_address(post, options)
|
67
76
|
add_customer_responsible_person(post, payment, options)
|
77
|
+
add_additional_data(post, options)
|
68
78
|
post[:payment][:creditcard][:auto_capture] = false
|
69
79
|
|
70
80
|
commit(:authorize, post)
|
@@ -109,7 +119,7 @@ module ActiveMerchant #:nodoc:
|
|
109
119
|
|
110
120
|
def verify(credit_card, options={})
|
111
121
|
MultiResponse.run(:use_first_response) do |r|
|
112
|
-
r.process { authorize(
|
122
|
+
r.process { authorize(VERIFY_AMOUNT_PER_COUNTRY[customer_country(options)], credit_card, options) }
|
113
123
|
r.process(:ignore_result) { void(r.authorization, options) }
|
114
124
|
end
|
115
125
|
end
|
@@ -171,7 +181,7 @@ module ActiveMerchant #:nodoc:
|
|
171
181
|
def add_invoice(post, money, options)
|
172
182
|
post[:payment][:amount_total] = amount(money)
|
173
183
|
post[:payment][:currency_code] = (options[:currency] || currency(money))
|
174
|
-
post[:payment][:merchant_payment_code] = options[:order_id]
|
184
|
+
post[:payment][:merchant_payment_code] = Digest::MD5.hexdigest(options[:order_id])
|
175
185
|
post[:payment][:instalments] = options[:instalments] || 1
|
176
186
|
end
|
177
187
|
|
@@ -202,6 +212,8 @@ module ActiveMerchant #:nodoc:
|
|
202
212
|
def add_additional_data(post, options)
|
203
213
|
post[:device_id] = options[:device_id] if options[:device_id]
|
204
214
|
post[:metadata] = options[:metadata] if options[:metadata]
|
215
|
+
post[:metadata] = {} if post[:metadata].nil?
|
216
|
+
post[:metadata][:merchant_payment_code] = options[:order_id] if options[:order_id]
|
205
217
|
end
|
206
218
|
|
207
219
|
def parse(body)
|
@@ -54,7 +54,7 @@ module ActiveMerchant #:nodoc:
|
|
54
54
|
def void(identification, options = {})
|
55
55
|
requires!(options, :order_id)
|
56
56
|
original_transaction_id, _ = identification.split(';')
|
57
|
-
commit(:void_transaction, {:
|
57
|
+
commit(:void_transaction, {reference_number: format_reference_number(options[:order_id]), transaction_id: original_transaction_id})
|
58
58
|
end
|
59
59
|
|
60
60
|
def voice_authorize(money, authorization_code, creditcard, options = {})
|
@@ -81,11 +81,11 @@ module ActiveMerchant #:nodoc:
|
|
81
81
|
requires!(options, :order_id)
|
82
82
|
|
83
83
|
{
|
84
|
-
:
|
85
|
-
:
|
86
|
-
:
|
87
|
-
:
|
88
|
-
:
|
84
|
+
reference_number: format_reference_number(options[:order_id]),
|
85
|
+
transaction_amount: amount(money),
|
86
|
+
original_transaction_amount: original_transaction_amount,
|
87
|
+
original_transaction_id: original_transaction_id,
|
88
|
+
client_ip_address: options[:ip]
|
89
89
|
}
|
90
90
|
end
|
91
91
|
|
@@ -93,10 +93,10 @@ module ActiveMerchant #:nodoc:
|
|
93
93
|
requires!(options, :order_id)
|
94
94
|
|
95
95
|
post = {
|
96
|
-
:
|
97
|
-
:
|
98
|
-
:
|
99
|
-
:
|
96
|
+
reference_number: format_reference_number(options[:order_id]),
|
97
|
+
authorization_number: options[:authorization_number],
|
98
|
+
transaction_amount: amount(money),
|
99
|
+
client_ip_address: options[:ip]
|
100
100
|
|
101
101
|
}
|
102
102
|
add_creditcard(post, creditcard)
|
@@ -146,10 +146,10 @@ module ActiveMerchant #:nodoc:
|
|
146
146
|
response = parse(ssl_post(test? ? self.test_url : self.live_url, post_data(action, parameters), 'Content-Type' => 'text/xml'))
|
147
147
|
|
148
148
|
Response.new(success?(response), message_from(response[:result_message]), response,
|
149
|
-
:
|
150
|
-
:
|
151
|
-
:
|
152
|
-
:
|
149
|
+
test: test?,
|
150
|
+
authorization: authorization_from(response, parameters),
|
151
|
+
avs_result: { code: response[:avs_response_code] },
|
152
|
+
cvv_result: response[:cvv_response_code]
|
153
153
|
)
|
154
154
|
end
|
155
155
|
|
@@ -201,15 +201,15 @@ module ActiveMerchant #:nodoc:
|
|
201
201
|
CREDIT_CARD_FIELDS = %w(AuthorizationNumber ClientIpAddress BillingAddress BillingCity BillingState BillingPostalCode BillingCountry BillingName CardVerificationValue ExpirationMonth ExpirationYear ReferenceNumber TransactionAmount AccountNumber)
|
202
202
|
|
203
203
|
ACTIONS = {
|
204
|
-
:
|
205
|
-
:
|
206
|
-
:
|
207
|
-
:
|
208
|
-
:
|
209
|
-
:
|
210
|
-
:
|
211
|
-
:
|
212
|
-
:
|
204
|
+
credit_card_authorize: CREDIT_CARD_FIELDS,
|
205
|
+
credit_card_charge: CREDIT_CARD_FIELDS,
|
206
|
+
credit_card_voice_authorize: CREDIT_CARD_FIELDS,
|
207
|
+
credit_card_capture: CREDIT_CARD_FIELDS,
|
208
|
+
credit_card_credit: CREDIT_CARD_FIELDS + ['OriginalTransactionAmount'],
|
209
|
+
credit_card_refund: %w(ReferenceNumber TransactionAmount OriginalTransactionAmount OriginalTransactionID ClientIpAddress),
|
210
|
+
void_transaction: %w(ReferenceNumber TransactionID),
|
211
|
+
credit_card_settle: %w(ReferenceNumber TransactionAmount OriginalTransactionAmount OriginalTransactionID ClientIpAddress),
|
212
|
+
system_check: %w(SystemCheck),
|
213
213
|
}
|
214
214
|
end
|
215
215
|
end
|
@@ -17,15 +17,16 @@ module ActiveMerchant #:nodoc:
|
|
17
17
|
|
18
18
|
self.delimiter = "\n"
|
19
19
|
self.actions = {
|
20
|
-
:
|
21
|
-
:
|
22
|
-
:
|
23
|
-
:
|
24
|
-
:
|
25
|
-
:
|
26
|
-
:
|
27
|
-
:
|
28
|
-
:
|
20
|
+
purchase: 'CCSALE',
|
21
|
+
credit: 'CCCREDIT',
|
22
|
+
refund: 'CCRETURN',
|
23
|
+
authorize: 'CCAUTHONLY',
|
24
|
+
capture: 'CCFORCE',
|
25
|
+
capture_complete: 'CCCOMPLETE',
|
26
|
+
void: 'CCDELETE',
|
27
|
+
store: 'CCGETTOKEN',
|
28
|
+
update: 'CCUPDATETOKEN',
|
29
|
+
verify: 'CCVERIFY'
|
29
30
|
}
|
30
31
|
|
31
32
|
def initialize(options = {})
|
@@ -47,6 +48,8 @@ module ActiveMerchant #:nodoc:
|
|
47
48
|
add_customer_data(form, options)
|
48
49
|
add_test_mode(form, options)
|
49
50
|
add_ip(form, options)
|
51
|
+
add_ssl_dynamic_dba(form, options)
|
52
|
+
add_level_3_fields(form, options) if options[:level_3_data]
|
50
53
|
commit(:purchase, money, form, options)
|
51
54
|
end
|
52
55
|
|
@@ -60,6 +63,8 @@ module ActiveMerchant #:nodoc:
|
|
60
63
|
add_customer_data(form, options)
|
61
64
|
add_test_mode(form, options)
|
62
65
|
add_ip(form, options)
|
66
|
+
add_ssl_dynamic_dba(form, options)
|
67
|
+
add_level_3_fields(form, options) if options[:level_3_data]
|
63
68
|
commit(:authorize, money, form, options)
|
64
69
|
end
|
65
70
|
|
@@ -72,6 +77,7 @@ module ActiveMerchant #:nodoc:
|
|
72
77
|
add_invoice(form, options)
|
73
78
|
add_creditcard(form, options[:credit_card])
|
74
79
|
add_currency(form, money, options)
|
80
|
+
add_address(form, options)
|
75
81
|
add_customer_data(form, options)
|
76
82
|
add_test_mode(form, options)
|
77
83
|
else
|
@@ -111,10 +117,12 @@ module ActiveMerchant #:nodoc:
|
|
111
117
|
end
|
112
118
|
|
113
119
|
def verify(credit_card, options = {})
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
120
|
+
form = {}
|
121
|
+
add_creditcard(form, credit_card)
|
122
|
+
add_address(form, options)
|
123
|
+
add_test_mode(form, options)
|
124
|
+
add_ip(form, options)
|
125
|
+
commit(:verify, 0, form, options)
|
118
126
|
end
|
119
127
|
|
120
128
|
def store(creditcard, options = {})
|
@@ -249,6 +257,50 @@ module ActiveMerchant #:nodoc:
|
|
249
257
|
form[:cardholder_ip] = options[:ip] if options.has_key?(:ip)
|
250
258
|
end
|
251
259
|
|
260
|
+
def add_ssl_dynamic_dba(form, options)
|
261
|
+
form[:dynamic_dba] = options[:dba] if options.has_key?(:dba)
|
262
|
+
end
|
263
|
+
|
264
|
+
def add_level_3_fields(form, options)
|
265
|
+
level_3_data = options[:level_3_data]
|
266
|
+
form[:customer_code] = level_3_data[:customer_code] if level_3_data[:customer_code]
|
267
|
+
form[:salestax] = level_3_data[:salestax] if level_3_data[:salestax]
|
268
|
+
form[:salestax_indicator] = level_3_data[:salestax_indicator] if level_3_data[:salestax_indicator]
|
269
|
+
form[:level3_indicator] = level_3_data[:level3_indicator] if level_3_data[:level3_indicator]
|
270
|
+
form[:ship_to_zip] = level_3_data[:ship_to_zip] if level_3_data[:ship_to_zip]
|
271
|
+
form[:ship_to_country] = level_3_data[:ship_to_country] if level_3_data[:ship_to_country]
|
272
|
+
form[:shipping_amount] = level_3_data[:shipping_amount] if level_3_data[:shipping_amount]
|
273
|
+
form[:ship_from_postal_code] = level_3_data[:ship_from_postal_code] if level_3_data[:ship_from_postal_code]
|
274
|
+
form[:discount_amount] = level_3_data[:discount_amount] if level_3_data[:discount_amount]
|
275
|
+
form[:duty_amount] = level_3_data[:duty_amount] if level_3_data[:duty_amount]
|
276
|
+
form[:national_tax_indicator] = level_3_data[:national_tax_indicator] if level_3_data[:national_tax_indicator]
|
277
|
+
form[:national_tax_amount] = level_3_data[:national_tax_amount] if level_3_data[:national_tax_amount]
|
278
|
+
form[:order_date] = level_3_data[:order_date] if level_3_data[:order_date]
|
279
|
+
form[:other_tax] = level_3_data[:other_tax] if level_3_data[:other_tax]
|
280
|
+
form[:summary_commodity_code] = level_3_data[:summary_commodity_code] if level_3_data[:summary_commodity_code]
|
281
|
+
form[:merchant_vat_number] = level_3_data[:merchant_vat_number] if level_3_data[:merchant_vat_number]
|
282
|
+
form[:customer_vat_number] = level_3_data[:customer_vat_number] if level_3_data[:customer_vat_number]
|
283
|
+
form[:freight_tax_amount] = level_3_data[:freight_tax_amount] if level_3_data[:freight_tax_amount]
|
284
|
+
form[:vat_invoice_number] = level_3_data[:vat_invoice_number] if level_3_data[:vat_invoice_number]
|
285
|
+
form[:tracking_number] = level_3_data[:tracking_number] if level_3_data[:tracking_number]
|
286
|
+
form[:shipping_company] = level_3_data[:shipping_company] if level_3_data[:shipping_company]
|
287
|
+
form[:other_fees] = level_3_data[:other_fees] if level_3_data[:other_fees]
|
288
|
+
add_line_items(form, level_3_data) if level_3_data[:line_items]
|
289
|
+
end
|
290
|
+
|
291
|
+
def add_line_items(form, level_3_data)
|
292
|
+
items = []
|
293
|
+
level_3_data[:line_items].each do |line_item|
|
294
|
+
item = {}
|
295
|
+
line_item.each do |key, value|
|
296
|
+
prefixed_key = "ssl_line_Item_#{key}"
|
297
|
+
item[prefixed_key.to_sym] = value
|
298
|
+
end
|
299
|
+
items << item
|
300
|
+
end
|
301
|
+
form[:LineItemProducts] = { product: items }
|
302
|
+
end
|
303
|
+
|
252
304
|
def message_from(response)
|
253
305
|
success?(response) ? response['result_message'] : response['errorMessage']
|
254
306
|
end
|
@@ -264,10 +316,10 @@ module ActiveMerchant #:nodoc:
|
|
264
316
|
response = parse(ssl_post(test? ? self.test_url : self.live_url, post_data(parameters, options)))
|
265
317
|
|
266
318
|
Response.new(response['result'] == '0', message_from(response), response,
|
267
|
-
:
|
268
|
-
:
|
269
|
-
:
|
270
|
-
:
|
319
|
+
test: @options[:test] || test?,
|
320
|
+
authorization: authorization_from(response),
|
321
|
+
avs_result: { code: response['avs_response'] },
|
322
|
+
cvv_result: response['cvv2_response']
|
271
323
|
)
|
272
324
|
end
|
273
325
|
|
@@ -278,7 +330,7 @@ module ActiveMerchant #:nodoc:
|
|
278
330
|
end
|
279
331
|
|
280
332
|
def post_data_string(key, value, options)
|
281
|
-
if custom_field?(key, options)
|
333
|
+
if custom_field?(key, options) || key == :LineItemProducts
|
282
334
|
"#{key}=#{CGI.escape(value.to_s)}"
|
283
335
|
else
|
284
336
|
"ssl_#{key}=#{CGI.escape(value.to_s)}"
|