payjp 0.0.8 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +1 -1
- data/.gitignore +0 -0
- data/.rubocop.yml +0 -0
- data/.rubocop_todo.yml +0 -0
- data/CONTRIBUTORS +0 -0
- data/Gemfile +0 -0
- data/History.txt +0 -0
- data/LICENSE +0 -0
- data/README.md +28 -0
- data/Rakefile +0 -0
- data/lib/payjp/account.rb +0 -0
- data/lib/payjp/api_operations/create.rb +0 -0
- data/lib/payjp/api_operations/delete.rb +0 -0
- data/lib/payjp/api_operations/list.rb +0 -0
- data/lib/payjp/api_operations/request.rb +0 -0
- data/lib/payjp/api_operations/update.rb +0 -0
- data/lib/payjp/api_resource.rb +0 -0
- data/lib/payjp/card.rb +0 -0
- data/lib/payjp/charge.rb +9 -0
- data/lib/payjp/customer.rb +0 -0
- data/lib/payjp/errors/api_connection_error.rb +0 -0
- data/lib/payjp/errors/api_error.rb +0 -0
- data/lib/payjp/errors/authentication_error.rb +0 -0
- data/lib/payjp/errors/card_error.rb +0 -0
- data/lib/payjp/errors/invalid_request_error.rb +0 -0
- data/lib/payjp/errors/payjp_error.rb +0 -0
- data/lib/payjp/event.rb +0 -0
- data/lib/payjp/list_object.rb +0 -0
- data/lib/payjp/payjp_object.rb +0 -0
- data/lib/payjp/plan.rb +0 -0
- data/lib/payjp/subscription.rb +0 -0
- data/lib/payjp/tenant.rb +19 -0
- data/lib/payjp/token.rb +0 -0
- data/lib/payjp/transfer.rb +0 -0
- data/lib/payjp/util.rb +1 -0
- data/lib/payjp/version.rb +1 -1
- data/lib/payjp.rb +1 -0
- data/payjp.gemspec +0 -0
- data/test/payjp/account_test.rb +0 -0
- data/test/payjp/api_resource_test.rb +0 -0
- data/test/payjp/charge_test.rb +12 -0
- data/test/payjp/customer_card_test.rb +0 -0
- data/test/payjp/customer_test.rb +0 -0
- data/test/payjp/event_test.rb +0 -0
- data/test/payjp/list_object_test.rb +0 -0
- data/test/payjp/metadata_test.rb +0 -0
- data/test/payjp/payjp_object_test.rb +0 -0
- data/test/payjp/plan_test.rb +0 -0
- data/test/payjp/subscription_test.rb +0 -0
- data/test/payjp/tenant_test.rb +42 -0
- data/test/payjp/token_test.rb +0 -0
- data/test/payjp/transfer_test.rb +0 -0
- data/test/payjp/util_test.rb +0 -0
- data/test/test_data.rb +29 -0
- data/test/test_helper.rb +0 -0
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea73b4ff6c1c71f4c571eca0fe6b9ecc907e71b4fc1914a10438eacf7eb50b6c
|
4
|
+
data.tar.gz: 5212a4b8341623b164dbb4869a13a4c423454b7bbfbad2ec43b09f78bdce177f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e6f7dd0643142735d9929e6f8c5b9bf08ea7239597e26ed88f43a32fd082ab524f4b3ce13c35647458b53a283a23bea409e0d2e04e5d78a8470acd25eb804cd
|
7
|
+
data.tar.gz: 3239795693202e338eea11b1b88c61ea5ffdd7fac72d1545580276700b2d37b0949651e0bf7239eefd4c328af7695fb1275f22d3f37d710c60705eb53e2e88ac
|
data/.github/workflows/test.yml
CHANGED
@@ -8,7 +8,7 @@ jobs:
|
|
8
8
|
runs-on: ubuntu-latest
|
9
9
|
strategy:
|
10
10
|
matrix:
|
11
|
-
ruby-version: [2.0.0, 2.1, 2.2, 2.3.0, jruby-9.2.17.0]
|
11
|
+
ruby-version: [2.0.0, 2.1, 2.2, 2.3.0, 2.7.0, jruby-9.2.17.0]
|
12
12
|
steps:
|
13
13
|
- uses: actions/checkout@v2
|
14
14
|
- name: Set up Ruby ${{ matrix.ruby-version }}
|
data/.gitignore
CHANGED
File without changes
|
data/.rubocop.yml
CHANGED
File without changes
|
data/.rubocop_todo.yml
CHANGED
File without changes
|
data/CONTRIBUTORS
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/History.txt
CHANGED
File without changes
|
data/LICENSE
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -41,6 +41,34 @@ gem build payjp.gemspec
|
|
41
41
|
* Ruby 2.0.0 or above.
|
42
42
|
* rest-client
|
43
43
|
|
44
|
+
### Retry on HTTP Status Code 429
|
45
|
+
* See [Rate Limit Guideline](https://pay.jp/docs/guideline-rate-limit#2-%E3%83%AA%E3%83%88%E3%83%A9%E3%82%A4)
|
46
|
+
* When you exceeded rate-limit, you can retry request by setting `max_retry`
|
47
|
+
like `Payjp.max_retry = 3` .
|
48
|
+
* The retry interval base value is `retry_initial_delay`
|
49
|
+
Adjust the value like `Payjp.retry_initial_delay = 4`
|
50
|
+
The smaller is shorter.
|
51
|
+
* The Maximum retry time is `retry_max_delay`.
|
52
|
+
Adjust the value like 'Payjp.retry_max_delay = 32'
|
53
|
+
* The retry interval calcurating is based on "Exponential backoff with equal jitter" algorithm.
|
54
|
+
See https://aws.amazon.com/jp/blogs/architecture/exponential-backoff-and-jitter/
|
55
|
+
|
56
|
+
how to use
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
require 'payjp'
|
60
|
+
Payjp.api_key = 'sk_test_c62fade9d045b54cd76d7036'
|
61
|
+
Payjp.max_retry = 3
|
62
|
+
Payjp.retry_initial_delay = 2
|
63
|
+
Payjp.retry_max_delay = 32
|
64
|
+
|
65
|
+
charge = Payjp::Charge.create(
|
66
|
+
:amount => 3500,
|
67
|
+
:card => 'token_id',
|
68
|
+
:currency => 'jpy',
|
69
|
+
)
|
70
|
+
```
|
71
|
+
|
44
72
|
### Bundler
|
45
73
|
|
46
74
|
If you are installing via bundler, you should be sure to use the https
|
data/Rakefile
CHANGED
File without changes
|
data/lib/payjp/account.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/payjp/api_resource.rb
CHANGED
File without changes
|
data/lib/payjp/card.rb
CHANGED
File without changes
|
data/lib/payjp/charge.rb
CHANGED
@@ -19,6 +19,11 @@ module Payjp
|
|
19
19
|
refresh_from(response, opts)
|
20
20
|
end
|
21
21
|
|
22
|
+
def tds_finish(params = {}, opts = {})
|
23
|
+
response, opts = request(:post, tds_finish_url, params, opts)
|
24
|
+
refresh_from(response, opts)
|
25
|
+
end
|
26
|
+
|
22
27
|
private
|
23
28
|
|
24
29
|
def refund_url
|
@@ -32,5 +37,9 @@ module Payjp
|
|
32
37
|
def reauth_url
|
33
38
|
url + '/reauth'
|
34
39
|
end
|
40
|
+
|
41
|
+
def tds_finish_url
|
42
|
+
url + '/tds_finish'
|
43
|
+
end
|
35
44
|
end
|
36
45
|
end
|
data/lib/payjp/customer.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/payjp/event.rb
CHANGED
File without changes
|
data/lib/payjp/list_object.rb
CHANGED
File without changes
|
data/lib/payjp/payjp_object.rb
CHANGED
File without changes
|
data/lib/payjp/plan.rb
CHANGED
File without changes
|
data/lib/payjp/subscription.rb
CHANGED
File without changes
|
data/lib/payjp/tenant.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Payjp
|
2
|
+
class Tenant < APIResource
|
3
|
+
include Payjp::APIOperations::Create
|
4
|
+
include Payjp::APIOperations::Delete
|
5
|
+
include Payjp::APIOperations::Update
|
6
|
+
include Payjp::APIOperations::List
|
7
|
+
|
8
|
+
def create_application_urls(params = {}, opts = {})
|
9
|
+
response, opts = request(:post, create_application_urls_url, params, opts)
|
10
|
+
response
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def create_application_urls_url
|
16
|
+
url + '/application_urls'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/payjp/token.rb
CHANGED
File without changes
|
data/lib/payjp/transfer.rb
CHANGED
File without changes
|
data/lib/payjp/util.rb
CHANGED
data/lib/payjp/version.rb
CHANGED
data/lib/payjp.rb
CHANGED
data/payjp.gemspec
CHANGED
File without changes
|
data/test/payjp/account_test.rb
CHANGED
File without changes
|
File without changes
|
data/test/payjp/charge_test.rb
CHANGED
@@ -91,5 +91,17 @@ module Payjp
|
|
91
91
|
c.reauth
|
92
92
|
assert_equal expired_at.to_i, c.expired_at
|
93
93
|
end
|
94
|
+
|
95
|
+
should "charges should be three_d_secure finishable" do
|
96
|
+
@mock.expects(:get).never
|
97
|
+
@mock.expects(:post).with do |url, api_key, params|
|
98
|
+
url == "#{Payjp.api_base}/v1/charges/test_charge/tds_finish" && api_key.nil? && CGI.parse(params) == {}
|
99
|
+
end.once.returns(test_response({ :id => "test_charge", :paid => true, :captured => true }))
|
100
|
+
|
101
|
+
c = Payjp::Charge.new("test_charge")
|
102
|
+
c.tds_finish
|
103
|
+
assert c.paid
|
104
|
+
assert c.captured
|
105
|
+
end
|
94
106
|
end
|
95
107
|
end
|
File without changes
|
data/test/payjp/customer_test.rb
CHANGED
File without changes
|
data/test/payjp/event_test.rb
CHANGED
File without changes
|
File without changes
|
data/test/payjp/metadata_test.rb
CHANGED
File without changes
|
File without changes
|
data/test/payjp/plan_test.rb
CHANGED
File without changes
|
File without changes
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require File.expand_path('../../test_helper', __FILE__)
|
2
|
+
|
3
|
+
module Payjp
|
4
|
+
class TenantTest < Test::Unit::TestCase
|
5
|
+
should "tenants should be listable" do
|
6
|
+
@mock.expects(:get).once.returns(test_response(test_tenant_array))
|
7
|
+
c = Payjp::Tenant.all.data
|
8
|
+
assert c.is_a? Array
|
9
|
+
assert c[0].is_a? Payjp::Tenant
|
10
|
+
end
|
11
|
+
|
12
|
+
should "tenants should be deletable" do
|
13
|
+
@mock.expects(:delete).once.returns(test_response(test_tenant))
|
14
|
+
c = Payjp::Tenant.new("test_tenant")
|
15
|
+
c.delete
|
16
|
+
end
|
17
|
+
|
18
|
+
should "tenants should be updateable" do
|
19
|
+
@mock.expects(:get).once.returns(test_response(test_tenant({ :name => "foo" })))
|
20
|
+
@mock.expects(:post).once.returns(test_response(test_tenant({ :name => "bar" })))
|
21
|
+
c = Payjp::Tenant.new("test_tenant").refresh
|
22
|
+
assert_equal "foo", c.name
|
23
|
+
c.name = "bar"
|
24
|
+
c.save
|
25
|
+
assert_equal "bar", c.name
|
26
|
+
end
|
27
|
+
|
28
|
+
should "create should return a new tenant" do
|
29
|
+
@mock.expects(:post).once.returns(test_response(test_tenant(:id => 'test_tenant1')))
|
30
|
+
c = Payjp::Tenant.create(:id => 'test_tenant1')
|
31
|
+
assert_equal "test_tenant1", c.id
|
32
|
+
end
|
33
|
+
|
34
|
+
should "create_application_urls should be callable" do
|
35
|
+
@mock.expects(:get).never
|
36
|
+
@mock.expects(:post).once.returns(test_response({ :object => "application_url", :url => 'https://pay.jp/_/applications/start/c24368137e384aa9xxxxxxxxxxxxxxxx', :expires => 1476676539 }))
|
37
|
+
c = Payjp::Tenant.new('test_tenant')
|
38
|
+
response = c.create_application_urls()
|
39
|
+
assert_equal response[:url], 'https://pay.jp/_/applications/start/c24368137e384aa9xxxxxxxxxxxxxxxx'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/test/payjp/token_test.rb
CHANGED
File without changes
|
data/test/payjp/transfer_test.rb
CHANGED
File without changes
|
data/test/payjp/util_test.rb
CHANGED
File without changes
|
data/test/test_data.rb
CHANGED
@@ -250,6 +250,35 @@ module Payjp
|
|
250
250
|
}
|
251
251
|
end
|
252
252
|
|
253
|
+
def test_tenant(params = {})
|
254
|
+
{
|
255
|
+
:created => 1433127983,
|
256
|
+
:name => "test",
|
257
|
+
:id => "test",
|
258
|
+
:livemode => false,
|
259
|
+
:metadata => nil,
|
260
|
+
:object => "tenant",
|
261
|
+
:platform_fee_rate => "10.15",
|
262
|
+
:payjp_fee_included => false,
|
263
|
+
:minimum_transfer_amount => 1000,
|
264
|
+
:bank_account_number => "0001000",
|
265
|
+
:bank_branch_code => "000",
|
266
|
+
:bank_code => "0000",
|
267
|
+
:bank_account_holder_name => "ヤマダ タロウ",
|
268
|
+
:bank_account_type => "普通",
|
269
|
+
:bank_account_status => "pending"
|
270
|
+
}.merge(params)
|
271
|
+
end
|
272
|
+
|
273
|
+
def test_tenant_array
|
274
|
+
{
|
275
|
+
:count => 3,
|
276
|
+
:data => [test_tenant, test_tenant, test_tenant],
|
277
|
+
:object => 'list',
|
278
|
+
:url => '/v1/tenants'
|
279
|
+
}
|
280
|
+
end
|
281
|
+
|
253
282
|
def test_invalid_api_key_error
|
254
283
|
{
|
255
284
|
:error => {
|
data/test/test_helper.rb
CHANGED
File without changes
|
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.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PAY.JP
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- lib/payjp/payjp_object.rb
|
140
140
|
- lib/payjp/plan.rb
|
141
141
|
- lib/payjp/subscription.rb
|
142
|
+
- lib/payjp/tenant.rb
|
142
143
|
- lib/payjp/token.rb
|
143
144
|
- lib/payjp/transfer.rb
|
144
145
|
- lib/payjp/util.rb
|
@@ -155,6 +156,7 @@ files:
|
|
155
156
|
- test/payjp/payjp_object_test.rb
|
156
157
|
- test/payjp/plan_test.rb
|
157
158
|
- test/payjp/subscription_test.rb
|
159
|
+
- test/payjp/tenant_test.rb
|
158
160
|
- test/payjp/token_test.rb
|
159
161
|
- test/payjp/transfer_test.rb
|
160
162
|
- test/payjp/util_test.rb
|
@@ -165,7 +167,7 @@ licenses:
|
|
165
167
|
- MIT
|
166
168
|
metadata:
|
167
169
|
source_code_uri: https://github.com/payjp/payjp-ruby
|
168
|
-
post_install_message:
|
170
|
+
post_install_message:
|
169
171
|
rdoc_options: []
|
170
172
|
require_paths:
|
171
173
|
- lib
|
@@ -181,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
183
|
version: '0'
|
182
184
|
requirements: []
|
183
185
|
rubygems_version: 3.1.2
|
184
|
-
signing_key:
|
186
|
+
signing_key:
|
185
187
|
specification_version: 4
|
186
188
|
summary: Ruby bindings for the Payjp API
|
187
189
|
test_files:
|
@@ -196,6 +198,7 @@ test_files:
|
|
196
198
|
- test/payjp/payjp_object_test.rb
|
197
199
|
- test/payjp/plan_test.rb
|
198
200
|
- test/payjp/subscription_test.rb
|
201
|
+
- test/payjp/tenant_test.rb
|
199
202
|
- test/payjp/token_test.rb
|
200
203
|
- test/payjp/transfer_test.rb
|
201
204
|
- test/payjp/util_test.rb
|