From 6a36a10a74bb36f1fb71e9b266bfc21a9e309f03 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 26 May 2026 03:12:16 +0000 Subject: [PATCH 1/2] Prepare Java SDK endpoint coverage release Co-authored-by: barnett --- pom.xml | 4 +- .../java/com/trolley/BalancesGateway.java | 8 ++- src/main/java/com/trolley/BatchGateway.java | 12 ++-- src/main/java/com/trolley/Gateway.java | 4 ++ .../com/trolley/OfflinePaymentGateway.java | 6 +- src/main/java/com/trolley/PaymentGateway.java | 19 +++++-- .../com/trolley/RecipientAccountGateway.java | 10 ++-- .../java/com/trolley/RecipientGateway.java | 12 ++-- .../java/com/trolley/VerificationGateway.java | 55 +++++++++++++++++++ .../com/trolley/types/OfflinePayment.java | 3 + src/main/java/com/trolley/types/Payment.java | 4 ++ .../com/trolley/types/RecipientAccount.java | 3 + 12 files changed, 111 insertions(+), 29 deletions(-) create mode 100644 src/main/java/com/trolley/VerificationGateway.java diff --git a/pom.xml b/pom.xml index 0c22141..9744f28 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.trolley java-sdk - 2.1.1 + 2.1.3 Java SDK for Trolley API jar Trolley Java SDK @@ -173,7 +173,7 @@ com.fasterxml.jackson.core jackson-core - 2.15.2 + 2.18.6 diff --git a/src/main/java/com/trolley/BalancesGateway.java b/src/main/java/com/trolley/BalancesGateway.java index 98eab58..42dfe50 100644 --- a/src/main/java/com/trolley/BalancesGateway.java +++ b/src/main/java/com/trolley/BalancesGateway.java @@ -23,7 +23,9 @@ public BalancesGateway(final Configuration config) { * @throws Exception */ public List getPaypalAccountBalances() throws Exception{ - return fetchBalances("paypal"); + final String endPoint = "/v1/balances/paypal"; + final String response = this.client.get(endPoint); + return balancesListFactory(response); } /** @@ -32,7 +34,9 @@ public List getPaypalAccountBalances() throws Exception{ * @throws Exception */ public List getTrolleyAccountBalances() throws Exception{ - return fetchBalances("paymentrails"); + final String endPoint = "/v1/balances/paymentrails"; + final String response = this.client.get(endPoint); + return balancesListFactory(response); } /** diff --git a/src/main/java/com/trolley/BatchGateway.java b/src/main/java/com/trolley/BatchGateway.java index 7d7a6e8..5986531 100644 --- a/src/main/java/com/trolley/BatchGateway.java +++ b/src/main/java/com/trolley/BatchGateway.java @@ -26,7 +26,7 @@ public Batch find(final String batchId) throws Exception { if (batchId == null || batchId.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); } - final String endPoint = "/v1/batches/" + batchId; + final String endPoint = "/v1/batches/{batchId}".replace("{batchId}", batchId); final String response = this.client.get(endPoint); return this.batchFactory(response); } @@ -39,7 +39,7 @@ public boolean update(final String batchId, final Batch batch) throws Exception throw new InvalidFieldException("Batch object cannot be null or empty."); } final String jsonBatch = new ObjectMapper().writeValueAsString((Object)batch); - final String endPoint = "/v1/batches/" + batchId; + final String endPoint = "/v1/batches/{batchId}".replace("{batchId}", batchId); this.client.patch(endPoint, jsonBatch); return true; } @@ -48,7 +48,7 @@ public boolean delete(final String batchId) throws Exception { if (batchId == null || batchId.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); } - final String endPoint = "/v1/batches/" + batchId; + final String endPoint = "/v1/batches/{batchId}".replace("{batchId}", batchId); this.client.delete(endPoint); return true; } @@ -96,7 +96,7 @@ public String generateQuote(final String batchId) throws Exception { if (batchId == null || batchId.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); } - final String endPoint = "/v1/batches/" + batchId + "/generate-quote"; + final String endPoint = "/v1/batches/{batchId}/generate-quote".replace("{batchId}", batchId); final String response = this.client.post(endPoint); return response; } @@ -105,7 +105,7 @@ public String processBatch(final String batchId) throws Exception { if (batchId == null || batchId.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); } - final String endPoint = "/v1/batches/" + batchId + "/start-processing"; + final String endPoint = "/v1/batches/{batchId}/start-processing".replace("{batchId}", batchId); final String response = this.client.post(endPoint); return response; } @@ -154,7 +154,7 @@ public BatchSummary summary(final String batchId) throws Exception { if (batchId == null || batchId.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null os empty"); } - final String endPoint = "/v1/batches/" + batchId + "/summary"; + final String endPoint = "/v1/batches/{batchId}/summary".replace("{batchId}", batchId); final String response = this.client.get(endPoint); final ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); diff --git a/src/main/java/com/trolley/Gateway.java b/src/main/java/com/trolley/Gateway.java index a033321..169a670 100644 --- a/src/main/java/com/trolley/Gateway.java +++ b/src/main/java/com/trolley/Gateway.java @@ -13,6 +13,8 @@ public class Gateway public InvoiceGateway invoice; public InvoiceLineGateway invoiceLine; public InvoicePaymentGateway invoicePayment; + public VerificationGateway verification; + public VerificationGateway trust; public Gateway(final Configuration config) { this.config = config; @@ -26,5 +28,7 @@ public Gateway(final Configuration config) { this.invoice = new InvoiceGateway(config); this.invoiceLine = new InvoiceLineGateway(config); this.invoicePayment = new InvoicePaymentGateway(config); + this.verification = new VerificationGateway(config); + this.trust = this.verification; } } diff --git a/src/main/java/com/trolley/OfflinePaymentGateway.java b/src/main/java/com/trolley/OfflinePaymentGateway.java index bada37d..7ad6b0e 100644 --- a/src/main/java/com/trolley/OfflinePaymentGateway.java +++ b/src/main/java/com/trolley/OfflinePaymentGateway.java @@ -38,7 +38,7 @@ public OfflinePayment create(final String recipientId, final OfflinePayment offl String jsonRequest = new ObjectMapper() .setDefaultPropertyInclusion(JsonInclude.Include.NON_DEFAULT) .writeValueAsString((Object)offlinePayment); - final String endPoint = "/v1/recipients/" + recipientId + "/offlinePayments/"; + final String endPoint = "/v1/recipients/{recipientId}/offlinePayments".replace("{recipientId}", recipientId); final String response = this.client.post(endPoint, jsonRequest); return this.offlinePaymentFactory(response); } @@ -66,7 +66,7 @@ public boolean update(final String recipientId, final String offlinePaymentId, f .setDefaultPropertyInclusion(JsonInclude.Include.NON_DEFAULT) .writeValueAsString((Object)offlinePayment); - final String endPoint = "/v1/recipients/" + recipientId + "/offlinePayments/" + offlinePaymentId; + final String endPoint = "/v1/recipients/{recipientId}/offlinePayments/{offlinePaymentId}".replace("{recipientId}", recipientId).replace("{offlinePaymentId}", offlinePaymentId); this.client.patch(endPoint, jsonRequest); return true; } @@ -86,7 +86,7 @@ public boolean delete(final String recipientId,final String offlinePaymentId) th throw new InvalidFieldException("offlinePaymentId cannot be null or empty."); } - final String endPoint = "/v1/recipients/" + recipientId + "/offlinePayments/" + offlinePaymentId; + final String endPoint = "/v1/recipients/{recipientId}/offlinePayments/{offlinePaymentId}".replace("{recipientId}", recipientId).replace("{offlinePaymentId}", offlinePaymentId); this.client.delete(endPoint); return true; } diff --git a/src/main/java/com/trolley/PaymentGateway.java b/src/main/java/com/trolley/PaymentGateway.java index 9359730..6adcff5 100644 --- a/src/main/java/com/trolley/PaymentGateway.java +++ b/src/main/java/com/trolley/PaymentGateway.java @@ -28,7 +28,16 @@ public Payment find(final String paymentId, final String batchId) throws Excepti if (paymentId == null || paymentId.isEmpty()) { throw new InvalidFieldException("Payment id cannot be null or empty."); } - final String endPoint = "/v1/batches/" + batchId + "/payments/" + paymentId; + final String endPoint = "/v1/batches/{batchId}/payments/{paymentId}".replace("{batchId}", batchId).replace("{paymentId}", paymentId); + final String response = this.client.get(endPoint); + return this.paymentFactory(response); + } + + public Payment find(final String paymentId) throws Exception { + if (paymentId == null || paymentId.isEmpty()) { + throw new InvalidFieldException("Payment id cannot be null or empty."); + } + final String endPoint = "/v1/payments/{paymentId}".replace("{paymentId}", paymentId); final String response = this.client.get(endPoint); return this.paymentFactory(response); } @@ -45,7 +54,7 @@ public Payment create(final Payment payment, final String batchId) throws Except .setDefaultPropertyInclusion(JsonInclude.Include.NON_DEFAULT) .writeValueAsString((Object)payment); - final String endPoint = "/v1/batches/" + batchId + "/payments"; + final String endPoint = "/v1/batches/{batchId}/payments".replace("{batchId}", batchId); final String response = this.client.post(endPoint, jsonPayment); return this.paymentFactory(response); } @@ -64,7 +73,7 @@ public boolean update(final String paymentId, final Payment payment, final Strin final String jsonPayment = new ObjectMapper() .setDefaultPropertyInclusion(JsonInclude.Include.NON_DEFAULT) .writeValueAsString((Object)payment); - final String endPoint = "/v1/batches/" + batchId + "/payments/" + paymentId; + final String endPoint = "/v1/batches/{batchId}/payments/{paymentId}".replace("{batchId}", batchId).replace("{paymentId}", paymentId); this.client.patch(endPoint, jsonPayment); return true; } @@ -76,7 +85,7 @@ public boolean delete(final String paymentId, final String batchId) throws Excep if (paymentId == null || paymentId.isEmpty()) { throw new InvalidFieldException("Payment id cannot be null or empty."); } - final String endPoint = "/v1/batches/" + batchId + "/payments/" + paymentId; + final String endPoint = "/v1/batches/{batchId}/payments/{paymentId}".replace("{batchId}", batchId).replace("{paymentId}", paymentId); this.client.delete(endPoint); return true; } @@ -121,7 +130,7 @@ public Payments search(final String batchId, final int page, final int pageSize, if (searchTerm == null) { throw new InvalidFieldException("searchTerm cannot be null. If you don't wish to provide a searchTerm, pass a blank String."); } - final String endPoint = "/v1/batches/" + batchId + "/payments?search=" + searchTerm + "&page=" + page + "&pageSize=" + pageSize; + final String endPoint = "/v1/batches/{batchId}/payments".replace("{batchId}", batchId) + "?search=" + searchTerm + "&page=" + page + "&pageSize=" + pageSize; final String response = this.client.get(endPoint); return this.paymentListFactory(response); diff --git a/src/main/java/com/trolley/RecipientAccountGateway.java b/src/main/java/com/trolley/RecipientAccountGateway.java index f26a6dd..5f6058d 100644 --- a/src/main/java/com/trolley/RecipientAccountGateway.java +++ b/src/main/java/com/trolley/RecipientAccountGateway.java @@ -24,7 +24,7 @@ public List findAll(final String recipientId) throws Exception if (recipientId == null || recipientId.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); } - final String endPoint = "/v1/recipients/" + recipientId + "/accounts"; + final String endPoint = "/v1/recipients/{recipientId}/accounts".replace("{recipientId}", recipientId); final String response = this.client.get(endPoint); return this.recipientAccountListFactory(response); } @@ -33,7 +33,7 @@ public RecipientAccount find(final String recipientId, final String recipientAcc if (recipientId == null || recipientId.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); } - final String endPoint = "/v1/recipients/" + recipientId + "/accounts/" + recipientAccountId; + final String endPoint = "/v1/recipients/{recipientId}/accounts/{recipientAccountId}".replace("{recipientId}", recipientId).replace("{recipientAccountId}", recipientAccountId); final String response = this.client.get(endPoint); return this.recipientAccountFactory(response); } @@ -48,7 +48,7 @@ public RecipientAccount create(final String recipientId, final RecipientAccount final String jsonAccount = new ObjectMapper() .setDefaultPropertyInclusion(JsonInclude.Include.NON_DEFAULT) .writeValueAsString((Object)account); - final String endPoint = "/v1/recipients/" + recipientId + "/accounts"; + final String endPoint = "/v1/recipients/{recipientId}/accounts".replace("{recipientId}", recipientId); final String response = this.client.post(endPoint, jsonAccount); return this.recipientAccountFactory(response); } @@ -63,7 +63,7 @@ public RecipientAccount update(final String recipientId, final String recipientA final String jsonAccount = new ObjectMapper() .setDefaultPropertyInclusion(JsonInclude.Include.NON_DEFAULT) .writeValueAsString((Object)account); - final String endPoint = "/v1/recipients/" + recipientId + "/accounts/" + recipientAccountId; + final String endPoint = "/v1/recipients/{recipientId}/accounts/{recipientAccountId}".replace("{recipientId}", recipientId).replace("{recipientAccountId}", recipientAccountId); final String response = this.client.patch(endPoint, jsonAccount); return this.recipientAccountFactory(response); } @@ -72,7 +72,7 @@ public boolean delete(final String recipientId, final String recipientAccountId) if (recipientId == null || recipientId.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); } - final String endPoint = "/v1/recipients/" + recipientId + "/accounts/" + recipientAccountId; + final String endPoint = "/v1/recipients/{recipientId}/accounts/{recipientAccountId}".replace("{recipientId}", recipientId).replace("{recipientAccountId}", recipientAccountId); this.client.delete(endPoint); return true; } diff --git a/src/main/java/com/trolley/RecipientGateway.java b/src/main/java/com/trolley/RecipientGateway.java index 4f2ecaa..ee8e4e6 100644 --- a/src/main/java/com/trolley/RecipientGateway.java +++ b/src/main/java/com/trolley/RecipientGateway.java @@ -39,7 +39,7 @@ public Recipient find(final String recipientId) throws Exception { if (recipientId == null || recipientId.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); } - final String endPoint = "/v1/recipients/" + recipientId; + final String endPoint = "/v1/recipients/{recipientId}".replace("{recipientId}", recipientId); final String response = this.client.get(endPoint); return this.recipientFactory(response); } @@ -57,7 +57,7 @@ public Logs getAllLogs(final String recipientId, final int page, final int pageS throw new InvalidFieldException("recipientId cannot be null."); } - final String endPoint = "/v1/recipients/" + recipientId + "/logs?page="+page+"&pageSize="+pageSize; + final String endPoint = "/v1/recipients/{recipientId}/logs".replace("{recipientId}", recipientId) + "?page=" + page + "&pageSize=" + pageSize; final String response = this.client.get(endPoint); return logListFactory(response); } @@ -88,7 +88,7 @@ public List findPayments(final String recipientId) throws Exception { if (recipientId == null || recipientId.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); } - final String endPoint = "/v1/recipients/" + recipientId + "/payments"; + final String endPoint = "/v1/recipients/{recipientId}/payments".replace("{recipientId}", recipientId); final String response = this.client.get(endPoint); final ObjectMapper mapper = new ObjectMapper(); final JsonNode node = mapper.readTree(response); @@ -123,7 +123,7 @@ public boolean update(final String recipientId, final Recipient recipient) throw throw new InvalidFieldException("Recipient object cannot be null or empty"); } final String jsonRecipient = new ObjectMapper().writeValueAsString((Object)recipient); - final String endPoint = "/v1/recipients/" + recipientId; + final String endPoint = "/v1/recipients/{recipientId}".replace("{recipientId}", recipientId); this.client.patch(endPoint, jsonRecipient); return true; } @@ -132,7 +132,7 @@ public boolean delete(final String recipientId) throws Exception { if (recipientId == null || recipientId.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); } - final String endPoint = "/v1/recipients/" + recipientId; + final String endPoint = "/v1/recipients/{recipientId}".replace("{recipientId}", recipientId); this.client.delete(endPoint); return true; } @@ -196,7 +196,7 @@ public OfflinePayments getAllOfflinePayments(final String recipientId, final int throw new InvalidFieldException("searchTerm cannot be null. If you don't wish to provide a searchTerm, pass a blank String."); } - final String endPoint = "/v1/recipients/" + recipientId + "/offlinePayments?search=" + searchTerm + "&page=" + page + "&pageSize=" + pageSize; + final String endPoint = "/v1/recipients/{recipientId}/offlinePayments".replace("{recipientId}", recipientId) + "?search=" + searchTerm + "&page=" + page + "&pageSize=" + pageSize; final String response = this.client.get(endPoint); diff --git a/src/main/java/com/trolley/VerificationGateway.java b/src/main/java/com/trolley/VerificationGateway.java new file mode 100644 index 0000000..3afea80 --- /dev/null +++ b/src/main/java/com/trolley/VerificationGateway.java @@ -0,0 +1,55 @@ +package com.trolley; + +import java.net.URLEncoder; +import java.util.Map; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class VerificationGateway { + Client client; + + public VerificationGateway(final Configuration config) { + this.client = new Client(config); + } + + public String search(final Map filters) throws Exception { + String endpoint = "/v1/verifications"; + if (filters != null && !filters.isEmpty()) { + endpoint += "?" + queryString(filters); + } + return this.client.get(endpoint); + } + + public String all(final Map filters) throws Exception { + return search(filters); + } + + public String expire(final Object body) throws Exception { + final String endpoint = "/v1/verifications/expire"; + return this.client.patch(endpoint, new ObjectMapper().writeValueAsString(body)); + } + + public String trigger(final String verificationType, final Object body) throws Exception { + final String endpoint = "/v1/verifications/{verificationType}/trigger".replace("{verificationType}", verificationType); + return this.client.post(endpoint, new ObjectMapper().writeValueAsString(body)); + } + + public String triggerWatchlist(final Object body) throws Exception { + final String endpoint = "/v1/verifications/watchlist/trigger"; + return this.client.post(endpoint, new ObjectMapper().writeValueAsString(body)); + } + + private String queryString(final Map filters) throws Exception { + StringBuilder builder = new StringBuilder(); + for (Map.Entry entry : filters.entrySet()) { + if (builder.length() > 0) { + builder.append("&"); + } + builder.append(URLEncoder.encode(entry.getKey(), "UTF-8")); + builder.append("="); + builder.append(URLEncoder.encode(String.valueOf(entry.getValue()), "UTF-8")); + } + return builder.toString(); + } +} diff --git a/src/main/java/com/trolley/types/OfflinePayment.java b/src/main/java/com/trolley/types/OfflinePayment.java index 5482b1c..10d6172 100644 --- a/src/main/java/com/trolley/types/OfflinePayment.java +++ b/src/main/java/com/trolley/types/OfflinePayment.java @@ -8,6 +8,7 @@ public class OfflinePayment { private String id; + private String recipientId; private Recipient recipient; private String amount; private String currency; @@ -24,6 +25,8 @@ public class OfflinePayment private String updatedAt; private String createdAt; private String deletedAt; + private String activityCount; + private Boolean taxReportable; public void setEquivalentWithholdingCurrency(final String equivalentWithholdingCurrency) { this.equivalentWithholdingCurrency = equivalentWithholdingCurrency; diff --git a/src/main/java/com/trolley/types/Payment.java b/src/main/java/com/trolley/types/Payment.java index 0348108..91bb983 100644 --- a/src/main/java/com/trolley/types/Payment.java +++ b/src/main/java/com/trolley/types/Payment.java @@ -22,8 +22,10 @@ public class Payment private List tags; private String sourceAmount; private String sourceCurrency; + private String sourceCurrencyName; private String targetAmount; private String targetCurrency; + private String targetCurrencyName; private String exchangeRate; private String fees; private String recipientFees; @@ -63,6 +65,8 @@ public class Payment private String settledAt; private String taxBasisAmount; private String taxBasisCurrency; + private String failureMessage; + private Boolean visibleToRecipient; @JsonInclude(JsonInclude.Include.NON_DEFAULT) private boolean taxReportable; diff --git a/src/main/java/com/trolley/types/RecipientAccount.java b/src/main/java/com/trolley/types/RecipientAccount.java index 32a8882..36c5259 100644 --- a/src/main/java/com/trolley/types/RecipientAccount.java +++ b/src/main/java/com/trolley/types/RecipientAccount.java @@ -31,6 +31,9 @@ public class RecipientAccount private String emailAddress; private String status; private String disabledAt; + private Object cardDetails; + private Object mailing; + private String phoneNumber; public String getEmailAddress() { return this.emailAddress; From 3c3a0211393526a2ff6c980ab3955e3908c3cf12 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 26 May 2026 04:28:19 +0000 Subject: [PATCH 2/2] Bump Java SDK minor version Co-authored-by: barnett --- pom.xml | 2 +- src/main/java/com/trolley/Version.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 9744f28..3fcd0f8 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.trolley java-sdk - 2.1.3 + 2.2.0 Java SDK for Trolley API jar Trolley Java SDK diff --git a/src/main/java/com/trolley/Version.java b/src/main/java/com/trolley/Version.java index 1a023d4..6b95e3a 100644 --- a/src/main/java/com/trolley/Version.java +++ b/src/main/java/com/trolley/Version.java @@ -5,6 +5,6 @@ */ public class Version { public static int MAJOR = 2; - public static int MINOR = 0; + public static int MINOR = 2; public static int PATCH = 0; }