promisepay 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +22 -22
- data/README.md +163 -163
- data/Rakefile +1 -1
- data/lib/promisepay.rb +13 -13
- data/lib/promisepay/client.rb +147 -144
- data/lib/promisepay/configurable.rb +49 -49
- data/lib/promisepay/default.rb +47 -47
- data/lib/promisepay/error.rb +92 -92
- data/lib/promisepay/models/account.rb +5 -5
- data/lib/promisepay/models/bank_account.rb +28 -28
- data/lib/promisepay/models/base_model.rb +23 -23
- data/lib/promisepay/models/card_account.rb +26 -26
- data/lib/promisepay/models/fee.rb +5 -5
- data/lib/promisepay/models/item.rb +197 -197
- data/lib/promisepay/models/paypal_account.rb +26 -26
- data/lib/promisepay/models/token.rb +7 -0
- data/lib/promisepay/models/transaction.rb +24 -24
- data/lib/promisepay/models/user.rb +63 -63
- data/lib/promisepay/resources/account_resource.rb +5 -5
- data/lib/promisepay/resources/bank_account_resource.rb +32 -32
- data/lib/promisepay/resources/base_resource.rb +20 -20
- data/lib/promisepay/resources/card_account_resource.rb +32 -32
- data/lib/promisepay/resources/fee_resource.rb +47 -47
- data/lib/promisepay/resources/item_resource.rb +53 -47
- data/lib/promisepay/resources/paypal_account_resource.rb +32 -32
- data/lib/promisepay/resources/token_resource.rb +28 -0
- data/lib/promisepay/resources/transaction_resource.rb +35 -35
- data/lib/promisepay/resources/user_resource.rb +59 -47
- data/lib/promisepay/version.rb +4 -4
- data/promisepay.gemspec +27 -27
- metadata +15 -13
@@ -1,26 +1,26 @@
|
|
1
|
-
module Promisepay
|
2
|
-
# Manage Paypal accounts
|
3
|
-
class PaypalAccount < Account
|
4
|
-
# Get the user the paypal account belongs to.
|
5
|
-
#
|
6
|
-
# @see http://docs.promisepay.com/v2.2/docs/paypal_accountsidusers
|
7
|
-
#
|
8
|
-
# @return [Promisepay::User]
|
9
|
-
def user
|
10
|
-
response = JSON.parse(@client.get("paypal_accounts/#{send(:id)}/users").body)
|
11
|
-
Promisepay::User.new(@client, response['users'])
|
12
|
-
end
|
13
|
-
|
14
|
-
# Deletes a Paypal account for a user on a marketplace.
|
15
|
-
# Sets the account to in-active.
|
16
|
-
#
|
17
|
-
# @see http://docs.promisepay.com/v2.2/docs/paypal_accountsid
|
18
|
-
#
|
19
|
-
# @return [Boolean]
|
20
|
-
def deactivate
|
21
|
-
@client.delete("paypal_accounts/#{id}")
|
22
|
-
@attributes['active'] = false
|
23
|
-
true
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
1
|
+
module Promisepay
|
2
|
+
# Manage Paypal accounts
|
3
|
+
class PaypalAccount < Account
|
4
|
+
# Get the user the paypal account belongs to.
|
5
|
+
#
|
6
|
+
# @see http://docs.promisepay.com/v2.2/docs/paypal_accountsidusers
|
7
|
+
#
|
8
|
+
# @return [Promisepay::User]
|
9
|
+
def user
|
10
|
+
response = JSON.parse(@client.get("paypal_accounts/#{send(:id)}/users").body)
|
11
|
+
Promisepay::User.new(@client, response['users'])
|
12
|
+
end
|
13
|
+
|
14
|
+
# Deletes a Paypal account for a user on a marketplace.
|
15
|
+
# Sets the account to in-active.
|
16
|
+
#
|
17
|
+
# @see http://docs.promisepay.com/v2.2/docs/paypal_accountsid
|
18
|
+
#
|
19
|
+
# @return [Boolean]
|
20
|
+
def deactivate
|
21
|
+
@client.delete("paypal_accounts/#{id}")
|
22
|
+
@attributes['active'] = false
|
23
|
+
true
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -1,24 +1,24 @@
|
|
1
|
-
module Promisepay
|
2
|
-
# Manage Transactions
|
3
|
-
class Transaction < Account
|
4
|
-
# .
|
5
|
-
#
|
6
|
-
# @see https://test.api.promisepay.com/transactions/:id/users
|
7
|
-
#
|
8
|
-
# @return [Promisepay::User]
|
9
|
-
def user
|
10
|
-
response = JSON.parse(@client.get("transactions/#{send(:id)}/users").body)
|
11
|
-
response.key?('users') ? Promisepay::User.new(@client, response['users']) : nil
|
12
|
-
end
|
13
|
-
|
14
|
-
# Gets a transactions fee details if applicable.
|
15
|
-
#
|
16
|
-
# @see http://docs.promisepay.com/v2.2/docs/transactionsidfees
|
17
|
-
#
|
18
|
-
# @return [Promisepay::Fee]
|
19
|
-
def fee
|
20
|
-
response = JSON.parse(@client.get("transactions/#{send(:id)}/fees").body)
|
21
|
-
response.key?('fees') ? Promisepay::Fee.new(@client, response['fees']) : nil
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
1
|
+
module Promisepay
|
2
|
+
# Manage Transactions
|
3
|
+
class Transaction < Account
|
4
|
+
# .
|
5
|
+
#
|
6
|
+
# @see https://test.api.promisepay.com/transactions/:id/users
|
7
|
+
#
|
8
|
+
# @return [Promisepay::User]
|
9
|
+
def user
|
10
|
+
response = JSON.parse(@client.get("transactions/#{send(:id)}/users").body)
|
11
|
+
response.key?('users') ? Promisepay::User.new(@client, response['users']) : nil
|
12
|
+
end
|
13
|
+
|
14
|
+
# Gets a transactions fee details if applicable.
|
15
|
+
#
|
16
|
+
# @see http://docs.promisepay.com/v2.2/docs/transactionsidfees
|
17
|
+
#
|
18
|
+
# @return [Promisepay::Fee]
|
19
|
+
def fee
|
20
|
+
response = JSON.parse(@client.get("transactions/#{send(:id)}/fees").body)
|
21
|
+
response.key?('fees') ? Promisepay::Fee.new(@client, response['fees']) : nil
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -1,63 +1,63 @@
|
|
1
|
-
|
2
|
-
module Promisepay
|
3
|
-
# Manage Users
|
4
|
-
class User < BaseModel
|
5
|
-
# Lists items for a user on a marketplace.
|
6
|
-
#
|
7
|
-
# @see http://docs.promisepay.com/v2.2/docs/usersiditems
|
8
|
-
#
|
9
|
-
# @return [Array<Promisepay::Item>]
|
10
|
-
def items
|
11
|
-
response = JSON.parse(@client.get("users/#{send(:id)}/items").body)
|
12
|
-
users = response.key?('items') ? response['items'] : []
|
13
|
-
users.map { |attributes| Promisepay::Item.new(@client, attributes) }
|
14
|
-
end
|
15
|
-
|
16
|
-
# Gets Bank account for a user on a marketplace.
|
17
|
-
#
|
18
|
-
# @see http://docs.promisepay.com/v2.2/docs/usersidbank_accounts
|
19
|
-
#
|
20
|
-
# @return [Promisepay::BankAccount]
|
21
|
-
def bank_account
|
22
|
-
response = JSON.parse(@client.get("users/#{send(:id)}/bank_accounts").body)
|
23
|
-
Promisepay::BankAccount.new(@client, response['bank_accounts'])
|
24
|
-
rescue Promisepay::UnprocessableEntity
|
25
|
-
nil
|
26
|
-
end
|
27
|
-
|
28
|
-
# Gets Card account for a user on a marketplace.
|
29
|
-
#
|
30
|
-
# @see http://docs.promisepay.com/v2.2/docs/usersidcard_accounts
|
31
|
-
#
|
32
|
-
# @return [Promisepay::CardAccount]
|
33
|
-
def card_account
|
34
|
-
response = JSON.parse(@client.get("users/#{send(:id)}/card_accounts").body)
|
35
|
-
Promisepay::CardAccount.new(@client, response['card_accounts'])
|
36
|
-
rescue Promisepay::UnprocessableEntity
|
37
|
-
nil
|
38
|
-
end
|
39
|
-
|
40
|
-
# Gets PayPal account for a user on a marketplace.
|
41
|
-
#
|
42
|
-
# @see http://docs.promisepay.com/v2.2/docs/usersidpaypal_accounts
|
43
|
-
#
|
44
|
-
# @return [Promisepay::PaypalAccount]
|
45
|
-
def paypal_account
|
46
|
-
response = JSON.parse(@client.get("users/#{send(:id)}/paypal_accounts").body)
|
47
|
-
Promisepay::PaypalAccount.new(@client, response['paypal_accounts'])
|
48
|
-
rescue Promisepay::UnprocessableEntity
|
49
|
-
nil
|
50
|
-
end
|
51
|
-
|
52
|
-
# Set the disbursement account for a user.
|
53
|
-
#
|
54
|
-
# @see http://docs.promisepay.com/v2.2/docs/usersiddisbursement_account
|
55
|
-
#
|
56
|
-
# @return [Boolean]
|
57
|
-
def disbursement_account(account_id)
|
58
|
-
options = { account_id: account_id }
|
59
|
-
JSON.parse(@client.post("users/#{send(:id)}/disbursement_account", options).body)
|
60
|
-
true
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
1
|
+
|
2
|
+
module Promisepay
|
3
|
+
# Manage Users
|
4
|
+
class User < BaseModel
|
5
|
+
# Lists items for a user on a marketplace.
|
6
|
+
#
|
7
|
+
# @see http://docs.promisepay.com/v2.2/docs/usersiditems
|
8
|
+
#
|
9
|
+
# @return [Array<Promisepay::Item>]
|
10
|
+
def items
|
11
|
+
response = JSON.parse(@client.get("users/#{send(:id)}/items").body)
|
12
|
+
users = response.key?('items') ? response['items'] : []
|
13
|
+
users.map { |attributes| Promisepay::Item.new(@client, attributes) }
|
14
|
+
end
|
15
|
+
|
16
|
+
# Gets Bank account for a user on a marketplace.
|
17
|
+
#
|
18
|
+
# @see http://docs.promisepay.com/v2.2/docs/usersidbank_accounts
|
19
|
+
#
|
20
|
+
# @return [Promisepay::BankAccount]
|
21
|
+
def bank_account
|
22
|
+
response = JSON.parse(@client.get("users/#{send(:id)}/bank_accounts").body)
|
23
|
+
Promisepay::BankAccount.new(@client, response['bank_accounts'])
|
24
|
+
rescue Promisepay::UnprocessableEntity
|
25
|
+
nil
|
26
|
+
end
|
27
|
+
|
28
|
+
# Gets Card account for a user on a marketplace.
|
29
|
+
#
|
30
|
+
# @see http://docs.promisepay.com/v2.2/docs/usersidcard_accounts
|
31
|
+
#
|
32
|
+
# @return [Promisepay::CardAccount]
|
33
|
+
def card_account
|
34
|
+
response = JSON.parse(@client.get("users/#{send(:id)}/card_accounts").body)
|
35
|
+
Promisepay::CardAccount.new(@client, response['card_accounts'])
|
36
|
+
rescue Promisepay::UnprocessableEntity
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
|
40
|
+
# Gets PayPal account for a user on a marketplace.
|
41
|
+
#
|
42
|
+
# @see http://docs.promisepay.com/v2.2/docs/usersidpaypal_accounts
|
43
|
+
#
|
44
|
+
# @return [Promisepay::PaypalAccount]
|
45
|
+
def paypal_account
|
46
|
+
response = JSON.parse(@client.get("users/#{send(:id)}/paypal_accounts").body)
|
47
|
+
Promisepay::PaypalAccount.new(@client, response['paypal_accounts'])
|
48
|
+
rescue Promisepay::UnprocessableEntity
|
49
|
+
nil
|
50
|
+
end
|
51
|
+
|
52
|
+
# Set the disbursement account for a user.
|
53
|
+
#
|
54
|
+
# @see http://docs.promisepay.com/v2.2/docs/usersiddisbursement_account
|
55
|
+
#
|
56
|
+
# @return [Boolean]
|
57
|
+
def disbursement_account(account_id)
|
58
|
+
options = { account_id: account_id }
|
59
|
+
JSON.parse(@client.post("users/#{send(:id)}/disbursement_account", options).body)
|
60
|
+
true
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
module Promisepay
|
2
|
-
# Resource for the Accounts API
|
3
|
-
class AccountResource < BaseResource
|
4
|
-
end
|
5
|
-
end
|
1
|
+
module Promisepay
|
2
|
+
# Resource for the Accounts API
|
3
|
+
class AccountResource < BaseResource
|
4
|
+
end
|
5
|
+
end
|
@@ -1,32 +1,32 @@
|
|
1
|
-
module Promisepay
|
2
|
-
# Resource for the BankAccounts API
|
3
|
-
class BankAccountResource < AccountResource
|
4
|
-
def model
|
5
|
-
Promisepay::BankAccount
|
6
|
-
end
|
7
|
-
|
8
|
-
# Get bank account for a user on a marketplace.
|
9
|
-
#
|
10
|
-
# @see http://docs.promisepay.com/v2.2/docs/bank_accountsid-1
|
11
|
-
#
|
12
|
-
# @param id [String] Bank Account ID.
|
13
|
-
#
|
14
|
-
# @return [Promisepay::BankAccount]
|
15
|
-
def find(id)
|
16
|
-
response = JSON.parse(@client.get("bank_accounts/#{id}").body)
|
17
|
-
Promisepay::BankAccount.new(@client, response['bank_accounts'])
|
18
|
-
end
|
19
|
-
|
20
|
-
# Create a bank account for a user on a marketplace.
|
21
|
-
#
|
22
|
-
# @see http://docs.promisepay.com/v2.2/docs/bank_accountsid-2
|
23
|
-
#
|
24
|
-
# @param attributes [Hash] Bank Account's attributes.
|
25
|
-
#
|
26
|
-
# @return [Promisepay::BankAccount]
|
27
|
-
def create(attributes)
|
28
|
-
response = JSON.parse(@client.post('bank_accounts', attributes).body)
|
29
|
-
Promisepay::BankAccount.new(@client, response['bank_accounts'])
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
1
|
+
module Promisepay
|
2
|
+
# Resource for the BankAccounts API
|
3
|
+
class BankAccountResource < AccountResource
|
4
|
+
def model
|
5
|
+
Promisepay::BankAccount
|
6
|
+
end
|
7
|
+
|
8
|
+
# Get bank account for a user on a marketplace.
|
9
|
+
#
|
10
|
+
# @see http://docs.promisepay.com/v2.2/docs/bank_accountsid-1
|
11
|
+
#
|
12
|
+
# @param id [String] Bank Account ID.
|
13
|
+
#
|
14
|
+
# @return [Promisepay::BankAccount]
|
15
|
+
def find(id)
|
16
|
+
response = JSON.parse(@client.get("bank_accounts/#{id}").body)
|
17
|
+
Promisepay::BankAccount.new(@client, response['bank_accounts'])
|
18
|
+
end
|
19
|
+
|
20
|
+
# Create a bank account for a user on a marketplace.
|
21
|
+
#
|
22
|
+
# @see http://docs.promisepay.com/v2.2/docs/bank_accountsid-2
|
23
|
+
#
|
24
|
+
# @param attributes [Hash] Bank Account's attributes.
|
25
|
+
#
|
26
|
+
# @return [Promisepay::BankAccount]
|
27
|
+
def create(attributes)
|
28
|
+
response = JSON.parse(@client.post('bank_accounts', attributes).body)
|
29
|
+
Promisepay::BankAccount.new(@client, response['bank_accounts'])
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -1,20 +1,20 @@
|
|
1
|
-
module Promisepay
|
2
|
-
# Base resource for all the other resources to inherit from
|
3
|
-
class BaseResource
|
4
|
-
def initialize(client)
|
5
|
-
@client = client
|
6
|
-
end
|
7
|
-
|
8
|
-
def method_missing(name, *args, &block)
|
9
|
-
if instance_methods.include?(model) && respond_to?(name)
|
10
|
-
model.new(@client, id: args[0]).send(name, *args[1..-1])
|
11
|
-
else
|
12
|
-
super
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def respond_to?(name, include_all = false)
|
17
|
-
super || model.new(@client).respond_to?(name, include_all)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
1
|
+
module Promisepay
|
2
|
+
# Base resource for all the other resources to inherit from
|
3
|
+
class BaseResource
|
4
|
+
def initialize(client)
|
5
|
+
@client = client
|
6
|
+
end
|
7
|
+
|
8
|
+
def method_missing(name, *args, &block)
|
9
|
+
if instance_methods.include?(model) && respond_to?(name)
|
10
|
+
model.new(@client, id: args[0]).send(name, *args[1..-1])
|
11
|
+
else
|
12
|
+
super
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def respond_to?(name, include_all = false)
|
17
|
+
super || model.new(@client).respond_to?(name, include_all)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -1,32 +1,32 @@
|
|
1
|
-
module Promisepay
|
2
|
-
# Resource for the CardAccounts API
|
3
|
-
class CardAccountResource < AccountResource
|
4
|
-
def model
|
5
|
-
Promisepay::CardAccount
|
6
|
-
end
|
7
|
-
|
8
|
-
# Get card account for a user on a marketplace.
|
9
|
-
#
|
10
|
-
# @see http://docs.promisepay.com/v2.2/docs/card_accountsid-1
|
11
|
-
#
|
12
|
-
# @param id [String] Bank Account ID.
|
13
|
-
#
|
14
|
-
# @return [Promisepay::CardAccount]
|
15
|
-
def find(id)
|
16
|
-
response = JSON.parse(@client.get("card_accounts/#{id}").body)
|
17
|
-
Promisepay::CardAccount.new(@client, response['card_accounts'])
|
18
|
-
end
|
19
|
-
|
20
|
-
# Create a card account for a user on a marketplace.
|
21
|
-
#
|
22
|
-
# @see http://docs.promisepay.com/v2.2/docs/card_accountsid-2
|
23
|
-
#
|
24
|
-
# @param attributes [Hash] Bank Account's attributes.
|
25
|
-
#
|
26
|
-
# @return [Promisepay::CardAccount]
|
27
|
-
def create(attributes)
|
28
|
-
response = JSON.parse(@client.post('card_accounts', attributes).body)
|
29
|
-
Promisepay::CardAccount.new(@client, response['card_accounts'])
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
1
|
+
module Promisepay
|
2
|
+
# Resource for the CardAccounts API
|
3
|
+
class CardAccountResource < AccountResource
|
4
|
+
def model
|
5
|
+
Promisepay::CardAccount
|
6
|
+
end
|
7
|
+
|
8
|
+
# Get card account for a user on a marketplace.
|
9
|
+
#
|
10
|
+
# @see http://docs.promisepay.com/v2.2/docs/card_accountsid-1
|
11
|
+
#
|
12
|
+
# @param id [String] Bank Account ID.
|
13
|
+
#
|
14
|
+
# @return [Promisepay::CardAccount]
|
15
|
+
def find(id)
|
16
|
+
response = JSON.parse(@client.get("card_accounts/#{id}").body)
|
17
|
+
Promisepay::CardAccount.new(@client, response['card_accounts'])
|
18
|
+
end
|
19
|
+
|
20
|
+
# Create a card account for a user on a marketplace.
|
21
|
+
#
|
22
|
+
# @see http://docs.promisepay.com/v2.2/docs/card_accountsid-2
|
23
|
+
#
|
24
|
+
# @param attributes [Hash] Bank Account's attributes.
|
25
|
+
#
|
26
|
+
# @return [Promisepay::CardAccount]
|
27
|
+
def create(attributes)
|
28
|
+
response = JSON.parse(@client.post('card_accounts', attributes).body)
|
29
|
+
Promisepay::CardAccount.new(@client, response['card_accounts'])
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -1,47 +1,47 @@
|
|
1
|
-
module Promisepay
|
2
|
-
# Resource for the Fees API
|
3
|
-
class FeeResource < BaseResource
|
4
|
-
def model
|
5
|
-
Promisepay::Fee
|
6
|
-
end
|
7
|
-
|
8
|
-
# List all fees for a marketplace
|
9
|
-
#
|
10
|
-
# @see http://docs.promisepay.com/v2.2/docs/fees-1
|
11
|
-
#
|
12
|
-
# @param options [Hash] Optional options.
|
13
|
-
# @option options [Integer] :limit Can ask for up to 200 fees. default: 10
|
14
|
-
# @option options [Integer] :offset Pagination help. default: 0
|
15
|
-
#
|
16
|
-
# @return [Array<Promisepay::Fee>] List all fees for a marketplace.
|
17
|
-
def find_all(options = {})
|
18
|
-
response = JSON.parse(@client.get('fees', options).body)
|
19
|
-
fees = response.key?('fees') ? response['fees'] : []
|
20
|
-
fees.map { |attributes| Promisepay::Fee.new(@client, attributes) }
|
21
|
-
end
|
22
|
-
|
23
|
-
# Get a single fee for a marketplace
|
24
|
-
#
|
25
|
-
# @see http://docs.promisepay.com/v2.2/docs/feesid
|
26
|
-
#
|
27
|
-
# @param id [String] Marketplace Fee ID.
|
28
|
-
#
|
29
|
-
# @return [Promisepay::Fee]
|
30
|
-
def find(id)
|
31
|
-
response = JSON.parse(@client.get("fees/#{id}").body)
|
32
|
-
Promisepay::Fee.new(@client, response['fees'])
|
33
|
-
end
|
34
|
-
|
35
|
-
# Create a fee for a marketplace
|
36
|
-
#
|
37
|
-
# @see http://docs.promisepay.com/v2.2/docs/fee_lists
|
38
|
-
#
|
39
|
-
# @param attributes [Hash] Item's attributes.
|
40
|
-
#
|
41
|
-
# @return [Promisepay::Item]
|
42
|
-
def create(attributes)
|
43
|
-
response = JSON.parse(@client.post('fees', attributes).body)
|
44
|
-
Promisepay::Fee.new(@client, response['fees'])
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
1
|
+
module Promisepay
|
2
|
+
# Resource for the Fees API
|
3
|
+
class FeeResource < BaseResource
|
4
|
+
def model
|
5
|
+
Promisepay::Fee
|
6
|
+
end
|
7
|
+
|
8
|
+
# List all fees for a marketplace
|
9
|
+
#
|
10
|
+
# @see http://docs.promisepay.com/v2.2/docs/fees-1
|
11
|
+
#
|
12
|
+
# @param options [Hash] Optional options.
|
13
|
+
# @option options [Integer] :limit Can ask for up to 200 fees. default: 10
|
14
|
+
# @option options [Integer] :offset Pagination help. default: 0
|
15
|
+
#
|
16
|
+
# @return [Array<Promisepay::Fee>] List all fees for a marketplace.
|
17
|
+
def find_all(options = {})
|
18
|
+
response = JSON.parse(@client.get('fees', options).body)
|
19
|
+
fees = response.key?('fees') ? response['fees'] : []
|
20
|
+
fees.map { |attributes| Promisepay::Fee.new(@client, attributes) }
|
21
|
+
end
|
22
|
+
|
23
|
+
# Get a single fee for a marketplace
|
24
|
+
#
|
25
|
+
# @see http://docs.promisepay.com/v2.2/docs/feesid
|
26
|
+
#
|
27
|
+
# @param id [String] Marketplace Fee ID.
|
28
|
+
#
|
29
|
+
# @return [Promisepay::Fee]
|
30
|
+
def find(id)
|
31
|
+
response = JSON.parse(@client.get("fees/#{id}").body)
|
32
|
+
Promisepay::Fee.new(@client, response['fees'])
|
33
|
+
end
|
34
|
+
|
35
|
+
# Create a fee for a marketplace
|
36
|
+
#
|
37
|
+
# @see http://docs.promisepay.com/v2.2/docs/fee_lists
|
38
|
+
#
|
39
|
+
# @param attributes [Hash] Item's attributes.
|
40
|
+
#
|
41
|
+
# @return [Promisepay::Item]
|
42
|
+
def create(attributes)
|
43
|
+
response = JSON.parse(@client.post('fees', attributes).body)
|
44
|
+
Promisepay::Fee.new(@client, response['fees'])
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|