payjp 0.0.15 → 1.1.7

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: 1b3f5f6b4f167980812b5c08363e4f67bab5c50c6707a4bf74ab2c1f128ebb28
4
- data.tar.gz: 3cb5696fcb7c35e1f8dfa09012a0640469e6a26e926c11d8c676b32502692a12
3
+ metadata.gz: 798dc8ea5c0674b152d81916e9be43296cb5021ffc4be7ac2c529eeb9ccb19db
4
+ data.tar.gz: 4ed855efa130d78b5f993de0a0771947c256396fed5dec989cbecdee183dff76
5
5
  SHA512:
6
- metadata.gz: fd73a7ad86c466cb0af733c867ce19c18130052afff58374c49938cbc6f2c35e9ce6a9f60a00da9b2447fbe84cbd36467fd07a5b8fd5fbb71cf382e7a24e4f58
7
- data.tar.gz: 6a2ddecfafbb56095fcb812a974462936f0ce72f33268d9ad5f4cd6f5c6f5d98e669595ac51d3cfbd6601c7b3190572db04c54f217b1cb4db15e0ce7e8be52d6
6
+ metadata.gz: 10ebe418db5cecc878c57886487893967b759c4a551067c93273f153fd468bc9d8bb4088fcb20bc82e05274938a6516faeb1d6011b748d423b1e0105fe9f20c0
7
+ data.tar.gz: 204df1a1a522a472cc216f3ba33149da363db6989a4b621709e11b4e84b8d91c8838722a05c1897102af98ee290217c96ced205a64d615662246640c587ae602
@@ -8,7 +8,7 @@ jobs:
8
8
  runs-on: ubuntu-20.04
9
9
  strategy:
10
10
  matrix:
11
- ruby-version: [2.0.0, 2.1, 2.2, 2.3.0, 2.7.0, jruby-9.2.17.0]
11
+ ruby-version: [2.3, 2.7, 3.0, 3.1, 3.2, 3.3, 3.4, jruby-9.2.17.0]
12
12
  steps:
13
13
  - uses: actions/checkout@v3
14
14
  - name: Set up Ruby ${{ matrix.ruby-version }}
@@ -0,0 +1,10 @@
1
+ module Payjp
2
+ class ThreeDSecureRequest < APIResource
3
+ include Payjp::APIOperations::List
4
+ include Payjp::APIOperations::Create
5
+
6
+ def self.url
7
+ "/v1/three_d_secure_requests"
8
+ end
9
+ end
10
+ end
data/lib/payjp/token.rb CHANGED
@@ -1,5 +1,19 @@
1
1
  module Payjp
2
2
  class Token < APIResource
3
3
  include Payjp::APIOperations::Create
4
+
5
+ def self.tds_finish(id, params = {}, opts = {})
6
+ response, opts = request(:post, url + '/' + id + '/tds_finish', params, opts)
7
+ Util.convert_to_payjp_object(response, opts)
8
+ end
9
+
10
+ def tds_finish(params = {}, opts = {})
11
+ response, opts = request(:post, tds_finish_url, params, opts)
12
+ refresh_from(response, opts)
13
+ end
14
+
15
+ def tds_finish_url
16
+ url + '/tds_finish'
17
+ end
4
18
  end
5
19
  end
data/lib/payjp/util.rb CHANGED
@@ -33,7 +33,8 @@ module Payjp
33
33
  'subscription' => Subscription,
34
34
  'term' => Term,
35
35
  'token' => Token,
36
- 'transfer' => Transfer
36
+ 'transfer' => Transfer,
37
+ 'three_d_secure_request' => ThreeDSecureRequest
37
38
  }
38
39
  end
39
40
 
@@ -70,7 +71,7 @@ module Payjp
70
71
  # (from URI::RFC2396_Parser#escape)
71
72
  key.to_s.gsub(Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")) do
72
73
  us = $&
73
- tmp = ''
74
+ tmp = String.new
74
75
  us.each_byte do |uc|
75
76
  tmp << sprintf('%%%02X', uc)
76
77
  end
data/lib/payjp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Payjp
2
- VERSION = '0.0.15'
2
+ VERSION = '1.1.7'
3
3
  end
data/lib/payjp.rb CHANGED
@@ -38,6 +38,7 @@ require 'payjp/subscription'
38
38
  require 'payjp/tenant'
39
39
  require 'payjp/term'
40
40
  require 'payjp/balance'
41
+ require 'payjp/three_d_secure_request'
41
42
 
42
43
  # Errors
43
44
  require 'payjp/errors/payjp_error'
data/payjp.gemspec CHANGED
@@ -13,17 +13,18 @@ Gem::Specification.new do |s|
13
13
  s.license = 'MIT'
14
14
 
15
15
  s.add_dependency('rest-client', '~> 2.0')
16
+ s.add_dependency('base64')
16
17
 
17
18
  s.add_development_dependency('mocha', '~> 1.2.1')
18
19
  s.add_development_dependency('activesupport', ['< 5.0', '~> 4.2.7'])
19
- s.add_development_dependency('test-unit', '~> 3.2.2')
20
- s.add_development_dependency('rake', '~> 11.3.0')
20
+ s.add_development_dependency('test-unit', '~> 3.6.2')
21
+ s.add_development_dependency('rake', '>= 11.3.0')
21
22
  s.add_development_dependency('bundler', '>= 1.7.6')
22
23
 
23
24
  s.files = `git ls-files`.split("\n")
24
25
  s.test_files = `git ls-files -- test/*`.split("\n")
25
26
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
26
- s.require_paths = ['lib']
27
+ s.require_paths = ['lib']
27
28
  s.metadata = {
28
29
  "source_code_uri" => "https://github.com/payjp/payjp-ruby",
29
30
  }
@@ -0,0 +1,40 @@
1
+ require File.expand_path('../../test_helper', __FILE__)
2
+
3
+ module Payjp
4
+ class ThreeDSecureRequestTest < Test::Unit::TestCase
5
+ should "three_d_secure_requests should be listable" do
6
+ @mock.expects(:get).once.returns(test_response(test_three_d_secure_request_array))
7
+ response = Payjp::ThreeDSecureRequest.all
8
+ assert response.data.is_a? Array
9
+ response.each do |three_d_secure_request|
10
+ assert three_d_secure_request.is_a?(Payjp::ThreeDSecureRequest)
11
+ end
12
+ end
13
+
14
+ should "three_d_secure_requests should be creatable" do
15
+ resource_id = 'car_xxx_test1'
16
+ tenant_id = 'ten_xxx_test1'
17
+ @mock.expects(:post).with do |url, api_key, params|
18
+ url == "#{Payjp.api_base}/v1/three_d_secure_requests" && api_key.nil? && CGI.parse(params) == {
19
+ 'resource_id' => [resource_id],
20
+ 'tenant_id' => [tenant_id],
21
+ }
22
+ end.once.returns(test_response(test_three_d_secure_request({:resource_id => resource_id, :tenant_id => tenant_id})))
23
+
24
+ response = Payjp::ThreeDSecureRequest.create({
25
+ :resource_id => resource_id,
26
+ :tenant_id => tenant_id,
27
+ })
28
+ assert response.resource_id == resource_id
29
+ assert response.tenant_id == tenant_id
30
+ end
31
+
32
+ should "three_d_secure_requests should be retrievable" do
33
+ tdsr_id = 'tdsr_xxx_test1'
34
+ @mock.expects(:get).once.returns(test_response(test_three_d_secure_request({:id => tdsr_id})))
35
+ response = Payjp::ThreeDSecureRequest.retrieve(tdsr_id)
36
+ assert_equal Payjp::ThreeDSecureRequest, response.class
37
+ assert_equal response.id, tdsr_id
38
+ end
39
+ end
40
+ end
@@ -30,5 +30,24 @@ module Payjp
30
30
  token.delete
31
31
  end
32
32
  end
33
+
34
+ should "token should be able to request tds_finish" do
35
+ token_id = 'tok_tds_token1'
36
+ @mock.expects(:post).once.returns(test_response(test_token({:id => token_id})))
37
+ token = Payjp::Token.new(token_id)
38
+ response = token.tds_finish()
39
+
40
+ assert_equal Payjp::Token, response.class
41
+ assert_equal token_id, response.id
42
+ end
43
+
44
+ should "token should be able to request tds_finish from class method" do
45
+ token_id = 'tok_tds_token2'
46
+ @mock.expects(:post).once.returns(test_response(test_token({:id => token_id})))
47
+ response = Payjp::Token.tds_finish(token_id)
48
+
49
+ assert_equal Payjp::Token, response.class
50
+ assert_equal token_id, response.id
51
+ end
33
52
  end
34
53
  end
data/test/test_data.rb CHANGED
@@ -425,5 +425,31 @@ module Payjp
425
425
  :bank_info => nil
426
426
  }.merge(params)
427
427
  end
428
+
429
+ def test_three_d_secure_request(params = {})
430
+ {
431
+ :created => 1730084767,
432
+ :expired_at => nil,
433
+ :finished_at => nil,
434
+ :id => "tdsr_xxx",
435
+ :livemode => true,
436
+ :object => "three_d_secure_request",
437
+ :resource_id => "car_xxx",
438
+ :result_received_at => nil,
439
+ :started_at => nil,
440
+ :state => "created",
441
+ :tenant_id => nil,
442
+ :three_d_secure_status => "unverified",
443
+ }.merge(params)
444
+ end
445
+
446
+ def test_three_d_secure_request_array
447
+ {
448
+ :count => 3,
449
+ :data => [test_three_d_secure_request({:id=>'tdsr_xxx1'}), test_three_d_secure_request({:id=>'tdsr_xxx2'}), test_three_d_secure_request({:id=>'tdsr_xxx3'})],
450
+ :object => 'list',
451
+ :url => '/v1/three_d_secure_requests'
452
+ }
453
+ end
428
454
  end
429
455
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: payjp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - PAY.JP
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-05-14 00:00:00.000000000 Z
10
+ date: 2025-03-19 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rest-client
@@ -24,6 +23,20 @@ dependencies:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
25
  version: '2.0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: base64
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
27
40
  - !ruby/object:Gem::Dependency
28
41
  name: mocha
29
42
  requirement: !ruby/object:Gem::Requirement
@@ -64,26 +77,26 @@ dependencies:
64
77
  requirements:
65
78
  - - "~>"
66
79
  - !ruby/object:Gem::Version
67
- version: 3.2.2
80
+ version: 3.6.2
68
81
  type: :development
69
82
  prerelease: false
70
83
  version_requirements: !ruby/object:Gem::Requirement
71
84
  requirements:
72
85
  - - "~>"
73
86
  - !ruby/object:Gem::Version
74
- version: 3.2.2
87
+ version: 3.6.2
75
88
  - !ruby/object:Gem::Dependency
76
89
  name: rake
77
90
  requirement: !ruby/object:Gem::Requirement
78
91
  requirements:
79
- - - "~>"
92
+ - - ">="
80
93
  - !ruby/object:Gem::Version
81
94
  version: 11.3.0
82
95
  type: :development
83
96
  prerelease: false
84
97
  version_requirements: !ruby/object:Gem::Requirement
85
98
  requirements:
86
- - - "~>"
99
+ - - ">="
87
100
  - !ruby/object:Gem::Version
88
101
  version: 11.3.0
89
102
  - !ruby/object:Gem::Dependency
@@ -144,6 +157,7 @@ files:
144
157
  - lib/payjp/subscription.rb
145
158
  - lib/payjp/tenant.rb
146
159
  - lib/payjp/term.rb
160
+ - lib/payjp/three_d_secure_request.rb
147
161
  - lib/payjp/token.rb
148
162
  - lib/payjp/transfer.rb
149
163
  - lib/payjp/util.rb
@@ -164,6 +178,7 @@ files:
164
178
  - test/payjp/subscription_test.rb
165
179
  - test/payjp/tenant_test.rb
166
180
  - test/payjp/term_test.rb
181
+ - test/payjp/three_d_secure_request_test.rb
167
182
  - test/payjp/token_test.rb
168
183
  - test/payjp/transfer_test.rb
169
184
  - test/payjp/util_test.rb
@@ -174,7 +189,6 @@ licenses:
174
189
  - MIT
175
190
  metadata:
176
191
  source_code_uri: https://github.com/payjp/payjp-ruby
177
- post_install_message:
178
192
  rdoc_options: []
179
193
  require_paths:
180
194
  - lib
@@ -189,8 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
203
  - !ruby/object:Gem::Version
190
204
  version: '0'
191
205
  requirements: []
192
- rubygems_version: 3.1.6
193
- signing_key:
206
+ rubygems_version: 3.6.2
194
207
  specification_version: 4
195
208
  summary: Ruby bindings for the Payjp API
196
209
  test_files:
@@ -209,6 +222,7 @@ test_files:
209
222
  - test/payjp/subscription_test.rb
210
223
  - test/payjp/tenant_test.rb
211
224
  - test/payjp/term_test.rb
225
+ - test/payjp/three_d_secure_request_test.rb
212
226
  - test/payjp/token_test.rb
213
227
  - test/payjp/transfer_test.rb
214
228
  - test/payjp/util_test.rb