nexio_activemerchant 0.4.0 → 0.4.1
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: 8267f1055cb04161ae87bca490199fbaf4ab95a67eb0232b956590fa87cfb0e0
|
4
|
+
data.tar.gz: 24984f56bd8933454549c8eadacfc1df478e72beeb083d2f0ea542fc2076b59d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b888126145cc8f56083f141b46c11b4a865722a713e655381c06205268559783facc7f78f62df2098ff9cb9bc7ca41c3fc668742aeaab94635265e746c6680d4
|
7
|
+
data.tar.gz: 89a14ea14571922157ec962c845ae9c0b254e63085fd4ab4763c5d0d98a20970789901c226c444935b82eb89b835e74f6175e005910d7f3c38df5e7efba95d94
|
@@ -24,16 +24,16 @@ module ActiveMerchant
|
|
24
24
|
OneTimeToken.new(token, Time.parse(expiration), fraud_url)
|
25
25
|
end
|
26
26
|
|
27
|
-
def purchase(money,
|
27
|
+
def purchase(money, source, options = {})
|
28
28
|
post = build_payload(options)
|
29
29
|
add_invoice(post, money, options)
|
30
|
-
add_payment(post,
|
30
|
+
add_payment(post, source, options)
|
31
31
|
add_order_data(post, options)
|
32
32
|
commit('process', post)
|
33
33
|
end
|
34
34
|
|
35
|
-
def authorize(money,
|
36
|
-
purchase(money,
|
35
|
+
def authorize(money, source, options = {})
|
36
|
+
purchase(money, source, options.merge(payload: options.fetch(:payload, {}).merge(isAuthOnly: true)))
|
37
37
|
end
|
38
38
|
|
39
39
|
def verify(credit_card, options = {})
|
@@ -43,10 +43,10 @@ module ActiveMerchant
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
def store(
|
46
|
+
def store(source, options = {})
|
47
47
|
post = build_payload(options)
|
48
48
|
post[:merchantId] ||= options[:merchant_id]
|
49
|
-
add_card_details(post,
|
49
|
+
add_card_details(post, source, options)
|
50
50
|
add_currency(post, options)
|
51
51
|
add_order_data(post, options)
|
52
52
|
resp = commit('saveCard', post)
|
@@ -57,14 +57,14 @@ module ActiveMerchant
|
|
57
57
|
|
58
58
|
private
|
59
59
|
|
60
|
-
def add_payment(post,
|
61
|
-
post[:tokenex] = token_from(
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
}.merge!(post.fetch(:card, {}))
|
60
|
+
def add_payment(post, source, options)
|
61
|
+
post[:tokenex] = token_from(source)
|
62
|
+
post[:card] ||= {}
|
63
|
+
if source.is_a?(Spree::CreditCard)
|
64
|
+
post[:card][:cardHolderName] = source.name
|
65
|
+
post[:card][:cardType] = source.brand
|
67
66
|
end
|
67
|
+
post[:card][:securityCode] = options.dig(:card, :cvv) if options.dig(:card, :cvv)
|
68
68
|
post[:processingOptions][:saveCardToken] = options[:save_credit_card] if options.key?(:save_credit_card)
|
69
69
|
if options[:three_d_callback_url].present?
|
70
70
|
post[:processingOptions][:customerRedirectUrl] = options[:three_d_callback_url]
|
@@ -73,23 +73,24 @@ module ActiveMerchant
|
|
73
73
|
post[:processingOptions][:paymentType] = options[:payment_type] if options[:payment_type].present?
|
74
74
|
end
|
75
75
|
|
76
|
-
def token_from(
|
77
|
-
return { token:
|
76
|
+
def token_from(source)
|
77
|
+
return { token: source } if source.is_a?(String)
|
78
78
|
|
79
79
|
{
|
80
|
-
token:
|
81
|
-
lastFour:
|
82
|
-
cardType:
|
80
|
+
token: source.gateway_payment_profile_id,
|
81
|
+
lastFour: source.last_digits,
|
82
|
+
cardType: source.brand
|
83
83
|
}
|
84
84
|
end
|
85
85
|
|
86
86
|
def add_card_data(post, options)
|
87
87
|
if card = options[:card]
|
88
|
-
post[:card]
|
88
|
+
post[:card] ||= {}
|
89
|
+
post[:card].merge!(
|
89
90
|
cardHolderName: card[:name],
|
90
91
|
expirationMonth: card[:month],
|
91
92
|
expirationYear: card[:year]
|
92
|
-
|
93
|
+
)
|
93
94
|
end
|
94
95
|
end
|
95
96
|
|
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.4.
|
4
|
+
version: 0.4.1
|
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-
|
11
|
+
date: 2021-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|