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
|
@@ -10,10 +10,12 @@ module GoCardlessPro
|
|
|
10
10
|
module Resources
|
|
11
11
|
# Represents an instance of a customer_bank_account resource returned from the API
|
|
12
12
|
|
|
13
|
-
# Customer Bank Accounts hold the bank details of a
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
13
|
+
# Customer Bank Accounts hold the bank details of a customer
|
|
14
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-customers).
|
|
15
|
+
# They always belong to a customer
|
|
16
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-customers),
|
|
17
|
+
# and may be linked to several Direct Debit mandates
|
|
18
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-mandates).
|
|
17
19
|
#
|
|
18
20
|
# Note that customer bank accounts must be unique, and so you will encounter
|
|
19
21
|
# a `bank_account_exists` error if you try to create a duplicate bank
|
|
@@ -21,15 +23,25 @@ module GoCardlessPro
|
|
|
21
23
|
# instead, the ID of which will be provided as
|
|
22
24
|
# `links[customer_bank_account]` in the error response.
|
|
23
25
|
#
|
|
24
|
-
#
|
|
25
|
-
# first
|
|
26
|
+
# Note: To ensure the customer's bank accounts are valid, verify them first
|
|
26
27
|
# using
|
|
27
|
-
#
|
|
28
|
-
#
|
|
28
|
+
# bank_details_lookups
|
|
29
|
+
# (https://developer.gocardless.com/api-reference/#bank-details-lookups-perform-a-bank-details-lookup),
|
|
29
30
|
# before proceeding with creating the accounts
|
|
30
31
|
class CustomerBankAccount
|
|
31
|
-
attr_reader :account_holder_name
|
|
32
|
-
|
|
32
|
+
attr_reader :account_holder_name
|
|
33
|
+
attr_reader :account_number_ending
|
|
34
|
+
attr_reader :account_type
|
|
35
|
+
attr_reader :bank_account_token
|
|
36
|
+
attr_reader :bank_name
|
|
37
|
+
attr_reader :country_code
|
|
38
|
+
attr_reader :created_at
|
|
39
|
+
attr_reader :currency
|
|
40
|
+
attr_reader :enabled
|
|
41
|
+
attr_reader :id
|
|
42
|
+
attr_reader :metadata
|
|
43
|
+
attr_reader :payer_name_verification_result
|
|
44
|
+
attr_reader :trusted_recipient
|
|
33
45
|
|
|
34
46
|
# Initialize a customer_bank_account resource instance
|
|
35
47
|
# @param object [Hash] an object returned from the API
|
|
@@ -48,6 +60,8 @@ module GoCardlessPro
|
|
|
48
60
|
@id = object['id']
|
|
49
61
|
@links = object['links']
|
|
50
62
|
@metadata = object['metadata']
|
|
63
|
+
@payer_name_verification_result = object['payer_name_verification_result']
|
|
64
|
+
@trusted_recipient = object['trusted_recipient']
|
|
51
65
|
@response = response
|
|
52
66
|
end
|
|
53
67
|
|
|
@@ -20,12 +20,15 @@ module GoCardlessPro
|
|
|
20
20
|
# actioned in some
|
|
21
21
|
# way, it is no longer visible using this API.
|
|
22
22
|
#
|
|
23
|
-
#
|
|
24
|
-
#
|
|
25
|
-
#
|
|
26
|
-
# use this API.</p>
|
|
23
|
+
# Restricted: This API is currently only available for approved integrators
|
|
24
|
+
# - please get in touch (mailto:help@gocardless.com) if you would like to
|
|
25
|
+
# use this API.
|
|
27
26
|
class CustomerNotification
|
|
28
|
-
attr_reader :action_taken
|
|
27
|
+
attr_reader :action_taken
|
|
28
|
+
attr_reader :action_taken_at
|
|
29
|
+
attr_reader :action_taken_by
|
|
30
|
+
attr_reader :id
|
|
31
|
+
attr_reader :type
|
|
29
32
|
|
|
30
33
|
# Initialize a customer_notification resource instance
|
|
31
34
|
# @param object [Hash] an object returned from the API
|
|
@@ -14,11 +14,25 @@ module GoCardlessPro
|
|
|
14
14
|
# has been updated, for example a payment which has been collected, or a
|
|
15
15
|
# mandate which has been transferred. Event creation is an asynchronous
|
|
16
16
|
# process, so it can take some time between an action occurring and its
|
|
17
|
-
# corresponding event getting included in API responses. See
|
|
18
|
-
#
|
|
17
|
+
# corresponding event getting included in API responses. See here
|
|
18
|
+
# (https://developer.gocardless.com/api-reference/#event-types) for a
|
|
19
|
+
# complete list of event types.
|
|
20
|
+
#
|
|
21
|
+
# Important: Events older than 18 months will be archived and no longer
|
|
22
|
+
# accessible via the API or exports. Archival will begin no sooner than 1
|
|
23
|
+
# August 2026 in sandbox environments, and no sooner than 1 October 2026 in
|
|
24
|
+
# live environments. Events within the 18-month window are unaffected. If
|
|
25
|
+
# you need archived data, contact GoCardless support.
|
|
19
26
|
class Event
|
|
20
|
-
attr_reader :action
|
|
21
|
-
|
|
27
|
+
attr_reader :action
|
|
28
|
+
attr_reader :created_at
|
|
29
|
+
attr_reader :customer_notifications
|
|
30
|
+
attr_reader :details
|
|
31
|
+
attr_reader :id
|
|
32
|
+
attr_reader :metadata
|
|
33
|
+
attr_reader :resource_metadata
|
|
34
|
+
attr_reader :resource_type
|
|
35
|
+
attr_reader :source
|
|
22
36
|
|
|
23
37
|
# Initialize a event resource instance
|
|
24
38
|
# @param object [Hash] an object returned from the API
|
|
@@ -34,6 +48,7 @@ module GoCardlessPro
|
|
|
34
48
|
@metadata = object['metadata']
|
|
35
49
|
@resource_metadata = object['resource_metadata']
|
|
36
50
|
@resource_type = object['resource_type']
|
|
51
|
+
@source = object['source']
|
|
37
52
|
@response = response
|
|
38
53
|
end
|
|
39
54
|
|
|
@@ -88,6 +103,10 @@ module GoCardlessPro
|
|
|
88
103
|
@links['mandate']
|
|
89
104
|
end
|
|
90
105
|
|
|
106
|
+
def mandate_request
|
|
107
|
+
@links['mandate_request']
|
|
108
|
+
end
|
|
109
|
+
|
|
91
110
|
def mandate_request_mandate
|
|
92
111
|
@links['mandate_request_mandate']
|
|
93
112
|
end
|
|
@@ -104,6 +123,10 @@ module GoCardlessPro
|
|
|
104
123
|
@links['organisation']
|
|
105
124
|
end
|
|
106
125
|
|
|
126
|
+
def outbound_payment
|
|
127
|
+
@links['outbound_payment']
|
|
128
|
+
end
|
|
129
|
+
|
|
107
130
|
def parent_event
|
|
108
131
|
@links['parent_event']
|
|
109
132
|
end
|
|
@@ -116,6 +139,10 @@ module GoCardlessPro
|
|
|
116
139
|
@links['payment']
|
|
117
140
|
end
|
|
118
141
|
|
|
142
|
+
def payment_account_transaction
|
|
143
|
+
@links['payment_account_transaction']
|
|
144
|
+
end
|
|
145
|
+
|
|
119
146
|
def payment_request_payment
|
|
120
147
|
@links['payment_request_payment']
|
|
121
148
|
end
|
|
@@ -12,7 +12,12 @@ module GoCardlessPro
|
|
|
12
12
|
|
|
13
13
|
# File-based exports of data
|
|
14
14
|
class Export
|
|
15
|
-
attr_reader :created_at
|
|
15
|
+
attr_reader :created_at
|
|
16
|
+
attr_reader :currency
|
|
17
|
+
attr_reader :download_url
|
|
18
|
+
attr_reader :error_message
|
|
19
|
+
attr_reader :export_type
|
|
20
|
+
attr_reader :id
|
|
16
21
|
|
|
17
22
|
# Initialize a export resource instance
|
|
18
23
|
# @param object [Hash] an object returned from the API
|
|
@@ -22,6 +27,7 @@ module GoCardlessPro
|
|
|
22
27
|
@created_at = object['created_at']
|
|
23
28
|
@currency = object['currency']
|
|
24
29
|
@download_url = object['download_url']
|
|
30
|
+
@error_message = object['error_message']
|
|
25
31
|
@export_type = object['export_type']
|
|
26
32
|
@id = object['id']
|
|
27
33
|
@response = response
|
|
@@ -0,0 +1,38 @@
|
|
|
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 funds_availability resource returned from the API
|
|
12
|
+
|
|
13
|
+
# Checks if the payer's current balance is sufficient to cover the amount
|
|
14
|
+
# the merchant wants to charge within the consent parameters defined on the
|
|
15
|
+
# mandate.
|
|
16
|
+
class FundsAvailability
|
|
17
|
+
attr_reader :available
|
|
18
|
+
|
|
19
|
+
# Initialize a funds_availability resource instance
|
|
20
|
+
# @param object [Hash] an object returned from the API
|
|
21
|
+
def initialize(object, response = nil)
|
|
22
|
+
@object = object
|
|
23
|
+
|
|
24
|
+
@available = object['available']
|
|
25
|
+
@response = response
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def api_response
|
|
29
|
+
ApiResponse.new(@response)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Provides the funds_availability resource as a hash of all its readable attributes
|
|
33
|
+
def to_h
|
|
34
|
+
@object
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -26,9 +26,15 @@ module GoCardlessPro
|
|
|
26
26
|
#
|
|
27
27
|
# Customers will receive a single notification about the complete schedule
|
|
28
28
|
# of collection.
|
|
29
|
-
#
|
|
30
29
|
class InstalmentSchedule
|
|
31
|
-
attr_reader :created_at
|
|
30
|
+
attr_reader :created_at
|
|
31
|
+
attr_reader :currency
|
|
32
|
+
attr_reader :id
|
|
33
|
+
attr_reader :metadata
|
|
34
|
+
attr_reader :name
|
|
35
|
+
attr_reader :payment_errors
|
|
36
|
+
attr_reader :status
|
|
37
|
+
attr_reader :total_amount
|
|
32
38
|
|
|
33
39
|
# Initialize a instalment_schedule resource instance
|
|
34
40
|
# @param object [Hash] an object returned from the API
|
|
@@ -10,14 +10,21 @@ module GoCardlessPro
|
|
|
10
10
|
module Resources
|
|
11
11
|
# Represents an instance of a institution resource returned from the API
|
|
12
12
|
|
|
13
|
-
# Institutions that are supported when creating
|
|
14
|
-
#
|
|
15
|
-
# country or purpose.
|
|
13
|
+
# Institutions that are supported when creating Bank Authorisations
|
|
14
|
+
# (https://developer.gocardless.com/api-reference/#billing-requests-bank-authorisations)
|
|
15
|
+
# for a particular country or purpose.
|
|
16
16
|
#
|
|
17
17
|
# Not all institutions support both Payment Initiation (PIS) and Account
|
|
18
18
|
# Information (AIS) services.
|
|
19
19
|
class Institution
|
|
20
|
-
attr_reader :autocompletes_collect_bank_account
|
|
20
|
+
attr_reader :autocompletes_collect_bank_account
|
|
21
|
+
attr_reader :country_code
|
|
22
|
+
attr_reader :icon_url
|
|
23
|
+
attr_reader :id
|
|
24
|
+
attr_reader :limits
|
|
25
|
+
attr_reader :logo_url
|
|
26
|
+
attr_reader :name
|
|
27
|
+
attr_reader :status
|
|
21
28
|
|
|
22
29
|
# Initialize a institution resource instance
|
|
23
30
|
# @param object [Hash] an object returned from the API
|
|
@@ -11,7 +11,8 @@ module GoCardlessPro
|
|
|
11
11
|
# Represents an instance of a logo resource returned from the API
|
|
12
12
|
|
|
13
13
|
# Logos are image uploads that, when associated with a creditor, are shown
|
|
14
|
-
# on the
|
|
14
|
+
# on the billing request flow
|
|
15
|
+
# (https://developer.gocardless.com/api-reference/#billing-requests-billing-request-flows)
|
|
15
16
|
# payment pages.
|
|
16
17
|
class Logo
|
|
17
18
|
attr_reader :id
|
|
@@ -10,14 +10,28 @@ module GoCardlessPro
|
|
|
10
10
|
module Resources
|
|
11
11
|
# Represents an instance of a mandate resource returned from the API
|
|
12
12
|
|
|
13
|
-
# Mandates represent the Direct Debit mandate with a
|
|
14
|
-
#
|
|
13
|
+
# Mandates represent the Direct Debit mandate with a customer
|
|
14
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-customers).
|
|
15
15
|
#
|
|
16
|
-
# GoCardless will notify you via a
|
|
17
|
-
#
|
|
16
|
+
# GoCardless will notify you via a webhook
|
|
17
|
+
# (https://developer.gocardless.com/api-reference/#appendix-webhooks)
|
|
18
|
+
# whenever the status of a mandate changes.
|
|
18
19
|
class Mandate
|
|
19
|
-
attr_reader :authorisation_source
|
|
20
|
-
|
|
20
|
+
attr_reader :authorisation_source
|
|
21
|
+
attr_reader :consent_parameters
|
|
22
|
+
attr_reader :consent_type
|
|
23
|
+
attr_reader :created_at
|
|
24
|
+
attr_reader :funds_settlement
|
|
25
|
+
attr_reader :id
|
|
26
|
+
attr_reader :mandate_type
|
|
27
|
+
attr_reader :metadata
|
|
28
|
+
attr_reader :next_possible_charge_date
|
|
29
|
+
attr_reader :next_possible_standard_ach_charge_date
|
|
30
|
+
attr_reader :payments_require_approval
|
|
31
|
+
attr_reader :reference
|
|
32
|
+
attr_reader :scheme
|
|
33
|
+
attr_reader :status
|
|
34
|
+
attr_reader :verified_at
|
|
21
35
|
|
|
22
36
|
# Initialize a mandate resource instance
|
|
23
37
|
# @param object [Hash] an object returned from the API
|
|
@@ -31,6 +45,7 @@ module GoCardlessPro
|
|
|
31
45
|
@funds_settlement = object['funds_settlement']
|
|
32
46
|
@id = object['id']
|
|
33
47
|
@links = object['links']
|
|
48
|
+
@mandate_type = object['mandate_type']
|
|
34
49
|
@metadata = object['metadata']
|
|
35
50
|
@next_possible_charge_date = object['next_possible_charge_date']
|
|
36
51
|
@next_possible_standard_ach_charge_date = object['next_possible_standard_ach_charge_date']
|
|
@@ -16,16 +16,19 @@ module GoCardlessPro
|
|
|
16
16
|
#
|
|
17
17
|
# The process is as follows:
|
|
18
18
|
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
#
|
|
19
|
+
# 1. Create a mandate import
|
|
20
|
+
# (https://developer.gocardless.com/api-reference/#mandate-imports-create-a-new-mandate-import)
|
|
21
|
+
# 2. Add entries
|
|
22
|
+
# (https://developer.gocardless.com/api-reference/#mandate-import-entries-add-a-mandate-import-entry)
|
|
23
|
+
# to the import
|
|
24
|
+
# 3. Submit
|
|
25
|
+
# (https://developer.gocardless.com/api-reference/#mandate-imports-submit-a-mandate-import)
|
|
22
26
|
# the import
|
|
23
|
-
#
|
|
24
|
-
# 4. Wait until a member of the GoCardless team approves the import, at
|
|
27
|
+
# 4. Wait until a member of the GoCardless team approves the import, at
|
|
25
28
|
# which point the mandates will be created
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
# system
|
|
29
|
+
# 5. Link up the mandates
|
|
30
|
+
# (https://developer.gocardless.com/api-reference/#mandate-import-entries-list-all-mandate-import-entries)
|
|
31
|
+
# in your system
|
|
29
32
|
#
|
|
30
33
|
# When you add entries to your mandate import, they are not turned into
|
|
31
34
|
# actual mandates
|
|
@@ -36,24 +39,28 @@ module GoCardlessPro
|
|
|
36
39
|
#
|
|
37
40
|
# We will issue a `mandate_created` webhook for each entry, which will be
|
|
38
41
|
# the same as the webhooks
|
|
39
|
-
# triggered when
|
|
40
|
-
#
|
|
42
|
+
# triggered when creating a mandate
|
|
43
|
+
# (https://developer.gocardless.com/api-reference/#mandates-create-a-mandate)
|
|
44
|
+
# using the mandates API. Once these
|
|
41
45
|
# webhooks start arriving, any reconciliation can now be accomplished by
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
#
|
|
45
|
-
# system
|
|
46
|
+
# checking the current status
|
|
47
|
+
# (https://developer.gocardless.com/api-reference/#mandate-imports-get-a-mandate-import)
|
|
48
|
+
# of the mandate import and
|
|
49
|
+
# linking up the mandates to your system
|
|
50
|
+
# (https://developer.gocardless.com/api-reference/#mandate-import-entries-list-all-mandate-import-entries).
|
|
46
51
|
#
|
|
47
|
-
#
|
|
48
|
-
#
|
|
49
|
-
#
|
|
52
|
+
# Note that all Mandate Imports have an upper limit of 30,000 entries, so we
|
|
53
|
+
# recommend you split your import into several smaller imports if you're
|
|
54
|
+
# planning to exceed this threshold.
|
|
50
55
|
#
|
|
51
|
-
#
|
|
52
|
-
#
|
|
53
|
-
#
|
|
54
|
-
# use this API.</p>
|
|
56
|
+
# Restricted: This API is currently only available for approved integrators
|
|
57
|
+
# - please get in touch (mailto:help@gocardless.com) if you would like to
|
|
58
|
+
# use this API.
|
|
55
59
|
class MandateImport
|
|
56
|
-
attr_reader :created_at
|
|
60
|
+
attr_reader :created_at
|
|
61
|
+
attr_reader :id
|
|
62
|
+
attr_reader :scheme
|
|
63
|
+
attr_reader :status
|
|
57
64
|
|
|
58
65
|
# Initialize a mandate_import resource instance
|
|
59
66
|
# @param object [Hash] an object returned from the API
|
|
@@ -10,38 +10,37 @@ module GoCardlessPro
|
|
|
10
10
|
module Resources
|
|
11
11
|
# Represents an instance of a mandate_import_entry resource returned from the API
|
|
12
12
|
|
|
13
|
-
# Mandate Import Entries are added to a
|
|
14
|
-
#
|
|
13
|
+
# Mandate Import Entries are added to a Mandate Import
|
|
14
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-mandate-imports).
|
|
15
15
|
# Each entry corresponds to one mandate to be imported into GoCardless.
|
|
16
16
|
#
|
|
17
17
|
# To import a mandate you will need:
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
#
|
|
22
|
-
#
|
|
23
|
-
# details
|
|
24
|
-
# <li>Amendment details (SEPA only)</li>
|
|
25
|
-
# </ol>
|
|
18
|
+
#
|
|
19
|
+
# 1. Identifying information about the customer (name/company and address)
|
|
20
|
+
# 2. Bank account details, consisting of an account holder name and
|
|
21
|
+
# either an IBAN or local bank details
|
|
22
|
+
# (https://developer.gocardless.com/api-reference/#appendix-local-bank-details)
|
|
23
|
+
# 3. Amendment details (SEPA only)
|
|
26
24
|
#
|
|
27
25
|
# We suggest you provide a `record_identifier` (which is unique within the
|
|
28
26
|
# context of a
|
|
29
27
|
# single mandate import) to help you to identify mandates that have been
|
|
30
28
|
# created once the
|
|
31
29
|
# import has been processed by GoCardless. You can
|
|
32
|
-
#
|
|
33
|
-
#
|
|
30
|
+
# list the mandate import entries
|
|
31
|
+
# (https://developer.gocardless.com/api-reference/#mandate-import-entries-list-all-mandate-import-entries),
|
|
34
32
|
# match them up in your system using the `record_identifier`, and look at
|
|
35
33
|
# the `links`
|
|
36
34
|
# fields to find the mandate, customer and customer bank account that have
|
|
37
35
|
# been imported.
|
|
38
36
|
#
|
|
39
|
-
#
|
|
40
|
-
#
|
|
41
|
-
#
|
|
42
|
-
# use this API.</p>
|
|
37
|
+
# Restricted: This API is currently only available for approved integrators
|
|
38
|
+
# - please get in touch (mailto:help@gocardless.com) if you would like to
|
|
39
|
+
# use this API.
|
|
43
40
|
class MandateImportEntry
|
|
44
|
-
attr_reader :created_at
|
|
41
|
+
attr_reader :created_at
|
|
42
|
+
attr_reader :processing_errors
|
|
43
|
+
attr_reader :record_identifier
|
|
45
44
|
|
|
46
45
|
# Initialize a mandate_import_entry resource instance
|
|
47
46
|
# @param object [Hash] an object returned from the API
|
|
@@ -10,11 +10,12 @@ module GoCardlessPro
|
|
|
10
10
|
module Resources
|
|
11
11
|
# Represents an instance of a mandate_pdf resource returned from the API
|
|
12
12
|
|
|
13
|
-
# Mandate PDFs allow you to easily display
|
|
14
|
-
#
|
|
15
|
-
# your customers.
|
|
13
|
+
# Mandate PDFs allow you to easily display scheme-rules compliant
|
|
14
|
+
# (https://developer.gocardless.com/api-reference/#appendix-compliance-requirements)
|
|
15
|
+
# Direct Debit mandates to your customers.
|
|
16
16
|
class MandatePdf
|
|
17
|
-
attr_reader :expires_at
|
|
17
|
+
attr_reader :expires_at
|
|
18
|
+
attr_reader :url
|
|
18
19
|
|
|
19
20
|
# Initialize a mandate_pdf resource instance
|
|
20
21
|
# @param object [Hash] an object returned from the API
|
|
@@ -14,9 +14,11 @@ module GoCardlessPro
|
|
|
14
14
|
# which refunds are not permitted. The default limit is zero — refunds are
|
|
15
15
|
# not permitted if the creditor has a negative balance. The limit can be
|
|
16
16
|
# changed on a per-creditor basis.
|
|
17
|
-
#
|
|
18
17
|
class NegativeBalanceLimit
|
|
19
|
-
attr_reader :balance_limit
|
|
18
|
+
attr_reader :balance_limit
|
|
19
|
+
attr_reader :created_at
|
|
20
|
+
attr_reader :currency
|
|
21
|
+
attr_reader :id
|
|
20
22
|
|
|
21
23
|
# Initialize a negative_balance_limit resource instance
|
|
22
24
|
# @param object [Hash] an object returned from the API
|
|
@@ -10,21 +10,38 @@ module GoCardlessPro
|
|
|
10
10
|
module Resources
|
|
11
11
|
# Represents an instance of a outbound_payment resource returned from the API
|
|
12
12
|
|
|
13
|
-
# Outbound Payments represent payments sent from
|
|
14
|
-
#
|
|
13
|
+
# Outbound Payments represent payments sent from creditors
|
|
14
|
+
# (https://developer.gocardless.com/api-reference/#core-endpoints-creditors).
|
|
15
15
|
#
|
|
16
|
-
# GoCardless will notify you via a
|
|
17
|
-
#
|
|
16
|
+
# GoCardless will notify you via a webhook
|
|
17
|
+
# (https://developer.gocardless.com/api-reference/#appendix-webhooks) when
|
|
18
|
+
# the status of the outbound payment changes
|
|
19
|
+
# (https://developer.gocardless.com/api-reference/#event-types-outbound-payment).
|
|
18
20
|
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
#
|
|
22
|
-
#
|
|
23
|
-
#
|
|
24
|
-
#
|
|
21
|
+
# ####Rate limiting
|
|
22
|
+
#
|
|
23
|
+
# Two rate limits apply to the Outbound Payments APIs:
|
|
24
|
+
#
|
|
25
|
+
# - All POST Outbound Payment endpoints (create, withdraw, approve, cancel
|
|
26
|
+
# and etc.) share a single rate-limit group of 300 requests per minute. As
|
|
27
|
+
# initiating a payment typically requires two API calls (one to create the
|
|
28
|
+
# payment and one to approve it), this allows you to add approximately 150
|
|
29
|
+
# outbound payments per minute.
|
|
30
|
+
# - All remaining Outbound Payment endpoints are limited to 500 requests per
|
|
31
|
+
# minute.
|
|
25
32
|
class OutboundPayment
|
|
26
|
-
attr_reader :amount
|
|
27
|
-
|
|
33
|
+
attr_reader :amount
|
|
34
|
+
attr_reader :created_at
|
|
35
|
+
attr_reader :currency
|
|
36
|
+
attr_reader :description
|
|
37
|
+
attr_reader :execution_date
|
|
38
|
+
attr_reader :id
|
|
39
|
+
attr_reader :is_withdrawal
|
|
40
|
+
attr_reader :metadata
|
|
41
|
+
attr_reader :reference
|
|
42
|
+
attr_reader :scheme
|
|
43
|
+
attr_reader :status
|
|
44
|
+
attr_reader :verifications
|
|
28
45
|
|
|
29
46
|
# Initialize a outbound_payment resource instance
|
|
30
47
|
# @param object [Hash] an object returned from the API
|
|
@@ -74,6 +91,10 @@ module GoCardlessPro
|
|
|
74
91
|
@links['customer']
|
|
75
92
|
end
|
|
76
93
|
|
|
94
|
+
def outbound_payment_import
|
|
95
|
+
@links['outbound_payment_import']
|
|
96
|
+
end
|
|
97
|
+
|
|
77
98
|
def recipient_bank_account
|
|
78
99
|
@links['recipient_bank_account']
|
|
79
100
|
end
|
|
@@ -0,0 +1,81 @@
|
|
|
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 resource returned from the API
|
|
12
|
+
|
|
13
|
+
# Outbound Payment Imports allow you to create multiple payments via a
|
|
14
|
+
# single API call.
|
|
15
|
+
#
|
|
16
|
+
# The Workflow:
|
|
17
|
+
#
|
|
18
|
+
# 1. Create the outbound payment import.
|
|
19
|
+
# 2. Retrieve an authorisation link from the response.
|
|
20
|
+
# 3. Redirect the user to the link to authorise the import.
|
|
21
|
+
# 4. Once the user authorises the import, the individual outbound payments
|
|
22
|
+
# are automatically submitted.
|
|
23
|
+
#
|
|
24
|
+
# Import entries are not processed as actual payments until they are
|
|
25
|
+
# reviewed and authorised in GoCardless Dashboard.
|
|
26
|
+
# Upon approval, a unique outbound payment is generated for every entry in
|
|
27
|
+
# the import.
|
|
28
|
+
#
|
|
29
|
+
# Outbound Payment Imports are capped at 1000 entries. If you expect to
|
|
30
|
+
# exceed this limit, please create multiple smaller imports.
|
|
31
|
+
class OutboundPaymentImport
|
|
32
|
+
attr_reader :amount_sum
|
|
33
|
+
attr_reader :authorisation_url
|
|
34
|
+
attr_reader :created_at
|
|
35
|
+
attr_reader :currency
|
|
36
|
+
attr_reader :entry_counts
|
|
37
|
+
attr_reader :id
|
|
38
|
+
attr_reader :status
|
|
39
|
+
|
|
40
|
+
# Initialize a outbound_payment_import resource instance
|
|
41
|
+
# @param object [Hash] an object returned from the API
|
|
42
|
+
def initialize(object, response = nil)
|
|
43
|
+
@object = object
|
|
44
|
+
|
|
45
|
+
@amount_sum = object['amount_sum']
|
|
46
|
+
@authorisation_url = object['authorisation_url']
|
|
47
|
+
@created_at = object['created_at']
|
|
48
|
+
@currency = object['currency']
|
|
49
|
+
@entry_counts = object['entry_counts']
|
|
50
|
+
@id = object['id']
|
|
51
|
+
@links = object['links']
|
|
52
|
+
@status = object['status']
|
|
53
|
+
@response = response
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def api_response
|
|
57
|
+
ApiResponse.new(@response)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Return the links that the resource has
|
|
61
|
+
def links
|
|
62
|
+
@outbound_payment_import_links ||= Links.new(@links)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Provides the outbound_payment_import resource as a hash of all its readable attributes
|
|
66
|
+
def to_h
|
|
67
|
+
@object
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
class Links
|
|
71
|
+
def initialize(links)
|
|
72
|
+
@links = links || {}
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def creditor
|
|
76
|
+
@links['creditor']
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|