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: ec3f8dfd4d750d78ce90d2df2b9c2af8d14c622812b7db61dab0c43fc333462e
4
- data.tar.gz: 256160687602fed6e849a3e8ca5cd612fba287ca4a17354c422f44c0378d4dba
3
+ metadata.gz: ce3933d8c3bbc17e45b003dc16033a9f0d4802b1baac54b09b938a8bfaf09c85
4
+ data.tar.gz: af7a7d9c97bf5e10daa9b4f873e62b72f031169332c4846c7e3200f90bc97775
5
5
  SHA512:
6
- metadata.gz: afdf43d4a69d9e31a2bc50b5d8e90015e812be6e7a21f8f81dde56391ce2612b2e61c17badc82c02813ac4c534e83d83fb392f81c8f6bd6e7cde71c5272d3c0a
7
- data.tar.gz: 392b52af17aaa208f47f5a0c034836a9f45af7209b85b5e246c2b093c9cb0afd9f5907eecd24316be849f1a54118c1272b4eac471350f67e0eb88e9096ad16a7
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
- els
22
- errors << [:brand, 'is invalid'] unless self.class.card_companies.include?(brand)
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] || currency(money)
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(options)
309
- { data: { customer: {} } }.merge!(options.fetch(:payload, {}))
310
+ def build_payload(params)
311
+ { data: { customer: {} } }.merge!(params.fetch(:payload, {}))
310
312
  end
311
313
 
312
314
  def base_headers(custom = {})
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NexioActivemerchant
4
- VERSION = '0.2.1'
4
+ VERSION = '0.2.5'
5
5
  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.1
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-08-05 00:00:00.000000000 Z
11
+ date: 2021-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemerchant