active_merchant-epsilon 0.11.0 → 0.12.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 +7 -1
- data/lib/active_merchant/billing/gateways/epsilon_link_payment.rb +14 -10
- data/lib/active_merchant/epsilon/version.rb +1 -1
- 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_successfull.yml → epsilon_link_type_purchase_successful.yml} +4 -4
- data/test/remote/gateways/remote_epsilon_link_payment_test.rb +11 -2
- data/test/test_helper.rb +15 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca6ef67e1e4a642d9396edeb901120bec894ec43254821f6d7a5aa793dc18550
|
4
|
+
data.tar.gz: 80a96286669e5f389c0806f7f35b3ea72fc37e437116d3a0620ac7e919544bbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfcca339864f03676b21d1404d3f034c9e374185b7ea63b00ef41cfce0d3a050284eff21d826ac13060d7e190bfa061caf79f37e6b91396e7ec92d35e242ca76
|
7
|
+
data.tar.gz: 9f34fb7ae71ac00e59840b9c6608a0dd934d46c9c8e771f48a9cdd700ac63cddd4ce901d31f3dd5d107492698d6eea17f757262db01d09512d20a698200e5785
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
### 0.12.0
|
4
|
+
|
5
|
+
- [Add Parameter `delivery_info_required` to purchase method for Epsilon Link Payment](https://github.com/pepabo/active_merchant-epsilon/pull/116)
|
6
|
+
|
3
7
|
### 0.11.0
|
4
8
|
|
5
9
|
- [Add void mehotd for Epsilon Link Payment](https://github.com/pepabo/active_merchant-epsilon/pull/114)
|
data/README.md
CHANGED
@@ -307,6 +307,10 @@ end
|
|
307
307
|
EpsilosLinkPaymentGateway is available in all link payments.
|
308
308
|
For example, GMO Payment After Delivery.
|
309
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`.
|
313
|
+
|
310
314
|
```ruby
|
311
315
|
ActiveMerchant::Billing::EpsilonLinkPaymentGateway.contract_code = 'YOUR_CONTRACT_CODE'
|
312
316
|
|
@@ -335,7 +339,9 @@ purchase_detail = {
|
|
335
339
|
memo2: 'memo2',
|
336
340
|
}
|
337
341
|
|
338
|
-
|
342
|
+
delivery_info_required = true
|
343
|
+
|
344
|
+
response = gateway.purchase(amount, purchase_detail, delivery_info_required)
|
339
345
|
|
340
346
|
if response.success?
|
341
347
|
puts "Successfully send order data"
|
@@ -6,7 +6,7 @@ module ActiveMerchant #:nodoc:
|
|
6
6
|
:redirect,
|
7
7
|
]
|
8
8
|
|
9
|
-
def purchase(amount, detail = {})
|
9
|
+
def purchase(amount, detail = {}, delivery_info_required = true)
|
10
10
|
params = {
|
11
11
|
contract_code: self.contract_code,
|
12
12
|
user_id: detail[:user_id],
|
@@ -20,17 +20,21 @@ module ActiveMerchant #:nodoc:
|
|
20
20
|
item_price: amount,
|
21
21
|
process_code: EpsilonProcessCode::FIRST,
|
22
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
23
|
}
|
33
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
|
+
|
34
38
|
params[:memo1] = detail[:memo1] if detail.has_key?(:memo1)
|
35
39
|
params[:memo2] = detail[:memo2] if detail.has_key?(:memo2)
|
36
40
|
params[:user_tel] = detail[:user_tel] if detail.has_key?(:user_tel)
|
@@ -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
|
@@ -5,7 +5,7 @@ http_interactions:
|
|
5
5
|
uri: https://beta.epsilon.jp/cgi-bin/order/receive_order3.cgi
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: contract_code=[CONTRACT_CODE]&user_id=
|
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
9
|
headers:
|
10
10
|
Content-Type:
|
11
11
|
- application/x-www-form-urlencoded
|
@@ -23,7 +23,7 @@ http_interactions:
|
|
23
23
|
message: OK
|
24
24
|
headers:
|
25
25
|
Date:
|
26
|
-
-
|
26
|
+
- Fri, 04 Sep 2020 05:52:38 GMT
|
27
27
|
Server:
|
28
28
|
- Apache
|
29
29
|
Connection:
|
@@ -38,7 +38,7 @@ http_interactions:
|
|
38
38
|
<?xml version="1.0" encoding="UTF-8" ?>
|
39
39
|
<Epsilon_result>
|
40
40
|
<result result="1" />
|
41
|
-
<result redirect="https%3A%2F%2Fbeta.epsilon.jp%2Fcgi-bin%2Forder%2Fmethod_select3.cgi%3Ftrans_code%
|
41
|
+
<result redirect="https%3A%2F%2Fbeta.epsilon.jp%2Fcgi-bin%2Forder%2Fmethod_select3.cgi%3Ftrans_code%3DIOnPh3Psm7k86" />
|
42
42
|
</Epsilon_result>
|
43
|
-
recorded_at:
|
43
|
+
recorded_at: Fri, 04 Sep 2020 05:52:38 GMT
|
44
44
|
recorded_with: VCR 6.0.0
|
@@ -6,8 +6,8 @@ class RemoteEpsilonLinkPaymentTest < MiniTest::Test
|
|
6
6
|
@gateway ||= ActiveMerchant::Billing::EpsilonLinkPaymentGateway.new
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
10
|
-
VCR.use_cassette(:
|
9
|
+
def test_epsilon_link_type_purchase_successful
|
10
|
+
VCR.use_cassette(:epsilon_link_type_purchase_successful) do
|
11
11
|
response = gateway.purchase(10000, valid_epsilon_link_type_purchase_detail)
|
12
12
|
|
13
13
|
assert_equal true, response.success?
|
@@ -15,6 +15,15 @@ class RemoteEpsilonLinkPaymentTest < MiniTest::Test
|
|
15
15
|
end
|
16
16
|
end
|
17
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
|
+
|
18
27
|
def test_epsilon_link_type_purchase_fail
|
19
28
|
VCR.use_cassette(:epsilon_link_type_purchase_fail) do
|
20
29
|
response = gateway.purchase(10000, invalid_epsilon_link_type_purchase_detail)
|
data/test/test_helper.rb
CHANGED
@@ -253,6 +253,21 @@ module SamplePaymentMethods
|
|
253
253
|
}
|
254
254
|
end
|
255
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
|
+
|
256
271
|
def invalid_epsilon_link_type_purchase_detail
|
257
272
|
now = Time.now
|
258
273
|
{
|
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.12.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-07
|
11
|
+
date: 2020-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|
@@ -188,8 +188,9 @@ 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_not_sending_delivery_information_purchase_successful.yml
|
191
192
|
- test/fixtures/vcr_cassettes/epsilon_link_type_purchase_fail.yml
|
192
|
-
- test/fixtures/vcr_cassettes/
|
193
|
+
- test/fixtures/vcr_cassettes/epsilon_link_type_purchase_successful.yml
|
193
194
|
- test/fixtures/vcr_cassettes/epsilon_link_type_void_fail.yml
|
194
195
|
- test/fixtures/vcr_cassettes/epsilon_link_type_void_successfull.yml
|
195
196
|
- test/fixtures/vcr_cassettes/find_order_failure.yml
|
@@ -269,8 +270,9 @@ test_files:
|
|
269
270
|
- test/fixtures/vcr_cassettes/change_recurring_amount_successful.yml
|
270
271
|
- test/fixtures/vcr_cassettes/convenience_store_purchase_fail.yml
|
271
272
|
- test/fixtures/vcr_cassettes/convenience_store_purchase_successful.yml
|
273
|
+
- test/fixtures/vcr_cassettes/epsilon_link_type_not_sending_delivery_information_purchase_successful.yml
|
272
274
|
- test/fixtures/vcr_cassettes/epsilon_link_type_purchase_fail.yml
|
273
|
-
- test/fixtures/vcr_cassettes/
|
275
|
+
- test/fixtures/vcr_cassettes/epsilon_link_type_purchase_successful.yml
|
274
276
|
- test/fixtures/vcr_cassettes/epsilon_link_type_void_fail.yml
|
275
277
|
- test/fixtures/vcr_cassettes/epsilon_link_type_void_successfull.yml
|
276
278
|
- test/fixtures/vcr_cassettes/find_order_failure.yml
|