gocardless_pro 4.2.0 → 4.4.1
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 +16 -12
- data/lib/gocardless_pro/client.rb +33 -3
- data/lib/gocardless_pro/error.rb +3 -3
- data/lib/gocardless_pro/list_response.rb +2 -2
- data/lib/gocardless_pro/middlewares/raise_gocardless_errors.rb +11 -3
- data/lib/gocardless_pro/paginator.rb +3 -2
- data/lib/gocardless_pro/resources/balance.rb +4 -1
- data/lib/gocardless_pro/resources/bank_account_detail.rb +5 -1
- data/lib/gocardless_pro/resources/bank_account_holder_verification.rb +44 -0
- data/lib/gocardless_pro/resources/bank_authorisation.rb +9 -2
- data/lib/gocardless_pro/resources/bank_details_lookup.rb +3 -1
- data/lib/gocardless_pro/resources/billing_request.rb +24 -10
- data/lib/gocardless_pro/resources/billing_request_flow.rb +18 -2
- data/lib/gocardless_pro/resources/billing_request_template.rb +18 -2
- data/lib/gocardless_pro/resources/billing_request_with_action.rb +6 -5
- data/lib/gocardless_pro/resources/block.rb +12 -8
- data/lib/gocardless_pro/resources/creditor.rb +26 -6
- data/lib/gocardless_pro/resources/creditor_bank_account.rb +17 -7
- data/lib/gocardless_pro/resources/currency_exchange_rate.rb +4 -1
- data/lib/gocardless_pro/resources/customer.rb +22 -5
- data/lib/gocardless_pro/resources/customer_bank_account.rb +24 -10
- data/lib/gocardless_pro/resources/customer_notification.rb +8 -5
- data/lib/gocardless_pro/resources/event.rb +31 -4
- data/lib/gocardless_pro/resources/export.rb +7 -1
- data/lib/gocardless_pro/resources/funds_availability.rb +38 -0
- data/lib/gocardless_pro/resources/instalment_schedule.rb +8 -2
- data/lib/gocardless_pro/resources/institution.rb +11 -4
- data/lib/gocardless_pro/resources/logo.rb +2 -1
- data/lib/gocardless_pro/resources/mandate.rb +21 -6
- data/lib/gocardless_pro/resources/mandate_import.rb +29 -22
- data/lib/gocardless_pro/resources/mandate_import_entry.rb +16 -17
- data/lib/gocardless_pro/resources/mandate_pdf.rb +5 -4
- data/lib/gocardless_pro/resources/negative_balance_limit.rb +4 -2
- data/lib/gocardless_pro/resources/outbound_payment.rb +33 -12
- data/lib/gocardless_pro/resources/outbound_payment_import.rb +81 -0
- data/lib/gocardless_pro/resources/outbound_payment_import_entry.rb +77 -0
- data/lib/gocardless_pro/resources/payer_authorisation.rb +34 -32
- data/lib/gocardless_pro/resources/payment.rb +24 -8
- data/lib/gocardless_pro/resources/payment_account.rb +64 -0
- data/lib/gocardless_pro/resources/payment_account_transaction.rb +79 -0
- data/lib/gocardless_pro/resources/payout.rb +19 -8
- data/lib/gocardless_pro/resources/payout_item.rb +4 -3
- data/lib/gocardless_pro/resources/redirect_flow.rb +44 -25
- data/lib/gocardless_pro/resources/refund.rb +16 -7
- data/lib/gocardless_pro/resources/scheme_identifier.rb +18 -3
- data/lib/gocardless_pro/resources/subscription.rb +37 -16
- data/lib/gocardless_pro/resources/tax_rate.rb +8 -3
- data/lib/gocardless_pro/resources/transferred_mandate.rb +3 -1
- data/lib/gocardless_pro/resources/verification_detail.rb +19 -8
- data/lib/gocardless_pro/resources/webhook.rb +13 -2
- data/lib/gocardless_pro/services/balances_service.rb +11 -3
- data/lib/gocardless_pro/services/bank_account_details_service.rb +14 -3
- data/lib/gocardless_pro/services/bank_account_holder_verifications_service.rb +92 -0
- data/lib/gocardless_pro/services/bank_authorisations_service.rb +9 -3
- data/lib/gocardless_pro/services/bank_details_lookups_service.rb +14 -6
- data/lib/gocardless_pro/services/billing_request_flows_service.rb +8 -2
- data/lib/gocardless_pro/services/billing_request_templates_service.rb +14 -7
- data/lib/gocardless_pro/services/billing_request_with_actions_service.rb +7 -1
- data/lib/gocardless_pro/services/billing_requests_service.rb +38 -33
- data/lib/gocardless_pro/services/blocks_service.rb +17 -10
- data/lib/gocardless_pro/services/creditor_bank_accounts_service.rb +14 -7
- data/lib/gocardless_pro/services/creditors_service.rb +13 -6
- data/lib/gocardless_pro/services/currency_exchange_rates_service.rb +10 -3
- data/lib/gocardless_pro/services/customer_bank_accounts_service.rb +25 -15
- data/lib/gocardless_pro/services/customer_notifications_service.rb +8 -3
- data/lib/gocardless_pro/services/customers_service.rb +15 -9
- data/lib/gocardless_pro/services/events_service.rb +16 -4
- data/lib/gocardless_pro/services/exports_service.rb +8 -2
- data/lib/gocardless_pro/services/funds_availabilities_service.rb +56 -0
- data/lib/gocardless_pro/services/instalment_schedules_service.rb +21 -13
- data/lib/gocardless_pro/services/institutions_service.rb +8 -2
- data/lib/gocardless_pro/services/logos_service.rb +9 -3
- data/lib/gocardless_pro/services/mandate_import_entries_service.rb +10 -4
- data/lib/gocardless_pro/services/mandate_imports_service.rb +16 -8
- data/lib/gocardless_pro/services/mandate_pdfs_service.rb +11 -5
- data/lib/gocardless_pro/services/mandates_service.rb +23 -16
- data/lib/gocardless_pro/services/negative_balance_limits_service.rb +10 -3
- data/lib/gocardless_pro/services/outbound_payment_import_entries_service.rb +64 -0
- data/lib/gocardless_pro/services/outbound_payment_imports_service.rb +118 -0
- data/lib/gocardless_pro/services/outbound_payments_service.rb +34 -12
- data/lib/gocardless_pro/services/payer_authorisations_service.rb +18 -15
- data/lib/gocardless_pro/services/payer_themes_service.rb +7 -1
- data/lib/gocardless_pro/services/payment_account_transactions_service.rb +93 -0
- data/lib/gocardless_pro/services/payment_accounts_service.rb +83 -0
- data/lib/gocardless_pro/services/payments_service.rb +29 -21
- data/lib/gocardless_pro/services/payout_items_service.rb +12 -7
- data/lib/gocardless_pro/services/payouts_service.rb +14 -7
- data/lib/gocardless_pro/services/redirect_flows_service.rb +19 -9
- data/lib/gocardless_pro/services/refunds_service.rb +18 -13
- data/lib/gocardless_pro/services/scenario_simulators_service.rb +90 -81
- data/lib/gocardless_pro/services/scheme_identifiers_service.rb +15 -9
- data/lib/gocardless_pro/services/subscriptions_service.rb +57 -47
- data/lib/gocardless_pro/services/tax_rates_service.rb +11 -4
- data/lib/gocardless_pro/services/transferred_mandates_service.rb +8 -2
- data/lib/gocardless_pro/services/verification_details_service.rb +7 -1
- data/lib/gocardless_pro/services/webhooks_service.rb +13 -6
- data/lib/gocardless_pro/version.rb +1 -1
- data/lib/gocardless_pro/webhook.rb +45 -0
- data/lib/gocardless_pro.rb +18 -0
- metadata +38 -16
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This client is automatically generated from a template and JSON schema definition.
|
|
3
|
+
# See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing.
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
require 'uri'
|
|
7
|
+
|
|
8
|
+
module GoCardlessPro
|
|
9
|
+
# A module containing classes for each of the resources in the GC Api
|
|
10
|
+
module Resources
|
|
11
|
+
# Represents an instance of a outbound_payment_import_entry resource returned from the API
|
|
12
|
+
|
|
13
|
+
# Import Entries are the individual rows of an outbound payment import,
|
|
14
|
+
# representing each payment to be created.
|
|
15
|
+
class OutboundPaymentImportEntry
|
|
16
|
+
attr_reader :amount
|
|
17
|
+
attr_reader :created_at
|
|
18
|
+
attr_reader :id
|
|
19
|
+
attr_reader :metadata
|
|
20
|
+
attr_reader :processed_at
|
|
21
|
+
attr_reader :reference
|
|
22
|
+
attr_reader :scheme
|
|
23
|
+
attr_reader :validation_errors
|
|
24
|
+
attr_reader :verification_result
|
|
25
|
+
|
|
26
|
+
# Initialize a outbound_payment_import_entry resource instance
|
|
27
|
+
# @param object [Hash] an object returned from the API
|
|
28
|
+
def initialize(object, response = nil)
|
|
29
|
+
@object = object
|
|
30
|
+
|
|
31
|
+
@amount = object['amount']
|
|
32
|
+
@created_at = object['created_at']
|
|
33
|
+
@id = object['id']
|
|
34
|
+
@links = object['links']
|
|
35
|
+
@metadata = object['metadata']
|
|
36
|
+
@processed_at = object['processed_at']
|
|
37
|
+
@reference = object['reference']
|
|
38
|
+
@scheme = object['scheme']
|
|
39
|
+
@validation_errors = object['validation_errors']
|
|
40
|
+
@verification_result = object['verification_result']
|
|
41
|
+
@response = response
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def api_response
|
|
45
|
+
ApiResponse.new(@response)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Return the links that the resource has
|
|
49
|
+
def links
|
|
50
|
+
@outbound_payment_import_entry_links ||= Links.new(@links)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Provides the outbound_payment_import_entry resource as a hash of all its readable attributes
|
|
54
|
+
def to_h
|
|
55
|
+
@object
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
class Links
|
|
59
|
+
def initialize(links)
|
|
60
|
+
@links = links || {}
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def outbound_payment
|
|
64
|
+
@links['outbound_payment']
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def outbound_payment_import
|
|
68
|
+
@links['outbound_payment_import']
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def recipient_bank_account
|
|
72
|
+
@links['recipient_bank_account']
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
@@ -10,14 +10,13 @@ module GoCardlessPro
|
|
|
10
10
|
module Resources
|
|
11
11
|
# Represents an instance of a payer_authorisation resource returned from the API
|
|
12
12
|
|
|
13
|
-
#
|
|
13
|
+
#
|
|
14
14
|
# Don't use Payer Authorisations for new integrations.
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
# integrations.
|
|
20
|
-
# </p>
|
|
15
|
+
# It is deprecated in favour of
|
|
16
|
+
#
|
|
17
|
+
# Billing Requests
|
|
18
|
+
# (https://developer.gocardless.com/getting-started/billing-requests/overview/).
|
|
19
|
+
# Use Billing Requests to build any future integrations.
|
|
21
20
|
#
|
|
22
21
|
# Payer Authorisation resource acts as a wrapper for creating customer, bank
|
|
23
22
|
# account and mandate details in a single request.
|
|
@@ -26,50 +25,53 @@ module GoCardlessPro
|
|
|
26
25
|
#
|
|
27
26
|
# The process to use the Payer Authorisation API is as follows:
|
|
28
27
|
#
|
|
29
|
-
#
|
|
28
|
+
# 1. Create a Payer Authorisation, either empty or with already available
|
|
30
29
|
# information
|
|
31
|
-
#
|
|
30
|
+
# 2. Update the authorisation with additional information or fix any
|
|
32
31
|
# mistakes
|
|
33
|
-
#
|
|
32
|
+
# 3. Submit the authorisation, after the payer has reviewed their
|
|
34
33
|
# information
|
|
35
|
-
#
|
|
34
|
+
# 4. [coming soon] Redirect the payer to the verification mechanisms from
|
|
36
35
|
# the response of the Submit request (this will be introduced as a
|
|
37
36
|
# non-breaking change)
|
|
38
|
-
#
|
|
39
|
-
# created
|
|
37
|
+
# 5. Confirm the authorisation to indicate that the resources can be created
|
|
40
38
|
#
|
|
41
39
|
# After the Payer Authorisation is confirmed, resources will eventually be
|
|
42
40
|
# created as it's an asynchronous process.
|
|
43
41
|
#
|
|
44
42
|
# To retrieve the status and ID of the linked resources you can do one of
|
|
45
43
|
# the following:
|
|
46
|
-
# <ol>
|
|
47
|
-
# <li> Listen to <code> payer_authorisation_completed </code> <a
|
|
48
|
-
# href="#appendix-webhooks"> webhook</a> (recommended)</li>
|
|
49
|
-
# <li> Poll the GET <a
|
|
50
|
-
# href="#payer-authorisations-get-a-single-payer-authorisation">
|
|
51
|
-
# endpoint</a></li>
|
|
52
|
-
# <li> Poll the GET events API
|
|
53
|
-
# <code>https://api.gocardless.com/events?payer_authorisation={id}&action=completed</code>
|
|
54
|
-
# </li>
|
|
55
|
-
# </ol>
|
|
56
44
|
#
|
|
57
|
-
#
|
|
45
|
+
# 1. Listen to payer_authorisation_completed webhook
|
|
46
|
+
# (https://developer.gocardless.com/api-reference/#appendix-webhooks)
|
|
47
|
+
# (recommended)
|
|
48
|
+
# 2. Poll the GET endpoint
|
|
49
|
+
# (https://developer.gocardless.com/api-reference/#payer-authorisations-get-a-single-payer-authorisation)
|
|
50
|
+
# 3. Poll the GET events API
|
|
51
|
+
# https://api.gocardless.com/events?payer_authorisation={id}&action=completed
|
|
52
|
+
#
|
|
53
|
+
#
|
|
58
54
|
# Note that the `create` and `update` endpoints behave differently than
|
|
59
|
-
#
|
|
60
|
-
#
|
|
61
|
-
#
|
|
55
|
+
# other existing `create` and `update` endpoints. The Payer Authorisation is
|
|
56
|
+
# still saved if incomplete data is provided.
|
|
57
|
+
# We return the list of incomplete data in the `incomplete_fields` along
|
|
62
58
|
# with the resources in the body of the response.
|
|
63
|
-
#
|
|
64
|
-
#
|
|
59
|
+
# The bank account details(account_number, bank_code & branch_code) must be
|
|
60
|
+
# sent together rather than splitting across different request for both
|
|
65
61
|
# `create` and `update` endpoints.
|
|
66
|
-
#
|
|
62
|
+
#
|
|
63
|
+
#
|
|
67
64
|
# The API is designed to be flexible and allows you to collect information
|
|
68
65
|
# in multiple steps without storing any sensitive data in the browser or in
|
|
69
66
|
# your servers.
|
|
70
|
-
# </p>
|
|
71
67
|
class PayerAuthorisation
|
|
72
|
-
attr_reader :bank_account
|
|
68
|
+
attr_reader :bank_account
|
|
69
|
+
attr_reader :created_at
|
|
70
|
+
attr_reader :customer
|
|
71
|
+
attr_reader :id
|
|
72
|
+
attr_reader :incomplete_fields
|
|
73
|
+
attr_reader :mandate
|
|
74
|
+
attr_reader :status
|
|
73
75
|
|
|
74
76
|
# Initialize a payer_authorisation resource instance
|
|
75
77
|
# @param object [Hash] an object returned from the API
|
|
@@ -10,16 +10,31 @@ module GoCardlessPro
|
|
|
10
10
|
module Resources
|
|
11
11
|
# Represents an instance of a payment resource returned from the API
|
|
12
12
|
|
|
13
|
-
# Payment objects represent payments from a
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
13
|
+
# Payment objects represent payments from a customer
|
|
14
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-customers)
|
|
15
|
+
# to a creditor
|
|
16
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-creditors),
|
|
17
|
+
# taken against a Direct Debit mandate
|
|
18
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-mandates).
|
|
17
19
|
#
|
|
18
|
-
# GoCardless will notify you via a
|
|
19
|
-
#
|
|
20
|
+
# GoCardless will notify you via a webhook
|
|
21
|
+
# (https://developer.gocardless.com/api-reference/#appendix-webhooks)
|
|
22
|
+
# whenever the state of a payment changes.
|
|
20
23
|
class Payment
|
|
21
|
-
attr_reader :amount
|
|
22
|
-
|
|
24
|
+
attr_reader :amount
|
|
25
|
+
attr_reader :amount_refunded
|
|
26
|
+
attr_reader :charge_date
|
|
27
|
+
attr_reader :created_at
|
|
28
|
+
attr_reader :currency
|
|
29
|
+
attr_reader :description
|
|
30
|
+
attr_reader :faster_ach
|
|
31
|
+
attr_reader :fx
|
|
32
|
+
attr_reader :id
|
|
33
|
+
attr_reader :metadata
|
|
34
|
+
attr_reader :reference
|
|
35
|
+
attr_reader :retry_if_possible
|
|
36
|
+
attr_reader :scheme
|
|
37
|
+
attr_reader :status
|
|
23
38
|
|
|
24
39
|
# Initialize a payment resource instance
|
|
25
40
|
# @param object [Hash] an object returned from the API
|
|
@@ -39,6 +54,7 @@ module GoCardlessPro
|
|
|
39
54
|
@metadata = object['metadata']
|
|
40
55
|
@reference = object['reference']
|
|
41
56
|
@retry_if_possible = object['retry_if_possible']
|
|
57
|
+
@scheme = object['scheme']
|
|
42
58
|
@status = object['status']
|
|
43
59
|
@response = response
|
|
44
60
|
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This client is automatically generated from a template and JSON schema definition.
|
|
3
|
+
# See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing.
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
require 'uri'
|
|
7
|
+
|
|
8
|
+
module GoCardlessPro
|
|
9
|
+
# A module containing classes for each of the resources in the GC Api
|
|
10
|
+
module Resources
|
|
11
|
+
# Represents an instance of a payment_account resource returned from the API
|
|
12
|
+
|
|
13
|
+
# Access the details of bank accounts provided for you by GoCardless that
|
|
14
|
+
# are used to fund Outbound Payments
|
|
15
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-outbound-payments).
|
|
16
|
+
class PaymentAccount
|
|
17
|
+
attr_reader :account_balance
|
|
18
|
+
attr_reader :account_holder_name
|
|
19
|
+
attr_reader :account_number_ending
|
|
20
|
+
attr_reader :bank_name
|
|
21
|
+
attr_reader :currency
|
|
22
|
+
attr_reader :id
|
|
23
|
+
|
|
24
|
+
# Initialize a payment_account resource instance
|
|
25
|
+
# @param object [Hash] an object returned from the API
|
|
26
|
+
def initialize(object, response = nil)
|
|
27
|
+
@object = object
|
|
28
|
+
|
|
29
|
+
@account_balance = object['account_balance']
|
|
30
|
+
@account_holder_name = object['account_holder_name']
|
|
31
|
+
@account_number_ending = object['account_number_ending']
|
|
32
|
+
@bank_name = object['bank_name']
|
|
33
|
+
@currency = object['currency']
|
|
34
|
+
@id = object['id']
|
|
35
|
+
@links = object['links']
|
|
36
|
+
@response = response
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def api_response
|
|
40
|
+
ApiResponse.new(@response)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Return the links that the resource has
|
|
44
|
+
def links
|
|
45
|
+
@payment_account_links ||= Links.new(@links)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Provides the payment_account resource as a hash of all its readable attributes
|
|
49
|
+
def to_h
|
|
50
|
+
@object
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
class Links
|
|
54
|
+
def initialize(links)
|
|
55
|
+
@links = links || {}
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def creditor
|
|
59
|
+
@links['creditor']
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This client is automatically generated from a template and JSON schema definition.
|
|
3
|
+
# See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing.
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
require 'uri'
|
|
7
|
+
|
|
8
|
+
module GoCardlessPro
|
|
9
|
+
# A module containing classes for each of the resources in the GC Api
|
|
10
|
+
module Resources
|
|
11
|
+
# Represents an instance of a payment_account_transaction resource returned from the API
|
|
12
|
+
|
|
13
|
+
# Payment account transactions represent movements of funds on a given
|
|
14
|
+
# payment account. The payment account is provisioned by GoCardless and is
|
|
15
|
+
# used to fund outbound payments
|
|
16
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-outbound-payments).
|
|
17
|
+
class PaymentAccountTransaction
|
|
18
|
+
attr_reader :amount
|
|
19
|
+
attr_reader :balance_after_transaction
|
|
20
|
+
attr_reader :counterparty_name
|
|
21
|
+
attr_reader :currency
|
|
22
|
+
attr_reader :description
|
|
23
|
+
attr_reader :direction
|
|
24
|
+
attr_reader :id
|
|
25
|
+
attr_reader :reference
|
|
26
|
+
attr_reader :value_date
|
|
27
|
+
|
|
28
|
+
# Initialize a payment_account_transaction resource instance
|
|
29
|
+
# @param object [Hash] an object returned from the API
|
|
30
|
+
def initialize(object, response = nil)
|
|
31
|
+
@object = object
|
|
32
|
+
|
|
33
|
+
@amount = object['amount']
|
|
34
|
+
@balance_after_transaction = object['balance_after_transaction']
|
|
35
|
+
@counterparty_name = object['counterparty_name']
|
|
36
|
+
@currency = object['currency']
|
|
37
|
+
@description = object['description']
|
|
38
|
+
@direction = object['direction']
|
|
39
|
+
@id = object['id']
|
|
40
|
+
@links = object['links']
|
|
41
|
+
@reference = object['reference']
|
|
42
|
+
@value_date = object['value_date']
|
|
43
|
+
@response = response
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def api_response
|
|
47
|
+
ApiResponse.new(@response)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Return the links that the resource has
|
|
51
|
+
def links
|
|
52
|
+
@payment_account_transaction_links ||= Links.new(@links)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Provides the payment_account_transaction resource as a hash of all its readable attributes
|
|
56
|
+
def to_h
|
|
57
|
+
@object
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
class Links
|
|
61
|
+
def initialize(links)
|
|
62
|
+
@links = links || {}
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def outbound_payment
|
|
66
|
+
@links['outbound_payment']
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def payment_bank_account
|
|
70
|
+
@links['payment_bank_account']
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def payout
|
|
74
|
+
@links['payout']
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -10,15 +10,26 @@ module GoCardlessPro
|
|
|
10
10
|
module Resources
|
|
11
11
|
# Represents an instance of a payout resource returned from the API
|
|
12
12
|
|
|
13
|
-
# Payouts represent transfers from GoCardless to a
|
|
14
|
-
#
|
|
15
|
-
# collected from one or many
|
|
16
|
-
# payments
|
|
17
|
-
#
|
|
18
|
-
#
|
|
13
|
+
# Payouts represent transfers from GoCardless to a creditor
|
|
14
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-creditors).
|
|
15
|
+
# Each payout contains the funds collected from one or many payments
|
|
16
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-payments).
|
|
17
|
+
# All the payments in a payout will have been collected in the same
|
|
18
|
+
# currency. Payouts are created automatically after a payment has been
|
|
19
|
+
# successfully collected.
|
|
19
20
|
class Payout
|
|
20
|
-
attr_reader :amount
|
|
21
|
-
|
|
21
|
+
attr_reader :amount
|
|
22
|
+
attr_reader :arrival_date
|
|
23
|
+
attr_reader :created_at
|
|
24
|
+
attr_reader :currency
|
|
25
|
+
attr_reader :deducted_fees
|
|
26
|
+
attr_reader :fx
|
|
27
|
+
attr_reader :id
|
|
28
|
+
attr_reader :metadata
|
|
29
|
+
attr_reader :payout_type
|
|
30
|
+
attr_reader :reference
|
|
31
|
+
attr_reader :status
|
|
32
|
+
attr_reader :tax_currency
|
|
22
33
|
|
|
23
34
|
# Initialize a payout resource instance
|
|
24
35
|
# @param object [Hash] an object returned from the API
|
|
@@ -30,10 +30,11 @@ module GoCardlessPro
|
|
|
30
30
|
# retrieved for payouts
|
|
31
31
|
# created in the last 6 months. Requests for older payouts will return an
|
|
32
32
|
# HTTP status
|
|
33
|
-
#
|
|
34
|
-
#
|
|
33
|
+
# 410 Gone.
|
|
35
34
|
class PayoutItem
|
|
36
|
-
attr_reader :amount
|
|
35
|
+
attr_reader :amount
|
|
36
|
+
attr_reader :taxes
|
|
37
|
+
attr_reader :type
|
|
37
38
|
|
|
38
39
|
# Initialize a payout_item resource instance
|
|
39
40
|
# @param object [Hash] an object returned from the API
|
|
@@ -10,38 +10,49 @@ module GoCardlessPro
|
|
|
10
10
|
module Resources
|
|
11
11
|
# Represents an instance of a redirect_flow resource returned from the API
|
|
12
12
|
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
13
|
+
# Deprecated: Redirect Flows are legacy APIs and cannot be used by new
|
|
14
|
+
# integrators.
|
|
15
|
+
# The Billing Request flow
|
|
16
|
+
# (https://developer.gocardless.com/api-reference/#billing-requests) API
|
|
17
|
+
# should be used for your payment flows.
|
|
17
18
|
#
|
|
18
|
-
# Redirect flows enable you to use GoCardless'
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
#
|
|
19
|
+
# Redirect flows enable you to use GoCardless' hosted payment pages
|
|
20
|
+
# (https://pay-sandbox.gocardless.com/AL000000AKFPFF) to set up mandates
|
|
21
|
+
# with your customers. These pages are fully compliant and have been
|
|
22
|
+
# translated into Danish, Dutch, French, German, Italian, Norwegian,
|
|
22
23
|
# Portuguese, Slovak, Spanish and Swedish.
|
|
23
24
|
#
|
|
24
25
|
# The overall flow is:
|
|
25
26
|
#
|
|
26
|
-
# 1.
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
#
|
|
27
|
+
# 1.
|
|
28
|
+
# You create
|
|
29
|
+
# (https://developer.gocardless.com/api-reference/#redirect-flows-create-a-redirect-flow)
|
|
30
|
+
# a redirect flow for your customer, and redirect them to the returned
|
|
31
|
+
# redirect url, e.g. `https://pay.gocardless.com/flow/RE123`.
|
|
32
|
+
# 2.
|
|
33
|
+
# Your customer supplies their name, email, address, and bank account
|
|
31
34
|
# details, and submits the form. This securely stores their details, and
|
|
32
35
|
# redirects them back to your `success_redirect_url` with
|
|
33
36
|
# `redirect_flow_id=RE123` in the querystring.
|
|
37
|
+
# 3.
|
|
38
|
+
# You complete
|
|
39
|
+
# (https://developer.gocardless.com/api-reference/#redirect-flows-complete-a-redirect-flow)
|
|
40
|
+
# the redirect flow, which creates a customer
|
|
41
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-customers),
|
|
42
|
+
# customer bank account
|
|
43
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-customer-bank-accounts),
|
|
44
|
+
# and mandate
|
|
45
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-mandates),
|
|
46
|
+
# and returns the ID of the mandate. You may wish to create a subscription
|
|
47
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-subscriptions)
|
|
48
|
+
# or payment
|
|
49
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-payments)
|
|
50
|
+
# at this point.
|
|
34
51
|
#
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
#
|
|
39
|
-
# You may wish to create a [subscription](#core-endpoints-subscriptions) or
|
|
40
|
-
# [payment](#core-endpoints-payments) at this point.
|
|
41
|
-
#
|
|
42
|
-
# Once you have [completed](#redirect-flows-complete-a-redirect-flow) the
|
|
43
|
-
# redirect flow via the API, you should display a confirmation page to your
|
|
44
|
-
# customer, confirming that their Direct Debit has been set up. You can
|
|
52
|
+
# Once you have completed
|
|
53
|
+
# (https://developer.gocardless.com/api-reference/#redirect-flows-complete-a-redirect-flow)
|
|
54
|
+
# the redirect flow via the API, you should display a confirmation page to
|
|
55
|
+
# your customer, confirming that their Direct Debit has been set up. You can
|
|
45
56
|
# build your own page, or redirect to the one we provide in the
|
|
46
57
|
# `confirmation_url` attribute of the redirect flow.
|
|
47
58
|
#
|
|
@@ -49,8 +60,16 @@ module GoCardlessPro
|
|
|
49
60
|
# complete an expired redirect flow. For an integrator this is shorter and
|
|
50
61
|
# they will expire after 10 minutes.
|
|
51
62
|
class RedirectFlow
|
|
52
|
-
attr_reader :confirmation_url
|
|
53
|
-
|
|
63
|
+
attr_reader :confirmation_url
|
|
64
|
+
attr_reader :created_at
|
|
65
|
+
attr_reader :description
|
|
66
|
+
attr_reader :id
|
|
67
|
+
attr_reader :mandate_reference
|
|
68
|
+
attr_reader :metadata
|
|
69
|
+
attr_reader :redirect_url
|
|
70
|
+
attr_reader :scheme
|
|
71
|
+
attr_reader :session_token
|
|
72
|
+
attr_reader :success_redirect_url
|
|
54
73
|
|
|
55
74
|
# Initialize a redirect_flow resource instance
|
|
56
75
|
# @param object [Hash] an object returned from the API
|
|
@@ -10,15 +10,24 @@ module GoCardlessPro
|
|
|
10
10
|
module Resources
|
|
11
11
|
# Represents an instance of a refund resource returned from the API
|
|
12
12
|
|
|
13
|
-
# Refund objects represent (partial) refunds of a
|
|
14
|
-
#
|
|
15
|
-
#
|
|
13
|
+
# Refund objects represent (partial) refunds of a payment
|
|
14
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-payments)
|
|
15
|
+
# back to the customer
|
|
16
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-customers).
|
|
16
17
|
#
|
|
17
|
-
# GoCardless will notify you via a
|
|
18
|
-
#
|
|
19
|
-
#
|
|
18
|
+
# GoCardless will notify you via a webhook
|
|
19
|
+
# (https://developer.gocardless.com/api-reference/#appendix-webhooks)
|
|
20
|
+
# whenever a refund is created, and will update the `amount_refunded`
|
|
21
|
+
# property of the payment.
|
|
20
22
|
class Refund
|
|
21
|
-
attr_reader :amount
|
|
23
|
+
attr_reader :amount
|
|
24
|
+
attr_reader :created_at
|
|
25
|
+
attr_reader :currency
|
|
26
|
+
attr_reader :fx
|
|
27
|
+
attr_reader :id
|
|
28
|
+
attr_reader :metadata
|
|
29
|
+
attr_reader :reference
|
|
30
|
+
attr_reader :status
|
|
22
31
|
|
|
23
32
|
# Initialize a refund resource instance
|
|
24
33
|
# @param object [Hash] an object returned from the API
|
|
@@ -13,10 +13,25 @@ module GoCardlessPro
|
|
|
13
13
|
# This represents a scheme identifier (e.g. a SUN in Bacs or a CID in SEPA).
|
|
14
14
|
# Scheme identifiers are used to specify the beneficiary name that appears
|
|
15
15
|
# on customers' bank statements.
|
|
16
|
-
#
|
|
17
16
|
class SchemeIdentifier
|
|
18
|
-
attr_reader :address_line1
|
|
19
|
-
|
|
17
|
+
attr_reader :address_line1
|
|
18
|
+
attr_reader :address_line2
|
|
19
|
+
attr_reader :address_line3
|
|
20
|
+
attr_reader :can_specify_mandate_reference
|
|
21
|
+
attr_reader :city
|
|
22
|
+
attr_reader :country_code
|
|
23
|
+
attr_reader :created_at
|
|
24
|
+
attr_reader :currency
|
|
25
|
+
attr_reader :email
|
|
26
|
+
attr_reader :id
|
|
27
|
+
attr_reader :minimum_advance_notice
|
|
28
|
+
attr_reader :name
|
|
29
|
+
attr_reader :phone_number
|
|
30
|
+
attr_reader :postal_code
|
|
31
|
+
attr_reader :reference
|
|
32
|
+
attr_reader :region
|
|
33
|
+
attr_reader :scheme
|
|
34
|
+
attr_reader :status
|
|
20
35
|
|
|
21
36
|
# Initialize a scheme_identifier resource instance
|
|
22
37
|
# @param object [Hash] an object returned from the API
|
|
@@ -10,21 +10,24 @@ module GoCardlessPro
|
|
|
10
10
|
module Resources
|
|
11
11
|
# Represents an instance of a subscription resource returned from the API
|
|
12
12
|
|
|
13
|
-
# Subscriptions create
|
|
14
|
-
#
|
|
13
|
+
# Subscriptions create payments
|
|
14
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-payments)
|
|
15
|
+
# according to a schedule.
|
|
15
16
|
#
|
|
16
|
-
#
|
|
17
|
+
# Recurrence Rules
|
|
17
18
|
#
|
|
18
19
|
# The following rules apply when specifying recurrence:
|
|
19
20
|
#
|
|
20
21
|
# - If `day_of_month` and `start_date` are not provided `start_date` will be
|
|
21
|
-
# the
|
|
22
|
-
#
|
|
22
|
+
# the mandate
|
|
23
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-mandates)'s
|
|
24
|
+
# `next_possible_charge_date` and the subscription will then recur based on
|
|
25
|
+
# the `interval` & `interval_unit`
|
|
23
26
|
# - If `month` or `day_of_month` are present the following validations
|
|
24
27
|
# apply:
|
|
25
28
|
#
|
|
26
|
-
# |
|
|
27
|
-
#
|
|
29
|
+
# | interval_unit | month |
|
|
30
|
+
# day_of_month |
|
|
28
31
|
# | :---------------- | :--------------------------------------------- |
|
|
29
32
|
# :----------------------------------------- |
|
|
30
33
|
# | yearly | optional (required if `day_of_month` provided) |
|
|
@@ -36,8 +39,8 @@ module GoCardlessPro
|
|
|
36
39
|
#
|
|
37
40
|
# Examples:
|
|
38
41
|
#
|
|
39
|
-
# |
|
|
40
|
-
#
|
|
42
|
+
# | interval_unit | interval | month | day_of_month | valid?
|
|
43
|
+
# |
|
|
41
44
|
# | :---------------- | :----------- | :-------- | :--------------- |
|
|
42
45
|
# :------------------------------------------------- |
|
|
43
46
|
# | yearly | 1 | january | -1 | valid
|
|
@@ -57,19 +60,37 @@ module GoCardlessPro
|
|
|
57
60
|
# | weekly | 2 | october | 10 |
|
|
58
61
|
# invalid - `month` and `day_of_month` must be blank |
|
|
59
62
|
#
|
|
60
|
-
#
|
|
63
|
+
# Rolling dates
|
|
61
64
|
#
|
|
62
65
|
# When a charge date falls on a non-business day, one of two things will
|
|
63
66
|
# happen:
|
|
64
67
|
#
|
|
65
68
|
# - if the recurrence rule specified `-1` as the `day_of_month`, the charge
|
|
66
|
-
# date will be rolled
|
|
67
|
-
#
|
|
68
|
-
# - otherwise the charge date will be rolled
|
|
69
|
-
#
|
|
69
|
+
# date will be rolled backwards to the previous business day (i.e., the last
|
|
70
|
+
# working day of the month).
|
|
71
|
+
# - otherwise the charge date will be rolled forwards to the next business
|
|
72
|
+
# day.
|
|
70
73
|
class Subscription
|
|
71
|
-
attr_reader :amount
|
|
72
|
-
|
|
74
|
+
attr_reader :amount
|
|
75
|
+
attr_reader :app_fee
|
|
76
|
+
attr_reader :count
|
|
77
|
+
attr_reader :created_at
|
|
78
|
+
attr_reader :currency
|
|
79
|
+
attr_reader :day_of_month
|
|
80
|
+
attr_reader :earliest_charge_date_after_resume
|
|
81
|
+
attr_reader :end_date
|
|
82
|
+
attr_reader :id
|
|
83
|
+
attr_reader :interval
|
|
84
|
+
attr_reader :interval_unit
|
|
85
|
+
attr_reader :metadata
|
|
86
|
+
attr_reader :month
|
|
87
|
+
attr_reader :name
|
|
88
|
+
attr_reader :parent_plan_paused
|
|
89
|
+
attr_reader :payment_reference
|
|
90
|
+
attr_reader :retry_if_possible
|
|
91
|
+
attr_reader :start_date
|
|
92
|
+
attr_reader :status
|
|
93
|
+
attr_reader :upcoming_payments
|
|
73
94
|
|
|
74
95
|
# Initialize a subscription resource instance
|
|
75
96
|
# @param object [Hash] an object returned from the API
|