nexio_activemerchant 0.2.3 → 0.2.7
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: '09b41171285a1391d8d99233c196e387bc1822c3efdbb8187eb8422764f1beae'
|
4
|
+
data.tar.gz: 85f11b3a8a146594f3f0919a1f8b3aa2a6a5415c342b541931acea748ce81c94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '094f7c5d9058ef1ceb7ed58fc77f217c0190175a64f75a24027909d75003b3bd4b7da8812a3b972b62b864e5f123e63c38129856ad74f0d5483592cc803377c0'
|
7
|
+
data.tar.gz: b82b1e74e01c35752e1f64e4949ccb038b841d62e32686590a58e3aba1ee2dd6959883fda3d0e9a7529130b86b216419f3983ee1b3ade95b0b93b18500a3fcae
|
@@ -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,7 +20,7 @@ module ActiveMerchant
|
|
18
20
|
|
19
21
|
if empty?(brand)
|
20
22
|
errors << [:brand, 'is required'] if own_form
|
21
|
-
elsif !
|
23
|
+
elsif !ALLOWED_CARD_BRANDS.include?(brand)
|
22
24
|
errors << [:brand, 'is invalid']
|
23
25
|
end
|
24
26
|
|
@@ -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)
|
@@ -171,15 +172,12 @@ module ActiveMerchant
|
|
171
172
|
def add_address(post, data, prefix)
|
172
173
|
return post if data.blank?
|
173
174
|
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
"#{prefix}Postal": data[:zip],
|
181
|
-
"#{prefix}State": data[:state]
|
182
|
-
})
|
175
|
+
{
|
176
|
+
AddressOne: :address1, AddressTwo: :address2, City: :city,
|
177
|
+
Country: :country, Phone: :phone, Postal: :zip, State: :state
|
178
|
+
}.each do |suffix, key|
|
179
|
+
post[:data][:customer]["#{prefix}#{suffix}"] = data[key] if data[key].present?
|
180
|
+
end
|
183
181
|
end
|
184
182
|
|
185
183
|
def add_payment(post, payment, options)
|
@@ -188,7 +186,7 @@ module ActiveMerchant
|
|
188
186
|
post[:card] = {
|
189
187
|
cardHolderName: payment.name,
|
190
188
|
cardType: payment.brand
|
191
|
-
}
|
189
|
+
}.merge!(post.fetch(:card, {}))
|
192
190
|
end
|
193
191
|
post[:processingOptions] ||= {}
|
194
192
|
post[:processingOptions][:merchantId] = self.options[:merchant_id].to_s
|
@@ -253,6 +251,7 @@ module ActiveMerchant
|
|
253
251
|
network_transaction_id: payload['id']
|
254
252
|
)
|
255
253
|
rescue ResponseError => e
|
254
|
+
logger&.error e.response.body
|
256
255
|
error_payload = parse(e.response.body)
|
257
256
|
Response.new(
|
258
257
|
false,
|
@@ -276,7 +275,7 @@ module ActiveMerchant
|
|
276
275
|
end
|
277
276
|
|
278
277
|
def post_data(_action, parameters = {})
|
279
|
-
parameters.to_json
|
278
|
+
{ merchantId: options[:merchant_id] }.merge(parameters).to_json
|
280
279
|
end
|
281
280
|
|
282
281
|
def commit_action_url(action, _parameters)
|
@@ -305,8 +304,8 @@ module ActiveMerchant
|
|
305
304
|
CVVResult.new(data.fetch('gatewayMessage', {}).fetch('cvvresponse', nil))
|
306
305
|
end
|
307
306
|
|
308
|
-
def build_payload(
|
309
|
-
{ data: { customer: {} } }.merge!(
|
307
|
+
def build_payload(params)
|
308
|
+
{ data: { customer: {} } }.merge!(params.fetch(:payload, {}))
|
310
309
|
end
|
311
310
|
|
312
311
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Whitespectre
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08
|
11
|
+
date: 2021-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|