nexio_activemerchant 0.4.0 → 0.4.2
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: 59dd2e649d9d7366b3b117a7f1b4848a0aed17af38054059c165a85131e64b5e
|
4
|
+
data.tar.gz: a2ef3247bc366edc6ff6be8e18a1cc2ce1a09d4943ebdcf9cb9d850778ea4efc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aba0211afbdb40d68e3d169e6e1249cbc6fa4435da040a4dbb30783fc93f20bc43c1f436631e35ae03b33ac633d4e8507e9467846638eac2553c71a7b835aa90
|
7
|
+
data.tar.gz: 88c3f83b39acb2e7cbe1092bbdb79a21d879e9591d0215ece284343cba89c84240496eca13421dac89ed5f2c89650ea9dc1840dac3b3d141f4b81f017da1c88e
|
data/.gitignore
CHANGED
@@ -9,7 +9,7 @@ module ActiveMerchant
|
|
9
9
|
self.base_path = '/apm/v3'
|
10
10
|
self.abstract_class = false
|
11
11
|
|
12
|
-
OneTimeToken = Struct.new(:token, :iframe_url, :redirect_urls, :button_urls)
|
12
|
+
OneTimeToken = Struct.new(:token, :iframe_url, :script_url, :redirect_urls, :button_urls)
|
13
13
|
|
14
14
|
def generate_token(money, options = {})
|
15
15
|
post = build_payload(options)
|
@@ -25,6 +25,7 @@ module ActiveMerchant
|
|
25
25
|
OneTimeToken.new(
|
26
26
|
resp.params['token'],
|
27
27
|
resp.params['expressIFrameUrl'],
|
28
|
+
resp.params['scriptUrl'],
|
28
29
|
map_urls(resp.params['redirectUrls']),
|
29
30
|
map_urls(resp.params['buttonIFrameUrls'])
|
30
31
|
)
|
@@ -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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Whitespectre
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '0'
|
88
88
|
requirements: []
|
89
|
-
rubygems_version: 3.1.
|
89
|
+
rubygems_version: 3.1.6
|
90
90
|
signing_key:
|
91
91
|
specification_version: 4
|
92
92
|
summary: ActiveMechant gateway for Nexio
|