gocardless_pro 4.3.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.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -0
  3. data/lib/gocardless_pro/client.rb +11 -1
  4. data/lib/gocardless_pro/list_response.rb +2 -2
  5. data/lib/gocardless_pro/resources/billing_request.rb +7 -8
  6. data/lib/gocardless_pro/resources/billing_request_with_action.rb +4 -4
  7. data/lib/gocardless_pro/resources/block.rb +4 -6
  8. data/lib/gocardless_pro/resources/creditor.rb +6 -4
  9. data/lib/gocardless_pro/resources/creditor_bank_account.rb +6 -5
  10. data/lib/gocardless_pro/resources/customer.rb +4 -3
  11. data/lib/gocardless_pro/resources/customer_bank_account.rb +13 -8
  12. data/lib/gocardless_pro/resources/customer_notification.rb +3 -4
  13. data/lib/gocardless_pro/resources/event.rb +13 -2
  14. data/lib/gocardless_pro/resources/export.rb +2 -0
  15. data/lib/gocardless_pro/resources/instalment_schedule.rb +0 -1
  16. data/lib/gocardless_pro/resources/institution.rb +3 -3
  17. data/lib/gocardless_pro/resources/logo.rb +2 -1
  18. data/lib/gocardless_pro/resources/mandate.rb +7 -4
  19. data/lib/gocardless_pro/resources/mandate_import.rb +25 -21
  20. data/lib/gocardless_pro/resources/mandate_import_entry.rb +13 -16
  21. data/lib/gocardless_pro/resources/mandate_pdf.rb +3 -3
  22. data/lib/gocardless_pro/resources/negative_balance_limit.rb +0 -1
  23. data/lib/gocardless_pro/resources/outbound_payment.rb +11 -4
  24. data/lib/gocardless_pro/resources/outbound_payment_import.rb +81 -0
  25. data/lib/gocardless_pro/resources/outbound_payment_import_entry.rb +77 -0
  26. data/lib/gocardless_pro/resources/payer_authorisation.rb +27 -31
  27. data/lib/gocardless_pro/resources/payment.rb +9 -6
  28. data/lib/gocardless_pro/resources/payment_account.rb +2 -1
  29. data/lib/gocardless_pro/resources/payment_account_transaction.rb +2 -1
  30. data/lib/gocardless_pro/resources/payout.rb +7 -6
  31. data/lib/gocardless_pro/resources/payout_item.rb +1 -2
  32. data/lib/gocardless_pro/resources/redirect_flow.rb +34 -23
  33. data/lib/gocardless_pro/resources/refund.rb +8 -6
  34. data/lib/gocardless_pro/resources/scheme_identifier.rb +0 -1
  35. data/lib/gocardless_pro/resources/subscription.rb +17 -14
  36. data/lib/gocardless_pro/resources/tax_rate.rb +2 -2
  37. data/lib/gocardless_pro/resources/verification_detail.rb +10 -6
  38. data/lib/gocardless_pro/services/balances_service.rb +11 -3
  39. data/lib/gocardless_pro/services/bank_account_details_service.rb +10 -4
  40. data/lib/gocardless_pro/services/bank_account_holder_verifications_service.rb +7 -1
  41. data/lib/gocardless_pro/services/bank_authorisations_service.rb +7 -1
  42. data/lib/gocardless_pro/services/bank_details_lookups_service.rb +14 -6
  43. data/lib/gocardless_pro/services/billing_request_flows_service.rb +7 -1
  44. data/lib/gocardless_pro/services/billing_request_templates_service.rb +10 -3
  45. data/lib/gocardless_pro/services/billing_request_with_actions_service.rb +7 -1
  46. data/lib/gocardless_pro/services/billing_requests_service.rb +18 -13
  47. data/lib/gocardless_pro/services/blocks_service.rb +10 -3
  48. data/lib/gocardless_pro/services/creditor_bank_accounts_service.rb +10 -3
  49. data/lib/gocardless_pro/services/creditors_service.rb +10 -3
  50. data/lib/gocardless_pro/services/currency_exchange_rates_service.rb +10 -3
  51. data/lib/gocardless_pro/services/customer_bank_accounts_service.rb +20 -10
  52. data/lib/gocardless_pro/services/customer_notifications_service.rb +7 -2
  53. data/lib/gocardless_pro/services/customers_service.rb +11 -5
  54. data/lib/gocardless_pro/services/events_service.rb +15 -3
  55. data/lib/gocardless_pro/services/exports_service.rb +7 -1
  56. data/lib/gocardless_pro/services/funds_availabilities_service.rb +7 -1
  57. data/lib/gocardless_pro/services/instalment_schedules_service.rb +15 -7
  58. data/lib/gocardless_pro/services/institutions_service.rb +7 -1
  59. data/lib/gocardless_pro/services/logos_service.rb +9 -3
  60. data/lib/gocardless_pro/services/mandate_import_entries_service.rb +10 -4
  61. data/lib/gocardless_pro/services/mandate_imports_service.rb +10 -2
  62. data/lib/gocardless_pro/services/mandate_pdfs_service.rb +11 -5
  63. data/lib/gocardless_pro/services/mandates_service.rb +16 -9
  64. data/lib/gocardless_pro/services/negative_balance_limits_service.rb +10 -3
  65. data/lib/gocardless_pro/services/outbound_payment_import_entries_service.rb +64 -0
  66. data/lib/gocardless_pro/services/outbound_payment_imports_service.rb +118 -0
  67. data/lib/gocardless_pro/services/outbound_payments_service.rb +11 -4
  68. data/lib/gocardless_pro/services/payer_authorisations_service.rb +11 -8
  69. data/lib/gocardless_pro/services/payer_themes_service.rb +7 -1
  70. data/lib/gocardless_pro/services/payment_account_transactions_service.rb +34 -7
  71. data/lib/gocardless_pro/services/payment_accounts_service.rb +10 -3
  72. data/lib/gocardless_pro/services/payments_service.rb +22 -14
  73. data/lib/gocardless_pro/services/payout_items_service.rb +12 -7
  74. data/lib/gocardless_pro/services/payouts_service.rb +12 -5
  75. data/lib/gocardless_pro/services/redirect_flows_service.rb +15 -5
  76. data/lib/gocardless_pro/services/refunds_service.rb +15 -10
  77. data/lib/gocardless_pro/services/scenario_simulators_service.rb +85 -82
  78. data/lib/gocardless_pro/services/scheme_identifiers_service.rb +13 -7
  79. data/lib/gocardless_pro/services/subscriptions_service.rb +48 -38
  80. data/lib/gocardless_pro/services/tax_rates_service.rb +10 -3
  81. data/lib/gocardless_pro/services/transferred_mandates_service.rb +7 -1
  82. data/lib/gocardless_pro/services/verification_details_service.rb +7 -1
  83. data/lib/gocardless_pro/services/webhooks_service.rb +10 -3
  84. data/lib/gocardless_pro/version.rb +1 -1
  85. data/lib/gocardless_pro/webhook.rb +45 -0
  86. data/lib/gocardless_pro.rb +6 -0
  87. metadata +7 -7
@@ -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
@@ -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
- # <p class="restricted-notice">
13
+ #
14
14
  # Don't use Payer Authorisations for new integrations.
15
- # It is deprecated in favour of
16
- # <a
17
- # href="https://developer.gocardless.com/getting-started/billing-requests/overview/">
18
- # Billing Requests</a>. Use Billing Requests to build any future
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,48 +25,45 @@ module GoCardlessPro
26
25
  #
27
26
  # The process to use the Payer Authorisation API is as follows:
28
27
  #
29
- # 1. Create a Payer Authorisation, either empty or with already available
28
+ # 1. Create a Payer Authorisation, either empty or with already available
30
29
  # information
31
- # 2. Update the authorisation with additional information or fix any
30
+ # 2. Update the authorisation with additional information or fix any
32
31
  # mistakes
33
- # 3. Submit the authorisation, after the payer has reviewed their
32
+ # 3. Submit the authorisation, after the payer has reviewed their
34
33
  # information
35
- # 4. [coming soon] Redirect the payer to the verification mechanisms from
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
- # 5. Confirm the authorisation to indicate that the resources can be
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
- # <p class="notice">
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
- # other existing `create` and `update` endpoints. The Payer Authorisation
60
- # is still saved if incomplete data is provided.
61
- # We return the list of incomplete data in the `incomplete_fields` along
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
- # The bank account details(account_number, bank_code & branch_code) must
64
- # be sent together rather than splitting across different request for both
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
- # <br><br>
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
68
  attr_reader :bank_account
73
69
  attr_reader :created_at
@@ -10,13 +10,16 @@ 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
- # [customer](#core-endpoints-customers) to a
15
- # [creditor](#core-endpoints-creditors), taken against a Direct Debit
16
- # [mandate](#core-endpoints-mandates).
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 [webhook](#appendix-webhooks) whenever
19
- # the state of a payment changes.
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
24
  attr_reader :amount
22
25
  attr_reader :amount_refunded
@@ -11,7 +11,8 @@ module GoCardlessPro
11
11
  # Represents an instance of a payment_account resource returned from the API
12
12
 
13
13
  # Access the details of bank accounts provided for you by GoCardless that
14
- # are used to fund [Outbound Payments](#core-endpoints-outbound-payments).
14
+ # are used to fund Outbound Payments
15
+ # (https://developer.gocardless.com/api-reference/#core-endpoints-outbound-payments).
15
16
  class PaymentAccount
16
17
  attr_reader :account_balance
17
18
  attr_reader :account_holder_name
@@ -12,7 +12,8 @@ module GoCardlessPro
12
12
 
13
13
  # Payment account transactions represent movements of funds on a given
14
14
  # payment account. The payment account is provisioned by GoCardless and is
15
- # used to fund [outbound payments](#core-endpoints-outbound-payments).
15
+ # used to fund outbound payments
16
+ # (https://developer.gocardless.com/api-reference/#core-endpoints-outbound-payments).
16
17
  class PaymentAccountTransaction
17
18
  attr_reader :amount
18
19
  attr_reader :balance_after_transaction
@@ -10,12 +10,13 @@ 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
- # [creditor](#core-endpoints-creditors). Each payout contains the funds
15
- # collected from one or many [payments](#core-endpoints-payments). All the
16
- # payments in a payout will have been collected in the same currency.
17
- # Payouts are created automatically after a payment has been successfully
18
- # collected.
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
21
  attr_reader :amount
21
22
  attr_reader :arrival_date
@@ -30,8 +30,7 @@ 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
- # <code>410 Gone</code>.
34
- #
33
+ # 410 Gone.
35
34
  class PayoutItem
36
35
  attr_reader :amount
37
36
  attr_reader :taxes
@@ -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
- # <p class="deprecated-notice"><strong>Deprecated</strong>: Redirect Flows
14
- # are legacy APIs and cannot be used by new integrators.
15
- # The [Billing Request flow](#billing-requests) API should be used for
16
- # your payment flows.</p>
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' [hosted payment
19
- # pages](https://pay-sandbox.gocardless.com/AL000000AKFPFF) to set up
20
- # mandates with your customers. These pages are fully compliant and have
21
- # been translated into Danish, Dutch, French, German, Italian, Norwegian,
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. You [create](#redirect-flows-create-a-redirect-flow) a redirect flow
27
- # for your customer, and redirect them to the returned redirect url, e.g.
28
- # `https://pay.gocardless.com/flow/RE123`.
29
- #
30
- # 2. Your customer supplies their name, email, address, and bank account
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
- # 3. You [complete](#redirect-flows-complete-a-redirect-flow) the redirect
36
- # flow, which creates a [customer](#core-endpoints-customers), [customer
37
- # bank account](#core-endpoints-customer-bank-accounts), and
38
- # [mandate](#core-endpoints-mandates), and returns the ID of the mandate.
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
  #
@@ -10,13 +10,15 @@ 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
- # [payment](#core-endpoints-payments) back to the
15
- # [customer](#core-endpoints-customers).
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 [webhook](#appendix-webhooks) whenever a
18
- # refund is created, and will update the `amount_refunded` property of the
19
- # payment.
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
23
  attr_reader :amount
22
24
  attr_reader :created_at
@@ -13,7 +13,6 @@ 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
17
  attr_reader :address_line1
19
18
  attr_reader :address_line2
@@ -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 [payments](#core-endpoints-payments) according to a
14
- # schedule.
13
+ # Subscriptions create payments
14
+ # (https://developer.gocardless.com/api-reference/#core-endpoints-payments)
15
+ # according to a schedule.
15
16
  #
16
- # ### Recurrence Rules
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 [mandate](#core-endpoints-mandates)'s `next_possible_charge_date` and
22
- # the subscription will then recur based on the `interval` & `interval_unit`
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
- # | __interval_unit__ | __month__ |
27
- # __day_of_month__ |
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
- # | __interval_unit__ | __interval__ | __month__ | __day_of_month__ | valid?
40
- # |
42
+ # | interval_unit | interval | month | day_of_month | valid?
43
+ # |
41
44
  # | :---------------- | :----------- | :-------- | :--------------- |
42
45
  # :------------------------------------------------- |
43
46
  # | yearly | 1 | january | -1 | valid
@@ -57,16 +60,16 @@ module GoCardlessPro
57
60
  # | weekly | 2 | october | 10 |
58
61
  # invalid - `month` and `day_of_month` must be blank |
59
62
  #
60
- # ### Rolling dates
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 __backwards__ to the previous business day (i.e., the
67
- # last working day of the month).
68
- # - otherwise the charge date will be rolled __forwards__ to the next
69
- # business day.
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
74
  attr_reader :amount
72
75
  attr_reader :app_fee
@@ -12,8 +12,8 @@ module GoCardlessPro
12
12
 
13
13
  # Tax rates from tax authority.
14
14
  #
15
- # We also maintain a [static list of the tax rates for each
16
- # jurisdiction](#appendix-tax-rates).
15
+ # We also maintain a static list of the tax rates for each jurisdiction
16
+ # (https://developer.gocardless.com/api-reference/#appendix-tax-rates).
17
17
  class TaxRate
18
18
  attr_reader :end_date
19
19
  attr_reader :id
@@ -13,24 +13,26 @@ module GoCardlessPro
13
13
  # Verification details represent any information needed by GoCardless to
14
14
  # verify a creditor.
15
15
  #
16
- # <p class="restricted-notice"><strong>Restricted</strong>:
17
- # These endpoints are restricted to customers who want to collect their
16
+ # Restricted:
17
+ # These endpoints are restricted to customers who want to collect their
18
18
  # merchant's
19
- # verification details and pass them to GoCardless via our API. Please
20
- # [get in
21
- # touch](mailto:help@gocardless.com) if you wish to enable this feature on
19
+ # verification details and pass them to GoCardless via our API. Please get
20
+ # in
21
+ # touch (mailto:help@gocardless.com) if you wish to enable this feature on
22
22
  # your
23
- # account.</p>
23
+ # account.
24
24
  class VerificationDetail
25
25
  attr_reader :address_line1
26
26
  attr_reader :address_line2
27
27
  attr_reader :address_line3
28
28
  attr_reader :city
29
29
  attr_reader :company_number
30
+ attr_reader :country_code
30
31
  attr_reader :description
31
32
  attr_reader :directors
32
33
  attr_reader :name
33
34
  attr_reader :postal_code
35
+ attr_reader :region
34
36
 
35
37
  # Initialize a verification_detail resource instance
36
38
  # @param object [Hash] an object returned from the API
@@ -42,11 +44,13 @@ module GoCardlessPro
42
44
  @address_line3 = object['address_line3']
43
45
  @city = object['city']
44
46
  @company_number = object['company_number']
47
+ @country_code = object['country_code']
45
48
  @description = object['description']
46
49
  @directors = object['directors']
47
50
  @links = object['links']
48
51
  @name = object['name']
49
52
  @postal_code = object['postal_code']
53
+ @region = object['region']
50
54
  @response = response
51
55
  end
52
56
 
@@ -10,8 +10,10 @@ module GoCardlessPro
10
10
  module Services
11
11
  # Service for making requests to the Balance endpoints
12
12
  class BalancesService < BaseService
13
- # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of balances
14
- # for a given creditor. This endpoint is rate limited to 60 requests per minute.
13
+ # Returns a cursor-paginated
14
+ # (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
15
+ # list of balances for a given creditor. This endpoint is rate limited to 60
16
+ # requests per minute.
15
17
  # Example URL: /balances
16
18
  # @param options [Hash] parameters as a hash, under a params key.
17
19
  def list(options = {})
@@ -45,7 +47,13 @@ module GoCardlessPro
45
47
  #
46
48
  # @param body [Hash]
47
49
  def unenvelope_body(body)
48
- body[envelope_key] || body['data']
50
+ if body.key?(envelope_key)
51
+ body[envelope_key]
52
+ elsif body.key?('data')
53
+ body['data']
54
+ else
55
+ body
56
+ end
49
57
  end
50
58
 
51
59
  # return the key which API responses will envelope data under
@@ -13,9 +13,9 @@ module GoCardlessPro
13
13
  # Returns bank account details in the flattened JSON Web Encryption format
14
14
  # described in RFC 7516.
15
15
  #
16
- # You must specify a `Gc-Key-Id` header when using this endpoint. See [Public
17
- # Key
18
- # Setup](https://developer.gocardless.com/gc-embed/bank-details-access#public_key_setup)
16
+ # You must specify a `Gc-Key-Id` header when using this endpoint. See Public Key
17
+ # Setup
18
+ # (https://developer.gocardless.com/gc-embed/bank-details-access#public_key_setup)
19
19
  # for more details.
20
20
  # Example URL: /bank_account_details/:identity
21
21
  #
@@ -41,7 +41,13 @@ module GoCardlessPro
41
41
  #
42
42
  # @param body [Hash]
43
43
  def unenvelope_body(body)
44
- body[envelope_key] || body['data']
44
+ if body.key?(envelope_key)
45
+ body[envelope_key]
46
+ elsif body.key?('data')
47
+ body['data']
48
+ else
49
+ body
50
+ end
45
51
  end
46
52
 
47
53
  # return the key which API responses will envelope data under
@@ -74,7 +74,13 @@ module GoCardlessPro
74
74
  #
75
75
  # @param body [Hash]
76
76
  def unenvelope_body(body)
77
- body[envelope_key] || body['data']
77
+ if body.key?(envelope_key)
78
+ body[envelope_key]
79
+ elsif body.key?('data')
80
+ body['data']
81
+ else
82
+ body
83
+ end
78
84
  end
79
85
 
80
86
  # return the key which API responses will envelope data under
@@ -70,7 +70,13 @@ module GoCardlessPro
70
70
  #
71
71
  # @param body [Hash]
72
72
  def unenvelope_body(body)
73
- body[envelope_key] || body['data']
73
+ if body.key?(envelope_key)
74
+ body[envelope_key]
75
+ elsif body.key?('data')
76
+ body['data']
77
+ else
78
+ body
79
+ end
74
80
  end
75
81
 
76
82
  # return the key which API responses will envelope data under