payjp 0.0.10 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby-publish.yml +24 -0
  3. data/.github/workflows/test.yml +2 -2
  4. data/.gitignore +0 -0
  5. data/.rubocop.yml +0 -0
  6. data/.rubocop_todo.yml +0 -0
  7. data/CONTRIBUTORS +0 -0
  8. data/Gemfile +0 -0
  9. data/History.txt +0 -0
  10. data/LICENSE +0 -0
  11. data/README.md +0 -0
  12. data/Rakefile +0 -0
  13. data/lib/payjp/account.rb +0 -0
  14. data/lib/payjp/api_operations/create.rb +0 -0
  15. data/lib/payjp/api_operations/delete.rb +0 -0
  16. data/lib/payjp/api_operations/list.rb +0 -0
  17. data/lib/payjp/api_operations/request.rb +0 -0
  18. data/lib/payjp/api_operations/update.rb +0 -0
  19. data/lib/payjp/api_resource.rb +0 -0
  20. data/lib/payjp/card.rb +0 -0
  21. data/lib/payjp/charge.rb +0 -0
  22. data/lib/payjp/customer.rb +0 -0
  23. data/lib/payjp/errors/api_connection_error.rb +0 -0
  24. data/lib/payjp/errors/api_error.rb +0 -0
  25. data/lib/payjp/errors/authentication_error.rb +0 -0
  26. data/lib/payjp/errors/card_error.rb +0 -0
  27. data/lib/payjp/errors/invalid_request_error.rb +0 -0
  28. data/lib/payjp/errors/payjp_error.rb +0 -0
  29. data/lib/payjp/event.rb +0 -0
  30. data/lib/payjp/list_object.rb +0 -0
  31. data/lib/payjp/payjp_object.rb +0 -0
  32. data/lib/payjp/plan.rb +0 -0
  33. data/lib/payjp/statement.rb +16 -0
  34. data/lib/payjp/subscription.rb +0 -0
  35. data/lib/payjp/tenant.rb +0 -0
  36. data/lib/payjp/token.rb +0 -0
  37. data/lib/payjp/transfer.rb +0 -0
  38. data/lib/payjp/util.rb +1 -0
  39. data/lib/payjp/version.rb +1 -1
  40. data/lib/payjp.rb +1 -0
  41. data/payjp.gemspec +0 -0
  42. data/test/payjp/account_test.rb +0 -0
  43. data/test/payjp/api_resource_test.rb +0 -0
  44. data/test/payjp/charge_test.rb +0 -0
  45. data/test/payjp/customer_card_test.rb +0 -0
  46. data/test/payjp/customer_test.rb +0 -0
  47. data/test/payjp/event_test.rb +0 -0
  48. data/test/payjp/list_object_test.rb +0 -0
  49. data/test/payjp/metadata_test.rb +0 -0
  50. data/test/payjp/payjp_object_test.rb +0 -0
  51. data/test/payjp/plan_test.rb +0 -0
  52. data/test/payjp/statement_test.rb +33 -0
  53. data/test/payjp/subscription_test.rb +0 -0
  54. data/test/payjp/tenant_test.rb +0 -0
  55. data/test/payjp/token_test.rb +0 -0
  56. data/test/payjp/transfer_test.rb +0 -0
  57. data/test/payjp/util_test.rb +0 -0
  58. data/test/test_data.rb +47 -1
  59. data/test/test_helper.rb +0 -0
  60. metadata +7 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea73b4ff6c1c71f4c571eca0fe6b9ecc907e71b4fc1914a10438eacf7eb50b6c
4
- data.tar.gz: 5212a4b8341623b164dbb4869a13a4c423454b7bbfbad2ec43b09f78bdce177f
3
+ metadata.gz: d0270ff64998ad57112bcf113594f8db36b931f1d1dd468dbd3bae4e1c16eb70
4
+ data.tar.gz: c0e32cbbb9b0ee609c4ff0e30f2621367d61a74276f819a2abfdf754bf4e62a8
5
5
  SHA512:
6
- metadata.gz: 5e6f7dd0643142735d9929e6f8c5b9bf08ea7239597e26ed88f43a32fd082ab524f4b3ce13c35647458b53a283a23bea409e0d2e04e5d78a8470acd25eb804cd
7
- data.tar.gz: 3239795693202e338eea11b1b88c61ea5ffdd7fac72d1545580276700b2d37b0949651e0bf7239eefd4c328af7695fb1275f22d3f37d710c60705eb53e2e88ac
6
+ metadata.gz: c45bd79ebfc04ac60497e4c7b844f060eb5acf6148fde65d27dd97d64dd81bd6712b4be4d98f9f1e072ca313d1afbcc1491a69d367b3b393571a811226c568c5
7
+ data.tar.gz: 9aaf07bc44d9002f5957bf73df57c5778700d7b0932968cafb22bba89e189e55ab0d83c5e5c3e4fab4891eef2b668098c851c034fa9f171c82bcf10c7f11530f
@@ -0,0 +1,24 @@
1
+ name: Publish Ruby Package
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ deploy:
9
+
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - uses: actions/checkout@v3
14
+ - name: Set up Ruby
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: '2.7'
18
+ bundler-cache: true
19
+ - name: Build and publish
20
+ env:
21
+ GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
22
+ run: |
23
+ bundle exec rake build
24
+ bundle exec gem push pkg/payjp-*.gem
@@ -5,12 +5,12 @@ on: push
5
5
  jobs:
6
6
  build-test:
7
7
 
8
- runs-on: ubuntu-latest
8
+ runs-on: ubuntu-20.04
9
9
  strategy:
10
10
  matrix:
11
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
- - uses: actions/checkout@v2
13
+ - uses: actions/checkout@v3
14
14
  - name: Set up Ruby ${{ matrix.ruby-version }}
15
15
  uses: ruby/setup-ruby@v1
16
16
  with:
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
File without changes
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
File without changes
data/lib/payjp/card.rb CHANGED
File without changes
data/lib/payjp/charge.rb CHANGED
File without changes
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
File without changes
File without changes
data/lib/payjp/plan.rb CHANGED
File without changes
@@ -0,0 +1,16 @@
1
+ module Payjp
2
+ class Statement < APIResource
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
15
+ end
16
+ end
File without changes
data/lib/payjp/tenant.rb CHANGED
File without changes
data/lib/payjp/token.rb CHANGED
File without changes
File without changes
data/lib/payjp/util.rb CHANGED
@@ -28,6 +28,7 @@ module Payjp
28
28
  'tenant' => Tenant,
29
29
  'event' => Event,
30
30
  'plan' => Plan,
31
+ 'statement' => Statement,
31
32
  'subscription' => Subscription,
32
33
  'token' => Token,
33
34
  'transfer' => Transfer
data/lib/payjp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Payjp
2
- VERSION = '0.0.10'
2
+ VERSION = '0.0.13'
3
3
  end
data/lib/payjp.rb CHANGED
@@ -33,6 +33,7 @@ require 'payjp/token'
33
33
  require 'payjp/event'
34
34
  require 'payjp/transfer'
35
35
  require 'payjp/card'
36
+ require 'payjp/statement'
36
37
  require 'payjp/subscription'
37
38
  require 'payjp/tenant'
38
39
 
data/payjp.gemspec CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,33 @@
1
+ require File.expand_path('../../test_helper', __FILE__)
2
+
3
+ module Payjp
4
+ class StatementTest < Test::Unit::TestCase
5
+ should "statement should be listable" do
6
+ @mock.expects(:get).once.returns(test_response(test_statement_array))
7
+ statements = Payjp::Statement.all.data
8
+ assert statements.is_a? Array
9
+ assert statements[0].is_a? Payjp::Statement
10
+ end
11
+
12
+ should "be retrievable" do
13
+ @mock.expects(:get).once.returns(test_response(test_statement))
14
+ statement = Payjp::Statement.retrieve('st_test')
15
+ assert statement.is_a? Payjp::Statement
16
+ assert_equal 'st_test', statement.id
17
+ assert_equal 'statement', statement.object
18
+ assert statement.to_hash.has_key?(:items)
19
+ assert statement.items[0].to_hash.has_key?(:amount)
20
+ assert statement.items[0].to_hash.has_key?(:name)
21
+ assert statement.items[0].to_hash.has_key?(:subject)
22
+ assert statement.items[0].to_hash.has_key?(:tax_rate)
23
+ end
24
+
25
+ should "statement_urls should be callable" do
26
+ @mock.expects(:get).never
27
+ @mock.expects(:post).once.returns(test_response({ :object => "statement_url", :url => 'https://pay.jp/_/statements/8f9ec721bc734dbcxxxxxxxxxxxxxxxx', :expires => 1476676539 }))
28
+ c = Payjp::Statement.new('st_test')
29
+ response = c.statement_urls()
30
+ assert_equal response[:url], 'https://pay.jp/_/statements/8f9ec721bc734dbcxxxxxxxxxxxxxxxx'
31
+ end
32
+ end
33
+ end
File without changes
File without changes
File without changes
File without changes
File without changes
data/test/test_data.rb CHANGED
@@ -235,7 +235,9 @@ module Payjp
235
235
  :charge_gross => 1000,
236
236
  :net => 1000,
237
237
  :refund_amount => 0,
238
- :refund_count => 0
238
+ :refund_count => 0,
239
+ :dispute_amount => 0,
240
+ :dispute_count => 0
239
241
  },
240
242
  :metadata => {}
241
243
  }.merge(params)
@@ -325,5 +327,49 @@ module Payjp
325
327
  }
326
328
  }
327
329
  end
330
+
331
+ def test_statement(params = {})
332
+ {
333
+ :created => 1695620296,
334
+ :id => "st_test",
335
+ :items => [
336
+ {
337
+ :amount => 282358654,
338
+ :name => "売上",
339
+ :subject => "gross_sales",
340
+ :tax_rate => "0.00"
341
+ },
342
+ {
343
+ :amount => -65699624,
344
+ :name => "返金",
345
+ :subject => "gross_refund",
346
+ :tax_rate => "0.00"
347
+ },
348
+ {
349
+ :amount => -7054912,
350
+ :name => "決済手数料",
351
+ :subject => "fee",
352
+ :tax_rate => "0.10"
353
+ },
354
+ {
355
+ :amount => 1644315,
356
+ :name => "返金による手数料返還",
357
+ :subject => "refund_fee_offset",
358
+ :tax_rate => "0.10"
359
+ }
360
+ ],
361
+ :object => "statement",
362
+ :title => nil
363
+ }.merge(params)
364
+ end
365
+
366
+ def test_statement_array
367
+ {
368
+ :count => 2,
369
+ :data => [test_statement, test_statement],
370
+ :object => 'list',
371
+ :url => '/v1/statements'
372
+ }
373
+ end
328
374
  end
329
375
  end
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.10
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - PAY.JP
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-30 00:00:00.000000000 Z
11
+ date: 2024-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -107,6 +107,7 @@ executables: []
107
107
  extensions: []
108
108
  extra_rdoc_files: []
109
109
  files:
110
+ - ".github/workflows/ruby-publish.yml"
110
111
  - ".github/workflows/test.yml"
111
112
  - ".gitignore"
112
113
  - ".rubocop.yml"
@@ -138,6 +139,7 @@ files:
138
139
  - lib/payjp/list_object.rb
139
140
  - lib/payjp/payjp_object.rb
140
141
  - lib/payjp/plan.rb
142
+ - lib/payjp/statement.rb
141
143
  - lib/payjp/subscription.rb
142
144
  - lib/payjp/tenant.rb
143
145
  - lib/payjp/token.rb
@@ -155,6 +157,7 @@ files:
155
157
  - test/payjp/metadata_test.rb
156
158
  - test/payjp/payjp_object_test.rb
157
159
  - test/payjp/plan_test.rb
160
+ - test/payjp/statement_test.rb
158
161
  - test/payjp/subscription_test.rb
159
162
  - test/payjp/tenant_test.rb
160
163
  - test/payjp/token_test.rb
@@ -182,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
185
  - !ruby/object:Gem::Version
183
186
  version: '0'
184
187
  requirements: []
185
- rubygems_version: 3.1.2
188
+ rubygems_version: 3.1.6
186
189
  signing_key:
187
190
  specification_version: 4
188
191
  summary: Ruby bindings for the Payjp API
@@ -197,6 +200,7 @@ test_files:
197
200
  - test/payjp/metadata_test.rb
198
201
  - test/payjp/payjp_object_test.rb
199
202
  - test/payjp/plan_test.rb
203
+ - test/payjp/statement_test.rb
200
204
  - test/payjp/subscription_test.rb
201
205
  - test/payjp/tenant_test.rb
202
206
  - test/payjp/token_test.rb