nexio_activemerchant 0.2.1 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce3933d8c3bbc17e45b003dc16033a9f0d4802b1baac54b09b938a8bfaf09c85
|
4
|
+
data.tar.gz: af7a7d9c97bf5e10daa9b4f873e62b72f031169332c4846c7e3200f90bc97775
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcfa1414b66c46fcbaf64f3e0d3bc95b3c6bd4097325370084c4696282f4d659b7146d1f43d9991c38f4090a6223594fe2ed1c2ca1c8c62c40a10fe48937cd54
|
7
|
+
data.tar.gz: 12695b194b5180d20fe6961ee48f3cf0697823e3a2ea08360c16a5202075d8c24c8e4aa16caceb50f6c1f584b1d43476db640bc3cd1af78fc3c06dab69a04b40
|
@@ -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)
|
@@ -125,7 +126,7 @@ module ActiveMerchant
|
|
125
126
|
end
|
126
127
|
|
127
128
|
def add_currency(post, options)
|
128
|
-
post[:data][:currency] = options[:currency]
|
129
|
+
post[:data][:currency] = options[:currency] if options.key?(:currency)
|
129
130
|
end
|
130
131
|
|
131
132
|
def add_order_data(post, options)
|
@@ -253,6 +254,7 @@ module ActiveMerchant
|
|
253
254
|
network_transaction_id: payload['id']
|
254
255
|
)
|
255
256
|
rescue ResponseError => e
|
257
|
+
logger&.error e.response.body
|
256
258
|
error_payload = parse(e.response.body)
|
257
259
|
Response.new(
|
258
260
|
false,
|
@@ -276,7 +278,7 @@ module ActiveMerchant
|
|
276
278
|
end
|
277
279
|
|
278
280
|
def post_data(_action, parameters = {})
|
279
|
-
parameters.to_json
|
281
|
+
{ merchantId: options[:merchant_id] }.merge(parameters).to_json
|
280
282
|
end
|
281
283
|
|
282
284
|
def commit_action_url(action, _parameters)
|
@@ -305,8 +307,8 @@ module ActiveMerchant
|
|
305
307
|
CVVResult.new(data.fetch('gatewayMessage', {}).fetch('cvvresponse', nil))
|
306
308
|
end
|
307
309
|
|
308
|
-
def build_payload(
|
309
|
-
{ data: { customer: {} } }.merge!(
|
310
|
+
def build_payload(params)
|
311
|
+
{ data: { customer: {} } }.merge!(params.fetch(:payload, {}))
|
310
312
|
end
|
311
313
|
|
312
314
|
def base_headers(custom = {})
|
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.5
|
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-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|