From 2d223ea9571ab87f405fd3a876d12d51daafb135 Mon Sep 17 00:00:00 2001 From: Igor Balos Date: Mon, 26 Aug 2024 13:31:22 +0200 Subject: [PATCH 1/2] add custom domain tracking --- .../postmark/client/AccountApiClient.java | 5 +++++ .../client/data/model/domains/Domain.java | 10 ++++++++++ .../data/model/domains/DomainDetails.java | 20 +++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/src/main/java/com/postmarkapp/postmark/client/AccountApiClient.java b/src/main/java/com/postmarkapp/postmark/client/AccountApiClient.java index 0ca2b50..12960b0 100644 --- a/src/main/java/com/postmarkapp/postmark/client/AccountApiClient.java +++ b/src/main/java/com/postmarkapp/postmark/client/AccountApiClient.java @@ -104,6 +104,11 @@ public DomainDetails verifyDomainReturnPath(Integer id) throws PostmarkException return dataHandler.fromJson(response,DomainDetails.class); } + public DomainDetails verifyDomainCustomTracking(Integer id) throws PostmarkException, IOException { + String response = execute(HttpClient.REQUEST_TYPES.PUT, getEndpointUrl(domainsEndpoint + id + "/verifyCustomTracking")); + return dataHandler.fromJson(response,DomainDetails.class); + } + public String verifyDomainSPF(Integer id) throws PostmarkException, IOException { return execute(HttpClient.REQUEST_TYPES.POST, getEndpointUrl(domainsEndpoint + id + "/verifySPF")); } diff --git a/src/main/java/com/postmarkapp/postmark/client/data/model/domains/Domain.java b/src/main/java/com/postmarkapp/postmark/client/data/model/domains/Domain.java index f52763a..671d402 100644 --- a/src/main/java/com/postmarkapp/postmark/client/data/model/domains/Domain.java +++ b/src/main/java/com/postmarkapp/postmark/client/data/model/domains/Domain.java @@ -10,6 +10,8 @@ public class Domain { private Boolean dkimVerified; private Boolean weakDKIM; private Boolean returnPathDomainVerified; + + private Boolean customTrackingVerified; private Integer id; // GETTERS AND SETTERS @@ -38,6 +40,14 @@ public void setDkimVerified(Boolean dkimVerified) { this.dkimVerified = dkimVerified; } + public Boolean getCustomTrackingVerified() { + return customTrackingVerified; + } + + public void setCustomTrackingVerified(Boolean customTrackingVerified) { + this.customTrackingVerified = customTrackingVerified; + } + public Boolean getWeakDKIM() { return weakDKIM; } diff --git a/src/main/java/com/postmarkapp/postmark/client/data/model/domains/DomainDetails.java b/src/main/java/com/postmarkapp/postmark/client/data/model/domains/DomainDetails.java index 29d1a9a..27674cd 100644 --- a/src/main/java/com/postmarkapp/postmark/client/data/model/domains/DomainDetails.java +++ b/src/main/java/com/postmarkapp/postmark/client/data/model/domains/DomainDetails.java @@ -18,6 +18,10 @@ public class DomainDetails extends Domain { private String returnPathDomain; private String returnPathDomainCNAMEValue; + private String customTrackingDomain; + + private String customTrackingDomainCNAMEValue; + // GETTERS AND SETTERS public String getSpfHost() { @@ -116,4 +120,20 @@ public void setReturnPathDomainCNAMEValue(String returnPathDomainCNAMEValue) { this.returnPathDomainCNAMEValue = returnPathDomainCNAMEValue; } + public String getCustomTrackingDomain() { + return customTrackingDomain; + } + + public void setCustomTrackingDomain(String customTrackingDomain) { + this.customTrackingDomain = customTrackingDomain; + } + + public String getCustomTrackingDomainCNAMEValue() { + return customTrackingDomainCNAMEValue; + } + + public void setCustomTrackingDomainCNAMEValue(String customTrackingDomainCNAMEValue) { + this.customTrackingDomainCNAMEValue = customTrackingDomainCNAMEValue; + } + } From 942104c7c200eadbbf2fac6d7bbe003beb08a2e0 Mon Sep 17 00:00:00 2001 From: Igor Balos Date: Mon, 26 Aug 2024 14:54:47 +0200 Subject: [PATCH 2/2] added test --- src/test/java/integration/DomainTest.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/test/java/integration/DomainTest.java b/src/test/java/integration/DomainTest.java index 51f3774..6ab2cc3 100644 --- a/src/test/java/integration/DomainTest.java +++ b/src/test/java/integration/DomainTest.java @@ -10,8 +10,7 @@ import java.io.IOException; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.*; /** * Created by bash on 11/14/17. @@ -58,4 +57,13 @@ void verifyReturnPath() throws PostmarkException, IOException { assertNotNull(domainDetails.getDkimTextValue()); } + @Test + void verifyDomainCustomTracking() throws PostmarkException, IOException { + Domains domains = client.getDomains(Parameters.init().build("count",6).build("offset",0)); + Integer domainId = domains.getDomains().get(0).getId(); + DomainDetails domainDetails = client.verifyDomainCustomTracking(domainId); + assertNotNull(domainDetails.getCustomTrackingDomainCNAMEValue()); + assertFalse(domainDetails.getCustomTrackingVerified()); + } + }