payjp 0.0.14 → 0.0.16

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: 32fcd8c9e2569e568458d8eac4dc882d1900e75577f8ff686801085b7d202385
4
- data.tar.gz: a4dd505473e1bf7fbd0fcd56c1620f00d5f4a39781f1c1ffdabc623f55d16464
3
+ metadata.gz: 4593810bec4a490625f7369e12e324565cef09cff6c0566d9d1ecf5bd0fd79cc
4
+ data.tar.gz: 558705e59753ed3a7e995905555adf7990f2a749e0cc285c2891ac16fad94d04
5
5
  SHA512:
6
- metadata.gz: 686404e37c62aafe0ce82a76264db1003651b3f43cc027cdae712911db20aaa3f0876ed7de74737d827e37fd97123406837dcaa4b6478c257f17ec7d411a1c0e
7
- data.tar.gz: 257f55f34bd2aa2347c14cbf0dadaa49229a36c21a6d130751f24984d175a01f4d31e1ef5418cff772c883c8bcfc0c47c584995ed03bcde7a7a8e0107d2a340f
6
+ metadata.gz: 8a2e1ef948314d3f7a20e509c11e5ba1a2dbe40795729b6e6b323170910673fbe570983a7274a931b3c3765409a66bfe9d7a05e27cc155f1f2d7a5f94ef05b97
7
+ data.tar.gz: '011833e6f4bf4b32ed7723ed398384f68241baf94f7690e470e53c84c0e2bb6b0a57cd41ecaf7b42f6239f798eb4f7ea4eb86c68d6342ee0a46a803d18d8b0aa'
@@ -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, jruby-9.2.17.0]
12
12
  steps:
13
13
  - uses: actions/checkout@v3
14
14
  - name: Set up Ruby ${{ matrix.ruby-version }}
data/lib/payjp/balance.rb CHANGED
@@ -1,5 +1,16 @@
1
1
  module Payjp
2
2
  class Balance < APIResource
3
3
  include Payjp::APIOperations::List
4
+
5
+ def statement_urls(params = {}, opts = {})
6
+ response, opts = request(:post, statement_urls_url, params, opts)
7
+ response
8
+ end
9
+
10
+ private
11
+
12
+ def statement_urls_url
13
+ url + '/statement_urls'
14
+ end
4
15
  end
5
16
  end
@@ -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
 
data/lib/payjp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Payjp
2
- VERSION = '0.0.14'
2
+ VERSION = '0.0.16'
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
@@ -16,8 +16,8 @@ Gem::Specification.new do |s|
16
16
 
17
17
  s.add_development_dependency('mocha', '~> 1.2.1')
18
18
  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')
19
+ s.add_development_dependency('test-unit', '~> 3.6.2')
20
+ s.add_development_dependency('rake', '>= 11.3.0')
21
21
  s.add_development_dependency('bundler', '>= 1.7.6')
22
22
 
23
23
  s.files = `git ls-files`.split("\n")
@@ -22,5 +22,13 @@ module Payjp
22
22
  balance.delete
23
23
  end
24
24
  end
25
+
26
+ should "statement_urls should be callable" do
27
+ @mock.expects(:get).never
28
+ @mock.expects(:post).once.returns(test_response({ :object => "statement_url", :url => 'https://pay.jp/_/statements/8f9ec721bc734dbcxxxxxxxxxxxxxxxx', :expires => 1476676539 }))
29
+ c = Payjp::Statement.new('st_test')
30
+ response = c.statement_urls()
31
+ assert_equal response[:url], 'https://pay.jp/_/statements/8f9ec721bc734dbcxxxxxxxxxxxxxxxx'
32
+ end
25
33
  end
26
34
  end
@@ -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,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: payjp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - PAY.JP
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-09 00:00:00.000000000 Z
11
+ date: 2024-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -64,26 +64,26 @@ dependencies:
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: 3.2.2
67
+ version: 3.6.2
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: 3.2.2
74
+ version: 3.6.2
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: rake
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - "~>"
79
+ - - ">="
80
80
  - !ruby/object:Gem::Version
81
81
  version: 11.3.0
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - "~>"
86
+ - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: 11.3.0
89
89
  - !ruby/object:Gem::Dependency
@@ -144,6 +144,7 @@ files:
144
144
  - lib/payjp/subscription.rb
145
145
  - lib/payjp/tenant.rb
146
146
  - lib/payjp/term.rb
147
+ - lib/payjp/three_d_secure_request.rb
147
148
  - lib/payjp/token.rb
148
149
  - lib/payjp/transfer.rb
149
150
  - lib/payjp/util.rb
@@ -164,6 +165,7 @@ files:
164
165
  - test/payjp/subscription_test.rb
165
166
  - test/payjp/tenant_test.rb
166
167
  - test/payjp/term_test.rb
168
+ - test/payjp/three_d_secure_request_test.rb
167
169
  - test/payjp/token_test.rb
168
170
  - test/payjp/transfer_test.rb
169
171
  - test/payjp/util_test.rb
@@ -209,6 +211,7 @@ test_files:
209
211
  - test/payjp/subscription_test.rb
210
212
  - test/payjp/tenant_test.rb
211
213
  - test/payjp/term_test.rb
214
+ - test/payjp/three_d_secure_request_test.rb
212
215
  - test/payjp/token_test.rb
213
216
  - test/payjp/transfer_test.rb
214
217
  - test/payjp/util_test.rb