promisepay 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +109 -38
- data/Rakefile +8 -0
- data/lib/promisepay/client.rb +9 -3
- data/lib/promisepay/error.rb +1 -3
- data/lib/promisepay/models/bank_account.rb +2 -2
- data/lib/promisepay/models/card_account.rb +2 -2
- data/lib/promisepay/models/charge.rb +25 -0
- data/lib/promisepay/models/company.rb +24 -1
- data/lib/promisepay/models/item.rb +48 -36
- data/lib/promisepay/models/paypal_account.rb +2 -2
- data/lib/promisepay/models/transaction.rb +3 -3
- data/lib/promisepay/models/user.rb +42 -6
- data/lib/promisepay/models/wallet_account.rb +40 -0
- data/lib/promisepay/resources/bank_account_resource.rb +16 -2
- data/lib/promisepay/resources/card_account_resource.rb +2 -2
- data/lib/promisepay/resources/charge_resource.rb +47 -0
- data/lib/promisepay/resources/company_resource.rb +4 -4
- data/lib/promisepay/resources/fee_resource.rb +3 -3
- data/lib/promisepay/resources/item_resource.rb +3 -3
- data/lib/promisepay/resources/paypal_account_resource.rb +2 -2
- data/lib/promisepay/resources/token_resource.rb +1 -1
- data/lib/promisepay/resources/transaction_resource.rb +2 -2
- data/lib/promisepay/resources/user_resource.rb +4 -4
- data/lib/promisepay/resources/wallet_account_resource.rb +20 -0
- data/lib/promisepay/version.rb +1 -1
- data/promisepay.gemspec +1 -1
- metadata +11 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adf04a3bdbb2d06fb8ac5c9d227472472ae2f848
|
4
|
+
data.tar.gz: ae1993be85c0a4dcfe2b7d85c417210d09ea4018
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21df78755f2183845a671aa0b94f0cf6c56c3e9ed713df5199da036dd72d14475a99c1f0f96e38b7e8fe24b7d45698a6df45e8ecd4fd72b2988982b5085a8fc8
|
7
|
+
data.tar.gz: b414646de24bfbd94a7246de6658891ac4617974c4eca4736f7d4d4934a239e37f5067da612fd036906d07909cfb01d2f3a7091b2f2253a3392e4444b197b5ee
|
data/README.md
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
[![Join the chat at https://gitter.im/PromisePay/promisepay-ruby](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/PromisePay/promisepay-ruby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
4
4
|
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/promisepay.svg)](http://badge.fury.io/rb/promisepay)
|
6
|
-
[![Build Status](https://travis-ci.org/PromisePay/promisepay-ruby.svg?branch=
|
7
|
-
[![Coverage Status](https://coveralls.io/repos/PromisePay/promisepay-ruby/badge.svg?branch=
|
6
|
+
[![Build Status](https://travis-ci.org/PromisePay/promisepay-ruby.svg?branch=master)](https://travis-ci.org/PromisePay/promisepay-ruby)
|
7
|
+
[![Coverage Status](https://coveralls.io/repos/PromisePay/promisepay-ruby/badge.svg?branch=master)](https://coveralls.io/r/PromisePay/promisepay-ruby?branch=develop)
|
8
8
|
[![Code Climate](https://codeclimate.com/github/PromisePay/promisepay-ruby/badges/gpa.svg)](https://codeclimate.com/github/PromisePay/promisepay-ruby)
|
9
9
|
|
10
10
|
To see a completed integration in a Ruby on Rails app, visit this [repository](https://github.com/dannyshafer/PromisePay_api_integration).
|
@@ -33,11 +33,6 @@ See [PromisePay documentation](https://promisepay-docs.readme.io/v1.0/docs/fetch
|
|
33
33
|
|
34
34
|
**Create a PromisePay client**
|
35
35
|
|
36
|
-
```ruby
|
37
|
-
#In the Gemfile
|
38
|
-
gem 'promisepay'
|
39
|
-
```
|
40
|
-
|
41
36
|
The client can be configured through environment variables.
|
42
37
|
|
43
38
|
```ruby
|
@@ -53,7 +48,7 @@ The following parameters are configurable through the client:
|
|
53
48
|
* `:environment` / `ENV['PROMISEPAY_ENVIRONMENT']`: API [environment](http://docs.promisepay.com/v2.2/docs/environments) to use (default: 'test')
|
54
49
|
* `:api_domain` / `ENV['PROMISEPAY_API_DOMAIN']`: API domain name to use (default: 'api.promisepay.com')
|
55
50
|
|
56
|
-
Instantiate
|
51
|
+
Instantiate the PromisePay client.
|
57
52
|
|
58
53
|
```ruby
|
59
54
|
client = Promisepay::Client.new(username: ENV['PROMISEPAY_USERNAME'], token: ENV['PROMISEPAY_TOKEN'])
|
@@ -63,7 +58,7 @@ client = Promisepay::Client.new(username: ENV['PROMISEPAY_USERNAME'], token: ENV
|
|
63
58
|
|
64
59
|
##Tokens
|
65
60
|
##### Example 1 - Request session token
|
66
|
-
The below example shows the controller request for a marketplace configured to have the Item and User IDs generated automatically for them.
|
61
|
+
The below example shows the controller request for a marketplace configured to have the Item and User IDs generated automatically for them. Note: by default, the ability to have PromisePay auto generate IDs is turned off. However, it can easily be requested by contacting PromisePay support.
|
67
62
|
|
68
63
|
```ruby
|
69
64
|
token_request = client.tokens.create(:session, {
|
@@ -221,10 +216,18 @@ user.paypal_account
|
|
221
216
|
```ruby
|
222
217
|
user.bank_account
|
223
218
|
```
|
219
|
+
#####Get a user's wallet account
|
220
|
+
```ruby
|
221
|
+
user.wallet_account
|
222
|
+
```
|
224
223
|
#####Get a user's items
|
225
224
|
```ruby
|
226
225
|
user.items
|
227
226
|
```
|
227
|
+
#####Get a user's address
|
228
|
+
```ruby
|
229
|
+
user.address
|
230
|
+
```
|
228
231
|
#####Set a user's disbursement account
|
229
232
|
```ruby
|
230
233
|
user.disbursement_account(bank_account.id)
|
@@ -329,13 +332,17 @@ bank_account.deactivate
|
|
329
332
|
```ruby
|
330
333
|
bank_account.user
|
331
334
|
```
|
335
|
+
#####Validate Routing Number
|
336
|
+
```ruby
|
337
|
+
client.bank_accounts.validate('122235821')
|
338
|
+
```
|
332
339
|
|
333
340
|
##PayPal Accounts
|
334
341
|
#####Create a PayPal account
|
335
342
|
```ruby
|
336
343
|
paypal_account = client.paypal_accounts.create(
|
337
|
-
|
338
|
-
|
344
|
+
user_id: seller.id,
|
345
|
+
paypal_email: 'seller@promisepay.com'
|
339
346
|
)
|
340
347
|
```
|
341
348
|
#####Get a PayPal account
|
@@ -350,22 +357,47 @@ paypal_account.deactivate
|
|
350
357
|
```ruby
|
351
358
|
paypal_account.user
|
352
359
|
```
|
360
|
+
|
361
|
+
##Wallet Accounts
|
362
|
+
#####Get a Wallet account
|
363
|
+
```ruby
|
364
|
+
wallet_account = client.wallet_accounts.find('1')
|
365
|
+
```
|
366
|
+
#####Deposit funds
|
367
|
+
```ruby
|
368
|
+
wallet_account.deposit(
|
369
|
+
account_id: '123',
|
370
|
+
amount: 500
|
371
|
+
)
|
372
|
+
```
|
373
|
+
#####Withdraw funds
|
374
|
+
```ruby
|
375
|
+
wallet_account.withdraw(
|
376
|
+
account_id: '123',
|
377
|
+
amount: 200
|
378
|
+
)
|
379
|
+
```
|
380
|
+
#####Get a Wallet account's users
|
381
|
+
```ruby
|
382
|
+
wallet_account.user
|
383
|
+
```
|
384
|
+
|
353
385
|
##Companies
|
354
386
|
|
355
387
|
#####Create a company
|
356
388
|
```ruby
|
357
389
|
client.companies.create(
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
390
|
+
user_id: "1",
|
391
|
+
name: "Acme Co",
|
392
|
+
legal_name: "Acme Co Pty Ltd",
|
393
|
+
tax_number: "1231231",
|
394
|
+
charge_tax: true,
|
395
|
+
address_line1: "123 Test St",
|
396
|
+
address_line2: "",
|
397
|
+
city: "Melbourne",
|
398
|
+
state: "VIC",
|
399
|
+
zip: "3000",
|
400
|
+
country: "AUS"
|
369
401
|
)
|
370
402
|
```
|
371
403
|
|
@@ -379,20 +411,25 @@ client.companies.find('compamy_id')
|
|
379
411
|
client.companies.find_all
|
380
412
|
```
|
381
413
|
|
414
|
+
#####Get a company's address
|
415
|
+
```ruby
|
416
|
+
company.address
|
417
|
+
```
|
418
|
+
|
382
419
|
#####Update a company
|
383
420
|
```ruby
|
384
421
|
client.companies.update(
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
422
|
+
id: "8d578b9c-5b79-11e5-885d-feff819cdc9f",
|
423
|
+
name: "Acme Co",
|
424
|
+
legal_name: "Acme Co Pty Ltd",
|
425
|
+
tax_number: "1231231",
|
426
|
+
charge_tax: true,
|
427
|
+
address_line1: "123 Test St",
|
428
|
+
address_line2: "",
|
429
|
+
city: "Melbourne",
|
430
|
+
state: "VIC",
|
431
|
+
zip: "3000",
|
432
|
+
country: "AUS"
|
396
433
|
)
|
397
434
|
```
|
398
435
|
|
@@ -433,12 +470,46 @@ transaction.users
|
|
433
470
|
transaction.fees
|
434
471
|
```
|
435
472
|
|
473
|
+
##Charges
|
474
|
+
#####Get a list of charges
|
475
|
+
```ruby
|
476
|
+
charges = client.charges.find_all
|
477
|
+
```
|
478
|
+
#####Get a charge
|
479
|
+
```ruby
|
480
|
+
charge = client.charges.find('1')
|
481
|
+
```
|
482
|
+
#####Create a charge
|
483
|
+
```ruby
|
484
|
+
charge = client.charges.create(
|
485
|
+
account_id: '123',
|
486
|
+
user_id: '456',
|
487
|
+
name: 'Charge for Delivery',
|
488
|
+
email: 'anonymous+buyer+1@promisepay.com',
|
489
|
+
amount: 4_500,
|
490
|
+
zip: '3000',
|
491
|
+
curency: 'AUD',
|
492
|
+
country: 'AUS',
|
493
|
+
retain_account: true,
|
494
|
+
device_id: '0900JapG4txqVP4Nf...',
|
495
|
+
ip_address: '172.16.81.100'
|
496
|
+
)
|
497
|
+
```
|
498
|
+
#####Get a charge's buyer
|
499
|
+
```ruby
|
500
|
+
charge.buyer
|
501
|
+
```
|
502
|
+
#####Get a charge's status
|
503
|
+
```ruby
|
504
|
+
charge.status
|
505
|
+
```
|
506
|
+
|
436
507
|
_Check out the [online documentation](http://promisepay.github.io/promisepay-ruby/) to get a full list of available resources and methods._
|
437
508
|
|
438
509
|
#4. Contributing
|
439
510
|
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
511
|
+
1. Fork it ( https://github.com/PromisePay/promisepay-ruby/fork )
|
512
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
513
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
514
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
515
|
+
5. Create a new Pull Request
|
data/Rakefile
CHANGED
data/lib/promisepay/client.rb
CHANGED
@@ -4,16 +4,19 @@ require_relative 'models/base_model'
|
|
4
4
|
require_relative 'models/account'
|
5
5
|
require_relative 'models/bank_account'
|
6
6
|
require_relative 'models/card_account'
|
7
|
+
require_relative 'models/charge'
|
7
8
|
require_relative 'models/company'
|
8
9
|
require_relative 'models/fee'
|
9
10
|
require_relative 'models/item'
|
10
11
|
require_relative 'models/paypal_account'
|
11
12
|
require_relative 'models/transaction'
|
12
13
|
require_relative 'models/user'
|
14
|
+
require_relative 'models/wallet_account'
|
13
15
|
require_relative 'resources/base_resource'
|
14
16
|
require_relative 'resources/account_resource'
|
15
17
|
require_relative 'resources/bank_account_resource'
|
16
18
|
require_relative 'resources/card_account_resource'
|
19
|
+
require_relative 'resources/charge_resource'
|
17
20
|
require_relative 'resources/company_resource'
|
18
21
|
require_relative 'resources/fee_resource'
|
19
22
|
require_relative 'resources/item_resource'
|
@@ -21,6 +24,7 @@ require_relative 'resources/paypal_account_resource'
|
|
21
24
|
require_relative 'resources/token_resource'
|
22
25
|
require_relative 'resources/transaction_resource'
|
23
26
|
require_relative 'resources/user_resource'
|
27
|
+
require_relative 'resources/wallet_account_resource'
|
24
28
|
require 'json'
|
25
29
|
require 'faraday'
|
26
30
|
|
@@ -55,9 +59,9 @@ module Promisepay
|
|
55
59
|
# @param url [String] The path, relative to {#api_endpoint}
|
56
60
|
# @param parameters [Hash] Query params for request
|
57
61
|
# @return [Faraday::Response]
|
58
|
-
def get(url, parameters = {})
|
62
|
+
def get(url, parameters = {}, skip_status_check = false)
|
59
63
|
response = connection.get("#{api_endpoint}#{url}", parameters)
|
60
|
-
on_complete(response)
|
64
|
+
on_complete(response) unless skip_status_check
|
61
65
|
response
|
62
66
|
end
|
63
67
|
|
@@ -113,13 +117,15 @@ module Promisepay
|
|
113
117
|
{
|
114
118
|
bank_accounts: BankAccountResource,
|
115
119
|
card_accounts: CardAccountResource,
|
120
|
+
charges: ChargeResource,
|
116
121
|
companies: CompanyResource,
|
117
122
|
fees: FeeResource,
|
118
123
|
items: ItemResource,
|
119
124
|
paypal_accounts: PaypalAccountResource,
|
120
125
|
transactions: TransactionResource,
|
121
126
|
users: UserResource,
|
122
|
-
tokens: TokenResource
|
127
|
+
tokens: TokenResource,
|
128
|
+
wallet_accounts: WalletAccountResource
|
123
129
|
}
|
124
130
|
end
|
125
131
|
|
data/lib/promisepay/error.rb
CHANGED
@@ -39,9 +39,7 @@ module Promisepay
|
|
39
39
|
message = ''
|
40
40
|
message << json_response['message'] if json_response.key?('message')
|
41
41
|
if json_response.key?('errors')
|
42
|
-
json_response['errors'].
|
43
|
-
message << "#{attribute}: #{content}"
|
44
|
-
end
|
42
|
+
message << json_response['errors'].map{|attribute, content| "#{attribute}: #{content}"}.join(", ")
|
45
43
|
end
|
46
44
|
|
47
45
|
message
|
@@ -3,7 +3,7 @@ module Promisepay
|
|
3
3
|
class BankAccount < Account
|
4
4
|
# Get the user the bank account belongs to.
|
5
5
|
#
|
6
|
-
# @see
|
6
|
+
# @see https://reference.promisepay.com/#show-bank-account-user
|
7
7
|
#
|
8
8
|
# @return [Promisepay::User]
|
9
9
|
def user
|
@@ -14,7 +14,7 @@ module Promisepay
|
|
14
14
|
# Deletes a bank account for a user on a marketplace.
|
15
15
|
# Sets the account to in-active.
|
16
16
|
#
|
17
|
-
# @see
|
17
|
+
# @see https://reference.promisepay.com/#redact-bank-account
|
18
18
|
#
|
19
19
|
# @param mobile_pin [String] Mobile PIN.
|
20
20
|
#
|
@@ -3,7 +3,7 @@ module Promisepay
|
|
3
3
|
class CardAccount < Account
|
4
4
|
# Get the user the card account belongs to.
|
5
5
|
#
|
6
|
-
# @see
|
6
|
+
# @see https://reference.promisepay.com/#show-card-account-user
|
7
7
|
#
|
8
8
|
# @return [Promisepay::User]
|
9
9
|
def user
|
@@ -14,7 +14,7 @@ module Promisepay
|
|
14
14
|
# Deletes a card account for a user on a marketplace.
|
15
15
|
# Sets the account to in-active.
|
16
16
|
#
|
17
|
-
# @see
|
17
|
+
# @see https://reference.promisepay.com/#redact-card-account
|
18
18
|
#
|
19
19
|
# @return [Boolean]
|
20
20
|
def deactivate
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
module Promisepay
|
3
|
+
# Manage Charges
|
4
|
+
class Charge < BaseModel
|
5
|
+
# Get the buyer associated with the charge.
|
6
|
+
#
|
7
|
+
# @see https://reference.promisepay.com/#show-charge-buyer
|
8
|
+
#
|
9
|
+
# @return [Promisepay::User]
|
10
|
+
def buyer
|
11
|
+
response = JSON.parse(@client.get("charges/#{send(:id)}/buyers").body)
|
12
|
+
Promisepay::User.new(@client, response['users'])
|
13
|
+
end
|
14
|
+
|
15
|
+
# Get current status.
|
16
|
+
#
|
17
|
+
# @see https://reference.promisepay.com/#show-charge-status
|
18
|
+
#
|
19
|
+
# @return [Hash]
|
20
|
+
def status
|
21
|
+
response = JSON.parse(@client.get("charges/#{send(:id)}/status").body)
|
22
|
+
response['charges']
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -1,15 +1,38 @@
|
|
1
1
|
module Promisepay
|
2
2
|
# Manage Companies
|
3
3
|
class Company < BaseModel
|
4
|
+
# Update the attributes of an item.
|
5
|
+
#
|
6
|
+
# @see https://reference.promisepay.com/#update-item
|
7
|
+
#
|
8
|
+
# @param attributes [Hash] Item's attributes to be updated.
|
9
|
+
#
|
10
|
+
# @return [self]
|
11
|
+
def update(attributes)
|
12
|
+
response = JSON.parse(@client.patch("companies/#{send(:id)}", attributes).body)
|
13
|
+
@attributes = response['companies']
|
14
|
+
self
|
15
|
+
end
|
4
16
|
|
5
17
|
# Get the user the company belongs to.
|
6
18
|
#
|
7
|
-
# @see
|
19
|
+
# @see
|
8
20
|
#
|
9
21
|
# @return [Promisepay::User]
|
10
22
|
def user
|
11
23
|
response = JSON.parse(@client.get("companies/#{send(:id)}/users").body)
|
12
24
|
Promisepay::User.new(@client, response['users'])
|
13
25
|
end
|
26
|
+
|
27
|
+
# Gets company address.
|
28
|
+
#
|
29
|
+
# @see https://reference.promisepay.com/#addresses
|
30
|
+
#
|
31
|
+
# @return [Hash]
|
32
|
+
def address
|
33
|
+
return nil unless @attributes.key?('related')
|
34
|
+
response = JSON.parse(@client.get("addresses/#{send(:related)['addresses']}").body)
|
35
|
+
response['addresses']
|
36
|
+
end
|
14
37
|
end
|
15
38
|
end
|
@@ -3,7 +3,7 @@ module Promisepay
|
|
3
3
|
class Item < BaseModel
|
4
4
|
# Update the attributes of an item.
|
5
5
|
#
|
6
|
-
# @see
|
6
|
+
# @see https://reference.promisepay.com/#update-item
|
7
7
|
#
|
8
8
|
# @param attributes [Hash] Item's attributes to be updated.
|
9
9
|
#
|
@@ -16,7 +16,7 @@ module Promisepay
|
|
16
16
|
|
17
17
|
# Show the item status for a marketplace.
|
18
18
|
#
|
19
|
-
# @see
|
19
|
+
# @see https://reference.promisepay.com/#show-item-status
|
20
20
|
#
|
21
21
|
# @return [Hash]
|
22
22
|
def status
|
@@ -26,7 +26,7 @@ module Promisepay
|
|
26
26
|
|
27
27
|
# Show the buyer detail for a single item for a marketplace.
|
28
28
|
#
|
29
|
-
# @see
|
29
|
+
# @see https://reference.promisepay.com/#show-item-buyer
|
30
30
|
#
|
31
31
|
# @return [Promisepay::User]
|
32
32
|
def buyer
|
@@ -36,7 +36,7 @@ module Promisepay
|
|
36
36
|
|
37
37
|
# Show the seller detail for a single item for a marketplace.
|
38
38
|
#
|
39
|
-
# @see
|
39
|
+
# @see https://reference.promisepay.com/#show-item-seller
|
40
40
|
#
|
41
41
|
# @return [Promisepay::User]
|
42
42
|
def seller
|
@@ -46,7 +46,7 @@ module Promisepay
|
|
46
46
|
|
47
47
|
# Get fees associated to the item.
|
48
48
|
#
|
49
|
-
# @see
|
49
|
+
# @see https://reference.promisepay.com/#show-item-fees
|
50
50
|
#
|
51
51
|
# @param options [Hash] Optional options.
|
52
52
|
# @option options [Integer] :limit Can ask for up to 200 fees. default: 10
|
@@ -61,7 +61,7 @@ module Promisepay
|
|
61
61
|
|
62
62
|
# Get historical transaction for the item.
|
63
63
|
#
|
64
|
-
# @see
|
64
|
+
# @see https://reference.promisepay.com/#list-item-transactions
|
65
65
|
#
|
66
66
|
# @param options [Hash] Optional options.
|
67
67
|
# @option options [Integer] :limit Can ask for up to 200 transactions. default: 10
|
@@ -76,7 +76,7 @@ module Promisepay
|
|
76
76
|
|
77
77
|
# Show the wire details for payment.
|
78
78
|
#
|
79
|
-
# @see
|
79
|
+
# @see https://reference.promisepay.com/#show-item-wire-details
|
80
80
|
#
|
81
81
|
# @return [Hash]
|
82
82
|
def wire_details
|
@@ -86,7 +86,7 @@ module Promisepay
|
|
86
86
|
|
87
87
|
# Show the bpay details details for payment.
|
88
88
|
#
|
89
|
-
# @see
|
89
|
+
# @see https://reference.promisepay.com/#show-item-bpay-details
|
90
90
|
#
|
91
91
|
# @return [Hash]
|
92
92
|
def bpay_details
|
@@ -94,53 +94,60 @@ module Promisepay
|
|
94
94
|
response['items']['bpay_details']
|
95
95
|
end
|
96
96
|
|
97
|
-
# .
|
97
|
+
# Make a payment for an Item.
|
98
98
|
#
|
99
|
-
# @see
|
99
|
+
# @see https://reference.promisepay.com/#make-payment
|
100
100
|
#
|
101
101
|
# @return [Boolean]
|
102
102
|
def make_payment(options = {})
|
103
|
-
@client.patch("items/#{send(:id)}/make_payment", options).body
|
103
|
+
response = JSON.parse(@client.patch("items/#{send(:id)}/make_payment", options).body)
|
104
|
+
@attributes = response['items']
|
104
105
|
true
|
105
106
|
end
|
106
107
|
|
107
|
-
# .
|
108
|
+
# Request payment for an Item.
|
108
109
|
#
|
109
|
-
# @see
|
110
|
+
# @see https://reference.promisepay.com/#request-payment
|
110
111
|
#
|
111
112
|
# @return [Boolean]
|
112
113
|
def request_payment(options = {})
|
113
|
-
@client.patch("items/#{send(:id)}/request_payment", options).body
|
114
|
+
response = JSON.parse(@client.patch("items/#{send(:id)}/request_payment", options).body)
|
115
|
+
@attributes = response['items']
|
114
116
|
true
|
115
117
|
end
|
116
118
|
|
117
|
-
#
|
119
|
+
# Release funds held in escrow from an Item with an Escrow or Escrow Partial Release
|
120
|
+
# payment type.
|
118
121
|
#
|
119
|
-
# @see
|
122
|
+
# @see https://reference.promisepay.com/#release-payment
|
120
123
|
#
|
121
124
|
# @return [Boolean]
|
122
125
|
def release_payment(options = {})
|
123
|
-
@client.patch("items/#{send(:id)}/release_payment", options).body
|
126
|
+
response = JSON.parse(@client.patch("items/#{send(:id)}/release_payment", options).body)
|
127
|
+
@attributes = response['items']
|
124
128
|
true
|
125
129
|
end
|
126
130
|
|
127
|
-
#
|
131
|
+
# Request release of funds held in escrow, from an Item with an Escrow or Escrow Partial
|
132
|
+
# Release payment type.
|
128
133
|
#
|
129
|
-
# @see
|
134
|
+
# @see https://reference.promisepay.com/#request-release
|
130
135
|
#
|
131
136
|
# @return [Boolean]
|
132
137
|
def request_release(options = {})
|
133
|
-
@client.patch("items/#{send(:id)}/request_release", options).body
|
138
|
+
response = JSON.parse(@client.patch("items/#{send(:id)}/request_release", options).body)
|
139
|
+
@attributes = response['items']
|
134
140
|
true
|
135
141
|
end
|
136
142
|
|
137
|
-
# .
|
143
|
+
# Acknowledge that funds are being wired for payment.
|
138
144
|
#
|
139
|
-
# @see
|
145
|
+
# @see https://reference.promisepay.com/#acknowledge-wire-transfer
|
140
146
|
#
|
141
147
|
# @return [Boolean]
|
142
148
|
def acknowledge_wire(options = {})
|
143
|
-
@client.patch("items/#{send(:id)}/acknowledge_wire", options).body
|
149
|
+
response = JSON.parse(@client.patch("items/#{send(:id)}/acknowledge_wire", options).body)
|
150
|
+
@attributes = response['items']
|
144
151
|
true
|
145
152
|
end
|
146
153
|
|
@@ -150,47 +157,52 @@ module Promisepay
|
|
150
157
|
#
|
151
158
|
# @return [Boolean]
|
152
159
|
def acknowledge_paypal(options = {})
|
153
|
-
@client.patch("items/#{send(:id)}/acknowledge_paypal", options).body
|
160
|
+
response = JSON.parse(@client.patch("items/#{send(:id)}/acknowledge_paypal", options).body)
|
161
|
+
@attributes = response['items']
|
154
162
|
true
|
155
163
|
end
|
156
164
|
|
157
|
-
# .
|
165
|
+
# Revert an acknowledge wire Item Action.
|
158
166
|
#
|
159
|
-
# @see
|
167
|
+
# @see https://reference.promisepay.com/#revert-wire-transfer
|
160
168
|
#
|
161
169
|
# @return [Boolean]
|
162
170
|
def revert_wire(options = {})
|
163
|
-
@client.patch("items/#{send(:id)}/revert_wire", options).body
|
171
|
+
response = JSON.parse(@client.patch("items/#{send(:id)}/revert_wire", options).body)
|
172
|
+
@attributes = response['items']
|
164
173
|
true
|
165
174
|
end
|
166
175
|
|
167
|
-
# .
|
176
|
+
# Request a refund for an Item.
|
168
177
|
#
|
169
|
-
# @see
|
178
|
+
# @see https://reference.promisepay.com/#request-refund
|
170
179
|
#
|
171
180
|
# @return [Boolean]
|
172
181
|
def request_refund(options = {})
|
173
|
-
@client.patch("items/#{send(:id)}/request_refund", options).body
|
182
|
+
response = JSON.parse(@client.patch("items/#{send(:id)}/request_refund", options).body)
|
183
|
+
@attributes = response['items']
|
174
184
|
true
|
175
185
|
end
|
176
186
|
|
177
|
-
# .
|
187
|
+
# Refund an Item’s funds held in escrow.
|
178
188
|
#
|
179
|
-
# @see
|
189
|
+
# @see https://reference.promisepay.com/#refund
|
180
190
|
#
|
181
191
|
# @return [Boolean]
|
182
192
|
def refund(options = {})
|
183
|
-
@client.patch("items/#{send(:id)}/refund", options).body
|
193
|
+
response = JSON.parse(@client.patch("items/#{send(:id)}/refund", options).body)
|
194
|
+
@attributes = response['items']
|
184
195
|
true
|
185
196
|
end
|
186
197
|
|
187
|
-
# .
|
198
|
+
# Cancel an Item.
|
188
199
|
#
|
189
|
-
# @see
|
200
|
+
# @see https://reference.promisepay.com/#cancel
|
190
201
|
#
|
191
202
|
# @return [Boolean]
|
192
203
|
def cancel
|
193
|
-
@client.patch("items/#{id}/cancel")
|
204
|
+
response = JSON.parse(@client.patch("items/#{id}/cancel").body)
|
205
|
+
@attributes = response['items']
|
194
206
|
true
|
195
207
|
end
|
196
208
|
end
|
@@ -3,7 +3,7 @@ module Promisepay
|
|
3
3
|
class PaypalAccount < Account
|
4
4
|
# Get the user the paypal account belongs to.
|
5
5
|
#
|
6
|
-
# @see
|
6
|
+
# @see https://reference.promisepay.com/#show-paypal-account-user
|
7
7
|
#
|
8
8
|
# @return [Promisepay::User]
|
9
9
|
def user
|
@@ -14,7 +14,7 @@ module Promisepay
|
|
14
14
|
# Deletes a Paypal account for a user on a marketplace.
|
15
15
|
# Sets the account to in-active.
|
16
16
|
#
|
17
|
-
# @see
|
17
|
+
# @see https://reference.promisepay.com/#redact-paypal-account
|
18
18
|
#
|
19
19
|
# @return [Boolean]
|
20
20
|
def deactivate
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Promisepay
|
2
2
|
# Manage Transactions
|
3
3
|
class Transaction < Account
|
4
|
-
# .
|
4
|
+
# Show the User associated with the Transaction.
|
5
5
|
#
|
6
|
-
# @see https://
|
6
|
+
# @see https://reference.promisepay.com/#show-transaction-user
|
7
7
|
#
|
8
8
|
# @return [Promisepay::User]
|
9
9
|
def user
|
@@ -13,7 +13,7 @@ module Promisepay
|
|
13
13
|
|
14
14
|
# Gets a transactions fee details if applicable.
|
15
15
|
#
|
16
|
-
# @see
|
16
|
+
# @see https://reference.promisepay.com/#shows-transaction-fees
|
17
17
|
#
|
18
18
|
# @return [Promisepay::Fee]
|
19
19
|
def fee
|
@@ -2,9 +2,22 @@
|
|
2
2
|
module Promisepay
|
3
3
|
# Manage Users
|
4
4
|
class User < BaseModel
|
5
|
+
# Update the attributes of an item.
|
6
|
+
#
|
7
|
+
# @see https://reference.promisepay.com/#update-item
|
8
|
+
#
|
9
|
+
# @param attributes [Hash] Item's attributes to be updated.
|
10
|
+
#
|
11
|
+
# @return [self]
|
12
|
+
def update(attributes)
|
13
|
+
response = JSON.parse(@client.patch("users/#{send(:id)}", attributes).body)
|
14
|
+
@attributes = response['users']
|
15
|
+
self
|
16
|
+
end
|
17
|
+
|
5
18
|
# Lists items for a user on a marketplace.
|
6
19
|
#
|
7
|
-
# @see
|
20
|
+
# @see https://reference.promisepay.com/#list-user-items
|
8
21
|
#
|
9
22
|
# @return [Array<Promisepay::Item>]
|
10
23
|
def items
|
@@ -15,7 +28,7 @@ module Promisepay
|
|
15
28
|
|
16
29
|
# Gets Bank account for a user on a marketplace.
|
17
30
|
#
|
18
|
-
# @see
|
31
|
+
# @see https://reference.promisepay.com/#show-user-bank-account
|
19
32
|
#
|
20
33
|
# @return [Promisepay::BankAccount]
|
21
34
|
def bank_account
|
@@ -27,7 +40,7 @@ module Promisepay
|
|
27
40
|
|
28
41
|
# Gets Card account for a user on a marketplace.
|
29
42
|
#
|
30
|
-
# @see
|
43
|
+
# @see https://reference.promisepay.com/#show-user-card-account
|
31
44
|
#
|
32
45
|
# @return [Promisepay::CardAccount]
|
33
46
|
def card_account
|
@@ -39,7 +52,7 @@ module Promisepay
|
|
39
52
|
|
40
53
|
# Gets PayPal account for a user on a marketplace.
|
41
54
|
#
|
42
|
-
# @see
|
55
|
+
# @see https://reference.promisepay.com/#show-user-paypal-account
|
43
56
|
#
|
44
57
|
# @return [Promisepay::PaypalAccount]
|
45
58
|
def paypal_account
|
@@ -49,9 +62,21 @@ module Promisepay
|
|
49
62
|
nil
|
50
63
|
end
|
51
64
|
|
65
|
+
# Show the User’s Wallet Account.
|
66
|
+
#
|
67
|
+
# @see https://reference.promisepay.com/#show-user-wallet-account
|
68
|
+
#
|
69
|
+
# @return [Promisepay::WalletAccount]
|
70
|
+
def wallet_account
|
71
|
+
response = JSON.parse(@client.get("users/#{send(:id)}/wallet_accounts").body)
|
72
|
+
Promisepay::WalletAccount.new(@client, response['wallet_accounts'])
|
73
|
+
rescue Promisepay::UnprocessableEntity
|
74
|
+
nil
|
75
|
+
end
|
76
|
+
|
52
77
|
# Set the disbursement account for a user.
|
53
78
|
#
|
54
|
-
# @see
|
79
|
+
# @see https://reference.promisepay.com/#set-user-disbursement-account
|
55
80
|
#
|
56
81
|
# @return [Boolean]
|
57
82
|
def disbursement_account(account_id)
|
@@ -62,7 +87,7 @@ module Promisepay
|
|
62
87
|
|
63
88
|
# Gets company for a user on a marketplace.
|
64
89
|
#
|
65
|
-
# @see
|
90
|
+
# @see
|
66
91
|
#
|
67
92
|
# @return [Promisepay::Company]
|
68
93
|
def company
|
@@ -71,5 +96,16 @@ module Promisepay
|
|
71
96
|
rescue Promisepay::NotFound
|
72
97
|
nil
|
73
98
|
end
|
99
|
+
|
100
|
+
# Gets user address.
|
101
|
+
#
|
102
|
+
# @see https://reference.promisepay.com/#addresses
|
103
|
+
#
|
104
|
+
# @return [Hash]
|
105
|
+
def address
|
106
|
+
return nil unless @attributes.key?('related')
|
107
|
+
response = JSON.parse(@client.get("addresses/#{send(:related)['addresses']}").body)
|
108
|
+
response['addresses']
|
109
|
+
end
|
74
110
|
end
|
75
111
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Promisepay
|
2
|
+
# Manage Wallet Accounts
|
3
|
+
class WalletAccount < BaseModel
|
4
|
+
# Withdraw funds from a Wallet Account to a specified disbursement account.
|
5
|
+
#
|
6
|
+
# @see https://reference.promisepay.com/#withdraw-funds
|
7
|
+
#
|
8
|
+
# @param options [Hash] Optional options.
|
9
|
+
# @option options [String] :account_id Account to withdraw to.
|
10
|
+
# @option options [Integer] :amount Amount (in cents) to withdraw.
|
11
|
+
#
|
12
|
+
# @return [Hash]
|
13
|
+
def withdraw(options = {})
|
14
|
+
response = JSON.parse(@client.post("wallet_accounts/#{send(:id)}/withdraw", options).body)
|
15
|
+
response.key?('disbursements') ? response['disbursements'] : {}
|
16
|
+
end
|
17
|
+
|
18
|
+
# Deposit funds to a Wallet Account from a specified payment account.
|
19
|
+
#
|
20
|
+
# @see https://reference.promisepay.com/#deposit-funds
|
21
|
+
#
|
22
|
+
# @param options [Hash] Optional options.
|
23
|
+
# @option options [String] :account_id Account to deposit from.
|
24
|
+
# @option options [Integer] :amount Amount (in cents) to deposit.
|
25
|
+
#
|
26
|
+
# @return [Hash]
|
27
|
+
def deposit(options = {})
|
28
|
+
response = JSON.parse(@client.post("wallet_accounts/#{send(:id)}/deposit", options).body)
|
29
|
+
response.key?('disbursements') ? response['disbursements'] : {}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Show the User the Wallet Account is associated with
|
33
|
+
#
|
34
|
+
# @return [Promisepay::User]
|
35
|
+
def user
|
36
|
+
response = JSON.parse(@client.get("wallet_accounts/#{send(:id)}/users").body)
|
37
|
+
response.key?('users') ? Promisepay::User.new(@client, response['users']) : nil
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -7,7 +7,7 @@ module Promisepay
|
|
7
7
|
|
8
8
|
# Get bank account for a user on a marketplace.
|
9
9
|
#
|
10
|
-
# @see
|
10
|
+
# @see https://reference.promisepay.com/#show-bank-account
|
11
11
|
#
|
12
12
|
# @param id [String] Bank Account ID.
|
13
13
|
#
|
@@ -19,7 +19,7 @@ module Promisepay
|
|
19
19
|
|
20
20
|
# Create a bank account for a user on a marketplace.
|
21
21
|
#
|
22
|
-
# @see
|
22
|
+
# @see https://reference.promisepay.com/#create-bank-account
|
23
23
|
#
|
24
24
|
# @param attributes [Hash] Bank Account's attributes.
|
25
25
|
#
|
@@ -28,5 +28,19 @@ module Promisepay
|
|
28
28
|
response = JSON.parse(@client.post('bank_accounts', attributes).body)
|
29
29
|
Promisepay::BankAccount.new(@client, response['bank_accounts'])
|
30
30
|
end
|
31
|
+
|
32
|
+
# Validate a US bank routing number before creating an account.
|
33
|
+
# This can be used to provide on-demand verification,
|
34
|
+
# and further information of the bank information a User is providing.
|
35
|
+
#
|
36
|
+
# @see https://reference.promisepay.com/#validate-routing-number
|
37
|
+
#
|
38
|
+
# @param routing_number [String] Bank account Routing Number
|
39
|
+
#
|
40
|
+
# @return [Hash]
|
41
|
+
def validate(routing_number)
|
42
|
+
response = @client.get('tools/routing_number', { routing_number: routing_number }, true)
|
43
|
+
(response.status == 200) ? JSON.parse(response.body)['routing_number'] : {}
|
44
|
+
end
|
31
45
|
end
|
32
46
|
end
|
@@ -7,7 +7,7 @@ module Promisepay
|
|
7
7
|
|
8
8
|
# Get card account for a user on a marketplace.
|
9
9
|
#
|
10
|
-
# @see
|
10
|
+
# @see https://reference.promisepay.com/#show-card-account
|
11
11
|
#
|
12
12
|
# @param id [String] Bank Account ID.
|
13
13
|
#
|
@@ -19,7 +19,7 @@ module Promisepay
|
|
19
19
|
|
20
20
|
# Create a card account for a user on a marketplace.
|
21
21
|
#
|
22
|
-
# @see
|
22
|
+
# @see https://reference.promisepay.com/#create-card-account
|
23
23
|
#
|
24
24
|
# @param attributes [Hash] Bank Account's attributes.
|
25
25
|
#
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Promisepay
|
2
|
+
# Resource for the Charges API
|
3
|
+
class ChargeResource < BaseResource
|
4
|
+
def model
|
5
|
+
Promisepay::Charge
|
6
|
+
end
|
7
|
+
|
8
|
+
# List all charges
|
9
|
+
#
|
10
|
+
# @see https://reference.promisepay.com/#list-charges
|
11
|
+
#
|
12
|
+
# @param options [Hash] Optional options.
|
13
|
+
# @option options [Integer] :limit Can ask for up to 200 charges. default: 10
|
14
|
+
# @option options [Integer] :offset Pagination help. default: 0
|
15
|
+
#
|
16
|
+
# @return [Array<Promisepay::Charge>] List all charges.
|
17
|
+
def find_all(options = {})
|
18
|
+
response = JSON.parse(@client.get('charges', options).body)
|
19
|
+
charges = response.key?('charges') ? response['charges'] : []
|
20
|
+
charges.map { |attributes| Promisepay::Charge.new(@client, attributes) }
|
21
|
+
end
|
22
|
+
|
23
|
+
# Get a single charge
|
24
|
+
#
|
25
|
+
# @see https://reference.promisepay.com/#show-charge
|
26
|
+
#
|
27
|
+
# @param id [String] Charge ID.
|
28
|
+
#
|
29
|
+
# @return [Promisepay::Charge]
|
30
|
+
def find(id)
|
31
|
+
response = JSON.parse(@client.get("charges/#{id}").body)
|
32
|
+
Promisepay::Charge.new(@client, response['charges'])
|
33
|
+
end
|
34
|
+
|
35
|
+
# Create a new charge for a marketplace
|
36
|
+
#
|
37
|
+
# @see https://reference.promisepay.com/#create-charge
|
38
|
+
#
|
39
|
+
# @param attributes [Hash] Charge's attributes.
|
40
|
+
#
|
41
|
+
# @return [Promisepay::Charge]
|
42
|
+
def create(attributes)
|
43
|
+
response = JSON.parse(@client.post('charges', attributes).body)
|
44
|
+
Promisepay::Charge.new(@client, response['charges'])
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -7,7 +7,7 @@ module Promisepay
|
|
7
7
|
|
8
8
|
# List all companies for a marketplace
|
9
9
|
#
|
10
|
-
# @see
|
10
|
+
# @see https://reference.promisepay.com/#list-companies
|
11
11
|
#
|
12
12
|
# @param options [Hash] Optional options.
|
13
13
|
# @option options [Integer] :limit Can ask for up to 200 users. default: 10
|
@@ -22,7 +22,7 @@ module Promisepay
|
|
22
22
|
|
23
23
|
# Get a company
|
24
24
|
#
|
25
|
-
# @see
|
25
|
+
# @see https://reference.promisepay.com/#show-company
|
26
26
|
#
|
27
27
|
# @param id [String] Company id
|
28
28
|
#
|
@@ -34,7 +34,7 @@ module Promisepay
|
|
34
34
|
|
35
35
|
# Create a company for a user
|
36
36
|
#
|
37
|
-
# @see
|
37
|
+
# @see https://reference.promisepay.com/#create-company
|
38
38
|
#
|
39
39
|
# @param attributes [Hash] Company's attributes.
|
40
40
|
#
|
@@ -46,7 +46,7 @@ module Promisepay
|
|
46
46
|
|
47
47
|
# Update a company for a user
|
48
48
|
#
|
49
|
-
# @see
|
49
|
+
# @see https://reference.promisepay.com/#update-company
|
50
50
|
#
|
51
51
|
# @param attributes [Hash] Company's attributes.
|
52
52
|
#
|
@@ -7,7 +7,7 @@ module Promisepay
|
|
7
7
|
|
8
8
|
# List all fees for a marketplace
|
9
9
|
#
|
10
|
-
# @see
|
10
|
+
# @see https://reference.promisepay.com/#list-fees
|
11
11
|
#
|
12
12
|
# @param options [Hash] Optional options.
|
13
13
|
# @option options [Integer] :limit Can ask for up to 200 fees. default: 10
|
@@ -22,7 +22,7 @@ module Promisepay
|
|
22
22
|
|
23
23
|
# Get a single fee for a marketplace
|
24
24
|
#
|
25
|
-
# @see
|
25
|
+
# @see https://reference.promisepay.com/#show-fee
|
26
26
|
#
|
27
27
|
# @param id [String] Marketplace Fee ID.
|
28
28
|
#
|
@@ -34,7 +34,7 @@ module Promisepay
|
|
34
34
|
|
35
35
|
# Create a fee for a marketplace
|
36
36
|
#
|
37
|
-
# @see
|
37
|
+
# @see https://reference.promisepay.com/#create-fee
|
38
38
|
#
|
39
39
|
# @param attributes [Hash] Item's attributes.
|
40
40
|
#
|
@@ -7,7 +7,7 @@ module Promisepay
|
|
7
7
|
|
8
8
|
# List all items for a marketplace
|
9
9
|
#
|
10
|
-
# @see
|
10
|
+
# @see https://reference.promisepay.com/#list-items
|
11
11
|
#
|
12
12
|
# @param options [Hash] Optional options.
|
13
13
|
# @option options [Integer] :limit Can ask for up to 200 items. default: 10
|
@@ -22,7 +22,7 @@ module Promisepay
|
|
22
22
|
|
23
23
|
# Get a single item for a marketplace
|
24
24
|
#
|
25
|
-
# @see
|
25
|
+
# @see https://reference.promisepay.com/#show-item
|
26
26
|
#
|
27
27
|
# @param id [String] Marketplace item ID.
|
28
28
|
#
|
@@ -40,7 +40,7 @@ module Promisepay
|
|
40
40
|
|
41
41
|
# Create an item for a marketplace
|
42
42
|
#
|
43
|
-
# @see
|
43
|
+
# @see https://reference.promisepay.com/#create-item
|
44
44
|
#
|
45
45
|
# @param attributes [Hash] Item's attributes.
|
46
46
|
#
|
@@ -7,7 +7,7 @@ module Promisepay
|
|
7
7
|
|
8
8
|
# Get paypal account for a user on a marketplace.
|
9
9
|
#
|
10
|
-
# @see
|
10
|
+
# @see https://reference.promisepay.com/#show-paypal-account
|
11
11
|
#
|
12
12
|
# @param id [String] Paypal Account ID.
|
13
13
|
#
|
@@ -19,7 +19,7 @@ module Promisepay
|
|
19
19
|
|
20
20
|
# Create a Paypal account for a user on a marketplace.
|
21
21
|
#
|
22
|
-
# @see
|
22
|
+
# @see https://reference.promisepay.com/#create-paypal-account
|
23
23
|
#
|
24
24
|
# @param attributes [Hash] Paypal Account's attributes.
|
25
25
|
#
|
@@ -3,7 +3,7 @@ module Promisepay
|
|
3
3
|
class TokenResource < BaseResource
|
4
4
|
# Create a new token for an item
|
5
5
|
#
|
6
|
-
# @see
|
6
|
+
# @see https://reference.promisepay.com/#generate-card-token
|
7
7
|
#
|
8
8
|
# @param attributes [Hash] Token's attributes.
|
9
9
|
#
|
@@ -7,7 +7,7 @@ module Promisepay
|
|
7
7
|
|
8
8
|
# List all transactions for a marketplace
|
9
9
|
#
|
10
|
-
# @see
|
10
|
+
# @see https://reference.promisepay.com/#list-transactions
|
11
11
|
#
|
12
12
|
# @param options [Hash] Optional options.
|
13
13
|
# @option options [Integer] :limit Can ask for up to 200 transactions. default: 10
|
@@ -22,7 +22,7 @@ module Promisepay
|
|
22
22
|
|
23
23
|
# Get a single transaction for a marketplace
|
24
24
|
#
|
25
|
-
# @see
|
25
|
+
# @see https://reference.promisepay.com/#show-transaction
|
26
26
|
#
|
27
27
|
# @param id [String] transaction ID.
|
28
28
|
#
|
@@ -7,7 +7,7 @@ module Promisepay
|
|
7
7
|
|
8
8
|
# List all users for a marketplace
|
9
9
|
#
|
10
|
-
# @see
|
10
|
+
# @see https://reference.promisepay.com/#list-users
|
11
11
|
#
|
12
12
|
# @param options [Hash] Optional options.
|
13
13
|
# @option options [Integer] :limit Can ask for up to 200 users. default: 10
|
@@ -22,7 +22,7 @@ module Promisepay
|
|
22
22
|
|
23
23
|
# Get a single user
|
24
24
|
#
|
25
|
-
# @see
|
25
|
+
# @see https://reference.promisepay.com/#show-user
|
26
26
|
#
|
27
27
|
# @param id [String] Marketplace user ID.
|
28
28
|
#
|
@@ -34,7 +34,7 @@ module Promisepay
|
|
34
34
|
|
35
35
|
# Create a new user for a marketplace
|
36
36
|
#
|
37
|
-
# @see
|
37
|
+
# @see https://reference.promisepay.com/#create-user
|
38
38
|
#
|
39
39
|
# @param attributes [Hash] User's attributes.
|
40
40
|
#
|
@@ -46,7 +46,7 @@ module Promisepay
|
|
46
46
|
|
47
47
|
# Update a user for a marketplace
|
48
48
|
#
|
49
|
-
# @see
|
49
|
+
# @see https://reference.promisepay.com/#update-user
|
50
50
|
#
|
51
51
|
# @param attributes [Hash] User's attributes.
|
52
52
|
#
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Promisepay
|
2
|
+
# Resource for the Wallet Accounts API
|
3
|
+
class WalletAccountResource < BaseResource
|
4
|
+
def model
|
5
|
+
Promisepay::WalletAccount
|
6
|
+
end
|
7
|
+
|
8
|
+
# Get a single wallet account
|
9
|
+
#
|
10
|
+
# @see https://reference.promisepay.com/#show-wallet-account
|
11
|
+
#
|
12
|
+
# @param id [String] account ID.
|
13
|
+
#
|
14
|
+
# @return [Promisepay::WalletAccount]
|
15
|
+
def find(id)
|
16
|
+
response = JSON.parse(@client.get("wallet_accounts/#{id}").body)
|
17
|
+
Promisepay::WalletAccount.new(@client, response['wallet_accounts'])
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/promisepay/version.rb
CHANGED
data/promisepay.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.required_ruby_version = '>= 1.9.3'
|
22
22
|
|
23
23
|
spec.add_dependency 'faraday'
|
24
|
-
spec.add_dependency 'json'
|
24
|
+
spec.add_dependency 'json', '~> 1.8.3'
|
25
25
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
26
26
|
spec.add_development_dependency 'rake', '~> 10.0'
|
27
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: promisepay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Romain Vigo Benia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.8.3
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 1.8.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -85,16 +85,19 @@ files:
|
|
85
85
|
- lib/promisepay/models/bank_account.rb
|
86
86
|
- lib/promisepay/models/base_model.rb
|
87
87
|
- lib/promisepay/models/card_account.rb
|
88
|
+
- lib/promisepay/models/charge.rb
|
88
89
|
- lib/promisepay/models/company.rb
|
89
90
|
- lib/promisepay/models/fee.rb
|
90
91
|
- lib/promisepay/models/item.rb
|
91
92
|
- lib/promisepay/models/paypal_account.rb
|
92
93
|
- lib/promisepay/models/transaction.rb
|
93
94
|
- lib/promisepay/models/user.rb
|
95
|
+
- lib/promisepay/models/wallet_account.rb
|
94
96
|
- lib/promisepay/resources/account_resource.rb
|
95
97
|
- lib/promisepay/resources/bank_account_resource.rb
|
96
98
|
- lib/promisepay/resources/base_resource.rb
|
97
99
|
- lib/promisepay/resources/card_account_resource.rb
|
100
|
+
- lib/promisepay/resources/charge_resource.rb
|
98
101
|
- lib/promisepay/resources/company_resource.rb
|
99
102
|
- lib/promisepay/resources/fee_resource.rb
|
100
103
|
- lib/promisepay/resources/item_resource.rb
|
@@ -102,6 +105,7 @@ files:
|
|
102
105
|
- lib/promisepay/resources/token_resource.rb
|
103
106
|
- lib/promisepay/resources/transaction_resource.rb
|
104
107
|
- lib/promisepay/resources/user_resource.rb
|
108
|
+
- lib/promisepay/resources/wallet_account_resource.rb
|
105
109
|
- lib/promisepay/version.rb
|
106
110
|
- promisepay.gemspec
|
107
111
|
homepage: https://github.com/PromisePay/promisepay-ruby
|
@@ -124,9 +128,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
128
|
version: '0'
|
125
129
|
requirements: []
|
126
130
|
rubyforge_project:
|
127
|
-
rubygems_version: 2.
|
131
|
+
rubygems_version: 2.5.1
|
128
132
|
signing_key:
|
129
133
|
specification_version: 4
|
130
134
|
summary: Gem to wrap promisepay.com API.
|
131
135
|
test_files: []
|
132
|
-
has_rdoc:
|