active_merchant-epsilon 0.9.2 → 0.12.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.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +0 -1
  3. data/CHANGELOG.md +20 -0
  4. data/README.md +19 -4
  5. data/lib/active_merchant/billing/gateways/epsilon.rb +13 -0
  6. data/lib/active_merchant/billing/gateways/epsilon/epsilon_base.rb +2 -1
  7. data/lib/active_merchant/billing/gateways/epsilon_link_payment.rb +55 -0
  8. data/lib/active_merchant/billing/gateways/response_parser.rb +6 -7
  9. data/lib/active_merchant/epsilon.rb +1 -1
  10. data/lib/active_merchant/epsilon/version.rb +1 -1
  11. data/test/fixtures/vcr_cassettes/capture_failure.yml +45 -0
  12. data/test/fixtures/vcr_cassettes/capture_success.yml +45 -0
  13. data/test/fixtures/vcr_cassettes/capture_success_authorize.yml +49 -0
  14. data/test/fixtures/vcr_cassettes/epsilon_link_type_not_sending_delivery_information_purchase_successful.yml +44 -0
  15. data/test/fixtures/vcr_cassettes/epsilon_link_type_purchase_fail.yml +43 -0
  16. data/test/fixtures/vcr_cassettes/epsilon_link_type_purchase_successful.yml +44 -0
  17. data/test/fixtures/vcr_cassettes/epsilon_link_type_void_fail.yml +45 -0
  18. data/test/fixtures/vcr_cassettes/epsilon_link_type_void_successfull.yml +45 -0
  19. data/test/fixtures/vcr_cassettes/gmo_after_purchase_fail.yml +4 -4
  20. data/test/fixtures/vcr_cassettes/gmo_after_purchase_successful.yml +4 -4
  21. data/test/fixtures/vcr_cassettes/purchase_with_capture_false_successful.yml +49 -0
  22. data/test/fixtures/vcr_cassettes/purchase_with_capture_true_successful.yml +49 -0
  23. data/test/remote/gateways/remote_epsilon_convenience_store_test.rb +1 -0
  24. data/test/remote/gateways/remote_epsilon_gmo_after_test.rb +1 -0
  25. data/test/remote/gateways/remote_epsilon_gmo_id_test.rb +1 -0
  26. data/test/remote/gateways/remote_epsilon_link_payment_test.rb +55 -0
  27. data/test/remote/gateways/remote_epsilon_test.rb +44 -0
  28. data/test/remote/gateways/remote_epsilon_virtual_account_test.rb +2 -1
  29. data/test/test_helper.rb +68 -5
  30. metadata +25 -3
  31. data/lib/active_merchant/billing/gateways/epsilon_gmo_after.rb +0 -38
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 915567d0ef3dfd3c77a829198bcf4fbc62e29a2a8bc5840b99c6ce1ae8337073
4
- data.tar.gz: f95f8b2405b3e6b9139688157ceeb962789a72bfe83f251503879dd1ff128c84
3
+ metadata.gz: ca6ef67e1e4a642d9396edeb901120bec894ec43254821f6d7a5aa793dc18550
4
+ data.tar.gz: 80a96286669e5f389c0806f7f35b3ea72fc37e437116d3a0620ac7e919544bbb
5
5
  SHA512:
6
- metadata.gz: f958bcbe2ab8f3cbe876396b4460017c38e65aa1ec8f8140326a3f65185612ab9a8bc89d57be4f3d4aafe9b06aa2dbf4eafee7e419553739dfb6300cc6f65418
7
- data.tar.gz: 79bd291e76a237d3a478bfd1c76bc4b28c9edc1e99d5f0ab990e282485af9630ce2822f2f0874cfacd7df6789b8bf885e2e4a13ac5ab995d5bb6789fd2222bba
6
+ metadata.gz: cfcca339864f03676b21d1404d3f034c9e374185b7ea63b00ef41cfce0d3a050284eff21d826ac13060d7e190bfa061caf79f37e6b91396e7ec92d35e242ca76
7
+ data.tar.gz: 9f34fb7ae71ac00e59840b9c6608a0dd934d46c9c8e771f48a9cdd700ac63cddd4ce901d31f3dd5d107492698d6eea17f757262db01d09512d20a698200e5785
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.3.8
4
3
  - 2.4.5
5
4
  - 2.5.3
6
5
 
@@ -1,5 +1,25 @@
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
+
7
+ ### 0.11.0
8
+
9
+ - [Add void mehotd for Epsilon Link Payment](https://github.com/pepabo/active_merchant-epsilon/pull/114)
10
+
11
+ ### 0.10.0
12
+
13
+ * [Capture authorized payments](https://github.com/pepabo/active_merchant-epsilon/pull/112)
14
+
15
+ ### 0.9.4
16
+
17
+ * [Support Epsilon Link Payment instead of GMO Payment After Delivery](https://github.com/pepabo/active_merchant-epsilon/pull/110)
18
+
19
+ ### 0.9.3
20
+
21
+ * [Fix API version for GMO Payment After Delivery](https://github.com/pepabo/active_merchant-epsilon/pull/108)
22
+
3
23
  ### 0.9.2
4
24
 
5
25
  * [Support GMO Payment After Delivery](https://github.com/pepabo/active_merchant-epsilon/pull/106)
data/README.md CHANGED
@@ -302,12 +302,19 @@ else
302
302
  end
303
303
  ```
304
304
 
305
- ### GMO Payment After Delivery
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::EpsilonGmoAfterGateway.contract_code = 'YOUR_CONTRACT_CODE'
315
+ ActiveMerchant::Billing::EpsilonLinkPaymentGateway.contract_code = 'YOUR_CONTRACT_CODE'
309
316
 
310
- gateway = ActiveMerchant::Billing::EpsilonGmoAfterGateway.new
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
- response = gateway.purchase(amount, purchase_detail)
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
@@ -182,6 +185,15 @@ module ActiveMerchant #:nodoc:
182
185
  commit(PATHS[:find_order], params, response_keys)
183
186
  end
184
187
 
188
+ def capture(order_number)
189
+ params = {
190
+ contract_code: self.contract_code,
191
+ order_number: order_number,
192
+ }
193
+
194
+ commit(PATHS[:capture], params)
195
+ end
196
+
185
197
  private
186
198
 
187
199
  def billing_params(amount, payment_method, detail)
@@ -208,6 +220,7 @@ module ActiveMerchant #:nodoc:
208
220
 
209
221
  params[:memo1] = detail[:memo1] if detail.has_key?(:memo1)
210
222
  params[:memo2] = detail[:memo2] if detail.has_key?(:memo2)
223
+ params[:kari_flag] = detail[:capture] ? 2 : 1 if detail.has_key?(:capture)
211
224
 
212
225
  if detail.has_key?(:token)
213
226
  params[:token] = detail[:token]
@@ -49,7 +49,8 @@ module ActiveMerchant #:nodoc:
49
49
  :acs_url,
50
50
  :pa_req,
51
51
  :receipt_number,
52
- :receipt_date
52
+ :receipt_date,
53
+ :captured,
53
54
  ].freeze
54
55
 
55
56
  private
@@ -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
@@ -123,14 +123,12 @@ module ActiveMerchant #:nodoc:
123
123
  uri_decode(@xml.xpath(ResponseXpath::REDIRECT).to_s)
124
124
  end
125
125
 
126
- def uri_decode(string)
127
- decoded_string = CGI.unescape(string)
128
-
129
- unless decoded_string.encoding == Encoding::UTF_8
130
- decoded_string = decoded_string.encode(Encoding::UTF_8, Encoding::CP932)
131
- end
126
+ def captured
127
+ @xml.xpath(ResponseXpath::CAPTURED).to_s != '1'
128
+ end
132
129
 
133
- decoded_string
130
+ def uri_decode(string)
131
+ CGI.unescape(string).encode(Encoding::UTF_8, Encoding::CP932)
134
132
  end
135
133
 
136
134
  module ResponseXpath
@@ -159,6 +157,7 @@ module ActiveMerchant #:nodoc:
159
157
  PAYMENT_CODE = '//Epsilon_result/result[@payment_code]/@payment_code'
160
158
  AMOUNT = '//Epsilon_result/result[@amount]/@amount'
161
159
  REDIRECT = '//Epsilon_result/result[@redirect]/@redirect'
160
+ CAPTURED = '//Epsilon_result/result[@kari_flag]/@kari_flag'
162
161
  end
163
162
 
164
163
  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/epsilon_gmo_after'
13
+ require_relative 'billing/gateways/epsilon_link_payment'
14
14
  require_relative 'billing/gateways/response_parser'
@@ -1,5 +1,5 @@
1
1
  module ActiveMerchant
2
2
  module Epsilon
3
- VERSION = "0.9.2"
3
+ VERSION = "0.12.0"
4
4
  end
5
5
  end
@@ -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
@@ -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=&user_name=YAMADA+Taro&user_mail_add=yamada-taro%40example.com&item_code=ITEM001&item_name=Greate+Product&order_number=O2665045&st_code=00000-0000-00000-00010-00000-00000-00000&mission_code=1&item_price=10000&process_code=1&xml=1&delivery_code=99&consignee_postal=1500002&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%E6%B8%8B%E8%B0%B7%E5%8C%BA%EF%BC%91%E2%88%92%EF%BC%91%E2%88%92%EF%BC%91&consignee_tel=0312345678&orderer_postal=1500002&orderer_name=YAMADA+Taro&orderer_address=%E6%9D%B1%E4%BA%AC%E9%83%BD%E6%B8%8B%E8%B0%B7%E5%8C%BA1-1-1&orderer_tel=0312345678&version=2&memo1=memo1&memo2=memo2
8
+ string: contract_code=[CONTRACT_CODE]&user_id=&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=O666431&st_code=00000-0000-00000-00010-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&user_tel=0312345678
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
- - Fri, 13 Mar 2020 02:42:03 GMT
26
+ - Wed, 18 Mar 2020 05:58:06 GMT
27
27
  Server:
28
28
  - Apache
29
29
  Connection:
@@ -36,9 +36,9 @@ http_interactions:
36
36
  encoding: UTF-8
37
37
  string: "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n <Epsilon_result>\r\n
38
38
  \ <result result=\"0\" />\r\n <result err_code=\"601\" />\r\n <result
39
- err_detail=\"%E3%83%A6%E3%83%BC%E3%82%B6%E3%83%BCID%E3%81%AE%E5%BD%A2%E5%BC%8F%E3%81%8C%E7%95%B0%E5%B8%B8%E3%81%A7%E3%81%99\"
39
+ err_detail=\"%83%86%81%5B%83U%81%5BID%82%CC%8C%60%8E%AE%82%AA%88%D9%8F%ED%82%C5%82%B7\"
40
40
  />\r\n <result memo1=\"memo1\" />\r\n <result memo2=\"memo2\" />\r\n
41
41
  \ </Epsilon_result>\r\n"
42
42
  http_version: null
43
- recorded_at: Fri, 13 Mar 2020 02:42:04 GMT
43
+ recorded_at: Wed, 18 Mar 2020 05:58:07 GMT
44
44
  recorded_with: VCR 5.1.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=U1584067324&user_name=YAMADA+Taro&user_mail_add=yamada-taro%40example.com&item_code=ITEM001&item_name=Greate+Product&order_number=O4628159&st_code=00000-0000-00000-00010-00000-00000-00000&mission_code=1&item_price=10000&process_code=1&xml=1&delivery_code=99&consignee_postal=1500002&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%E6%B8%8B%E8%B0%B7%E5%8C%BA%EF%BC%91%E2%88%92%EF%BC%91%E2%88%92%EF%BC%91&consignee_tel=0312345678&orderer_postal=1500002&orderer_name=YAMADA+Taro&orderer_address=%E6%9D%B1%E4%BA%AC%E9%83%BD%E6%B8%8B%E8%B0%B7%E5%8C%BA1-1-1&orderer_tel=0312345678&version=2&memo1=memo1&memo2=memo2
8
+ string: contract_code=[CONTRACT_CODE]&user_id=U1584510803&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=O23603867&st_code=00000-0000-00000-00010-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&user_tel=0312345678
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
- - Fri, 13 Mar 2020 02:42:05 GMT
26
+ - Wed, 18 Mar 2020 05:53:23 GMT
27
27
  Server:
28
28
  - Apache
29
29
  Connection:
@@ -38,8 +38,8 @@ 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%3DpShgPaOlX%252Fs55" />
41
+ <result redirect="https%3A%2F%2Fbeta.epsilon.jp%2Fcgi-bin%2Forder%2Fmethod_select3.cgi%3Ftrans_code%3DITL3uKDMlWg41" />
42
42
  </Epsilon_result>
43
43
  http_version: null
44
- recorded_at: Fri, 13 Mar 2020 02:42:05 GMT
44
+ recorded_at: Wed, 18 Mar 2020 05:53:25 GMT
45
45
  recorded_with: VCR 5.1.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
@@ -24,6 +24,7 @@ class RemoteEpsilonConvenienceStoreGatewayTest < MiniTest::Test
24
24
  VCR.use_cassette(:convenience_store_purchase_fail) do
25
25
  response = gateway.purchase(10000, invalid_convenience_store, purchase_detail)
26
26
  assert_equal false, response.success?
27
+ assert_equal true, response.params["error_detail"].valid_encoding?
27
28
  end
28
29
  end
29
30
  end
@@ -24,6 +24,7 @@ class RemoteEpsilonGmoAfterGatewayTest < MiniTest::Test
24
24
  response = gateway.purchase(10000, invalid_purchase_detail)
25
25
 
26
26
  assert_equal false, response.success?
27
+ assert_equal true, response.params["error_detail"].valid_encoding?
27
28
  end
28
29
  end
29
30
  end
@@ -20,6 +20,7 @@ class RemoteEpsilonGmoIdGatewayTest < MiniTest::Test
20
20
  detail = invalid_gmo_id_purchase_detail
21
21
  response = gateway.purchase(200, detail)
22
22
  assert_equal false, response.success?
23
+ assert_equal true, response.params["error_detail"].valid_encoding?
23
24
  end
24
25
  end
25
26
 
@@ -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
@@ -72,10 +72,29 @@ class RemoteEpsilonGatewayTest < MiniTest::Test
72
72
  end
73
73
  end
74
74
 
75
+ def test_purchase_with_capture_true_successful
76
+ VCR.use_cassette(:purchase_with_capture_true_successful) do
77
+ response = gateway.purchase(1000, valid_credit_card, purchase_detail.merge(capture: true))
78
+
79
+ assert_equal true, response.success?
80
+ assert_equal true, response.params['captured']
81
+ end
82
+ end
83
+
84
+ def test_purchase_with_capture_false_successful
85
+ VCR.use_cassette(:purchase_with_capture_false_successful) do
86
+ response = gateway.purchase(1000, valid_credit_card, purchase_detail.merge(capture: false))
87
+
88
+ assert_equal true, response.success?
89
+ assert_equal false, response.params['captured']
90
+ end
91
+ end
92
+
75
93
  def test_purchase_fail
76
94
  VCR.use_cassette(:purchase_fail) do
77
95
  response = gateway.purchase(10000, invalid_credit_card, purchase_detail)
78
96
  assert_equal false, response.success?
97
+ assert_equal true, response.params["error_detail"].valid_encoding?
79
98
  end
80
99
  end
81
100
 
@@ -138,6 +157,7 @@ class RemoteEpsilonGatewayTest < MiniTest::Test
138
157
  )
139
158
 
140
159
  assert_equal false, response.success?
160
+ assert_equal true, response.params["error_detail"].valid_encoding?
141
161
  end
142
162
  end
143
163
 
@@ -239,6 +259,7 @@ class RemoteEpsilonGatewayTest < MiniTest::Test
239
259
  invalid_purchase_detail[:user_id] = ''
240
260
  response = gateway.registered_purchase(10000, invalid_purchase_detail)
241
261
  assert_equal false, response.success?
262
+ assert_equal true, response.params["error_detail"].valid_encoding?
242
263
  end
243
264
  end
244
265
 
@@ -283,4 +304,27 @@ class RemoteEpsilonGatewayTest < MiniTest::Test
283
304
  assert_equal false, response.success?
284
305
  end
285
306
  end
307
+
308
+ def test_capture_success
309
+ detail = purchase_detail
310
+
311
+ VCR.use_cassette(:capture_success_authorize) do
312
+ purchase_response = gateway.purchase(100, valid_credit_card, detail.merge(capture: false))
313
+
314
+ assert_equal true, purchase_response.success?
315
+ assert_equal false, purchase_response.params['captured']
316
+ end
317
+
318
+ VCR.use_cassette(:capture_success) do
319
+ response = gateway.capture(detail[:order_number])
320
+ assert_equal true, response.success?
321
+ end
322
+ end
323
+
324
+ def test_capture_failure
325
+ VCR.use_cassette(:capture_failure) do
326
+ response = gateway.capture('1234567890')
327
+ assert_equal false, response.success?
328
+ end
329
+ end
286
330
  end
@@ -31,6 +31,7 @@ class RemoteEpsilonVirtualAccountGatewayTest < MiniTest::Test
31
31
  VCR.use_cassette(:virtual_account_purchase_fail) do
32
32
  response = gateway.purchase(10000, invalid_purchase_detail)
33
33
  assert_equal false, response.success?
34
+ assert_equal true, response.params["error_detail"].valid_encoding?
34
35
  end
35
36
  end
36
- end
37
+ end
@@ -210,20 +210,83 @@ module SamplePaymentMethods
210
210
  now = Time.now
211
211
  {
212
212
  user_id: "U#{Time.now.to_i}",
213
- user_name: 'YAMADA Taro',
213
+ user_name: '山田 太郎',
214
214
  user_email: 'yamada-taro@example.com',
215
+ user_tel: '0312345678',
215
216
  item_code: 'ITEM001',
216
217
  item_name: 'Greate Product',
217
218
  order_number: "O#{now.sec}#{now.usec}",
219
+ st_code: '00000-0000-00000-00010-00000-00000-00000',
218
220
  memo1: 'memo1',
219
221
  memo2: 'memo2',
220
- consignee_postal: '1500002',
222
+ consignee_postal: '1000001',
223
+ consignee_name: 'イプシロンタロウ',
224
+ consignee_address: '東京都千代田区千代田1番1号',
225
+ consignee_tel: '0312345678',
226
+ orderer_postal: '1000001',
227
+ orderer_name: 'YAMADA Taro',
228
+ orderer_address: '東京都千代田区千代田1番1号',
229
+ orderer_tel: '0312345678',
230
+ }
231
+ end
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',
221
284
  consignee_name: 'イプシロンタロウ',
222
- consignee_address: '東京都渋谷区1−1−1',
285
+ consignee_address: '東京都千代田区千代田1番1号',
223
286
  consignee_tel: '0312345678',
224
- orderer_postal: '1500002',
287
+ orderer_postal: '1000001',
225
288
  orderer_name: 'YAMADA Taro',
226
- orderer_address: '東京都渋谷区1-1-1',
289
+ orderer_address: '東京都千代田区千代田11',
227
290
  orderer_tel: '0312345678',
228
291
  }
229
292
  end
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.9.2
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-03-13 00:00:00.000000000 Z
11
+ date: 2020-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemerchant
@@ -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
@@ -220,6 +230,7 @@ files:
220
230
  - test/remote/gateways/remote_epsilon_convenience_store_test.rb
221
231
  - test/remote/gateways/remote_epsilon_gmo_after_test.rb
222
232
  - test/remote/gateways/remote_epsilon_gmo_id_test.rb
233
+ - test/remote/gateways/remote_epsilon_link_payment_test.rb
223
234
  - test/remote/gateways/remote_epsilon_test.rb
224
235
  - test/remote/gateways/remote_epsilon_virtual_account_test.rb
225
236
  - test/test_helper.rb
@@ -252,10 +263,18 @@ test_files:
252
263
  - test/fixtures/vcr_cassettes/autheticate_three_d_secure_card_successful.yml
253
264
  - test/fixtures/vcr_cassettes/cancel_recurring_fail.yml
254
265
  - test/fixtures/vcr_cassettes/cancel_recurring_successful.yml
266
+ - test/fixtures/vcr_cassettes/capture_failure.yml
267
+ - test/fixtures/vcr_cassettes/capture_success.yml
268
+ - test/fixtures/vcr_cassettes/capture_success_authorize.yml
255
269
  - test/fixtures/vcr_cassettes/change_recurring_amount_failure.yml
256
270
  - test/fixtures/vcr_cassettes/change_recurring_amount_successful.yml
257
271
  - test/fixtures/vcr_cassettes/convenience_store_purchase_fail.yml
258
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
274
+ - test/fixtures/vcr_cassettes/epsilon_link_type_purchase_fail.yml
275
+ - test/fixtures/vcr_cassettes/epsilon_link_type_purchase_successful.yml
276
+ - test/fixtures/vcr_cassettes/epsilon_link_type_void_fail.yml
277
+ - test/fixtures/vcr_cassettes/epsilon_link_type_void_successfull.yml
259
278
  - test/fixtures/vcr_cassettes/find_order_failure.yml
260
279
  - test/fixtures/vcr_cassettes/find_order_success.yml
261
280
  - test/fixtures/vcr_cassettes/find_user_failure.yml
@@ -269,6 +288,8 @@ test_files:
269
288
  - test/fixtures/vcr_cassettes/installment_purchase_successful.yml
270
289
  - test/fixtures/vcr_cassettes/purchase_fail.yml
271
290
  - test/fixtures/vcr_cassettes/purchase_successful.yml
291
+ - test/fixtures/vcr_cassettes/purchase_with_capture_false_successful.yml
292
+ - test/fixtures/vcr_cassettes/purchase_with_capture_true_successful.yml
272
293
  - test/fixtures/vcr_cassettes/purchase_with_three_d_secure_card_successful.yml
273
294
  - test/fixtures/vcr_cassettes/purchase_with_verification_value.yml
274
295
  - test/fixtures/vcr_cassettes/recurring_fail.yml
@@ -291,6 +312,7 @@ test_files:
291
312
  - test/remote/gateways/remote_epsilon_convenience_store_test.rb
292
313
  - test/remote/gateways/remote_epsilon_gmo_after_test.rb
293
314
  - test/remote/gateways/remote_epsilon_gmo_id_test.rb
315
+ - test/remote/gateways/remote_epsilon_link_payment_test.rb
294
316
  - test/remote/gateways/remote_epsilon_test.rb
295
317
  - test/remote/gateways/remote_epsilon_virtual_account_test.rb
296
318
  - test/test_helper.rb
@@ -1,38 +0,0 @@
1
- module ActiveMerchant #:nodoc:
2
- module Billing #:nodoc:
3
- class EpsilonGmoAfterGateway < EpsilonBaseGateway
4
- def purchase(amount, detail = {})
5
- params = {
6
- contract_code: self.contract_code,
7
- user_id: detail[:user_id],
8
- user_name: detail[:user_name],
9
- user_mail_add: detail[:user_email],
10
- item_code: detail[:item_code],
11
- item_name: detail[:item_name],
12
- order_number: detail[:order_number],
13
- st_code: '00000-0000-00000-00010-00000-00000-00000',
14
- mission_code: EpsilonMissionCode::PURCHASE,
15
- item_price: amount,
16
- process_code: EpsilonProcessCode::FIRST,
17
- xml: 1, # 応答形式。1: xml形式を固定
18
- delivery_code: 99, # 配送区分。99で固定
19
- consignee_postal: detail[:consignee_postal],
20
- consignee_name: detail[:consignee_name],
21
- consignee_address: detail[:consignee_address],
22
- consignee_tel: detail[:consignee_tel],
23
- orderer_postal: detail[:orderer_postal],
24
- orderer_name: detail[:orderer_name],
25
- orderer_address: detail[:orderer_address],
26
- orderer_tel: detail[:orderer_tel],
27
- version: 2, # 推奨文字コードがUTF8の方を指定
28
- }
29
-
30
- params[:memo1] = detail[:memo1] if detail.has_key?(:memo1)
31
- params[:memo2] = detail[:memo2] if detail.has_key?(:memo2)
32
- params[:user_tel] = detail[:user_tel] if detail.has_key?(:user_tel)
33
-
34
- commit('receive_order3.cgi', params, [:redirect])
35
- end
36
- end
37
- end
38
- end