From 63f7309be53a5485d5a87e25e6133fdb37db7bae Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Wed, 13 May 2026 09:20:51 +0000 Subject: [PATCH 1/5] Changes generated by fe5b9706d5cd471e209b7dbeb90ac9927ef6da5d This commit was automatically created from gocardless/client-library-templates@fe5b9706d5cd471e209b7dbeb90ac9927ef6da5d by the `push-files` action. Workflow run: https://github.com/gocardless/client-library-templates/actions/runs/25789979725 --- .../com/gocardless/resources/CustomerBankAccount.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/gocardless/resources/CustomerBankAccount.java b/src/main/java/com/gocardless/resources/CustomerBankAccount.java index ee7d762d..e064d414 100644 --- a/src/main/java/com/gocardless/resources/CustomerBankAccount.java +++ b/src/main/java/com/gocardless/resources/CustomerBankAccount.java @@ -36,6 +36,7 @@ private CustomerBankAccount() { private String id; private Links links; private Map metadata; + private Boolean trustedRecipient; /** * Name of the account holder, as known by the bank. The full name provided when the customer is @@ -129,6 +130,14 @@ public Map getMetadata() { return metadata; } + /** + * Whether this customer bank account is registered as a trusted recipient for Outbound + * Payments. Only present when the feature is enabled for the organisation. + */ + public Boolean getTrustedRecipient() { + return trustedRecipient; + } + public enum AccountType { @SerializedName("savings") SAVINGS, @SerializedName("checking") From 2430cc8de78ac0ff253e84d6b4d4e62a471f4475 Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Thu, 14 May 2026 13:46:59 +0000 Subject: [PATCH 2/5] Changes generated by 6ca63e56bfca4f8ea6d5563c1df8ddc59404db3c This commit was automatically created from gocardless/client-library-templates@6ca63e56bfca4f8ea6d5563c1df8ddc59404db3c by the `push-files` action. Workflow run: https://github.com/gocardless/client-library-templates/actions/runs/25863477354 --- .../com/gocardless/resources/Balance.java | 2 +- .../gocardless/resources/BillingRequest.java | 22 ++++++----- .../resources/BillingRequestFlow.java | 2 +- .../resources/BillingRequestTemplate.java | 14 ++++--- .../resources/BillingRequestWithAction.java | 22 ++++++----- .../com/gocardless/resources/Creditor.java | 12 +++--- .../resources/CreditorBankAccount.java | 4 +- .../com/gocardless/resources/Customer.java | 4 +- .../resources/CustomerBankAccount.java | 4 +- .../resources/InstalmentSchedule.java | 2 +- .../com/gocardless/resources/Institution.java | 2 +- .../resources/NegativeBalanceLimit.java | 2 +- .../gocardless/resources/OutboundPayment.java | 4 +- .../resources/OutboundPaymentImport.java | 4 +- .../resources/PayerAuthorisation.java | 6 +-- .../com/gocardless/resources/Payment.java | 4 +- .../gocardless/resources/PaymentAccount.java | 2 +- .../java/com/gocardless/resources/Payout.java | 11 +++--- .../com/gocardless/resources/PayoutItem.java | 4 +- .../java/com/gocardless/resources/Refund.java | 4 +- .../resources/SchemeIdentifier.java | 2 +- .../gocardless/resources/Subscription.java | 2 +- .../resources/VerificationDetail.java | 2 +- .../services/BankDetailsLookupService.java | 2 +- .../services/BillingRequestFlowService.java | 4 +- .../services/BillingRequestService.java | 38 ++++++++++--------- .../BillingRequestTemplateService.java | 20 ++++++---- .../BillingRequestWithActionService.java | 24 ++++++------ .../services/CreditorBankAccountService.java | 4 +- .../gocardless/services/CreditorService.java | 4 +- .../services/CustomerBankAccountService.java | 4 +- .../gocardless/services/CustomerService.java | 10 ++--- .../services/InstalmentScheduleService.java | 4 +- .../services/InstitutionService.java | 4 +- .../services/MandateImportEntryService.java | 12 +++--- .../services/MandatePdfService.java | 6 +-- .../services/NegativeBalanceLimitService.java | 2 +- .../services/OutboundPaymentService.java | 4 +- .../services/PayerAuthorisationService.java | 24 ++++++------ .../gocardless/services/PaymentService.java | 4 +- .../gocardless/services/PayoutService.java | 2 +- .../services/RedirectFlowService.java | 8 ++-- .../services/SubscriptionService.java | 2 +- .../services/VerificationDetailService.java | 2 +- 44 files changed, 168 insertions(+), 153 deletions(-) diff --git a/src/main/java/com/gocardless/resources/Balance.java b/src/main/java/com/gocardless/resources/Balance.java index ddab602e..782f46e4 100644 --- a/src/main/java/com/gocardless/resources/Balance.java +++ b/src/main/java/com/gocardless/resources/Balance.java @@ -49,7 +49,7 @@ public BalanceType getBalanceType() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public Currency getCurrency() { diff --git a/src/main/java/com/gocardless/resources/BillingRequest.java b/src/main/java/com/gocardless/resources/BillingRequest.java index 6650dfa6..32c6f714 100644 --- a/src/main/java/com/gocardless/resources/BillingRequest.java +++ b/src/main/java/com/gocardless/resources/BillingRequest.java @@ -495,7 +495,7 @@ public Integer getAppFee() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "USD" and "CAD" are supported. */ public String getCurrency() { @@ -894,7 +894,7 @@ public Constraints getConstraints() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. */ public String getCurrency() { return currency; @@ -1110,8 +1110,10 @@ public Alignment getAlignment() { } /** - * (Optional) The maximum number of payments that can be collected in this periodic - * limit. + * The maximum number of payments that can be collected in this periodic limit. + * _Note:_ Only supported for the PayTo scheme, where it is required. Providing this + * field for other VRP schemes will result in a validation error. + * */ public Integer getMaxPayments() { return maxPayments; @@ -1213,7 +1215,7 @@ public Integer getAppFee() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. `GBP` and + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. `GBP` and * `EUR` supported; `GBP` with your customers in the UK and for `EUR` with your customers in * supported Eurozone countries only. */ @@ -1407,7 +1409,7 @@ public String getId() { } /** - * [ISO 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. Used as the + * [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. Used as the * language for notification emails sent by GoCardless if your organisation does not * send its own (see [compliance requirements](#appendix-compliance-requirements)). * Currently only "en", "fr", "de", "pt", "es", "it", "nl", "da", "nb", "sl", "sv" are @@ -1503,7 +1505,7 @@ public String getBankName() { /** * [ISO 3166-1 alpha-2 - * code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). + * code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). * Defaults to the country code of the `iban` if supplied, otherwise is required. */ public String getCountryCode() { @@ -1519,7 +1521,7 @@ public String getCreatedAt() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. * Currently "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public String getCurrency() { @@ -1634,7 +1636,7 @@ public String getCity() { /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public String getCountryCode() { return countryCode; @@ -1760,7 +1762,7 @@ public Integer getCount() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "USD" and "CAD" are supported. */ public String getCurrency() { diff --git a/src/main/java/com/gocardless/resources/BillingRequestFlow.java b/src/main/java/com/gocardless/resources/BillingRequestFlow.java index 63e01714..77922702 100644 --- a/src/main/java/com/gocardless/resources/BillingRequestFlow.java +++ b/src/main/java/com/gocardless/resources/BillingRequestFlow.java @@ -309,7 +309,7 @@ public String getCompanyName() { /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public String getCountryCode() { return countryCode; diff --git a/src/main/java/com/gocardless/resources/BillingRequestTemplate.java b/src/main/java/com/gocardless/resources/BillingRequestTemplate.java index 8dcf681d..b58ef867 100644 --- a/src/main/java/com/gocardless/resources/BillingRequestTemplate.java +++ b/src/main/java/com/gocardless/resources/BillingRequestTemplate.java @@ -73,7 +73,7 @@ public MandateRequestConstraints getMandateRequestConstraints() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. */ public String getMandateRequestCurrency() { return mandateRequestCurrency; @@ -158,9 +158,9 @@ public String getPaymentRequestAmount() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. `GBP` and `EUR` - * supported; `GBP` with your customers in the UK and for `EUR` with your customers in supported - * Eurozone countries only. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. `GBP` and + * `EUR` supported; `GBP` with your customers in the UK and for `EUR` with your customers in + * supported Eurozone countries only. */ public String getPaymentRequestCurrency() { return paymentRequestCurrency; @@ -313,8 +313,10 @@ public Alignment getAlignment() { } /** - * (Optional) The maximum number of payments that can be collected in this periodic - * limit. + * The maximum number of payments that can be collected in this periodic limit. _Note:_ + * Only supported for the PayTo scheme, where it is required. Providing this field for + * other VRP schemes will result in a validation error. + * */ public Integer getMaxPayments() { return maxPayments; diff --git a/src/main/java/com/gocardless/resources/BillingRequestWithAction.java b/src/main/java/com/gocardless/resources/BillingRequestWithAction.java index dc1545f2..3c3b8f6f 100644 --- a/src/main/java/com/gocardless/resources/BillingRequestWithAction.java +++ b/src/main/java/com/gocardless/resources/BillingRequestWithAction.java @@ -697,7 +697,7 @@ public Integer getAppFee() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. * Currently "USD" and "CAD" are supported. */ public String getCurrency() { @@ -1098,7 +1098,7 @@ public Constraints getConstraints() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. */ public String getCurrency() { return currency; @@ -1319,8 +1319,10 @@ public Alignment getAlignment() { } /** - * (Optional) The maximum number of payments that can be collected in this - * periodic limit. + * The maximum number of payments that can be collected in this periodic limit. + * _Note:_ Only supported for the PayTo scheme, where it is required. Providing + * this field for other VRP schemes will result in a validation error. + * */ public Integer getMaxPayments() { return maxPayments; @@ -1422,7 +1424,7 @@ public Integer getAppFee() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. `GBP` + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. `GBP` * and `EUR` supported; `GBP` with your customers in the UK and for `EUR` with your * customers in supported Eurozone countries only. */ @@ -1617,7 +1619,7 @@ public String getId() { } /** - * [ISO 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. Used as + * [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. Used as * the language for notification emails sent by GoCardless if your organisation does * not send its own (see [compliance * requirements](#appendix-compliance-requirements)). Currently only "en", "fr", @@ -1714,7 +1716,7 @@ public String getBankName() { /** * [ISO 3166-1 alpha-2 - * code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). + * code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). * Defaults to the country code of the `iban` if supplied, otherwise is required. */ public String getCountryCode() { @@ -1730,7 +1732,7 @@ public String getCreatedAt() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. * Currently "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are * supported. */ @@ -1846,7 +1848,7 @@ public String getCity() { /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public String getCountryCode() { return countryCode; @@ -1973,7 +1975,7 @@ public Integer getCount() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. * Currently "USD" and "CAD" are supported. */ public String getCurrency() { diff --git a/src/main/java/com/gocardless/resources/Creditor.java b/src/main/java/com/gocardless/resources/Creditor.java index a1230496..6d583f72 100644 --- a/src/main/java/com/gocardless/resources/Creditor.java +++ b/src/main/java/com/gocardless/resources/Creditor.java @@ -89,7 +89,7 @@ public String getCity() { /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public String getCountryCode() { return countryCode; @@ -119,10 +119,10 @@ public Boolean getCustomPaymentPagesEnabled() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) code for the currency in which - * amounts will be paid out (after foreign exchange). Currently "AUD", "CAD", "DKK", "EUR", - * "GBP", "NZD", "SEK" and "USD" are supported. Present only if payouts will be (or were) made - * via foreign exchange. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) code for the currency in + * which amounts will be paid out (after foreign exchange). Currently "AUD", "CAD", "DKK", + * "EUR", "GBP", "NZD", "SEK" and "USD" are supported. Present only if payouts will be (or were) + * made via foreign exchange. */ public FxPayoutCurrency getFxPayoutCurrency() { return fxPayoutCurrency; @@ -396,7 +396,7 @@ public String getCity() { /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public String getCountryCode() { return countryCode; diff --git a/src/main/java/com/gocardless/resources/CreditorBankAccount.java b/src/main/java/com/gocardless/resources/CreditorBankAccount.java index 63a81e00..ff78a649 100644 --- a/src/main/java/com/gocardless/resources/CreditorBankAccount.java +++ b/src/main/java/com/gocardless/resources/CreditorBankAccount.java @@ -71,7 +71,7 @@ public String getBankName() { /** * [ISO 3166-1 alpha-2 - * code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). + * code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). * Defaults to the country code of the `iban` if supplied, otherwise is required. */ public String getCountryCode() { @@ -86,7 +86,7 @@ public String getCreatedAt() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public String getCurrency() { diff --git a/src/main/java/com/gocardless/resources/Customer.java b/src/main/java/com/gocardless/resources/Customer.java index 018d7fd1..cc6d0098 100644 --- a/src/main/java/com/gocardless/resources/Customer.java +++ b/src/main/java/com/gocardless/resources/Customer.java @@ -73,7 +73,7 @@ public String getCompanyName() { /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public String getCountryCode() { return countryCode; @@ -124,7 +124,7 @@ public String getId() { } /** - * [ISO 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. Used as the language + * [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. Used as the language * for notification emails sent by GoCardless if your organisation does not send its own (see * [compliance requirements](#appendix-compliance-requirements)). Currently only "en", "fr", * "de", "pt", "es", "it", "nl", "da", "nb", "sl", "sv" are supported. If this is not provided, diff --git a/src/main/java/com/gocardless/resources/CustomerBankAccount.java b/src/main/java/com/gocardless/resources/CustomerBankAccount.java index e064d414..f9ae38e3 100644 --- a/src/main/java/com/gocardless/resources/CustomerBankAccount.java +++ b/src/main/java/com/gocardless/resources/CustomerBankAccount.java @@ -82,7 +82,7 @@ public String getBankName() { /** * [ISO 3166-1 alpha-2 - * code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). + * code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). * Defaults to the country code of the `iban` if supplied, otherwise is required. */ public String getCountryCode() { @@ -97,7 +97,7 @@ public String getCreatedAt() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public String getCurrency() { diff --git a/src/main/java/com/gocardless/resources/InstalmentSchedule.java b/src/main/java/com/gocardless/resources/InstalmentSchedule.java index 47135d25..9d53f9c1 100644 --- a/src/main/java/com/gocardless/resources/InstalmentSchedule.java +++ b/src/main/java/com/gocardless/resources/InstalmentSchedule.java @@ -42,7 +42,7 @@ public String getCreatedAt() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public Currency getCurrency() { diff --git a/src/main/java/com/gocardless/resources/Institution.java b/src/main/java/com/gocardless/resources/Institution.java index 4acafb73..78c30860 100644 --- a/src/main/java/com/gocardless/resources/Institution.java +++ b/src/main/java/com/gocardless/resources/Institution.java @@ -37,7 +37,7 @@ public Boolean getAutocompletesCollectBankAccount() { /** * [ISO - * 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) * alpha-2 code. The country code of the institution. If nothing is provided, institutions with * the country code 'GB' are returned by default. */ diff --git a/src/main/java/com/gocardless/resources/NegativeBalanceLimit.java b/src/main/java/com/gocardless/resources/NegativeBalanceLimit.java index bc9aeb94..cdf490ce 100644 --- a/src/main/java/com/gocardless/resources/NegativeBalanceLimit.java +++ b/src/main/java/com/gocardless/resources/NegativeBalanceLimit.java @@ -36,7 +36,7 @@ public String getCreatedAt() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public Currency getCurrency() { diff --git a/src/main/java/com/gocardless/resources/OutboundPayment.java b/src/main/java/com/gocardless/resources/OutboundPayment.java index c704dd71..0be6d4c9 100644 --- a/src/main/java/com/gocardless/resources/OutboundPayment.java +++ b/src/main/java/com/gocardless/resources/OutboundPayment.java @@ -54,8 +54,8 @@ public String getCreatedAt() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency. Currently only "GBP" - * is supported. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency. Currently only + * "GBP" is supported. */ public Currency getCurrency() { return currency; diff --git a/src/main/java/com/gocardless/resources/OutboundPaymentImport.java b/src/main/java/com/gocardless/resources/OutboundPaymentImport.java index ab01a04a..c7303747 100644 --- a/src/main/java/com/gocardless/resources/OutboundPaymentImport.java +++ b/src/main/java/com/gocardless/resources/OutboundPaymentImport.java @@ -57,8 +57,8 @@ public String getCreatedAt() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency. Currently only "GBP" - * is supported. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency. Currently only + * "GBP" is supported. */ public Currency getCurrency() { return currency; diff --git a/src/main/java/com/gocardless/resources/PayerAuthorisation.java b/src/main/java/com/gocardless/resources/PayerAuthorisation.java index 6efbbe11..2f18baf6 100644 --- a/src/main/java/com/gocardless/resources/PayerAuthorisation.java +++ b/src/main/java/com/gocardless/resources/PayerAuthorisation.java @@ -225,7 +225,7 @@ public String getBranchCode() { /** * [ISO 3166-1 alpha-2 - * code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). + * code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). * Defaults to the country code of the `iban` if supplied, otherwise is required. */ public String getCountryCode() { @@ -233,7 +233,7 @@ public String getCountryCode() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public String getCurrency() { @@ -331,7 +331,7 @@ public String getCompanyName() { /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public String getCountryCode() { return countryCode; diff --git a/src/main/java/com/gocardless/resources/Payment.java b/src/main/java/com/gocardless/resources/Payment.java index f93f45dd..712ba7d0 100644 --- a/src/main/java/com/gocardless/resources/Payment.java +++ b/src/main/java/com/gocardless/resources/Payment.java @@ -67,7 +67,7 @@ public String getCreatedAt() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public Currency getCurrency() { @@ -252,7 +252,7 @@ public Integer getFxAmount() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) code for the currency in + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) code for the currency in * which amounts will be paid out (after foreign exchange). Currently "AUD", "CAD", "DKK", * "EUR", "GBP", "NZD", "SEK" and "USD" are supported. Present only if payouts will be (or * were) made via foreign exchange. diff --git a/src/main/java/com/gocardless/resources/PaymentAccount.java b/src/main/java/com/gocardless/resources/PaymentAccount.java index 67e2706d..70942fcd 100644 --- a/src/main/java/com/gocardless/resources/PaymentAccount.java +++ b/src/main/java/com/gocardless/resources/PaymentAccount.java @@ -52,7 +52,7 @@ public String getBankName() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public String getCurrency() { diff --git a/src/main/java/com/gocardless/resources/Payout.java b/src/main/java/com/gocardless/resources/Payout.java index 9d087c32..af3b6ea5 100644 --- a/src/main/java/com/gocardless/resources/Payout.java +++ b/src/main/java/com/gocardless/resources/Payout.java @@ -58,7 +58,7 @@ public String getCreatedAt() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public Currency getCurrency() { @@ -132,9 +132,10 @@ public Status getStatus() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) code for the currency in which - * tax is paid out to the tax authorities of your tax jurisdiction. Currently “EUR”, “GBP”, for - * French or British merchants, this will be `null` if tax is not applicable beta + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) code for the currency in + * which tax is paid out to the tax authorities of your tax jurisdiction. Currently “EUR”, + * “GBP”, for French or British merchants, this will be `null` if tax is not applicable + * beta */ public String getTaxCurrency() { return taxCurrency; @@ -209,7 +210,7 @@ public Integer getFxAmount() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) code for the currency in + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) code for the currency in * which amounts will be paid out (after foreign exchange). Currently "AUD", "CAD", "DKK", * "EUR", "GBP", "NZD", "SEK" and "USD" are supported. Present only if payouts will be (or * were) made via foreign exchange. diff --git a/src/main/java/com/gocardless/resources/PayoutItem.java b/src/main/java/com/gocardless/resources/PayoutItem.java index a6bc6e6c..126a3687 100644 --- a/src/main/java/com/gocardless/resources/PayoutItem.java +++ b/src/main/java/com/gocardless/resources/PayoutItem.java @@ -168,7 +168,7 @@ public String getAmount() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public Currency getCurrency() { @@ -188,7 +188,7 @@ public String getDestinationAmount() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) code for the currency in + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) code for the currency in * which tax is paid out to the tax authorities of your tax jurisdiction. Currently “EUR” * for French merchants and “GBP” for British merchants. */ diff --git a/src/main/java/com/gocardless/resources/Refund.java b/src/main/java/com/gocardless/resources/Refund.java index 787b4ad2..cc4dd0fc 100644 --- a/src/main/java/com/gocardless/resources/Refund.java +++ b/src/main/java/com/gocardless/resources/Refund.java @@ -42,7 +42,7 @@ public String getCreatedAt() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. This is set to + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. This is set to * the currency of the refund's [payment](#core-endpoints-payments). */ public String getCurrency() { @@ -170,7 +170,7 @@ public Integer getFxAmount() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) code for the currency in + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) code for the currency in * which amounts will be paid out (after foreign exchange). Currently "AUD", "CAD", "DKK", * "EUR", "GBP", "NZD", "SEK" and "USD" are supported. Present only if payouts will be (or * were) made via foreign exchange. diff --git a/src/main/java/com/gocardless/resources/SchemeIdentifier.java b/src/main/java/com/gocardless/resources/SchemeIdentifier.java index 9394b14b..e3f4655d 100644 --- a/src/main/java/com/gocardless/resources/SchemeIdentifier.java +++ b/src/main/java/com/gocardless/resources/SchemeIdentifier.java @@ -70,7 +70,7 @@ public String getCity() { /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public String getCountryCode() { return countryCode; diff --git a/src/main/java/com/gocardless/resources/Subscription.java b/src/main/java/com/gocardless/resources/Subscription.java index 69729820..ada34d0d 100644 --- a/src/main/java/com/gocardless/resources/Subscription.java +++ b/src/main/java/com/gocardless/resources/Subscription.java @@ -99,7 +99,7 @@ public String getCreatedAt() { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public String getCurrency() { diff --git a/src/main/java/com/gocardless/resources/VerificationDetail.java b/src/main/java/com/gocardless/resources/VerificationDetail.java index 71eaa6d8..d0538d52 100644 --- a/src/main/java/com/gocardless/resources/VerificationDetail.java +++ b/src/main/java/com/gocardless/resources/VerificationDetail.java @@ -123,7 +123,7 @@ public String getCity() { /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public String getCountryCode() { return countryCode; diff --git a/src/main/java/com/gocardless/services/BankDetailsLookupService.java b/src/main/java/com/gocardless/services/BankDetailsLookupService.java index f6336246..7e86c1da 100644 --- a/src/main/java/com/gocardless/services/BankDetailsLookupService.java +++ b/src/main/java/com/gocardless/services/BankDetailsLookupService.java @@ -121,7 +121,7 @@ public BankDetailsLookupCreateRequest withBranchCode(String branchCode) { /** * [ISO - * 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) * alpha-2 code. Must be provided if specifying local details. */ public BankDetailsLookupCreateRequest withCountryCode(String countryCode) { diff --git a/src/main/java/com/gocardless/services/BillingRequestFlowService.java b/src/main/java/com/gocardless/services/BillingRequestFlowService.java index 92ecd394..8c0dd055 100644 --- a/src/main/java/com/gocardless/services/BillingRequestFlowService.java +++ b/src/main/java/com/gocardless/services/BillingRequestFlowService.java @@ -252,7 +252,7 @@ public BillingRequestFlowCreateRequest withPrefilledCustomerCompanyName( /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public BillingRequestFlowCreateRequest withPrefilledCustomerCountryCode( String countryCode) { @@ -511,7 +511,7 @@ public PrefilledCustomer withCompanyName(String companyName) { /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public PrefilledCustomer withCountryCode(String countryCode) { this.countryCode = countryCode; diff --git a/src/main/java/com/gocardless/services/BillingRequestService.java b/src/main/java/com/gocardless/services/BillingRequestService.java index 1ca4e925..fe047773 100644 --- a/src/main/java/com/gocardless/services/BillingRequestService.java +++ b/src/main/java/com/gocardless/services/BillingRequestService.java @@ -215,7 +215,7 @@ public BillingRequestCreateRequest withInstalmentScheduleRequestAppFee(Integer a } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "USD" and "CAD" are supported. */ public BillingRequestCreateRequest withInstalmentScheduleRequestCurrency(String currency) { @@ -419,7 +419,7 @@ public BillingRequestCreateRequest withMandateRequestConstraints(Constraints con } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. */ public BillingRequestCreateRequest withMandateRequestCurrency(String currency) { if (mandateRequest == null) { @@ -618,7 +618,7 @@ public BillingRequestCreateRequest withPaymentRequestAppFee(Integer appFee) { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. `GBP` and + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. `GBP` and * `EUR` supported; `GBP` with your customers in the UK and for `EUR` with your customers in * supported Eurozone countries only. */ @@ -776,7 +776,7 @@ public BillingRequestCreateRequest withSubscriptionRequestCount(Integer count) { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public BillingRequestCreateRequest withSubscriptionRequestCurrency(String currency) { @@ -1183,7 +1183,7 @@ public InstalmentScheduleRequest withAppFee(Integer appFee) { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. * Currently "USD" and "CAD" are supported. */ public InstalmentScheduleRequest withCurrency(String currency) { @@ -1323,8 +1323,10 @@ public PeriodicLimits withAlignment(Alignment alignment) { } /** - * (Optional) The maximum number of payments that can be collected in this periodic - * limit. + * The maximum number of payments that can be collected in this periodic limit. _Note:_ + * Only supported for the PayTo scheme, where it is required. Providing this field for + * other VRP schemes will result in a validation error. + * */ public PeriodicLimits withMaxPayments(Integer maxPayments) { this.maxPayments = maxPayments; @@ -1527,7 +1529,7 @@ public MandateRequest withConstraints(Constraints constraints) { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. */ public MandateRequest withCurrency(String currency) { this.currency = currency; @@ -1698,7 +1700,7 @@ public PaymentRequest withAppFee(Integer appFee) { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. `GBP` + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. `GBP` * and `EUR` supported; `GBP` with your customers in the UK and for `EUR` with your * customers in supported Eurozone countries only. */ @@ -1834,7 +1836,7 @@ public SubscriptionRequest withCount(Integer count) { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. * Currently "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public SubscriptionRequest withCurrency(String currency) { @@ -2045,7 +2047,7 @@ public BillingRequestCollectCustomerDetailsRequest withCustomerGivenName(String } /** - * [ISO 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. Used as the + * [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. Used as the * language for notification emails sent by GoCardless if your organisation does not send * its own (see [compliance requirements](#appendix-compliance-requirements)). Currently * only "en", "fr", "de", "pt", "es", "it", "nl", "da", "nb", "sl", "sv" are supported. If @@ -2142,7 +2144,7 @@ public BillingRequestCollectCustomerDetailsRequest withCustomerBillingDetailCity /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public BillingRequestCollectCustomerDetailsRequest withCustomerBillingDetailCountryCode( String countryCode) { @@ -2314,7 +2316,7 @@ public Customer withGivenName(String givenName) { } /** - * [ISO 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. Used as the + * [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. Used as the * language for notification emails sent by GoCardless if your organisation does not * send its own (see [compliance requirements](#appendix-compliance-requirements)). * Currently only "en", "fr", "de", "pt", "es", "it", "nl", "da", "nb", "sl", "sv" are @@ -2392,7 +2394,7 @@ public CustomerBillingDetail withCity(String city) { /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public CustomerBillingDetail withCountryCode(String countryCode) { this.countryCode = countryCode; @@ -2553,7 +2555,7 @@ public BillingRequestCollectBankAccountRequest withBranchCode(String branchCode) /** * [ISO 3166-1 alpha-2 - * code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). + * code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). * Defaults to the country code of the `iban` if supplied, otherwise is required. */ public BillingRequestCollectBankAccountRequest withCountryCode(String countryCode) { @@ -2562,7 +2564,7 @@ public BillingRequestCollectBankAccountRequest withCountryCode(String countryCod } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public BillingRequestCollectBankAccountRequest withCurrency(String currency) { @@ -3198,7 +3200,7 @@ public static final class BillingRequestChooseCurrencyRequest private Map metadata; /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public BillingRequestChooseCurrencyRequest withCurrency(String currency) { @@ -3285,7 +3287,7 @@ public static final class BillingRequestSelectInstitutionRequest /** * [ISO - * 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) * alpha-2 code. The country code of the institution. If nothing is provided, institutions * with the country code 'GB' are returned by default. */ diff --git a/src/main/java/com/gocardless/services/BillingRequestTemplateService.java b/src/main/java/com/gocardless/services/BillingRequestTemplateService.java index 53261738..5a814eb9 100644 --- a/src/main/java/com/gocardless/services/BillingRequestTemplateService.java +++ b/src/main/java/com/gocardless/services/BillingRequestTemplateService.java @@ -320,7 +320,7 @@ public BillingRequestTemplateCreateRequest withMandateRequestConstraintsStartDat } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. */ public BillingRequestTemplateCreateRequest withMandateRequestCurrency( String mandateRequestCurrency) { @@ -445,7 +445,7 @@ public BillingRequestTemplateCreateRequest withPaymentRequestAmount( } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. `GBP` and + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. `GBP` and * `EUR` supported; `GBP` with your customers in the UK and for `EUR` with your customers in * supported Eurozone countries only. */ @@ -608,8 +608,10 @@ public PeriodicLimits withAlignment(Alignment alignment) { } /** - * (Optional) The maximum number of payments that can be collected in this periodic - * limit. + * The maximum number of payments that can be collected in this periodic limit. _Note:_ + * Only supported for the PayTo scheme, where it is required. Providing this field for + * other VRP schemes will result in a validation error. + * */ public PeriodicLimits withMaxPayments(Integer maxPayments) { this.maxPayments = maxPayments; @@ -850,7 +852,7 @@ public BillingRequestTemplateUpdateRequest withMandateRequestConstraintsStartDat } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. */ public BillingRequestTemplateUpdateRequest withMandateRequestCurrency( String mandateRequestCurrency) { @@ -975,7 +977,7 @@ public BillingRequestTemplateUpdateRequest withPaymentRequestAmount( } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. `GBP` and + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. `GBP` and * `EUR` supported; `GBP` with your customers in the UK and for `EUR` with your customers in * supported Eurozone countries only. */ @@ -1117,8 +1119,10 @@ public PeriodicLimits withAlignment(Alignment alignment) { } /** - * (Optional) The maximum number of payments that can be collected in this periodic - * limit. + * The maximum number of payments that can be collected in this periodic limit. _Note:_ + * Only supported for the PayTo scheme, where it is required. Providing this field for + * other VRP schemes will result in a validation error. + * */ public PeriodicLimits withMaxPayments(Integer maxPayments) { this.maxPayments = maxPayments; diff --git a/src/main/java/com/gocardless/services/BillingRequestWithActionService.java b/src/main/java/com/gocardless/services/BillingRequestWithActionService.java index 66083e37..0191bc45 100644 --- a/src/main/java/com/gocardless/services/BillingRequestWithActionService.java +++ b/src/main/java/com/gocardless/services/BillingRequestWithActionService.java @@ -223,7 +223,7 @@ public BillingRequestWithActionCreateWithActionsRequest withMandateRequestConstr } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. */ public BillingRequestWithActionCreateWithActionsRequest withMandateRequestCurrency( String currency) { @@ -434,7 +434,7 @@ public BillingRequestWithActionCreateWithActionsRequest withPaymentRequestAppFee } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. `GBP` and + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. `GBP` and * `EUR` supported; `GBP` with your customers in the UK and for `EUR` with your customers in * supported Eurozone countries only. */ @@ -739,7 +739,7 @@ public CollectBankAccount withBranchCode(String branchCode) { /** * [ISO 3166-1 alpha-2 - * code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). + * code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). * Defaults to the country code of the `iban` if supplied, otherwise is required. */ public CollectBankAccount withCountryCode(String countryCode) { @@ -748,7 +748,7 @@ public CollectBankAccount withCountryCode(String countryCode) { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. * Currently "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public CollectBankAccount withCurrency(String currency) { @@ -882,7 +882,7 @@ public Customer withGivenName(String givenName) { } /** - * [ISO 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. Used as the + * [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. Used as the * language for notification emails sent by GoCardless if your organisation does not * send its own (see [compliance requirements](#appendix-compliance-requirements)). * Currently only "en", "fr", "de", "pt", "es", "it", "nl", "da", "nb", "sl", "sv" are @@ -986,7 +986,7 @@ public CustomerBillingDetail withCity(String city) { /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public CustomerBillingDetail withCountryCode(String countryCode) { this.countryCode = countryCode; @@ -1156,7 +1156,7 @@ public static class SelectInstitution { /** * [ISO - * 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) * alpha-2 code. The country code of the institution. If nothing is provided, * institutions with the country code 'GB' are returned by default. */ @@ -1288,8 +1288,10 @@ public PeriodicLimits withAlignment(Alignment alignment) { } /** - * (Optional) The maximum number of payments that can be collected in this periodic - * limit. + * The maximum number of payments that can be collected in this periodic limit. _Note:_ + * Only supported for the PayTo scheme, where it is required. Providing this field for + * other VRP schemes will result in a validation error. + * */ public PeriodicLimits withMaxPayments(Integer maxPayments) { this.maxPayments = maxPayments; @@ -1479,7 +1481,7 @@ public MandateRequest withConstraints(Constraints constraints) { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. */ public MandateRequest withCurrency(String currency) { this.currency = currency; @@ -1650,7 +1652,7 @@ public PaymentRequest withAppFee(Integer appFee) { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. `GBP` + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. `GBP` * and `EUR` supported; `GBP` with your customers in the UK and for `EUR` with your * customers in supported Eurozone countries only. */ diff --git a/src/main/java/com/gocardless/services/CreditorBankAccountService.java b/src/main/java/com/gocardless/services/CreditorBankAccountService.java index 17b23d32..35f8b688 100644 --- a/src/main/java/com/gocardless/services/CreditorBankAccountService.java +++ b/src/main/java/com/gocardless/services/CreditorBankAccountService.java @@ -144,7 +144,7 @@ public CreditorBankAccountCreateRequest withBranchCode(String branchCode) { /** * [ISO 3166-1 alpha-2 - * code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). + * code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). * Defaults to the country code of the `iban` if supplied, otherwise is required. */ public CreditorBankAccountCreateRequest withCountryCode(String countryCode) { @@ -153,7 +153,7 @@ public CreditorBankAccountCreateRequest withCountryCode(String countryCode) { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public CreditorBankAccountCreateRequest withCurrency(String currency) { diff --git a/src/main/java/com/gocardless/services/CreditorService.java b/src/main/java/com/gocardless/services/CreditorService.java index 9e6f2fb3..6f442726 100644 --- a/src/main/java/com/gocardless/services/CreditorService.java +++ b/src/main/java/com/gocardless/services/CreditorService.java @@ -89,7 +89,7 @@ public CreditorCreateRequest withBankReferencePrefix(String bankReferencePrefix) /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public CreditorCreateRequest withCountryCode(String countryCode) { this.countryCode = countryCode; @@ -473,7 +473,7 @@ public CreditorUpdateRequest withCity(String city) { /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public CreditorUpdateRequest withCountryCode(String countryCode) { this.countryCode = countryCode; diff --git a/src/main/java/com/gocardless/services/CustomerBankAccountService.java b/src/main/java/com/gocardless/services/CustomerBankAccountService.java index 6e95c65a..3522c73f 100644 --- a/src/main/java/com/gocardless/services/CustomerBankAccountService.java +++ b/src/main/java/com/gocardless/services/CustomerBankAccountService.java @@ -174,7 +174,7 @@ public CustomerBankAccountCreateRequest withBranchCode(String branchCode) { /** * [ISO 3166-1 alpha-2 - * code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). + * code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). * Defaults to the country code of the `iban` if supplied, otherwise is required. */ public CustomerBankAccountCreateRequest withCountryCode(String countryCode) { @@ -183,7 +183,7 @@ public CustomerBankAccountCreateRequest withCountryCode(String countryCode) { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public CustomerBankAccountCreateRequest withCurrency(String currency) { diff --git a/src/main/java/com/gocardless/services/CustomerService.java b/src/main/java/com/gocardless/services/CustomerService.java index 28c2c3fa..9bbba6c9 100644 --- a/src/main/java/com/gocardless/services/CustomerService.java +++ b/src/main/java/com/gocardless/services/CustomerService.java @@ -140,7 +140,7 @@ public CustomerCreateRequest withCompanyName(String companyName) { /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public CustomerCreateRequest withCountryCode(String countryCode) { this.countryCode = countryCode; @@ -182,7 +182,7 @@ public CustomerCreateRequest withGivenName(String givenName) { } /** - * [ISO 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. Used as the + * [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. Used as the * language for notification emails sent by GoCardless if your organisation does not send * its own (see [compliance requirements](#appendix-compliance-requirements)). Currently * only "en", "fr", "de", "pt", "es", "it", "nl", "da", "nb", "sl", "sv" are supported. If @@ -382,7 +382,7 @@ public CustomerListRequest withCreatedAtLte(String lte) { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public CustomerListRequest withCurrency(Currency currency) { @@ -694,7 +694,7 @@ public CustomerUpdateRequest withCompanyName(String companyName) { /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public CustomerUpdateRequest withCountryCode(String countryCode) { this.countryCode = countryCode; @@ -736,7 +736,7 @@ public CustomerUpdateRequest withGivenName(String givenName) { } /** - * [ISO 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. Used as the + * [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. Used as the * language for notification emails sent by GoCardless if your organisation does not send * its own (see [compliance requirements](#appendix-compliance-requirements)). Currently * only "en", "fr", "de", "pt", "es", "it", "nl", "da", "nb", "sl", "sv" are supported. If diff --git a/src/main/java/com/gocardless/services/InstalmentScheduleService.java b/src/main/java/com/gocardless/services/InstalmentScheduleService.java index e563850c..7139fb23 100644 --- a/src/main/java/com/gocardless/services/InstalmentScheduleService.java +++ b/src/main/java/com/gocardless/services/InstalmentScheduleService.java @@ -143,7 +143,7 @@ public InstalmentScheduleCreateWithDatesRequest withAppFee(Integer appFee) { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public InstalmentScheduleCreateWithDatesRequest withCurrency(Currency currency) { @@ -423,7 +423,7 @@ public InstalmentScheduleCreateWithScheduleRequest withAppFee(Integer appFee) { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public InstalmentScheduleCreateWithScheduleRequest withCurrency(Currency currency) { diff --git a/src/main/java/com/gocardless/services/InstitutionService.java b/src/main/java/com/gocardless/services/InstitutionService.java index 2b950d34..037d301c 100644 --- a/src/main/java/com/gocardless/services/InstitutionService.java +++ b/src/main/java/com/gocardless/services/InstitutionService.java @@ -74,7 +74,7 @@ public InstitutionListRequest withBranchCode(String branchCode) { /** * [ISO - * 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) * alpha-2 code. The country code of the institution. If nothing is provided, institutions * with the country code 'GB' are returned by default. */ @@ -166,7 +166,7 @@ public static final class InstitutionListForBillingRequestRequest /** * [ISO - * 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) * alpha-2 code. The country code of the institution. If nothing is provided, institutions * with the country code 'GB' are returned by default. */ diff --git a/src/main/java/com/gocardless/services/MandateImportEntryService.java b/src/main/java/com/gocardless/services/MandateImportEntryService.java index b5fed44f..5b4b5c6b 100644 --- a/src/main/java/com/gocardless/services/MandateImportEntryService.java +++ b/src/main/java/com/gocardless/services/MandateImportEntryService.java @@ -212,7 +212,7 @@ public MandateImportEntryCreateRequest withBankAccountBranchCode(String branchCo /** * [ISO 3166-1 alpha-2 - * code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). + * code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). * Defaults to the country code of the `iban` if supplied, otherwise is required. */ public MandateImportEntryCreateRequest withBankAccountCountryCode(String countryCode) { @@ -316,7 +316,7 @@ public MandateImportEntryCreateRequest withCustomerCompanyName(String companyNam /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public MandateImportEntryCreateRequest withCustomerCountryCode(String countryCode) { if (customer == null) { @@ -374,7 +374,7 @@ public MandateImportEntryCreateRequest withCustomerGivenName(String givenName) { } /** - * [ISO 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. Used as the + * [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. Used as the * language for notification emails sent by GoCardless if your organisation does not send * its own (see [compliance requirements](#appendix-compliance-requirements)). Currently * only "en", "fr", "de", "pt", "es", "it", "nl", "da", "nb", "sl", "sv" are supported. If @@ -652,7 +652,7 @@ public BankAccount withBranchCode(String branchCode) { /** * [ISO 3166-1 alpha-2 - * code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). + * code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). * Defaults to the country code of the `iban` if supplied, otherwise is required. */ public BankAccount withCountryCode(String countryCode) { @@ -758,7 +758,7 @@ public Customer withCompanyName(String companyName) { /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public Customer withCountryCode(String countryCode) { this.countryCode = countryCode; @@ -800,7 +800,7 @@ public Customer withGivenName(String givenName) { } /** - * [ISO 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. Used as the + * [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. Used as the * language for notification emails sent by GoCardless if your organisation does not * send its own (see [compliance requirements](#appendix-compliance-requirements)). * Currently only "en", "fr", "de", "pt", "es", "it", "nl", "da", "nb", "sl", "sv" are diff --git a/src/main/java/com/gocardless/services/MandatePdfService.java b/src/main/java/com/gocardless/services/MandatePdfService.java index f81e501e..a22ef4a7 100644 --- a/src/main/java/com/gocardless/services/MandatePdfService.java +++ b/src/main/java/com/gocardless/services/MandatePdfService.java @@ -31,7 +31,7 @@ public MandatePdfService(HttpClient httpClient) { * * To generate a PDF mandate in another language, set the `Accept-Language` header when creating * the PDF mandate to the relevant [ISO - * 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language code supported for the + * 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language code supported for the * scheme. * * | Scheme | Supported languages | | :--------------- | @@ -58,7 +58,7 @@ public MandatePdfCreateRequest create() { * * To generate a PDF mandate in another language, set the `Accept-Language` header when creating * the PDF mandate to the relevant [ISO - * 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language code supported for the + * 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language code supported for the * scheme. * * | Scheme | Supported languages | | :--------------- | @@ -196,7 +196,7 @@ public MandatePdfCreateRequest withCompanyName(String companyName) { /** * [ISO - * 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) * alpha-2 code. Required if providing local details. */ public MandatePdfCreateRequest withCountryCode(String countryCode) { diff --git a/src/main/java/com/gocardless/services/NegativeBalanceLimitService.java b/src/main/java/com/gocardless/services/NegativeBalanceLimitService.java index cfbb5967..75bbbe8e 100644 --- a/src/main/java/com/gocardless/services/NegativeBalanceLimitService.java +++ b/src/main/java/com/gocardless/services/NegativeBalanceLimitService.java @@ -76,7 +76,7 @@ public NegativeBalanceLimitListRequest withCreditor(String creditor) { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public NegativeBalanceLimitListRequest withCurrency(Currency currency) { diff --git a/src/main/java/com/gocardless/services/OutboundPaymentService.java b/src/main/java/com/gocardless/services/OutboundPaymentService.java index f38fc345..78e2a716 100644 --- a/src/main/java/com/gocardless/services/OutboundPaymentService.java +++ b/src/main/java/com/gocardless/services/OutboundPaymentService.java @@ -60,7 +60,7 @@ public OutboundPaymentCancelRequest cancel(String identity) { } /** - * Approves an outbound payment. Only outbound payments with the “pending_approval” status can + * Approves an outbound payment. Only outbound payments with the "pending_approval" status can * be approved. */ public OutboundPaymentApproveRequest approve(String identity) { @@ -540,7 +540,7 @@ protected String getRequestEnvelope() { /** * Request class for {@link OutboundPaymentService#approve }. * - * Approves an outbound payment. Only outbound payments with the “pending_approval” status can + * Approves an outbound payment. Only outbound payments with the "pending_approval" status can * be approved. */ public static final class OutboundPaymentApproveRequest extends PostRequest { diff --git a/src/main/java/com/gocardless/services/PayerAuthorisationService.java b/src/main/java/com/gocardless/services/PayerAuthorisationService.java index 796ba0a9..7319d697 100644 --- a/src/main/java/com/gocardless/services/PayerAuthorisationService.java +++ b/src/main/java/com/gocardless/services/PayerAuthorisationService.java @@ -284,7 +284,7 @@ public PayerAuthorisationCreateRequest withBankAccountBranchCode(String branchCo /** * [ISO 3166-1 alpha-2 - * code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). + * code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). * Defaults to the country code of the `iban` if supplied, otherwise is required. */ public PayerAuthorisationCreateRequest withBankAccountCountryCode(String countryCode) { @@ -296,7 +296,7 @@ public PayerAuthorisationCreateRequest withBankAccountCountryCode(String country } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public PayerAuthorisationCreateRequest withBankAccountCurrency(String currency) { @@ -401,7 +401,7 @@ public PayerAuthorisationCreateRequest withCustomerCompanyName(String companyNam /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public PayerAuthorisationCreateRequest withCustomerCountryCode(String countryCode) { if (customer == null) { @@ -708,7 +708,7 @@ public BankAccount withBranchCode(String branchCode) { /** * [ISO 3166-1 alpha-2 - * code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). + * code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). * Defaults to the country code of the `iban` if supplied, otherwise is required. */ public BankAccount withCountryCode(String countryCode) { @@ -717,7 +717,7 @@ public BankAccount withCountryCode(String countryCode) { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. * Currently "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public BankAccount withCurrency(String currency) { @@ -820,7 +820,7 @@ public Customer withCompanyName(String companyName) { /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public Customer withCountryCode(String countryCode) { this.countryCode = countryCode; @@ -1104,7 +1104,7 @@ public PayerAuthorisationUpdateRequest withBankAccountBranchCode(String branchCo /** * [ISO 3166-1 alpha-2 - * code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). + * code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). * Defaults to the country code of the `iban` if supplied, otherwise is required. */ public PayerAuthorisationUpdateRequest withBankAccountCountryCode(String countryCode) { @@ -1116,7 +1116,7 @@ public PayerAuthorisationUpdateRequest withBankAccountCountryCode(String country } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public PayerAuthorisationUpdateRequest withBankAccountCurrency(String currency) { @@ -1221,7 +1221,7 @@ public PayerAuthorisationUpdateRequest withCustomerCompanyName(String companyNam /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public PayerAuthorisationUpdateRequest withCustomerCountryCode(String countryCode) { if (customer == null) { @@ -1522,7 +1522,7 @@ public BankAccount withBranchCode(String branchCode) { /** * [ISO 3166-1 alpha-2 - * code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). + * code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). * Defaults to the country code of the `iban` if supplied, otherwise is required. */ public BankAccount withCountryCode(String countryCode) { @@ -1531,7 +1531,7 @@ public BankAccount withCountryCode(String countryCode) { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. * Currently "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public BankAccount withCurrency(String currency) { @@ -1634,7 +1634,7 @@ public Customer withCompanyName(String companyName) { /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public Customer withCountryCode(String countryCode) { this.countryCode = countryCode; diff --git a/src/main/java/com/gocardless/services/PaymentService.java b/src/main/java/com/gocardless/services/PaymentService.java index b331188b..692efae4 100644 --- a/src/main/java/com/gocardless/services/PaymentService.java +++ b/src/main/java/com/gocardless/services/PaymentService.java @@ -145,7 +145,7 @@ public PaymentCreateRequest withChargeDate(String chargeDate) { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public PaymentCreateRequest withCurrency(Currency currency) { @@ -502,7 +502,7 @@ public PaymentListRequest withCreditor(String creditor) { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public PaymentListRequest withCurrency(Currency currency) { diff --git a/src/main/java/com/gocardless/services/PayoutService.java b/src/main/java/com/gocardless/services/PayoutService.java index 7c240c00..f297a9ac 100644 --- a/src/main/java/com/gocardless/services/PayoutService.java +++ b/src/main/java/com/gocardless/services/PayoutService.java @@ -151,7 +151,7 @@ public PayoutListRequest withCreditorBankAccount(String creditorBankAccount) } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public PayoutListRequest withCurrency(Currency currency) { diff --git a/src/main/java/com/gocardless/services/RedirectFlowService.java b/src/main/java/com/gocardless/services/RedirectFlowService.java index 843b90ba..482c4432 100644 --- a/src/main/java/com/gocardless/services/RedirectFlowService.java +++ b/src/main/java/com/gocardless/services/RedirectFlowService.java @@ -246,7 +246,7 @@ public RedirectFlowCreateRequest withPrefilledCustomerCompanyName(String company /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public RedirectFlowCreateRequest withPrefilledCustomerCountryCode(String countryCode) { if (prefilledCustomer == null) { @@ -302,7 +302,7 @@ public RedirectFlowCreateRequest withPrefilledCustomerGivenName(String givenName } /** - * [ISO 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. + * [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. */ public RedirectFlowCreateRequest withPrefilledCustomerLanguage(String language) { if (prefilledCustomer == null) { @@ -548,7 +548,7 @@ public PrefilledCustomer withCompanyName(String companyName) { /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public PrefilledCustomer withCountryCode(String countryCode) { this.countryCode = countryCode; @@ -588,7 +588,7 @@ public PrefilledCustomer withGivenName(String givenName) { } /** - * [ISO 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. + * [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code. */ public PrefilledCustomer withLanguage(String language) { this.language = language; diff --git a/src/main/java/com/gocardless/services/SubscriptionService.java b/src/main/java/com/gocardless/services/SubscriptionService.java index 301a9ef0..cef96c9f 100644 --- a/src/main/java/com/gocardless/services/SubscriptionService.java +++ b/src/main/java/com/gocardless/services/SubscriptionService.java @@ -235,7 +235,7 @@ public SubscriptionCreateRequest withCount(Integer count) { } /** - * [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently + * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) currency code. Currently * "AUD", "CAD", "DKK", "EUR", "GBP", "NZD", "SEK" and "USD" are supported. */ public SubscriptionCreateRequest withCurrency(String currency) { diff --git a/src/main/java/com/gocardless/services/VerificationDetailService.java b/src/main/java/com/gocardless/services/VerificationDetailService.java index 57901cd6..859f6a82 100644 --- a/src/main/java/com/gocardless/services/VerificationDetailService.java +++ b/src/main/java/com/gocardless/services/VerificationDetailService.java @@ -216,7 +216,7 @@ public Directors withCity(String city) { /** * [ISO 3166-1 alpha-2 - * code.](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) + * code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) */ public Directors withCountryCode(String countryCode) { this.countryCode = countryCode; From a42c8292e44ac5220d6c80bef88852e6add0e983 Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Thu, 14 May 2026 15:14:02 +0000 Subject: [PATCH 3/5] Changes generated by f8e5cc4daf64c360ba9e5c0a062265fce399032f This commit was automatically created from gocardless/client-library-templates@f8e5cc4daf64c360ba9e5c0a062265fce399032f by the `push-files` action. Workflow run: https://github.com/gocardless/client-library-templates/actions/runs/25867955166 --- src/main/java/com/gocardless/resources/BillingRequest.java | 3 +-- .../com/gocardless/resources/BillingRequestTemplate.java | 3 +-- .../com/gocardless/resources/BillingRequestWithAction.java | 3 +-- .../java/com/gocardless/services/BillingRequestService.java | 3 +-- .../gocardless/services/BillingRequestTemplateService.java | 6 ++---- .../services/BillingRequestWithActionService.java | 3 +-- 6 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/gocardless/resources/BillingRequest.java b/src/main/java/com/gocardless/resources/BillingRequest.java index 32c6f714..9d58b671 100644 --- a/src/main/java/com/gocardless/resources/BillingRequest.java +++ b/src/main/java/com/gocardless/resources/BillingRequest.java @@ -1111,8 +1111,7 @@ public Alignment getAlignment() { /** * The maximum number of payments that can be collected in this periodic limit. - * _Note:_ Only supported for the PayTo scheme, where it is required. Providing this - * field for other VRP schemes will result in a validation error. + * _Note:_ Only supported for the PayTo scheme, where it is required. * */ public Integer getMaxPayments() { diff --git a/src/main/java/com/gocardless/resources/BillingRequestTemplate.java b/src/main/java/com/gocardless/resources/BillingRequestTemplate.java index b58ef867..9ae48c42 100644 --- a/src/main/java/com/gocardless/resources/BillingRequestTemplate.java +++ b/src/main/java/com/gocardless/resources/BillingRequestTemplate.java @@ -314,8 +314,7 @@ public Alignment getAlignment() { /** * The maximum number of payments that can be collected in this periodic limit. _Note:_ - * Only supported for the PayTo scheme, where it is required. Providing this field for - * other VRP schemes will result in a validation error. + * Only supported for the PayTo scheme, where it is required. * */ public Integer getMaxPayments() { diff --git a/src/main/java/com/gocardless/resources/BillingRequestWithAction.java b/src/main/java/com/gocardless/resources/BillingRequestWithAction.java index 3c3b8f6f..bfff0e61 100644 --- a/src/main/java/com/gocardless/resources/BillingRequestWithAction.java +++ b/src/main/java/com/gocardless/resources/BillingRequestWithAction.java @@ -1320,8 +1320,7 @@ public Alignment getAlignment() { /** * The maximum number of payments that can be collected in this periodic limit. - * _Note:_ Only supported for the PayTo scheme, where it is required. Providing - * this field for other VRP schemes will result in a validation error. + * _Note:_ Only supported for the PayTo scheme, where it is required. * */ public Integer getMaxPayments() { diff --git a/src/main/java/com/gocardless/services/BillingRequestService.java b/src/main/java/com/gocardless/services/BillingRequestService.java index fe047773..350008dd 100644 --- a/src/main/java/com/gocardless/services/BillingRequestService.java +++ b/src/main/java/com/gocardless/services/BillingRequestService.java @@ -1324,8 +1324,7 @@ public PeriodicLimits withAlignment(Alignment alignment) { /** * The maximum number of payments that can be collected in this periodic limit. _Note:_ - * Only supported for the PayTo scheme, where it is required. Providing this field for - * other VRP schemes will result in a validation error. + * Only supported for the PayTo scheme, where it is required. * */ public PeriodicLimits withMaxPayments(Integer maxPayments) { diff --git a/src/main/java/com/gocardless/services/BillingRequestTemplateService.java b/src/main/java/com/gocardless/services/BillingRequestTemplateService.java index 5a814eb9..5b0dab12 100644 --- a/src/main/java/com/gocardless/services/BillingRequestTemplateService.java +++ b/src/main/java/com/gocardless/services/BillingRequestTemplateService.java @@ -609,8 +609,7 @@ public PeriodicLimits withAlignment(Alignment alignment) { /** * The maximum number of payments that can be collected in this periodic limit. _Note:_ - * Only supported for the PayTo scheme, where it is required. Providing this field for - * other VRP schemes will result in a validation error. + * Only supported for the PayTo scheme, where it is required. * */ public PeriodicLimits withMaxPayments(Integer maxPayments) { @@ -1120,8 +1119,7 @@ public PeriodicLimits withAlignment(Alignment alignment) { /** * The maximum number of payments that can be collected in this periodic limit. _Note:_ - * Only supported for the PayTo scheme, where it is required. Providing this field for - * other VRP schemes will result in a validation error. + * Only supported for the PayTo scheme, where it is required. * */ public PeriodicLimits withMaxPayments(Integer maxPayments) { diff --git a/src/main/java/com/gocardless/services/BillingRequestWithActionService.java b/src/main/java/com/gocardless/services/BillingRequestWithActionService.java index 0191bc45..4c6bdf86 100644 --- a/src/main/java/com/gocardless/services/BillingRequestWithActionService.java +++ b/src/main/java/com/gocardless/services/BillingRequestWithActionService.java @@ -1289,8 +1289,7 @@ public PeriodicLimits withAlignment(Alignment alignment) { /** * The maximum number of payments that can be collected in this periodic limit. _Note:_ - * Only supported for the PayTo scheme, where it is required. Providing this field for - * other VRP schemes will result in a validation error. + * Only supported for the PayTo scheme, where it is required. * */ public PeriodicLimits withMaxPayments(Integer maxPayments) { From 52ae61abfd3c6486d951f02302c301aa6f5fedb9 Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Mon, 18 May 2026 16:51:36 +0000 Subject: [PATCH 4/5] Changes generated by ccd5f29c66451be97572e18823ab15c26c53de8c This commit was automatically created from gocardless/client-library-templates@ccd5f29c66451be97572e18823ab15c26c53de8c by the `push-files` action. Workflow run: https://github.com/gocardless/client-library-templates/actions/runs/26047380864 --- src/main/java/com/gocardless/resources/BillingRequest.java | 2 +- .../java/com/gocardless/resources/BillingRequestTemplate.java | 2 +- .../com/gocardless/resources/BillingRequestWithAction.java | 2 +- .../java/com/gocardless/services/BillingRequestService.java | 2 +- .../gocardless/services/BillingRequestTemplateService.java | 4 ++-- .../gocardless/services/BillingRequestWithActionService.java | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/gocardless/resources/BillingRequest.java b/src/main/java/com/gocardless/resources/BillingRequest.java index 9d58b671..ab8bd6a6 100644 --- a/src/main/java/com/gocardless/resources/BillingRequest.java +++ b/src/main/java/com/gocardless/resources/BillingRequest.java @@ -1111,7 +1111,7 @@ public Alignment getAlignment() { /** * The maximum number of payments that can be collected in this periodic limit. - * _Note:_ Only supported for the PayTo scheme, where it is required. + * _Note:_ This is only supported for the PayTo scheme, where it is required. * */ public Integer getMaxPayments() { diff --git a/src/main/java/com/gocardless/resources/BillingRequestTemplate.java b/src/main/java/com/gocardless/resources/BillingRequestTemplate.java index 9ae48c42..0dd9d044 100644 --- a/src/main/java/com/gocardless/resources/BillingRequestTemplate.java +++ b/src/main/java/com/gocardless/resources/BillingRequestTemplate.java @@ -314,7 +314,7 @@ public Alignment getAlignment() { /** * The maximum number of payments that can be collected in this periodic limit. _Note:_ - * Only supported for the PayTo scheme, where it is required. + * This is only supported for the PayTo scheme, where it is required. * */ public Integer getMaxPayments() { diff --git a/src/main/java/com/gocardless/resources/BillingRequestWithAction.java b/src/main/java/com/gocardless/resources/BillingRequestWithAction.java index bfff0e61..c7068523 100644 --- a/src/main/java/com/gocardless/resources/BillingRequestWithAction.java +++ b/src/main/java/com/gocardless/resources/BillingRequestWithAction.java @@ -1320,7 +1320,7 @@ public Alignment getAlignment() { /** * The maximum number of payments that can be collected in this periodic limit. - * _Note:_ Only supported for the PayTo scheme, where it is required. + * _Note:_ This is only supported for the PayTo scheme, where it is required. * */ public Integer getMaxPayments() { diff --git a/src/main/java/com/gocardless/services/BillingRequestService.java b/src/main/java/com/gocardless/services/BillingRequestService.java index 350008dd..a63deae4 100644 --- a/src/main/java/com/gocardless/services/BillingRequestService.java +++ b/src/main/java/com/gocardless/services/BillingRequestService.java @@ -1324,7 +1324,7 @@ public PeriodicLimits withAlignment(Alignment alignment) { /** * The maximum number of payments that can be collected in this periodic limit. _Note:_ - * Only supported for the PayTo scheme, where it is required. + * This is only supported for the PayTo scheme, where it is required. * */ public PeriodicLimits withMaxPayments(Integer maxPayments) { diff --git a/src/main/java/com/gocardless/services/BillingRequestTemplateService.java b/src/main/java/com/gocardless/services/BillingRequestTemplateService.java index 5b0dab12..a30383cb 100644 --- a/src/main/java/com/gocardless/services/BillingRequestTemplateService.java +++ b/src/main/java/com/gocardless/services/BillingRequestTemplateService.java @@ -609,7 +609,7 @@ public PeriodicLimits withAlignment(Alignment alignment) { /** * The maximum number of payments that can be collected in this periodic limit. _Note:_ - * Only supported for the PayTo scheme, where it is required. + * This is only supported for the PayTo scheme, where it is required. * */ public PeriodicLimits withMaxPayments(Integer maxPayments) { @@ -1119,7 +1119,7 @@ public PeriodicLimits withAlignment(Alignment alignment) { /** * The maximum number of payments that can be collected in this periodic limit. _Note:_ - * Only supported for the PayTo scheme, where it is required. + * This is only supported for the PayTo scheme, where it is required. * */ public PeriodicLimits withMaxPayments(Integer maxPayments) { diff --git a/src/main/java/com/gocardless/services/BillingRequestWithActionService.java b/src/main/java/com/gocardless/services/BillingRequestWithActionService.java index 4c6bdf86..700711b1 100644 --- a/src/main/java/com/gocardless/services/BillingRequestWithActionService.java +++ b/src/main/java/com/gocardless/services/BillingRequestWithActionService.java @@ -1289,7 +1289,7 @@ public PeriodicLimits withAlignment(Alignment alignment) { /** * The maximum number of payments that can be collected in this periodic limit. _Note:_ - * Only supported for the PayTo scheme, where it is required. + * This is only supported for the PayTo scheme, where it is required. * */ public PeriodicLimits withMaxPayments(Integer maxPayments) { From 4d70b77433d4ea0e5a02e6853f8b420837670287 Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Wed, 20 May 2026 16:47:37 +0000 Subject: [PATCH 5/5] Changes generated by 072c0250a5cabd3578679c838c7bf8d678094c03 This commit was automatically created from gocardless/client-library-templates@072c0250a5cabd3578679c838c7bf8d678094c03 by the `push-files` action. Workflow run: https://github.com/gocardless/client-library-templates/actions/runs/26176239684 --- .../BalancesListCodeSampleTest.java | 54 +++++++++++++++ .../BankAccountDetailsGetCodeSampleTest.java | 53 +++++++++++++++ ...lderVerificationsCreateCodeSampleTest.java | 55 +++++++++++++++ ...tHolderVerificationsGetCodeSampleTest.java | 53 +++++++++++++++ ...ankAuthorisationsCreateCodeSampleTest.java | 55 +++++++++++++++ .../BankAuthorisationsGetCodeSampleTest.java | 53 +++++++++++++++ ...ankDetailsLookupsCreateCodeSampleTest.java | 55 +++++++++++++++ ...llingRequestFlowsCreateCodeSampleTest.java | 59 ++++++++++++++++ ...gRequestFlowsInitialiseCodeSampleTest.java | 53 +++++++++++++++ ...gRequestTemplatesCreateCodeSampleTest.java | 57 ++++++++++++++++ ...lingRequestTemplatesGetCodeSampleTest.java | 53 +++++++++++++++ ...ingRequestTemplatesListCodeSampleTest.java | 57 ++++++++++++++++ ...gRequestTemplatesUpdateCodeSampleTest.java | 55 +++++++++++++++ .../BillingRequestsCancelCodeSampleTest.java | 53 +++++++++++++++ ...uestsCollectBankAccountCodeSampleTest.java | 55 +++++++++++++++ ...sCollectCustomerDetailsCodeSampleTest.java | 56 ++++++++++++++++ ...estsConfirmPayerDetailsCodeSampleTest.java | 53 +++++++++++++++ .../BillingRequestsCreateCodeSampleTest.java | 55 +++++++++++++++ .../BillingRequestsFulfilCodeSampleTest.java | 53 +++++++++++++++ .../BillingRequestsGetCodeSampleTest.java | 53 +++++++++++++++ .../BillingRequestsListCodeSampleTest.java | 56 ++++++++++++++++ .../BillingRequestsNotifyCodeSampleTest.java | 54 +++++++++++++++ .../BlocksBlockByRefCodeSampleTest.java | 56 ++++++++++++++++ .../BlocksCreateCodeSampleTest.java | 55 +++++++++++++++ .../BlocksDisableCodeSampleTest.java | 53 +++++++++++++++ .../BlocksEnableCodeSampleTest.java | 53 +++++++++++++++ .../code_samples/BlocksGetCodeSampleTest.java | 53 +++++++++++++++ .../BlocksListCodeSampleTest.java | 56 ++++++++++++++++ ...ditorBankAccountsCreateCodeSampleTest.java | 55 +++++++++++++++ ...itorBankAccountsDisableCodeSampleTest.java | 53 +++++++++++++++ ...CreditorBankAccountsGetCodeSampleTest.java | 54 +++++++++++++++ ...reditorBankAccountsListCodeSampleTest.java | 57 ++++++++++++++++ .../CreditorsCreateCodeSampleTest.java | 56 ++++++++++++++++ .../CreditorsGetCodeSampleTest.java | 53 +++++++++++++++ .../CreditorsListCodeSampleTest.java | 56 ++++++++++++++++ .../CreditorsUpdateCodeSampleTest.java | 53 +++++++++++++++ ...rrencyExchangeRatesListCodeSampleTest.java | 54 +++++++++++++++ ...tomerBankAccountsCreateCodeSampleTest.java | 56 ++++++++++++++++ ...omerBankAccountsDisableCodeSampleTest.java | 53 +++++++++++++++ ...CustomerBankAccountsGetCodeSampleTest.java | 54 +++++++++++++++ ...ustomerBankAccountsListCodeSampleTest.java | 57 ++++++++++++++++ ...tomerBankAccountsUpdateCodeSampleTest.java | 54 +++++++++++++++ ...omerNotificationsHandleCodeSampleTest.java | 54 +++++++++++++++ .../CustomersCreateCodeSampleTest.java | 57 ++++++++++++++++ .../CustomersGetCodeSampleTest.java | 53 +++++++++++++++ .../CustomersListCodeSampleTest.java | 56 ++++++++++++++++ .../CustomersRemoveCodeSampleTest.java | 53 +++++++++++++++ .../CustomersUpdateCodeSampleTest.java | 54 +++++++++++++++ .../code_samples/EventsGetCodeSampleTest.java | 53 +++++++++++++++ .../EventsListCodeSampleTest.java | 57 ++++++++++++++++ .../ExportsGetCodeSampleTest.java | 53 +++++++++++++++ .../ExportsListCodeSampleTest.java | 55 +++++++++++++++ ...undsAvailabilitiesCheckCodeSampleTest.java | 53 +++++++++++++++ ...stalmentSchedulesCancelCodeSampleTest.java | 53 +++++++++++++++ ...chedulesCreateWithDatesCodeSampleTest.java | 66 ++++++++++++++++++ ...dulesCreateWithScheduleCodeSampleTest.java | 65 ++++++++++++++++++ .../InstalmentSchedulesGetCodeSampleTest.java | 54 +++++++++++++++ ...InstalmentSchedulesListCodeSampleTest.java | 57 ++++++++++++++++ ...stalmentSchedulesUpdateCodeSampleTest.java | 53 +++++++++++++++ .../InstitutionsListCodeSampleTest.java | 57 ++++++++++++++++ ...nsListForBillingRequestCodeSampleTest.java | 54 +++++++++++++++ .../LogosCreateForCreditorCodeSampleTest.java | 55 +++++++++++++++ ...dateImportEntriesCreateCodeSampleTest.java | 61 +++++++++++++++++ ...andateImportEntriesListCodeSampleTest.java | 57 ++++++++++++++++ .../MandateImportsCancelCodeSampleTest.java | 53 +++++++++++++++ .../MandateImportsCreateCodeSampleTest.java | 55 +++++++++++++++ .../MandateImportsGetCodeSampleTest.java | 53 +++++++++++++++ .../MandateImportsSubmitCodeSampleTest.java | 53 +++++++++++++++ .../MandatePdfsCreateCodeSampleTest.java | 60 +++++++++++++++++ .../MandatesCancelCodeSampleTest.java | 53 +++++++++++++++ .../MandatesCreateCodeSampleTest.java | 55 +++++++++++++++ .../MandatesGetCodeSampleTest.java | 53 +++++++++++++++ .../MandatesListCodeSampleTest.java | 56 ++++++++++++++++ .../MandatesReinstateCodeSampleTest.java | 53 +++++++++++++++ .../MandatesUpdateCodeSampleTest.java | 53 +++++++++++++++ ...gativeBalanceLimitsListCodeSampleTest.java | 56 ++++++++++++++++ ...aymentImportEntriesListCodeSampleTest.java | 55 +++++++++++++++ ...undPaymentImportsCreateCodeSampleTest.java | 67 +++++++++++++++++++ ...tboundPaymentImportsGetCodeSampleTest.java | 53 +++++++++++++++ ...boundPaymentImportsListCodeSampleTest.java | 54 +++++++++++++++ ...OutboundPaymentsApproveCodeSampleTest.java | 53 +++++++++++++++ .../OutboundPaymentsCancelCodeSampleTest.java | 53 +++++++++++++++ .../OutboundPaymentsCreateCodeSampleTest.java | 57 ++++++++++++++++ .../OutboundPaymentsGetCodeSampleTest.java | 53 +++++++++++++++ .../OutboundPaymentsListCodeSampleTest.java | 54 +++++++++++++++ .../OutboundPaymentsStatsCodeSampleTest.java | 53 +++++++++++++++ .../OutboundPaymentsUpdateCodeSampleTest.java | 54 +++++++++++++++ ...utboundPaymentsWithdrawCodeSampleTest.java | 57 ++++++++++++++++ ...erAuthorisationsConfirmCodeSampleTest.java | 54 +++++++++++++++ ...yerAuthorisationsCreateCodeSampleTest.java | 58 ++++++++++++++++ .../PayerAuthorisationsGetCodeSampleTest.java | 54 +++++++++++++++ ...yerAuthorisationsSubmitCodeSampleTest.java | 54 +++++++++++++++ ...yerAuthorisationsUpdateCodeSampleTest.java | 62 +++++++++++++++++ ...ThemesCreateForCreditorCodeSampleTest.java | 56 ++++++++++++++++ ...tAccountTransactionsGetCodeSampleTest.java | 53 +++++++++++++++ ...AccountTransactionsListCodeSampleTest.java | 55 +++++++++++++++ .../PaymentsCancelCodeSampleTest.java | 53 +++++++++++++++ .../PaymentsCreateCodeSampleTest.java | 57 ++++++++++++++++ .../PaymentsGetCodeSampleTest.java | 53 +++++++++++++++ .../PaymentsListCodeSampleTest.java | 56 ++++++++++++++++ .../PaymentsRetryCodeSampleTest.java | 53 +++++++++++++++ .../PaymentsUpdateCodeSampleTest.java | 54 +++++++++++++++ .../PayoutItemsListCodeSampleTest.java | 54 +++++++++++++++ .../PayoutsGetCodeSampleTest.java | 53 +++++++++++++++ .../PayoutsListCodeSampleTest.java | 56 ++++++++++++++++ .../PayoutsUpdateCodeSampleTest.java | 53 +++++++++++++++ .../RedirectFlowsCompleteCodeSampleTest.java | 54 +++++++++++++++ .../RedirectFlowsCreateCodeSampleTest.java | 58 ++++++++++++++++ .../RedirectFlowsGetCodeSampleTest.java | 53 +++++++++++++++ .../RefundsCreateCodeSampleTest.java | 55 +++++++++++++++ .../RefundsGetCodeSampleTest.java | 53 +++++++++++++++ .../RefundsListCodeSampleTest.java | 55 +++++++++++++++ .../RefundsUpdateCodeSampleTest.java | 53 +++++++++++++++ .../ScenarioSimulatorsRunCodeSampleTest.java | 53 +++++++++++++++ ...SchemeIdentifiersCreateCodeSampleTest.java | 56 ++++++++++++++++ .../SchemeIdentifiersGetCodeSampleTest.java | 53 +++++++++++++++ .../SchemeIdentifiersListCodeSampleTest.java | 56 ++++++++++++++++ .../SubscriptionsCancelCodeSampleTest.java | 53 +++++++++++++++ .../SubscriptionsCreateCodeSampleTest.java | 57 ++++++++++++++++ .../SubscriptionsGetCodeSampleTest.java | 53 +++++++++++++++ .../SubscriptionsListCodeSampleTest.java | 57 ++++++++++++++++ .../SubscriptionsPauseCodeSampleTest.java | 53 +++++++++++++++ .../SubscriptionsResumeCodeSampleTest.java | 53 +++++++++++++++ .../SubscriptionsUpdateCodeSampleTest.java | 53 +++++++++++++++ .../TaxRatesGetCodeSampleTest.java | 53 +++++++++++++++ .../TaxRatesListCodeSampleTest.java | 54 +++++++++++++++ ...atesTransferredMandatesCodeSampleTest.java | 53 +++++++++++++++ ...rificationDetailsCreateCodeSampleTest.java | 66 ++++++++++++++++++ ...VerificationDetailsListCodeSampleTest.java | 57 ++++++++++++++++ .../WebhooksGetCodeSampleTest.java | 53 +++++++++++++++ .../WebhooksListCodeSampleTest.java | 57 ++++++++++++++++ .../WebhooksRetryCodeSampleTest.java | 53 +++++++++++++++ 132 files changed, 7249 insertions(+) create mode 100644 src/test/java/com/gocardless/code_samples/BalancesListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BankAccountDetailsGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BankAccountHolderVerificationsCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BankAccountHolderVerificationsGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BankAuthorisationsCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BankAuthorisationsGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BankDetailsLookupsCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BillingRequestFlowsCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BillingRequestFlowsInitialiseCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BillingRequestTemplatesCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BillingRequestTemplatesGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BillingRequestTemplatesListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BillingRequestTemplatesUpdateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BillingRequestsCancelCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BillingRequestsCollectBankAccountCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BillingRequestsCollectCustomerDetailsCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BillingRequestsConfirmPayerDetailsCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BillingRequestsCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BillingRequestsFulfilCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BillingRequestsGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BillingRequestsListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BillingRequestsNotifyCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BlocksBlockByRefCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BlocksCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BlocksDisableCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BlocksEnableCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BlocksGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/BlocksListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/CreditorBankAccountsCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/CreditorBankAccountsDisableCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/CreditorBankAccountsGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/CreditorBankAccountsListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/CreditorsCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/CreditorsGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/CreditorsListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/CreditorsUpdateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/CurrencyExchangeRatesListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/CustomerBankAccountsCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/CustomerBankAccountsDisableCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/CustomerBankAccountsGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/CustomerBankAccountsListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/CustomerBankAccountsUpdateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/CustomerNotificationsHandleCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/CustomersCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/CustomersGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/CustomersListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/CustomersRemoveCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/CustomersUpdateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/EventsGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/EventsListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/ExportsGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/ExportsListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/FundsAvailabilitiesCheckCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/InstalmentSchedulesCancelCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/InstalmentSchedulesCreateWithDatesCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/InstalmentSchedulesCreateWithScheduleCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/InstalmentSchedulesGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/InstalmentSchedulesListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/InstalmentSchedulesUpdateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/InstitutionsListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/InstitutionsListForBillingRequestCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/LogosCreateForCreditorCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/MandateImportEntriesCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/MandateImportEntriesListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/MandateImportsCancelCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/MandateImportsCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/MandateImportsGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/MandateImportsSubmitCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/MandatePdfsCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/MandatesCancelCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/MandatesCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/MandatesGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/MandatesListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/MandatesReinstateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/MandatesUpdateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/NegativeBalanceLimitsListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/OutboundPaymentImportEntriesListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/OutboundPaymentImportsCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/OutboundPaymentImportsGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/OutboundPaymentImportsListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/OutboundPaymentsApproveCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/OutboundPaymentsCancelCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/OutboundPaymentsCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/OutboundPaymentsGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/OutboundPaymentsListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/OutboundPaymentsStatsCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/OutboundPaymentsUpdateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/OutboundPaymentsWithdrawCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/PayerAuthorisationsConfirmCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/PayerAuthorisationsCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/PayerAuthorisationsGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/PayerAuthorisationsSubmitCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/PayerAuthorisationsUpdateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/PayerThemesCreateForCreditorCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/PaymentAccountTransactionsGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/PaymentAccountTransactionsListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/PaymentsCancelCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/PaymentsCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/PaymentsGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/PaymentsListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/PaymentsRetryCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/PaymentsUpdateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/PayoutItemsListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/PayoutsGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/PayoutsListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/PayoutsUpdateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/RedirectFlowsCompleteCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/RedirectFlowsCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/RedirectFlowsGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/RefundsCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/RefundsGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/RefundsListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/RefundsUpdateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/ScenarioSimulatorsRunCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/SchemeIdentifiersCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/SchemeIdentifiersGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/SchemeIdentifiersListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/SubscriptionsCancelCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/SubscriptionsCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/SubscriptionsGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/SubscriptionsListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/SubscriptionsPauseCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/SubscriptionsResumeCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/SubscriptionsUpdateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/TaxRatesGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/TaxRatesListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/TransferredMandatesTransferredMandatesCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/VerificationDetailsCreateCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/VerificationDetailsListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/WebhooksGetCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/WebhooksListCodeSampleTest.java create mode 100644 src/test/java/com/gocardless/code_samples/WebhooksRetryCodeSampleTest.java diff --git a/src/test/java/com/gocardless/code_samples/BalancesListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BalancesListCodeSampleTest.java new file mode 100644 index 00000000..7fe11a9a --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BalancesListCodeSampleTest.java @@ -0,0 +1,54 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BalancesListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"balances\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.balances().all().withCreditor("CR123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BankAccountDetailsGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BankAccountDetailsGetCodeSampleTest.java new file mode 100644 index 00000000..fbc01e19 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BankAccountDetailsGetCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BankAccountDetailsGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"bank_account_details\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.bankAccountDetails().get("BA123").withHeader("Gc-Key-Id", "PK123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BankAccountHolderVerificationsCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BankAccountHolderVerificationsCreateCodeSampleTest.java new file mode 100644 index 00000000..5d3d1cf4 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BankAccountHolderVerificationsCreateCodeSampleTest.java @@ -0,0 +1,55 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import com.gocardless.services.BankAccountHolderVerificationService.BankAccountHolderVerificationCreateRequest.Type; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BankAccountHolderVerificationsCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"bank_account_holder_verifications\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.bankAccountHolderVerifications().create().withType(Type.CONFIRMATION_OF_PAYEE) + .withLinksBankAccount("BA123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BankAccountHolderVerificationsGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BankAccountHolderVerificationsGetCodeSampleTest.java new file mode 100644 index 00000000..cfa027b7 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BankAccountHolderVerificationsGetCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BankAccountHolderVerificationsGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"bank_account_holder_verifications\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.bankAccountHolderVerifications().get("BAHV123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BankAuthorisationsCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BankAuthorisationsCreateCodeSampleTest.java new file mode 100644 index 00000000..a42af3d6 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BankAuthorisationsCreateCodeSampleTest.java @@ -0,0 +1,55 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BankAuthorisationsCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"bank_authorisations\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + BankAuthorisation bankAuthorisation = client.bankAuthorisations().create() + .withRedirectUri("https://my-company.com/landing") + .withLinksBillingRequest("BRQ123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BankAuthorisationsGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BankAuthorisationsGetCodeSampleTest.java new file mode 100644 index 00000000..4d07b98a --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BankAuthorisationsGetCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BankAuthorisationsGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"bank_authorisations\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.bankAuthorisations().get("BAU123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BankDetailsLookupsCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BankDetailsLookupsCreateCodeSampleTest.java new file mode 100644 index 00000000..e562b35e --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BankDetailsLookupsCreateCodeSampleTest.java @@ -0,0 +1,55 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BankDetailsLookupsCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"bank_details_lookups\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + BankDetailsLookup bankDetailsLookup = + client.bankDetailsLookups().create().withAccountNumber("55779911") + .withBranchCode("200000").withCountryCode("GB").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BillingRequestFlowsCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BillingRequestFlowsCreateCodeSampleTest.java new file mode 100644 index 00000000..cc5c986e --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BillingRequestFlowsCreateCodeSampleTest.java @@ -0,0 +1,59 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BillingRequestFlowsCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"billing_request_flows\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + BillingRequestFlow billingRequestFlow = client.billingRequestFlows().create() + .withRedirectUri("https://my-company.com/landing") + .withExitUri("https://my-company.com/exit") + .withPrefilledCustomerGivenName("Frank") + .withPrefilledCustomerFamilyName("Osborne") + .withPrefilledCustomerEmail("frank.osborne@acmeplc.com") + .withLinksBillingRequest("BRQ123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BillingRequestFlowsInitialiseCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BillingRequestFlowsInitialiseCodeSampleTest.java new file mode 100644 index 00000000..68265adf --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BillingRequestFlowsInitialiseCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BillingRequestFlowsInitialiseCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testInitialiseCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"billing_request_flows\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.billingRequestFlows().initialise("BRF123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BillingRequestTemplatesCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BillingRequestTemplatesCreateCodeSampleTest.java new file mode 100644 index 00000000..f96e000c --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BillingRequestTemplatesCreateCodeSampleTest.java @@ -0,0 +1,57 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BillingRequestTemplatesCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"billing_request_templates\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + BillingRequestTemplate billingRequestTemplate = client.billingRequestTemplates() + .create().withPaymentRequestDescription("One-time joining fee") + .withPaymentRequestCurrency("GBP").withPaymentRequestAmount("69.99") + .withMandateRequestCurrency("GBP") + .withRedirectUri("https://my-company.com/landing").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BillingRequestTemplatesGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BillingRequestTemplatesGetCodeSampleTest.java new file mode 100644 index 00000000..f75f5926 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BillingRequestTemplatesGetCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BillingRequestTemplatesGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"billing_request_templates\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.billingRequestTemplates().get("BRT123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BillingRequestTemplatesListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BillingRequestTemplatesListCodeSampleTest.java new file mode 100644 index 00000000..b8d091a4 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BillingRequestTemplatesListCodeSampleTest.java @@ -0,0 +1,57 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BillingRequestTemplatesListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"billing_request_templates\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + for (BillingRequestTemplate billingRequestTemplate : client.billingRequestTemplates() + .all().execute()) { + System.out.println(billingRequestTemplate.getId()); + } + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BillingRequestTemplatesUpdateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BillingRequestTemplatesUpdateCodeSampleTest.java new file mode 100644 index 00000000..deb2c210 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BillingRequestTemplatesUpdateCodeSampleTest.java @@ -0,0 +1,55 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BillingRequestTemplatesUpdateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testUpdateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"billing_request_templates\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + BillingRequestTemplate billingRequestTemplate = client.billingRequestTemplates() + .update("BRT123").withName("12 Month Silver Plan") + .withPaymentRequestAmount("49.99").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BillingRequestsCancelCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BillingRequestsCancelCodeSampleTest.java new file mode 100644 index 00000000..e2583427 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BillingRequestsCancelCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BillingRequestsCancelCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCancelCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"billing_requests\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.billingRequests().cancel("BR123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BillingRequestsCollectBankAccountCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BillingRequestsCollectBankAccountCodeSampleTest.java new file mode 100644 index 00000000..bb8fa869 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BillingRequestsCollectBankAccountCodeSampleTest.java @@ -0,0 +1,55 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BillingRequestsCollectBankAccountCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCollectBankAccountCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"billing_requests\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.billingRequests().collectBankAccount("BR123").withAccountNumber("55779911") + .withBranchCode("200000").withAccountHolderName("Frank Osborne") + .withCountryCode("GB").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BillingRequestsCollectCustomerDetailsCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BillingRequestsCollectCustomerDetailsCodeSampleTest.java new file mode 100644 index 00000000..cccd59b7 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BillingRequestsCollectCustomerDetailsCodeSampleTest.java @@ -0,0 +1,56 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BillingRequestsCollectCustomerDetailsCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCollectCustomerDetailsCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"billing_requests\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.billingRequests().collectCustomerDetails("BR123") + .withCustomerEmail("alice@example.com").withCustomerGivenName("Alice") + .withCustomerFamilyName("Smith") + .withCustomerBillingDetailAddressLine1("1 Somewhere Lane").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BillingRequestsConfirmPayerDetailsCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BillingRequestsConfirmPayerDetailsCodeSampleTest.java new file mode 100644 index 00000000..8d0f6799 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BillingRequestsConfirmPayerDetailsCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BillingRequestsConfirmPayerDetailsCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testConfirmPayerDetailsCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"billing_requests\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.billingRequests().confirmPayerDetails("BR123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BillingRequestsCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BillingRequestsCreateCodeSampleTest.java new file mode 100644 index 00000000..8d3a3e40 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BillingRequestsCreateCodeSampleTest.java @@ -0,0 +1,55 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BillingRequestsCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"billing_requests\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + BillingRequest billingRequest = client.billingRequests().create() + .withPaymentRequestDescription("First Payment").withPaymentRequestAmount(500) + .withPaymentRequestCurrency("GBP").withMandateRequestScheme("bacs").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BillingRequestsFulfilCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BillingRequestsFulfilCodeSampleTest.java new file mode 100644 index 00000000..2ed37c26 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BillingRequestsFulfilCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BillingRequestsFulfilCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testFulfilCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"billing_requests\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.billingRequests().fulfil("BR123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BillingRequestsGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BillingRequestsGetCodeSampleTest.java new file mode 100644 index 00000000..5718acd2 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BillingRequestsGetCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BillingRequestsGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"billing_requests\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.billingRequests().get("BR123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BillingRequestsListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BillingRequestsListCodeSampleTest.java new file mode 100644 index 00000000..0d91f5ce --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BillingRequestsListCodeSampleTest.java @@ -0,0 +1,56 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BillingRequestsListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"billing_requests\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + for (BillingRequest billingRequest : client.billingRequests().all().execute()) { + System.out.println(billingRequest.getId()); + } + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BillingRequestsNotifyCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BillingRequestsNotifyCodeSampleTest.java new file mode 100644 index 00000000..5ef91d11 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BillingRequestsNotifyCodeSampleTest.java @@ -0,0 +1,54 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BillingRequestsNotifyCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testNotifyCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"billing_requests\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.billingRequests().notify("BR123").withNotificationType("email") + .withRedirectUri("https://my-company.com").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BlocksBlockByRefCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BlocksBlockByRefCodeSampleTest.java new file mode 100644 index 00000000..6f2e9972 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BlocksBlockByRefCodeSampleTest.java @@ -0,0 +1,56 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BlocksBlockByRefCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testBlockByRefCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"blocks\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + for (Block block : client.blocks().blockByRef().withReferenceType("customer") + .withReferenceValue("CU123").withReasonType("no_intent_to_pay").execute()) { + System.out.println(block.getId()); + } + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BlocksCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BlocksCreateCodeSampleTest.java new file mode 100644 index 00000000..151a633d --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BlocksCreateCodeSampleTest.java @@ -0,0 +1,55 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BlocksCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"blocks\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + Block block = client.blocks().create().withBlockType("email") + .withReasonType("no_intent_to_pay").withResourceReference("example@example.com") + .execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BlocksDisableCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BlocksDisableCodeSampleTest.java new file mode 100644 index 00000000..81adb129 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BlocksDisableCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BlocksDisableCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testDisableCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"blocks\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + Block block = client.blocks().disable("BLC123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BlocksEnableCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BlocksEnableCodeSampleTest.java new file mode 100644 index 00000000..08e6beb9 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BlocksEnableCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BlocksEnableCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testEnableCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"blocks\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + Block block = client.blocks().enable("BLC123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BlocksGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BlocksGetCodeSampleTest.java new file mode 100644 index 00000000..a42e9971 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BlocksGetCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BlocksGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"blocks\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + Block block = client.blocks().get("BLC456").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/BlocksListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/BlocksListCodeSampleTest.java new file mode 100644 index 00000000..bfd5a594 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/BlocksListCodeSampleTest.java @@ -0,0 +1,56 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class BlocksListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"blocks\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + for (Block block : client.blocks().all().execute()) { + System.out.println(block.getId()); + System.out.println(block.getBlockType()); + } + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/CreditorBankAccountsCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/CreditorBankAccountsCreateCodeSampleTest.java new file mode 100644 index 00000000..212eddf3 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/CreditorBankAccountsCreateCodeSampleTest.java @@ -0,0 +1,55 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CreditorBankAccountsCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"creditor_bank_accounts\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + CreditorBankAccount creditorBankAccount = client.creditorBankAccounts().create() + .withAccountNumber("55779911").withBranchCode("200000").withCountryCode("GB") + .withAccountHolderName("Acme").withLinksCreditor("CR123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/CreditorBankAccountsDisableCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/CreditorBankAccountsDisableCodeSampleTest.java new file mode 100644 index 00000000..31844c39 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/CreditorBankAccountsDisableCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CreditorBankAccountsDisableCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testDisableCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"creditor_bank_accounts\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.creditorBankAccounts().disable("BA123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/CreditorBankAccountsGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/CreditorBankAccountsGetCodeSampleTest.java new file mode 100644 index 00000000..0584f3c3 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/CreditorBankAccountsGetCodeSampleTest.java @@ -0,0 +1,54 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CreditorBankAccountsGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"creditor_bank_accounts\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + CreditorBankAccount creditorBankAccount = + client.creditorBankAccounts().get("BA123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/CreditorBankAccountsListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/CreditorBankAccountsListCodeSampleTest.java new file mode 100644 index 00000000..51b17b8f --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/CreditorBankAccountsListCodeSampleTest.java @@ -0,0 +1,57 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CreditorBankAccountsListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"creditor_bank_accounts\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + for (CreditorBankAccount creditorBankAccount : client.creditorBankAccounts().all() + .withCreditor("CR123").execute()) { + System.out.println(creditorBankAccount.getId()); + } + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/CreditorsCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/CreditorsCreateCodeSampleTest.java new file mode 100644 index 00000000..cdcdf313 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/CreditorsCreateCodeSampleTest.java @@ -0,0 +1,56 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import com.gocardless.services.CreditorService.CreditorCreateRequest.CreditorType; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CreditorsCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"creditors\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + Creditor creditor = client.creditors().create().withName("Acme").withCountryCode("GB") + .withCreditorType(CreditorType.COMPANY).withBankReferencePrefix("ACME") + .execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/CreditorsGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/CreditorsGetCodeSampleTest.java new file mode 100644 index 00000000..39488c32 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/CreditorsGetCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CreditorsGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"creditors\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + Creditor creditor = client.creditors().get("CR123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/CreditorsListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/CreditorsListCodeSampleTest.java new file mode 100644 index 00000000..91841316 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/CreditorsListCodeSampleTest.java @@ -0,0 +1,56 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CreditorsListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"creditors\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + for (Creditor creditor : client.creditors().all().execute()) { + System.out.println(creditor.getId()); + } + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/CreditorsUpdateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/CreditorsUpdateCodeSampleTest.java new file mode 100644 index 00000000..3ccd9e39 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/CreditorsUpdateCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CreditorsUpdateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testUpdateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"creditors\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.creditors().update("CR123").withLinksDefaultGbpPayoutAccount("BA789").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/CurrencyExchangeRatesListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/CurrencyExchangeRatesListCodeSampleTest.java new file mode 100644 index 00000000..da3f04fe --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/CurrencyExchangeRatesListCodeSampleTest.java @@ -0,0 +1,54 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CurrencyExchangeRatesListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"currency_exchange_rates\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.currencyExchangeRates().all().withSource("EUR").withTarget("GBP").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/CustomerBankAccountsCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/CustomerBankAccountsCreateCodeSampleTest.java new file mode 100644 index 00000000..41762235 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/CustomerBankAccountsCreateCodeSampleTest.java @@ -0,0 +1,56 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CustomerBankAccountsCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"customer_bank_accounts\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + CustomerBankAccount customerBankAccount = + client.customerBankAccounts().create().withAccountNumber("55779911") + .withBranchCode("200000").withAccountHolderName("Frank Osborne") + .withCountryCode("GB").withLinksCustomer("CU123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/CustomerBankAccountsDisableCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/CustomerBankAccountsDisableCodeSampleTest.java new file mode 100644 index 00000000..0396aa8e --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/CustomerBankAccountsDisableCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CustomerBankAccountsDisableCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testDisableCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"customer_bank_accounts\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.customerBankAccounts().disable("BA123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/CustomerBankAccountsGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/CustomerBankAccountsGetCodeSampleTest.java new file mode 100644 index 00000000..1d59cafb --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/CustomerBankAccountsGetCodeSampleTest.java @@ -0,0 +1,54 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CustomerBankAccountsGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"customer_bank_accounts\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + CustomerBankAccount customerBankAccount = + client.customerBankAccounts().get("BA123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/CustomerBankAccountsListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/CustomerBankAccountsListCodeSampleTest.java new file mode 100644 index 00000000..ccee6068 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/CustomerBankAccountsListCodeSampleTest.java @@ -0,0 +1,57 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CustomerBankAccountsListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"customer_bank_accounts\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + for (CustomerBankAccount customerBankAccount : client.customerBankAccounts().all() + .withCustomer("CU123").withEnabled(true).execute()) { + System.out.println(customerBankAccount.getAccountHolderName()); + } + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/CustomerBankAccountsUpdateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/CustomerBankAccountsUpdateCodeSampleTest.java new file mode 100644 index 00000000..b8b7c775 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/CustomerBankAccountsUpdateCodeSampleTest.java @@ -0,0 +1,54 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CustomerBankAccountsUpdateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testUpdateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"customer_bank_accounts\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.customerBankAccounts().update("BA123") + .withMetadata("description", "Business account").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/CustomerNotificationsHandleCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/CustomerNotificationsHandleCodeSampleTest.java new file mode 100644 index 00000000..041f19ef --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/CustomerNotificationsHandleCodeSampleTest.java @@ -0,0 +1,54 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CustomerNotificationsHandleCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testHandleCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"customer_notifications\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + CustomerNotification customerNotification = + client.customerNotifications().handle("PCN123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/CustomersCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/CustomersCreateCodeSampleTest.java new file mode 100644 index 00000000..b376c1bb --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/CustomersCreateCodeSampleTest.java @@ -0,0 +1,57 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CustomersCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"customers\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + Customer customer = client.customers().create().withEmail("user@example.com") + .withGivenName("Frank").withFamilyName("Osborne") + .withAddressLine1("27 Acer Road").withAddressLine2("Apt 2").withCity("London") + .withPostalCode("E8 3GX").withCountryCode("GB") + .withMetadata("salesforce_id", "ABCD1234").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/CustomersGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/CustomersGetCodeSampleTest.java new file mode 100644 index 00000000..cf567b17 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/CustomersGetCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CustomersGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"customers\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + Customer customer = client.customers().get("CU123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/CustomersListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/CustomersListCodeSampleTest.java new file mode 100644 index 00000000..8b4b7192 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/CustomersListCodeSampleTest.java @@ -0,0 +1,56 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CustomersListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"customers\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + for (Customer customer : client.customers().all().execute()) { + System.out.println(customer.getId()); + } + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/CustomersRemoveCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/CustomersRemoveCodeSampleTest.java new file mode 100644 index 00000000..51dea482 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/CustomersRemoveCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CustomersRemoveCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testRemoveCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"customers\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.customers().remove("CU123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/CustomersUpdateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/CustomersUpdateCodeSampleTest.java new file mode 100644 index 00000000..6ffc5367 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/CustomersUpdateCodeSampleTest.java @@ -0,0 +1,54 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CustomersUpdateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testUpdateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"customers\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.customers().update("CU123").withEmail("updated_user@example.com") + .withGivenName("Jenny").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/EventsGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/EventsGetCodeSampleTest.java new file mode 100644 index 00000000..13d43686 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/EventsGetCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class EventsGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"events\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + Event event = client.events().get("EV123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/EventsListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/EventsListCodeSampleTest.java new file mode 100644 index 00000000..9e8e0dac --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/EventsListCodeSampleTest.java @@ -0,0 +1,57 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import com.gocardless.services.EventService.EventListRequest.ResourceType; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class EventsListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"events\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + for (Event event : client.events().all().withResourceType(ResourceType.PAYMENTS) + .execute()) { + System.out.println(event.getAction()); + } + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/ExportsGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/ExportsGetCodeSampleTest.java new file mode 100644 index 00000000..d27b566d --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/ExportsGetCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class ExportsGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"exports\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + Export export = client.exports().get("EX123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/ExportsListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/ExportsListCodeSampleTest.java new file mode 100644 index 00000000..fce4916d --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/ExportsListCodeSampleTest.java @@ -0,0 +1,55 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class ExportsListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"exports\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + for (Export export : client.exports().all().execute()) { + System.out.println(export.getId()); + } + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/FundsAvailabilitiesCheckCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/FundsAvailabilitiesCheckCodeSampleTest.java new file mode 100644 index 00000000..471df596 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/FundsAvailabilitiesCheckCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class FundsAvailabilitiesCheckCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCheckCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"funds_availability\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.fundsAvailabilities().check("MD123").withAmount("1000").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/InstalmentSchedulesCancelCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/InstalmentSchedulesCancelCodeSampleTest.java new file mode 100644 index 00000000..1b06bd8b --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/InstalmentSchedulesCancelCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class InstalmentSchedulesCancelCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCancelCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"instalment_schedules\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.instalmentSchedules().cancel("IS123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/InstalmentSchedulesCreateWithDatesCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/InstalmentSchedulesCreateWithDatesCodeSampleTest.java new file mode 100644 index 00000000..5a453621 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/InstalmentSchedulesCreateWithDatesCodeSampleTest.java @@ -0,0 +1,66 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import com.gocardless.services.InstalmentScheduleService.InstalmentScheduleCreateWithDatesRequest.Currency; +import com.gocardless.services.InstalmentScheduleService.InstalmentScheduleCreateWithDatesRequest.Instalments; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.Arrays; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class InstalmentSchedulesCreateWithDatesCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateWithDatesCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"instalment_schedules\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + InstalmentSchedule instalmentSchedule = client.instalmentSchedules().createWithDates() + .withTotalAmount(10000) // 100 GBP in Pence, collected from the end customer. + .withAppFee(10) // Your 10 pence fee, applied to each instalment, to be + // paid out to you + .withCurrency(Currency.GBP) + .withInstalments(Arrays.asList( + new Instalments().withAmount(3400).withChargeDate("2019-08-20"), + new Instalments().withAmount(3400).withChargeDate("2019-09-03"), + new Instalments().withAmount(3200).withChargeDate("2019-09-17"))) + .withLinksMandate("MD0000YTKZKY4J").withMetadata("invoiceId", "001") + .withIdempotencyKey("random_instalment_schedule_specific_string").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/InstalmentSchedulesCreateWithScheduleCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/InstalmentSchedulesCreateWithScheduleCodeSampleTest.java new file mode 100644 index 00000000..c2d88e3e --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/InstalmentSchedulesCreateWithScheduleCodeSampleTest.java @@ -0,0 +1,65 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import com.gocardless.services.InstalmentScheduleService.InstalmentScheduleCreateWithScheduleRequest.Instalments.IntervalUnit; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.Arrays; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class InstalmentSchedulesCreateWithScheduleCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateWithScheduleCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"instalment_schedules\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + InstalmentSchedule instalmentSchedule = client.instalmentSchedules() + .createWithSchedule().withTotalAmount(10000) // 100 GBP in Pence, collected from + // the customer. + .withAppFee(10) // Your 10 pence fee, applied to each instalment, to be + // paid out to you + .withCurrency( + com.gocardless.services.InstalmentScheduleService.InstalmentScheduleCreateWithScheduleRequest.Currency.GBP) + .withInstalmentsIntervalUnit(IntervalUnit.WEEKLY).withInstalmentsInterval(2) + .withInstalmentsAmounts(Arrays.asList(3400, 3400, 3200)) + .withLinksMandate("MD0000YTKZKY4J").withMetadata("invoiceId", "001") + .withIdempotencyKey("random_instalment_schedule_specific_string").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/InstalmentSchedulesGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/InstalmentSchedulesGetCodeSampleTest.java new file mode 100644 index 00000000..311b2d9e --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/InstalmentSchedulesGetCodeSampleTest.java @@ -0,0 +1,54 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class InstalmentSchedulesGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"instalment_schedules\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + InstalmentSchedule instalmentSchedule = + client.instalmentSchedules().get("IS123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/InstalmentSchedulesListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/InstalmentSchedulesListCodeSampleTest.java new file mode 100644 index 00000000..58de12ba --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/InstalmentSchedulesListCodeSampleTest.java @@ -0,0 +1,57 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class InstalmentSchedulesListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"instalment_schedules\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + for (InstalmentSchedule instalmentSchedule : client.instalmentSchedules().all() + .execute()) { + System.out.println(instalmentSchedule.getId()); + } + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/InstalmentSchedulesUpdateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/InstalmentSchedulesUpdateCodeSampleTest.java new file mode 100644 index 00000000..d14de4bf --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/InstalmentSchedulesUpdateCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class InstalmentSchedulesUpdateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testUpdateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"instalment_schedules\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.instalmentSchedules().update("IS123").withMetadata("key", "value").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/InstitutionsListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/InstitutionsListCodeSampleTest.java new file mode 100644 index 00000000..e60a209e --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/InstitutionsListCodeSampleTest.java @@ -0,0 +1,57 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class InstitutionsListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"institutions\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + for (Institution institution : client.institutions().all().withCountryCode("GB") + .execute()) { + System.out.println(institution.getId()); + } + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/InstitutionsListForBillingRequestCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/InstitutionsListForBillingRequestCodeSampleTest.java new file mode 100644 index 00000000..3aa80e44 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/InstitutionsListForBillingRequestCodeSampleTest.java @@ -0,0 +1,54 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class InstitutionsListForBillingRequestCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListForBillingRequestCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"institutions\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.institutions().listForBillingRequest("BR123").withCountryCode("GB").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/LogosCreateForCreditorCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/LogosCreateForCreditorCodeSampleTest.java new file mode 100644 index 00000000..5b80f1a6 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/LogosCreateForCreditorCodeSampleTest.java @@ -0,0 +1,55 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class LogosCreateForCreditorCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateForCreditorCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"logos\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + Logo logo = client.logos().createForCreditor().withImage( + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAA") + .withLinksCreditor("CR123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/MandateImportEntriesCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/MandateImportEntriesCreateCodeSampleTest.java new file mode 100644 index 00000000..0d96904a --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/MandateImportEntriesCreateCodeSampleTest.java @@ -0,0 +1,61 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class MandateImportEntriesCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"mandate_import_entries\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + MandateImportEntry mandateImportEntry = + client.mandateImportEntries().create().withCustomerCompanyName("Jane's widgets") + .withCustomerEmail("jane@janeswidgets.fr") + .withBankAccountAccountHolderName("Jane Doe") + .withBankAccountIban("FR14BARC20000055779911") + .withAmendmentOriginalMandateReference("REFNMANDATE") + .withAmendmentOriginalCreditorId("FR123OTHERBANK") + .withAmendmentOriginalCreditorName("Existing DD Provider") + .withLinksMandateImport("IM000010790WX1").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/MandateImportEntriesListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/MandateImportEntriesListCodeSampleTest.java new file mode 100644 index 00000000..f7ba90d2 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/MandateImportEntriesListCodeSampleTest.java @@ -0,0 +1,57 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class MandateImportEntriesListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"mandate_import_entries\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + for (MandateImportEntry entry : client.mandateImportEntries().all() + .withMandateImport("IM000010790WX1").execute()) { + System.out.println(entry.getRecordIdentifier()); + } + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/MandateImportsCancelCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/MandateImportsCancelCodeSampleTest.java new file mode 100644 index 00000000..552d482b --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/MandateImportsCancelCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class MandateImportsCancelCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCancelCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"mandate_imports\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.mandateImports().cancel("IM123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/MandateImportsCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/MandateImportsCreateCodeSampleTest.java new file mode 100644 index 00000000..8e9abdaa --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/MandateImportsCreateCodeSampleTest.java @@ -0,0 +1,55 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class MandateImportsCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"mandate_imports\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + MandateImport mandateImport = client.mandateImports().create().withScheme( + com.gocardless.services.MandateImportService.MandateImportCreateRequest.Scheme.BACS) + .execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/MandateImportsGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/MandateImportsGetCodeSampleTest.java new file mode 100644 index 00000000..ed1209b6 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/MandateImportsGetCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class MandateImportsGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"mandate_imports\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + MandateImport mandateImport = client.mandateImports().get("IM123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/MandateImportsSubmitCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/MandateImportsSubmitCodeSampleTest.java new file mode 100644 index 00000000..b4b2757c --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/MandateImportsSubmitCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class MandateImportsSubmitCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testSubmitCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"mandate_imports\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.mandateImports().submit("IM123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/MandatePdfsCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/MandatePdfsCreateCodeSampleTest.java new file mode 100644 index 00000000..29f7afba --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/MandatePdfsCreateCodeSampleTest.java @@ -0,0 +1,60 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class MandatePdfsCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"mandate_pdfs\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + MandatePdf mandatePdfForMandate = + client.mandatePdfs().create().withLinksMandate("MD123").execute(); + MandatePdf mandatePdfForBankDetails = + client.mandatePdfs().create().withAccountNumber("44779911") + .withBranchCode("200000").withCountryCode("GB").execute(); + MandatePdf mandatePdfInFrench = + client.mandatePdfs().create().withIban("FR14BARC20000055779911") + .withHeader("Accept-Language", "fr").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/MandatesCancelCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/MandatesCancelCodeSampleTest.java new file mode 100644 index 00000000..c74c2219 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/MandatesCancelCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class MandatesCancelCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCancelCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"mandates\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.mandates().cancel("MD123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/MandatesCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/MandatesCreateCodeSampleTest.java new file mode 100644 index 00000000..f9002228 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/MandatesCreateCodeSampleTest.java @@ -0,0 +1,55 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class MandatesCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"mandates\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + Mandate mandate = client.mandates().create().withScheme("bacs") + .withLinksCustomerBankAccount("BA123").withMetadata("contract", "ABCD1234") + .execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/MandatesGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/MandatesGetCodeSampleTest.java new file mode 100644 index 00000000..a1c5ef4c --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/MandatesGetCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class MandatesGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"mandates\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + Mandate mandate = client.mandates().get("MD123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/MandatesListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/MandatesListCodeSampleTest.java new file mode 100644 index 00000000..efe0a052 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/MandatesListCodeSampleTest.java @@ -0,0 +1,56 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class MandatesListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"mandates\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + for (Mandate mandate : client.mandates().all().withCustomer("CU123").execute()) { + System.out.println(mandate.getId()); + } + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/MandatesReinstateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/MandatesReinstateCodeSampleTest.java new file mode 100644 index 00000000..28e47638 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/MandatesReinstateCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class MandatesReinstateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testReinstateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"mandates\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.mandates().reinstate("MD123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/MandatesUpdateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/MandatesUpdateCodeSampleTest.java new file mode 100644 index 00000000..9c6308af --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/MandatesUpdateCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class MandatesUpdateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testUpdateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"mandates\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.mandates().update("MD123").withMetadata("contract_id", "ref_09011991").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/NegativeBalanceLimitsListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/NegativeBalanceLimitsListCodeSampleTest.java new file mode 100644 index 00000000..69d48b5b --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/NegativeBalanceLimitsListCodeSampleTest.java @@ -0,0 +1,56 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import com.gocardless.services.NegativeBalanceLimitService.NegativeBalanceLimitListRequest.Currency; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class NegativeBalanceLimitsListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"negative_balance_limits\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.negativeBalanceLimits().all().withCreditor("CR123").withCurrency(Currency.GBP) + .execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/OutboundPaymentImportEntriesListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/OutboundPaymentImportEntriesListCodeSampleTest.java new file mode 100644 index 00000000..95a53ee1 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/OutboundPaymentImportEntriesListCodeSampleTest.java @@ -0,0 +1,55 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class OutboundPaymentImportEntriesListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"outbound_payment_import_entries\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.outboundPaymentImportEntries().list().withOutboundPaymentImport("IM123") + .withLimit(10).execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/OutboundPaymentImportsCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/OutboundPaymentImportsCreateCodeSampleTest.java new file mode 100644 index 00000000..a692c5fe --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/OutboundPaymentImportsCreateCodeSampleTest.java @@ -0,0 +1,67 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import com.gocardless.services.OutboundPaymentImportService.OutboundPaymentImportCreateRequest.EntryItems; +import com.gocardless.services.OutboundPaymentImportService.OutboundPaymentImportCreateRequest.EntryItems.Scheme; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class OutboundPaymentImportsCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"outbound_payment_imports\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + EntryItems entry1 = new EntryItems().withAmount(1000).withScheme(Scheme.FASTER_PAYMENTS) + .withReference("Invoice 123").withRecipientBankAccountId("BA123"); + Map metadata = new HashMap<>(); + metadata.put("order_id", "ORD-789"); + EntryItems entry2 = new EntryItems().withAmount(2000).withScheme(Scheme.FASTER_PAYMENTS) + .withReference("Invoice 124").withRecipientBankAccountId("BA456") + .withMetadata(metadata); + OutboundPaymentImport outboundPaymentImport = client.outboundPaymentImports().create() + .withEntryItems(Arrays.asList(entry1, entry2)).withLinksCreditor("CR123") + .execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/OutboundPaymentImportsGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/OutboundPaymentImportsGetCodeSampleTest.java new file mode 100644 index 00000000..77c469df --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/OutboundPaymentImportsGetCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class OutboundPaymentImportsGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"outbound_payment_imports\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.outboundPaymentImports().get("IM123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/OutboundPaymentImportsListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/OutboundPaymentImportsListCodeSampleTest.java new file mode 100644 index 00000000..9a232a7b --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/OutboundPaymentImportsListCodeSampleTest.java @@ -0,0 +1,54 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class OutboundPaymentImportsListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"outbound_payment_imports\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.outboundPaymentImports().list().withLimit(10).execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/OutboundPaymentsApproveCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/OutboundPaymentsApproveCodeSampleTest.java new file mode 100644 index 00000000..92c95e6f --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/OutboundPaymentsApproveCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class OutboundPaymentsApproveCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testApproveCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"outbound_payments\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.outboundPayments().approve("OUT123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/OutboundPaymentsCancelCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/OutboundPaymentsCancelCodeSampleTest.java new file mode 100644 index 00000000..31d75ea8 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/OutboundPaymentsCancelCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class OutboundPaymentsCancelCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCancelCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"outbound_payments\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.outboundPayments().cancel("OUT123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/OutboundPaymentsCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/OutboundPaymentsCreateCodeSampleTest.java new file mode 100644 index 00000000..75b116bd --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/OutboundPaymentsCreateCodeSampleTest.java @@ -0,0 +1,57 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import com.gocardless.services.OutboundPaymentService.OutboundPaymentCreateRequest.Scheme; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class OutboundPaymentsCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"outbound_payments\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + OutboundPayment outboundPayment = client.outboundPayments().create().withAmount(1000) + .withScheme(Scheme.FASTER_PAYMENTS) + .withDescription("Reward Payment (August 2024)").withReference("Invoice 123") + .withLinksCreditor("CR123").withLinksRecipientBankAccount("BA123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/OutboundPaymentsGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/OutboundPaymentsGetCodeSampleTest.java new file mode 100644 index 00000000..8bc690d2 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/OutboundPaymentsGetCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class OutboundPaymentsGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"outbound_payments\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.outboundPayments().get("OUT123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/OutboundPaymentsListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/OutboundPaymentsListCodeSampleTest.java new file mode 100644 index 00000000..262dda2b --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/OutboundPaymentsListCodeSampleTest.java @@ -0,0 +1,54 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class OutboundPaymentsListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"outbound_payments\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.outboundPayments().list().withLimit(10).execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/OutboundPaymentsStatsCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/OutboundPaymentsStatsCodeSampleTest.java new file mode 100644 index 00000000..940f9a9f --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/OutboundPaymentsStatsCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class OutboundPaymentsStatsCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testStatsCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"outbound_payments\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.outboundPayments().stats().execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/OutboundPaymentsUpdateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/OutboundPaymentsUpdateCodeSampleTest.java new file mode 100644 index 00000000..44cb0487 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/OutboundPaymentsUpdateCodeSampleTest.java @@ -0,0 +1,54 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class OutboundPaymentsUpdateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testUpdateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"outbound_payments\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + OutboundPayment outboundPayment = client.outboundPayments().update("OUT123") + .withMetadata("invoice_id", "INV-1234").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/OutboundPaymentsWithdrawCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/OutboundPaymentsWithdrawCodeSampleTest.java new file mode 100644 index 00000000..851520a6 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/OutboundPaymentsWithdrawCodeSampleTest.java @@ -0,0 +1,57 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import com.gocardless.services.OutboundPaymentService.OutboundPaymentWithdrawRequest.Scheme; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class OutboundPaymentsWithdrawCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testWithdrawCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"outbound_payments\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + OutboundPayment outboundPayment = client.outboundPayments().withdraw().withAmount(5000) + .withScheme(Scheme.FASTER_PAYMENTS) + .withDescription("Withdraw funds to business account") + .withLinksCreditor("CR123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/PayerAuthorisationsConfirmCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/PayerAuthorisationsConfirmCodeSampleTest.java new file mode 100644 index 00000000..5ce9c876 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/PayerAuthorisationsConfirmCodeSampleTest.java @@ -0,0 +1,54 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class PayerAuthorisationsConfirmCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testConfirmCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"payer_authorisations\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + PayerAuthorisation payerAuthorisation = + client.payerAuthorisations().confirm("PAU123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/PayerAuthorisationsCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/PayerAuthorisationsCreateCodeSampleTest.java new file mode 100644 index 00000000..792407f2 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/PayerAuthorisationsCreateCodeSampleTest.java @@ -0,0 +1,58 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class PayerAuthorisationsCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"payer_authorisations\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + PayerAuthorisation payerAuthorisation = client.payerAuthorisations().create() + .withCustomerEmail("mail@example.com").withCustomerGivenName("Name") + .withCustomerFamilyName("Surname") + .withBankAccountAccountHolderName("Name Surname") + .withBankAccountBranchCode("200000").withBankAccountAccountNumber("55779911") + .withMandateReference("XYZ789").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/PayerAuthorisationsGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/PayerAuthorisationsGetCodeSampleTest.java new file mode 100644 index 00000000..498b3b6b --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/PayerAuthorisationsGetCodeSampleTest.java @@ -0,0 +1,54 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class PayerAuthorisationsGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"payer_authorisations\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + PayerAuthorisation payerAuthorisation = + client.payerAuthorisations().get("PAU123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/PayerAuthorisationsSubmitCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/PayerAuthorisationsSubmitCodeSampleTest.java new file mode 100644 index 00000000..831364a5 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/PayerAuthorisationsSubmitCodeSampleTest.java @@ -0,0 +1,54 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class PayerAuthorisationsSubmitCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testSubmitCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"payer_authorisations\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + PayerAuthorisation payerAuthorisation = + client.payerAuthorisations().submit("PAU123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/PayerAuthorisationsUpdateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/PayerAuthorisationsUpdateCodeSampleTest.java new file mode 100644 index 00000000..89d5a36d --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/PayerAuthorisationsUpdateCodeSampleTest.java @@ -0,0 +1,62 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.HashMap; +import java.util.Map; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class PayerAuthorisationsUpdateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testUpdateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"payer_authorisations\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + Map customerMetadata = new HashMap<>(); + customerMetadata.put("salesforce_id", "EFGH5678"); + PayerAuthorisation payerAuthorisation = client.payerAuthorisations().update("PA123") + .withCustomerEmail("mail@example.com").withCustomerGivenName("Name") + .withCustomerFamilyName("Surname").withCustomerMetadata(customerMetadata) + .withBankAccountAccountHolderName("Name Surname") + .withBankAccountBranchCode("200000").withBankAccountAccountNumber("55779911") + .withMandateReference("XYZ789").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/PayerThemesCreateForCreditorCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/PayerThemesCreateForCreditorCodeSampleTest.java new file mode 100644 index 00000000..df6794cf --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/PayerThemesCreateForCreditorCodeSampleTest.java @@ -0,0 +1,56 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class PayerThemesCreateForCreditorCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateForCreditorCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"payer_themes\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + PayerTheme payerTheme = client.payerThemes().createForCreditor() + .withButtonBackgroundColour("#128DAA").withContentBoxBorderColour("#BD10E0") + .withHeaderBackgroundColour("#BD10E0").withLinkTextColour("#7ED321") + .withLinksCreditor("CR123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/PaymentAccountTransactionsGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/PaymentAccountTransactionsGetCodeSampleTest.java new file mode 100644 index 00000000..de2b22db --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/PaymentAccountTransactionsGetCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class PaymentAccountTransactionsGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"payment_account_transactions\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.paymentAccountTransactions().get("PATR1234").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/PaymentAccountTransactionsListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/PaymentAccountTransactionsListCodeSampleTest.java new file mode 100644 index 00000000..ea3f3dfa --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/PaymentAccountTransactionsListCodeSampleTest.java @@ -0,0 +1,55 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class PaymentAccountTransactionsListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"payment_account_transactions\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.paymentAccountTransactions().list("BA12345").withValueDateFrom("2024-01-01") + .withValueDateTo("2024-01-31").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/PaymentsCancelCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/PaymentsCancelCodeSampleTest.java new file mode 100644 index 00000000..83c58105 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/PaymentsCancelCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class PaymentsCancelCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCancelCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"payments\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.payments().cancel("PM123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/PaymentsCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/PaymentsCreateCodeSampleTest.java new file mode 100644 index 00000000..854cab8c --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/PaymentsCreateCodeSampleTest.java @@ -0,0 +1,57 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import com.gocardless.services.PaymentService.PaymentCreateRequest.Currency; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class PaymentsCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"payments\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + Payment payment = client.payments().create().withAmount(100).withCurrency(Currency.GBP) + .withChargeDate("2014-05-19").withReference("WINEBOX001") + .withMetadata("order_dispatch_date", "2014-05-22").withLinksMandate("MD123") + .execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/PaymentsGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/PaymentsGetCodeSampleTest.java new file mode 100644 index 00000000..c363601b --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/PaymentsGetCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class PaymentsGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"payments\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + Payment payment = client.payments().get("PM123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/PaymentsListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/PaymentsListCodeSampleTest.java new file mode 100644 index 00000000..c74e0339 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/PaymentsListCodeSampleTest.java @@ -0,0 +1,56 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class PaymentsListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"payments\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + for (Payment payment : client.payments().all().withCustomer("CU123").execute()) { + System.out.println(payment.getId()); + } + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/PaymentsRetryCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/PaymentsRetryCodeSampleTest.java new file mode 100644 index 00000000..e73b348b --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/PaymentsRetryCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class PaymentsRetryCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testRetryCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"payments\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.payments().retry("PM123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/PaymentsUpdateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/PaymentsUpdateCodeSampleTest.java new file mode 100644 index 00000000..0e221fac --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/PaymentsUpdateCodeSampleTest.java @@ -0,0 +1,54 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class PaymentsUpdateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testUpdateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"payments\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.payments().update("PM123").withMetadata("order_id", "transaction-0HE9WQ0WDE") + .execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/PayoutItemsListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/PayoutItemsListCodeSampleTest.java new file mode 100644 index 00000000..f2432903 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/PayoutItemsListCodeSampleTest.java @@ -0,0 +1,54 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class PayoutItemsListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"payout_items\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.payoutItems().all().withPayout("PO123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/PayoutsGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/PayoutsGetCodeSampleTest.java new file mode 100644 index 00000000..e836e1aa --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/PayoutsGetCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class PayoutsGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"payouts\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.payouts().get("PO123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/PayoutsListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/PayoutsListCodeSampleTest.java new file mode 100644 index 00000000..5ec44270 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/PayoutsListCodeSampleTest.java @@ -0,0 +1,56 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import com.gocardless.services.PayoutService.PayoutListRequest.Status; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class PayoutsListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"payouts\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + for (Payout payout : client.payouts().all().withStatus(Status.PENDING).execute()) { + System.out.println(payout.getId()); + } + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/PayoutsUpdateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/PayoutsUpdateCodeSampleTest.java new file mode 100644 index 00000000..b9e93dae --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/PayoutsUpdateCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class PayoutsUpdateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testUpdateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"payouts\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.payouts().update("PO123").withMetadata("key", "value").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/RedirectFlowsCompleteCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/RedirectFlowsCompleteCodeSampleTest.java new file mode 100644 index 00000000..c5cf7e87 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/RedirectFlowsCompleteCodeSampleTest.java @@ -0,0 +1,54 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class RedirectFlowsCompleteCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCompleteCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"redirect_flows\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.redirectFlows().complete("RE123").withSessionToken("SESS_wSs0uGYMISxzqOBq") + .execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/RedirectFlowsCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/RedirectFlowsCreateCodeSampleTest.java new file mode 100644 index 00000000..2b86c9e8 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/RedirectFlowsCreateCodeSampleTest.java @@ -0,0 +1,58 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class RedirectFlowsCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"redirect_flows\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + RedirectFlow redirectFlow = client.redirectFlows().create() + .withDescription("Wine boxes").withSessionToken("SESS_wSs0uGYMISxzqOBq") + .withSuccessRedirectUrl("https://example.com/pay/confirm") + .withPrefilledCustomerGivenName("Frank") + .withPrefilledCustomerFamilyName("Osborne") + .withPrefilledCustomerEmail("frank.osborne@acmeplc.com").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/RedirectFlowsGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/RedirectFlowsGetCodeSampleTest.java new file mode 100644 index 00000000..33911c98 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/RedirectFlowsGetCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class RedirectFlowsGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"redirect_flows\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + RedirectFlow redirectFlow = client.redirectFlows().get("RE123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/RefundsCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/RefundsCreateCodeSampleTest.java new file mode 100644 index 00000000..0394a6dd --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/RefundsCreateCodeSampleTest.java @@ -0,0 +1,55 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class RefundsCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"refunds\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.refunds().create().withAmount(100).withTotalAmountConfirmation(150) + .withReference("Acme refund").withMetadata("reason", "late delivery") + .withLinksPayment("PM123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/RefundsGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/RefundsGetCodeSampleTest.java new file mode 100644 index 00000000..939e2532 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/RefundsGetCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class RefundsGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"refunds\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + Refund refund = client.refunds().get("RF123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/RefundsListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/RefundsListCodeSampleTest.java new file mode 100644 index 00000000..7a8b4f7d --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/RefundsListCodeSampleTest.java @@ -0,0 +1,55 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class RefundsListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"refunds\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + for (Refund refund : client.refunds().all().withPayment("PM123").execute()) { + System.out.println(refund.getId()); + } + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/RefundsUpdateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/RefundsUpdateCodeSampleTest.java new file mode 100644 index 00000000..ae331547 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/RefundsUpdateCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class RefundsUpdateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testUpdateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"refunds\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.refunds().update("RF123").withMetadata("internal_code", "refund_1A").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/ScenarioSimulatorsRunCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/ScenarioSimulatorsRunCodeSampleTest.java new file mode 100644 index 00000000..3c988afe --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/ScenarioSimulatorsRunCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class ScenarioSimulatorsRunCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testRunCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"scenario_simulators\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.scenarioSimulators().run("payment_failed").withLinksResource("PM123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/SchemeIdentifiersCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/SchemeIdentifiersCreateCodeSampleTest.java new file mode 100644 index 00000000..a7069288 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/SchemeIdentifiersCreateCodeSampleTest.java @@ -0,0 +1,56 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import com.gocardless.services.SchemeIdentifierService.SchemeIdentifierCreateRequest.Scheme; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class SchemeIdentifiersCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"scheme_identifiers\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + SchemeIdentifier schemeIdentifier = + client.schemeIdentifiers().create().withScheme(Scheme.BACS) + .withName("The Wine Club").withLinksCreditor("CR123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/SchemeIdentifiersGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/SchemeIdentifiersGetCodeSampleTest.java new file mode 100644 index 00000000..d42f7e6c --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/SchemeIdentifiersGetCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class SchemeIdentifiersGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"scheme_identifiers\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + SchemeIdentifier schemeIdentifier = client.schemeIdentifiers().get("SU123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/SchemeIdentifiersListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/SchemeIdentifiersListCodeSampleTest.java new file mode 100644 index 00000000..424d70b8 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/SchemeIdentifiersListCodeSampleTest.java @@ -0,0 +1,56 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class SchemeIdentifiersListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"scheme_identifiers\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + for (SchemeIdentifier schemeIdentifier : client.schemeIdentifiers().all().execute()) { + System.out.println(schemeIdentifier.getId()); + } + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/SubscriptionsCancelCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/SubscriptionsCancelCodeSampleTest.java new file mode 100644 index 00000000..30adea98 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/SubscriptionsCancelCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class SubscriptionsCancelCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCancelCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"subscriptions\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.subscriptions().cancel("SB123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/SubscriptionsCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/SubscriptionsCreateCodeSampleTest.java new file mode 100644 index 00000000..fd2c05cc --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/SubscriptionsCreateCodeSampleTest.java @@ -0,0 +1,57 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import com.gocardless.services.SubscriptionService.SubscriptionCreateRequest.IntervalUnit; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class SubscriptionsCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"subscriptions\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + Subscription subscription = client.subscriptions().create().withAmount(2500) + .withCurrency("GBP").withName("Monthly Magazine") + .withIntervalUnit(IntervalUnit.MONTHLY).withDayOfMonth(1) + .withMetadata("order_no", "ABCD1234").withLinksMandate("MD123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/SubscriptionsGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/SubscriptionsGetCodeSampleTest.java new file mode 100644 index 00000000..f00f5cf4 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/SubscriptionsGetCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class SubscriptionsGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"subscriptions\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + Subscription subscription = client.subscriptions().get("SB123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/SubscriptionsListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/SubscriptionsListCodeSampleTest.java new file mode 100644 index 00000000..b6c8c8dc --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/SubscriptionsListCodeSampleTest.java @@ -0,0 +1,57 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class SubscriptionsListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"subscriptions\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + for (Subscription subscription : client.subscriptions().all().withCustomer("CU123") + .execute()) { + System.out.println(subscription.getId()); + } + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/SubscriptionsPauseCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/SubscriptionsPauseCodeSampleTest.java new file mode 100644 index 00000000..fb230368 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/SubscriptionsPauseCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class SubscriptionsPauseCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testPauseCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"subscriptions\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.subscriptions().pause("SB123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/SubscriptionsResumeCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/SubscriptionsResumeCodeSampleTest.java new file mode 100644 index 00000000..b5eda07a --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/SubscriptionsResumeCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class SubscriptionsResumeCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testResumeCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"subscriptions\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.subscriptions().resume("SB123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/SubscriptionsUpdateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/SubscriptionsUpdateCodeSampleTest.java new file mode 100644 index 00000000..e0519fbc --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/SubscriptionsUpdateCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class SubscriptionsUpdateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testUpdateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"subscriptions\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.subscriptions().update("SB123").withName("New name").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/TaxRatesGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/TaxRatesGetCodeSampleTest.java new file mode 100644 index 00000000..eedcaa6b --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/TaxRatesGetCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class TaxRatesGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"tax_rates\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + TaxRate taxRate = client.taxRates().get("GB_VAT_1").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/TaxRatesListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/TaxRatesListCodeSampleTest.java new file mode 100644 index 00000000..c039c080 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/TaxRatesListCodeSampleTest.java @@ -0,0 +1,54 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class TaxRatesListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"tax_rates\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.taxRates().all().withJurisdiction("GB").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/TransferredMandatesTransferredMandatesCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/TransferredMandatesTransferredMandatesCodeSampleTest.java new file mode 100644 index 00000000..9653a230 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/TransferredMandatesTransferredMandatesCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class TransferredMandatesTransferredMandatesCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testTransferredMandatesCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"transferred_mandates\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.transferredMandates().transferredMandates("MD123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/VerificationDetailsCreateCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/VerificationDetailsCreateCodeSampleTest.java new file mode 100644 index 00000000..18ac67fa --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/VerificationDetailsCreateCodeSampleTest.java @@ -0,0 +1,66 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import com.gocardless.services.VerificationDetailService.VerificationDetailCreateRequest.Directors; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class VerificationDetailsCreateCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testCreateCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"verification_details\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + Directors director = new Directors(); + director.withCity("London"); + director.withCountryCode("GB"); + director.withDateOfBirth("1986-02-19"); + director.withGivenName("Gandalf"); + director.withFamilyName("Grey"); + director.withPostalCode("B4 7NJ"); + director.withStreet("Drury Lane"); + VerificationDetail verificationDetail = client.verificationDetails().create() + .withName("Acme").withDescription("wine and cheese seller") + .withCompanyNumber("03768189").withAddressLine1("12 Drury Lane") + .withCity("London").withPostalCode("B4 7NJ").withDirectors(director) + .withLinksCreditor("CR123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/VerificationDetailsListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/VerificationDetailsListCodeSampleTest.java new file mode 100644 index 00000000..bf653a08 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/VerificationDetailsListCodeSampleTest.java @@ -0,0 +1,57 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class VerificationDetailsListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"verification_details\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + for (VerificationDetail verificationDetail : client.verificationDetails().all() + .withCreditor("CR123").execute()) { + System.out.println(verificationDetail.getDescription()); + } + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/WebhooksGetCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/WebhooksGetCodeSampleTest.java new file mode 100644 index 00000000..03c2e0e1 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/WebhooksGetCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class WebhooksGetCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testGetCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"webhooks\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + com.gocardless.resources.Webhook webhook = client.webhooks().get("WB123").execute(); + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/WebhooksListCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/WebhooksListCodeSampleTest.java new file mode 100644 index 00000000..a0c34870 --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/WebhooksListCodeSampleTest.java @@ -0,0 +1,57 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class WebhooksListCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testListCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = + "{ \"webhooks\": [{}], \"meta\": { \"cursors\": {}, \"limit\": 50 } }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + for (com.gocardless.resources.Webhook webhook : client.webhooks().all() + .withSuccessful(true).execute()) { + System.out.println(webhook.getId()); + } + } finally { + System.setOut(originalOut); + } + } +} diff --git a/src/test/java/com/gocardless/code_samples/WebhooksRetryCodeSampleTest.java b/src/test/java/com/gocardless/code_samples/WebhooksRetryCodeSampleTest.java new file mode 100644 index 00000000..226aa8bb --- /dev/null +++ b/src/test/java/com/gocardless/code_samples/WebhooksRetryCodeSampleTest.java @@ -0,0 +1,53 @@ +package com.gocardless.code_samples; + +// Code Sample Test +// This test verifies that a documentation code sample is syntactically valid +// and can execute against a mocked API without errors. +// +// IMPORTANT: This test does NOT verify business logic - it only verifies that +// the code sample compiles and executes without syntax errors. +import com.gocardless.GoCardlessClient; +import com.gocardless.resources.*; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class WebhooksRetryCodeSampleTest { + private static final String ACCESS_TOKEN = "SECRET_TOKEN"; + private GoCardlessClient client; + private MockWebServer server; + + @Before + public void setUp() throws Exception { + server = new MockWebServer(); + server.start(); + client = GoCardlessClient.newBuilder(ACCESS_TOKEN) + .withBaseUrl(String.format("http://localhost:%d", server.getPort())).build(); + } + + @After + public void tearDown() throws Exception { + server.shutdown(); + } + + @Test + public void testRetryCodeSample() throws Exception { + // Mock response - enqueue multiple times to handle code samples with multiple API calls + String responseBody = "{ \"webhooks\": {} }"; + for (int i = 0; i < 5; i++) { + server.enqueue(new MockResponse().setBody(responseBody).setResponseCode(200)); + } + // Suppress stdout from code samples + PrintStream originalOut = System.out; + System.setOut(new PrintStream(new ByteArrayOutputStream())); + try { + client.webhooks().retry("WB123").execute(); + } finally { + System.setOut(originalOut); + } + } +}