active_merchant-epsilon 0.9.3 → 0.13.0
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 +4 -4
- data/.github/workflows/test.yml +21 -0
- data/CHANGELOG.md +20 -0
- data/README.md +19 -4
- data/lib/active_merchant/billing/gateways/epsilon.rb +14 -0
- data/lib/active_merchant/billing/gateways/epsilon/epsilon_base.rb +2 -1
- data/lib/active_merchant/billing/gateways/epsilon_link_payment.rb +55 -0
- data/lib/active_merchant/billing/gateways/response_parser.rb +10 -0
- data/lib/active_merchant/epsilon.rb +1 -1
- data/lib/active_merchant/epsilon/version.rb +1 -1
- data/test/fixtures/vcr_cassettes/capture_failure.yml +45 -0
- data/test/fixtures/vcr_cassettes/capture_success.yml +45 -0
- data/test/fixtures/vcr_cassettes/capture_success_authorize.yml +49 -0
- data/test/fixtures/vcr_cassettes/epsilon_link_type_not_sending_delivery_information_purchase_successful.yml +44 -0
- data/test/fixtures/vcr_cassettes/epsilon_link_type_purchase_fail.yml +43 -0
- data/test/fixtures/vcr_cassettes/epsilon_link_type_purchase_successful.yml +44 -0
- data/test/fixtures/vcr_cassettes/epsilon_link_type_void_fail.yml +45 -0
- data/test/fixtures/vcr_cassettes/epsilon_link_type_void_successfull.yml +45 -0
- data/test/fixtures/vcr_cassettes/purchase_with_capture_false_successful.yml +49 -0
- data/test/fixtures/vcr_cassettes/purchase_with_capture_true_successful.yml +49 -0
- data/test/remote/gateways/remote_epsilon_convenience_store_test.rb +5 -5
- data/test/remote/gateways/remote_epsilon_link_payment_test.rb +55 -0
- data/test/remote/gateways/remote_epsilon_test.rb +47 -2
- data/test/test_helper.rb +62 -0
- metadata +30 -10
- data/.travis.yml +0 -13
- data/lib/active_merchant/billing/gateways/epsilon_gmo_after.rb +0 -42
- 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: c43c4d71a9719ec55be94aa1f66222eac8bead4b16db6a31611269aee844afcf
|
4
|
+
data.tar.gz: 6bb0b39a5598d3cb8718037df3fd00ff42a53cded61bc98529a4ad00aa9f4259
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 164e39f8d0e343f0172e5371fc99d1c46d8d04346c8e0c135ac7478cbe507be36d6182913df016e510eb75073559ad9d59b042718f3c26fa5fb6a37c20e940f6
|
7
|
+
data.tar.gz: 1b5e435a9342d69b78e032d466fb3f930805912bb2c4ac24eb7e7d9ce2bcf652a5b15f050ab38ad3526929cda5cc00ac32d0f540828226d97a0ca69ab986f845
|
@@ -0,0 +1,21 @@
|
|
1
|
+
name: test
|
2
|
+
on: push
|
3
|
+
|
4
|
+
jobs:
|
5
|
+
test-all:
|
6
|
+
runs-on: ubuntu-latest
|
7
|
+
|
8
|
+
strategy:
|
9
|
+
fail-fast: false
|
10
|
+
matrix:
|
11
|
+
ruby-version: [2.4, 2.5, 2.6, 2.7, 3.0]
|
12
|
+
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
|
16
|
+
- uses: ruby/setup-ruby@v1.63.0
|
17
|
+
with:
|
18
|
+
ruby-version: ${{ matrix.ruby-version }}
|
19
|
+
bundler-cache: true
|
20
|
+
|
21
|
+
- run: bundle exec rake test:unit test:remote
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
### 0.13.0
|
4
|
+
|
5
|
+
- [Add `last-update` to OrderResponse](https://github.com/pepabo/active_merchant-epsilon/pull/118)
|
6
|
+
|
7
|
+
### 0.12.0
|
8
|
+
|
9
|
+
- [Add Parameter `delivery_info_required` to purchase method for Epsilon Link Payment](https://github.com/pepabo/active_merchant-epsilon/pull/116)
|
10
|
+
|
11
|
+
### 0.11.0
|
12
|
+
|
13
|
+
- [Add void mehotd for Epsilon Link Payment](https://github.com/pepabo/active_merchant-epsilon/pull/114)
|
14
|
+
|
15
|
+
### 0.10.0
|
16
|
+
|
17
|
+
* [Capture authorized payments](https://github.com/pepabo/active_merchant-epsilon/pull/112)
|
18
|
+
|
19
|
+
### 0.9.4
|
20
|
+
|
21
|
+
* [Support Epsilon Link Payment instead of GMO Payment After Delivery](https://github.com/pepabo/active_merchant-epsilon/pull/110)
|
22
|
+
|
3
23
|
### 0.9.3
|
4
24
|
|
5
25
|
* [Fix API version for GMO Payment After Delivery](https://github.com/pepabo/active_merchant-epsilon/pull/108)
|
data/README.md
CHANGED
@@ -302,12 +302,19 @@ else
|
|
302
302
|
end
|
303
303
|
```
|
304
304
|
|
305
|
-
###
|
305
|
+
### Epsilon Link Payment
|
306
|
+
|
307
|
+
EpsilosLinkPaymentGateway is available in all link payments.
|
308
|
+
For example, GMO Payment After Delivery.
|
309
|
+
|
310
|
+
If you don't need to send paramaters of delivery information details(e.g. consignee_postal, consignee_name, orderer_postal, and orderer_name), you set `delivery_info_required` to `false`.
|
311
|
+
|
312
|
+
Default value of `delivery_info_required` is `true`, therefore you must set delivery information details to purchase_detail When you don't set `delivery_info_required`.
|
306
313
|
|
307
314
|
```ruby
|
308
|
-
ActiveMerchant::Billing::
|
315
|
+
ActiveMerchant::Billing::EpsilonLinkPaymentGateway.contract_code = 'YOUR_CONTRACT_CODE'
|
309
316
|
|
310
|
-
gateway = ActiveMerchant::Billing::
|
317
|
+
gateway = ActiveMerchant::Billing::EpsilonLinkPaymentGateway.new
|
311
318
|
|
312
319
|
amount = 10000
|
313
320
|
|
@@ -319,6 +326,7 @@ purchase_detail = {
|
|
319
326
|
item_code: 'ITEM001',
|
320
327
|
item_name: 'Greate Product',
|
321
328
|
order_number: 'UNIQUE ORDER NUMBER',
|
329
|
+
st_code: 'SETTLEMENT_CODE',
|
322
330
|
consignee_postal: '1500002',
|
323
331
|
consignee_name: '山田 太郎',
|
324
332
|
consignee_address: '東京都渋谷区1-1-1',
|
@@ -331,7 +339,9 @@ purchase_detail = {
|
|
331
339
|
memo2: 'memo2',
|
332
340
|
}
|
333
341
|
|
334
|
-
|
342
|
+
delivery_info_required = true
|
343
|
+
|
344
|
+
response = gateway.purchase(amount, purchase_detail, delivery_info_required)
|
335
345
|
|
336
346
|
if response.success?
|
337
347
|
puts "Successfully send order data"
|
@@ -341,6 +351,11 @@ else
|
|
341
351
|
end
|
342
352
|
```
|
343
353
|
|
354
|
+
### Epsilon Link Payment Void Transaction
|
355
|
+
```ruby
|
356
|
+
gateway.void('order_number')
|
357
|
+
```
|
358
|
+
|
344
359
|
### Error handling
|
345
360
|
|
346
361
|
If epsilon server returns status excepted 200, `#purchase` method raise `ActiveMerchant::ResponseError`.
|
@@ -19,6 +19,7 @@ module ActiveMerchant #:nodoc:
|
|
19
19
|
find_user: 'get_user_info.cgi',
|
20
20
|
change_recurring_amount: 'change_amount_payment.cgi',
|
21
21
|
find_order: 'getsales2.cgi',
|
22
|
+
capture: 'sales_payment.cgi',
|
22
23
|
}.freeze
|
23
24
|
|
24
25
|
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
|
@@ -51,6 +52,7 @@ module ActiveMerchant #:nodoc:
|
|
51
52
|
|
52
53
|
params[:memo1] = detail[:memo1] if detail.has_key?(:memo1)
|
53
54
|
params[:memo2] = detail[:memo2] if detail.has_key?(:memo2)
|
55
|
+
params[:kari_flag] = detail[:capture] ? 2 : 1 if detail.has_key?(:capture)
|
54
56
|
|
55
57
|
commit(PATHS[:registered_purchase], params)
|
56
58
|
end
|
@@ -83,6 +85,7 @@ module ActiveMerchant #:nodoc:
|
|
83
85
|
|
84
86
|
params[:memo1] = detail[:memo1] if detail.has_key?(:memo1)
|
85
87
|
params[:memo2] = detail[:memo2] if detail.has_key?(:memo2)
|
88
|
+
params[:kari_flag] = detail[:capture] ? 2 : 1 if detail.has_key?(:capture)
|
86
89
|
|
87
90
|
commit(PATHS[:registered_recurring], params)
|
88
91
|
end
|
@@ -174,6 +177,7 @@ module ActiveMerchant #:nodoc:
|
|
174
177
|
response_keys = [
|
175
178
|
:transaction_code,
|
176
179
|
:state,
|
180
|
+
:last_update,
|
177
181
|
:payment_code,
|
178
182
|
:item_price,
|
179
183
|
:amount,
|
@@ -182,6 +186,15 @@ module ActiveMerchant #:nodoc:
|
|
182
186
|
commit(PATHS[:find_order], params, response_keys)
|
183
187
|
end
|
184
188
|
|
189
|
+
def capture(order_number)
|
190
|
+
params = {
|
191
|
+
contract_code: self.contract_code,
|
192
|
+
order_number: order_number,
|
193
|
+
}
|
194
|
+
|
195
|
+
commit(PATHS[:capture], params)
|
196
|
+
end
|
197
|
+
|
185
198
|
private
|
186
199
|
|
187
200
|
def billing_params(amount, payment_method, detail)
|
@@ -208,6 +221,7 @@ module ActiveMerchant #:nodoc:
|
|
208
221
|
|
209
222
|
params[:memo1] = detail[:memo1] if detail.has_key?(:memo1)
|
210
223
|
params[:memo2] = detail[:memo2] if detail.has_key?(:memo2)
|
224
|
+
params[:kari_flag] = detail[:capture] ? 2 : 1 if detail.has_key?(:capture)
|
211
225
|
|
212
226
|
if detail.has_key?(:token)
|
213
227
|
params[:token] = detail[:token]
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class EpsilonLinkPaymentGateway < EpsilonBaseGateway
|
4
|
+
|
5
|
+
RESPONSE_KEYS = DEFAULT_RESPONSE_KEYS + [
|
6
|
+
:redirect,
|
7
|
+
]
|
8
|
+
|
9
|
+
def purchase(amount, detail = {}, delivery_info_required = true)
|
10
|
+
params = {
|
11
|
+
contract_code: self.contract_code,
|
12
|
+
user_id: detail[:user_id],
|
13
|
+
user_name: detail[:user_name],
|
14
|
+
user_mail_add: detail[:user_email],
|
15
|
+
item_code: detail[:item_code],
|
16
|
+
item_name: detail[:item_name],
|
17
|
+
order_number: detail[:order_number],
|
18
|
+
st_code: detail[:st_code],
|
19
|
+
mission_code: EpsilonMissionCode::PURCHASE,
|
20
|
+
item_price: amount,
|
21
|
+
process_code: EpsilonProcessCode::FIRST,
|
22
|
+
xml: 1, # 応答形式。1: xml形式を固定
|
23
|
+
}
|
24
|
+
|
25
|
+
# 注文情報の詳細が必要な場合のみ、セットする
|
26
|
+
if delivery_info_required
|
27
|
+
params[:delivery_code] = 99 # 配送区分。99で固定
|
28
|
+
params[:consignee_postal] = detail[:consignee_postal]
|
29
|
+
params[:consignee_name] = detail[:consignee_name]
|
30
|
+
params[:consignee_address] = detail[:consignee_address]
|
31
|
+
params[:consignee_tel] = detail[:consignee_tel]
|
32
|
+
params[:orderer_postal] = detail[:orderer_postal]
|
33
|
+
params[:orderer_name] = detail[:orderer_name]
|
34
|
+
params[:orderer_address] = detail[:orderer_address]
|
35
|
+
params[:orderer_tel] = detail[:orderer_tel]
|
36
|
+
end
|
37
|
+
|
38
|
+
params[:memo1] = detail[:memo1] if detail.has_key?(:memo1)
|
39
|
+
params[:memo2] = detail[:memo2] if detail.has_key?(:memo2)
|
40
|
+
params[:user_tel] = detail[:user_tel] if detail.has_key?(:user_tel)
|
41
|
+
|
42
|
+
commit('receive_order3.cgi', params, RESPONSE_KEYS)
|
43
|
+
end
|
44
|
+
|
45
|
+
def void(order_number)
|
46
|
+
params = {
|
47
|
+
contract_code: self.contract_code,
|
48
|
+
order_number: order_number
|
49
|
+
}
|
50
|
+
|
51
|
+
commit('cancel_payment.cgi', params)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -107,6 +107,10 @@ module ActiveMerchant #:nodoc:
|
|
107
107
|
@xml.xpath(ResponseXpath::STATE).to_s
|
108
108
|
end
|
109
109
|
|
110
|
+
def last_update
|
111
|
+
@xml.xpath(ResponseXpath::LAST_UPDATE).to_s
|
112
|
+
end
|
113
|
+
|
110
114
|
def payment_code
|
111
115
|
@xml.xpath(ResponseXpath::PAYMENT_CODE).to_s
|
112
116
|
end
|
@@ -123,6 +127,10 @@ module ActiveMerchant #:nodoc:
|
|
123
127
|
uri_decode(@xml.xpath(ResponseXpath::REDIRECT).to_s)
|
124
128
|
end
|
125
129
|
|
130
|
+
def captured
|
131
|
+
@xml.xpath(ResponseXpath::CAPTURED).to_s != '1'
|
132
|
+
end
|
133
|
+
|
126
134
|
def uri_decode(string)
|
127
135
|
CGI.unescape(string).encode(Encoding::UTF_8, Encoding::CP932)
|
128
136
|
end
|
@@ -149,10 +157,12 @@ module ActiveMerchant #:nodoc:
|
|
149
157
|
BRANCH_CODE = '//Epsilon_result/result[@branch_code][1]/@branch_code'
|
150
158
|
BRANCH_NAME = '//Epsilon_result/result[@branch_name][1]/@branch_name'
|
151
159
|
STATE = '//Epsilon_result/result[@state]/@state'
|
160
|
+
LAST_UPDATE = '//Epsilon_result/result[@last_update]/@last_update'
|
152
161
|
ITEM_PRICE = '//Epsilon_result/result[@item_price]/@item_price'
|
153
162
|
PAYMENT_CODE = '//Epsilon_result/result[@payment_code]/@payment_code'
|
154
163
|
AMOUNT = '//Epsilon_result/result[@amount]/@amount'
|
155
164
|
REDIRECT = '//Epsilon_result/result[@redirect]/@redirect'
|
165
|
+
CAPTURED = '//Epsilon_result/result[@kari_flag]/@kari_flag'
|
156
166
|
end
|
157
167
|
|
158
168
|
module ResultCode
|
@@ -10,5 +10,5 @@ require_relative 'billing/gateways/epsilon'
|
|
10
10
|
require_relative 'billing/gateways/epsilon_convenience_store'
|
11
11
|
require_relative 'billing/gateways/epsilon_gmo_id'
|
12
12
|
require_relative 'billing/gateways/epsilon_virtual_account'
|
13
|
-
require_relative 'billing/gateways/
|
13
|
+
require_relative 'billing/gateways/epsilon_link_payment'
|
14
14
|
require_relative 'billing/gateways/response_parser'
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://beta.epsilon.jp/cgi-bin/order/sales_payment.cgi
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: contract_code=[CONTRACT_CODE]&order_number=1234567890
|
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
|
+
- Fri, 12 Jun 2020 11:00:12 GMT
|
27
|
+
Server:
|
28
|
+
- Apache
|
29
|
+
Connection:
|
30
|
+
- close
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Content-Type:
|
34
|
+
- text/xml; charset=CP932
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: |-
|
38
|
+
<?xml version="1.0" encoding="x-sjis-cp932"?>
|
39
|
+
<Epsilon_result>
|
40
|
+
<result err_code="810" />
|
41
|
+
<result err_detail="%91%CE%8F%DB%8E%E6%88%F8%82%CD%82%A0%82%E8%82%DC%82%B9%82%F1" />
|
42
|
+
<result result="9" />
|
43
|
+
</Epsilon_result>
|
44
|
+
recorded_at: Fri, 12 Jun 2020 11:00:14 GMT
|
45
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://beta.epsilon.jp/cgi-bin/order/sales_payment.cgi
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: contract_code=[CONTRACT_CODE]&order_number=O14289569
|
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
|
+
- Fri, 12 Jun 2020 11:00:16 GMT
|
27
|
+
Server:
|
28
|
+
- Apache
|
29
|
+
Connection:
|
30
|
+
- close
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Content-Type:
|
34
|
+
- text/xml; charset=CP932
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: |-
|
38
|
+
<?xml version="1.0" encoding="x-sjis-cp932"?>
|
39
|
+
<Epsilon_result>
|
40
|
+
<result err_code="" />
|
41
|
+
<result err_detail="" />
|
42
|
+
<result result="1" />
|
43
|
+
</Epsilon_result>
|
44
|
+
recorded_at: Fri, 12 Jun 2020 11:00:17 GMT
|
45
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,49 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://beta.epsilon.jp/cgi-bin/order/direct_card_payment.cgi
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: contract_code=[CONTRACT_CODE]&user_id=U1591959614&user_name=YAMADA+Taro&user_mail_add=yamada-taro%40example.com&item_code=ITEM001&item_name=Greate+Product&order_number=O14289569&st_code=10000-0000-0000&mission_code=1&kari_flag=1&item_price=100&process_code=1&card_number=4242424242424242&expire_y=2021&expire_m=10&card_st_code=&pay_time=&tds_check_code=&user_agent=ActiveMerchant%3A%3AEpsilon-0.9.4&memo1=memo1&memo2=memo2
|
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
|
+
- Fri, 12 Jun 2020 11:00:15 GMT
|
27
|
+
Server:
|
28
|
+
- Apache
|
29
|
+
Connection:
|
30
|
+
- close
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Content-Type:
|
34
|
+
- text/xml; charset=CP932
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: |-
|
38
|
+
<?xml version="1.0" encoding="x-sjis-cp932"?>
|
39
|
+
<Epsilon_result>
|
40
|
+
<result acsurl="" />
|
41
|
+
<result err_code="" />
|
42
|
+
<result err_detail="" />
|
43
|
+
<result kari_flag="1" />
|
44
|
+
<result pareq="" />
|
45
|
+
<result result="1" />
|
46
|
+
<result trans_code="1362118" />
|
47
|
+
</Epsilon_result>
|
48
|
+
recorded_at: Fri, 12 Jun 2020 11:00:16 GMT
|
49
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://beta.epsilon.jp/cgi-bin/order/receive_order3.cgi
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: contract_code=[CONTRACT_CODE]&user_id=U1599198756&user_name=%E5%B1%B1%E7%94%B0+%E5%A4%AA%E9%83%8E&user_mail_add=yamada-taro%40example.com&item_code=ITEM001&item_name=Greate+Product&order_number=O36528472&st_code=00000-0000-01000-00000-00000-00000-00000&mission_code=1&item_price=10000&process_code=1&xml=1&memo1=memo1&memo2=memo2
|
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
|
+
- Fri, 04 Sep 2020 05:52:36 GMT
|
27
|
+
Server:
|
28
|
+
- Apache
|
29
|
+
Connection:
|
30
|
+
- close
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Content-Type:
|
34
|
+
- text/xml
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: |
|
38
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
39
|
+
<Epsilon_result>
|
40
|
+
<result result="1" />
|
41
|
+
<result redirect="https%3A%2F%2Fbeta.epsilon.jp%2Fcgi-bin%2Forder%2Fmethod_select3.cgi%3Ftrans_code%3DRewAwZ7Jm3Y91" />
|
42
|
+
</Epsilon_result>
|
43
|
+
recorded_at: Fri, 04 Sep 2020 05:52:37 GMT
|
44
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,43 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://beta.epsilon.jp/cgi-bin/order/receive_order3.cgi
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: contract_code=[CONTRACT_CODE]&user_id=U1594794779&user_name=%E5%B1%B1%E7%94%B0+%E5%A4%AA%E9%83%8E&user_mail_add=yamada-taro%40example.com&item_code=ITEM001&item_name=Greate+Product&order_number=O59578602&st_code=invalid_id&mission_code=1&item_price=10000&process_code=1&xml=1&delivery_code=99&consignee_postal=1000001&consignee_name=%E3%82%A4%E3%83%97%E3%82%B7%E3%83%AD%E3%83%B3%E3%82%BF%E3%83%AD%E3%82%A6&consignee_address=%E6%9D%B1%E4%BA%AC%E9%83%BD%E5%8D%83%E4%BB%A3%E7%94%B0%E5%8C%BA%E5%8D%83%E4%BB%A3%E7%94%B01%E7%95%AA1%E5%8F%B7&consignee_tel=0312345678&orderer_postal=1000001&orderer_name=YAMADA+Taro&orderer_address=%E6%9D%B1%E4%BA%AC%E9%83%BD%E5%8D%83%E4%BB%A3%E7%94%B0%E5%8C%BA%E5%8D%83%E4%BB%A3%E7%94%B01%E7%95%AA1%E5%8F%B7&orderer_tel=0312345678&memo1=memo1&memo2=memo2
|
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, 15 Jul 2020 06:32:59 GMT
|
27
|
+
Server:
|
28
|
+
- Apache
|
29
|
+
Connection:
|
30
|
+
- close
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Content-Type:
|
34
|
+
- text/xml
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n <Epsilon_result>\r\n
|
38
|
+
\ <result result=\"0\" />\r\n <result err_code=\"601\" />\r\n <result
|
39
|
+
err_detail=\"%8C%88%8D%CF%83R%81%5B%83h%82%CC%8Ew%92%E8%82%AA%88%D9%8F%ED%82%C5%82%B7\"
|
40
|
+
/>\r\n <result memo1=\"memo1\" />\r\n <result memo2=\"memo2\" />\r\n
|
41
|
+
\ </Epsilon_result>\r\n"
|
42
|
+
recorded_at: Wed, 15 Jul 2020 06:33:00 GMT
|
43
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://beta.epsilon.jp/cgi-bin/order/receive_order3.cgi
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: contract_code=[CONTRACT_CODE]&user_id=U1599198757&user_name=%E5%B1%B1%E7%94%B0+%E5%A4%AA%E9%83%8E&user_mail_add=yamada-taro%40example.com&item_code=ITEM001&item_name=Greate+Product&order_number=O37739738&st_code=00000-0000-01000-00000-00000-00000-00000&mission_code=1&item_price=10000&process_code=1&xml=1&delivery_code=99&consignee_postal=1000001&consignee_name=%E3%82%A4%E3%83%97%E3%82%B7%E3%83%AD%E3%83%B3%E3%82%BF%E3%83%AD%E3%82%A6&consignee_address=%E6%9D%B1%E4%BA%AC%E9%83%BD%E5%8D%83%E4%BB%A3%E7%94%B0%E5%8C%BA%E5%8D%83%E4%BB%A3%E7%94%B01%E7%95%AA1%E5%8F%B7&consignee_tel=0312345678&orderer_postal=1000001&orderer_name=YAMADA+Taro&orderer_address=%E6%9D%B1%E4%BA%AC%E9%83%BD%E5%8D%83%E4%BB%A3%E7%94%B0%E5%8C%BA%E5%8D%83%E4%BB%A3%E7%94%B01%E7%95%AA1%E5%8F%B7&orderer_tel=0312345678&memo1=memo1&memo2=memo2
|
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
|
+
- Fri, 04 Sep 2020 05:52:38 GMT
|
27
|
+
Server:
|
28
|
+
- Apache
|
29
|
+
Connection:
|
30
|
+
- close
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Content-Type:
|
34
|
+
- text/xml
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: |
|
38
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
39
|
+
<Epsilon_result>
|
40
|
+
<result result="1" />
|
41
|
+
<result redirect="https%3A%2F%2Fbeta.epsilon.jp%2Fcgi-bin%2Forder%2Fmethod_select3.cgi%3Ftrans_code%3DIOnPh3Psm7k86" />
|
42
|
+
</Epsilon_result>
|
43
|
+
recorded_at: Fri, 04 Sep 2020 05:52:38 GMT
|
44
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://beta.epsilon.jp/cgi-bin/order/cancel_payment.cgi
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: contract_code=&order_number=invalid_order_number
|
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
|
+
- Mon, 20 Jul 2020 02:48:28 GMT
|
27
|
+
Server:
|
28
|
+
- Apache
|
29
|
+
Connection:
|
30
|
+
- close
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Content-Type:
|
34
|
+
- text/xml; charset=CP932
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: |-
|
38
|
+
<?xml version="1.0" encoding="x-sjis-cp932"?>
|
39
|
+
<Epsilon_result>
|
40
|
+
<result err_code="607" />
|
41
|
+
<result err_detail="%8C_%96%F1%83R%81%5B%83h%8C%60%8E%AE%83G%83%89%81%5B" />
|
42
|
+
<result result="9" />
|
43
|
+
</Epsilon_result>
|
44
|
+
recorded_at: Mon, 20 Jul 2020 02:48:29 GMT
|
45
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://beta.epsilon.jp/cgi-bin/order/cancel_payment.cgi
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: contract_code=[CONTRACT_CODE]&order_number=595213151
|
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
|
+
- Mon, 20 Jul 2020 02:56:42 GMT
|
27
|
+
Server:
|
28
|
+
- Apache
|
29
|
+
Connection:
|
30
|
+
- close
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Content-Type:
|
34
|
+
- text/xml; charset=CP932
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: |-
|
38
|
+
<?xml version="1.0" encoding="x-sjis-cp932"?>
|
39
|
+
<Epsilon_result>
|
40
|
+
<result err_code="" />
|
41
|
+
<result err_detail="" />
|
42
|
+
<result result="1" />
|
43
|
+
</Epsilon_result>
|
44
|
+
recorded_at: Mon, 20 Jul 2020 02:56:43 GMT
|
45
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,49 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://beta.epsilon.jp/cgi-bin/order/direct_card_payment.cgi
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: contract_code=[CONTRACT_CODE]&user_id=U1591960355&user_name=YAMADA+Taro&user_mail_add=yamada-taro%40example.com&item_code=ITEM001&item_name=Greate+Product&order_number=O35284193&st_code=10000-0000-0000&mission_code=1&item_price=1000&process_code=1&card_number=4242424242424242&expire_y=2021&expire_m=10&card_st_code=&pay_time=&tds_check_code=&user_agent=ActiveMerchant%3A%3AEpsilon-0.9.4&memo1=memo1&memo2=memo2&kari_flag=1
|
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
|
+
- Fri, 12 Jun 2020 11:12:35 GMT
|
27
|
+
Server:
|
28
|
+
- Apache
|
29
|
+
Connection:
|
30
|
+
- close
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Content-Type:
|
34
|
+
- text/xml; charset=CP932
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: |-
|
38
|
+
<?xml version="1.0" encoding="x-sjis-cp932"?>
|
39
|
+
<Epsilon_result>
|
40
|
+
<result acsurl="" />
|
41
|
+
<result err_code="" />
|
42
|
+
<result err_detail="" />
|
43
|
+
<result kari_flag="1" />
|
44
|
+
<result pareq="" />
|
45
|
+
<result result="1" />
|
46
|
+
<result trans_code="1362123" />
|
47
|
+
</Epsilon_result>
|
48
|
+
recorded_at: Fri, 12 Jun 2020 11:12:37 GMT
|
49
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,49 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://beta.epsilon.jp/cgi-bin/order/direct_card_payment.cgi
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: contract_code=[CONTRACT_CODE]&user_id=U1591960357&user_name=YAMADA+Taro&user_mail_add=yamada-taro%40example.com&item_code=ITEM001&item_name=Greate+Product&order_number=O37368550&st_code=10000-0000-0000&mission_code=1&item_price=1000&process_code=1&card_number=4242424242424242&expire_y=2021&expire_m=10&card_st_code=&pay_time=&tds_check_code=&user_agent=ActiveMerchant%3A%3AEpsilon-0.9.4&memo1=memo1&memo2=memo2&kari_flag=2
|
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
|
+
- Fri, 12 Jun 2020 11:12:37 GMT
|
27
|
+
Server:
|
28
|
+
- Apache
|
29
|
+
Connection:
|
30
|
+
- close
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Content-Type:
|
34
|
+
- text/xml; charset=CP932
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: |-
|
38
|
+
<?xml version="1.0" encoding="x-sjis-cp932"?>
|
39
|
+
<Epsilon_result>
|
40
|
+
<result acsurl="" />
|
41
|
+
<result err_code="" />
|
42
|
+
<result err_detail="" />
|
43
|
+
<result kari_flag="0" />
|
44
|
+
<result pareq="" />
|
45
|
+
<result result="1" />
|
46
|
+
<result trans_code="1362124" />
|
47
|
+
</Epsilon_result>
|
48
|
+
recorded_at: Fri, 12 Jun 2020 11:12:39 GMT
|
49
|
+
recorded_with: VCR 6.0.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
|
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
class RemoteEpsilonLinkPaymentTest < MiniTest::Test
|
3
|
+
include SamplePaymentMethods
|
4
|
+
|
5
|
+
def gateway
|
6
|
+
@gateway ||= ActiveMerchant::Billing::EpsilonLinkPaymentGateway.new
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_epsilon_link_type_purchase_successful
|
10
|
+
VCR.use_cassette(:epsilon_link_type_purchase_successful) do
|
11
|
+
response = gateway.purchase(10000, valid_epsilon_link_type_purchase_detail)
|
12
|
+
|
13
|
+
assert_equal true, response.success?
|
14
|
+
assert_equal true, !response.params['redirect'].empty?
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_epsilon_link_type_not_sending_delivery_information_purchase_successful
|
19
|
+
VCR.use_cassette(:epsilon_link_type_not_sending_delivery_information_purchase_successful) do
|
20
|
+
response = gateway.purchase(10000, valid_epsilon_link_type_not_sending_delivery_information_purchase_detail, false)
|
21
|
+
|
22
|
+
assert_equal true, response.success?
|
23
|
+
assert_equal true, !response.params['redirect'].empty?
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_epsilon_link_type_purchase_fail
|
28
|
+
VCR.use_cassette(:epsilon_link_type_purchase_fail) do
|
29
|
+
response = gateway.purchase(10000, invalid_epsilon_link_type_purchase_detail)
|
30
|
+
|
31
|
+
assert_equal false, response.success?
|
32
|
+
assert_equal true, response.params["error_detail"].valid_encoding?
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_epsilon_link_type_void_successfull
|
37
|
+
VCR.use_cassette(:epsilon_link_type_void_successfull) do
|
38
|
+
# あらかじめ課金済ステータスの受注がイプシロン側にないと取り消しができないため、課金済の受注をイプシロン側で作成しておいた。
|
39
|
+
# ここでは void の引数として作成済の受注のorder_numberを渡している。
|
40
|
+
# VCRのキャッシュを作成し直す場合は変更しないとエラーとなる。
|
41
|
+
response = gateway.void('595213151')
|
42
|
+
|
43
|
+
assert_equal true, response.success?
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_epsilon_link_type_void_fail
|
48
|
+
VCR.use_cassette(:epsilon_link_type_void_fail) do
|
49
|
+
response = gateway.void('invalid_order_number')
|
50
|
+
|
51
|
+
assert_equal false, response.success?
|
52
|
+
assert_equal true, response.params["error_detail"].valid_encoding?
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -62,13 +62,34 @@ 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
|
+
)
|
74
|
+
assert_equal true, response.success?
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_purchase_with_capture_true_successful
|
79
|
+
VCR.use_cassette(:purchase_with_capture_true_successful) do
|
80
|
+
response = gateway.purchase(1000, valid_credit_card, purchase_detail.merge(capture: true))
|
81
|
+
|
71
82
|
assert_equal true, response.success?
|
83
|
+
assert_equal true, response.params['captured']
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_purchase_with_capture_false_successful
|
88
|
+
VCR.use_cassette(:purchase_with_capture_false_successful) do
|
89
|
+
response = gateway.purchase(1000, valid_credit_card, purchase_detail.merge(capture: false))
|
90
|
+
|
91
|
+
assert_equal true, response.success?
|
92
|
+
assert_equal false, response.params['captured']
|
72
93
|
end
|
73
94
|
end
|
74
95
|
|
@@ -275,6 +296,7 @@ class RemoteEpsilonGatewayTest < MiniTest::Test
|
|
275
296
|
assert_equal true, response.success?
|
276
297
|
|
277
298
|
assert_equal true, !response.params['state'].empty?
|
299
|
+
assert_equal true, !response.params['last_update'].empty?
|
278
300
|
assert_equal true, !response.params['payment_code'].empty?
|
279
301
|
assert_equal true, !response.params['item_price'].empty?
|
280
302
|
end
|
@@ -286,4 +308,27 @@ class RemoteEpsilonGatewayTest < MiniTest::Test
|
|
286
308
|
assert_equal false, response.success?
|
287
309
|
end
|
288
310
|
end
|
311
|
+
|
312
|
+
def test_capture_success
|
313
|
+
detail = purchase_detail
|
314
|
+
|
315
|
+
VCR.use_cassette(:capture_success_authorize) do
|
316
|
+
purchase_response = gateway.purchase(100, valid_credit_card, detail.merge(capture: false))
|
317
|
+
|
318
|
+
assert_equal true, purchase_response.success?
|
319
|
+
assert_equal false, purchase_response.params['captured']
|
320
|
+
end
|
321
|
+
|
322
|
+
VCR.use_cassette(:capture_success) do
|
323
|
+
response = gateway.capture(detail[:order_number])
|
324
|
+
assert_equal true, response.success?
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
328
|
+
def test_capture_failure
|
329
|
+
VCR.use_cassette(:capture_failure) do
|
330
|
+
response = gateway.capture('1234567890')
|
331
|
+
assert_equal false, response.success?
|
332
|
+
end
|
333
|
+
end
|
289
334
|
end
|
data/test/test_helper.rb
CHANGED
@@ -216,6 +216,7 @@ module SamplePaymentMethods
|
|
216
216
|
item_code: 'ITEM001',
|
217
217
|
item_name: 'Greate Product',
|
218
218
|
order_number: "O#{now.sec}#{now.usec}",
|
219
|
+
st_code: '00000-0000-00000-00010-00000-00000-00000',
|
219
220
|
memo1: 'memo1',
|
220
221
|
memo2: 'memo2',
|
221
222
|
consignee_postal: '1000001',
|
@@ -229,6 +230,67 @@ module SamplePaymentMethods
|
|
229
230
|
}
|
230
231
|
end
|
231
232
|
|
233
|
+
def valid_epsilon_link_type_purchase_detail
|
234
|
+
now = Time.now
|
235
|
+
{
|
236
|
+
user_id: "U#{Time.now.to_i}",
|
237
|
+
user_name: '山田 太郎',
|
238
|
+
user_email: 'yamada-taro@example.com',
|
239
|
+
item_code: 'ITEM001',
|
240
|
+
item_name: 'Greate Product',
|
241
|
+
order_number: "O#{now.sec}#{now.usec}",
|
242
|
+
st_code: '00000-0000-01000-00000-00000-00000-00000',
|
243
|
+
memo1: 'memo1',
|
244
|
+
memo2: 'memo2',
|
245
|
+
consignee_postal: '1000001',
|
246
|
+
consignee_name: 'イプシロンタロウ',
|
247
|
+
consignee_address: '東京都千代田区千代田1番1号',
|
248
|
+
consignee_tel: '0312345678',
|
249
|
+
orderer_postal: '1000001',
|
250
|
+
orderer_name: 'YAMADA Taro',
|
251
|
+
orderer_address: '東京都千代田区千代田1番1号',
|
252
|
+
orderer_tel: '0312345678',
|
253
|
+
}
|
254
|
+
end
|
255
|
+
|
256
|
+
def valid_epsilon_link_type_not_sending_delivery_information_purchase_detail
|
257
|
+
now = Time.now
|
258
|
+
{
|
259
|
+
user_id: "U#{Time.now.to_i}",
|
260
|
+
user_name: '山田 太郎',
|
261
|
+
user_email: 'yamada-taro@example.com',
|
262
|
+
item_code: 'ITEM001',
|
263
|
+
item_name: 'Greate Product',
|
264
|
+
order_number: "O#{now.sec}#{now.usec}",
|
265
|
+
st_code: '00000-0000-01000-00000-00000-00000-00000',
|
266
|
+
memo1: 'memo1',
|
267
|
+
memo2: 'memo2',
|
268
|
+
}
|
269
|
+
end
|
270
|
+
|
271
|
+
def invalid_epsilon_link_type_purchase_detail
|
272
|
+
now = Time.now
|
273
|
+
{
|
274
|
+
user_id: "U#{Time.now.to_i}",
|
275
|
+
user_name: '山田 太郎',
|
276
|
+
user_email: 'yamada-taro@example.com',
|
277
|
+
item_code: 'ITEM001',
|
278
|
+
item_name: 'Greate Product',
|
279
|
+
order_number: "O#{now.sec}#{now.usec}",
|
280
|
+
st_code: 'invalid_id',
|
281
|
+
memo1: 'memo1',
|
282
|
+
memo2: 'memo2',
|
283
|
+
consignee_postal: '1000001',
|
284
|
+
consignee_name: 'イプシロンタロウ',
|
285
|
+
consignee_address: '東京都千代田区千代田1番1号',
|
286
|
+
consignee_tel: '0312345678',
|
287
|
+
orderer_postal: '1000001',
|
288
|
+
orderer_name: 'YAMADA Taro',
|
289
|
+
orderer_address: '東京都千代田区千代田1番1号',
|
290
|
+
orderer_tel: '0312345678',
|
291
|
+
}
|
292
|
+
end
|
293
|
+
|
232
294
|
def fixture_xml(filename, parse: true)
|
233
295
|
xml = File.read("test/fixtures/#{filename}")
|
234
296
|
parse ? Nokogiri.parse(xml.sub('x-sjis-cp932', 'CP932')) : xml
|
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.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenichi TAKAHASHI
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-25 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
|
@@ -172,8 +172,8 @@ files:
|
|
172
172
|
- lib/active_merchant/billing/gateways/epsilon/epsilon_mission_code.rb
|
173
173
|
- lib/active_merchant/billing/gateways/epsilon/epsilon_process_code.rb
|
174
174
|
- lib/active_merchant/billing/gateways/epsilon_convenience_store.rb
|
175
|
-
- lib/active_merchant/billing/gateways/epsilon_gmo_after.rb
|
176
175
|
- lib/active_merchant/billing/gateways/epsilon_gmo_id.rb
|
176
|
+
- lib/active_merchant/billing/gateways/epsilon_link_payment.rb
|
177
177
|
- lib/active_merchant/billing/gateways/epsilon_virtual_account.rb
|
178
178
|
- lib/active_merchant/billing/gateways/response_parser.rb
|
179
179
|
- lib/active_merchant/epsilon.rb
|
@@ -181,10 +181,18 @@ files:
|
|
181
181
|
- test/fixtures/vcr_cassettes/autheticate_three_d_secure_card_successful.yml
|
182
182
|
- test/fixtures/vcr_cassettes/cancel_recurring_fail.yml
|
183
183
|
- test/fixtures/vcr_cassettes/cancel_recurring_successful.yml
|
184
|
+
- test/fixtures/vcr_cassettes/capture_failure.yml
|
185
|
+
- test/fixtures/vcr_cassettes/capture_success.yml
|
186
|
+
- test/fixtures/vcr_cassettes/capture_success_authorize.yml
|
184
187
|
- test/fixtures/vcr_cassettes/change_recurring_amount_failure.yml
|
185
188
|
- test/fixtures/vcr_cassettes/change_recurring_amount_successful.yml
|
186
189
|
- test/fixtures/vcr_cassettes/convenience_store_purchase_fail.yml
|
187
190
|
- test/fixtures/vcr_cassettes/convenience_store_purchase_successful.yml
|
191
|
+
- test/fixtures/vcr_cassettes/epsilon_link_type_not_sending_delivery_information_purchase_successful.yml
|
192
|
+
- test/fixtures/vcr_cassettes/epsilon_link_type_purchase_fail.yml
|
193
|
+
- test/fixtures/vcr_cassettes/epsilon_link_type_purchase_successful.yml
|
194
|
+
- test/fixtures/vcr_cassettes/epsilon_link_type_void_fail.yml
|
195
|
+
- test/fixtures/vcr_cassettes/epsilon_link_type_void_successfull.yml
|
188
196
|
- test/fixtures/vcr_cassettes/find_order_failure.yml
|
189
197
|
- test/fixtures/vcr_cassettes/find_order_success.yml
|
190
198
|
- test/fixtures/vcr_cassettes/find_user_failure.yml
|
@@ -198,6 +206,8 @@ files:
|
|
198
206
|
- test/fixtures/vcr_cassettes/installment_purchase_successful.yml
|
199
207
|
- test/fixtures/vcr_cassettes/purchase_fail.yml
|
200
208
|
- test/fixtures/vcr_cassettes/purchase_successful.yml
|
209
|
+
- test/fixtures/vcr_cassettes/purchase_with_capture_false_successful.yml
|
210
|
+
- test/fixtures/vcr_cassettes/purchase_with_capture_true_successful.yml
|
201
211
|
- test/fixtures/vcr_cassettes/purchase_with_three_d_secure_card_successful.yml
|
202
212
|
- test/fixtures/vcr_cassettes/purchase_with_verification_value.yml
|
203
213
|
- test/fixtures/vcr_cassettes/recurring_fail.yml
|
@@ -218,8 +228,8 @@ files:
|
|
218
228
|
- test/fixtures/vcr_cassettes/void_fail.yml
|
219
229
|
- test/fixtures/vcr_cassettes/void_successful.yml
|
220
230
|
- test/remote/gateways/remote_epsilon_convenience_store_test.rb
|
221
|
-
- test/remote/gateways/remote_epsilon_gmo_after_test.rb
|
222
231
|
- test/remote/gateways/remote_epsilon_gmo_id_test.rb
|
232
|
+
- test/remote/gateways/remote_epsilon_link_payment_test.rb
|
223
233
|
- test/remote/gateways/remote_epsilon_test.rb
|
224
234
|
- test/remote/gateways/remote_epsilon_virtual_account_test.rb
|
225
235
|
- test/test_helper.rb
|
@@ -229,7 +239,7 @@ homepage: http://github.com/pepabo/active_merchant-epsilon
|
|
229
239
|
licenses:
|
230
240
|
- MIT
|
231
241
|
metadata: {}
|
232
|
-
post_install_message:
|
242
|
+
post_install_message:
|
233
243
|
rdoc_options: []
|
234
244
|
require_paths:
|
235
245
|
- lib
|
@@ -244,18 +254,26 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
244
254
|
- !ruby/object:Gem::Version
|
245
255
|
version: '0'
|
246
256
|
requirements: []
|
247
|
-
rubygems_version: 3.
|
248
|
-
signing_key:
|
257
|
+
rubygems_version: 3.2.3
|
258
|
+
signing_key:
|
249
259
|
specification_version: 4
|
250
260
|
summary: Epsilon integration for ActiveMerchant.
|
251
261
|
test_files:
|
252
262
|
- test/fixtures/vcr_cassettes/autheticate_three_d_secure_card_successful.yml
|
253
263
|
- test/fixtures/vcr_cassettes/cancel_recurring_fail.yml
|
254
264
|
- test/fixtures/vcr_cassettes/cancel_recurring_successful.yml
|
265
|
+
- test/fixtures/vcr_cassettes/capture_failure.yml
|
266
|
+
- test/fixtures/vcr_cassettes/capture_success.yml
|
267
|
+
- test/fixtures/vcr_cassettes/capture_success_authorize.yml
|
255
268
|
- test/fixtures/vcr_cassettes/change_recurring_amount_failure.yml
|
256
269
|
- test/fixtures/vcr_cassettes/change_recurring_amount_successful.yml
|
257
270
|
- test/fixtures/vcr_cassettes/convenience_store_purchase_fail.yml
|
258
271
|
- test/fixtures/vcr_cassettes/convenience_store_purchase_successful.yml
|
272
|
+
- test/fixtures/vcr_cassettes/epsilon_link_type_not_sending_delivery_information_purchase_successful.yml
|
273
|
+
- test/fixtures/vcr_cassettes/epsilon_link_type_purchase_fail.yml
|
274
|
+
- test/fixtures/vcr_cassettes/epsilon_link_type_purchase_successful.yml
|
275
|
+
- test/fixtures/vcr_cassettes/epsilon_link_type_void_fail.yml
|
276
|
+
- test/fixtures/vcr_cassettes/epsilon_link_type_void_successfull.yml
|
259
277
|
- test/fixtures/vcr_cassettes/find_order_failure.yml
|
260
278
|
- test/fixtures/vcr_cassettes/find_order_success.yml
|
261
279
|
- test/fixtures/vcr_cassettes/find_user_failure.yml
|
@@ -269,6 +287,8 @@ test_files:
|
|
269
287
|
- test/fixtures/vcr_cassettes/installment_purchase_successful.yml
|
270
288
|
- test/fixtures/vcr_cassettes/purchase_fail.yml
|
271
289
|
- test/fixtures/vcr_cassettes/purchase_successful.yml
|
290
|
+
- test/fixtures/vcr_cassettes/purchase_with_capture_false_successful.yml
|
291
|
+
- test/fixtures/vcr_cassettes/purchase_with_capture_true_successful.yml
|
272
292
|
- test/fixtures/vcr_cassettes/purchase_with_three_d_secure_card_successful.yml
|
273
293
|
- test/fixtures/vcr_cassettes/purchase_with_verification_value.yml
|
274
294
|
- test/fixtures/vcr_cassettes/recurring_fail.yml
|
@@ -289,8 +309,8 @@ test_files:
|
|
289
309
|
- test/fixtures/vcr_cassettes/void_fail.yml
|
290
310
|
- test/fixtures/vcr_cassettes/void_successful.yml
|
291
311
|
- test/remote/gateways/remote_epsilon_convenience_store_test.rb
|
292
|
-
- test/remote/gateways/remote_epsilon_gmo_after_test.rb
|
293
312
|
- test/remote/gateways/remote_epsilon_gmo_id_test.rb
|
313
|
+
- test/remote/gateways/remote_epsilon_link_payment_test.rb
|
294
314
|
- test/remote/gateways/remote_epsilon_test.rb
|
295
315
|
- test/remote/gateways/remote_epsilon_virtual_account_test.rb
|
296
316
|
- test/test_helper.rb
|
data/.travis.yml
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- 2.3.8
|
4
|
-
- 2.4.5
|
5
|
-
- 2.5.3
|
6
|
-
|
7
|
-
script: bundle exec rake test:remote
|
8
|
-
script: bundle exec rake test:unit
|
9
|
-
|
10
|
-
notifications:
|
11
|
-
slack:
|
12
|
-
rooms:
|
13
|
-
secure: rYtA4FBXqKHYv+v7xA6FfkcsDXRexWyMj9WMG2YK7bgZoNG2N7q461Dr/lCU0JTuRGsxDIs5jHK+QFFZNW/h+SbhQfiew++W8FgoIbP/z7HuEW50SXLcigGb02YmQm+ybbh5Dw1QGmcTOVItXJfuFmrDm1fq0qO0HC0543Yn4BzrSdWnEWQSaK7JMBRc9aYVPc0VlWG8pGRLtW0PDb6D32MvEI4jPrnh2NPDomPT9YutmMC+jNBPKr72m68g3v2GogbX4irZ6Kp5UUUZtaDbt9yLRfNL/3bsVGVrS1S2qCO4If5xTtE7lvV807a8QuQIj4Y9YqRO7K+/wUrz4Yb2ycF7agAkjN+w2WNEjgsKeFk50R4BWKpSy6y2N2RIl7rdHVEnU1T9I6LH0do5hMGqhgDYgppb2F7YFL9buUqag6gKAX3BHIV16ADJOFBT2Hh2m6x9f5TRb5ZR4LDJBQaflMhj0pwmIcC5Bhr3yi45r/4xiJ1IQaspXCzvfUMXARgWqqSxxveVQ07obiFeFCZ2YJEyv9fYLxT39+9koP48iKHTzbtFi4ay37PfMaztiXM0dqTwdjbJ95krc8AoNuTDphgwLLW2Zxxz2+tFQiLcj1tebUZa1hBsil1EVI7P/8PjAjGowckCnEAnFBZS5oFrgE2qzuwIGbLRYeeoRev0tks=
|
@@ -1,42 +0,0 @@
|
|
1
|
-
module ActiveMerchant #:nodoc:
|
2
|
-
module Billing #:nodoc:
|
3
|
-
class EpsilonGmoAfterGateway < EpsilonBaseGateway
|
4
|
-
|
5
|
-
RESPONSE_KEYS = DEFAULT_RESPONSE_KEYS + [
|
6
|
-
:redirect,
|
7
|
-
]
|
8
|
-
|
9
|
-
def purchase(amount, detail = {})
|
10
|
-
params = {
|
11
|
-
contract_code: self.contract_code,
|
12
|
-
user_id: detail[:user_id],
|
13
|
-
user_name: detail[:user_name],
|
14
|
-
user_mail_add: detail[:user_email],
|
15
|
-
item_code: detail[:item_code],
|
16
|
-
item_name: detail[:item_name],
|
17
|
-
order_number: detail[:order_number],
|
18
|
-
st_code: '00000-0000-00000-00010-00000-00000-00000',
|
19
|
-
mission_code: EpsilonMissionCode::PURCHASE,
|
20
|
-
item_price: amount,
|
21
|
-
process_code: EpsilonProcessCode::FIRST,
|
22
|
-
xml: 1, # 応答形式。1: xml形式を固定
|
23
|
-
delivery_code: 99, # 配送区分。99で固定
|
24
|
-
consignee_postal: detail[:consignee_postal],
|
25
|
-
consignee_name: detail[:consignee_name],
|
26
|
-
consignee_address: detail[:consignee_address],
|
27
|
-
consignee_tel: detail[:consignee_tel],
|
28
|
-
orderer_postal: detail[:orderer_postal],
|
29
|
-
orderer_name: detail[:orderer_name],
|
30
|
-
orderer_address: detail[:orderer_address],
|
31
|
-
orderer_tel: detail[:orderer_tel],
|
32
|
-
}
|
33
|
-
|
34
|
-
params[:memo1] = detail[:memo1] if detail.has_key?(:memo1)
|
35
|
-
params[:memo2] = detail[:memo2] if detail.has_key?(:memo2)
|
36
|
-
params[:user_tel] = detail[:user_tel] if detail.has_key?(:user_tel)
|
37
|
-
|
38
|
-
commit('receive_order3.cgi', params, RESPONSE_KEYS)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -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
|