diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b1104b4ed..5a908e50b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,14 +17,8 @@ jobs: - uses: actions/setup-java@v4 with: distribution: "zulu" - java-version: "23" # Always use the latest JDK for building - - name: Load Maven dependencies cache - uses: actions/cache@v3 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-build${{ matrix.javaversion }}-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- + java-version: "21" # Always use the latest stable JDK for building + cache: "maven" - name: Install dependencies run: make install - name: Build Library @@ -35,7 +29,7 @@ jobs: distribution: "zulu" java-version: ${{ matrix.javaversion }} - name: Run test with Java ${{ matrix.javaversion }} - run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 make test + run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 make test-ci coverage: runs-on: ubuntu-latest steps: @@ -43,14 +37,8 @@ jobs: - uses: actions/setup-java@v4 with: distribution: "zulu" - java-version: "23" # Always use the latest JDK for building - - name: Load Maven dependencies cache - uses: actions/cache@v3 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-build-coverage-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- + java-version: "21" # Always use the latest stable JDK for building + cache: "maven" - name: Install dependencies run: make install - name: Test coverage @@ -77,16 +65,10 @@ jobs: - uses: actions/setup-java@v4 with: distribution: "zulu" - java-version: "23" # Always use the latest JDK for building + java-version: "21" # Always use the latest stable JDK for building + cache: "maven" - name: Install checkstyle and style guide run: make install-checkstyle - - name: Load Maven dependencies and CVE database cache - uses: actions/cache@v3 - with: - path: ~/.m2/repository # The CVE database is included in the Maven repository folder - key: ${{ runner.os }}-maven-security-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - name: Lint run: make lint - name: Upload Test results @@ -102,14 +84,8 @@ jobs: - uses: actions/setup-java@v4 with: distribution: "zulu" - java-version: "23" # Always use the latest JDK for building - - name: Load Maven dependencies cache - uses: actions/cache@v3 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-build-coverage-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- + java-version: "21" # Always use the latest stable JDK for building + cache: "maven" - name: Install Dependencies run: make install - name: Generate Docs diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 866e8912a..03140bcf9 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -25,7 +25,7 @@ on: jobs: release: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 @@ -33,10 +33,10 @@ jobs: fetch-depth: 0 - name: Install JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: "zulu" - java-version: "22" # Always use the latest JDK + java-version: "21" # Always use the latest stable JDK for building server-id: "ossrh" # define environmental variable names server-username: MAVEN_USERNAME diff --git a/CHANGELOG.md b/CHANGELOG.md index c18f2a505..b660022db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # CHANGELOG +## Next Release + +- Adds `WebhookCustomHeader` model, allowing `custom_headers` to be passed when creating/updating a webhook +- Corrects payload wrapping for updating a webhook +- Bumps dependencies + ## v7.4.4 (2025-01-03) - Fixes how params are passed to the API when buying a pickup and providing a pickup rate (closes #340) diff --git a/Makefile b/Makefile index c4e40fae9..43f011db7 100644 --- a/Makefile +++ b/Makefile @@ -66,6 +66,10 @@ scan: ## test - Test the project test: + mvn test -Dgpg.skip=true -Dcheckstyle.skip=true -Ddependency-check.skip=true -Djavadoc.skip=true -Djacoco.skip=true + +## test-ci - Test the project on CI (does not rebuild the project) +test-ci: mvn surefire:test ## update-examples-submodule - Update the examples submodule @@ -73,4 +77,4 @@ update-examples-submodule: git submodule init git submodule update --remote -.PHONY: help build clean coverage docs install-checkstyle install-styleguide install lint publish publish-dry release scan scan-strict test update-examples-submodule +.PHONY: help build clean coverage docs install-checkstyle install-styleguide install lint publish publish-dry release scan scan-strict test test-ci update-examples-submodule diff --git a/examples b/examples index 0492e408e..7669825fb 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 0492e408e1b37b2ec18bcb4a4d228ab0f458f59d +Subproject commit 7669825fb53be074d7f585c78c4f38ad4fefe0d0 diff --git a/pom.xml b/pom.xml index 22101bb4f..6ad2f5ab2 100644 --- a/pom.xml +++ b/pom.xml @@ -46,30 +46,32 @@ com.google.code.gson gson - 2.10.1 + 2.12.1 + compile com.google.errorprone error_prone_core - 2.32.0 + 2.36.0 provided org.junit.jupiter junit-jupiter - 5.9.3 + 5.11.4 test org.hamcrest hamcrest - 2.2 + 3.0 test org.jetbrains annotations - 24.0.1 + 26.0.2 + compile com.easypost @@ -80,7 +82,7 @@ org.projectlombok lombok - 1.18.30 + 1.18.36 provided @@ -128,7 +130,7 @@ org.jacoco jacoco-maven-plugin - 0.8.10 + 0.8.12 @@ -173,7 +175,7 @@ org.apache.maven.plugins maven-source-plugin - 3.2.1 + 3.3.1 attach-sources @@ -191,7 +193,7 @@ -html true - 3.5.0 + 3.11.2 attach-javadocs @@ -204,7 +206,7 @@ org.apache.maven.plugins maven-gpg-plugin - 3.1.0 + 3.2.7 @@ -233,6 +235,7 @@ -XDcompilePolicy=simple -Xplugin:ErrorProne + --should-stop=ifError=FLOW -Xlint:-options -J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED -J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED @@ -249,12 +252,12 @@ com.google.errorprone error_prone_core - 2.32.0 + 2.36.0 org.projectlombok lombok - 1.18.30 + 1.18.36 @@ -262,7 +265,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.6.13 + 1.7.0 true ossrh @@ -273,7 +276,7 @@ org.codehaus.mojo templating-maven-plugin - 1.0.0 + 3.0.0 filtering-java-templates @@ -286,7 +289,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - 3.2.2 + 3.6.0 ${basedir}/easypost_java_style.xml UTF-8 @@ -315,7 +318,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.3.0 + 3.5.0 enforce-java @@ -335,6 +338,8 @@ org.owasp dependency-check-maven + + 8.4.0 dependency-check-suppressions.xml diff --git a/src/main/java/com/easypost/model/Webhook.java b/src/main/java/com/easypost/model/Webhook.java index ddb176940..4e6ca3218 100644 --- a/src/main/java/com/easypost/model/Webhook.java +++ b/src/main/java/com/easypost/model/Webhook.java @@ -1,11 +1,12 @@ package com.easypost.model; import java.util.Date; - +import java.util.List; import lombok.Getter; @Getter public final class Webhook extends EasyPostResource { private String url; private Date disabledAt; + private List customHeaders; } diff --git a/src/main/java/com/easypost/model/WebhookCustomHeader.java b/src/main/java/com/easypost/model/WebhookCustomHeader.java new file mode 100644 index 000000000..ebe359938 --- /dev/null +++ b/src/main/java/com/easypost/model/WebhookCustomHeader.java @@ -0,0 +1,9 @@ +package com.easypost.model; + +import lombok.Getter; + +@Getter +public final class WebhookCustomHeader { + private String name; + private String value; +} diff --git a/src/main/java/com/easypost/service/WebhookService.java b/src/main/java/com/easypost/service/WebhookService.java index e08663734..19c2d5032 100644 --- a/src/main/java/com/easypost/service/WebhookService.java +++ b/src/main/java/com/easypost/service/WebhookService.java @@ -108,11 +108,8 @@ public Webhook update(final String id) throws EasyPostException { * @throws EasyPostException when the request fails. */ public Webhook update(final String id, final Map params) throws EasyPostException { - Map wrappedParams = new HashMap(); - wrappedParams.put("webhook", params); - String endpoint = "webhooks/" + id; - return Requestor.request(RequestMethod.PUT, endpoint, wrappedParams, Webhook.class, client); + return Requestor.request(RequestMethod.PUT, endpoint, params, Webhook.class, client); } } diff --git a/src/test/cassettes/webhook/all.json b/src/test/cassettes/webhook/all.json index 8ea7dd756..6549f7c53 100644 --- a/src/test/cassettes/webhook/all.json +++ b/src/test/cassettes/webhook/all.json @@ -1,8 +1,8 @@ [ { - "recordedAt": 1723824060, + "recordedAt": 1740070340, "request": { - "body": "{\n \"webhook\": {\n \"url\": \"http://example.com\"\n }\n}", + "body": "{\n \"webhook\": {\n \"webhook_secret\": \"sécret\",\n \"url\": \"http://example.com\",\n \"custom_headers\": [\n {\n \"name\": \"test\",\n \"value\": \"header\"\n }\n ]\n }\n}", "method": "POST", "headers": { "Accept-Charset": [ @@ -18,20 +18,20 @@ "uri": "https://api.easypost.com/v2/webhooks" }, "response": { - "body": "{\n \"mode\": \"test\",\n \"disabled_at\": null,\n \"created_at\": \"2024-08-16T16:01:00Z\",\n \"id\": \"hook_bb18e6b05be811efbc5b7d8db8d30d2c\",\n \"url\": \"http://example.com\",\n \"object\": \"Webhook\"\n}", + "body": "{\n \"mode\": \"test\",\n \"disabled_at\": null,\n \"created_at\": \"2025-02-20T16:52:20Z\",\n \"id\": \"hook_0cb0f41cefab11ef807963ca33822ef2\",\n \"url\": \"http://example.com\",\n \"object\": \"Webhook\",\n \"custom_headers\": [\n {\n \"name\": \"test\",\n \"value\": \"header\"\n }\n ]\n}", "httpVersion": null, "headers": { "null": [ "HTTP/1.1 201 Created" ], "content-length": [ - "161" + "213" ], "expires": [ "0" ], "x-node": [ - "bigweb38nuq" + "bigweb59nuq" ], "x-frame-options": [ "SAMEORIGIN" @@ -58,23 +58,23 @@ "nosniff" ], "x-ep-request-uuid": [ - "8a4bf43e66bf77bce7872f580036bf50" + "c6a31f9167b75dc4e2b7e27500432cfc" ], "x-proxied": [ - "intlb4nuq c0f5e722d1", - "extlb1nuq b6e1b5034c" + "intlb4nuq 51d74985a2", + "extlb2nuq 99aac35317" ], "referrer-policy": [ "strict-origin-when-cross-origin" ], "x-runtime": [ - "0.153254" + "0.441378" ], "content-type": [ "application/json; charset\u003dutf-8" ], "x-version-label": [ - "easypost-202408152333-48cda4a73e-master" + "easypost-202502192243-499e5bdec0-master" ], "cache-control": [ "private, no-cache, no-store" @@ -86,10 +86,10 @@ }, "uri": "https://api.easypost.com/v2/webhooks" }, - "duration": 366 + "duration": 555 }, { - "recordedAt": 1723824060, + "recordedAt": 1740070340, "request": { "body": "", "method": "GET", @@ -104,20 +104,20 @@ "uri": "https://api.easypost.com/v2/webhooks" }, "response": { - "body": "{\n \"webhooks\": [\n {\n \"mode\": \"test\",\n \"disabled_at\": null,\n \"created_at\": \"2024-08-16T16:01:00Z\",\n \"id\": \"hook_bb18e6b05be811efbc5b7d8db8d30d2c\",\n \"url\": \"http://example.com\",\n \"object\": \"Webhook\"\n }\n ]\n}", + "body": "{\n \"webhooks\": [\n {\n \"mode\": \"test\",\n \"disabled_at\": null,\n \"created_at\": \"2025-02-20T16:52:20Z\",\n \"id\": \"hook_0cb0f41cefab11ef807963ca33822ef2\",\n \"url\": \"http://example.com\",\n \"object\": \"Webhook\",\n \"custom_headers\": [\n {\n \"name\": \"test\",\n \"value\": \"header\"\n }\n ]\n }\n ]\n}", "httpVersion": null, "headers": { "null": [ "HTTP/1.1 200 OK" ], "content-length": [ - "176" + "228" ], "expires": [ "0" ], "x-node": [ - "bigweb43nuq" + "bigweb56nuq" ], "x-frame-options": [ "SAMEORIGIN" @@ -137,9 +137,6 @@ "strict-transport-security": [ "max-age\u003d31536000; includeSubDomains; preload" ], - "x-canary": [ - "direct" - ], "x-xss-protection": [ "1; mode\u003dblock" ], @@ -147,23 +144,23 @@ "nosniff" ], "x-ep-request-uuid": [ - "8a4bf43b66bf77bce7872f590036bff4" + "c6a31f9367b75dc4e2b7e29000432d93" ], "x-proxied": [ - "intlb3nuq c0f5e722d1", - "extlb1nuq b6e1b5034c" + "intlb3nuq 51d74985a2", + "extlb2nuq 99aac35317" ], "referrer-policy": [ "strict-origin-when-cross-origin" ], "x-runtime": [ - "0.034141" + "0.032402" ], "content-type": [ "application/json; charset\u003dutf-8" ], "x-version-label": [ - "easypost-202408152333-48cda4a73e-master" + "easypost-202502192243-499e5bdec0-master" ], "cache-control": [ "private, no-cache, no-store" @@ -175,6 +172,92 @@ }, "uri": "https://api.easypost.com/v2/webhooks" }, - "duration": 240 + "duration": 145 + }, + { + "recordedAt": 1740070341, + "request": { + "body": "", + "method": "DELETE", + "headers": { + "Accept-Charset": [ + "UTF-8" + ], + "User-Agent": [ + "REDACTED" + ] + }, + "uri": "https://api.easypost.com/v2/webhooks/hook_0cb0f41cefab11ef807963ca33822ef2" + }, + "response": { + "body": "{}", + "httpVersion": null, + "headers": { + "null": [ + "HTTP/1.1 200 OK" + ], + "content-length": [ + "2" + ], + "expires": [ + "0" + ], + "x-node": [ + "bigweb34nuq" + ], + "x-frame-options": [ + "SAMEORIGIN" + ], + "x-download-options": [ + "noopen" + ], + "x-permitted-cross-domain-policies": [ + "none" + ], + "x-backend": [ + "easypost" + ], + "pragma": [ + "no-cache" + ], + "strict-transport-security": [ + "max-age\u003d31536000; includeSubDomains; preload" + ], + "x-xss-protection": [ + "1; mode\u003dblock" + ], + "x-content-type-options": [ + "nosniff" + ], + "x-ep-request-uuid": [ + "c6a31f9267b75dc5e2b7e29100432dcb" + ], + "x-proxied": [ + "intlb3nuq 51d74985a2", + "extlb2nuq 99aac35317" + ], + "referrer-policy": [ + "strict-origin-when-cross-origin" + ], + "x-runtime": [ + "0.394873" + ], + "content-type": [ + "application/json; charset\u003dutf-8" + ], + "x-version-label": [ + "easypost-202502192243-499e5bdec0-master" + ], + "cache-control": [ + "private, no-cache, no-store" + ] + }, + "status": { + "code": 200, + "message": "OK" + }, + "uri": "https://api.easypost.com/v2/webhooks/hook_0cb0f41cefab11ef807963ca33822ef2" + }, + "duration": 494 } ] \ No newline at end of file diff --git a/src/test/cassettes/webhook/create.json b/src/test/cassettes/webhook/create.json index ea43e34fc..c4b397d25 100644 --- a/src/test/cassettes/webhook/create.json +++ b/src/test/cassettes/webhook/create.json @@ -1,8 +1,8 @@ [ { - "recordedAt": 1723824210, + "recordedAt": 1740070316, "request": { - "body": "{\n \"webhook\": {\n \"url\": \"http://example.com\"\n }\n}", + "body": "{\n \"webhook\": {\n \"webhook_secret\": \"sécret\",\n \"url\": \"http://example.com\",\n \"custom_headers\": [\n {\n \"name\": \"test\",\n \"value\": \"header\"\n }\n ]\n }\n}", "method": "POST", "headers": { "Accept-Charset": [ @@ -18,20 +18,20 @@ "uri": "https://api.easypost.com/v2/webhooks" }, "response": { - "body": "{\n \"mode\": \"test\",\n \"disabled_at\": null,\n \"created_at\": \"2024-08-16T16:03:31Z\",\n \"id\": \"hook_14d6cc1c5be911efbef14beb4b660d57\",\n \"url\": \"http://example.com\",\n \"object\": \"Webhook\"\n}", + "body": "{\n \"mode\": \"test\",\n \"disabled_at\": null,\n \"created_at\": \"2025-02-20T16:51:56Z\",\n \"id\": \"hook_fe5d2a84efaa11efb84e61dfc018c5b8\",\n \"url\": \"http://example.com\",\n \"object\": \"Webhook\",\n \"custom_headers\": [\n {\n \"name\": \"test\",\n \"value\": \"header\"\n }\n ]\n}", "httpVersion": null, "headers": { "null": [ "HTTP/1.1 201 Created" ], "content-length": [ - "161" + "213" ], "expires": [ "0" ], "x-node": [ - "bigweb33nuq" + "bigweb36nuq" ], "x-frame-options": [ "SAMEORIGIN" @@ -58,23 +58,23 @@ "nosniff" ], "x-ep-request-uuid": [ - "0580883066bf7852e787409e003656b1" + "c6a31f8f67b75dace2b7da570043128a" ], "x-proxied": [ - "intlb3nuq c0f5e722d1", - "extlb2nuq b6e1b5034c" + "intlb3nuq 51d74985a2", + "extlb2nuq 99aac35317" ], "referrer-policy": [ "strict-origin-when-cross-origin" ], "x-runtime": [ - "0.174827" + "0.427009" ], "content-type": [ "application/json; charset\u003dutf-8" ], "x-version-label": [ - "easypost-202408152333-48cda4a73e-master" + "easypost-202502192243-499e5bdec0-master" ], "cache-control": [ "private, no-cache, no-store" @@ -86,10 +86,10 @@ }, "uri": "https://api.easypost.com/v2/webhooks" }, - "duration": 398 + "duration": 534 }, { - "recordedAt": 1723824211, + "recordedAt": 1740070317, "request": { "body": "", "method": "DELETE", @@ -101,7 +101,7 @@ "REDACTED" ] }, - "uri": "https://api.easypost.com/v2/webhooks/hook_14d6cc1c5be911efbef14beb4b660d57" + "uri": "https://api.easypost.com/v2/webhooks/hook_fe5d2a84efaa11efb84e61dfc018c5b8" }, "response": { "body": "{}", @@ -117,7 +117,7 @@ "0" ], "x-node": [ - "bigweb32nuq" + "bigweb36nuq" ], "x-frame-options": [ "SAMEORIGIN" @@ -137,9 +137,6 @@ "strict-transport-security": [ "max-age\u003d31536000; includeSubDomains; preload" ], - "x-canary": [ - "direct" - ], "x-xss-protection": [ "1; mode\u003dblock" ], @@ -147,23 +144,23 @@ "nosniff" ], "x-ep-request-uuid": [ - "0580883466bf7853e787409f0036572b" + "c6a31f8d67b75dace2b7da6f0043130a" ], "x-proxied": [ - "intlb3nuq c0f5e722d1", - "extlb2nuq b6e1b5034c" + "intlb4nuq 51d74985a2", + "extlb2nuq 99aac35317" ], "referrer-policy": [ "strict-origin-when-cross-origin" ], "x-runtime": [ - "0.396557" + "0.338361" ], "content-type": [ "application/json; charset\u003dutf-8" ], "x-version-label": [ - "easypost-202408152333-48cda4a73e-master" + "easypost-202502192243-499e5bdec0-master" ], "cache-control": [ "private, no-cache, no-store" @@ -173,8 +170,8 @@ "code": 200, "message": "OK" }, - "uri": "https://api.easypost.com/v2/webhooks/hook_14d6cc1c5be911efbef14beb4b660d57" + "uri": "https://api.easypost.com/v2/webhooks/hook_fe5d2a84efaa11efb84e61dfc018c5b8" }, - "duration": 606 + "duration": 435 } ] \ No newline at end of file diff --git a/src/test/cassettes/webhook/delete.json b/src/test/cassettes/webhook/delete.json index cb734417a..4ce5d1bca 100644 --- a/src/test/cassettes/webhook/delete.json +++ b/src/test/cassettes/webhook/delete.json @@ -1,8 +1,8 @@ [ { - "recordedAt": 1723824179, + "recordedAt": 1740070361, "request": { - "body": "{\n \"webhook\": {\n \"url\": \"http://example.com\"\n }\n}", + "body": "{\n \"webhook\": {\n \"webhook_secret\": \"sécret\",\n \"url\": \"http://example.com\",\n \"custom_headers\": [\n {\n \"name\": \"test\",\n \"value\": \"header\"\n }\n ]\n }\n}", "method": "POST", "headers": { "Accept-Charset": [ @@ -18,20 +18,20 @@ "uri": "https://api.easypost.com/v2/webhooks" }, "response": { - "body": "{\n \"mode\": \"test\",\n \"disabled_at\": null,\n \"created_at\": \"2024-08-16T16:03:00Z\",\n \"id\": \"hook_025ea41a5be911ef8252638bfeba7606\",\n \"url\": \"http://example.com\",\n \"object\": \"Webhook\"\n}", + "body": "{\n \"mode\": \"test\",\n \"disabled_at\": null,\n \"created_at\": \"2025-02-20T16:52:41Z\",\n \"id\": \"hook_190c06d4efab11efb7663b222d4bf486\",\n \"url\": \"http://example.com\",\n \"object\": \"Webhook\",\n \"custom_headers\": [\n {\n \"name\": \"test\",\n \"value\": \"header\"\n }\n ]\n}", "httpVersion": null, "headers": { "null": [ "HTTP/1.1 201 Created" ], "content-length": [ - "161" + "213" ], "expires": [ "0" ], "x-node": [ - "bigweb39nuq" + "bigweb43nuq" ], "x-frame-options": [ "SAMEORIGIN" @@ -51,6 +51,9 @@ "strict-transport-security": [ "max-age\u003d31536000; includeSubDomains; preload" ], + "x-canary": [ + "direct" + ], "x-xss-protection": [ "1; mode\u003dblock" ], @@ -58,23 +61,23 @@ "nosniff" ], "x-ep-request-uuid": [ - "0580883266bf7833e787385e003630c3" + "c6a31f9267b75dd9e2b7eace0043480b" ], "x-proxied": [ - "intlb4nuq c0f5e722d1", - "extlb2nuq b6e1b5034c" + "intlb3nuq 51d74985a2", + "extlb2nuq 99aac35317" ], "referrer-policy": [ "strict-origin-when-cross-origin" ], "x-runtime": [ - "0.180354" + "0.436254" ], "content-type": [ "application/json; charset\u003dutf-8" ], "x-version-label": [ - "easypost-202408152333-48cda4a73e-master" + "easypost-202502192243-499e5bdec0-master" ], "cache-control": [ "private, no-cache, no-store" @@ -86,10 +89,10 @@ }, "uri": "https://api.easypost.com/v2/webhooks" }, - "duration": 396 + "duration": 563 }, { - "recordedAt": 1723824180, + "recordedAt": 1740070361, "request": { "body": "", "method": "GET", @@ -101,23 +104,23 @@ "REDACTED" ] }, - "uri": "https://api.easypost.com/v2/webhooks/hook_025ea41a5be911ef8252638bfeba7606" + "uri": "https://api.easypost.com/v2/webhooks/hook_190c06d4efab11efb7663b222d4bf486" }, "response": { - "body": "{\n \"mode\": \"test\",\n \"disabled_at\": null,\n \"created_at\": \"2024-08-16T16:03:00Z\",\n \"id\": \"hook_025ea41a5be911ef8252638bfeba7606\",\n \"url\": \"http://example.com\",\n \"object\": \"Webhook\"\n}", + "body": "{\n \"mode\": \"test\",\n \"disabled_at\": null,\n \"created_at\": \"2025-02-20T16:52:41Z\",\n \"id\": \"hook_190c06d4efab11efb7663b222d4bf486\",\n \"url\": \"http://example.com\",\n \"object\": \"Webhook\",\n \"custom_headers\": [\n {\n \"name\": \"test\",\n \"value\": \"header\"\n }\n ]\n}", "httpVersion": null, "headers": { "null": [ "HTTP/1.1 200 OK" ], "content-length": [ - "161" + "213" ], "expires": [ "0" ], "x-node": [ - "bigweb41nuq" + "bigweb38nuq" ], "x-frame-options": [ "SAMEORIGIN" @@ -144,23 +147,23 @@ "nosniff" ], "x-ep-request-uuid": [ - "0580883066bf7834e787385f00363147" + "c6a31f9167b75dd9e2b7eacf0043489f" ], "x-proxied": [ - "intlb3nuq c0f5e722d1", - "extlb2nuq b6e1b5034c" + "intlb3nuq 51d74985a2", + "extlb2nuq 99aac35317" ], "referrer-policy": [ "strict-origin-when-cross-origin" ], "x-runtime": [ - "0.038295" + "0.025882" ], "content-type": [ "application/json; charset\u003dutf-8" ], "x-version-label": [ - "easypost-202408152333-48cda4a73e-master" + "easypost-202502192243-499e5bdec0-master" ], "cache-control": [ "private, no-cache, no-store" @@ -170,12 +173,12 @@ "code": 200, "message": "OK" }, - "uri": "https://api.easypost.com/v2/webhooks/hook_025ea41a5be911ef8252638bfeba7606" + "uri": "https://api.easypost.com/v2/webhooks/hook_190c06d4efab11efb7663b222d4bf486" }, - "duration": 260 + "duration": 142 }, { - "recordedAt": 1723824180, + "recordedAt": 1740070362, "request": { "body": "", "method": "DELETE", @@ -187,7 +190,7 @@ "REDACTED" ] }, - "uri": "https://api.easypost.com/v2/webhooks/hook_025ea41a5be911ef8252638bfeba7606" + "uri": "https://api.easypost.com/v2/webhooks/hook_190c06d4efab11efb7663b222d4bf486" }, "response": { "body": "{}", @@ -203,7 +206,7 @@ "0" ], "x-node": [ - "bigweb36nuq" + "bigweb32nuq" ], "x-frame-options": [ "SAMEORIGIN" @@ -223,6 +226,9 @@ "strict-transport-security": [ "max-age\u003d31536000; includeSubDomains; preload" ], + "x-canary": [ + "direct" + ], "x-xss-protection": [ "1; mode\u003dblock" ], @@ -230,23 +236,23 @@ "nosniff" ], "x-ep-request-uuid": [ - "0580883566bf7834e78738600036318b" + "c6a31f8e67b75dd9e2b7ead0004348cc" ], "x-proxied": [ - "intlb3nuq c0f5e722d1", - "extlb2nuq b6e1b5034c" + "intlb3nuq 51d74985a2", + "extlb2nuq 99aac35317" ], "referrer-policy": [ "strict-origin-when-cross-origin" ], "x-runtime": [ - "0.327085" + "0.354045" ], "content-type": [ "application/json; charset\u003dutf-8" ], "x-version-label": [ - "easypost-202408152333-48cda4a73e-master" + "easypost-202502192243-499e5bdec0-master" ], "cache-control": [ "private, no-cache, no-store" @@ -256,8 +262,8 @@ "code": 200, "message": "OK" }, - "uri": "https://api.easypost.com/v2/webhooks/hook_025ea41a5be911ef8252638bfeba7606" + "uri": "https://api.easypost.com/v2/webhooks/hook_190c06d4efab11efb7663b222d4bf486" }, - "duration": 546 + "duration": 456 } ] \ No newline at end of file diff --git a/src/test/cassettes/webhook/retrieve.json b/src/test/cassettes/webhook/retrieve.json index 5be0bfd89..1eca34221 100644 --- a/src/test/cassettes/webhook/retrieve.json +++ b/src/test/cassettes/webhook/retrieve.json @@ -1,8 +1,8 @@ [ { - "recordedAt": 1723824178, + "recordedAt": 1740070379, "request": { - "body": "{\n \"webhook\": {\n \"url\": \"http://example.com\"\n }\n}", + "body": "{\n \"webhook\": {\n \"webhook_secret\": \"sécret\",\n \"url\": \"http://example.com\",\n \"custom_headers\": [\n {\n \"name\": \"test\",\n \"value\": \"header\"\n }\n ]\n }\n}", "method": "POST", "headers": { "Accept-Charset": [ @@ -18,14 +18,14 @@ "uri": "https://api.easypost.com/v2/webhooks" }, "response": { - "body": "{\n \"mode\": \"test\",\n \"disabled_at\": null,\n \"created_at\": \"2024-08-16T16:02:58Z\",\n \"id\": \"hook_017271945be911efac4c110d6e514c58\",\n \"url\": \"http://example.com\",\n \"object\": \"Webhook\"\n}", + "body": "{\n \"mode\": \"test\",\n \"disabled_at\": null,\n \"created_at\": \"2025-02-20T16:52:59Z\",\n \"id\": \"hook_23c7531cefab11efbe44197603026978\",\n \"url\": \"http://example.com\",\n \"object\": \"Webhook\",\n \"custom_headers\": [\n {\n \"name\": \"test\",\n \"value\": \"header\"\n }\n ]\n}", "httpVersion": null, "headers": { "null": [ "HTTP/1.1 201 Created" ], "content-length": [ - "161" + "213" ], "expires": [ "0" @@ -58,23 +58,23 @@ "nosniff" ], "x-ep-request-uuid": [ - "0580883466bf7832e787384200362ea8" + "c6a31f9267b75debe2b7eff800435dd3" ], "x-proxied": [ - "intlb4nuq c0f5e722d1", - "extlb2nuq b6e1b5034c" + "intlb3nuq 51d74985a2", + "extlb2nuq 99aac35317" ], "referrer-policy": [ "strict-origin-when-cross-origin" ], "x-runtime": [ - "0.157394" + "0.402787" ], "content-type": [ "application/json; charset\u003dutf-8" ], "x-version-label": [ - "easypost-202408152333-48cda4a73e-master" + "easypost-202502192243-499e5bdec0-master" ], "cache-control": [ "private, no-cache, no-store" @@ -86,10 +86,10 @@ }, "uri": "https://api.easypost.com/v2/webhooks" }, - "duration": 371 + "duration": 516 }, { - "recordedAt": 1723824178, + "recordedAt": 1740070379, "request": { "body": "", "method": "GET", @@ -101,23 +101,23 @@ "REDACTED" ] }, - "uri": "https://api.easypost.com/v2/webhooks/hook_017271945be911efac4c110d6e514c58" + "uri": "https://api.easypost.com/v2/webhooks/hook_23c7531cefab11efbe44197603026978" }, "response": { - "body": "{\n \"mode\": \"test\",\n \"disabled_at\": null,\n \"created_at\": \"2024-08-16T16:02:58Z\",\n \"id\": \"hook_017271945be911efac4c110d6e514c58\",\n \"url\": \"http://example.com\",\n \"object\": \"Webhook\"\n}", + "body": "{\n \"mode\": \"test\",\n \"disabled_at\": null,\n \"created_at\": \"2025-02-20T16:52:59Z\",\n \"id\": \"hook_23c7531cefab11efbe44197603026978\",\n \"url\": \"http://example.com\",\n \"object\": \"Webhook\",\n \"custom_headers\": [\n {\n \"name\": \"test\",\n \"value\": \"header\"\n }\n ]\n}", "httpVersion": null, "headers": { "null": [ "HTTP/1.1 200 OK" ], "content-length": [ - "161" + "213" ], "expires": [ "0" ], "x-node": [ - "bigweb38nuq" + "bigweb54nuq" ], "x-frame-options": [ "SAMEORIGIN" @@ -144,23 +144,23 @@ "nosniff" ], "x-ep-request-uuid": [ - "0580883666bf7832e787384300362f2a" + "c6a31f8c67b75debe2b7eff900435e6e" ], "x-proxied": [ - "intlb4nuq c0f5e722d1", - "extlb2nuq b6e1b5034c" + "intlb3nuq 51d74985a2", + "extlb2nuq 99aac35317" ], "referrer-policy": [ "strict-origin-when-cross-origin" ], "x-runtime": [ - "0.034720" + "0.034835" ], "content-type": [ "application/json; charset\u003dutf-8" ], "x-version-label": [ - "easypost-202408152333-48cda4a73e-master" + "easypost-202502192243-499e5bdec0-master" ], "cache-control": [ "private, no-cache, no-store" @@ -170,12 +170,12 @@ "code": 200, "message": "OK" }, - "uri": "https://api.easypost.com/v2/webhooks/hook_017271945be911efac4c110d6e514c58" + "uri": "https://api.easypost.com/v2/webhooks/hook_23c7531cefab11efbe44197603026978" }, - "duration": 245 + "duration": 153 }, { - "recordedAt": 1723824179, + "recordedAt": 1740070380, "request": { "body": "", "method": "DELETE", @@ -187,7 +187,7 @@ "REDACTED" ] }, - "uri": "https://api.easypost.com/v2/webhooks/hook_017271945be911efac4c110d6e514c58" + "uri": "https://api.easypost.com/v2/webhooks/hook_23c7531cefab11efbe44197603026978" }, "response": { "body": "{}", @@ -203,7 +203,7 @@ "0" ], "x-node": [ - "bigweb42nuq" + "bigweb54nuq" ], "x-frame-options": [ "SAMEORIGIN" @@ -230,23 +230,23 @@ "nosniff" ], "x-ep-request-uuid": [ - "0580883466bf7832e787384400362f7f" + "c6a31f8f67b75debe2b7effa00435ea0" ], "x-proxied": [ - "intlb3nuq c0f5e722d1", - "extlb2nuq b6e1b5034c" + "intlb3nuq 51d74985a2", + "extlb2nuq 99aac35317" ], "referrer-policy": [ "strict-origin-when-cross-origin" ], "x-runtime": [ - "0.369001" + "0.337242" ], "content-type": [ "application/json; charset\u003dutf-8" ], "x-version-label": [ - "easypost-202408152333-48cda4a73e-master" + "easypost-202502192243-499e5bdec0-master" ], "cache-control": [ "private, no-cache, no-store" @@ -256,8 +256,8 @@ "code": 200, "message": "OK" }, - "uri": "https://api.easypost.com/v2/webhooks/hook_017271945be911efac4c110d6e514c58" + "uri": "https://api.easypost.com/v2/webhooks/hook_23c7531cefab11efbe44197603026978" }, - "duration": 581 + "duration": 438 } ] \ No newline at end of file diff --git a/src/test/cassettes/webhook/update.json b/src/test/cassettes/webhook/update.json index 1407351f4..a9e8602b5 100644 --- a/src/test/cassettes/webhook/update.json +++ b/src/test/cassettes/webhook/update.json @@ -1,8 +1,8 @@ [ { - "recordedAt": 1723824181, + "recordedAt": 1740070397, "request": { - "body": "{\n \"webhook\": {\n \"url\": \"http://example.com\"\n }\n}", + "body": "{\n \"webhook\": {\n \"webhook_secret\": \"sécret\",\n \"url\": \"http://example.com\",\n \"custom_headers\": [\n {\n \"name\": \"test\",\n \"value\": \"header\"\n }\n ]\n }\n}", "method": "POST", "headers": { "Accept-Charset": [ @@ -18,20 +18,20 @@ "uri": "https://api.easypost.com/v2/webhooks" }, "response": { - "body": "{\n \"mode\": \"test\",\n \"disabled_at\": null,\n \"created_at\": \"2024-08-16T16:03:01Z\",\n \"id\": \"hook_032ca4be5be911ef881b0193adc21e57\",\n \"url\": \"http://example.com\",\n \"object\": \"Webhook\"\n}", + "body": "{\n \"mode\": \"test\",\n \"disabled_at\": null,\n \"created_at\": \"2025-02-20T16:53:17Z\",\n \"id\": \"hook_2e88ac92efab11ef96cc57dc6c60627e\",\n \"url\": \"http://example.com\",\n \"object\": \"Webhook\",\n \"custom_headers\": [\n {\n \"name\": \"test\",\n \"value\": \"header\"\n }\n ]\n}", "httpVersion": null, "headers": { "null": [ "HTTP/1.1 201 Created" ], "content-length": [ - "161" + "213" ], "expires": [ "0" ], "x-node": [ - "bigweb39nuq" + "bigweb35nuq" ], "x-frame-options": [ "SAMEORIGIN" @@ -58,23 +58,23 @@ "nosniff" ], "x-ep-request-uuid": [ - "0580883566bf7835e787386200363271" + "c6a31f8e67b75dfde2b85a2f004372cb" ], "x-proxied": [ - "intlb3nuq c0f5e722d1", - "extlb2nuq b6e1b5034c" + "intlb4nuq 51d74985a2", + "extlb2nuq 99aac35317" ], "referrer-policy": [ "strict-origin-when-cross-origin" ], "x-runtime": [ - "0.115087" + "0.384566" ], "content-type": [ "application/json; charset\u003dutf-8" ], "x-version-label": [ - "easypost-202408152333-48cda4a73e-master" + "easypost-202502192243-499e5bdec0-master" ], "cache-control": [ "private, no-cache, no-store" @@ -86,12 +86,12 @@ }, "uri": "https://api.easypost.com/v2/webhooks" }, - "duration": 316 + "duration": 491 }, { - "recordedAt": 1723824182, + "recordedAt": 1740070398, "request": { - "body": "{\n \"webhook\": {}\n}", + "body": "{\n \"webhook_secret\": \"sécret\",\n \"custom_headers\": [\n {\n \"name\": \"test\",\n \"value\": \"header\"\n }\n ]\n}", "method": "PUT", "headers": { "Accept-Charset": [ @@ -104,23 +104,23 @@ "application/json" ] }, - "uri": "https://api.easypost.com/v2/webhooks/hook_032ca4be5be911ef881b0193adc21e57" + "uri": "https://api.easypost.com/v2/webhooks/hook_2e88ac92efab11ef96cc57dc6c60627e" }, "response": { - "body": "{\n \"mode\": \"test\",\n \"disabled_at\": null,\n \"created_at\": \"2024-08-16T16:03:01Z\",\n \"id\": \"hook_032ca4be5be911ef881b0193adc21e57\",\n \"url\": \"http://example.com\",\n \"object\": \"Webhook\"\n}", + "body": "{\n \"mode\": \"test\",\n \"disabled_at\": null,\n \"created_at\": \"2025-02-20T16:53:17Z\",\n \"id\": \"hook_2e88ac92efab11ef96cc57dc6c60627e\",\n \"url\": \"http://example.com\",\n \"object\": \"Webhook\",\n \"custom_headers\": [\n {\n \"name\": \"test\",\n \"value\": \"header\"\n }\n ]\n}", "httpVersion": null, "headers": { "null": [ "HTTP/1.1 201 Created" ], "content-length": [ - "161" + "213" ], "expires": [ "0" ], "x-node": [ - "bigweb35nuq" + "bigweb57nuq" ], "x-frame-options": [ "SAMEORIGIN" @@ -147,23 +147,23 @@ "nosniff" ], "x-ep-request-uuid": [ - "0580883066bf7835e78738640036330f" + "c6a31f9067b75dfde2b85a3100437361" ], "x-proxied": [ - "intlb3nuq c0f5e722d1", - "extlb2nuq b6e1b5034c" + "intlb4nuq 51d74985a2", + "extlb2nuq 99aac35317" ], "referrer-policy": [ "strict-origin-when-cross-origin" ], "x-runtime": [ - "0.518599" + "0.743142" ], "content-type": [ "application/json; charset\u003dutf-8" ], "x-version-label": [ - "easypost-202408152333-48cda4a73e-master" + "easypost-202502192243-499e5bdec0-master" ], "cache-control": [ "private, no-cache, no-store" @@ -173,12 +173,12 @@ "code": 201, "message": "Created" }, - "uri": "https://api.easypost.com/v2/webhooks/hook_032ca4be5be911ef881b0193adc21e57" + "uri": "https://api.easypost.com/v2/webhooks/hook_2e88ac92efab11ef96cc57dc6c60627e" }, - "duration": 734 + "duration": 871 }, { - "recordedAt": 1723824182, + "recordedAt": 1740070398, "request": { "body": "", "method": "DELETE", @@ -190,7 +190,7 @@ "REDACTED" ] }, - "uri": "https://api.easypost.com/v2/webhooks/hook_032ca4be5be911ef881b0193adc21e57" + "uri": "https://api.easypost.com/v2/webhooks/hook_2e88ac92efab11ef96cc57dc6c60627e" }, "response": { "body": "{}", @@ -206,7 +206,7 @@ "0" ], "x-node": [ - "bigweb42nuq" + "bigweb56nuq" ], "x-frame-options": [ "SAMEORIGIN" @@ -233,23 +233,23 @@ "nosniff" ], "x-ep-request-uuid": [ - "0580883266bf7836e7873865003633e3" + "c6a31f8e67b75dfee2b85a3200437449" ], "x-proxied": [ - "intlb4nuq c0f5e722d1", - "extlb2nuq b6e1b5034c" + "intlb3nuq 51d74985a2", + "extlb2nuq 99aac35317" ], "referrer-policy": [ "strict-origin-when-cross-origin" ], "x-runtime": [ - "0.440538" + "0.325343" ], "content-type": [ "application/json; charset\u003dutf-8" ], "x-version-label": [ - "easypost-202408152333-48cda4a73e-master" + "easypost-202502192243-499e5bdec0-master" ], "cache-control": [ "private, no-cache, no-store" @@ -259,8 +259,8 @@ "code": 200, "message": "OK" }, - "uri": "https://api.easypost.com/v2/webhooks/hook_032ca4be5be911ef881b0193adc21e57" + "uri": "https://api.easypost.com/v2/webhooks/hook_2e88ac92efab11ef96cc57dc6c60627e" }, - "duration": 639 + "duration": 441 } ] \ No newline at end of file diff --git a/src/test/java/com/easypost/Fixtures.java b/src/test/java/com/easypost/Fixtures.java index 1e5449be8..a7217337c 100644 --- a/src/test/java/com/easypost/Fixtures.java +++ b/src/test/java/com/easypost/Fixtures.java @@ -14,6 +14,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.HashMap; +import java.util.List; import java.util.Objects; import static com.easypost.TestUtils.getSourceFileDirectory; @@ -295,21 +296,21 @@ public static byte[] eventBytes() { } /** - * Get the default webhook URL. + * Get the default webhook HMAC signature. * - * @return The default webhook URL + * @return The default webhook HMAC signature */ public static String webhookHmacSignature() { - return Objects.requireNonNull(getFixtureData()).webhookHmacSignature; + return Objects.requireNonNull(getFixtureData()).webhooks.hmacSignature; } /** - * Get the default webhook URL. + * Get the default webhook secret. * - * @return The default webhook URL + * @return The default webhook secret */ public static String webhookSecret() { - return Objects.requireNonNull(getFixtureData()).webhookSecret; + return Objects.requireNonNull(getFixtureData()).webhooks.secret; } /** @@ -318,7 +319,16 @@ public static String webhookSecret() { * @return The default webhook URL */ public static String webhookUrl() { - return Objects.requireNonNull(getFixtureData()).webhookUrl; + return Objects.requireNonNull(getFixtureData()).webhooks.url; + } + + /** + * Get the default webhook custom headers. + * + * @return The default webhook custom headers + */ + public static List webhookCustomHeaders() { + return Objects.requireNonNull(getFixtureData()).webhooks.customHeaders; } /** diff --git a/src/test/java/com/easypost/TestUtils.java b/src/test/java/com/easypost/TestUtils.java index 64a9fcdaa..2f4b04237 100644 --- a/src/test/java/com/easypost/TestUtils.java +++ b/src/test/java/com/easypost/TestUtils.java @@ -175,7 +175,7 @@ public VCR(String testCassettesFolder, String apiKey) throws MissingParameterErr advancedSettings.censors = new Censors("REDACTED").censorHeadersByKeys(HEADER_CENSORS) .censorQueryParametersByKeys(QUERY_CENSORS).censorBodyElementsByKeys(BODY_CENSORS); - advancedSettings.timeFrame = TimeFrame.months6(); + advancedSettings.timeFrame = TimeFrame.months12(); advancedSettings.whenExpired = ExpirationActions.Warn; vcr = new com.easypost.easyvcr.VCR(advancedSettings); diff --git a/src/test/java/com/easypost/WebhookTest.java b/src/test/java/com/easypost/WebhookTest.java index c48d886b2..11a57ee44 100644 --- a/src/test/java/com/easypost/WebhookTest.java +++ b/src/test/java/com/easypost/WebhookTest.java @@ -3,6 +3,7 @@ import com.easypost.exception.EasyPostException; import com.easypost.model.Event; import com.easypost.model.Webhook; +import com.easypost.model.WebhookCustomHeader; import com.easypost.utils.Utilities; import com.google.common.collect.ImmutableMap; import org.junit.jupiter.api.AfterEach; @@ -51,6 +52,22 @@ public void cleanup() { } } + /** + * Create a webhook. + * + * @return Webhook object + */ + private static Webhook createBasicWebhook() throws EasyPostException { + Map params = new HashMap<>(); + params.put("url", Fixtures.webhookUrl()); + params.put("webhook_secret", Fixtures.webhookSecret()); + params.put("custom_headers", Fixtures.webhookCustomHeaders()); + + Webhook webhook = vcr.client.webhook.create(params); + testWebhookId = webhook.getId(); // trigger deletion after test + return webhook; + } + /** * Test creating a webhook. * @@ -65,20 +82,9 @@ public void testCreate() throws EasyPostException { assertInstanceOf(Webhook.class, webhook); assertTrue(webhook.getId().startsWith("hook_")); assertEquals(Fixtures.webhookUrl(), webhook.getUrl()); - } - - /** - * Create a webhook. - * - * @return Webhook object - */ - private static Webhook createBasicWebhook() throws EasyPostException { - Map params = new HashMap<>(); - params.put("url", Fixtures.webhookUrl()); - - Webhook webhook = vcr.client.webhook.create(params); - testWebhookId = webhook.getId(); // trigger deletion after test - return webhook; + WebhookCustomHeader customHeader = webhook.getCustomHeaders().get(0); + assertEquals("test", customHeader.getName()); + assertEquals("header", customHeader.getValue()); } /** @@ -106,10 +112,8 @@ public void testRetrieve() throws EasyPostException { @Test public void testAll() throws EasyPostException { vcr.setUpTest("all"); - Map params = new HashMap<>(); - params.put("url", Fixtures.webhookUrl()); - vcr.client.webhook.create(params); + createBasicWebhook(); List webhooks = vcr.client.webhook.all(); @@ -127,10 +131,16 @@ public void testUpdate() throws EasyPostException { vcr.setUpTest("update"); Webhook webhook = createBasicWebhook(); + Map params = new HashMap<>(); + params.put("webhook_secret", Fixtures.webhookSecret()); + params.put("custom_headers", Fixtures.webhookCustomHeaders()); - vcr.client.webhook.update(webhook.getId()); + Webhook updatedWebhook = vcr.client.webhook.update(webhook.getId(), params); - assertInstanceOf(Webhook.class, webhook); + assertInstanceOf(Webhook.class, updatedWebhook); + WebhookCustomHeader customHeader = updatedWebhook.getCustomHeaders().get(0); + assertEquals("test", customHeader.getName()); + assertEquals("header", customHeader.getValue()); } /** diff --git a/src/test/java/com/easypost/fixtures/FixtureStructure.java b/src/test/java/com/easypost/fixtures/FixtureStructure.java index e9fddebf7..3be812070 100644 --- a/src/test/java/com/easypost/fixtures/FixtureStructure.java +++ b/src/test/java/com/easypost/fixtures/FixtureStructure.java @@ -18,6 +18,7 @@ import com.easypost.fixtures.components.Shipments; import com.easypost.fixtures.components.TaxIdentifiers; import com.easypost.fixtures.components.Users; +import com.easypost.fixtures.components.Webhooks; import com.google.gson.annotations.SerializedName; public final class FixtureStructure { @@ -76,13 +77,7 @@ public final class FixtureStructure { @SerializedName ("users") public Users users; - @SerializedName ("webhook_hmac_signature") - public String webhookHmacSignature; - - @SerializedName ("webhook_secret") - public String webhookSecret; - - @SerializedName ("webhook_url") - public String webhookUrl; + @SerializedName ("webhooks") + public Webhooks webhooks; } diff --git a/src/test/java/com/easypost/fixtures/components/Webhooks.java b/src/test/java/com/easypost/fixtures/components/Webhooks.java new file mode 100644 index 000000000..c2456c8d3 --- /dev/null +++ b/src/test/java/com/easypost/fixtures/components/Webhooks.java @@ -0,0 +1,20 @@ +package com.easypost.fixtures.components; + +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +public final class Webhooks { + @SerializedName ("hmac_signature") + public String hmacSignature; + + @SerializedName ("secret") + public String secret; + + @SerializedName ("url") + public String url; + + @SerializedName ("custom_headers") + public List customHeaders; + +}