nexio_activemerchant 0.2.0 → 0.2.4
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75aed4f978138206f5c7fc033bb0e0a81faf69dac593a26a68661a265de059b5
|
4
|
+
data.tar.gz: 97fc92fe19530378d0d86d9dc625310ac1de2db40dca87264a806c97facc0116
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f2ab0d0573a9311d7f3753839f39fe9581aab93cf9e30711472edce47f8569365262dec46a09375607ea99f0d9fdbae287a42635bcf748885e836a8353830d3
|
7
|
+
data.tar.gz: 870d45d255eeb17b8ab5d84f80f06e8f05950fb32671ced3a14aa35d816131d85209b531c45a1d3e7523a9f649433d589de81344a74bd289510b0576e392623b
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module ActiveMerchant
|
4
4
|
module Billing
|
5
5
|
class EncryptedNexioCard < CreditCard
|
6
|
+
ALLOWED_CARD_BRANDS = %w(amex discover jcb mastercard visa).freeze
|
7
|
+
|
6
8
|
attr_accessor :encrypted_number, :own_form, :one_time_token
|
7
9
|
|
8
10
|
attr_reader :brand
|
@@ -18,8 +20,8 @@ module ActiveMerchant
|
|
18
20
|
|
19
21
|
if empty?(brand)
|
20
22
|
errors << [:brand, 'is required'] if own_form
|
21
|
-
|
22
|
-
errors << [:brand, 'is invalid']
|
23
|
+
elsif !ALLOWED_CARD_BRANDS.include?(brand)
|
24
|
+
errors << [:brand, 'is invalid']
|
23
25
|
end
|
24
26
|
|
25
27
|
errors << [:encrypted_number, 'is required'] if empty?(encrypted_number)
|
@@ -26,6 +26,7 @@ module ActiveMerchant
|
|
26
26
|
|
27
27
|
def generate_token(options = {})
|
28
28
|
post = build_payload(options)
|
29
|
+
post[:data][:allowedCardTypes] = %w(amex discover jcb mastercard visa)
|
29
30
|
add_currency(post, options)
|
30
31
|
add_order_data(post, options)
|
31
32
|
add_card_data(post, options)
|
@@ -42,6 +43,7 @@ module ActiveMerchant
|
|
42
43
|
post[:processingOptions][:verboseResponse] = true if test?
|
43
44
|
post[:processingOptions][:customerRedirectUrl] = options[:three_d_callback_url] if options.key?(:three_d_callback_url)
|
44
45
|
post[:processingOptions][:check3ds] = options[:three_d_secure]
|
46
|
+
post[:processingOptions][:paymentType] = options[:payment_type] if options.key?(:payment_type)
|
45
47
|
add_invoice(post, money, options)
|
46
48
|
add_payment(post, payment, options)
|
47
49
|
add_order_data(post, options)
|
@@ -111,6 +113,11 @@ module ActiveMerchant
|
|
111
113
|
commit('secret', { merchantId: options[:merchant_id].to_s }).params['secret']
|
112
114
|
end
|
113
115
|
|
116
|
+
def get_transaction(id)
|
117
|
+
parse(ssl_get(action_url("/transaction/v3/paymentId/#{id}"), base_headers))
|
118
|
+
rescue ResponseError => e
|
119
|
+
end
|
120
|
+
|
114
121
|
private
|
115
122
|
|
116
123
|
def add_invoice(post, money, options)
|
@@ -119,7 +126,7 @@ module ActiveMerchant
|
|
119
126
|
end
|
120
127
|
|
121
128
|
def add_currency(post, options)
|
122
|
-
post[:data][:currency] = options[:currency]
|
129
|
+
post[:data][:currency] = options[:currency] if options.key?(:currency)
|
123
130
|
end
|
124
131
|
|
125
132
|
def add_order_data(post, options)
|
@@ -234,8 +241,7 @@ module ActiveMerchant
|
|
234
241
|
end
|
235
242
|
|
236
243
|
def commit(action, parameters)
|
237
|
-
payload = parse(ssl_post(commit_action_url(action, parameters), post_data(action, parameters),
|
238
|
-
Authorization: "Basic #{options[:auth_token]}"))
|
244
|
+
payload = parse(ssl_post(commit_action_url(action, parameters), post_data(action, parameters), base_headers))
|
239
245
|
|
240
246
|
Response.new(
|
241
247
|
response_status(action, payload),
|
@@ -281,6 +287,10 @@ module ActiveMerchant
|
|
281
287
|
else
|
282
288
|
"/pay/v3/#{action}"
|
283
289
|
end
|
290
|
+
action_url(path)
|
291
|
+
end
|
292
|
+
|
293
|
+
def action_url(path)
|
284
294
|
"#{test? ? test_url : live_url}#{path}"
|
285
295
|
end
|
286
296
|
|
@@ -299,6 +309,10 @@ module ActiveMerchant
|
|
299
309
|
def build_payload(options)
|
300
310
|
{ data: { customer: {} } }.merge!(options.fetch(:payload, {}))
|
301
311
|
end
|
312
|
+
|
313
|
+
def base_headers(custom = {})
|
314
|
+
{ Authorization: "Basic #{options[:auth_token]}" }
|
315
|
+
end
|
302
316
|
end
|
303
317
|
end
|
304
318
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nexio_activemerchant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Whitespectre
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|