promisepay 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +23 -0
- data/lib/promisepay/client.rb +3 -0
- data/lib/promisepay/models/direct_debit_authority.rb +14 -0
- data/lib/promisepay/resources/company_resource.rb +1 -1
- data/lib/promisepay/resources/direct_debit_authority_resource.rb +48 -0
- data/lib/promisepay/resources/user_resource.rb +1 -1
- data/lib/promisepay/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 720f65f4244539bf6ba85c933da844e316175e79
|
4
|
+
data.tar.gz: 51b022522725cc0d87a93de9a39ec92d59e1bef9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c986f0beea300497a1d8ae57b1d662739e822189efd3d1e7de7ed2dd19a76a9c19445f1f7c86fc579420b5d99ce53a874b8cf6fcff3b6986f3ec45ee2cea783f
|
7
|
+
data.tar.gz: 0e76772a62fa67e0ff7e6ba8794dfe29c530f3d7b4efb37f80e164f8f722476259182e44b3dcb1e4c70295a76e5eee69774285f0f740d4208d152f9ac29b96ce
|
data/README.md
CHANGED
@@ -504,6 +504,29 @@ charge.buyer
|
|
504
504
|
charge.status
|
505
505
|
```
|
506
506
|
|
507
|
+
##Direct Debit Authority
|
508
|
+
#####Get a list of direct debit authorities for a given account
|
509
|
+
```ruby
|
510
|
+
bank_account = client.bank_accounts.find('9fda18e7-b1d3-4a83-830d-0cef0f62cd25')
|
511
|
+
ddas = client.charges.find_all(bank_account.id)
|
512
|
+
```
|
513
|
+
#####Get a direct debit authority
|
514
|
+
```ruby
|
515
|
+
dda = client.direct_debit_authorities.find('8f233e04-ffaa-4c9d-adf9-244853848e21')
|
516
|
+
```
|
517
|
+
#####Create a direct debit authority
|
518
|
+
```ruby
|
519
|
+
charge = client.direct_debit_authorities.create(
|
520
|
+
account_id: '9fda18e7-b1d3-4a83-830d-0cef0f62cd25',
|
521
|
+
amount: '10000'
|
522
|
+
)
|
523
|
+
```
|
524
|
+
#####Delete a direct debit authority
|
525
|
+
```ruby
|
526
|
+
dda = client.direct_debit_authorities.find('8f233e04-ffaa-4c9d-adf9-244853848e21')
|
527
|
+
dda.delete
|
528
|
+
```
|
529
|
+
|
507
530
|
_Check out the [online documentation](http://promisepay.github.io/promisepay-ruby/) to get a full list of available resources and methods._
|
508
531
|
|
509
532
|
#4. Contributing
|
data/lib/promisepay/client.rb
CHANGED
@@ -6,6 +6,7 @@ require_relative 'models/bank_account'
|
|
6
6
|
require_relative 'models/card_account'
|
7
7
|
require_relative 'models/charge'
|
8
8
|
require_relative 'models/company'
|
9
|
+
require_relative 'models/direct_debit_authority'
|
9
10
|
require_relative 'models/fee'
|
10
11
|
require_relative 'models/item'
|
11
12
|
require_relative 'models/paypal_account'
|
@@ -19,6 +20,7 @@ require_relative 'resources/card_account_resource'
|
|
19
20
|
require_relative 'resources/charge_resource'
|
20
21
|
require_relative 'resources/company_resource'
|
21
22
|
require_relative 'resources/fee_resource'
|
23
|
+
require_relative 'resources/direct_debit_authority_resource'
|
22
24
|
require_relative 'resources/item_resource'
|
23
25
|
require_relative 'resources/paypal_account_resource'
|
24
26
|
require_relative 'resources/token_resource'
|
@@ -119,6 +121,7 @@ module Promisepay
|
|
119
121
|
card_accounts: CardAccountResource,
|
120
122
|
charges: ChargeResource,
|
121
123
|
companies: CompanyResource,
|
124
|
+
direct_debit_authorities: DirectDebitAuthorityResource,
|
122
125
|
fees: FeeResource,
|
123
126
|
items: ItemResource,
|
124
127
|
paypal_accounts: PaypalAccountResource,
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Promisepay
|
2
|
+
# Manage Direct Debit Authorities
|
3
|
+
class DirectDebitAuthority < BaseModel
|
4
|
+
# Delete a specific Direct Debit Authority
|
5
|
+
#
|
6
|
+
# @see https://reference.promisepay.com/#delete-direct-debit-authority
|
7
|
+
#
|
8
|
+
# @return [Boolean]
|
9
|
+
def delete
|
10
|
+
@client.delete("direct_debit_authorities/#{id}")
|
11
|
+
true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -52,7 +52,7 @@ module Promisepay
|
|
52
52
|
#
|
53
53
|
# @return [Promisepay::Company]
|
54
54
|
def update(attributes)
|
55
|
-
response = JSON.parse(@client.patch(
|
55
|
+
response = JSON.parse(@client.patch("companies/#{attributes[:id]}", attributes).body)
|
56
56
|
Promisepay::Company.new(@client, response['companies'])
|
57
57
|
end
|
58
58
|
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Promisepay
|
2
|
+
# Resource for the Direct Debit Authorities API
|
3
|
+
class DirectDebitAuthorityResource < BaseResource
|
4
|
+
def model
|
5
|
+
Promisepay::DirectDebitAuthority
|
6
|
+
end
|
7
|
+
|
8
|
+
# List existing direct debit authorities for a given bank account
|
9
|
+
#
|
10
|
+
# @see https://reference.promisepay.com/#list-direct-debit-authorities
|
11
|
+
#
|
12
|
+
# @param account_id [String] account id to retrieve direct debit authorities from.
|
13
|
+
# @param options [Hash] Optional options.
|
14
|
+
# @option options [Integer] :limit Can ask for up to 200 users. default: 10
|
15
|
+
# @option options [Integer] :offset Pagination help. default: 0
|
16
|
+
#
|
17
|
+
# @return [Array<Promisepay::DirectDebitAuthority>] List of direct debit authorities.
|
18
|
+
def find_all(account_id, options = {})
|
19
|
+
response = JSON.parse(@client.get('direct_debit_authorities', { account_id: account_id }.merge(options)).body)
|
20
|
+
direct_debit_authorities = response.key?('direct_debit_authorities') ? response['direct_debit_authorities'] : []
|
21
|
+
direct_debit_authorities.map { |attributes| Promisepay::DirectDebitAuthority.new(@client, attributes) }
|
22
|
+
end
|
23
|
+
|
24
|
+
# Show details of a specific Direct Debit Authority
|
25
|
+
#
|
26
|
+
# @see https://reference.promisepay.com/#show-direct-debit-authority
|
27
|
+
#
|
28
|
+
# @param id [String] direct debit authority ID.
|
29
|
+
#
|
30
|
+
# @return [Promisepay::DirectDebitAuthority]
|
31
|
+
def find(id)
|
32
|
+
response = JSON.parse(@client.get("direct_debit_authorities/#{id}").body)
|
33
|
+
Promisepay::DirectDebitAuthority.new(@client, response['direct_debit_authorities'])
|
34
|
+
end
|
35
|
+
|
36
|
+
# Create a Direct Debit Authority associated with a Bank Account.
|
37
|
+
#
|
38
|
+
# @see https://reference.promisepay.com/#create-direct-debit-authority
|
39
|
+
#
|
40
|
+
# @param attributes [Hash] Direct Debit Authority's attributes.
|
41
|
+
#
|
42
|
+
# @return [Promisepay::DirectDebitAuthority]
|
43
|
+
def create(attributes)
|
44
|
+
response = JSON.parse(@client.post('direct_debit_authorities', attributes).body)
|
45
|
+
Promisepay::DirectDebitAuthority.new(@client, response['direct_debit_authorities'])
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -52,7 +52,7 @@ module Promisepay
|
|
52
52
|
#
|
53
53
|
# @return [Promisepay::User]
|
54
54
|
def update(attributes)
|
55
|
-
response = JSON.parse(@client.patch(
|
55
|
+
response = JSON.parse(@client.patch("users/#{attributes[:id]}", attributes).body)
|
56
56
|
Promisepay::User.new(@client, response['users'])
|
57
57
|
end
|
58
58
|
end
|
data/lib/promisepay/version.rb
CHANGED
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.2
|
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: 2016-08-
|
11
|
+
date: 2016-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -87,6 +87,7 @@ files:
|
|
87
87
|
- lib/promisepay/models/card_account.rb
|
88
88
|
- lib/promisepay/models/charge.rb
|
89
89
|
- lib/promisepay/models/company.rb
|
90
|
+
- lib/promisepay/models/direct_debit_authority.rb
|
90
91
|
- lib/promisepay/models/fee.rb
|
91
92
|
- lib/promisepay/models/item.rb
|
92
93
|
- lib/promisepay/models/paypal_account.rb
|
@@ -99,6 +100,7 @@ files:
|
|
99
100
|
- lib/promisepay/resources/card_account_resource.rb
|
100
101
|
- lib/promisepay/resources/charge_resource.rb
|
101
102
|
- lib/promisepay/resources/company_resource.rb
|
103
|
+
- lib/promisepay/resources/direct_debit_authority_resource.rb
|
102
104
|
- lib/promisepay/resources/fee_resource.rb
|
103
105
|
- lib/promisepay/resources/item_resource.rb
|
104
106
|
- lib/promisepay/resources/paypal_account_resource.rb
|