active_merchant-epsilon 0.9.0 → 0.10.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9668d6a76c41c51531236786b52d3cacecbc46c95fc6ec6bd9e183b2447d50c0
4
- data.tar.gz: aebd5b08968677868c3e532330d0d892dac75ca8ba61881d4fa090278771e895
3
+ metadata.gz: a0e846e512a231038d3e3d1c9c873fbd143f9273b5300408a7eb01ea567db19f
4
+ data.tar.gz: be1757162ec55305ba5e37faf1f78a26164cb73a5207d5395a81da6e85346535
5
5
  SHA512:
6
- metadata.gz: 07b7cbbca794528280c570c98aa452cd5eb02853f595393f123e25dd1f09f5ec5bd8e67d78762c13d90eede09b28132d3de0392a07789a7b18845a430d53be2e
7
- data.tar.gz: 6effbf8145aa78bb1eab554700da4dfe4e9a9dca2cf522cf64871533724c112b90ada365c006083eada79dac50e9ee41e0ade11339f023f7cf3433dc2dc2849c
6
+ metadata.gz: 02e58bc1a1452e386fe6ffff3eb0fed57e6bd14791969c2449e7ef86f855b3fca0ea81571d02af544554d27de66a9eeb4dab8f120e0b55727666f9ec69c5287a
7
+ data.tar.gz: bebcb439e9eb71793f08faea283f15686c662062aaa222bf14ae75961cc812c3624e7959f61da87e7ee10241b5e55bf1440f851b85d113622bd894e3429a6149
@@ -1,8 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.7
4
- - 2.2.3
5
- - 2.3.0
3
+ - 2.4.5
4
+ - 2.5.3
6
5
 
7
6
  script: bundle exec rake test:remote
8
7
  script: bundle exec rake test:unit
@@ -1,5 +1,25 @@
1
1
  # CHANGELOG
2
2
 
3
+ ### 0.10.0
4
+
5
+ * [Capture authorized payments](https://github.com/pepabo/active_merchant-epsilon/pull/112)
6
+
7
+ ### 0.9.4
8
+
9
+ * [Support Epsilon Link Payment instead of GMO Payment After Delivery](https://github.com/pepabo/active_merchant-epsilon/pull/110)
10
+
11
+ ### 0.9.3
12
+
13
+ * [Fix API version for GMO Payment After Delivery](https://github.com/pepabo/active_merchant-epsilon/pull/108)
14
+
15
+ ### 0.9.2
16
+
17
+ * [Support GMO Payment After Delivery](https://github.com/pepabo/active_merchant-epsilon/pull/106)
18
+
19
+ ### 0.9.1
20
+
21
+ * [Add amount to response parameters when find order](https://github.com/pepabo/active_merchant-epsilon/pull/99)
22
+
3
23
  ### 0.9.0
4
24
 
5
25
  * [Support virtual account payment](https://github.com/pepabo/active_merchant-epsilon/pull/97)
data/README.md CHANGED
@@ -302,6 +302,49 @@ else
302
302
  end
303
303
  ```
304
304
 
305
+ ### Epsilon Link Payment
306
+
307
+ EpsilosLinkPaymentGateway is available in all link payments.
308
+ For example, GMO Payment After Delivery.
309
+
310
+ ```ruby
311
+ ActiveMerchant::Billing::EpsilonLinkPaymentGateway.contract_code = 'YOUR_CONTRACT_CODE'
312
+
313
+ gateway = ActiveMerchant::Billing::EpsilonLinkPaymentGateway.new
314
+
315
+ amount = 10000
316
+
317
+ purchase_detail = {
318
+ user_id: 'YOUR_APP_USER_IDENTIFIER',
319
+ user_name: '山田 太郎',
320
+ user_email: 'yamada-taro@example.com',
321
+ user_tel: '0312345678',
322
+ item_code: 'ITEM001',
323
+ item_name: 'Greate Product',
324
+ order_number: 'UNIQUE ORDER NUMBER',
325
+ st_code: 'SETTLEMENT_CODE',
326
+ consignee_postal: '1500002',
327
+ consignee_name: '山田 太郎',
328
+ consignee_address: '東京都渋谷区1-1-1',
329
+ consignee_tel: '0312345678',
330
+ orderer_postal: '1500002',
331
+ orderer_name: '山田 太郎',
332
+ orderer_address: '東京都渋谷区1-1-1',
333
+ orderer_tel: '0312345678',
334
+ memo1: 'memo1',
335
+ memo2: 'memo2',
336
+ }
337
+
338
+ response = gateway.purchase(amount, purchase_detail)
339
+
340
+ if response.success?
341
+ puts "Successfully send order data"
342
+ puts "Redirect url is #{response.params['redirect']}"
343
+ else
344
+ raise StandardError, response.message
345
+ end
346
+ ```
347
+
305
348
  ### Error handling
306
349
 
307
350
  If epsilon server returns status excepted 200, `#purchase` method raise `ActiveMerchant::ResponseError`.
@@ -18,13 +18,13 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_dependency 'activemerchant', '~> 1.66.0'
21
+ spec.add_dependency 'activemerchant', '~> 1.88'
22
22
  spec.add_dependency 'nokogiri'
23
23
 
24
- spec.add_development_dependency 'bundler', '~> 1.7'
24
+ spec.add_development_dependency 'bundler'
25
25
  spec.add_development_dependency 'dotenv'
26
26
  spec.add_development_dependency 'pry-byebug'
27
- spec.add_development_dependency 'rake', '~> 10.0'
27
+ spec.add_development_dependency 'rake'
28
28
  spec.add_development_dependency 'tapp'
29
29
  spec.add_development_dependency 'webmock'
30
30
  spec.add_development_dependency 'vcr'
@@ -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
@@ -176,11 +179,21 @@ module ActiveMerchant #:nodoc:
176
179
  :state,
177
180
  :payment_code,
178
181
  :item_price,
182
+ :amount,
179
183
  ]
180
184
 
181
185
  commit(PATHS[:find_order], params, response_keys)
182
186
  end
183
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
+
184
197
  private
185
198
 
186
199
  def billing_params(amount, payment_method, detail)
@@ -207,6 +220,7 @@ module ActiveMerchant #:nodoc:
207
220
 
208
221
  params[:memo1] = detail[:memo1] if detail.has_key?(:memo1)
209
222
  params[:memo2] = detail[:memo2] if detail.has_key?(:memo2)
223
+ params[:kari_flag] = detail[:capture] ? 2 : 1 if detail.has_key?(:capture)
210
224
 
211
225
  if detail.has_key?(:token)
212
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,42 @@
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 = {})
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
+ 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,3 +1,5 @@
1
+ require 'cgi'
2
+
1
3
  module ActiveMerchant #:nodoc:
2
4
  module Billing #:nodoc:
3
5
  class ResponseParser
@@ -113,8 +115,20 @@ module ActiveMerchant #:nodoc:
113
115
  @xml.xpath(ResponseXpath::ITEM_PRICE).to_s
114
116
  end
115
117
 
118
+ def amount
119
+ @xml.xpath(ResponseXpath::AMOUNT).to_s
120
+ end
121
+
122
+ def redirect
123
+ uri_decode(@xml.xpath(ResponseXpath::REDIRECT).to_s)
124
+ end
125
+
126
+ def captured
127
+ @xml.xpath(ResponseXpath::CAPTURED).to_s != '1'
128
+ end
129
+
116
130
  def uri_decode(string)
117
- URI.decode(string).encode(Encoding::UTF_8, Encoding::CP932)
131
+ CGI.unescape(string).encode(Encoding::UTF_8, Encoding::CP932)
118
132
  end
119
133
 
120
134
  module ResponseXpath
@@ -141,6 +155,9 @@ module ActiveMerchant #:nodoc:
141
155
  STATE = '//Epsilon_result/result[@state]/@state'
142
156
  ITEM_PRICE = '//Epsilon_result/result[@item_price]/@item_price'
143
157
  PAYMENT_CODE = '//Epsilon_result/result[@payment_code]/@payment_code'
158
+ AMOUNT = '//Epsilon_result/result[@amount]/@amount'
159
+ REDIRECT = '//Epsilon_result/result[@redirect]/@redirect'
160
+ CAPTURED = '//Epsilon_result/result[@kari_flag]/@kari_flag'
144
161
  end
145
162
 
146
163
  module ResultCode
@@ -10,4 +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_link_payment'
13
14
  require_relative 'billing/gateways/response_parser'
@@ -1,5 +1,5 @@
1
1
  module ActiveMerchant
2
2
  module Epsilon
3
- VERSION = "0.9.0"
3
+ VERSION = "0.10.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=&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
+ 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, 18 Mar 2020 05:58:06 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=\"%83%86%81%5B%83U%81%5BID%82%CC%8C%60%8E%AE%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
+ http_version: null
43
+ recorded_at: Wed, 18 Mar 2020 05:58:07 GMT
44
+ recorded_with: VCR 5.1.0
@@ -0,0 +1,45 @@
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=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
+ 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, 18 Mar 2020 05:53:23 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%3DITL3uKDMlWg41" />
42
+ </Epsilon_result>
43
+ http_version: null
44
+ recorded_at: Wed, 18 Mar 2020 05:53:25 GMT
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
@@ -0,0 +1,30 @@
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
@@ -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
 
@@ -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
@@ -9,7 +9,7 @@ require 'tapp'
9
9
  require 'vcr'
10
10
 
11
11
  require 'webmock/minitest'
12
- require 'mocha/mini_test'
12
+ require 'mocha/minitest'
13
13
 
14
14
  Dotenv.load
15
15
 
@@ -206,6 +206,30 @@ module SamplePaymentMethods
206
206
  }
207
207
  end
208
208
 
209
+ def gmo_after_purchase_detail
210
+ now = Time.now
211
+ {
212
+ user_id: "U#{Time.now.to_i}",
213
+ user_name: '山田 太郎',
214
+ user_email: 'yamada-taro@example.com',
215
+ user_tel: '0312345678',
216
+ item_code: 'ITEM001',
217
+ item_name: 'Greate Product',
218
+ order_number: "O#{now.sec}#{now.usec}",
219
+ st_code: '00000-0000-00000-00010-00000-00000-00000',
220
+ memo1: 'memo1',
221
+ memo2: 'memo2',
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
+
209
233
  def fixture_xml(filename, parse: true)
210
234
  xml = File.read("test/fixtures/#{filename}")
211
235
  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.9.0
4
+ version: 0.10.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: 2018-07-17 00:00:00.000000000 Z
11
+ date: 2020-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemerchant
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.66.0
19
+ version: '1.88'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.66.0
26
+ version: '1.88'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: nokogiri
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.7'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1.7'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: dotenv
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -84,16 +84,16 @@ dependencies:
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '10.0'
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '10.0'
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: tapp
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -173,6 +173,7 @@ files:
173
173
  - lib/active_merchant/billing/gateways/epsilon/epsilon_process_code.rb
174
174
  - lib/active_merchant/billing/gateways/epsilon_convenience_store.rb
175
175
  - lib/active_merchant/billing/gateways/epsilon_gmo_id.rb
176
+ - lib/active_merchant/billing/gateways/epsilon_link_payment.rb
176
177
  - lib/active_merchant/billing/gateways/epsilon_virtual_account.rb
177
178
  - lib/active_merchant/billing/gateways/response_parser.rb
178
179
  - lib/active_merchant/epsilon.rb
@@ -180,6 +181,9 @@ files:
180
181
  - test/fixtures/vcr_cassettes/autheticate_three_d_secure_card_successful.yml
181
182
  - test/fixtures/vcr_cassettes/cancel_recurring_fail.yml
182
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
183
187
  - test/fixtures/vcr_cassettes/change_recurring_amount_failure.yml
184
188
  - test/fixtures/vcr_cassettes/change_recurring_amount_successful.yml
185
189
  - test/fixtures/vcr_cassettes/convenience_store_purchase_fail.yml
@@ -188,6 +192,8 @@ files:
188
192
  - test/fixtures/vcr_cassettes/find_order_success.yml
189
193
  - test/fixtures/vcr_cassettes/find_user_failure.yml
190
194
  - test/fixtures/vcr_cassettes/find_user_success.yml
195
+ - test/fixtures/vcr_cassettes/gmo_after_purchase_fail.yml
196
+ - test/fixtures/vcr_cassettes/gmo_after_purchase_successful.yml
191
197
  - test/fixtures/vcr_cassettes/gmo_id_purchase_failure.yml
192
198
  - test/fixtures/vcr_cassettes/gmo_id_purchase_successful.yml
193
199
  - test/fixtures/vcr_cassettes/gmo_id_void_faiure.yml
@@ -195,6 +201,8 @@ files:
195
201
  - test/fixtures/vcr_cassettes/installment_purchase_successful.yml
196
202
  - test/fixtures/vcr_cassettes/purchase_fail.yml
197
203
  - test/fixtures/vcr_cassettes/purchase_successful.yml
204
+ - test/fixtures/vcr_cassettes/purchase_with_capture_false_successful.yml
205
+ - test/fixtures/vcr_cassettes/purchase_with_capture_true_successful.yml
198
206
  - test/fixtures/vcr_cassettes/purchase_with_three_d_secure_card_successful.yml
199
207
  - test/fixtures/vcr_cassettes/purchase_with_verification_value.yml
200
208
  - test/fixtures/vcr_cassettes/recurring_fail.yml
@@ -215,6 +223,7 @@ files:
215
223
  - test/fixtures/vcr_cassettes/void_fail.yml
216
224
  - test/fixtures/vcr_cassettes/void_successful.yml
217
225
  - test/remote/gateways/remote_epsilon_convenience_store_test.rb
226
+ - test/remote/gateways/remote_epsilon_gmo_after_test.rb
218
227
  - test/remote/gateways/remote_epsilon_gmo_id_test.rb
219
228
  - test/remote/gateways/remote_epsilon_test.rb
220
229
  - test/remote/gateways/remote_epsilon_virtual_account_test.rb
@@ -240,8 +249,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
240
249
  - !ruby/object:Gem::Version
241
250
  version: '0'
242
251
  requirements: []
243
- rubyforge_project:
244
- rubygems_version: 2.7.6
252
+ rubygems_version: 3.1.2
245
253
  signing_key:
246
254
  specification_version: 4
247
255
  summary: Epsilon integration for ActiveMerchant.
@@ -249,6 +257,9 @@ test_files:
249
257
  - test/fixtures/vcr_cassettes/autheticate_three_d_secure_card_successful.yml
250
258
  - test/fixtures/vcr_cassettes/cancel_recurring_fail.yml
251
259
  - test/fixtures/vcr_cassettes/cancel_recurring_successful.yml
260
+ - test/fixtures/vcr_cassettes/capture_failure.yml
261
+ - test/fixtures/vcr_cassettes/capture_success.yml
262
+ - test/fixtures/vcr_cassettes/capture_success_authorize.yml
252
263
  - test/fixtures/vcr_cassettes/change_recurring_amount_failure.yml
253
264
  - test/fixtures/vcr_cassettes/change_recurring_amount_successful.yml
254
265
  - test/fixtures/vcr_cassettes/convenience_store_purchase_fail.yml
@@ -257,6 +268,8 @@ test_files:
257
268
  - test/fixtures/vcr_cassettes/find_order_success.yml
258
269
  - test/fixtures/vcr_cassettes/find_user_failure.yml
259
270
  - test/fixtures/vcr_cassettes/find_user_success.yml
271
+ - test/fixtures/vcr_cassettes/gmo_after_purchase_fail.yml
272
+ - test/fixtures/vcr_cassettes/gmo_after_purchase_successful.yml
260
273
  - test/fixtures/vcr_cassettes/gmo_id_purchase_failure.yml
261
274
  - test/fixtures/vcr_cassettes/gmo_id_purchase_successful.yml
262
275
  - test/fixtures/vcr_cassettes/gmo_id_void_faiure.yml
@@ -264,6 +277,8 @@ test_files:
264
277
  - test/fixtures/vcr_cassettes/installment_purchase_successful.yml
265
278
  - test/fixtures/vcr_cassettes/purchase_fail.yml
266
279
  - test/fixtures/vcr_cassettes/purchase_successful.yml
280
+ - test/fixtures/vcr_cassettes/purchase_with_capture_false_successful.yml
281
+ - test/fixtures/vcr_cassettes/purchase_with_capture_true_successful.yml
267
282
  - test/fixtures/vcr_cassettes/purchase_with_three_d_secure_card_successful.yml
268
283
  - test/fixtures/vcr_cassettes/purchase_with_verification_value.yml
269
284
  - test/fixtures/vcr_cassettes/recurring_fail.yml
@@ -284,6 +299,7 @@ test_files:
284
299
  - test/fixtures/vcr_cassettes/void_fail.yml
285
300
  - test/fixtures/vcr_cassettes/void_successful.yml
286
301
  - test/remote/gateways/remote_epsilon_convenience_store_test.rb
302
+ - test/remote/gateways/remote_epsilon_gmo_after_test.rb
287
303
  - test/remote/gateways/remote_epsilon_gmo_id_test.rb
288
304
  - test/remote/gateways/remote_epsilon_test.rb
289
305
  - test/remote/gateways/remote_epsilon_virtual_account_test.rb