active_merchant-epsilon 0.14.0 → 0.15.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: 8fe0b19a8605e29e5c3a2a310e3b9684767a21fb2f93957342ffd41b9135657e
4
- data.tar.gz: b8eb1a2b4d150c0696d26a52e58f5069a60542739bc6461d61f864ad20a470db
3
+ metadata.gz: 91e76e51445d095695e77bdd56b88062b52afcfe35c48b4c6eb4e9d890f6bc0b
4
+ data.tar.gz: 51a731fc40d31bc182ce462ff041d5aeb9ed833095f8caffcd6b3b962e958e52
5
5
  SHA512:
6
- metadata.gz: 87d7533d96fd6591a2b4ffeb78c7cfe2de4ad987e41c58be72083672f346178be6fa593e3aad6a5f3b66b0dde708e883d6d82a8c864a05006589d33a2978b41c
7
- data.tar.gz: '0782a6f4c48fcc0e905a7b72205d5511bea0ffa95ca285dceee5058d97ae0d63e25fc2e2b009910b800c398b2cb07451cb525f8d0ee1f58696228c487f2f4106'
6
+ metadata.gz: 368556d657fc83e9912def82af6a5040c19d53ed9249444e42ca4a61c1a30c2186a0d5af52f80a121e2b1f9ea052fa13878bca35474ca4a7e5bc4755c9ba8ea0
7
+ data.tar.gz: bb51f853bd5be0c7560ff902a63d1b168bbadbd9cb7ecc92b7451c006b7e4302651c81c62b89099306ad50cb0749e2301f92e04d6896953462febd22f8cecb0e
@@ -11,12 +11,12 @@ jobs:
11
11
  strategy:
12
12
  fail-fast: false
13
13
  matrix:
14
- ruby-version: [2.4, 2.5, 2.6, 2.7, 3.0]
14
+ ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4.0-preview1']
15
15
 
16
16
  steps:
17
17
  - uses: actions/checkout@v2
18
18
 
19
- - uses: ruby/setup-ruby@v1.63.0
19
+ - uses: ruby/setup-ruby@v1
20
20
  with:
21
21
  ruby-version: ${{ matrix.ruby-version }}
22
22
  bundler-cache: true
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ### 0.15.0
4
+
5
+ - [Support 3D Secure parameters for link type payments](https://github.com/pepabo/active_merchant-epsilon/pull/131)
6
+
3
7
  ### 0.14.0
4
8
 
5
9
  - [Support 3D Secure 2.0 for credit card payments](https://github.com/pepabo/active_merchant-epsilon/pull/121)
data/README.md CHANGED
@@ -127,8 +127,8 @@ end
127
127
  # AND SECOND REQUEST
128
128
 
129
129
  response = gateway.authenticate(
130
- order_number: 'ORDER NUMBER',
131
- three_d_secure_pares: 'PAYMENT AUTHENTICATION RESPONSE',
130
+ order_number: 'ORDER NUMBER',
131
+ three_d_secure_pa_res: 'PAYMENT AUTHENTICATION RESPONSE',
132
132
  )
133
133
 
134
134
  if response.success?
@@ -199,8 +199,8 @@ end
199
199
  # AND SECOND REQUEST
200
200
 
201
201
  response = gateway.authenticate(
202
- order_number: 'ORDER NUMBER',
203
- three_d_secure_pares: 'PAYMENT AUTHENTICATION RESPONSE',
202
+ order_number: 'ORDER NUMBER',
203
+ three_d_secure_pa_res: 'PAYMENT AUTHENTICATION RESPONSE',
204
204
  )
205
205
 
206
206
  if response.success?
@@ -0,0 +1,25 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ module EpsilonRiskBaseAuthParams
4
+ KEYS = %i[
5
+ tds_flag billAddrCity billAddrCountry billAddrLine1 billAddrLine2 billAddrLine3
6
+ billAddrPostCode billAddrState shipAddrCity shipAddrCountry shipAddrLine1 shipAddrLine2
7
+ shipAddrLine3 shipAddrPostCode shipAddrState chAccAgeInd chAccChange
8
+ chAccChangeIndchAccDate chAccPwdChange chAccPwChangeInd nbPurchaseAccount paymentAccAge
9
+ paymentAccInd provisionAttemptsDay shipAddressUsage shipAddressUsageInd shipNameIndicator
10
+ suspiciousAccActivity txnActivityDay txnActivityYear threeDSReqAuthData threeDSReqAuthMethod
11
+ threeDSReqAuthTimestamp addrMatch cardholderName homePhone mobilePhone
12
+ workPhone challengeInd deliveryEmailAddress deliveryTimeframe giftCardAmount
13
+ giftCardCount preOrderDate preOrderPurchaseInd reorderItemsInd shipIndicator
14
+ ].freeze
15
+
16
+ THREE_D_SECURE_2_INDICATORS = [21, 22].freeze
17
+
18
+ def three_d_secure_2?(tds_flag)
19
+ THREE_D_SECURE_2_INDICATORS.include?(tds_flag)
20
+ end
21
+
22
+ module_function :three_d_secure_2?
23
+ end
24
+ end
25
+ end
@@ -22,20 +22,6 @@ module ActiveMerchant #:nodoc:
22
22
  capture: 'sales_payment.cgi',
23
23
  }.freeze
24
24
 
25
- RISK_BASE_AUTH_PARAMS_KEYS = %i[
26
- tds_flag billAddrCity billAddrCountry billAddrLine1 billAddrLine2 billAddrLine3
27
- billAddrPostCode billAddrState shipAddrCity shipAddrCountry shipAddrLine1 shipAddrLine2
28
- shipAddrLine3 shipAddrPostCode shipAddrState chAccAgeInd chAccChange
29
- chAccChangeIndchAccDate chAccPwdChange chAccPwChangeInd nbPurchaseAccount paymentAccAge
30
- paymentAccInd provisionAttemptsDay shipAddressUsage shipAddressUsageInd shipNameIndicator
31
- suspiciousAccActivity txnActivityDay txnActivityYear threeDSReqAuthData threeDSReqAuthMethod
32
- threeDSReqAuthTimestamp addrMatch cardholderName homePhone mobilePhone
33
- workPhone challengeInd deliveryEmailAddress deliveryTimeframe giftCardAmount
34
- giftCardCount preOrderDate preOrderPurchaseInd reorderItemsInd shipIndicator
35
- ].freeze
36
-
37
- THREE_D_SECURE_2_INDICATORS = [21, 22].freeze
38
-
39
25
  self.supported_cardtypes = [:visa, :master, :american_express, :discover]
40
26
 
41
27
  def purchase(amount, credit_card, detail = {})
@@ -44,7 +30,7 @@ module ActiveMerchant #:nodoc:
44
30
  params = billing_params(amount, credit_card, detail)
45
31
 
46
32
  if three_d_secure_2?(detail)
47
- params.merge!(detail.slice(*RISK_BASE_AUTH_PARAMS_KEYS).compact)
33
+ params.merge!(detail.slice(*EpsilonRiskBaseAuthParams::KEYS).compact)
48
34
  end
49
35
 
50
36
  commit(PATHS[:purchase], params)
@@ -73,7 +59,7 @@ module ActiveMerchant #:nodoc:
73
59
  params[:kari_flag] = detail[:capture] ? 2 : 1 if detail.has_key?(:capture)
74
60
 
75
61
  if three_d_secure_2?(detail)
76
- params.merge!(detail.slice(*RISK_BASE_AUTH_PARAMS_KEYS).compact)
62
+ params.merge!(detail.slice(*EpsilonRiskBaseAuthParams::KEYS).compact)
77
63
  end
78
64
 
79
65
  commit(PATHS[:registered_purchase], params)
@@ -263,7 +249,7 @@ module ActiveMerchant #:nodoc:
263
249
  end
264
250
 
265
251
  def three_d_secure_2?(detail)
266
- THREE_D_SECURE_2_INDICATORS.include?(detail[:tds_flag])
252
+ EpsilonRiskBaseAuthParams.three_d_secure_2?(detail[:tds_flag])
267
253
  end
268
254
  end
269
255
  end
@@ -39,6 +39,10 @@ module ActiveMerchant #:nodoc:
39
39
  params[:memo2] = detail[:memo2] if detail.has_key?(:memo2)
40
40
  params[:user_tel] = detail[:user_tel] if detail.has_key?(:user_tel)
41
41
 
42
+ if three_d_secure_2?(detail)
43
+ params.merge!(detail.slice(*EpsilonRiskBaseAuthParams::KEYS).compact)
44
+ end
45
+
42
46
  commit('receive_order3.cgi', params, RESPONSE_KEYS)
43
47
  end
44
48
 
@@ -50,6 +54,12 @@ module ActiveMerchant #:nodoc:
50
54
 
51
55
  commit('cancel_payment.cgi', params)
52
56
  end
57
+
58
+ private
59
+
60
+ def three_d_secure_2?(detail)
61
+ EpsilonRiskBaseAuthParams.three_d_secure_2?(detail[:tds_flag])
62
+ end
53
63
  end
54
64
  end
55
65
  end
@@ -1,5 +1,5 @@
1
1
  module ActiveMerchant
2
2
  module Epsilon
3
- VERSION = "0.14.0"
3
+ VERSION = "0.15.0"
4
4
  end
5
5
  end
@@ -5,6 +5,7 @@ require_relative 'epsilon/version'
5
5
  require_relative 'billing/convenience_store'
6
6
  require_relative 'billing/gateways/epsilon/epsilon_mission_code'
7
7
  require_relative 'billing/gateways/epsilon/epsilon_process_code'
8
+ require_relative 'billing/gateways/epsilon/epsilon_risk_base_auth_params'
8
9
  require_relative 'billing/gateways/epsilon/epsilon_base'
9
10
  require_relative 'billing/gateways/epsilon'
10
11
  require_relative 'billing/gateways/epsilon_convenience_store'
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://secure.epsilon.jp/cgi-bin/order/receive_order3.cgi
6
+ body:
7
+ encoding: UTF-8
8
+ string: contract_code=[CONTRACT_CODE]&user_id=U1747274309&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=O29285401&st_code=10000-0000-00000-00000-00000-00000-00000&mission_code=1&item_price=10000&process_code=1&xml=1&memo1=memo1&memo2=memo2&tds_flag=21
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
+ Server:
26
+ - nginx
27
+ Date:
28
+ - Thu, 15 May 2025 01:58:29 GMT
29
+ Content-Type:
30
+ - text/xml
31
+ Content-Length:
32
+ - '228'
33
+ Connection:
34
+ - close
35
+ Vary:
36
+ - Accept-Encoding
37
+ Strict-Transport-Security:
38
+ - max-age=31536000; includeSubDomains; preload
39
+ body:
40
+ encoding: ASCII-8BIT
41
+ string: |
42
+ <?xml version="1.0" encoding="UTF-8" ?>
43
+ <Epsilon_result>
44
+ <result result="1" />
45
+ <result redirect="https%3A%2F%2Fsecure.epsilon.jp%2Fcgi-bin%2Forder%2Fcard3.cgi%3Ftrans_code%3DeyHc6JoHNEiEce2mlXuiCg25" />
46
+ </Epsilon_result>
47
+ recorded_at: Thu, 15 May 2025 01:58:29 GMT
48
+ recorded_with: VCR 6.3.1
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class RemoteEpsilonConvenienceStoreGatewayTest < MiniTest::Test
3
+ class RemoteEpsilonConvenienceStoreGatewayTest < Minitest::Test
4
4
  include SamplePaymentMethods
5
5
 
6
6
  def gateway
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class RemoteEpsilonGmoIdGatewayTest < MiniTest::Test
3
+ class RemoteEpsilonGmoIdGatewayTest < Minitest::Test
4
4
  include SamplePaymentMethods
5
5
 
6
6
  def gateway
@@ -1,5 +1,5 @@
1
1
  require 'test_helper'
2
- class RemoteEpsilonLinkPaymentTest < MiniTest::Test
2
+ class RemoteEpsilonLinkPaymentTest < Minitest::Test
3
3
  include SamplePaymentMethods
4
4
 
5
5
  def gateway
@@ -33,6 +33,16 @@ class RemoteEpsilonLinkPaymentTest < MiniTest::Test
33
33
  end
34
34
  end
35
35
 
36
+ def test_epsilon_link_type_with_3d_secure
37
+ ActiveMerchant::Billing::Base.stub(:mode, :production) do
38
+ VCR.use_cassette(:epsilon_link_type_with_3d_secure) do
39
+ response = gateway.purchase(10000, valid_epsilon_link_type_purchase_detail_for_3d_secure, false)
40
+
41
+ pp response
42
+ end
43
+ end
44
+ end
45
+
36
46
  def test_epsilon_link_type_void_successfull
37
47
  VCR.use_cassette(:epsilon_link_type_void_successfull) do
38
48
  # あらかじめ課金済ステータスの受注がイプシロン側にないと取り消しができないため、課金済の受注をイプシロン側で作成しておいた。
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class RemoteEpsilonGatewayTest < MiniTest::Test
3
+ class RemoteEpsilonGatewayTest < Minitest::Test
4
4
  include SamplePaymentMethods
5
5
 
6
6
  def gateway
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class RemoteEpsilonVirtualAccountGatewayTest < MiniTest::Test
3
+ class RemoteEpsilonVirtualAccountGatewayTest < Minitest::Test
4
4
  include SamplePaymentMethods
5
5
 
6
6
  def gateway
data/test/test_helper.rb CHANGED
@@ -69,7 +69,7 @@ module SamplePaymentMethods
69
69
  last_name: 'YAMADA',
70
70
  number: '4123451111111117',
71
71
  month: '12',
72
- year: '2023',
72
+ year: Time.now.year + 1,
73
73
  )
74
74
  end
75
75
 
@@ -295,6 +295,22 @@ module SamplePaymentMethods
295
295
  }
296
296
  end
297
297
 
298
+ def valid_epsilon_link_type_purchase_detail_for_3d_secure
299
+ now = Time.now
300
+ {
301
+ user_id: "U#{Time.now.to_i}",
302
+ user_name: '山田 太郎',
303
+ user_email: 'yamada-taro@example.com',
304
+ item_code: 'ITEM001',
305
+ item_name: 'Greate Product',
306
+ order_number: "O#{now.sec}#{now.usec}",
307
+ st_code: '10000-0000-00000-00000-00000-00000-00000',
308
+ memo1: 'memo1',
309
+ memo2: 'memo2',
310
+ tds_flag: 21
311
+ }
312
+ end
313
+
298
314
  def invalid_epsilon_link_type_purchase_detail
299
315
  now = Time.now
300
316
  {
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class EpsilonConvenienceStoreTest < MiniTest::Test
3
+ class EpsilonConvenienceStoreTest < Minitest::Test
4
4
  def test_blank_parameter_generate_error
5
5
  convenience_store = ActiveMerchant::Billing::ConvenienceStore.new(code: "",
6
6
  full_name_kana: "",
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class EpsilonGatewayTest < MiniTest::Test
3
+ class EpsilonGatewayTest < Minitest::Test
4
4
  include SamplePaymentMethods
5
5
 
6
6
  def test_set_proxy_address_and_port
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.14.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenichi TAKAHASHI
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-21 00:00:00.000000000 Z
11
+ date: 2025-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemerchant
@@ -171,6 +171,7 @@ files:
171
171
  - lib/active_merchant/billing/gateways/epsilon/epsilon_base.rb
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
+ - lib/active_merchant/billing/gateways/epsilon/epsilon_risk_base_auth_params.rb
174
175
  - lib/active_merchant/billing/gateways/epsilon_convenience_store.rb
175
176
  - lib/active_merchant/billing/gateways/epsilon_gmo_id.rb
176
177
  - lib/active_merchant/billing/gateways/epsilon_link_payment.rb
@@ -194,6 +195,7 @@ files:
194
195
  - test/fixtures/vcr_cassettes/epsilon_link_type_purchase_successful.yml
195
196
  - test/fixtures/vcr_cassettes/epsilon_link_type_void_fail.yml
196
197
  - test/fixtures/vcr_cassettes/epsilon_link_type_void_successfull.yml
198
+ - test/fixtures/vcr_cassettes/epsilon_link_type_with_3d_secure.yml
197
199
  - test/fixtures/vcr_cassettes/find_order_failure.yml
198
200
  - test/fixtures/vcr_cassettes/find_order_success.yml
199
201
  - test/fixtures/vcr_cassettes/find_user_failure.yml
@@ -241,7 +243,7 @@ homepage: http://github.com/pepabo/active_merchant-epsilon
241
243
  licenses:
242
244
  - MIT
243
245
  metadata: {}
244
- post_install_message:
246
+ post_install_message:
245
247
  rdoc_options: []
246
248
  require_paths:
247
249
  - lib
@@ -256,8 +258,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
256
258
  - !ruby/object:Gem::Version
257
259
  version: '0'
258
260
  requirements: []
259
- rubygems_version: 3.0.3
260
- signing_key:
261
+ rubygems_version: 3.5.3
262
+ signing_key:
261
263
  specification_version: 4
262
264
  summary: Epsilon integration for ActiveMerchant.
263
265
  test_files:
@@ -277,6 +279,7 @@ test_files:
277
279
  - test/fixtures/vcr_cassettes/epsilon_link_type_purchase_successful.yml
278
280
  - test/fixtures/vcr_cassettes/epsilon_link_type_void_fail.yml
279
281
  - test/fixtures/vcr_cassettes/epsilon_link_type_void_successfull.yml
282
+ - test/fixtures/vcr_cassettes/epsilon_link_type_with_3d_secure.yml
280
283
  - test/fixtures/vcr_cassettes/find_order_failure.yml
281
284
  - test/fixtures/vcr_cassettes/find_order_success.yml
282
285
  - test/fixtures/vcr_cassettes/find_user_failure.yml