activemerchant 1.93.0 → 1.98.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +111 -0
- data/README.md +3 -0
- data/lib/active_merchant/billing/avs_result.rb +4 -5
- data/lib/active_merchant/billing/credit_card.rb +6 -0
- data/lib/active_merchant/billing/credit_card_methods.rb +67 -4
- data/lib/active_merchant/billing/gateway.rb +10 -0
- data/lib/active_merchant/billing/gateways/adyen.rb +106 -22
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +43 -10
- data/lib/active_merchant/billing/gateways/beanstream.rb +2 -0
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +3 -0
- data/lib/active_merchant/billing/gateways/blue_snap.rb +22 -2
- data/lib/active_merchant/billing/gateways/bpoint.rb +4 -4
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +56 -9
- data/lib/active_merchant/billing/gateways/card_connect.rb +3 -1
- data/lib/active_merchant/billing/gateways/cecabank.rb +7 -7
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +98 -61
- data/lib/active_merchant/billing/gateways/credorax.rb +29 -3
- data/lib/active_merchant/billing/gateways/cyber_source.rb +30 -13
- data/lib/active_merchant/billing/gateways/d_local.rb +1 -1
- data/lib/active_merchant/billing/gateways/decidir.rb +233 -0
- data/lib/active_merchant/billing/gateways/elavon.rb +9 -0
- data/lib/active_merchant/billing/gateways/epay.rb +13 -2
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +42 -12
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +6 -0
- data/lib/active_merchant/billing/gateways/global_collect.rb +3 -7
- data/lib/active_merchant/billing/gateways/hps.rb +46 -1
- data/lib/active_merchant/billing/gateways/kushki.rb +1 -1
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +1 -1
- data/lib/active_merchant/billing/gateways/migs.rb +8 -0
- data/lib/active_merchant/billing/gateways/monei.rb +31 -0
- data/lib/active_merchant/billing/gateways/mundipagg.rb +3 -2
- data/lib/active_merchant/billing/gateways/nab_transact.rb +1 -1
- data/lib/active_merchant/billing/gateways/nmi.rb +39 -1
- data/lib/active_merchant/billing/gateways/opp.rb +20 -1
- data/lib/active_merchant/billing/gateways/orbital.rb +60 -10
- data/lib/active_merchant/billing/gateways/payflow.rb +40 -2
- data/lib/active_merchant/billing/gateways/paymill.rb +5 -0
- data/lib/active_merchant/billing/gateways/paypal.rb +14 -1
- data/lib/active_merchant/billing/gateways/payu_latam.rb +6 -2
- data/lib/active_merchant/billing/gateways/qvalent.rb +43 -1
- data/lib/active_merchant/billing/gateways/realex.rb +32 -9
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +43 -29
- data/lib/active_merchant/billing/gateways/stripe.rb +54 -9
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +267 -0
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +2 -2
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +45 -6
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +8 -5
- data/lib/active_merchant/billing/gateways/worldpay.rb +171 -39
- data/lib/active_merchant/country.rb +1 -0
- data/lib/active_merchant/version.rb +1 -1
- metadata +19 -4
@@ -63,6 +63,7 @@ module ActiveMerchant #:nodoc:
|
|
63
63
|
add_invoice(post, options)
|
64
64
|
add_creditcard_or_reference(post, credit_card_or_reference)
|
65
65
|
add_instant_capture(post, false)
|
66
|
+
add_3ds_auth(post, options)
|
66
67
|
|
67
68
|
commit(:authorize, post)
|
68
69
|
end
|
@@ -74,6 +75,7 @@ module ActiveMerchant #:nodoc:
|
|
74
75
|
add_creditcard_or_reference(post, credit_card_or_reference)
|
75
76
|
add_invoice(post, options)
|
76
77
|
add_instant_capture(post, true)
|
78
|
+
add_3ds_auth(post, options)
|
77
79
|
|
78
80
|
commit(:authorize, post)
|
79
81
|
end
|
@@ -158,6 +160,16 @@ module ActiveMerchant #:nodoc:
|
|
158
160
|
post[:instantcapture] = option ? 1 : 0
|
159
161
|
end
|
160
162
|
|
163
|
+
def add_3ds_auth(post, options)
|
164
|
+
if options[:three_d_secure]
|
165
|
+
post[:eci] = options.dig(:three_d_secure, :eci)
|
166
|
+
post[:xid] = options.dig(:three_d_secure, :xid)
|
167
|
+
post[:cavv] = options.dig(:three_d_secure, :cavv)
|
168
|
+
post[:threeds_version] = options.dig(:three_d_secure, :version)
|
169
|
+
post[:ds_transaction_id] = options.dig(:three_d_secure, :ds_transaction_id)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
161
173
|
def commit(action, params)
|
162
174
|
response = send("do_#{action}", params)
|
163
175
|
|
@@ -193,7 +205,6 @@ module ActiveMerchant #:nodoc:
|
|
193
205
|
headers['Referer'] = (options[:password] || 'activemerchant.org')
|
194
206
|
|
195
207
|
response = raw_ssl_request(:post, live_url + 'auth/default.aspx', authorize_post_data(params), headers)
|
196
|
-
|
197
208
|
# Authorize gives the response back by redirecting with the values in
|
198
209
|
# the URL query
|
199
210
|
if location = response['Location']
|
@@ -268,7 +279,7 @@ module ActiveMerchant #:nodoc:
|
|
268
279
|
|
269
280
|
def authorize_post_data(params = {})
|
270
281
|
params[:language] = '2'
|
271
|
-
params[:cms] = '
|
282
|
+
params[:cms] = 'activemerchant_3ds'
|
272
283
|
params[:accepturl] = live_url + 'auth/default.aspx?accept=1'
|
273
284
|
params[:declineurl] = live_url + 'auth/default.aspx?decline=1'
|
274
285
|
params[:merchantnumber] = @options[:login]
|
@@ -51,7 +51,7 @@ module ActiveMerchant #:nodoc:
|
|
51
51
|
params = {}
|
52
52
|
add_metadata(params, options)
|
53
53
|
add_invoice(params, amount, options)
|
54
|
-
add_customer_data(params, options)
|
54
|
+
add_customer_data(params, options, payment_method)
|
55
55
|
add_credit_card(params, payment_method, options)
|
56
56
|
params['Method'] = payment_method.respond_to?(:number) ? 'ProcessPayment' : 'TokenPayment'
|
57
57
|
commit(url_for('Transaction'), params)
|
@@ -61,7 +61,7 @@ module ActiveMerchant #:nodoc:
|
|
61
61
|
params = {}
|
62
62
|
add_metadata(params, options)
|
63
63
|
add_invoice(params, amount, options)
|
64
|
-
add_customer_data(params, options)
|
64
|
+
add_customer_data(params, options, payment_method)
|
65
65
|
add_credit_card(params, payment_method, options)
|
66
66
|
params['Method'] = 'Authorise'
|
67
67
|
commit(url_for('Authorisation'), params)
|
@@ -137,7 +137,7 @@ module ActiveMerchant #:nodoc:
|
|
137
137
|
params = {}
|
138
138
|
add_metadata(params, options)
|
139
139
|
add_invoice(params, 0, options)
|
140
|
-
add_customer_data(params, options)
|
140
|
+
add_customer_data(params, options, payment_method)
|
141
141
|
add_credit_card(params, payment_method, options)
|
142
142
|
params['Method'] = 'CreateTokenCustomer'
|
143
143
|
commit(url_for('Transaction'), params)
|
@@ -166,7 +166,7 @@ module ActiveMerchant #:nodoc:
|
|
166
166
|
params = {}
|
167
167
|
add_metadata(params, options)
|
168
168
|
add_invoice(params, 0, options)
|
169
|
-
add_customer_data(params, options)
|
169
|
+
add_customer_data(params, options, payment_method)
|
170
170
|
add_credit_card(params, payment_method, options)
|
171
171
|
add_customer_token(params, customer_token)
|
172
172
|
params['Method'] = 'UpdateTokenCustomer'
|
@@ -212,17 +212,48 @@ module ActiveMerchant #:nodoc:
|
|
212
212
|
params['TransactionID'] = reference
|
213
213
|
end
|
214
214
|
|
215
|
-
def add_customer_data(params, options)
|
216
|
-
params
|
217
|
-
|
218
|
-
|
219
|
-
|
215
|
+
def add_customer_data(params, options, payment_method = nil)
|
216
|
+
add_customer_fields(params, options, payment_method)
|
217
|
+
add_shipping_fields(params, options)
|
218
|
+
end
|
219
|
+
|
220
|
+
def add_customer_fields(params, options, payment_method)
|
221
|
+
key = 'Customer'
|
222
|
+
params[key] ||= {}
|
223
|
+
|
224
|
+
customer_address = options[:billing_address] || options[:address]
|
225
|
+
|
226
|
+
add_name_and_email(params[key], customer_address, options[:email], payment_method)
|
227
|
+
add_address(params[key], customer_address)
|
228
|
+
end
|
229
|
+
|
230
|
+
def add_shipping_fields(params, options)
|
231
|
+
key = 'ShippingAddress'
|
232
|
+
params[key] = {}
|
233
|
+
|
234
|
+
add_name_and_email(params[key], options[:shipping_address], options[:email])
|
235
|
+
add_address(params[key], options[:shipping_address], {:skip_company => true})
|
236
|
+
end
|
237
|
+
|
238
|
+
def add_name_and_email(params, address, email, payment_method = nil)
|
239
|
+
if address.present?
|
240
|
+
params['FirstName'], params['LastName'] = split_names(address[:name])
|
241
|
+
elsif payment_method_name_available?(payment_method)
|
242
|
+
params['FirstName'] = payment_method.first_name
|
243
|
+
params['LastName'] = payment_method.last_name
|
244
|
+
end
|
245
|
+
|
246
|
+
params['Email'] = email
|
247
|
+
end
|
248
|
+
|
249
|
+
def payment_method_name_available?(payment_method)
|
250
|
+
payment_method.respond_to?(:first_name) && payment_method.respond_to?(:last_name) &&
|
251
|
+
payment_method.first_name.present? && payment_method.last_name.present?
|
220
252
|
end
|
221
253
|
|
222
254
|
def add_address(params, address, options={})
|
223
255
|
return unless address
|
224
256
|
|
225
|
-
params['FirstName'], params['LastName'] = split_names(address[:name])
|
226
257
|
params['Title'] = address[:title]
|
227
258
|
params['CompanyName'] = address[:company] unless options[:skip_company]
|
228
259
|
params['Street1'] = truncate(address[:address1], 50)
|
@@ -231,9 +262,8 @@ module ActiveMerchant #:nodoc:
|
|
231
262
|
params['State'] = address[:state]
|
232
263
|
params['PostalCode'] = address[:zip]
|
233
264
|
params['Country'] = address[:country].to_s.downcase
|
234
|
-
params['Phone'] = address[:phone]
|
265
|
+
params['Phone'] = address[:phone] || address[:phone_number]
|
235
266
|
params['Fax'] = address[:fax]
|
236
|
-
params['Email'] = options[:email]
|
237
267
|
end
|
238
268
|
|
239
269
|
def add_credit_card(params, credit_card, options)
|
@@ -27,6 +27,7 @@ module ActiveMerchant #:nodoc:
|
|
27
27
|
add_extra_options(post, options)
|
28
28
|
add_order_id(post, options)
|
29
29
|
add_ip(post, options)
|
30
|
+
add_metadata(post, options)
|
30
31
|
|
31
32
|
commit(:post, 'purchases', post)
|
32
33
|
end
|
@@ -39,6 +40,7 @@ module ActiveMerchant #:nodoc:
|
|
39
40
|
add_extra_options(post, options)
|
40
41
|
add_order_id(post, options)
|
41
42
|
add_ip(post, options)
|
43
|
+
add_metadata(post, options)
|
42
44
|
|
43
45
|
post[:capture] = false
|
44
46
|
|
@@ -138,6 +140,10 @@ module ActiveMerchant #:nodoc:
|
|
138
140
|
post[:customer_ip] = options[:ip] || '127.0.0.1'
|
139
141
|
end
|
140
142
|
|
143
|
+
def add_metadata(post, options)
|
144
|
+
post[:metadata] = options.fetch(:metadata, {})
|
145
|
+
end
|
146
|
+
|
141
147
|
def commit(method, uri, parameters=nil)
|
142
148
|
response = begin
|
143
149
|
parse(ssl_request(method, get_url(uri), parameters.to_json, headers))
|
@@ -10,7 +10,7 @@ module ActiveMerchant #:nodoc:
|
|
10
10
|
self.supported_countries = ['AD', 'AE', 'AG', 'AI', 'AL', 'AM', 'AO', 'AR', 'AS', 'AT', 'AU', 'AW', 'AX', 'AZ', 'BA', 'BB', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BL', 'BM', 'BN', 'BO', 'BQ', 'BR', 'BS', 'BT', 'BW', 'BY', 'BZ', 'CA', 'CC', 'CD', 'CF', 'CH', 'CI', 'CK', 'CL', 'CM', 'CN', 'CO', 'CR', 'CU', 'CV', 'CW', 'CX', 'CY', 'CZ', 'DE', 'DJ', 'DK', 'DM', 'DO', 'DZ', 'EC', 'EE', 'EG', 'ER', 'ES', 'ET', 'FI', 'FJ', 'FK', 'FM', 'FO', 'FR', 'GA', 'GB', 'GD', 'GE', 'GF', 'GH', 'GI', 'GL', 'GM', 'GN', 'GP', 'GQ', 'GR', 'GS', 'GT', 'GU', 'GW', 'GY', 'HK', 'HN', 'HR', 'HT', 'HU', 'ID', 'IE', 'IL', 'IM', 'IN', 'IS', 'IT', 'JM', 'JO', 'JP', 'KE', 'KG', 'KH', 'KI', 'KM', 'KN', 'KR', 'KW', 'KY', 'KZ', 'LA', 'LB', 'LC', 'LI', 'LK', 'LR', 'LS', 'LT', 'LU', 'LV', 'MA', 'MC', 'MD', 'ME', 'MF', 'MG', 'MH', 'MK', 'MM', 'MN', 'MO', 'MP', 'MQ', 'MR', 'MS', 'MT', 'MU', 'MV', 'MW', 'MX', 'MY', 'MZ', 'NA', 'NC', 'NE', 'NG', 'NI', 'NL', 'NO', 'NP', 'NR', 'NU', 'NZ', 'OM', 'PA', 'PE', 'PF', 'PG', 'PH', 'PL', 'PN', 'PS', 'PT', 'PW', 'QA', 'RE', 'RO', 'RS', 'RU', 'RW', 'SA', 'SB', 'SC', 'SE', 'SG', 'SH', 'SI', 'SJ', 'SK', 'SL', 'SM', 'SN', 'SR', 'ST', 'SV', 'SZ', 'TC', 'TD', 'TG', 'TH', 'TJ', 'TL', 'TM', 'TN', 'TO', 'TR', 'TT', 'TV', 'TW', 'TZ', 'UA', 'UG', 'US', 'UY', 'UZ', 'VC', 'VE', 'VG', 'VI', 'VN', 'WF', 'WS', 'ZA', 'ZM', 'ZW']
|
11
11
|
self.default_currency = 'USD'
|
12
12
|
self.money_format = :cents
|
13
|
-
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
|
13
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :naranja, :cabal]
|
14
14
|
|
15
15
|
def initialize(options={})
|
16
16
|
requires!(options, :merchant_id, :api_key_id, :secret_api_key)
|
@@ -142,12 +142,8 @@ module ActiveMerchant #:nodoc:
|
|
142
142
|
|
143
143
|
def add_customer_data(post, options, payment = nil)
|
144
144
|
if payment
|
145
|
-
post['order']['customer']['personalInformation'] =
|
146
|
-
|
147
|
-
'firstName' => payment.first_name[0..14],
|
148
|
-
'surname' => payment.last_name[0..69]
|
149
|
-
}
|
150
|
-
}
|
145
|
+
post['order']['customer']['personalInformation']['name']['firstName'] = payment.first_name[0..14] if payment.first_name
|
146
|
+
post['order']['customer']['personalInformation']['name']['surname'] = payment.last_name[0..69] if payment.last_name
|
151
147
|
end
|
152
148
|
post['order']['customer']['merchantCustomerId'] = options[:customer] if options[:customer]
|
153
149
|
post['order']['customer']['companyInformation']['name'] = options[:company] if options[:company]
|
@@ -15,6 +15,14 @@ module ActiveMerchant #:nodoc:
|
|
15
15
|
|
16
16
|
self.money_format = :dollars
|
17
17
|
|
18
|
+
PAYMENT_DATA_SOURCE_MAPPING = {
|
19
|
+
apple_pay: 'ApplePay',
|
20
|
+
master: 'MasterCard 3DSecure',
|
21
|
+
visa: 'Visa 3DSecure',
|
22
|
+
american_express: 'AMEX 3DSecure',
|
23
|
+
discover: 'Discover 3DSecure',
|
24
|
+
}
|
25
|
+
|
18
26
|
def initialize(options={})
|
19
27
|
requires!(options, :secret_api_key)
|
20
28
|
super
|
@@ -28,6 +36,7 @@ module ActiveMerchant #:nodoc:
|
|
28
36
|
add_details(xml, options)
|
29
37
|
add_descriptor_name(xml, options)
|
30
38
|
add_payment(xml, card_or_token, options)
|
39
|
+
add_three_d_secure(xml, card_or_token, options)
|
31
40
|
end
|
32
41
|
end
|
33
42
|
|
@@ -46,6 +55,7 @@ module ActiveMerchant #:nodoc:
|
|
46
55
|
add_details(xml, options)
|
47
56
|
add_descriptor_name(xml, options)
|
48
57
|
add_payment(xml, card_or_token, options)
|
58
|
+
add_three_d_secure(xml, card_or_token, options)
|
49
59
|
end
|
50
60
|
end
|
51
61
|
|
@@ -81,7 +91,8 @@ module ActiveMerchant #:nodoc:
|
|
81
91
|
transcript.
|
82
92
|
gsub(%r((<hps:CardNbr>)[^<]*(<\/hps:CardNbr>))i, '\1[FILTERED]\2').
|
83
93
|
gsub(%r((<hps:CVV2>)[^<]*(<\/hps:CVV2>))i, '\1[FILTERED]\2').
|
84
|
-
gsub(%r((<hps:SecretAPIKey>)[^<]*(<\/hps:SecretAPIKey>))i, '\1[FILTERED]\2')
|
94
|
+
gsub(%r((<hps:SecretAPIKey>)[^<]*(<\/hps:SecretAPIKey>))i, '\1[FILTERED]\2').
|
95
|
+
gsub(%r((<hps:PaymentData>)[^<]*(<\/hps:PaymentData>))i, '\1[FILTERED]\2')
|
85
96
|
end
|
86
97
|
|
87
98
|
private
|
@@ -164,6 +175,40 @@ module ActiveMerchant #:nodoc:
|
|
164
175
|
xml.hps :TxnDescriptor, options[:descriptor_name] if options[:descriptor_name]
|
165
176
|
end
|
166
177
|
|
178
|
+
def add_three_d_secure(xml, card_or_token, options)
|
179
|
+
if card_or_token.is_a?(NetworkTokenizationCreditCard)
|
180
|
+
build_three_d_secure(xml, {
|
181
|
+
source: card_or_token.source,
|
182
|
+
cavv: card_or_token.payment_cryptogram,
|
183
|
+
eci: card_or_token.eci,
|
184
|
+
xid: card_or_token.transaction_id,
|
185
|
+
})
|
186
|
+
elsif options[:three_d_secure]
|
187
|
+
options[:three_d_secure][:source] ||= card_brand(card_or_token)
|
188
|
+
build_three_d_secure(xml, options[:three_d_secure])
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
def build_three_d_secure(xml, three_d_secure)
|
193
|
+
# PaymentDataSource is required when supplying the SecureECommerce data group,
|
194
|
+
# and the gateway currently only allows the values within the mapping
|
195
|
+
return unless PAYMENT_DATA_SOURCE_MAPPING[three_d_secure[:source].to_sym]
|
196
|
+
|
197
|
+
xml.hps :SecureECommerce do
|
198
|
+
xml.hps :PaymentDataSource, PAYMENT_DATA_SOURCE_MAPPING[three_d_secure[:source].to_sym]
|
199
|
+
xml.hps :TypeOfPaymentData, '3DSecure' # Only type currently supported
|
200
|
+
xml.hps :PaymentData, three_d_secure[:cavv] if three_d_secure[:cavv]
|
201
|
+
# the gateway only allows a single character for the ECI
|
202
|
+
xml.hps :ECommerceIndicator, strip_leading_zero(three_d_secure[:eci]) if three_d_secure[:eci]
|
203
|
+
xml.hps :XID, three_d_secure[:xid] if three_d_secure[:xid]
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
def strip_leading_zero(value)
|
208
|
+
return value unless value[0] == '0'
|
209
|
+
value[1, 1]
|
210
|
+
end
|
211
|
+
|
167
212
|
def build_request(action)
|
168
213
|
xml = Builder::XmlMarkup.new(encoding: 'UTF-8')
|
169
214
|
xml.instruct!(:xml, encoding: 'UTF-8')
|
@@ -7,7 +7,7 @@ module ActiveMerchant #:nodoc:
|
|
7
7
|
self.test_url = 'https://api-uat.kushkipagos.com/v1/'
|
8
8
|
self.live_url = 'https://api.kushkipagos.com/v1/'
|
9
9
|
|
10
|
-
self.supported_countries = ['CO', 'EC']
|
10
|
+
self.supported_countries = ['CL', 'CO', 'EC', 'MX', 'PE']
|
11
11
|
self.default_currency = 'USD'
|
12
12
|
self.money_format = :dollars
|
13
13
|
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club]
|
@@ -4,7 +4,7 @@ module ActiveMerchant #:nodoc:
|
|
4
4
|
self.live_url = self.test_url = 'https://api.mercadopago.com/v1'
|
5
5
|
|
6
6
|
self.supported_countries = ['AR', 'BR', 'CL', 'CO', 'MX', 'PE', 'UY']
|
7
|
-
self.supported_cardtypes = [:visa, :master, :american_express, :elo]
|
7
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :elo, :cabal, :naranja]
|
8
8
|
|
9
9
|
self.homepage_url = 'https://www.mercadopago.com/'
|
10
10
|
self.display_name = 'Mercado Pago'
|
@@ -63,6 +63,7 @@ module ActiveMerchant #:nodoc:
|
|
63
63
|
add_creditcard(post, creditcard)
|
64
64
|
add_standard_parameters('pay', post, options[:unique_id])
|
65
65
|
add_3ds(post, options)
|
66
|
+
add_tx_source(post, options)
|
66
67
|
|
67
68
|
commit(post)
|
68
69
|
end
|
@@ -83,6 +84,7 @@ module ActiveMerchant #:nodoc:
|
|
83
84
|
add_amount(post, money, options)
|
84
85
|
add_advanced_user(post)
|
85
86
|
add_standard_parameters('capture', post, options[:unique_id])
|
87
|
+
add_tx_source(post, options)
|
86
88
|
|
87
89
|
commit(post)
|
88
90
|
end
|
@@ -99,6 +101,7 @@ module ActiveMerchant #:nodoc:
|
|
99
101
|
add_amount(post, money, options)
|
100
102
|
add_advanced_user(post)
|
101
103
|
add_standard_parameters('refund', post, options[:unique_id])
|
104
|
+
add_tx_source(post, options)
|
102
105
|
|
103
106
|
commit(post)
|
104
107
|
end
|
@@ -110,6 +113,7 @@ module ActiveMerchant #:nodoc:
|
|
110
113
|
|
111
114
|
add_advanced_user(post)
|
112
115
|
add_standard_parameters('voidAuthorisation', post, options[:unique_id])
|
116
|
+
add_tx_source(post, options)
|
113
117
|
|
114
118
|
commit(post)
|
115
119
|
end
|
@@ -241,6 +245,10 @@ module ActiveMerchant #:nodoc:
|
|
241
245
|
post['3DSstatus'] = options[:three_ds_status] if options[:three_ds_status]
|
242
246
|
end
|
243
247
|
|
248
|
+
def add_tx_source(post, options)
|
249
|
+
post[:TxSource] = options[:tx_source] if options[:tx_source]
|
250
|
+
end
|
251
|
+
|
244
252
|
def add_creditcard(post, creditcard)
|
245
253
|
post[:CardNum] = creditcard.number
|
246
254
|
post[:CardSecurityCode] = creditcard.verification_value if creditcard.verification_value?
|
@@ -133,6 +133,7 @@ module ActiveMerchant #:nodoc:
|
|
133
133
|
add_payment(xml, action, money, options)
|
134
134
|
add_account(xml, credit_card)
|
135
135
|
add_customer(xml, credit_card, options)
|
136
|
+
add_three_d_secure(xml, options)
|
136
137
|
end
|
137
138
|
|
138
139
|
commit(request)
|
@@ -225,6 +226,36 @@ module ActiveMerchant #:nodoc:
|
|
225
226
|
end
|
226
227
|
end
|
227
228
|
|
229
|
+
# Private : Convert ECI to ResultIndicator
|
230
|
+
# Possible ECI values:
|
231
|
+
# 02 or 05 - Fully Authenticated Transaction
|
232
|
+
# 00 or 07 - Non 3D Secure Transaction
|
233
|
+
# Possible ResultIndicator values:
|
234
|
+
# 01 = MASTER_3D_ATTEMPT
|
235
|
+
# 02 = MASTER_3D_SUCCESS
|
236
|
+
# 05 = VISA_3D_SUCCESS
|
237
|
+
# 06 = VISA_3D_ATTEMPT
|
238
|
+
# 07 = DEFAULT_E_COMMERCE
|
239
|
+
def eci_to_result_indicator(eci)
|
240
|
+
case eci
|
241
|
+
when '02', '05'
|
242
|
+
return eci
|
243
|
+
else
|
244
|
+
return '07'
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
# Private : Add the 3DSecure infos to XML
|
249
|
+
def add_three_d_secure(xml, options)
|
250
|
+
if options[:three_d_secure]
|
251
|
+
xml.Authentication(:type => '3DSecure') do
|
252
|
+
xml.ResultIndicator eci_to_result_indicator options[:three_d_secure][:eci]
|
253
|
+
xml.Parameter(:name => 'VERIFICATION_ID') { xml.text options[:three_d_secure][:cavv] }
|
254
|
+
xml.Parameter(:name => 'XID') { xml.text options[:three_d_secure][:xid] }
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
228
259
|
# Private: Parse XML response from Monei servers
|
229
260
|
def parse(body)
|
230
261
|
xml = Nokogiri::XML(body)
|
@@ -5,7 +5,7 @@ module ActiveMerchant #:nodoc:
|
|
5
5
|
|
6
6
|
self.supported_countries = ['US']
|
7
7
|
self.default_currency = 'USD'
|
8
|
-
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
|
8
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :alelo]
|
9
9
|
|
10
10
|
self.homepage_url = 'https://www.mundipagg.com/'
|
11
11
|
self.display_name = 'Mundipagg'
|
@@ -155,7 +155,8 @@ module ActiveMerchant #:nodoc:
|
|
155
155
|
post[:customer][:name] = payment.name if post[:customer]
|
156
156
|
post[:customer_id] = parse_auth(payment)[0] if payment.is_a?(String)
|
157
157
|
post[:payment] = {}
|
158
|
-
|
158
|
+
affiliation = options[:gateway_affiliation_id] || @options[:gateway_id]
|
159
|
+
post[:payment][:gateway_affiliation_id] = affiliation if affiliation
|
159
160
|
post[:payment][:metadata] = { mundipagg_payment_method_code: '1' } if test?
|
160
161
|
if voucher?(payment)
|
161
162
|
add_voucher(post, payment, options)
|
@@ -12,7 +12,7 @@ module ActiveMerchant #:nodoc:
|
|
12
12
|
|
13
13
|
self.test_url = 'https://demo.transact.nab.com.au/xmlapi/payment'
|
14
14
|
self.live_url = 'https://transact.nab.com.au/live/xmlapi/payment'
|
15
|
-
self.test_periodic_url = 'https://transact.nab.com.au/
|
15
|
+
self.test_periodic_url = 'https://demo.transact.nab.com.au/xmlapi/periodic'
|
16
16
|
self.live_periodic_url = 'https://transact.nab.com.au/xmlapi/periodic'
|
17
17
|
|
18
18
|
self.supported_countries = ['AU']
|
@@ -31,9 +31,11 @@ module ActiveMerchant #:nodoc:
|
|
31
31
|
post = {}
|
32
32
|
add_invoice(post, amount, options)
|
33
33
|
add_payment_method(post, payment_method, options)
|
34
|
+
add_stored_credential(post, options)
|
34
35
|
add_customer_data(post, options)
|
35
36
|
add_vendor_data(post, options)
|
36
37
|
add_merchant_defined_fields(post, options)
|
38
|
+
add_level3_fields(post, options)
|
37
39
|
|
38
40
|
commit('sale', post)
|
39
41
|
end
|
@@ -42,9 +44,11 @@ module ActiveMerchant #:nodoc:
|
|
42
44
|
post = {}
|
43
45
|
add_invoice(post, amount, options)
|
44
46
|
add_payment_method(post, payment_method, options)
|
47
|
+
add_stored_credential(post, options)
|
45
48
|
add_customer_data(post, options)
|
46
49
|
add_vendor_data(post, options)
|
47
50
|
add_merchant_defined_fields(post, options)
|
51
|
+
add_level3_fields(post, options)
|
48
52
|
|
49
53
|
commit('auth', post)
|
50
54
|
end
|
@@ -81,6 +85,7 @@ module ActiveMerchant #:nodoc:
|
|
81
85
|
add_payment_method(post, payment_method, options)
|
82
86
|
add_customer_data(post, options)
|
83
87
|
add_vendor_data(post, options)
|
88
|
+
add_level3_fields(post, options)
|
84
89
|
|
85
90
|
commit('credit', post)
|
86
91
|
end
|
@@ -91,6 +96,7 @@ module ActiveMerchant #:nodoc:
|
|
91
96
|
add_customer_data(post, options)
|
92
97
|
add_vendor_data(post, options)
|
93
98
|
add_merchant_defined_fields(post, options)
|
99
|
+
add_level3_fields(post, options)
|
94
100
|
|
95
101
|
commit('validate', post)
|
96
102
|
end
|
@@ -117,7 +123,7 @@ module ActiveMerchant #:nodoc:
|
|
117
123
|
|
118
124
|
def scrub(transcript)
|
119
125
|
transcript.
|
120
|
-
gsub(%r((password=)
|
126
|
+
gsub(%r((password=)[^&\n]*), '\1[FILTERED]').
|
121
127
|
gsub(%r((ccnumber=)\d+), '\1[FILTERED]').
|
122
128
|
gsub(%r((cvv=)\d+), '\1[FILTERED]').
|
123
129
|
gsub(%r((checkaba=)\d+), '\1[FILTERED]').
|
@@ -131,6 +137,10 @@ module ActiveMerchant #:nodoc:
|
|
131
137
|
|
132
138
|
private
|
133
139
|
|
140
|
+
def add_level3_fields(post, options)
|
141
|
+
add_fields_to_post_if_present(post, options, [:tax, :shipping, :ponumber])
|
142
|
+
end
|
143
|
+
|
134
144
|
def add_invoice(post, money, options)
|
135
145
|
post[:amount] = amount(money)
|
136
146
|
post[:orderid] = options[:order_id]
|
@@ -170,6 +180,34 @@ module ActiveMerchant #:nodoc:
|
|
170
180
|
end
|
171
181
|
end
|
172
182
|
|
183
|
+
def add_stored_credential(post, options)
|
184
|
+
return unless (stored_credential = options[:stored_credential])
|
185
|
+
|
186
|
+
if stored_credential[:initiator] == 'cardholder'
|
187
|
+
post[:initiated_by] = 'customer'
|
188
|
+
else
|
189
|
+
post[:initiated_by] = 'merchant'
|
190
|
+
end
|
191
|
+
|
192
|
+
# :reason_type, when provided, overrides anything previously set in
|
193
|
+
# post[:billing_method] (see `add_invoice` and the :recurring) option
|
194
|
+
case stored_credential[:reason_type]
|
195
|
+
when 'recurring'
|
196
|
+
post[:billing_method] = 'recurring'
|
197
|
+
when 'installment'
|
198
|
+
post[:billing_method] = 'installment'
|
199
|
+
when 'unscheduled'
|
200
|
+
post.delete(:billing_method)
|
201
|
+
end
|
202
|
+
|
203
|
+
if stored_credential[:initial_transaction]
|
204
|
+
post[:stored_credential_indicator] = 'stored'
|
205
|
+
else
|
206
|
+
post[:stored_credential_indicator] = 'used'
|
207
|
+
post[:initial_transaction_id] = stored_credential[:network_transaction_id]
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
173
211
|
def add_customer_data(post, options)
|
174
212
|
post[:email] = options[:email]
|
175
213
|
post[:ipaddress] = options[:ip]
|