payjp 0.0.12 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e04927ede4192a112eada01f9cbed0446c5be53239fa4e6a0ad0428e7bc5f223
4
- data.tar.gz: 255cb29b0aaa221b636c2bac80e4076e3847581511d115593c7fd6e835f38f6f
3
+ metadata.gz: 32fcd8c9e2569e568458d8eac4dc882d1900e75577f8ff686801085b7d202385
4
+ data.tar.gz: a4dd505473e1bf7fbd0fcd56c1620f00d5f4a39781f1c1ffdabc623f55d16464
5
5
  SHA512:
6
- metadata.gz: 5dca21abfcb1d46a5da179129c6331cb0ed47c32601e1c144dc76d549a6d04a11294e198c2c8e0ab637c396620492a75a3e00aed74b0f6919c9a55aa694cd669
7
- data.tar.gz: ffbeed6e352fe7ff832f375e335877c184e0b136cba6df6df97fe502ae56fd6c961092f3125c7286ffef8315f9579e25b9b2d8972945d3c51b5c1981150294e1
6
+ metadata.gz: 686404e37c62aafe0ce82a76264db1003651b3f43cc027cdae712911db20aaa3f0876ed7de74737d827e37fd97123406837dcaa4b6478c257f17ec7d411a1c0e
7
+ data.tar.gz: 257f55f34bd2aa2347c14cbf0dadaa49229a36c21a6d130751f24984d175a01f4d31e1ef5418cff772c883c8bcfc0c47c584995ed03bcde7a7a8e0107d2a340f
@@ -0,0 +1,5 @@
1
+ module Payjp
2
+ class Balance < APIResource
3
+ include Payjp::APIOperations::List
4
+ end
5
+ end
@@ -2,14 +2,14 @@ module Payjp
2
2
  class Statement < APIResource
3
3
  include Payjp::APIOperations::List
4
4
 
5
- def create_statement_urls(params = {}, opts = {})
6
- response, opts = request(:post, create_statement_urls_url, params, opts)
5
+ def statement_urls(params = {}, opts = {})
6
+ response, opts = request(:post, statement_urls_url, params, opts)
7
7
  response
8
8
  end
9
9
 
10
10
  private
11
11
 
12
- def create_statement_urls_url
12
+ def statement_urls_url
13
13
  url + '/statement_urls'
14
14
  end
15
15
  end
data/lib/payjp/term.rb ADDED
@@ -0,0 +1,5 @@
1
+ module Payjp
2
+ class Term < APIResource
3
+ include Payjp::APIOperations::List
4
+ end
5
+ end
data/lib/payjp/util.rb CHANGED
@@ -22,6 +22,7 @@ module Payjp
22
22
 
23
23
  # business objects
24
24
  'account' => Account,
25
+ 'balance' => Balance,
25
26
  'card' => Card,
26
27
  'charge' => Charge,
27
28
  'customer' => Customer,
@@ -30,6 +31,7 @@ module Payjp
30
31
  'plan' => Plan,
31
32
  'statement' => Statement,
32
33
  'subscription' => Subscription,
34
+ 'term' => Term,
33
35
  'token' => Token,
34
36
  'transfer' => Transfer
35
37
  }
data/lib/payjp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Payjp
2
- VERSION = '0.0.12'
2
+ VERSION = '0.0.14'
3
3
  end
data/lib/payjp.rb CHANGED
@@ -36,6 +36,8 @@ require 'payjp/card'
36
36
  require 'payjp/statement'
37
37
  require 'payjp/subscription'
38
38
  require 'payjp/tenant'
39
+ require 'payjp/term'
40
+ require 'payjp/balance'
39
41
 
40
42
  # Errors
41
43
  require 'payjp/errors/payjp_error'
@@ -0,0 +1,26 @@
1
+ require File.expand_path('../../test_helper', __FILE__)
2
+
3
+ module Payjp
4
+ class BalanceTest < Test::Unit::TestCase
5
+ should "balances should be listable" do
6
+ @mock.expects(:get).once.returns(test_response(test_balance_array))
7
+ c = Payjp::Balance.all.data
8
+ assert c.is_a? Array
9
+ assert c[0].is_a? Payjp::Balance
10
+ end
11
+
12
+ should "retrieve should retrieve balance" do
13
+ @mock.expects(:get).once.returns(test_response(test_balance))
14
+ balance = Payjp::Balance.retrieve('ba_test_balance')
15
+ assert_equal 'ba_test_balance', balance.id
16
+ end
17
+
18
+ should "balances should not be deletable" do
19
+ assert_raises NoMethodError do
20
+ @mock.expects(:get).once.returns(test_response(test_balance))
21
+ balance = Payjp::Balance.retrieve('ba_test_balance')
22
+ balance.delete
23
+ end
24
+ end
25
+ end
26
+ end
@@ -22,11 +22,11 @@ module Payjp
22
22
  assert statement.items[0].to_hash.has_key?(:tax_rate)
23
23
  end
24
24
 
25
- should "create_statement_urls should be callable" do
25
+ should "statement_urls should be callable" do
26
26
  @mock.expects(:get).never
27
27
  @mock.expects(:post).once.returns(test_response({ :object => "statement_url", :url => 'https://pay.jp/_/statements/8f9ec721bc734dbcxxxxxxxxxxxxxxxx', :expires => 1476676539 }))
28
28
  c = Payjp::Statement.new('st_test')
29
- response = c.create_statement_urls()
29
+ response = c.statement_urls()
30
30
  assert_equal response[:url], 'https://pay.jp/_/statements/8f9ec721bc734dbcxxxxxxxxxxxxxxxx'
31
31
  end
32
32
  end
@@ -0,0 +1,26 @@
1
+ require File.expand_path('../../test_helper', __FILE__)
2
+
3
+ module Payjp
4
+ class TermTest < Test::Unit::TestCase
5
+ should "terms should be listable" do
6
+ @mock.expects(:get).once.returns(test_response(test_term_array))
7
+ c = Payjp::Term.all.data
8
+ assert c.is_a? Array
9
+ assert c[0].is_a? Payjp::Term
10
+ end
11
+
12
+ should "retrieve should retrieve term" do
13
+ @mock.expects(:get).once.returns(test_response(test_term))
14
+ term = Payjp::Term.retrieve('tm_test_term')
15
+ assert_equal 'tm_test_term', term.id
16
+ end
17
+
18
+ should "terms should not be deletable" do
19
+ assert_raises NoMethodError do
20
+ @mock.expects(:get).once.returns(test_response(test_term))
21
+ term = Payjp::Term.retrieve('tm_test_term')
22
+ term.delete
23
+ end
24
+ end
25
+ end
26
+ end
data/test/test_data.rb CHANGED
@@ -359,7 +359,9 @@ module Payjp
359
359
  }
360
360
  ],
361
361
  :object => "statement",
362
- :title => nil
362
+ :title => nil,
363
+ :tenant_id => nil,
364
+ :updated => 1695892351
363
365
  }.merge(params)
364
366
  end
365
367
 
@@ -371,5 +373,57 @@ module Payjp
371
373
  :url => '/v1/statements'
372
374
  }
373
375
  end
376
+
377
+ def test_term_array
378
+ {
379
+ :count => 3,
380
+ :data => [test_term, test_term, test_term],
381
+ :object => 'list',
382
+ :url => '/v1/terms'
383
+ }
384
+ end
385
+
386
+ def test_term(params = {})
387
+ {
388
+ :id => "tm_test_term",
389
+ :livemode => false,
390
+ :object => "term",
391
+ :charge_count => 158,
392
+ :refund_count => 25,
393
+ :dispute_count => 2,
394
+ :end_at => 1439650800,
395
+ :start_at => 1438354800
396
+ }.merge(params)
397
+ end
398
+
399
+ def test_balance_array
400
+ {
401
+ :count => 3,
402
+ :data => [test_balance, test_balance, test_balance],
403
+ :object => 'list',
404
+ :url => '/v1/terms'
405
+ }
406
+ end
407
+
408
+ def test_balance(params = {})
409
+ {
410
+ :created => 1438354800,
411
+ :id => 'ba_test_balance',
412
+ :livemode => false,
413
+ :net => 1000,
414
+ :object => 'balance',
415
+ :state => 'collecting',
416
+ :tenant_id => nil,
417
+ :statements => {
418
+ :count => 2,
419
+ :data => [test_statement,test_statement],
420
+ :object => 'list',
421
+ :url => '/v1/statements'
422
+ },
423
+ :closed => false,
424
+ :due_date => nil,
425
+ :bank_info => nil
426
+ }.merge(params)
427
+ end
374
428
  end
375
429
  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.12
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - PAY.JP
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-17 00:00:00.000000000 Z
11
+ date: 2024-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -126,6 +126,7 @@ files:
126
126
  - lib/payjp/api_operations/request.rb
127
127
  - lib/payjp/api_operations/update.rb
128
128
  - lib/payjp/api_resource.rb
129
+ - lib/payjp/balance.rb
129
130
  - lib/payjp/card.rb
130
131
  - lib/payjp/charge.rb
131
132
  - lib/payjp/customer.rb
@@ -142,6 +143,7 @@ files:
142
143
  - lib/payjp/statement.rb
143
144
  - lib/payjp/subscription.rb
144
145
  - lib/payjp/tenant.rb
146
+ - lib/payjp/term.rb
145
147
  - lib/payjp/token.rb
146
148
  - lib/payjp/transfer.rb
147
149
  - lib/payjp/util.rb
@@ -149,6 +151,7 @@ files:
149
151
  - payjp.gemspec
150
152
  - test/payjp/account_test.rb
151
153
  - test/payjp/api_resource_test.rb
154
+ - test/payjp/balance_test.rb
152
155
  - test/payjp/charge_test.rb
153
156
  - test/payjp/customer_card_test.rb
154
157
  - test/payjp/customer_test.rb
@@ -160,6 +163,7 @@ files:
160
163
  - test/payjp/statement_test.rb
161
164
  - test/payjp/subscription_test.rb
162
165
  - test/payjp/tenant_test.rb
166
+ - test/payjp/term_test.rb
163
167
  - test/payjp/token_test.rb
164
168
  - test/payjp/transfer_test.rb
165
169
  - test/payjp/util_test.rb
@@ -192,6 +196,7 @@ summary: Ruby bindings for the Payjp API
192
196
  test_files:
193
197
  - test/payjp/account_test.rb
194
198
  - test/payjp/api_resource_test.rb
199
+ - test/payjp/balance_test.rb
195
200
  - test/payjp/charge_test.rb
196
201
  - test/payjp/customer_card_test.rb
197
202
  - test/payjp/customer_test.rb
@@ -203,6 +208,7 @@ test_files:
203
208
  - test/payjp/statement_test.rb
204
209
  - test/payjp/subscription_test.rb
205
210
  - test/payjp/tenant_test.rb
211
+ - test/payjp/term_test.rb
206
212
  - test/payjp/token_test.rb
207
213
  - test/payjp/transfer_test.rb
208
214
  - test/payjp/util_test.rb