active_merchant-epsilon 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +5 -0
- data/lib/active_merchant/billing/gateways/epsilon_link_payment.rb +9 -0
- data/lib/active_merchant/epsilon/version.rb +1 -1
- data/test/fixtures/vcr_cassettes/epsilon_link_type_purchase_fail.yml +43 -0
- data/test/fixtures/vcr_cassettes/epsilon_link_type_purchase_successfull.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/remote/gateways/remote_epsilon_link_payment_test.rb +46 -0
- data/test/test_helper.rb +46 -0
- metadata +13 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a03c39c4cec54b9fc58239c06fa68f6cc744f23eae1f24d1d358adee4b9690d
|
4
|
+
data.tar.gz: ad13565004a9be017201bf3e7943119f454ce02e15de7525b862842a6d826181
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb9788ea30e77a481f94435e89b82469a96bc66a385e7a0cc73a8f581487dc0129f148e53e2fc9a7114edf632a2cf2b11d1d189c52e53deb899b70b925225989
|
7
|
+
data.tar.gz: 527de254d4c3e0d64bdcbb067c10f6ff6428a007b920742125288e33e6362d22f89d16ab0c0356cc4046ffb1c4ab35037b30492f56174b2d73c2a40d761f5ad0
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -345,6 +345,11 @@ else
|
|
345
345
|
end
|
346
346
|
```
|
347
347
|
|
348
|
+
### Epsilon Link Payment Void Transaction
|
349
|
+
```ruby
|
350
|
+
gateway.void('order_number')
|
351
|
+
```
|
352
|
+
|
348
353
|
### Error handling
|
349
354
|
|
350
355
|
If epsilon server returns status excepted 200, `#purchase` method raise `ActiveMerchant::ResponseError`.
|
@@ -37,6 +37,15 @@ module ActiveMerchant #:nodoc:
|
|
37
37
|
|
38
38
|
commit('receive_order3.cgi', params, RESPONSE_KEYS)
|
39
39
|
end
|
40
|
+
|
41
|
+
def void(order_number)
|
42
|
+
params = {
|
43
|
+
contract_code: self.contract_code,
|
44
|
+
order_number: order_number
|
45
|
+
}
|
46
|
+
|
47
|
+
commit('cancel_payment.cgi', params)
|
48
|
+
end
|
40
49
|
end
|
41
50
|
end
|
42
51
|
end
|
@@ -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=U1594794223&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=O43585140&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
|
+
- Wed, 15 Jul 2020 06:23:43 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%3D1Mj2rD9EYR099" />
|
42
|
+
</Epsilon_result>
|
43
|
+
recorded_at: Wed, 15 Jul 2020 06:23:44 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,46 @@
|
|
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_successfull
|
10
|
+
VCR.use_cassette(:epsilon_link_type_purchase_successfull) 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_purchase_fail
|
19
|
+
VCR.use_cassette(:epsilon_link_type_purchase_fail) do
|
20
|
+
response = gateway.purchase(10000, invalid_epsilon_link_type_purchase_detail)
|
21
|
+
|
22
|
+
assert_equal false, response.success?
|
23
|
+
assert_equal true, response.params["error_detail"].valid_encoding?
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_epsilon_link_type_void_successfull
|
28
|
+
VCR.use_cassette(:epsilon_link_type_void_successfull) do
|
29
|
+
# あらかじめ課金済ステータスの受注がイプシロン側にないと取り消しができないため、課金済の受注をイプシロン側で作成しておいた。
|
30
|
+
# ここでは void の引数として作成済の受注のorder_numberを渡している。
|
31
|
+
# VCRのキャッシュを作成し直す場合は変更しないとエラーとなる。
|
32
|
+
response = gateway.void('595213151')
|
33
|
+
|
34
|
+
assert_equal true, response.success?
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_epsilon_link_type_void_fail
|
39
|
+
VCR.use_cassette(:epsilon_link_type_void_fail) do
|
40
|
+
response = gateway.void('invalid_order_number')
|
41
|
+
|
42
|
+
assert_equal false, response.success?
|
43
|
+
assert_equal true, response.params["error_detail"].valid_encoding?
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -230,6 +230,52 @@ module SamplePaymentMethods
|
|
230
230
|
}
|
231
231
|
end
|
232
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 invalid_epsilon_link_type_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: 'invalid_id',
|
266
|
+
memo1: 'memo1',
|
267
|
+
memo2: 'memo2',
|
268
|
+
consignee_postal: '1000001',
|
269
|
+
consignee_name: 'イプシロンタロウ',
|
270
|
+
consignee_address: '東京都千代田区千代田1番1号',
|
271
|
+
consignee_tel: '0312345678',
|
272
|
+
orderer_postal: '1000001',
|
273
|
+
orderer_name: 'YAMADA Taro',
|
274
|
+
orderer_address: '東京都千代田区千代田1番1号',
|
275
|
+
orderer_tel: '0312345678',
|
276
|
+
}
|
277
|
+
end
|
278
|
+
|
233
279
|
def fixture_xml(filename, parse: true)
|
234
280
|
xml = File.read("test/fixtures/#{filename}")
|
235
281
|
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.11.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: 2020-
|
11
|
+
date: 2020-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|
@@ -188,6 +188,10 @@ files:
|
|
188
188
|
- test/fixtures/vcr_cassettes/change_recurring_amount_successful.yml
|
189
189
|
- test/fixtures/vcr_cassettes/convenience_store_purchase_fail.yml
|
190
190
|
- test/fixtures/vcr_cassettes/convenience_store_purchase_successful.yml
|
191
|
+
- test/fixtures/vcr_cassettes/epsilon_link_type_purchase_fail.yml
|
192
|
+
- test/fixtures/vcr_cassettes/epsilon_link_type_purchase_successfull.yml
|
193
|
+
- test/fixtures/vcr_cassettes/epsilon_link_type_void_fail.yml
|
194
|
+
- test/fixtures/vcr_cassettes/epsilon_link_type_void_successfull.yml
|
191
195
|
- test/fixtures/vcr_cassettes/find_order_failure.yml
|
192
196
|
- test/fixtures/vcr_cassettes/find_order_success.yml
|
193
197
|
- test/fixtures/vcr_cassettes/find_user_failure.yml
|
@@ -225,6 +229,7 @@ files:
|
|
225
229
|
- test/remote/gateways/remote_epsilon_convenience_store_test.rb
|
226
230
|
- test/remote/gateways/remote_epsilon_gmo_after_test.rb
|
227
231
|
- test/remote/gateways/remote_epsilon_gmo_id_test.rb
|
232
|
+
- test/remote/gateways/remote_epsilon_link_payment_test.rb
|
228
233
|
- test/remote/gateways/remote_epsilon_test.rb
|
229
234
|
- test/remote/gateways/remote_epsilon_virtual_account_test.rb
|
230
235
|
- test/test_helper.rb
|
@@ -249,7 +254,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
249
254
|
- !ruby/object:Gem::Version
|
250
255
|
version: '0'
|
251
256
|
requirements: []
|
252
|
-
rubygems_version: 3.
|
257
|
+
rubygems_version: 3.0.3
|
253
258
|
signing_key:
|
254
259
|
specification_version: 4
|
255
260
|
summary: Epsilon integration for ActiveMerchant.
|
@@ -264,6 +269,10 @@ test_files:
|
|
264
269
|
- test/fixtures/vcr_cassettes/change_recurring_amount_successful.yml
|
265
270
|
- test/fixtures/vcr_cassettes/convenience_store_purchase_fail.yml
|
266
271
|
- test/fixtures/vcr_cassettes/convenience_store_purchase_successful.yml
|
272
|
+
- test/fixtures/vcr_cassettes/epsilon_link_type_purchase_fail.yml
|
273
|
+
- test/fixtures/vcr_cassettes/epsilon_link_type_purchase_successfull.yml
|
274
|
+
- test/fixtures/vcr_cassettes/epsilon_link_type_void_fail.yml
|
275
|
+
- test/fixtures/vcr_cassettes/epsilon_link_type_void_successfull.yml
|
267
276
|
- test/fixtures/vcr_cassettes/find_order_failure.yml
|
268
277
|
- test/fixtures/vcr_cassettes/find_order_success.yml
|
269
278
|
- test/fixtures/vcr_cassettes/find_user_failure.yml
|
@@ -301,6 +310,7 @@ test_files:
|
|
301
310
|
- test/remote/gateways/remote_epsilon_convenience_store_test.rb
|
302
311
|
- test/remote/gateways/remote_epsilon_gmo_after_test.rb
|
303
312
|
- test/remote/gateways/remote_epsilon_gmo_id_test.rb
|
313
|
+
- test/remote/gateways/remote_epsilon_link_payment_test.rb
|
304
314
|
- test/remote/gateways/remote_epsilon_test.rb
|
305
315
|
- test/remote/gateways/remote_epsilon_virtual_account_test.rb
|
306
316
|
- test/test_helper.rb
|