active_merchant-epsilon 0.12.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +24 -0
- data/CHANGELOG.md +8 -0
- data/README.md +51 -0
- data/lib/active_merchant/billing/gateways/epsilon/epsilon_base.rb +1 -0
- data/lib/active_merchant/billing/gateways/epsilon.rb +27 -0
- data/lib/active_merchant/billing/gateways/response_parser.rb +17 -6
- data/lib/active_merchant/epsilon/version.rb +1 -1
- data/test/fixtures/vcr_cassettes/authenticate_with_three_d_secure_2_successful.yml +51 -0
- data/test/fixtures/vcr_cassettes/purchase_with_three_d_secure_2_successful.yml +51 -0
- data/test/remote/gateways/remote_epsilon_convenience_store_test.rb +5 -5
- data/test/remote/gateways/remote_epsilon_test.rb +58 -2
- data/test/test_helper.rb +27 -0
- metadata +7 -5
- data/.travis.yml +0 -12
- data/test/remote/gateways/remote_epsilon_gmo_after_test.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fe0b19a8605e29e5c3a2a310e3b9684767a21fb2f93957342ffd41b9135657e
|
4
|
+
data.tar.gz: b8eb1a2b4d150c0696d26a52e58f5069a60542739bc6461d61f864ad20a470db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87d7533d96fd6591a2b4ffeb78c7cfe2de4ad987e41c58be72083672f346178be6fa593e3aad6a5f3b66b0dde708e883d6d82a8c864a05006589d33a2978b41c
|
7
|
+
data.tar.gz: '0782a6f4c48fcc0e905a7b72205d5511bea0ffa95ca285dceee5058d97ae0d63e25fc2e2b009910b800c398b2cb07451cb525f8d0ee1f58696228c487f2f4106'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
name: test
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches:
|
5
|
+
- master
|
6
|
+
pull_request:
|
7
|
+
jobs:
|
8
|
+
test-all:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
|
11
|
+
strategy:
|
12
|
+
fail-fast: false
|
13
|
+
matrix:
|
14
|
+
ruby-version: [2.4, 2.5, 2.6, 2.7, 3.0]
|
15
|
+
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v2
|
18
|
+
|
19
|
+
- uses: ruby/setup-ruby@v1.63.0
|
20
|
+
with:
|
21
|
+
ruby-version: ${{ matrix.ruby-version }}
|
22
|
+
bundler-cache: true
|
23
|
+
|
24
|
+
- run: bundle exec rake test:unit test:remote
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
### 0.14.0
|
4
|
+
|
5
|
+
- [Support 3D Secure 2.0 for credit card payments](https://github.com/pepabo/active_merchant-epsilon/pull/121)
|
6
|
+
|
7
|
+
### 0.13.0
|
8
|
+
|
9
|
+
- [Add `last-update` to OrderResponse](https://github.com/pepabo/active_merchant-epsilon/pull/118)
|
10
|
+
|
3
11
|
### 0.12.0
|
4
12
|
|
5
13
|
- [Add Parameter `delivery_info_required` to purchase method for Epsilon Link Payment](https://github.com/pepabo/active_merchant-epsilon/pull/116)
|
data/README.md
CHANGED
@@ -159,6 +159,57 @@ purchase_detail = {
|
|
159
159
|
# (snip)
|
160
160
|
```
|
161
161
|
|
162
|
+
### CreditCard Payment with 3D secure 2.0(with token)
|
163
|
+
|
164
|
+
```ruby
|
165
|
+
# 3D secure 2.0 does not have a test environment for epsilon
|
166
|
+
ActiveMerchant::Billing::Base.mode = :production
|
167
|
+
|
168
|
+
amount = 1000
|
169
|
+
purchase_detail = {
|
170
|
+
user_id: 'YOUR_APP_USER_IDENTIFIER',
|
171
|
+
user_name: '山田 太郎',
|
172
|
+
user_email: 'yamada-taro@example.com',
|
173
|
+
item_code: 'ITEM001',
|
174
|
+
item_name: 'Greate Product',
|
175
|
+
order_number: 'UNIQUE ORDER NUMBER',
|
176
|
+
three_d_secure_check_code: 1,
|
177
|
+
token: 'CREDIT CARD TOKEN'
|
178
|
+
tds_flag: 21 # 21 or 22
|
179
|
+
# optional:
|
180
|
+
# add params for risk-based certification(billAddrCity etc...)
|
181
|
+
}
|
182
|
+
|
183
|
+
response = gateway.purchase(amount, ActiveMerchant::Billing::CreditCard.new, purchase_detail)
|
184
|
+
|
185
|
+
if response.success?
|
186
|
+
if response.params['three_d_secure']
|
187
|
+
puts response.params['tds2_url']
|
188
|
+
puts response.params['pa_req']
|
189
|
+
else
|
190
|
+
# NOT 3D SECURE
|
191
|
+
puts "Successfully charged #{amount} yen as credit card payment(not 3D secure)"
|
192
|
+
end
|
193
|
+
else
|
194
|
+
raise StandardError, response.message
|
195
|
+
end
|
196
|
+
|
197
|
+
# (The card holder identifies himself on credit card's page and comes back here)
|
198
|
+
|
199
|
+
# AND SECOND REQUEST
|
200
|
+
|
201
|
+
response = gateway.authenticate(
|
202
|
+
order_number: 'ORDER NUMBER',
|
203
|
+
three_d_secure_pares: 'PAYMENT AUTHENTICATION RESPONSE',
|
204
|
+
)
|
205
|
+
|
206
|
+
if response.success?
|
207
|
+
puts 'Successfully charged as credit card payment(3D secure 2.0)'
|
208
|
+
else
|
209
|
+
raise StandardError, response.message
|
210
|
+
end
|
211
|
+
```
|
212
|
+
|
162
213
|
### CreditCard Revolving Payment
|
163
214
|
|
164
215
|
```ruby
|
@@ -22,6 +22,20 @@ module ActiveMerchant #:nodoc:
|
|
22
22
|
capture: 'sales_payment.cgi',
|
23
23
|
}.freeze
|
24
24
|
|
25
|
+
RISK_BASE_AUTH_PARAMS_KEYS = %i[
|
26
|
+
tds_flag billAddrCity billAddrCountry billAddrLine1 billAddrLine2 billAddrLine3
|
27
|
+
billAddrPostCode billAddrState shipAddrCity shipAddrCountry shipAddrLine1 shipAddrLine2
|
28
|
+
shipAddrLine3 shipAddrPostCode shipAddrState chAccAgeInd chAccChange
|
29
|
+
chAccChangeIndchAccDate chAccPwdChange chAccPwChangeInd nbPurchaseAccount paymentAccAge
|
30
|
+
paymentAccInd provisionAttemptsDay shipAddressUsage shipAddressUsageInd shipNameIndicator
|
31
|
+
suspiciousAccActivity txnActivityDay txnActivityYear threeDSReqAuthData threeDSReqAuthMethod
|
32
|
+
threeDSReqAuthTimestamp addrMatch cardholderName homePhone mobilePhone
|
33
|
+
workPhone challengeInd deliveryEmailAddress deliveryTimeframe giftCardAmount
|
34
|
+
giftCardCount preOrderDate preOrderPurchaseInd reorderItemsInd shipIndicator
|
35
|
+
].freeze
|
36
|
+
|
37
|
+
THREE_D_SECURE_2_INDICATORS = [21, 22].freeze
|
38
|
+
|
25
39
|
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
|
26
40
|
|
27
41
|
def purchase(amount, credit_card, detail = {})
|
@@ -29,6 +43,10 @@ module ActiveMerchant #:nodoc:
|
|
29
43
|
|
30
44
|
params = billing_params(amount, credit_card, detail)
|
31
45
|
|
46
|
+
if three_d_secure_2?(detail)
|
47
|
+
params.merge!(detail.slice(*RISK_BASE_AUTH_PARAMS_KEYS).compact)
|
48
|
+
end
|
49
|
+
|
32
50
|
commit(PATHS[:purchase], params)
|
33
51
|
end
|
34
52
|
|
@@ -54,6 +72,10 @@ module ActiveMerchant #:nodoc:
|
|
54
72
|
params[:memo2] = detail[:memo2] if detail.has_key?(:memo2)
|
55
73
|
params[:kari_flag] = detail[:capture] ? 2 : 1 if detail.has_key?(:capture)
|
56
74
|
|
75
|
+
if three_d_secure_2?(detail)
|
76
|
+
params.merge!(detail.slice(*RISK_BASE_AUTH_PARAMS_KEYS).compact)
|
77
|
+
end
|
78
|
+
|
57
79
|
commit(PATHS[:registered_purchase], params)
|
58
80
|
end
|
59
81
|
|
@@ -177,6 +199,7 @@ module ActiveMerchant #:nodoc:
|
|
177
199
|
response_keys = [
|
178
200
|
:transaction_code,
|
179
201
|
:state,
|
202
|
+
:last_update,
|
180
203
|
:payment_code,
|
181
204
|
:item_price,
|
182
205
|
:amount,
|
@@ -238,6 +261,10 @@ module ActiveMerchant #:nodoc:
|
|
238
261
|
|
239
262
|
params
|
240
263
|
end
|
264
|
+
|
265
|
+
def three_d_secure_2?(detail)
|
266
|
+
THREE_D_SECURE_2_INDICATORS.include?(detail[:tds_flag])
|
267
|
+
end
|
241
268
|
end
|
242
269
|
end
|
243
270
|
end
|
@@ -10,7 +10,7 @@ module ActiveMerchant #:nodoc:
|
|
10
10
|
@result = @xml.xpath(ResponseXpath::RESULT).to_s
|
11
11
|
|
12
12
|
response = {
|
13
|
-
success: [ResultCode::SUCCESS, ResultCode::
|
13
|
+
success: [ResultCode::SUCCESS, ResultCode::THREE_D_SECURE_1, ResultCode::THREE_D_SECURE_2].include?(@result) || !state.empty?,
|
14
14
|
message: "#{error_code}: #{error_detail}"
|
15
15
|
}
|
16
16
|
|
@@ -48,7 +48,7 @@ module ActiveMerchant #:nodoc:
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def three_d_secure
|
51
|
-
|
51
|
+
[ResultCode::THREE_D_SECURE_1, ResultCode::THREE_D_SECURE_2].include?(@result)
|
52
52
|
end
|
53
53
|
|
54
54
|
def acs_url
|
@@ -59,6 +59,10 @@ module ActiveMerchant #:nodoc:
|
|
59
59
|
uri_decode(@xml.xpath(ResponseXpath::PA_REQ).to_s)
|
60
60
|
end
|
61
61
|
|
62
|
+
def tds2_url
|
63
|
+
uri_decode(@xml.xpath(ResponseXpath::TDS2_URL).to_s)
|
64
|
+
end
|
65
|
+
|
62
66
|
def receipt_number
|
63
67
|
@xml.xpath(ResponseXpath::RECEIPT_NUMBER).to_s
|
64
68
|
end
|
@@ -107,6 +111,10 @@ module ActiveMerchant #:nodoc:
|
|
107
111
|
@xml.xpath(ResponseXpath::STATE).to_s
|
108
112
|
end
|
109
113
|
|
114
|
+
def last_update
|
115
|
+
@xml.xpath(ResponseXpath::LAST_UPDATE).to_s
|
116
|
+
end
|
117
|
+
|
110
118
|
def payment_code
|
111
119
|
@xml.xpath(ResponseXpath::PAYMENT_CODE).to_s
|
112
120
|
end
|
@@ -141,6 +149,7 @@ module ActiveMerchant #:nodoc:
|
|
141
149
|
CARD_EXPIRE = '//Epsilon_result/result[@card_expire]/@card_expire'
|
142
150
|
ACS_URL = '//Epsilon_result/result[@acsurl]/@acsurl' # ACS (Access Control Server)
|
143
151
|
PA_REQ = '//Epsilon_result/result[@pareq]/@pareq' # PAReq (payer authentication request)
|
152
|
+
TDS2_URL = '//Epsilon_result/result[@tds2_url]/@tds2_url'
|
144
153
|
RECEIPT_NUMBER = '//Epsilon_result/result[@receipt_no][1]/@receipt_no'
|
145
154
|
RECEIPT_DATE = '//Epsilon_result/result[@receipt_date][1]/@receipt_date'
|
146
155
|
CONVENIENCE_STORE_LIMIT_DATE = '//Epsilon_result/result[@conveni_limit][1]/@conveni_limit'
|
@@ -153,6 +162,7 @@ module ActiveMerchant #:nodoc:
|
|
153
162
|
BRANCH_CODE = '//Epsilon_result/result[@branch_code][1]/@branch_code'
|
154
163
|
BRANCH_NAME = '//Epsilon_result/result[@branch_name][1]/@branch_name'
|
155
164
|
STATE = '//Epsilon_result/result[@state]/@state'
|
165
|
+
LAST_UPDATE = '//Epsilon_result/result[@last_update]/@last_update'
|
156
166
|
ITEM_PRICE = '//Epsilon_result/result[@item_price]/@item_price'
|
157
167
|
PAYMENT_CODE = '//Epsilon_result/result[@payment_code]/@payment_code'
|
158
168
|
AMOUNT = '//Epsilon_result/result[@amount]/@amount'
|
@@ -161,10 +171,11 @@ module ActiveMerchant #:nodoc:
|
|
161
171
|
end
|
162
172
|
|
163
173
|
module ResultCode
|
164
|
-
FAILURE
|
165
|
-
SUCCESS
|
166
|
-
|
167
|
-
|
174
|
+
FAILURE = '0'
|
175
|
+
SUCCESS = '1'
|
176
|
+
THREE_D_SECURE_1 = '5'
|
177
|
+
THREE_D_SECURE_2 = '6'
|
178
|
+
SYSTEM_ERROR = '9'
|
168
179
|
end
|
169
180
|
end
|
170
181
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://secure.epsilon.jp/cgi-bin/order/direct_card_payment.cgi
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: contract_code=[CONTRACT_CODE]&order_number=O30189731&tds_check_code=2&tds_pares=dummy+pa_res
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/x-www-form-urlencoded
|
12
|
+
Connection:
|
13
|
+
- close
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
+
Accept:
|
17
|
+
- "*/*"
|
18
|
+
User-Agent:
|
19
|
+
- Ruby
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Thu, 15 Sep 2022 08:09:38 GMT
|
27
|
+
Server:
|
28
|
+
- Apache
|
29
|
+
Vary:
|
30
|
+
- Accept-Encoding
|
31
|
+
Content-Length:
|
32
|
+
- '161'
|
33
|
+
Connection:
|
34
|
+
- close
|
35
|
+
Content-Type:
|
36
|
+
- text/xml; charset=CP932
|
37
|
+
body:
|
38
|
+
encoding: ASCII-8BIT
|
39
|
+
string: |-
|
40
|
+
<?xml version="1.0" encoding="x-sjis-cp932"?>
|
41
|
+
<Epsilon_result>
|
42
|
+
<result acsurl="" />
|
43
|
+
<result err_code="" />
|
44
|
+
<result err_detail="" />
|
45
|
+
<result kari_flag="0" />
|
46
|
+
<result pareq="" />
|
47
|
+
<result result="1" />
|
48
|
+
<result trans_code="257072796" />
|
49
|
+
</Epsilon_result>
|
50
|
+
recorded_at: Thu, 15 Sep 2022 08:09:38 GMT
|
51
|
+
recorded_with: VCR 6.1.0
|
@@ -0,0 +1,51 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://secure.epsilon.jp/cgi-bin/order/direct_card_payment.cgi
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: contract_code=[CONTRACT_CODE]&user_id=124014051&user_name=YAMADA+TARO&user_mail_add=yamada-taro%40example.com&item_code=ITEM001&item_name=Greate+Product&order_number=O1663728963&st_code=10000-0000-0000&mission_code=1&item_price=1000&process_code=2&card_st_code=&pay_time=&xml=1&tds_flag=21
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/x-www-form-urlencoded
|
12
|
+
Connection:
|
13
|
+
- close
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
+
Accept:
|
17
|
+
- "*/*"
|
18
|
+
User-Agent:
|
19
|
+
- Ruby
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Wed, 21 Sep 2022 02:56:03 GMT
|
27
|
+
Server:
|
28
|
+
- Apache
|
29
|
+
Vary:
|
30
|
+
- Accept-Encoding
|
31
|
+
Content-Length:
|
32
|
+
- '234'
|
33
|
+
Connection:
|
34
|
+
- close
|
35
|
+
Content-Type:
|
36
|
+
- text/xml; charset=CP932
|
37
|
+
body:
|
38
|
+
encoding: ASCII-8BIT
|
39
|
+
string: |-
|
40
|
+
<?xml version="1.0" encoding="x-sjis-cp932"?>
|
41
|
+
<Epsilon_result>
|
42
|
+
<result acsurl="" />
|
43
|
+
<result err_code="" />
|
44
|
+
<result err_detail="" />
|
45
|
+
<result pareq="sOuxTX%252BZHCDBJKRdKkN2Iw53" />
|
46
|
+
<result result="6" />
|
47
|
+
<result tds2_url="https%3A%2F%2Fsecure.epsilon.jp%2Fcgi-bin%2Forder%2Ftds2.cgi" />
|
48
|
+
<result trans_code="257810878" />
|
49
|
+
</Epsilon_result>
|
50
|
+
recorded_at: Wed, 21 Sep 2022 02:56:04 GMT
|
51
|
+
recorded_with: VCR 6.1.0
|
@@ -12,11 +12,11 @@ class RemoteEpsilonConvenienceStoreGatewayTest < MiniTest::Test
|
|
12
12
|
response = gateway.purchase(10000, valid_convenience_store, purchase_detail)
|
13
13
|
|
14
14
|
assert_equal true, response.success?
|
15
|
-
assert_match
|
16
|
-
assert_match
|
17
|
-
assert_match
|
18
|
-
assert_match
|
19
|
-
assert_match
|
15
|
+
assert_match(/\d{7}/, response.params['receipt_number'])
|
16
|
+
assert_match(/\d{4}\-\d{2}\-\d{2} \d{2}:\d{2}:\d{2}/, response.params['receipt_date'])
|
17
|
+
assert_match(/\d{4}\-\d{2}\-\d{2}/, response.params['convenience_store_limit_date'])
|
18
|
+
assert_match(%r!\Ahttp://.+!, response.params['convenience_store_payment_slip_url'])
|
19
|
+
assert_match(/\d{5}/, response.params['company_code'])
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -62,16 +62,47 @@ class RemoteEpsilonGatewayTest < MiniTest::Test
|
|
62
62
|
|
63
63
|
assert_equal true, response.success?
|
64
64
|
assert_equal true, response.params['three_d_secure']
|
65
|
-
assert_match
|
65
|
+
assert_match(/\Ahttps?/, response.params['acs_url'])
|
66
66
|
refute_empty response.params['pa_req']
|
67
67
|
end
|
68
68
|
|
69
69
|
VCR.use_cassette(:autheticate_three_d_secure_card_successful) do
|
70
|
-
response = gateway.authenticate(
|
70
|
+
response = gateway.authenticate(
|
71
|
+
order_number: purchase_detail[:order_number],
|
72
|
+
three_d_secure_pa_res: valid_three_d_secure_pa_res
|
73
|
+
)
|
71
74
|
assert_equal true, response.success?
|
72
75
|
end
|
73
76
|
end
|
74
77
|
|
78
|
+
def test_purchase_with_three_d_secure_2_successful
|
79
|
+
# 3DS2.0はテスト環境がないので mode を :production にする
|
80
|
+
ActiveMerchant::Billing::Base.stub(:mode, :production) do
|
81
|
+
VCR.use_cassette(:purchase_with_three_d_secure_2_successful) do
|
82
|
+
response = gateway.purchase(
|
83
|
+
1000,
|
84
|
+
ActiveMerchant::Billing::CreditCard.new,
|
85
|
+
purchase_detail_for_three_d_secure_2
|
86
|
+
)
|
87
|
+
|
88
|
+
assert_equal true, response.success?
|
89
|
+
assert_equal true, response.params['three_d_secure']
|
90
|
+
assert_equal true, response.params['tds2_url'].present?
|
91
|
+
assert_equal true, response.params['pa_req'].present?
|
92
|
+
assert_empty response.params['acs_url']
|
93
|
+
end
|
94
|
+
|
95
|
+
VCR.use_cassette(:authenticate_with_three_d_secure_2_successful) do
|
96
|
+
response = gateway.authenticate(
|
97
|
+
order_number: purchase_detail_for_three_d_secure_2[:order_number],
|
98
|
+
three_d_secure_pa_res: 'dummy pa_res'
|
99
|
+
)
|
100
|
+
|
101
|
+
assert_equal true, response.success?
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
75
106
|
def test_purchase_with_capture_true_successful
|
76
107
|
VCR.use_cassette(:purchase_with_capture_true_successful) do
|
77
108
|
response = gateway.purchase(1000, valid_credit_card, purchase_detail.merge(capture: true))
|
@@ -253,6 +284,30 @@ class RemoteEpsilonGatewayTest < MiniTest::Test
|
|
253
284
|
end
|
254
285
|
end
|
255
286
|
|
287
|
+
def test_registered_purchase_with_three_d_secure_2_successful
|
288
|
+
# 3DS2.0はテスト環境がないので mode を :production にする
|
289
|
+
ActiveMerchant::Billing::Base.stub(:mode, :production) do
|
290
|
+
VCR.use_cassette(:purchase_with_three_d_secure_2_successful) do
|
291
|
+
response = gateway.registered_purchase(1000, purchase_detail_for_registered_and_three_d_secure_2)
|
292
|
+
|
293
|
+
assert_equal true, response.success?
|
294
|
+
assert_equal true, response.params['three_d_secure']
|
295
|
+
assert_equal true, response.params['tds2_url'].present?
|
296
|
+
assert_equal true, response.params['pa_req'].present?
|
297
|
+
assert_empty response.params['acs_url']
|
298
|
+
end
|
299
|
+
|
300
|
+
VCR.use_cassette(:authenticate_with_three_d_secure_2_successful) do
|
301
|
+
response = gateway.authenticate(
|
302
|
+
order_number: purchase_detail_for_three_d_secure_2[:order_number],
|
303
|
+
three_d_secure_pa_res: 'dummy pa_res'
|
304
|
+
)
|
305
|
+
|
306
|
+
assert_equal true, response.success?
|
307
|
+
end
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
256
311
|
def test_registered_purchase_fail
|
257
312
|
VCR.use_cassette(:registered_purchase_fail) do
|
258
313
|
invalid_purchase_detail = purchase_detail_for_registered
|
@@ -293,6 +348,7 @@ class RemoteEpsilonGatewayTest < MiniTest::Test
|
|
293
348
|
assert_equal true, response.success?
|
294
349
|
|
295
350
|
assert_equal true, !response.params['state'].empty?
|
351
|
+
assert_equal true, !response.params['last_update'].empty?
|
296
352
|
assert_equal true, !response.params['payment_code'].empty?
|
297
353
|
assert_equal true, !response.params['item_price'].empty?
|
298
354
|
end
|
data/test/test_helper.rb
CHANGED
@@ -156,6 +156,33 @@ module SamplePaymentMethods
|
|
156
156
|
}
|
157
157
|
end
|
158
158
|
|
159
|
+
def purchase_detail_for_three_d_secure_2
|
160
|
+
now = Time.now
|
161
|
+
{
|
162
|
+
user_id: "U#{now.to_i}",
|
163
|
+
user_name: 'YAMADA Taro',
|
164
|
+
user_email: 'yamada-taro@example.com',
|
165
|
+
item_code: 'ITEM001',
|
166
|
+
item_name: 'Greate Product',
|
167
|
+
order_number: "O#{now.sec}#{now.usec}",
|
168
|
+
token: '03d4a2ce2f747c9223a4ead24888d0293ad26c06273e296f9faa0675f99a1ff7',
|
169
|
+
three_d_secure_check_code: 1,
|
170
|
+
tds_flag: 21,
|
171
|
+
}
|
172
|
+
end
|
173
|
+
|
174
|
+
def purchase_detail_for_registered_and_three_d_secure_2
|
175
|
+
{
|
176
|
+
user_id: '124014051',
|
177
|
+
user_email: 'yamada-taro@example.com',
|
178
|
+
user_name: 'YAMADA TARO',
|
179
|
+
item_code: 'ITEM001',
|
180
|
+
item_name: 'Greate Product',
|
181
|
+
order_number: "O#{Time.now.to_i}",
|
182
|
+
tds_flag: 21,
|
183
|
+
}
|
184
|
+
end
|
185
|
+
|
159
186
|
def valid_three_d_secure_pa_res
|
160
187
|
now = Time.now
|
161
188
|
{
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_merchant-epsilon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenichi TAKAHASHI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|
@@ -158,8 +158,8 @@ extensions: []
|
|
158
158
|
extra_rdoc_files: []
|
159
159
|
files:
|
160
160
|
- ".env.sample"
|
161
|
+
- ".github/workflows/test.yml"
|
161
162
|
- ".gitignore"
|
162
|
-
- ".travis.yml"
|
163
163
|
- CHANGELOG.md
|
164
164
|
- Gemfile
|
165
165
|
- LICENSE.txt
|
@@ -178,6 +178,7 @@ files:
|
|
178
178
|
- lib/active_merchant/billing/gateways/response_parser.rb
|
179
179
|
- lib/active_merchant/epsilon.rb
|
180
180
|
- lib/active_merchant/epsilon/version.rb
|
181
|
+
- test/fixtures/vcr_cassettes/authenticate_with_three_d_secure_2_successful.yml
|
181
182
|
- test/fixtures/vcr_cassettes/autheticate_three_d_secure_card_successful.yml
|
182
183
|
- test/fixtures/vcr_cassettes/cancel_recurring_fail.yml
|
183
184
|
- test/fixtures/vcr_cassettes/cancel_recurring_successful.yml
|
@@ -208,6 +209,7 @@ files:
|
|
208
209
|
- test/fixtures/vcr_cassettes/purchase_successful.yml
|
209
210
|
- test/fixtures/vcr_cassettes/purchase_with_capture_false_successful.yml
|
210
211
|
- test/fixtures/vcr_cassettes/purchase_with_capture_true_successful.yml
|
212
|
+
- test/fixtures/vcr_cassettes/purchase_with_three_d_secure_2_successful.yml
|
211
213
|
- test/fixtures/vcr_cassettes/purchase_with_three_d_secure_card_successful.yml
|
212
214
|
- test/fixtures/vcr_cassettes/purchase_with_verification_value.yml
|
213
215
|
- test/fixtures/vcr_cassettes/recurring_fail.yml
|
@@ -228,7 +230,6 @@ files:
|
|
228
230
|
- test/fixtures/vcr_cassettes/void_fail.yml
|
229
231
|
- test/fixtures/vcr_cassettes/void_successful.yml
|
230
232
|
- test/remote/gateways/remote_epsilon_convenience_store_test.rb
|
231
|
-
- test/remote/gateways/remote_epsilon_gmo_after_test.rb
|
232
233
|
- test/remote/gateways/remote_epsilon_gmo_id_test.rb
|
233
234
|
- test/remote/gateways/remote_epsilon_link_payment_test.rb
|
234
235
|
- test/remote/gateways/remote_epsilon_test.rb
|
@@ -260,6 +261,7 @@ signing_key:
|
|
260
261
|
specification_version: 4
|
261
262
|
summary: Epsilon integration for ActiveMerchant.
|
262
263
|
test_files:
|
264
|
+
- test/fixtures/vcr_cassettes/authenticate_with_three_d_secure_2_successful.yml
|
263
265
|
- test/fixtures/vcr_cassettes/autheticate_three_d_secure_card_successful.yml
|
264
266
|
- test/fixtures/vcr_cassettes/cancel_recurring_fail.yml
|
265
267
|
- test/fixtures/vcr_cassettes/cancel_recurring_successful.yml
|
@@ -290,6 +292,7 @@ test_files:
|
|
290
292
|
- test/fixtures/vcr_cassettes/purchase_successful.yml
|
291
293
|
- test/fixtures/vcr_cassettes/purchase_with_capture_false_successful.yml
|
292
294
|
- test/fixtures/vcr_cassettes/purchase_with_capture_true_successful.yml
|
295
|
+
- test/fixtures/vcr_cassettes/purchase_with_three_d_secure_2_successful.yml
|
293
296
|
- test/fixtures/vcr_cassettes/purchase_with_three_d_secure_card_successful.yml
|
294
297
|
- test/fixtures/vcr_cassettes/purchase_with_verification_value.yml
|
295
298
|
- test/fixtures/vcr_cassettes/recurring_fail.yml
|
@@ -310,7 +313,6 @@ test_files:
|
|
310
313
|
- test/fixtures/vcr_cassettes/void_fail.yml
|
311
314
|
- test/fixtures/vcr_cassettes/void_successful.yml
|
312
315
|
- test/remote/gateways/remote_epsilon_convenience_store_test.rb
|
313
|
-
- test/remote/gateways/remote_epsilon_gmo_after_test.rb
|
314
316
|
- test/remote/gateways/remote_epsilon_gmo_id_test.rb
|
315
317
|
- test/remote/gateways/remote_epsilon_link_payment_test.rb
|
316
318
|
- test/remote/gateways/remote_epsilon_test.rb
|
data/.travis.yml
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- 2.4.5
|
4
|
-
- 2.5.3
|
5
|
-
|
6
|
-
script: bundle exec rake test:remote
|
7
|
-
script: bundle exec rake test:unit
|
8
|
-
|
9
|
-
notifications:
|
10
|
-
slack:
|
11
|
-
rooms:
|
12
|
-
secure: rYtA4FBXqKHYv+v7xA6FfkcsDXRexWyMj9WMG2YK7bgZoNG2N7q461Dr/lCU0JTuRGsxDIs5jHK+QFFZNW/h+SbhQfiew++W8FgoIbP/z7HuEW50SXLcigGb02YmQm+ybbh5Dw1QGmcTOVItXJfuFmrDm1fq0qO0HC0543Yn4BzrSdWnEWQSaK7JMBRc9aYVPc0VlWG8pGRLtW0PDb6D32MvEI4jPrnh2NPDomPT9YutmMC+jNBPKr72m68g3v2GogbX4irZ6Kp5UUUZtaDbt9yLRfNL/3bsVGVrS1S2qCO4If5xTtE7lvV807a8QuQIj4Y9YqRO7K+/wUrz4Yb2ycF7agAkjN+w2WNEjgsKeFk50R4BWKpSy6y2N2RIl7rdHVEnU1T9I6LH0do5hMGqhgDYgppb2F7YFL9buUqag6gKAX3BHIV16ADJOFBT2Hh2m6x9f5TRb5ZR4LDJBQaflMhj0pwmIcC5Bhr3yi45r/4xiJ1IQaspXCzvfUMXARgWqqSxxveVQ07obiFeFCZ2YJEyv9fYLxT39+9koP48iKHTzbtFi4ay37PfMaztiXM0dqTwdjbJ95krc8AoNuTDphgwLLW2Zxxz2+tFQiLcj1tebUZa1hBsil1EVI7P/8PjAjGowckCnEAnFBZS5oFrgE2qzuwIGbLRYeeoRev0tks=
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class RemoteEpsilonGmoAfterGatewayTest < MiniTest::Test
|
4
|
-
include SamplePaymentMethods
|
5
|
-
|
6
|
-
def gateway
|
7
|
-
@gateway ||= ActiveMerchant::Billing::EpsilonGmoAfterGateway.new
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_gmo_after_purchase_successfull
|
11
|
-
VCR.use_cassette(:gmo_after_purchase_successful) do
|
12
|
-
response = gateway.purchase(10000, gmo_after_purchase_detail)
|
13
|
-
|
14
|
-
assert_equal true, response.success?
|
15
|
-
assert_equal true, !response.params['redirect'].empty?
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_gmo_after_purchase_fail
|
20
|
-
invalid_purchase_detail = gmo_after_purchase_detail
|
21
|
-
invalid_purchase_detail[:user_id] = ''
|
22
|
-
|
23
|
-
VCR.use_cassette(:gmo_after_purchase_fail) do
|
24
|
-
response = gateway.purchase(10000, invalid_purchase_detail)
|
25
|
-
|
26
|
-
assert_equal false, response.success?
|
27
|
-
assert_equal true, response.params["error_detail"].valid_encoding?
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|