From 43d3a9955ccdcbb74e6d7b30dfb667d971e7c297 Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:53:35 +0000 Subject: [PATCH 1/3] Changes generated by 98656df793ba39dd79f2e3d9b33c5a2d14db1cd4 This commit was automatically created from gocardless/gocardless-pro-java-template@98656df793ba39dd79f2e3d9b33c5a2d14db1cd4 by the `push-files` action. Workflow run: https://github.com/gocardless/gocardless-pro-java-template/actions/runs/9908686995 --- .gitignore | 4 +- README.md | 4 +- build.gradle | 13 ++- gradlew | 1 + .../gocardless/resources/Subscription.java | 8 ++ .../com/gocardless/services/LogoService.java | 14 ++- .../services/MandateImportEntryService.java | 105 ++++++++++++++++++ .../services/MandatePdfService.java | 30 +++++ 8 files changed, 173 insertions(+), 6 deletions(-) mode change 100755 => 100644 gradlew diff --git a/.gitignore b/.gitignore index 6266b006..e134aac3 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,6 @@ out/ ############################## ## Visual Studio Code ############################## -.vscode/ \ No newline at end of file +.vscode/ + +tmp-push-files-checkout/ diff --git a/README.md b/README.md index 6dc520a5..e66e926c 100644 --- a/README.md +++ b/README.md @@ -14,14 +14,14 @@ With Maven: com.gocardless gocardless-pro - 5.25.0 + 5.26.0 ``` With Gradle: ``` -implementation 'com.gocardless:gocardless-pro:5.25.0' +implementation 'com.gocardless:gocardless-pro:5.26.0' ``` ## Initializing the client diff --git a/build.gradle b/build.gradle index 95dfc31f..976c8286 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,11 @@ buildscript { repositories { mavenCentral() maven { url 'https://plugins.gradle.org/m2/' } + jcenter() + google() + maven { + url 'https://maven.google.com' + } } dependencies { @@ -20,12 +25,18 @@ plugins { sourceCompatibility = 1.8 targetCompatibility = 1.8 group = 'com.gocardless' -version = '5.25.0' +version = '5.26.0' apply plugin: 'ch.raffael.pegdown-doclet' repositories { mavenCentral() + maven { url 'https://plugins.gradle.org/m2/' } + jcenter() + google() + maven { + url 'https://maven.google.com' + } } dependencies { diff --git a/gradlew b/gradlew old mode 100755 new mode 100644 index cccdd3d5..a956838e --- a/gradlew +++ b/gradlew @@ -1,4 +1,5 @@ #!/usr/bin/env sh +set -x ############################################################################## ## diff --git a/src/main/java/com/gocardless/resources/Subscription.java b/src/main/java/com/gocardless/resources/Subscription.java index f3327927..f5e15536 100644 --- a/src/main/java/com/gocardless/resources/Subscription.java +++ b/src/main/java/com/gocardless/resources/Subscription.java @@ -61,6 +61,7 @@ private Subscription() { private Map metadata; private Month month; private String name; + private Boolean parentPlanPaused; private String paymentReference; private Boolean retryIfPossible; private String startDate; @@ -186,6 +187,13 @@ public String getName() { return name; } + /** + * Whether the parent plan of this subscription is paused. + */ + public Boolean getParentPlanPaused() { + return parentPlanPaused; + } + /** * An optional payment reference. This will be set as the reference on each payment created and * will appear on your customer's bank statement. See the documentation for the [create payment diff --git a/src/main/java/com/gocardless/services/LogoService.java b/src/main/java/com/gocardless/services/LogoService.java index 052cf777..0f9ba10a 100644 --- a/src/main/java/com/gocardless/services/LogoService.java +++ b/src/main/java/com/gocardless/services/LogoService.java @@ -23,6 +23,11 @@ public LogoService(HttpClient httpClient) { /** * Creates a new logo associated with a creditor. If a creditor already has a logo, this will * update the existing logo linked to the creditor. + * + * We support JPG and PNG formats. Your logo will be scaled to a maximum of 300px by 40px. For + * more guidance on how to upload logos that will look great across your customer payment page + * and notification emails see + * [here](https://developer.gocardless.com/gc-embed/setting-up-branding#tips_for_uploading_your_logo). */ public LogoCreateForCreditorRequest createForCreditor() { return new LogoCreateForCreditorRequest(httpClient); @@ -33,6 +38,11 @@ public LogoCreateForCreditorRequest createForCreditor() { * * Creates a new logo associated with a creditor. If a creditor already has a logo, this will * update the existing logo linked to the creditor. + * + * We support JPG and PNG formats. Your logo will be scaled to a maximum of 300px by 40px. For + * more guidance on how to upload logos that will look great across your customer payment page + * and notification emails see + * [here](https://developer.gocardless.com/gc-embed/setting-up-branding#tips_for_uploading_your_logo). */ public static final class LogoCreateForCreditorRequest extends PostRequest { private String image; @@ -52,7 +62,7 @@ public LogoCreateForCreditorRequest withLinks(Links links) { } /** - * ID of the creditor the payer theme belongs to + * ID of the creditor the logo belongs to */ public LogoCreateForCreditorRequest withLinksCreditor(String creditor) { if (links == null) { @@ -95,7 +105,7 @@ public static class Links { private String creditor; /** - * ID of the creditor the payer theme belongs to + * ID of the creditor the logo belongs to */ public Links withCreditor(String creditor) { this.creditor = creditor; diff --git a/src/main/java/com/gocardless/services/MandateImportEntryService.java b/src/main/java/com/gocardless/services/MandateImportEntryService.java index d40b5bba..1066dd62 100644 --- a/src/main/java/com/gocardless/services/MandateImportEntryService.java +++ b/src/main/java/com/gocardless/services/MandateImportEntryService.java @@ -3,6 +3,7 @@ import com.gocardless.http.*; import com.gocardless.resources.MandateImportEntry; import com.google.common.collect.ImmutableMap; +import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; import java.util.List; import java.util.Map; @@ -171,6 +172,20 @@ public MandateImportEntryCreateRequest withBankAccountAccountNumber(String accou return this; } + /** + * Bank account type. Required for USD-denominated bank accounts. Must not be provided for + * bank accounts in other currencies. See [local details](#local-bank-details-united-states) + * for more information. + */ + public MandateImportEntryCreateRequest withBankAccountAccountType( + BankAccount.AccountType accountType) { + if (bankAccount == null) { + bankAccount = new BankAccount(); + } + bankAccount.withAccountType(accountType); + return this; + } + /** * Bank code - see [local details](#appendix-local-bank-details) for more information. * Alternatively you can provide an `iban`. @@ -221,6 +236,19 @@ public MandateImportEntryCreateRequest withBankAccountIban(String iban) { return this; } + /** + * Key-value store of custom data. Up to 3 keys are permitted, with key names up to 50 + * characters and values up to 500 characters. + */ + public MandateImportEntryCreateRequest withBankAccountMetadata( + Map metadata) { + if (bankAccount == null) { + bankAccount = new BankAccount(); + } + bankAccount.withMetadata(metadata); + return this; + } + public MandateImportEntryCreateRequest withCustomer(Customer customer) { this.customer = customer; return this; @@ -361,6 +389,18 @@ public MandateImportEntryCreateRequest withCustomerLanguage(String language) { return this; } + /** + * Key-value store of custom data. Up to 3 keys are permitted, with key names up to 50 + * characters and values up to 500 characters. + */ + public MandateImportEntryCreateRequest withCustomerMetadata(Map metadata) { + if (customer == null) { + customer = new Customer(); + } + customer.withMetadata(metadata); + return this; + } + /** * [ITU E.123](https://en.wikipedia.org/wiki/E.123) formatted phone number, including * country code. @@ -433,6 +473,18 @@ public MandateImportEntryCreateRequest withMandate(Mandate mandate) { return this; } + /** + * Key-value store of custom data. Up to 3 keys are permitted, with key names up to 50 + * characters and values up to 500 characters. + */ + public MandateImportEntryCreateRequest withMandateMetadata(Map metadata) { + if (mandate == null) { + mandate = new Mandate(); + } + mandate.withMetadata(metadata); + return this; + } + /** * Unique reference. Different schemes have different length and [character * set](#appendix-character-sets) requirements. GoCardless will generate a unique reference @@ -523,10 +575,12 @@ public Amendment withOriginalMandateReference(String originalMandateReference) { public static class BankAccount { private String accountHolderName; private String accountNumber; + private AccountType accountType; private String bankCode; private String branchCode; private String countryCode; private String iban; + private Map metadata; /** * Name of the account holder, as known by the bank. Usually this is the same as the @@ -549,6 +603,16 @@ public BankAccount withAccountNumber(String accountNumber) { return this; } + /** + * Bank account type. Required for USD-denominated bank accounts. Must not be provided + * for bank accounts in other currencies. See [local + * details](#local-bank-details-united-states) for more information. + */ + public BankAccount withAccountType(AccountType accountType) { + this.accountType = accountType; + return this; + } + /** * Bank code - see [local details](#appendix-local-bank-details) for more information. * Alternatively you can provide an `iban`. @@ -587,6 +651,27 @@ public BankAccount withIban(String iban) { this.iban = iban; return this; } + + /** + * Key-value store of custom data. Up to 3 keys are permitted, with key names up to 50 + * characters and values up to 500 characters. + */ + public BankAccount withMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public enum AccountType { + @SerializedName("savings") + SAVINGS, @SerializedName("checking") + CHECKING, @SerializedName("unknown") + UNKNOWN; + + @Override + public String toString() { + return name().toLowerCase(); + } + } } public static class Customer { @@ -601,6 +686,7 @@ public static class Customer { private String familyName; private String givenName; private String language; + private Map metadata; private String phoneNumber; private String postalCode; private String region; @@ -707,6 +793,15 @@ public Customer withLanguage(String language) { return this; } + /** + * Key-value store of custom data. Up to 3 keys are permitted, with key names up to 50 + * characters and values up to 500 characters. + */ + public Customer withMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + /** * [ITU E.123](https://en.wikipedia.org/wiki/E.123) formatted phone number, including * country code. @@ -761,8 +856,18 @@ public Links withMandateImport(String mandateImport) { } public static class Mandate { + private Map metadata; private String reference; + /** + * Key-value store of custom data. Up to 3 keys are permitted, with key names up to 50 + * characters and values up to 500 characters. + */ + public Mandate withMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + /** * Unique reference. Different schemes have different length and [character * set](#appendix-character-sets) requirements. GoCardless will generate a unique diff --git a/src/main/java/com/gocardless/services/MandatePdfService.java b/src/main/java/com/gocardless/services/MandatePdfService.java index 4f044fdb..57ed02a7 100644 --- a/src/main/java/com/gocardless/services/MandatePdfService.java +++ b/src/main/java/com/gocardless/services/MandatePdfService.java @@ -80,8 +80,11 @@ public static final class MandatePdfCreateRequest extends PostRequest Date: Fri, 12 Jul 2024 13:18:51 +0100 Subject: [PATCH 2/3] tlc: better CI pipeline --- .github/workflows/build.yml | 105 ++++++++++++++---------------------- 1 file changed, 39 insertions(+), 66 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7950edcc..b0aa9aba 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,70 +1,43 @@ -name: gocardless/gocardless-pro-java/build -on: push +name: build & test + +on: + push: + branches: [master] + pull_request: + types: [opened, reopened, synchronize] jobs: - test_library_jdk8: - runs-on: ubuntu-latest - container: - image: openjdk:8 - steps: - - uses: actions/checkout@v2 - - name: Test - run: |- - export TERM=${TERM:-dumb} - ./install_crypto_deps.sh - ./gradlew test - - name: Save test results - run: |- - mkdir -p ~/junit - find . -type f -regex "$OUT_DIR/build/test-results/test/.*xml" -exec cp {} ~/junit/ \; - if: always() - - uses: actions/upload-artifact@v2 - with: - path: "~/junit" - - uses: actions/upload-artifact@v2 - with: - path: "~/junit" - test_library_jdk9: - runs-on: ubuntu-latest - container: - image: openjdk:9 - steps: - - uses: actions/checkout@v2 - - name: Test - run: |- - export TERM=${TERM:-dumb} - ./install_crypto_deps.sh - ./gradlew test - - name: Save test results - run: |- - mkdir -p ~/junit - find . -type f -regex "$OUT_DIR/build/test-results/test/.*xml" -exec cp {} ~/junit/ \; - if: always() - - uses: actions/upload-artifact@v2 - with: - path: "~/junit" - - uses: actions/upload-artifact@v2 - with: - path: "~/junit" - test_library_jdk11: + test: runs-on: ubuntu-latest - container: - image: openjdk:11 + strategy: + fail-fast: false + matrix: + jdk-version: [ 8, 9, 11 ] steps: - - uses: actions/checkout@v2 - - name: Test - run: |- - export TERM=${TERM:-dumb} - ./install_crypto_deps.sh - ./gradlew test - - name: Save test results - run: |- - mkdir -p ~/junit - find . -type f -regex "$OUT_DIR/build/test-results/test/.*xml" -exec cp {} ~/junit/ \; - if: always() - - uses: actions/upload-artifact@v2 - with: - path: "~/junit" - - uses: actions/upload-artifact@v2 - with: - path: "~/junit" + - uses: actions/checkout@v4 + - uses: actions/setup-java@v2 + with: + java-version: "${{ matrix.jdk-version }}" + distribution: adopt + - name: Verify java installed properly + run: java -version + - name: Grant execute permission for gradlew + run: chmod +x gradlew + # test + - name: Test + run: |- + export TERM=${TERM:-dumb} + ./gradlew test + # test build + - name: Build with Gradle + run: ./gradlew build + - name: Save test results + if: always() + run: |- + mkdir -p ~/junit + find . -type f -regex "./build/test-results/test/.*xml" -exec cp {} ~/junit/ \; + - uses: actions/upload-artifact@v4 + if: always() + with: + name: test_library_jdk${{ matrix.jdk-version }}_junit + path: "~/junit" From 04704ebc21392b853008a1d5b8110b877c6f8224 Mon Sep 17 00:00:00 2001 From: Martin Nefjodov Date: Fri, 12 Jul 2024 13:19:17 +0100 Subject: [PATCH 3/3] feat: switch to OSSRH token for publishing --- .github/workflows/maven-publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index c552613f..89d600c1 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -31,5 +31,5 @@ jobs: - name: Publish package run: ./gradlew publishToSonatype closeAndReleaseStagingRepository -Psigning.keyId=${{secrets.SIGNING_KEY_ID}} -Psigning.password=${{secrets.SIGNING_KEY_PASSWORD}} -Psigning.secretKeyRingFile=$(echo ~/.gradle/secring.gpg) -Dorg.gradle.internal.http.socketTimeout=300000 --stacktrace env: - MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + MAVEN_USERNAME: ${{ secrets.OSSRH_ACCESS_TOKEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_ACCESS_TOKEN_PASSWORD }}