From 4619a508fdacf5e82941eaf1d06db4994d8bec1a Mon Sep 17 00:00:00 2001 From: Joshua Cunningham Date: Tue, 11 Jan 2022 09:59:38 -0500 Subject: [PATCH 1/5] start improvements --- dwa.json | 74 +++++++++++++++++++ .../ca/paymentrails/paymentrails/Batch.java | 21 +++++- .../paymentrails/BatchGateway.java | 15 ++++ .../ca/paymentrails/paymentrails/Client.java | 8 ++ .../paymentrails/integration/BatchTest.java | 57 ++++++++++---- .../integration/RecipientTest.java | 6 +- 6 files changed, 160 insertions(+), 21 deletions(-) create mode 100644 dwa.json diff --git a/dwa.json b/dwa.json new file mode 100644 index 0000000..b7fc383 --- /dev/null +++ b/dwa.json @@ -0,0 +1,74 @@ +{ + "payments": [ + { + "id": null, + "recipient": { + "id": "R-MkUaC9bmzhDNgmmevuz1EH", + "routeType": "sepa", + "estimatedFees": "1.2", + "referenceId": "R-MkUaC9bmzhDNgmmevuz1EH", + "email": "create.recipienta99272ed-22fb-4bd7-8393-fc7856110354@example.com", + "name": "John Smith", + "lastName": "Smith", + "firstName": "John", + "type": "individual", + "taxType": null, + "status": "incomplete", + "language": "en", + "complianceStatus": "pending", + "dob": null, + "passport": "", + "updatedAt": "2022-01-10T21:53:01.560Z", + "createdAt": "2022-01-10T21:53:01.560Z", + "gravatarUrl": "https://www.gravatar.com/avatar/ce45988fb9396e593c7511d477b598d8?d=404", + "governmentId": null, + "ssn": null, + "primaryCurrency": null, + "placeOfBirth": null, + "tags": [], + "merchantId": "M-XQRXUnLPci69U79sTzSAND", + "payoutMethod": null, + "payout": null, + "inactiveReasons": { "primaryAccount": "missing" }, + "compliance": { + "status": "pending", + "checkedAt": null, + "additionalProperties": {} + }, + "accounts": [], + "taxForm": null, + "taxFormStatus": null, + "taxWithholdingPercentage": null + }, + "status": null, + "isSupplyPayment": null, + "returnedAmount": null, + "amount": "15", + "currency": "USD", + "category": null, + "account": null, + "tags": null, + "sourceAmount": null, + "sourceCurrency": null, + "targetAmount": null, + "targetCurrency": null, + "exchangeRate": null, + "fees": null, + "recipientFees": null, + "fxRate": null, + "memo": null, + "externalId": null, + "processedAt": null, + "createdAt": null, + "updatedAt": null, + "merchantFees": null, + "compliance": null, + "payoutMethod": null, + "methodDisplay": null, + "withholdingAmount": null, + "withholdingCurrency": null, + "equivalentWithholdingAmount": null, + "equivalentWithholdingCurrency": null + } + ] +} diff --git a/src/main/java/ca/paymentrails/paymentrails/Batch.java b/src/main/java/ca/paymentrails/paymentrails/Batch.java index f50b375..53a4693 100644 --- a/src/main/java/ca/paymentrails/paymentrails/Batch.java +++ b/src/main/java/ca/paymentrails/paymentrails/Batch.java @@ -2,6 +2,11 @@ import java.util.List; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +@JsonInclude(Include.NON_NULL) public class Batch { private String id; @@ -14,10 +19,10 @@ public class Batch { private Object completedAt; private String createdAt; private String updatedAt; - private Payments payments; + @JsonAnyGetter + private List payments; public String quoteExpiredAt; - public String getId() { return id; } @@ -98,11 +103,15 @@ public void setUpdatedAt(String updatedAt) { this.updatedAt = updatedAt; } - public Payments getPayments() { + public List getPayments() { return payments; } - public void setPayments(Payments payments) { + // public void setPayments(Payments payments) { + // this.payments = payments; + // } + + public void setPayments(List payments) { this.payments = payments; } @@ -159,6 +168,10 @@ public static Batch create(String body) throws Exception { return Configuration.gateway().batch.create(body); } + public static Batch create(Batch body) throws Exception { + return Configuration.gateway().batch.create(body); + } + /** * Generate a quote for a batch * diff --git a/src/main/java/ca/paymentrails/paymentrails/BatchGateway.java b/src/main/java/ca/paymentrails/paymentrails/BatchGateway.java index ede97d2..37c10e6 100644 --- a/src/main/java/ca/paymentrails/paymentrails/BatchGateway.java +++ b/src/main/java/ca/paymentrails/paymentrails/BatchGateway.java @@ -60,6 +60,21 @@ public Batch create(String body) throws Exception { return batchFactory(response); } + public Batch create(Batch batch) throws Exception { + if (batch == null) { + throw new InvalidFieldException("Batch cannot be null."); + } + + String result = new ObjectMapper().writeValueAsString(batch); + + System.out.println("YOOO"); + System.out.println(result); + + String endPoint = "/v1/batches/"; + String response = this.client.post(endPoint, result); + return batchFactory(response); + } + public String generateQuote(String batch_id) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); diff --git a/src/main/java/ca/paymentrails/paymentrails/Client.java b/src/main/java/ca/paymentrails/paymentrails/Client.java index c8b3bd7..b858660 100644 --- a/src/main/java/ca/paymentrails/paymentrails/Client.java +++ b/src/main/java/ca/paymentrails/paymentrails/Client.java @@ -11,6 +11,8 @@ import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; +import com.fasterxml.jackson.databind.ObjectMapper; + import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPatch; @@ -110,6 +112,12 @@ public String post(String endPoint, String body) throws Exception { return sendRequest("POST", endPoint, body); } + // public String post(String endPoint, Object body) throws Exception { + // String result = new ObjectMapper().writeValueAsString(body); + + // return sendRequest("POST", endPoint, result); + // } + /** * Makes an HTTP POST request to the API * diff --git a/src/test/java/ca/paymentrails/paymentrails/integration/BatchTest.java b/src/test/java/ca/paymentrails/paymentrails/integration/BatchTest.java index 1a344b1..8753ca9 100644 --- a/src/test/java/ca/paymentrails/paymentrails/integration/BatchTest.java +++ b/src/test/java/ca/paymentrails/paymentrails/integration/BatchTest.java @@ -4,8 +4,12 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import java.util.ArrayList; +import java.util.List; import java.util.UUID; +// import com.fasterxml.jackson.annotation.JsonCreator; + import org.junit.Test; import org.powermock.core.classloader.annotations.PrepareForTest; @@ -14,13 +18,15 @@ import ca.paymentrails.paymentrails.Configuration; import ca.paymentrails.paymentrails.Gateway; import ca.paymentrails.paymentrails.Payment; +// import ca.paymentrails.paymentrails.Payments; import ca.paymentrails.paymentrails.Recipient; +// import javassist.compiler.ast.Variable; @PrepareForTest(Recipient.class) public class BatchTest { private Recipient createRecipient() throws Exception { - Gateway client = new Gateway(new Configuration("Your-API-KEY", "YOUR-API-SECRET", "production")); + Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); UUID uuid = UUID.randomUUID(); @@ -39,17 +45,29 @@ private Recipient createRecipient() throws Exception { @Test public void testCreate() throws Exception { - Gateway client = new Gateway(new Configuration("Your-API-KEY", "YOUR-API-SECRET", "production")); - + Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); String body = "{\"sourceCurrency\": \"GBP\", \"description\":\"Integration Test Create\"}"; Batch batch = client.batch.create(body); assertEquals(batch.getCurrency(), "GBP"); } + @Test + public void testCreateObject() throws Exception { + Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); + + Batch batchToCreate = new Batch(); + batchToCreate.setCurrency("GBP"); + batchToCreate.setDescription("Integration Test Create"); + + Batch createdBatch = client.batch.create(batchToCreate); + assertEquals(createdBatch.getCurrency(), "GBP"); + assertEquals(createdBatch.getDescription(), "Integration Test Create"); + } + @Test public void testUpdate() throws Exception { - Gateway client = new Gateway(new Configuration("Your-API-KEY", "YOUR-API-SECRET", "production")); + Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); String body = "{\"sourceCurrency\": \"GBP\", \"description\":\"Integration Test Create\"}"; Batch batch = client.batch.create(body); @@ -68,14 +86,27 @@ public void testUpdate() throws Exception { @Test public void testCreateWithPayments() throws Exception { - Gateway client = new Gateway(new Configuration("Your-API-KEY", "YOUR-API-SECRET", "production")); - + Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); Recipient recipientAlpha = createRecipient(); - String body = "{\"payments\": [{\"recipient\": {\"id\": " + "\"" + recipientAlpha.getId() + "\"" - + "},\"amount\": \"10.00\", \"currency\": \"EUR\"}]}"; - Batch batch = client.batch.create(body); + // String body = "{\"payments\": [{\"recipient\": {\"id\": " + "\"" + recipientAlpha.getId() + "\"" + // + "},\"amount\": \"10.00\", \"currency\": \"EUR\"}]}"; + + // String body = "{\"payments\": [{\"recipient\": {\"id\": \"" + recipientAlpha.getId() + "\"}, \"amount\": \"15\", \"memo\": \"Test\", \"currency\": \"USD\"}]}"; + Payment payment = new Payment(); + payment.setAmount("15"); + payment.setCurrency("USD"); + payment.setRecipient(recipientAlpha); + + List payments = new ArrayList(); + payments.add(payment); + + Batch batchToCreate = new Batch(); + batchToCreate.setPayments(payments); + + + Batch batch = client.batch.create(batchToCreate); assertNotNull(batch); assertNotNull(batch.getId()); @@ -83,13 +114,12 @@ public void testCreateWithPayments() throws Exception { Batch batch1 = client.batch.find(batch.getId()); assertNotNull(batch1); - assertEquals(1, batch1.getPayments().getPayments().size()); + assertEquals(1, batch1.getPayments().size()); } @Test public void testPayments() throws Exception { - Gateway client = new Gateway(new Configuration("Your-API-KEY", "YOUR-API-SECRET", "production")); - + Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); String body = "{\"sourceCurrency\": \"GBP\", \"description\":\"Integration Test Create\"}"; Batch batch = client.batch.create(body); @@ -110,8 +140,7 @@ public void testPayments() throws Exception { @Test public void testProcessing() throws Exception { - Gateway client = new Gateway(new Configuration("Your-API-KEY", "YOUR-API-SECRET", "production")); - + Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); Recipient recipientAlpha = createRecipient(); diff --git a/src/test/java/ca/paymentrails/paymentrails/integration/RecipientTest.java b/src/test/java/ca/paymentrails/paymentrails/integration/RecipientTest.java index 67d702f..7e54876 100644 --- a/src/test/java/ca/paymentrails/paymentrails/integration/RecipientTest.java +++ b/src/test/java/ca/paymentrails/paymentrails/integration/RecipientTest.java @@ -20,7 +20,7 @@ public class RecipientTest { @Test public void testCreateRecipient() throws Exception { - Gateway client = new Gateway(new Configuration("YOUR-API-KEY", "YOUR-API-KEY", "production")); + Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); UUID uuid = UUID.randomUUID(); @@ -36,7 +36,7 @@ public void testCreateRecipient() throws Exception { @Test public void testLifecycle() throws Exception { - Gateway client = new Gateway(new Configuration("YOUR-API-KEY", "YOUR-API-KEY", "production")); + Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); UUID uuid = UUID.randomUUID(); @@ -64,7 +64,7 @@ public void testLifecycle() throws Exception { @Test public void testAccount() throws Exception { - Gateway client = new Gateway(new Configuration("YOUR-API-KEY", "YOUR-API-KEY", "production")); + Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); UUID uuid = UUID.randomUUID(); From a65648640ef2c529a19b54ba4b5ec6b232c72673 Mon Sep 17 00:00:00 2001 From: Joshua Cunningham Date: Tue, 11 Jan 2022 17:38:24 -0500 Subject: [PATCH 2/5] generally support create/update with object --- dwa.json | 74 ------------------- .../ca/paymentrails/paymentrails/Batch.java | 9 +-- .../paymentrails/BatchGateway.java | 37 ++++++++-- .../ca/paymentrails/paymentrails/Client.java | 2 - .../ca/paymentrails/paymentrails/Payment.java | 19 +++++ .../paymentrails/paymentrails/Recipient.java | 7 ++ .../paymentrails/RecipientAccount.java | 3 + .../paymentrails/RecipientAccountGateway.java | 30 ++++++++ .../paymentrails/RecipientGateway.java | 27 +++++++ .../paymentrails/integration/BatchTest.java | 52 +++++++++---- .../integration/RecipientTest.java | 72 +++++++++++++++++- 11 files changed, 224 insertions(+), 108 deletions(-) delete mode 100644 dwa.json diff --git a/dwa.json b/dwa.json deleted file mode 100644 index b7fc383..0000000 --- a/dwa.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "payments": [ - { - "id": null, - "recipient": { - "id": "R-MkUaC9bmzhDNgmmevuz1EH", - "routeType": "sepa", - "estimatedFees": "1.2", - "referenceId": "R-MkUaC9bmzhDNgmmevuz1EH", - "email": "create.recipienta99272ed-22fb-4bd7-8393-fc7856110354@example.com", - "name": "John Smith", - "lastName": "Smith", - "firstName": "John", - "type": "individual", - "taxType": null, - "status": "incomplete", - "language": "en", - "complianceStatus": "pending", - "dob": null, - "passport": "", - "updatedAt": "2022-01-10T21:53:01.560Z", - "createdAt": "2022-01-10T21:53:01.560Z", - "gravatarUrl": "https://www.gravatar.com/avatar/ce45988fb9396e593c7511d477b598d8?d=404", - "governmentId": null, - "ssn": null, - "primaryCurrency": null, - "placeOfBirth": null, - "tags": [], - "merchantId": "M-XQRXUnLPci69U79sTzSAND", - "payoutMethod": null, - "payout": null, - "inactiveReasons": { "primaryAccount": "missing" }, - "compliance": { - "status": "pending", - "checkedAt": null, - "additionalProperties": {} - }, - "accounts": [], - "taxForm": null, - "taxFormStatus": null, - "taxWithholdingPercentage": null - }, - "status": null, - "isSupplyPayment": null, - "returnedAmount": null, - "amount": "15", - "currency": "USD", - "category": null, - "account": null, - "tags": null, - "sourceAmount": null, - "sourceCurrency": null, - "targetAmount": null, - "targetCurrency": null, - "exchangeRate": null, - "fees": null, - "recipientFees": null, - "fxRate": null, - "memo": null, - "externalId": null, - "processedAt": null, - "createdAt": null, - "updatedAt": null, - "merchantFees": null, - "compliance": null, - "payoutMethod": null, - "methodDisplay": null, - "withholdingAmount": null, - "withholdingCurrency": null, - "equivalentWithholdingAmount": null, - "equivalentWithholdingCurrency": null - } - ] -} diff --git a/src/main/java/ca/paymentrails/paymentrails/Batch.java b/src/main/java/ca/paymentrails/paymentrails/Batch.java index 53a4693..272571e 100644 --- a/src/main/java/ca/paymentrails/paymentrails/Batch.java +++ b/src/main/java/ca/paymentrails/paymentrails/Batch.java @@ -1,8 +1,6 @@ package ca.paymentrails.paymentrails; import java.util.List; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -19,8 +17,9 @@ public class Batch { private Object completedAt; private String createdAt; private String updatedAt; - @JsonAnyGetter + private List payments; + public String quoteExpiredAt; public String getId() { @@ -107,10 +106,6 @@ public List getPayments() { return payments; } - // public void setPayments(Payments payments) { - // this.payments = payments; - // } - public void setPayments(List payments) { this.payments = payments; } diff --git a/src/main/java/ca/paymentrails/paymentrails/BatchGateway.java b/src/main/java/ca/paymentrails/paymentrails/BatchGateway.java index 37c10e6..8bd3bfb 100644 --- a/src/main/java/ca/paymentrails/paymentrails/BatchGateway.java +++ b/src/main/java/ca/paymentrails/paymentrails/BatchGateway.java @@ -3,7 +3,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; - import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -40,6 +39,22 @@ public boolean update(String batch_id, String body) throws Exception { return true; } + public boolean update(String batch_id, Batch batch) throws Exception { + if (batch_id == null || batch_id.isEmpty()) { + throw new InvalidFieldException("Batch id cannot be null or empty."); + } + if (batch == null) { + throw new InvalidFieldException("Body cannot be null or empty."); + } + + String jsonBatch = new ObjectMapper().writeValueAsString(batch); + + String endPoint = "/v1/batches/" + batch_id; + this.client.patch(endPoint, jsonBatch); + + return true; + } + public boolean delete(String batch_id) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); @@ -66,12 +81,9 @@ public Batch create(Batch batch) throws Exception { } String result = new ObjectMapper().writeValueAsString(batch); - - System.out.println("YOOO"); - System.out.println(result); - String endPoint = "/v1/batches/"; String response = this.client.post(endPoint, result); + return batchFactory(response); } @@ -139,8 +151,23 @@ public BatchSummary summary(String batch_id) throws Exception { private Batch batchFactory(String data) throws IOException { ObjectMapper mapper = new ObjectMapper(); JsonNode node = mapper.readTree(data); + + mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + Object payments = mapper.readValue(node.get("batch").get("payments").get("payments").traverse(), Object.class); + + @SuppressWarnings("unchecked") + List castPayments = (List) payments; + List paymentList = new ArrayList(); + + for (int i = 0; i < castPayments.size(); i++) { + Payment payment = mapper.convertValue(castPayments.get(i), Payment.class); + paymentList.add(payment); + } + Batch batch = mapper.readValue(node.get("batch").traverse(), Batch.class); + batch.setPayments(paymentList); return batch; } diff --git a/src/main/java/ca/paymentrails/paymentrails/Client.java b/src/main/java/ca/paymentrails/paymentrails/Client.java index b858660..2175533 100644 --- a/src/main/java/ca/paymentrails/paymentrails/Client.java +++ b/src/main/java/ca/paymentrails/paymentrails/Client.java @@ -11,8 +11,6 @@ import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; -import com.fasterxml.jackson.databind.ObjectMapper; - import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPatch; diff --git a/src/main/java/ca/paymentrails/paymentrails/Payment.java b/src/main/java/ca/paymentrails/paymentrails/Payment.java index f6ba890..ff49036 100644 --- a/src/main/java/ca/paymentrails/paymentrails/Payment.java +++ b/src/main/java/ca/paymentrails/paymentrails/Payment.java @@ -1,7 +1,10 @@ package ca.paymentrails.paymentrails; import java.util.List; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +@JsonInclude(Include.NON_NULL) public class Payment { private String id; @@ -408,3 +411,19 @@ public static List query(String batch_id, int page, int pageSize) throw return query(batch_id, page, pageSize, ""); } } + +// class PaymentSerializer extends JsonSerializer> { + +// @Override +// public void serialize(List value, JsonGenerator jgen, +// SerializerProvider provider) throws IOException { +// jgen.writeStartArray(); +// for (Payment payment : value) { +// jgen.writeStartObject(); +// jgen.writeObjectField("payment", payment); +// jgen.writeEndObject(); +// } +// jgen.writeEndArray(); +// } + +// } \ No newline at end of file diff --git a/src/main/java/ca/paymentrails/paymentrails/Recipient.java b/src/main/java/ca/paymentrails/paymentrails/Recipient.java index 1bdc025..d8c6fcb 100644 --- a/src/main/java/ca/paymentrails/paymentrails/Recipient.java +++ b/src/main/java/ca/paymentrails/paymentrails/Recipient.java @@ -1,7 +1,10 @@ package ca.paymentrails.paymentrails; import java.util.List; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +@JsonInclude(Include.NON_NULL) public class Recipient { String id; @@ -93,6 +96,10 @@ public void setAddress(Address address) { this.address = address; } + public Address getAddress() { + return address; + } + public Compliance getCompliance() { return compliance; } diff --git a/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java b/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java index e9147f3..709a28c 100644 --- a/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java +++ b/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java @@ -1,7 +1,10 @@ package ca.paymentrails.paymentrails; import java.util.List; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include;; +@JsonInclude(Include.NON_NULL) public class RecipientAccount { String type; diff --git a/src/main/java/ca/paymentrails/paymentrails/RecipientAccountGateway.java b/src/main/java/ca/paymentrails/paymentrails/RecipientAccountGateway.java index 593ccb3..f6c3ed1 100644 --- a/src/main/java/ca/paymentrails/paymentrails/RecipientAccountGateway.java +++ b/src/main/java/ca/paymentrails/paymentrails/RecipientAccountGateway.java @@ -49,6 +49,21 @@ public RecipientAccount create(String recipient_id, String body) throws Exceptio return recipientAccountFactory(response); } + public RecipientAccount create(String recipient_id, RecipientAccount account) throws Exception { + if (recipient_id == null || recipient_id.isEmpty()) { + throw new InvalidFieldException("Recipient id cannot be null or empty."); + } + if (account == null) { + throw new InvalidFieldException("Body cannot be null or empty"); + } + + String jsonAccount = new ObjectMapper().writeValueAsString(account); + + String endPoint = "/v1/recipients/" + recipient_id + "/accounts"; + String response = this.client.post(endPoint, jsonAccount); + return recipientAccountFactory(response); + } + public RecipientAccount update(String recipient_id, String recipient_account_id, String body) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); @@ -62,6 +77,21 @@ public RecipientAccount update(String recipient_id, String recipient_account_id, return recipientAccountFactory(response); } + public RecipientAccount update(String recipient_id, String recipient_account_id, RecipientAccount account) throws Exception { + if (recipient_id == null || recipient_id.isEmpty()) { + throw new InvalidFieldException("Recipient id cannot be null or empty."); + } + if (account == null) { + throw new InvalidFieldException("Body cannot be null or empty"); + } + + String jsonAccount = new ObjectMapper().writeValueAsString(account); + + String endPoint = "/v1/recipients/" + recipient_id + "/accounts/" + recipient_account_id; + String response = this.client.patch(endPoint, jsonAccount); + return recipientAccountFactory(response); + } + public boolean delete(String recipient_id, String recipient_account_id) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); diff --git a/src/main/java/ca/paymentrails/paymentrails/RecipientGateway.java b/src/main/java/ca/paymentrails/paymentrails/RecipientGateway.java index 0ded248..fa655ff 100644 --- a/src/main/java/ca/paymentrails/paymentrails/RecipientGateway.java +++ b/src/main/java/ca/paymentrails/paymentrails/RecipientGateway.java @@ -59,6 +59,18 @@ public Recipient create(String body) throws Exception { return recipientFactory(response); } + public Recipient create(Recipient recipient) throws Exception { + if (recipient == null) { + throw new InvalidFieldException("Body cannot be null or empty"); + } + + String jsonRecipient = new ObjectMapper().writeValueAsString(recipient); + + String endPoint = "/v1/recipients/"; + String response = this.client.post(endPoint, jsonRecipient); + return recipientFactory(response); + } + public boolean update(String recipient_id, String body) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); @@ -72,6 +84,21 @@ public boolean update(String recipient_id, String body) throws Exception { return true; } + public boolean update(String recipient_id, Recipient recipient) throws Exception { + if (recipient_id == null || recipient_id.isEmpty()) { + throw new InvalidFieldException("Recipient id cannot be null or empty."); + } + if (recipient == null) { + throw new InvalidFieldException("Body cannot be null or empty"); + } + + String jsonRecipient = new ObjectMapper().writeValueAsString(recipient); + + String endPoint = "/v1/recipients/" + recipient_id; + this.client.patch(endPoint, jsonRecipient); + return true; + } + public boolean delete(String recipient_id) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); diff --git a/src/test/java/ca/paymentrails/paymentrails/integration/BatchTest.java b/src/test/java/ca/paymentrails/paymentrails/integration/BatchTest.java index 8753ca9..07aa14a 100644 --- a/src/test/java/ca/paymentrails/paymentrails/integration/BatchTest.java +++ b/src/test/java/ca/paymentrails/paymentrails/integration/BatchTest.java @@ -8,8 +8,6 @@ import java.util.List; import java.util.UUID; -// import com.fasterxml.jackson.annotation.JsonCreator; - import org.junit.Test; import org.powermock.core.classloader.annotations.PrepareForTest; @@ -18,9 +16,8 @@ import ca.paymentrails.paymentrails.Configuration; import ca.paymentrails.paymentrails.Gateway; import ca.paymentrails.paymentrails.Payment; -// import ca.paymentrails.paymentrails.Payments; +import ca.paymentrails.paymentrails.Payments; import ca.paymentrails.paymentrails.Recipient; -// import javassist.compiler.ast.Variable; @PrepareForTest(Recipient.class) public class BatchTest { @@ -63,6 +60,9 @@ public void testCreateObject() throws Exception { Batch createdBatch = client.batch.create(batchToCreate); assertEquals(createdBatch.getCurrency(), "GBP"); assertEquals(createdBatch.getDescription(), "Integration Test Create"); + + client.batch.delete(createdBatch.getId()); + } @Test @@ -85,36 +85,56 @@ public void testUpdate() throws Exception { } @Test - public void testCreateWithPayments() throws Exception { + public void testUpdateObject() throws Exception { Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); - Recipient recipientAlpha = createRecipient(); + String body = "{\"sourceCurrency\": \"GBP\", \"description\":\"Integration Test Create\"}"; + + Batch batch = client.batch.create(body); + assertEquals(batch.getCurrency(), "GBP"); + + Batch updatedBatch = new Batch(); + updatedBatch.setDescription("Integration Update Object"); + boolean response = client.batch.update(batch.getId(), updatedBatch); - // String body = "{\"payments\": [{\"recipient\": {\"id\": " + "\"" + recipientAlpha.getId() + "\"" - // + "},\"amount\": \"10.00\", \"currency\": \"EUR\"}]}"; + assertNotNull(response); + Batch batch1 = client.batch.find(batch.getId()); + assertEquals(batch1.getDescription(), "Integration Update Object"); - // String body = "{\"payments\": [{\"recipient\": {\"id\": \"" + recipientAlpha.getId() + "\"}, \"amount\": \"15\", \"memo\": \"Test\", \"currency\": \"USD\"}]}"; + response = client.batch.delete(batch1.getId()); + assertNotNull(response); + } + + @Test + public void testCreateWithPayments() throws Exception { + Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); + Recipient recipientAlpha = createRecipient(); Payment payment = new Payment(); + payment.setAmount("15"); payment.setCurrency("USD"); payment.setRecipient(recipientAlpha); - List payments = new ArrayList(); - payments.add(payment); + List paymentList = new ArrayList(); + paymentList.add(payment); - Batch batchToCreate = new Batch(); - batchToCreate.setPayments(payments); + Payments payments = new Payments(); + payments.setPayments(paymentList); + Batch batchToCreate = new Batch(); + batchToCreate.setPayments(paymentList); Batch batch = client.batch.create(batchToCreate); assertNotNull(batch); assertNotNull(batch.getId()); - Batch batch1 = client.batch.find(batch.getId()); - assertNotNull(batch1); + List batchPayments = batch.getPayments(); + assertEquals(1, batchPayments.size()); + + assertEquals("15.00", batchPayments.get(0).getAmount()); + assertEquals("USD", batchPayments.get(0).getCurrency()); - assertEquals(1, batch1.getPayments().size()); } @Test diff --git a/src/test/java/ca/paymentrails/paymentrails/integration/RecipientTest.java b/src/test/java/ca/paymentrails/paymentrails/integration/RecipientTest.java index 7e54876..a8bb357 100644 --- a/src/test/java/ca/paymentrails/paymentrails/integration/RecipientTest.java +++ b/src/test/java/ca/paymentrails/paymentrails/integration/RecipientTest.java @@ -7,6 +7,7 @@ import org.junit.Test; import org.powermock.core.classloader.annotations.PrepareForTest; +import ca.paymentrails.paymentrails.Address; import ca.paymentrails.paymentrails.Configuration; import ca.paymentrails.paymentrails.Recipient; import ca.paymentrails.paymentrails.RecipientAccount; @@ -34,6 +35,35 @@ public void testCreateRecipient() throws Exception { assertNotNull(recipient.getId()); } + @Test + public void testCreateRecipientObject() throws Exception { + Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); + + UUID uuid = UUID.randomUUID(); + + Recipient createdRecipient = new Recipient(); + Address createdRecipientAddress = new Address(); + + createdRecipient.setType("individual"); + createdRecipient.setFirstName("Tom"); + createdRecipient.setLastName("Jones"); + createdRecipient.setEmail("test.create" + uuid.toString() + "@example.com"); + + createdRecipientAddress.setStreet1("123 Main St"); + createdRecipientAddress.setCity("San Francissco"); + createdRecipientAddress.setRegion("CA"); + createdRecipientAddress.setPostalCode("94131"); + createdRecipientAddress.setCountry("US"); + createdRecipientAddress.setPhone("18005551212"); + createdRecipient.setAddress(createdRecipientAddress); + + Recipient recipient = client.recipient.create(createdRecipient); + assertEquals(recipient.getFirstName(), "Tom"); + assertEquals(recipient.getLastName(), "Jones"); + assertEquals(recipient.getEmail(), "test.create" + uuid.toString() + "@example.com"); + assertNotNull(recipient.getId()); + } + @Test public void testLifecycle() throws Exception { Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); @@ -48,12 +78,14 @@ public void testLifecycle() throws Exception { assertEquals(recipient.getEmail(), "test.create" + uuid.toString() + "@example.com"); assertNotNull(recipient.getId()); - body = "{\"firstName\": \"Bob\"}"; - boolean response = client.recipient.update(recipient.getId(), body); + Recipient recipientUpdate = new Recipient(); + recipientUpdate.setFirstName("Bob"); + boolean response = client.recipient.update(recipient.getId(), recipientUpdate); assertNotNull(response); - Recipient anotheRecipient = client.recipient.find(recipient.getId()); - assertEquals(anotheRecipient.getFirstName(), "Bob"); + Recipient updatedRecipient = client.recipient.find(recipient.getId()); + assertEquals(updatedRecipient.getFirstName(), "Bob"); + assertEquals(updatedRecipient.getLastName(), "Jones"); response = client.recipient.delete(recipient.getId()); assertNotNull(response); @@ -97,4 +129,36 @@ public void testAccount() throws Exception { assertEquals(1, recipientAccounts1.size()); } + @Test + public void testAccountObject() throws Exception { + Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); + + UUID uuid = UUID.randomUUID(); + + String body = "{\"type\": \"individual\",\"firstName\": \"Tom\",\"lastName\": \"Jones\",\"email\": \"account.create" + + uuid.toString() + "@example.com\"}"; + Recipient recipient = client.recipient.create(body); + assertEquals(recipient.getFirstName(), "Tom"); + assertEquals(recipient.getLastName(), "Jones"); + assertEquals(recipient.getEmail(), "account.create" + uuid.toString() + "@example.com"); + assertNotNull(recipient.getId()); + + RecipientAccount createdAccount = new RecipientAccount(); + createdAccount.setType("bank-transfer"); + createdAccount.setPrimary(true); + createdAccount.setCountry("DE"); + createdAccount.setCurrency("EUR"); + createdAccount.setIban("DE89 3704 0044 0532 0130 00"); + createdAccount.setAccountHolderName("Tom Jones"); + + RecipientAccount recipientAccount = client.recipientAccount.create(recipient.getId(), createdAccount); + assertEquals("Tom Jones", recipientAccount.getAccountHolderName()); + + RecipientAccount recipAccount = client.recipientAccount.find(recipient.getId(), recipientAccount.getId()); + assertEquals(recipAccount.getCountry(), recipientAccount.getCountry()); + + List recipientAccounts1 = client.recipientAccount.findAll(recipient.getId()); + assertEquals(1, recipientAccounts1.size()); + } + } \ No newline at end of file From f7462003784e9e5b93a17001f5a200878e05bc8d Mon Sep 17 00:00:00 2001 From: Joshua Cunningham Date: Thu, 13 Jan 2022 12:44:43 -0500 Subject: [PATCH 3/5] added stuff to POM, renaming --- .gitignore | 2 +- README.md | 10 +- docs/classes/batchgateway.md | 112 +++++++++--------- docs/classes/configuration.md | 30 ++--- docs/classes/gateway.md | 38 +++--- docs/classes/paymentgateway.md | 76 ++++++------ docs/classes/recipientaccountgateway.md | 73 ++++++------ docs/classes/recipientgateway.md | 66 +++++------ docs/types/batch.md | 12 +- docs/types/configurationparams.md | 14 +-- docs/types/payment.md | 30 ++--- docs/types/recipient.md | 56 ++++----- docs/types/recipientaccount.md | 81 ++++++------- pom.xml | 95 ++++++++++++--- .../Exceptions/AuthenticationException.java | 2 +- .../Exceptions/AuthorizationException.java | 2 +- .../DownForMaintenanceException.java | 2 +- .../Exceptions/InvalidFieldException.java | 2 +- .../InvalidServerConnectionException.java | 2 +- .../InvalidStatusCodeException.java | 2 +- .../Exceptions/MalformedException.java | 2 +- .../Exceptions/NotFoundException.java | 2 +- .../Exceptions/TooManyRequestsException.java | 2 +- .../Exceptions/UnexpectedException.java | 2 +- .../trolley/trolley}/Address.java | 2 +- .../trolley/trolley}/Balances.java | 16 +-- .../trolley/trolley}/BalancesGateway.java | 4 +- .../trolley/trolley}/BankTransfer.java | 2 +- .../trolley/trolley}/Batch.java | 68 +++++------ .../trolley/trolley}/BatchGateway.java | 5 +- .../trolley/trolley}/BatchSummary.java | 2 +- .../trolley/trolley}/CAD.java | 2 +- .../trolley/trolley}/Client.java | 14 +-- .../trolley/trolley}/Compliance.java | 2 +- .../trolley/trolley}/Configuration.java | 2 +- .../trolley/trolley}/Detail.java | 2 +- .../trolley/trolley}/EUR.java | 2 +- .../trolley/trolley}/Gateway.java | 2 +- .../trolley/trolley}/Meta.java | 2 +- .../trolley/trolley}/Payment.java | 50 ++++---- .../trolley/trolley}/PaymentGateway.java | 5 +- .../trolley/trolley}/Payments.java | 2 +- .../trolley/trolley}/Recipient.java | 44 +++---- .../trolley/trolley}/RecipientAccount.java | 2 +- .../trolley}/RecipientAccountGateway.java | 5 +- .../trolley/trolley}/RecipientGateway.java | 5 +- .../trolley/trolley}/Total.java | 2 +- .../trolley/trolley}/USD.java | 2 +- .../trolley/sdk}/integration/BatchTest.java | 18 +-- .../sdk}/integration/RecipientTest.java | 14 +-- 50 files changed, 529 insertions(+), 462 deletions(-) rename src/main/java/{ca/paymentrails => com/trolley}/Exceptions/AuthenticationException.java (85%) rename src/main/java/{ca/paymentrails => com/trolley}/Exceptions/AuthorizationException.java (85%) rename src/main/java/{ca/paymentrails => com/trolley}/Exceptions/DownForMaintenanceException.java (85%) rename src/main/java/{ca/paymentrails => com/trolley}/Exceptions/InvalidFieldException.java (80%) rename src/main/java/{ca/paymentrails => com/trolley}/Exceptions/InvalidServerConnectionException.java (86%) rename src/main/java/{ca/paymentrails => com/trolley}/Exceptions/InvalidStatusCodeException.java (85%) rename src/main/java/{ca/paymentrails => com/trolley}/Exceptions/MalformedException.java (84%) rename src/main/java/{ca/paymentrails => com/trolley}/Exceptions/NotFoundException.java (84%) rename src/main/java/{ca/paymentrails => com/trolley}/Exceptions/TooManyRequestsException.java (85%) rename src/main/java/{ca/paymentrails => com/trolley}/Exceptions/UnexpectedException.java (84%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/Address.java (97%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/Balances.java (63%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/BalancesGateway.java (82%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/BankTransfer.java (82%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/Batch.java (70%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/BatchGateway.java (98%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/BatchSummary.java (68%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/CAD.java (96%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/Client.java (95%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/Compliance.java (95%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/Configuration.java (98%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/Detail.java (80%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/EUR.java (97%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/Gateway.java (94%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/Meta.java (93%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/Payment.java (85%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/PaymentGateway.java (97%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/Payments.java (91%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/Recipient.java (86%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/RecipientAccount.java (99%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/RecipientAccountGateway.java (98%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/RecipientGateway.java (98%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/Total.java (82%) rename src/main/java/{ca/paymentrails/paymentrails => com/trolley/trolley}/USD.java (96%) rename src/test/java/{ca/paymentrails/paymentrails => com/trolley/sdk}/integration/BatchTest.java (94%) rename src/test/java/{ca/paymentrails/paymentrails => com/trolley/sdk}/integration/RecipientTest.java (96%) diff --git a/.gitignore b/.gitignore index 8753aeb..70088b5 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,4 @@ nbproject .project .vscode .vscode/* -src/main/java/ca/paymentrails/paymentrails/index.java \ No newline at end of file +src/main/java/com/trolley/trolley/index.java \ No newline at end of file diff --git a/README.md b/README.md index 35715ba..96dd4aa 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,8 @@ Add this dependency to your project's POM: ```xml - ca.paymentrails - paymentrails + com.trolley + java-sdk 1.0.1 ``` @@ -29,8 +29,8 @@ The library is hosted at [insert github link] ## Getting Started ```java -import ca.paymentrails.paymentrails.*; -import ca.paymentrails.Exceptions.*; +import com.trolley.java-sdk.*; +import com.trolley.Exceptions.*; public class PaymentRailsExample { public static void main(String[] args) { @@ -49,7 +49,7 @@ public class PaymentRailsExample { ### Usage -Methods should all have Java Doc comments to help you understand their usage. As mentioned the [full API documentation](http://docs.paymentrails.com) +Methods should all have Java Doc comments to help you understand their usage. As mentioned the [full API documentation](http://docs.trolley.com) is the best source of information about the API. For more information please read the [Java API docs](https://github.com/PaymentRails/paymentrails_dotnet/tree/master/docs/) is available. The best starting point is: diff --git a/docs/classes/batchgateway.md b/docs/classes/batchgateway.md index d9f968a..e810dc2 100644 --- a/docs/classes/batchgateway.md +++ b/docs/classes/batchgateway.md @@ -3,21 +3,21 @@ # Class: BatchGateway Gateway class for batches -*__class__*: BatchGateway +_**class**_: BatchGateway ## Index ### Methods -* [create](BatchGateway.md#create) -* [find](BatchGateway.md#find) -* [generateQuote](BatchGateway.md#generatequote) -* [paymentList](BatchGateway.md#paymentlist) -* [delete](BatchGateway.md#delete) -* [search](BatchGateway.md#search) -* [processBatch](BatchGateway.md#processBatch) -* [summary](BatchGateway.md#summary) -* [update](BatchGateway.md#update) +- [create](BatchGateway.md#create) +- [find](BatchGateway.md#find) +- [generateQuote](BatchGateway.md#generatequote) +- [paymentList](BatchGateway.md#paymentlist) +- [delete](BatchGateway.md#delete) +- [search](BatchGateway.md#search) +- [processBatch](BatchGateway.md#processBatch) +- [summary](BatchGateway.md#summary) +- [update](BatchGateway.md#update) --- @@ -27,19 +27,19 @@ Gateway class for batches ### create -► **create**(batch: *`Batch`*): `Batch` +► **create**(batch: _`Batch`_): `Batch` -*Defined in [BatchGateway.java:95](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/BatchGateway.java#L95)* +_Defined in [BatchGateway.java:95](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/BatchGateway.java#L95)_ -Creates a batch with optional payments. This is the interface that is provide by the [Create Batch](http://docs.paymentrails.com/api/#create-a-batch) API +Creates a batch with optional payments. This is the interface that is provide by the [Create Batch](http://docs.trolley.com/api/#create-a-batch) API Batch batch = client.batch.create("{\"sourceCurrency\": \"USD\", \"description\":\"Docs Create\"}"); **Parameters:** -| Param | Type | Description | -| ------ | ------ | ------ | -| batch | `Batch` | - | +| Param | Type | Description | +| ----- | ------- | ----------- | +| batch | `Batch` | - | **Returns:** `Batch` @@ -49,9 +49,9 @@ Creates a batch with optional payments. This is the interface that is provide by ### find -► **find**(batchId: *`string`*): `Batch` +► **find**(batchId: _`string`_): `Batch` -*Defined in [BatchGateway.java:67](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/BatchGateway.java#L67)* +_Defined in [BatchGateway.java:67](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/BatchGateway.java#L67)_ Retrieves a batch based on the batch id @@ -59,9 +59,9 @@ Retrieves a batch based on the batch id **Parameters:** -| Param | Type | Description | -| ------ | ------ | ------ | -| batchId | `string` | Payment Rails batch id (e.g. "B-xx999bb") | +| Param | Type | Description | +| ------- | -------- | ----------------------------------------- | +| batchId | `string` | Payment Rails batch id (e.g. "B-xx999bb") | **Returns:** `Batch` @@ -71,17 +71,17 @@ Retrieves a batch based on the batch id ### generateQuote -► **generateQuote**(batchId: *`string`*): `Batch` +► **generateQuote**(batchId: _`string`_): `Batch` -*Defined in [BatchGateway.java:182](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/BatchGateway.java#L182)* +_Defined in [BatchGateway.java:182](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/BatchGateway.java#L182)_ Generate a FX quote for this batch **Parameters:** -| Param | Type | Description | -| ------ | ------ | ------ | -| batchId | `string` | Payment Rails payment id (e.g. "B-xx999bb") | +| Param | Type | Description | +| ------- | -------- | ------------------------------------------- | +| batchId | `string` | Payment Rails payment id (e.g. "B-xx999bb") | **Returns:** `Batch` @@ -91,19 +91,19 @@ Generate a FX quote for this batch ### paymentList -► **paymentList**(batchId: *`string`*, page?: *`number`*, pageSize?: *`number`*): `Payment`[] +► **paymentList**(batchId: _`string`_, page?: _`number`_, pageSize?: _`number`_): `Payment`[] -*Defined in [BatchGateway.java:166](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/BatchGateway.java#L166)* +_Defined in [BatchGateway.java:166](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/BatchGateway.java#L166)_ Return a paginated list of payments for this batch **Parameters:** -| Param | Type | Default value | Description | -| ------ | ------ | ------ | ------ | -| batchId | `string` | - | Payment Rails payment id (e.g. "B-xx999bb") | -| page | `number` | 1 | starting a 1 | -| pageSize | `number` | 10 | in the range 0...1000 | +| Param | Type | Default value | Description | +| -------- | -------- | ------------- | ------------------------------------------- | +| batchId | `string` | - | Payment Rails payment id (e.g. "B-xx999bb") | +| page | `number` | 1 | starting a 1 | +| pageSize | `number` | 10 | in the range 0...1000 | **Returns:** `Payment`[] @@ -113,9 +113,9 @@ Return a paginated list of payments for this batch ### delete -► **delete**(batchId: *`string`*): `Boolean` +► **delete**(batchId: _`string`_): `Boolean` -*Defined in [BatchGateway.java:132](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/BatchGateway.java#L132)* +_Defined in [BatchGateway.java:132](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/BatchGateway.java#L132)_ Delete the given batch @@ -123,9 +123,9 @@ Delete the given batch **Parameters:** -| Param | Type | Description | -| ------ | ------ | ------ | -| batchId | `string` | Payment Rails batch (e.g. "B-xx999bb") | +| Param | Type | Description | +| ------- | -------- | -------------------------------------- | +| batchId | `string` | Payment Rails batch (e.g. "B-xx999bb") | **Returns:** `Boolean` @@ -135,19 +135,19 @@ Delete the given batch ### search -► **search**(page?: *`number`*, pageSize?: *`number`*, term?: *`string`*): `Batch`[] +► **search**(page?: _`number`_, pageSize?: _`number`_, term?: _`string`_): `Batch`[] -*Defined in [BatchGateway.java:146](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/BatchGateway.java#L146)* +_Defined in [BatchGateway.java:146](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/BatchGateway.java#L146)_ Search for a batch matching the given term **Parameters:** -| Param | Type | Default value | Description | -| ------ | ------ | ------ | ------ | -| page | `number` | 1 | - | -| pageSize | `number` | 10 | - | -| term | `string` | "" | string search term | +| Param | Type | Default value | Description | +| -------- | -------- | ------------- | ------------------ | +| page | `number` | 1 | - | +| pageSize | `number` | 10 | - | +| term | `string` | "" | string search term | **Returns:** `Batch`[] @@ -157,17 +157,17 @@ Search for a batch matching the given term ### processBatch -► **processBatch**(batchId: *`string`*): `Batch` +► **processBatch**(batchId: _`string`_): `Batch` -*Defined in [BatchGateway.java:194](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/BatchGateway.java#L194)* +_Defined in [BatchGateway.java:194](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/BatchGateway.java#L194)_ Start processing this batch **Parameters:** -| Param | Type | Description | -| ------ | ------ | ------ | -| batchId | `string` | Payment Rails batch id (e.g. "B-xx999bb") | +| Param | Type | Description | +| ------- | -------- | ----------------------------------------- | +| batchId | `string` | Payment Rails batch id (e.g. "B-xx999bb") | **Returns:** `Batch` @@ -177,9 +177,9 @@ Start processing this batch ### summary -► **summary**(batchId: *`string`*): `String` +► **summary**(batchId: _`string`_): `String` -*Defined in [BatchGateway.java:206](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/BatchGateway.java#L206)* +_Defined in [BatchGateway.java:206](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/BatchGateway.java#L206)_ Get a transaction totaled summary for this batch @@ -187,10 +187,10 @@ Get a transaction totaled summary for this batch **Parameters:** -| Param | Type | Description | -| ------ | ------ | ------ | -| batchId | `string` | Payment Rails payment id (e.g. "B-xx999bb") | +| Param | Type | Description | +| ------- | -------- | ------------------------------------------- | +| batchId | `string` | Payment Rails payment id (e.g. "B-xx999bb") | **Returns:** `String` ---- \ No newline at end of file +--- diff --git a/docs/classes/configuration.md b/docs/classes/configuration.md index 42b475d..5a6d110 100644 --- a/docs/classes/configuration.md +++ b/docs/classes/configuration.md @@ -6,9 +6,9 @@ ### Properties -* [apiBase](Configuration.md#apibase) -* [apiKey](Configuration.md#apikey) -* [apiSecret](Configuration.md#apisecret) +- [apiBase](Configuration.md#apibase) +- [apiKey](Configuration.md#apikey) +- [apiSecret](Configuration.md#apisecret) --- @@ -18,9 +18,9 @@ ### enviroment -**● enviroment**: *`string`* +**● enviroment**: _`string`_ -*Defined in [Configuration.java:35](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Configuration.java#L35)* +_Defined in [Configuration.java:35](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Configuration.java#L35)_ --- @@ -28,9 +28,9 @@ ### publicKey -**● publicKey**: *`string`* +**● publicKey**: _`string`_ -*Defined in [Configuration.java:33](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Configuration.java#L33)* +_Defined in [Configuration.java:33](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Configuration.java#L33)_ --- @@ -38,9 +38,9 @@ ### privateKey -**● privateKey**: *`string`* +**● privateKey**: _`string`_ -*Defined in [Configuration.java:34](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Configuration.java#L34)* +_Defined in [Configuration.java:34](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Configuration.java#L34)_ --- @@ -48,18 +48,18 @@ ### «Static» environment -► **environment**(environment: *"production"⎮"sandbox"⎮"integration"*): `void` +► **environment**(environment: _"production"⎮"sandbox"⎮"integration"_): `void` -*Defined in [Configuration.java:90](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Configuration.java#L90)* +_Defined in [Configuration.java:90](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Configuration.java#L90)_ Set the Payment Rails API environment that your using **Parameters:** -| Param | Type | Description | -| ------ | ------ | ------ | -| environment | "production"⎮"sandbox"⎮"integration" | one of "production" or "sandbox" | +| Param | Type | Description | +| ----------- | ------------------------------------ | -------------------------------- | +| environment | "production"⎮"sandbox"⎮"integration" | one of "production" or "sandbox" | **Returns:** `void` ---- \ No newline at end of file +--- diff --git a/docs/classes/gateway.md b/docs/classes/gateway.md index befbd87..641a67a 100644 --- a/docs/classes/gateway.md +++ b/docs/classes/gateway.md @@ -6,12 +6,12 @@ ### Properties -* [balances](gateway.md#balances) -* [batch](gateway.md#batch) -* [config](gateway.md#config) -* [payment](gateway.md#payment) -* [recipient](gateway.md#recipient) -* [recipientAccount](gateway.md#recipientaccount) +- [balances](gateway.md#balances) +- [batch](gateway.md#batch) +- [config](gateway.md#config) +- [payment](gateway.md#payment) +- [recipient](gateway.md#recipient) +- [recipientAccount](gateway.md#recipientaccount) --- @@ -21,9 +21,9 @@ ### balances -**● balances**: *[BalancesGateway](balancesgateway.md)* +**● balances**: _[BalancesGateway](balancesgateway.md)_ -*Defined in [Gateway.md:15]* +_Defined in [Gateway.md:15]_ --- @@ -31,9 +31,9 @@ ### batch -**● batch**: *[BatchGateway](batchgateway.md)* +**● batch**: _[BatchGateway](batchgateway.md)_ -*Defined in [Gateway.java:13](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Gateway.java#L13)* +_Defined in [Gateway.java:13](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Gateway.java#L13)_ --- @@ -41,9 +41,9 @@ ### config -**● config**: *[Configuration](configuration.md)* +**● config**: _[Configuration](configuration.md)_ -*Defined in [Gateway.java:10](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Gateway.java#L10)* +_Defined in [Gateway.java:10](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Gateway.java#L10)_ --- @@ -51,9 +51,9 @@ ### payment -**● payment**: *[PaymentGateway](paymentgateway.md)* +**● payment**: _[PaymentGateway](paymentgateway.md)_ -*Defined in [Gateway.java:16](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Gateway.java#L16)* +_Defined in [Gateway.java:16](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Gateway.java#L16)_ --- @@ -61,9 +61,9 @@ ### recipient -**● recipient**: *[RecipientGateway](recipientgateway.md)* +**● recipient**: _[RecipientGateway](recipientgateway.md)_ -*Defined in [Gateway.java:12](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Gateway.java#L12)* +_Defined in [Gateway.java:12](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Gateway.java#L12)_ --- @@ -71,8 +71,8 @@ ### recipientAccount -**● recipientAccount**: *[RecipientAccountGateway](recipientaccountgateway.md)* +**● recipientAccount**: _[RecipientAccountGateway](recipientaccountgateway.md)_ -*Defined in [Gateway.java:14](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Gateway.java#L14)* +_Defined in [Gateway.java:14](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Gateway.java#L14)_ ---- \ No newline at end of file +--- diff --git a/docs/classes/paymentgateway.md b/docs/classes/paymentgateway.md index b318a7e..8c90e99 100644 --- a/docs/classes/paymentgateway.md +++ b/docs/classes/paymentgateway.md @@ -6,11 +6,11 @@ ### Methods -* [create](paymentgateway.md#create) -* [find](paymentgateway.md#find) -* [remove](paymentgateway.md#remove) -* [search](paymentgateway.md#search) -* [update](paymentgateway.md#update) +- [create](paymentgateway.md#create) +- [find](paymentgateway.md#find) +- [remove](paymentgateway.md#remove) +- [search](paymentgateway.md#search) +- [update](paymentgateway.md#update) --- @@ -20,9 +20,9 @@ ### create -► **create**(batchId: *`string`*, body: *`any`*): `Payment` +► **create**(batchId: _`string`_, body: _`any`_): `Payment` -*Defined in [PaymentGateway.java:55](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Gateway.java#L55)* +_Defined in [PaymentGateway.java:55](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Gateway.java#L55)_ Create a new payment in a batch @@ -30,10 +30,10 @@ Create a new payment in a batch **Parameters:** -| Param | Type | Description | -| ------ | ------ | ------ | -| batchId | `string` | Payment Rails payment id (e.g. "B-xx999bb") | -| body | `any` | Payment information | +| Param | Type | Description | +| ------- | -------- | ------------------------------------------- | +| batchId | `string` | Payment Rails payment id (e.g. "B-xx999bb") | +| body | `any` | Payment information | **Returns:** `Payment` @@ -43,9 +43,9 @@ Create a new payment in a batch ### find -► **find**(paymentId: *`string`*): `Payment` +► **find**(paymentId: _`string`_): `Payment` -*Defined in [PaymentGateway.java:34](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Gateway.java#L34)* +_Defined in [PaymentGateway.java:34](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Gateway.java#L34)_ Find a specific payment @@ -53,9 +53,9 @@ Find a specific payment **Parameters:** -| Param | Type | Description | -| ------ | ------ | ------ | -| paymentId | `string` | Payment Rails payment id (e.g. "P-aabccc") | +| Param | Type | Description | +| --------- | -------- | ------------------------------------------ | +| paymentId | `string` | Payment Rails payment id (e.g. "P-aabccc") | **Returns:** `Payment` @@ -65,9 +65,9 @@ Find a specific payment ### delete -► **delete**(paymentId: *`string`*, batchId: *`string`*): `boolean` +► **delete**(paymentId: _`string`_, batchId: _`string`_): `boolean` -*Defined in [PaymentGateway.java:90](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Gateway.java#L90)* +_Defined in [PaymentGateway.java:90](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Gateway.java#L90)_ Delete a given payment -- Note you can only delete non processed payments @@ -75,10 +75,10 @@ Delete a given payment -- Note you can only delete non processed payments **Parameters:** -| Param | Type | Description | -| ------ | ------ | ------ | -| paymentId | `string` | Payment Rails payment id (e.g. "P-aabccc") | -| batchId | `string` | Payment Rails payment id (e.g. "B-xx999bb") | +| Param | Type | Description | +| --------- | -------- | ------------------------------------------- | +| paymentId | `string` | Payment Rails payment id (e.g. "P-aabccc") | +| batchId | `string` | Payment Rails payment id (e.g. "B-xx999bb") | **Returns:** `boolean` @@ -88,20 +88,20 @@ Delete a given payment -- Note you can only delete non processed payments ### search -► **search**(batchId: *`string`*, page?: *`number`*, pageSize?: *`number`*, term?: *`string`*): `Payment`[] +► **search**(batchId: _`string`_, page?: _`number`_, pageSize?: _`number`_, term?: _`string`_): `Payment`[] -*Defined in [PaymentGateway.java:105](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Gateway.java#L105)* +_Defined in [PaymentGateway.java:105](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Gateway.java#L105)_ Search for payments in a given batch **Parameters:** -| Param | Type | Default value | Description | -| ------ | ------ | ------ | ------ | -| batchId | `string` | - | Payment Rails payment id (e.g. "B-xx999bb") | -| page | `number` | 1 | Page number (1 based) | -| pageSize | `number` | 10 | Page size (0...1000) | -| term | `string` | "" | Any search terms to look for | +| Param | Type | Default value | Description | +| -------- | -------- | ------------- | ------------------------------------------- | +| batchId | `string` | - | Payment Rails payment id (e.g. "B-xx999bb") | +| page | `number` | 1 | Page number (1 based) | +| pageSize | `number` | 10 | Page size (0...1000) | +| term | `string` | "" | Any search terms to look for | **Returns:** `Payment`[] @@ -111,9 +111,9 @@ Search for payments in a given batch ### update -► **update**(paymentId: *`string`*, batchId: *`string`*, body: *`any`*): `boolean` +► **update**(paymentId: _`string`_, batchId: _`string`_, body: _`any`_): `boolean` -*Defined in [PaymentGateway.java:74](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Gateway.java#L74)* +_Defined in [PaymentGateway.java:74](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Gateway.java#L74)_ Update a given payment @@ -121,12 +121,12 @@ Update a given payment **Parameters:** -| Param | Type | Description | -| ------ | ------ | ------ | -| paymentId | `string` | Payment Rails payment id (e.g. "P-aabccc") | -| batchId | `string` | Payment Rails payment id (e.g. "B-xx999bb") | -| body | `any` | Payment update information | +| Param | Type | Description | +| --------- | -------- | ------------------------------------------- | +| paymentId | `string` | Payment Rails payment id (e.g. "P-aabccc") | +| batchId | `string` | Payment Rails payment id (e.g. "B-xx999bb") | +| body | `any` | Payment update information | **Returns:** `boolean` ---- \ No newline at end of file +--- diff --git a/docs/classes/recipientaccountgateway.md b/docs/classes/recipientaccountgateway.md index d806023..7944796 100644 --- a/docs/classes/recipientaccountgateway.md +++ b/docs/classes/recipientaccountgateway.md @@ -6,11 +6,11 @@ ### Methods -* [findAll](recipientaccountgateway.md#findAll) -* [create](recipientaccountgateway.md#create) -* [find](recipientaccountgateway.md#find) -* [remove](recipientaccountgateway.md#remove) -* [update](recipientaccountgateway.md#update) +- [findAll](recipientaccountgateway.md#findAll) +- [create](recipientaccountgateway.md#create) +- [find](recipientaccountgateway.md#find) +- [remove](recipientaccountgateway.md#remove) +- [update](recipientaccountgateway.md#update) --- @@ -20,9 +20,9 @@ ### all -► **all**(recipientId: *`string`*): `List`(recipientaccount.md)[]> +► **all**(recipientId: _`string`_): `List`(recipientaccount.md)[]> -*Defined in [RecipientAccountGateway.java:33](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccountGateway.java#L33)* +_Defined in [RecipientAccountGateway.java:33](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccountGateway.java#L33)_ Fetch all of the accounts for a given Payment Rails recipient @@ -31,9 +31,9 @@ Fetch all of the accounts for a given Payment Rails recipient **Parameters:** -| Param | Type | Description | -| ------ | ------ | ------ | -| recipientId | `string` | The Payment Rails recipient ID (e.g. R-xyzzy) | +| Param | Type | Description | +| ----------- | -------- | --------------------------------------------- | +| recipientId | `string` | The Payment Rails recipient ID (e.g. R-xyzzy) | **Returns:** `List(recipientaccount.md)[]> @@ -43,19 +43,20 @@ Fetch all of the accounts for a given Payment Rails recipient ### create -► **create**(recipientId: *`string`*, body: *`RecipientAccount`*): `RecipientAccount`(recipientaccount.md)> +► **create**(recipientId: _`string`_, body: _`RecipientAccount`_): `RecipientAccount`(recipientaccount.md)> -*Defined in [RecipientAccountGateway.java:79](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccountGateway.java#L79)* +_Defined in [RecipientAccountGateway.java:79](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccountGateway.java#L79)_ Create a new recipient account RecipientAccount recipientAccount = client.recipientAccount.create("R-112e2c3x","{\"type\":\"bank-transfer\",\"primary\":\"true\",\"country\":\"CA\",\"currency\":\"CAD\",\"accountNum\":\"012345678\",\"bankId\":\"004\",\"branchId\":\"47261\",\"accountHolderName\":\"John Smith\"}"); + **Parameters:** -| Param | Type | Description | -| ------ | ------ | ------ | -| recipientId | `string` | The Payment Rails recipient ID (e.g. R-xyzzy) | -| body | `string` | Account information | +| Param | Type | Description | +| ----------- | -------- | --------------------------------------------- | +| recipientId | `string` | The Payment Rails recipient ID (e.g. R-xyzzy) | +| body | `string` | Account information | **Returns:** `RecipientAccount`(recipientaccount.md)> @@ -65,9 +66,9 @@ Create a new recipient account ### find -► **find**(recipientId: *`string`*, accountId: *`string`*): `RecipientAccount`(recipientaccount.md)> +► **find**(recipientId: _`string`_, accountId: _`string`_): `RecipientAccount`(recipientaccount.md)> -*Defined in [RecipientAccountGateway.java:52](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccountGateway.java#L52)* +_Defined in [RecipientAccountGateway.java:52](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccountGateway.java#L52)_ Fetch a specific account for a given Payment Rails recipient @@ -75,10 +76,10 @@ RecipientAccount recipientAccount = client.recipientAccount.find("R-ad322121", " **Parameters:** -| Param | Type | Description | -| ------ | ------ | ------ | -| recipientId | `string` | The Payment Rails recipient ID (e.g. R-xyzzy) | -| accountId | `string` | The Payment Rails account ID (e.g. A-xyzzy) | +| Param | Type | Description | +| ----------- | -------- | --------------------------------------------- | +| recipientId | `string` | The Payment Rails recipient ID (e.g. R-xyzzy) | +| accountId | `string` | The Payment Rails account ID (e.g. A-xyzzy) | **Returns:** `RecipientAccount`(recipientaccount.md)> @@ -88,9 +89,9 @@ RecipientAccount recipientAccount = client.recipientAccount.find("R-ad322121", " ### delete -► **delete**(recipientId: *`string`*, accountId: *`string`*): `boolean` +► **delete**(recipientId: _`string`_, accountId: _`string`_): `boolean` -*Defined in [RecipientAccountGateway.java:121](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccountGateway.java#L121)* +_Defined in [RecipientAccountGateway.java:121](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccountGateway.java#L121)_ Delete the given recipient account. This will only return success, otherwise it will throw an exception (e.g. NotFound) @@ -98,10 +99,10 @@ Delete the given recipient account. This will only return success, otherwise it **Parameters:** -| Param | Type | Description | -| ------ | ------ | ------ | -| recipientId | `string` | The Payment Rails recipient ID (e.g. R-xyzzy) | -| accountId | `string` | The Payment Rails account ID (e.g. A-xyzzy) | +| Param | Type | Description | +| ----------- | -------- | --------------------------------------------- | +| recipientId | `string` | The Payment Rails recipient ID (e.g. R-xyzzy) | +| accountId | `string` | The Payment Rails account ID (e.g. A-xyzzy) | **Returns:** `boolean` @@ -111,9 +112,9 @@ Delete the given recipient account. This will only return success, otherwise it ### update -► **update**(recipientId: *`string`*, accountId: *`string`*, body: *`RecipientAccount`*): `RecipientAccount`(recipientaccount.md)> +► **update**(recipientId: _`string`_, accountId: _`string`_, body: _`RecipientAccount`_): `RecipientAccount`(recipientaccount.md)> -*Defined in [RecipientAccountGateway.java:102](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccountGateway.java#L102)* +_Defined in [RecipientAccountGateway.java:102](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccountGateway.java#L102)_ Update a recipient account. Note: Updating an account will create a new account ID if it contains any property that isn't just "primary" @@ -121,12 +122,12 @@ Update a recipient account. Note: Updating an account will create a new account **Parameters:** -| Param | Type | Description | -| ------ | ------ | ------ | -| recipientId | `string` | The Payment Rails recipient ID (e.g. R-xyzzy) | -| accountId | `string` | The Payment Rails account ID (e.g. A-xyzzy) | -| body | `any` | Account information | +| Param | Type | Description | +| ----------- | -------- | --------------------------------------------- | +| recipientId | `string` | The Payment Rails recipient ID (e.g. R-xyzzy) | +| accountId | `string` | The Payment Rails account ID (e.g. A-xyzzy) | +| body | `any` | Account information | **Returns:** `RecipientAccount`(recipientaccount.md)> ---- \ No newline at end of file +--- diff --git a/docs/classes/recipientgateway.md b/docs/classes/recipientgateway.md index 0f38846..029eed0 100644 --- a/docs/classes/recipientgateway.md +++ b/docs/classes/recipientgateway.md @@ -6,11 +6,11 @@ ### Methods -* [create](RecipientGateway.md#create) -* [find](RecipientGateway.md#find) -* [remove](RecipientGateway.md#remove) -* [search](RecipientGateway.md#search) -* [update](RecipientGateway.md#update) +- [create](RecipientGateway.md#create) +- [find](RecipientGateway.md#find) +- [remove](RecipientGateway.md#remove) +- [search](RecipientGateway.md#search) +- [update](RecipientGateway.md#update) --- @@ -20,9 +20,9 @@ ### create -► **create**(body: *[Recipient](../types/recipient.md)*): `Recipient` +► **create**(body: _[Recipient](../types/recipient.md)_): `Recipient` -*Defined in [RecipientGateway.java:82](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientGateway.java#L82)* +_Defined in [RecipientGateway.java:82](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientGateway.java#L82)_ Create a given recipient @@ -32,9 +32,9 @@ Create a given recipient **Parameters:** -| Param | Type | Description | -| ------ | ------ | ------ | -| body | [Recipient](../types/recipient.md) | The recipient information to create | +| Param | Type | Description | +| ----- | ---------------------------------- | ----------------------------------- | +| body | [Recipient](../types/recipient.md) | The recipient information to create | **Returns:** `Recipient` @@ -44,9 +44,9 @@ Create a given recipient ### find -► **find**(recipientId: *`string`*): `Recipient` +► **find**(recipientId: _`string`_): `Recipient` -*Defined in [RecipientGateway.java:58](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientGateway.java#L58)* +_Defined in [RecipientGateway.java:58](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientGateway.java#L58)_ Find a specific recipient by their Payment Rails recipient ID @@ -54,9 +54,9 @@ Recipient recipient = client.recipient.find(R-efr313md8cj); **Parameters:** -| Param | Type | Description | -| ------ | ------ | ------ | -| recipientId | `string` | The Payment Rails recipient ID (e.g. R-xyzzy) | +| Param | Type | Description | +| ----------- | -------- | --------------------------------------------- | +| recipientId | `string` | The Payment Rails recipient ID (e.g. R-xyzzy) | **Returns:** `Recipient` @@ -66,9 +66,9 @@ Recipient recipient = client.recipient.find(R-efr313md8cj); ### delete -► **delete**(recipientId: *`string`*): `boolean` +► **delete**(recipientId: _`string`_): `boolean` -*Defined in [RecipientGateway.java:115](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientGateway.java#L115)* +_Defined in [RecipientGateway.java:115](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientGateway.java#L115)_ Delete the given recipient. @@ -76,9 +76,9 @@ Delete the given recipient. **Parameters:** -| Param | Type | Description | -| ------ | ------ | ------ | -| recipientId | `string` | The Payment Rails recipient ID (e.g. R-xyzzy) | +| Param | Type | Description | +| ----------- | -------- | --------------------------------------------- | +| recipientId | `string` | The Payment Rails recipient ID (e.g. R-xyzzy) | **Returns:** `boolean` @@ -88,17 +88,17 @@ Delete the given recipient. ### search -► **search**(page: *`number`*, pageSize: *`number`*, term: *`string`*): `Recipient`[] +► **search**(page: _`number`_, pageSize: _`number`_, term: _`string`_): `Recipient`[] -*Defined in [RecipientGateway.java:123](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientGateway.java#L123)* +_Defined in [RecipientGateway.java:123](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientGateway.java#L123)_ **Parameters:** -| Param | Type | Description | -| ------ | ------ | ------ | -| page | `number` | - | -| pageSize | `number` | - | -| term | `string` | - | +| Param | Type | Description | +| -------- | -------- | ----------- | +| page | `number` | - | +| pageSize | `number` | - | +| term | `string` | - | **Returns:** `Recipient`[] @@ -108,9 +108,9 @@ Delete the given recipient. ### update -► **update**(body: *[Recipient](../types/recipient.md)*): `boolean` +► **update**(body: _[Recipient](../types/recipient.md)_): `boolean` -*Defined in [RecipientGateway.java:100](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientGateway.java#L100)* +_Defined in [RecipientGateway.java:100](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientGateway.java#L100)_ Update the given recipient @@ -118,10 +118,10 @@ Update the given recipient **Parameters:** -| Param | Type | Description | -| ------ | ------ | ------ | -| body | [Recipient](../types/recipient.md) | the changes to make to the recipient | +| Param | Type | Description | +| ----- | ---------------------------------- | ------------------------------------ | +| body | [Recipient](../types/recipient.md) | the changes to make to the recipient | **Returns:** `boolean` ---- \ No newline at end of file +--- diff --git a/docs/types/batch.md b/docs/types/batch.md index d5c8f01..533adee 100644 --- a/docs/types/batch.md +++ b/docs/types/batch.md @@ -2,7 +2,7 @@ # Types: Batch -*__type__*: Batch +_**type**_: Batch ## Properties @@ -10,9 +10,9 @@ ### description -**● description**: *`undefined`⎮`string`* +**● description**: _`undefined`⎮`string`_ -*Defined in [Batch.java:15](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Batch.java#L15)* +_Defined in [Batch.java:15](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Batch.java#L15)_ --- @@ -20,8 +20,8 @@ ### sourceCurrency -**● sourceCurrency**: *`undefined`⎮`string`* +**● sourceCurrency**: _`undefined`⎮`string`_ -*Defined in [Batch.java:14](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Batch.java#L14)* +_Defined in [Batch.java:14](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Batch.java#L14)_ ---- \ No newline at end of file +--- diff --git a/docs/types/configurationparams.md b/docs/types/configurationparams.md index 2df5210..1043da7 100644 --- a/docs/types/configurationparams.md +++ b/docs/types/configurationparams.md @@ -8,9 +8,9 @@ ### «Optional» environment -**● environment**: *"production"⎮"sandbox"⎮"integration"⎮"development"* +**● environment**: _"production"⎮"sandbox"⎮"integration"⎮"development"_ -*Defined in [Configuration.java:15](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Configuration.java#L15)* +_Defined in [Configuration.java:15](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Configuration.java#L15)_ The environment that you're using, most likely one of "production" or "sandbox" @@ -20,9 +20,9 @@ The environment that you're using, most likely one of "production" or "sandbox" ### public key -**● public key**: *`string`* +**● public key**: _`string`_ -*Defined in [Configuration.java:7](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Configuration.java#L7)* +_Defined in [Configuration.java:7](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Configuration.java#L7)_ The Payment Rails public key @@ -32,10 +32,10 @@ The Payment Rails public key ### private key -**● private key**: *`string`* +**● private key**: _`string`_ -*Defined in [Configuration.java:11](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Configuration.java#L11)* +_Defined in [Configuration.java:11](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Configuration.java#L11)_ The Payment Rails private key ---- \ No newline at end of file +--- diff --git a/docs/types/payment.md b/docs/types/payment.md index cdb9344..f3db38e 100644 --- a/docs/types/payment.md +++ b/docs/types/payment.md @@ -2,7 +2,7 @@ # Types: Payment -*__type__*: Payment +_**type**_: Payment ## Properties @@ -10,9 +10,9 @@ ### «Optional» memo -**● memo**: *`undefined`⎮`string`* +**● memo**: _`undefined`⎮`string`_ -*Defined in [Payment.java:22](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Payment.java#L22)* +_Defined in [Payment.java:22](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Payment.java#L22)_ --- @@ -20,15 +20,15 @@ ### recipient -**● recipient**: *`object`* +**● recipient**: _`object`_ -*Defined in [Payment.java:23](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Payment.java#L23)* +_Defined in [Payment.java:23](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Payment.java#L23)_ #### Type declaration -«Optional» email: `undefined`⎮`string` -«Optional» id: `undefined`⎮`string` -«Optional» referenceId: `undefined`⎮`string` +«Optional» email: `undefined`⎮`string` +«Optional» id: `undefined`⎮`string` +«Optional» referenceId: `undefined`⎮`string` --- @@ -36,9 +36,9 @@ ### «Optional» sourceAmount -**● sourceAmount**: *`undefined`⎮`string`* +**● sourceAmount**: _`undefined`⎮`string`_ -*Defined in [Payment.java:19](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Payment.java#L19)* +_Defined in [Payment.java:19](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Payment.java#L19)_ --- @@ -46,9 +46,9 @@ ### «Optional» targetAmount -**● targetAmount**: *`undefined`⎮`string`* +**● targetAmount**: _`undefined`⎮`string`_ -*Defined in [Payment.java:20](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Payment.java#L20)* +_Defined in [Payment.java:20](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Payment.java#L20)_ --- @@ -56,8 +56,8 @@ ### «Optional» targetCurrency -**● targetCurrency**: *`undefined`⎮`string`* +**● targetCurrency**: _`undefined`⎮`string`_ -*Defined in [Payment.java:21](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Payment.java#L21)* +_Defined in [Payment.java:21](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Payment.java#L21)_ ---- \ No newline at end of file +--- diff --git a/docs/types/recipient.md b/docs/types/recipient.md index 5e14164..16a8cf3 100644 --- a/docs/types/recipient.md +++ b/docs/types/recipient.md @@ -2,7 +2,7 @@ # Types: Recipient -*__type__*: Recipient +_**type**_: Recipient ## Properties @@ -10,9 +10,9 @@ ### «Optional» account -**● account**: *`any`* +**● account**: _`any`_ -*Defined in [Recipient.java:30](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Recipient.java#L29)* +_Defined in [Recipient.java:30](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Recipient.java#L29)_ --- @@ -20,9 +20,9 @@ ### «Optional» address -**● address**: *`undefined`⎮`object`* +**● address**: _`undefined`⎮`object`_ -*Defined in [Recipient.java:20](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Recipient.java#L20)* +_Defined in [Recipient.java:20](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Recipient.java#L20)_ --- @@ -30,9 +30,9 @@ ### «Optional» dob -**● dob**: *`undefined`⎮`string`* +**● dob**: _`undefined`⎮`string`_ -*Defined in [Recipient.java:15](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Recipient.java#L15)* +_Defined in [Recipient.java:15](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Recipient.java#L15)_ --- @@ -40,9 +40,9 @@ ### «Optional» email -**● email**: *`undefined`⎮`string`* +**● email**: _`undefined`⎮`string`_ -*Defined in [Recipient.java:10](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Recipient.java#L10)* +_Defined in [Recipient.java:10](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Recipient.java#L10)_ --- @@ -50,9 +50,9 @@ ### «Optional» firstName -**● firstName**: *`undefined`⎮`string`* +**● firstName**: _`undefined`⎮`string`_ -*Defined in [Recipient.java:12](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Recipient.java#L12)* +_Defined in [Recipient.java:12](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Recipient.java#L12)_ --- @@ -60,9 +60,9 @@ ### «Optional» governmentId -**● governmentId**: *`undefined`⎮`string`* +**● governmentId**: _`undefined`⎮`string`_ -*Defined in [Recipient.java:17](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Recipient.java#L17)* +_Defined in [Recipient.java:17](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Recipient.java#L17)_ --- @@ -70,9 +70,9 @@ ### «Optional» language -**● language**: *`undefined`⎮`string`* +**● language**: _`undefined`⎮`string`_ -*Defined in [Recipient.java:19](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Recipient.java#L19)* +_Defined in [Recipient.java:19](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Recipient.java#L19)_ --- @@ -80,9 +80,9 @@ ### «Optional» lastName -**● lastName**: *`undefined`⎮`string`* +**● lastName**: _`undefined`⎮`string`_ -*Defined in [Recipient.java:13](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Recipient.java#L13)* +_Defined in [Recipient.java:13](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Recipient.java#L13)_ --- @@ -90,9 +90,9 @@ ### «Optional» name -**● name**: *`undefined`⎮`string`* +**● name**: _`undefined`⎮`string`_ -*Defined in [Recipient.java:11](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Recipient.java#L11)* +_Defined in [Recipient.java:11](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Recipient.java#L11)_ --- @@ -100,9 +100,9 @@ ### «Optional» passport -**● passport**: *`undefined`⎮`string`* +**● passport**: _`undefined`⎮`string`_ -*Defined in [Recipient.java:18](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Recipient.java#L18)* +_Defined in [Recipient.java:18](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Recipient.java#L18)_ --- @@ -110,9 +110,9 @@ ### «Optional» referenceId -**● referenceId**: *`undefined`⎮`string`* +**● referenceId**: _`undefined`⎮`string`_ -*Defined in [Recipient.java:9](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Recipient.java#L9)* +_Defined in [Recipient.java:9](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Recipient.java#L9)_ --- @@ -120,9 +120,9 @@ ### «Optional» ssn -**● ssn**: *`undefined`⎮`string`* +**● ssn**: _`undefined`⎮`string`_ -*Defined in [Recipient.java:16](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Recipient.java#L16)* +_Defined in [Recipient.java:16](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Recipient.java#L16)_ --- @@ -130,8 +130,8 @@ ### «Optional» type -**● type**: *"individual"⎮"business"* +**● type**: _"individual"⎮"business"_ -*Defined in [Recipient.java:14](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/Recipient.java#L14)* +_Defined in [Recipient.java:14](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/Recipient.java#L14)_ ---- \ No newline at end of file +--- diff --git a/docs/types/recipientaccount.md b/docs/types/recipientaccount.md index b4789ea..3317c42 100644 --- a/docs/types/recipientaccount.md +++ b/docs/types/recipientaccount.md @@ -2,7 +2,7 @@ # Types: RecipientAccount -*__type__*: RecipientAccount +_**type**_: RecipientAccount ## Properties @@ -10,18 +10,19 @@ ### «Optional» accountHolderName -**● accountHolderName**: *`undefined`⎮`string`* +**● accountHolderName**: _`undefined`⎮`string`_ -*Defined in [RecipientAccount.java:23](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java#L23)* +_Defined in [RecipientAccount.java:23](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccount.java#L23)_ --- + ### «Optional» accountNum -**● accountNum**: *`undefined`⎮`string`* +**● accountNum**: _`undefined`⎮`string`_ -*Defined in [RecipientAccount.java:22](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java#L22)* +_Defined in [RecipientAccount.java:22](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccount.java#L22)_ --- @@ -29,9 +30,9 @@ ### «Optional» bankAddress -**● bankAddress**: *`undefined`⎮`string`* +**● bankAddress**: _`undefined`⎮`string`_ -*Defined in [RecipientAccount.java:28](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java#L28)* +_Defined in [RecipientAccount.java:28](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccount.java#L28)_ --- @@ -39,9 +40,9 @@ ### «Optional» bankCity -**● bankCity**: *`undefined`⎮`string`* +**● bankCity**: _`undefined`⎮`string`_ -*Defined in [RecipientAccount.java:29](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java#L29)* +_Defined in [RecipientAccount.java:29](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccount.java#L29)_ --- @@ -49,9 +50,9 @@ ### «Optional» bankId -**● bankId**: *`undefined`⎮`string`* +**● bankId**: _`undefined`⎮`string`_ -*Defined in [RecipientAccount.java:26](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java#L26)* +_Defined in [RecipientAccount.java:26](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccount.java#L26)_ --- @@ -59,9 +60,9 @@ ### «Optional» bankName -**● bankName**: *`undefined`⎮`string`* +**● bankName**: _`undefined`⎮`string`_ -*Defined in [RecipientAccount.java:27](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java#L27)* +_Defined in [RecipientAccount.java:27](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccount.java#L27)_ --- @@ -69,9 +70,9 @@ ### «Optional» bankPostalCode -**● bankPostalCode**: *`undefined`⎮`string`* +**● bankPostalCode**: _`undefined`⎮`string`_ -*Defined in [RecipientAccount.java:31](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java#L31)* +_Defined in [RecipientAccount.java:31](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccount.java#L31)_ --- @@ -79,9 +80,9 @@ ### «Optional» bankRegionCode -**● bankRegionCode**: *`undefined`⎮`string`* +**● bankRegionCode**: _`undefined`⎮`string`_ -*Defined in [RecipientAccount.java:30](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java#L30)* +_Defined in [RecipientAccount.java:30](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccount.java#L30)_ --- @@ -89,9 +90,9 @@ ### «Optional» branchId -**● branchId**: *`undefined`⎮`string`* +**● branchId**: _`undefined`⎮`string`_ -*Defined in [RecipientAccount.java:25](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java#L25)* +_Defined in [RecipientAccount.java:25](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccount.java#L25)_ --- @@ -99,9 +100,9 @@ ### «Optional» country -**● country**: *`undefined`⎮`string`* +**● country**: _`undefined`⎮`string`_ -*Defined in [RecipientAccount.java:19](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java#L19)* +_Defined in [RecipientAccount.java:19](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccount.java#L19)_ --- @@ -109,9 +110,9 @@ ### currency -**● currency**: *`string`* = "" +**● currency**: _`string`_ = "" -*Defined in [RecipientAccount.java:11](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java#L11)* +_Defined in [RecipientAccount.java:11](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccount.java#L11)_ --- @@ -119,9 +120,9 @@ ### «Optional» emailAddress -**● emailAddress**: *`undefined`⎮`string`* +**● emailAddress**: _`undefined`⎮`string`_ -*Defined in [RecipientAccount.java:16](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java#L16)* +_Defined in [RecipientAccount.java:16](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccount.java#L16)_ --- @@ -129,9 +130,9 @@ ### «Optional» iban -**● iban**: *`undefined`⎮`string`* +**● iban**: _`undefined`⎮`string`_ -*Defined in [RecipientAccount.java:21](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java#L21)* +_Defined in [RecipientAccount.java:21](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccount.java#L21)_ --- @@ -139,9 +140,9 @@ ### id -**● id**: *`string`* = "" +**● id**: _`string`_ = "" -*Defined in [RecipientAccount.java:9](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java#L9)* +_Defined in [RecipientAccount.java:9](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccount.java#L9)_ --- @@ -149,9 +150,9 @@ ### primary -**● primary**: *`boolean`* = false +**● primary**: _`boolean`_ = false -*Defined in [RecipientAccount.java:10](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java#L10)* +_Defined in [RecipientAccount.java:10](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccount.java#L10)_ --- @@ -159,9 +160,9 @@ ### «Optional» recipientFees -**● recipientFees**: *`undefined`⎮`string`* +**● recipientFees**: _`undefined`⎮`string`_ -*Defined in [RecipientAccount.java:13](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java#L13)* +_Defined in [RecipientAccount.java:13](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccount.java#L13)_ --- @@ -169,9 +170,9 @@ ### «Optional» routeType -**● routeType**: *`undefined`⎮`string`* +**● routeType**: _`undefined`⎮`string`_ -*Defined in [RecipientAccount.java:12](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java#L12)* +_Defined in [RecipientAccount.java:12](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccount.java#L12)_ --- @@ -179,9 +180,9 @@ ### «Optional» swiftBic -**● swiftBic**: *`string`⎮`null`* +**● swiftBic**: _`string`⎮`null`_ -*Defined in [RecipientAccount.java:24](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java#L24)* +_Defined in [RecipientAccount.java:24](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccount.java#L24)_ --- @@ -189,8 +190,8 @@ ### «Optional» type -**● type**: *`undefined`⎮`string`* +**● type**: _`undefined`⎮`string`_ -*Defined in [RecipientAccount.java:20](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java#L20)* +_Defined in [RecipientAccount.java:20](https://github.com/PaymentRails/java-sdk/tree/master/src/main/java/com/trolley/trolley/RecipientAccount.java#L20)_ ---- \ No newline at end of file +--- diff --git a/pom.xml b/pom.xml index a30b444..3df5d36 100644 --- a/pom.xml +++ b/pom.xml @@ -1,19 +1,83 @@ 4.0.0 - ca.paymentrails - paymentrails + com.trolley + java-sdk 1.0.1 - Java SDK for Payment Rails API + Java SDK for Trolley API jar - Payment Rails Java SDK + Trolley Java SDK UTF-8 - 1.8 - 1.8 + 8 + 8 1.6.6 - + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.7 + true + + ossrh + https://oss.sonatype.org/ + true + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + org.apache.httpcomponents @@ -55,15 +119,14 @@ 2.9.10.1 - com.fasterxml.jackson.core - jackson-annotations - LATEST - - - com.fasterxml.jackson.core - jackson-core + com.fasterxml.jackson.core + jackson-annotations LATEST - + + + com.fasterxml.jackson.core + jackson-core + LATEST + - \ No newline at end of file diff --git a/src/main/java/ca/paymentrails/Exceptions/AuthenticationException.java b/src/main/java/com/trolley/Exceptions/AuthenticationException.java similarity index 85% rename from src/main/java/ca/paymentrails/Exceptions/AuthenticationException.java rename to src/main/java/com/trolley/Exceptions/AuthenticationException.java index 1be01bc..1d8d878 100644 --- a/src/main/java/ca/paymentrails/Exceptions/AuthenticationException.java +++ b/src/main/java/com/trolley/Exceptions/AuthenticationException.java @@ -1,4 +1,4 @@ -package ca.paymentrails.Exceptions; +package com.trolley.Exceptions; public class AuthenticationException extends Exception { diff --git a/src/main/java/ca/paymentrails/Exceptions/AuthorizationException.java b/src/main/java/com/trolley/Exceptions/AuthorizationException.java similarity index 85% rename from src/main/java/ca/paymentrails/Exceptions/AuthorizationException.java rename to src/main/java/com/trolley/Exceptions/AuthorizationException.java index 3a62261..657bb92 100644 --- a/src/main/java/ca/paymentrails/Exceptions/AuthorizationException.java +++ b/src/main/java/com/trolley/Exceptions/AuthorizationException.java @@ -1,4 +1,4 @@ -package ca.paymentrails.Exceptions; +package com.trolley.Exceptions; public class AuthorizationException extends Exception { diff --git a/src/main/java/ca/paymentrails/Exceptions/DownForMaintenanceException.java b/src/main/java/com/trolley/Exceptions/DownForMaintenanceException.java similarity index 85% rename from src/main/java/ca/paymentrails/Exceptions/DownForMaintenanceException.java rename to src/main/java/com/trolley/Exceptions/DownForMaintenanceException.java index 1934a08..9eade2a 100644 --- a/src/main/java/ca/paymentrails/Exceptions/DownForMaintenanceException.java +++ b/src/main/java/com/trolley/Exceptions/DownForMaintenanceException.java @@ -1,4 +1,4 @@ -package ca.paymentrails.Exceptions; +package com.trolley.Exceptions; public class DownForMaintenanceException extends Exception { diff --git a/src/main/java/ca/paymentrails/Exceptions/InvalidFieldException.java b/src/main/java/com/trolley/Exceptions/InvalidFieldException.java similarity index 80% rename from src/main/java/ca/paymentrails/Exceptions/InvalidFieldException.java rename to src/main/java/com/trolley/Exceptions/InvalidFieldException.java index 4acc61e..895f75f 100644 --- a/src/main/java/ca/paymentrails/Exceptions/InvalidFieldException.java +++ b/src/main/java/com/trolley/Exceptions/InvalidFieldException.java @@ -1,5 +1,5 @@ -package ca.paymentrails.Exceptions; +package com.trolley.Exceptions; public class InvalidFieldException extends Exception { diff --git a/src/main/java/ca/paymentrails/Exceptions/InvalidServerConnectionException.java b/src/main/java/com/trolley/Exceptions/InvalidServerConnectionException.java similarity index 86% rename from src/main/java/ca/paymentrails/Exceptions/InvalidServerConnectionException.java rename to src/main/java/com/trolley/Exceptions/InvalidServerConnectionException.java index a55bb44..4d77eb0 100644 --- a/src/main/java/ca/paymentrails/Exceptions/InvalidServerConnectionException.java +++ b/src/main/java/com/trolley/Exceptions/InvalidServerConnectionException.java @@ -1,4 +1,4 @@ -package ca.paymentrails.Exceptions; +package com.trolley.Exceptions; public class InvalidServerConnectionException extends Exception { diff --git a/src/main/java/ca/paymentrails/Exceptions/InvalidStatusCodeException.java b/src/main/java/com/trolley/Exceptions/InvalidStatusCodeException.java similarity index 85% rename from src/main/java/ca/paymentrails/Exceptions/InvalidStatusCodeException.java rename to src/main/java/com/trolley/Exceptions/InvalidStatusCodeException.java index 3525e12..3c1e29f 100644 --- a/src/main/java/ca/paymentrails/Exceptions/InvalidStatusCodeException.java +++ b/src/main/java/com/trolley/Exceptions/InvalidStatusCodeException.java @@ -1,4 +1,4 @@ -package ca.paymentrails.Exceptions; +package com.trolley.Exceptions; public class InvalidStatusCodeException extends Exception { diff --git a/src/main/java/ca/paymentrails/Exceptions/MalformedException.java b/src/main/java/com/trolley/Exceptions/MalformedException.java similarity index 84% rename from src/main/java/ca/paymentrails/Exceptions/MalformedException.java rename to src/main/java/com/trolley/Exceptions/MalformedException.java index 6e47650..e141196 100644 --- a/src/main/java/ca/paymentrails/Exceptions/MalformedException.java +++ b/src/main/java/com/trolley/Exceptions/MalformedException.java @@ -1,4 +1,4 @@ -package ca.paymentrails.Exceptions; +package com.trolley.Exceptions; public class MalformedException extends Exception { diff --git a/src/main/java/ca/paymentrails/Exceptions/NotFoundException.java b/src/main/java/com/trolley/Exceptions/NotFoundException.java similarity index 84% rename from src/main/java/ca/paymentrails/Exceptions/NotFoundException.java rename to src/main/java/com/trolley/Exceptions/NotFoundException.java index 851a0b7..5218c4f 100644 --- a/src/main/java/ca/paymentrails/Exceptions/NotFoundException.java +++ b/src/main/java/com/trolley/Exceptions/NotFoundException.java @@ -1,4 +1,4 @@ -package ca.paymentrails.Exceptions; +package com.trolley.Exceptions; public class NotFoundException extends Exception { diff --git a/src/main/java/ca/paymentrails/Exceptions/TooManyRequestsException.java b/src/main/java/com/trolley/Exceptions/TooManyRequestsException.java similarity index 85% rename from src/main/java/ca/paymentrails/Exceptions/TooManyRequestsException.java rename to src/main/java/com/trolley/Exceptions/TooManyRequestsException.java index e74fede..c130625 100644 --- a/src/main/java/ca/paymentrails/Exceptions/TooManyRequestsException.java +++ b/src/main/java/com/trolley/Exceptions/TooManyRequestsException.java @@ -1,4 +1,4 @@ -package ca.paymentrails.Exceptions; +package com.trolley.Exceptions; public class TooManyRequestsException extends Exception { diff --git a/src/main/java/ca/paymentrails/Exceptions/UnexpectedException.java b/src/main/java/com/trolley/Exceptions/UnexpectedException.java similarity index 84% rename from src/main/java/ca/paymentrails/Exceptions/UnexpectedException.java rename to src/main/java/com/trolley/Exceptions/UnexpectedException.java index 02ee809..46288a4 100644 --- a/src/main/java/ca/paymentrails/Exceptions/UnexpectedException.java +++ b/src/main/java/com/trolley/Exceptions/UnexpectedException.java @@ -1,4 +1,4 @@ -package ca.paymentrails.Exceptions; +package com.trolley.Exceptions; public class UnexpectedException extends Exception { diff --git a/src/main/java/ca/paymentrails/paymentrails/Address.java b/src/main/java/com/trolley/trolley/Address.java similarity index 97% rename from src/main/java/ca/paymentrails/paymentrails/Address.java rename to src/main/java/com/trolley/trolley/Address.java index 2265b94..213a7b6 100644 --- a/src/main/java/ca/paymentrails/paymentrails/Address.java +++ b/src/main/java/com/trolley/trolley/Address.java @@ -1,4 +1,4 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/ca/paymentrails/paymentrails/Balances.java b/src/main/java/com/trolley/trolley/Balances.java similarity index 63% rename from src/main/java/ca/paymentrails/paymentrails/Balances.java rename to src/main/java/com/trolley/trolley/Balances.java index d74480e..3b3706d 100644 --- a/src/main/java/ca/paymentrails/paymentrails/Balances.java +++ b/src/main/java/com/trolley/trolley/Balances.java @@ -1,4 +1,4 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; public class Balances { @@ -36,9 +36,9 @@ public void setCAD(CAD CAD) { * Retrieves all account balances * * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidFieldException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidConnectionException */ public static String find() throws Exception { return find(""); @@ -47,11 +47,11 @@ public static String find() throws Exception { /** * Retrieves balance based on term * - * @param term (paypal or paymentrails) + * @param term (paypal or trolley) * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidFieldException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidConnectionException */ public static String find(String term) throws Exception { return Configuration.gateway().balances.find(term); diff --git a/src/main/java/ca/paymentrails/paymentrails/BalancesGateway.java b/src/main/java/com/trolley/trolley/BalancesGateway.java similarity index 82% rename from src/main/java/ca/paymentrails/paymentrails/BalancesGateway.java rename to src/main/java/com/trolley/trolley/BalancesGateway.java index eef1bab..f11b06b 100644 --- a/src/main/java/ca/paymentrails/paymentrails/BalancesGateway.java +++ b/src/main/java/com/trolley/trolley/BalancesGateway.java @@ -1,6 +1,6 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; -import ca.paymentrails.Exceptions.InvalidFieldException; +import com.trolley.Exceptions.InvalidFieldException; public class BalancesGateway { Client client; diff --git a/src/main/java/ca/paymentrails/paymentrails/BankTransfer.java b/src/main/java/com/trolley/trolley/BankTransfer.java similarity index 82% rename from src/main/java/ca/paymentrails/paymentrails/BankTransfer.java rename to src/main/java/com/trolley/trolley/BankTransfer.java index 52b224d..594d7fe 100644 --- a/src/main/java/ca/paymentrails/paymentrails/BankTransfer.java +++ b/src/main/java/com/trolley/trolley/BankTransfer.java @@ -1,4 +1,4 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; public class BankTransfer { diff --git a/src/main/java/ca/paymentrails/paymentrails/Batch.java b/src/main/java/com/trolley/trolley/Batch.java similarity index 70% rename from src/main/java/ca/paymentrails/paymentrails/Batch.java rename to src/main/java/com/trolley/trolley/Batch.java index 272571e..c0c8e5e 100644 --- a/src/main/java/ca/paymentrails/paymentrails/Batch.java +++ b/src/main/java/com/trolley/trolley/Batch.java @@ -1,4 +1,4 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; import java.util.List; import com.fasterxml.jackson.annotation.JsonInclude; @@ -115,9 +115,9 @@ public void setPayments(List payments) { * * @param batch_id * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidFieldException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidConnectionException */ public static Batch find(String batch_id) throws Exception { return Configuration.gateway().batch.find(batch_id); @@ -129,9 +129,9 @@ public static Batch find(String batch_id) throws Exception { * @param batch_id * @param body * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidFieldException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidConnectionException */ public static boolean update(String batch_id, String body) throws Exception { return Configuration.gateway().batch.update(batch_id, body); @@ -142,9 +142,9 @@ public static boolean update(String batch_id, String body) throws Exception { * * @param batch_id * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidFieldException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidConnectionException */ public static boolean delete(String batch_id) throws Exception { return Configuration.gateway().batch.delete(batch_id); @@ -155,9 +155,9 @@ public static boolean delete(String batch_id) throws Exception { * * @param body * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidFieldException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidConnectionException */ public static Batch create(String body) throws Exception { return Configuration.gateway().batch.create(body); @@ -172,9 +172,9 @@ public static Batch create(Batch body) throws Exception { * * @param batch_id * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidFieldException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidConnectionException */ public static String generateQuote(String batch_id) throws Exception { return Configuration.gateway().batch.generateQuote(batch_id); @@ -185,9 +185,9 @@ public static String generateQuote(String batch_id) throws Exception { * * @param batch_id * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidFieldException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidConnectionException */ public static String processBatch(String batch_id) throws Exception { return Configuration.gateway().batch.processBatch(batch_id); @@ -201,9 +201,9 @@ public static String processBatch(String batch_id) throws Exception { * @param pageSize * @param message * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException - * @throws ca.paymentrails.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidFieldException */ public static List query(int page, int pageSize, String message) throws Exception { return Configuration.gateway().batch.query(page, pageSize, message); @@ -215,9 +215,9 @@ public static List query(int page, int pageSize, String message) throws E * * @param message * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException - * @throws ca.paymentrails.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidFieldException */ public static List query(String message) throws Exception { return query(1, 10, message); @@ -227,9 +227,9 @@ public static List query(String message) throws Exception { * List all batches * * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException - * @throws ca.paymentrails.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidFieldException */ public static List query() throws Exception { return query(1, 10, ""); @@ -242,9 +242,9 @@ public static List query() throws Exception { * @param page * @param pageNumber * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException - * @throws ca.paymentrails.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidFieldException */ public static List query(int page, int pageNumber) throws Exception { return query(page, pageNumber, ""); @@ -255,9 +255,9 @@ public static List query(int page, int pageNumber) throws Exception { * * @param batch_id * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidFieldException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidConnectionException */ public static BatchSummary summary(String batch_id) throws Exception { return Configuration.gateway().batch.summary(batch_id); diff --git a/src/main/java/ca/paymentrails/paymentrails/BatchGateway.java b/src/main/java/com/trolley/trolley/BatchGateway.java similarity index 98% rename from src/main/java/ca/paymentrails/paymentrails/BatchGateway.java rename to src/main/java/com/trolley/trolley/BatchGateway.java index 8bd3bfb..c9bba8c 100644 --- a/src/main/java/ca/paymentrails/paymentrails/BatchGateway.java +++ b/src/main/java/com/trolley/trolley/BatchGateway.java @@ -1,4 +1,4 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; import java.io.IOException; import java.util.ArrayList; @@ -6,8 +6,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; - -import ca.paymentrails.Exceptions.InvalidFieldException; +import com.trolley.Exceptions.InvalidFieldException; public class BatchGateway { Client client; diff --git a/src/main/java/ca/paymentrails/paymentrails/BatchSummary.java b/src/main/java/com/trolley/trolley/BatchSummary.java similarity index 68% rename from src/main/java/ca/paymentrails/paymentrails/BatchSummary.java rename to src/main/java/com/trolley/trolley/BatchSummary.java index 76a392b..db3d5c3 100644 --- a/src/main/java/ca/paymentrails/paymentrails/BatchSummary.java +++ b/src/main/java/com/trolley/trolley/BatchSummary.java @@ -1,4 +1,4 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; public class BatchSummary { diff --git a/src/main/java/ca/paymentrails/paymentrails/CAD.java b/src/main/java/com/trolley/trolley/CAD.java similarity index 96% rename from src/main/java/ca/paymentrails/paymentrails/CAD.java rename to src/main/java/com/trolley/trolley/CAD.java index 46f43dd..cf76f1a 100644 --- a/src/main/java/ca/paymentrails/paymentrails/CAD.java +++ b/src/main/java/com/trolley/trolley/CAD.java @@ -1,4 +1,4 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; public class CAD { diff --git a/src/main/java/ca/paymentrails/paymentrails/Client.java b/src/main/java/com/trolley/trolley/Client.java similarity index 95% rename from src/main/java/ca/paymentrails/paymentrails/Client.java rename to src/main/java/com/trolley/trolley/Client.java index 2175533..ee40d08 100644 --- a/src/main/java/ca/paymentrails/paymentrails/Client.java +++ b/src/main/java/com/trolley/trolley/Client.java @@ -1,4 +1,4 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; import java.io.BufferedReader; import java.io.DataOutputStream; @@ -11,14 +11,14 @@ import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; +import com.trolley.Exceptions.*; + import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPatch; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.HttpClients; -import ca.paymentrails.Exceptions.*; - public class Client { private Configuration config; @@ -132,8 +132,8 @@ public String post(String endPoint) throws Exception { * @param endPoint * @param body * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidConnectionException */ public String patch(String endPoint, String body) throws Exception { String StringResponse = ""; @@ -180,7 +180,7 @@ public String patch(String endPoint, String body) throws Exception { * @param endPoint * @return The response * @throws InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidConnectionException */ public String delete(String endPoint) throws Exception { return sendRequest("DELETE", endPoint); @@ -205,7 +205,7 @@ private void throwStatusCodeException(int statusCode, String message) throws Exc case 503: throw new DownForMaintenanceException(message); default: - throw new ca.paymentrails.Exceptions.UnexpectedException(message); + throw new com.trolley.Exceptions.UnexpectedException(message); } } diff --git a/src/main/java/ca/paymentrails/paymentrails/Compliance.java b/src/main/java/com/trolley/trolley/Compliance.java similarity index 95% rename from src/main/java/ca/paymentrails/paymentrails/Compliance.java rename to src/main/java/com/trolley/trolley/Compliance.java index 36e8ec3..74dca5d 100644 --- a/src/main/java/ca/paymentrails/paymentrails/Compliance.java +++ b/src/main/java/com/trolley/trolley/Compliance.java @@ -1,4 +1,4 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/ca/paymentrails/paymentrails/Configuration.java b/src/main/java/com/trolley/trolley/Configuration.java similarity index 98% rename from src/main/java/ca/paymentrails/paymentrails/Configuration.java rename to src/main/java/com/trolley/trolley/Configuration.java index 58f4c80..b69e835 100644 --- a/src/main/java/ca/paymentrails/paymentrails/Configuration.java +++ b/src/main/java/com/trolley/trolley/Configuration.java @@ -1,4 +1,4 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; public class Configuration { diff --git a/src/main/java/ca/paymentrails/paymentrails/Detail.java b/src/main/java/com/trolley/trolley/Detail.java similarity index 80% rename from src/main/java/ca/paymentrails/paymentrails/Detail.java rename to src/main/java/com/trolley/trolley/Detail.java index 807adcb..47c378a 100644 --- a/src/main/java/ca/paymentrails/paymentrails/Detail.java +++ b/src/main/java/com/trolley/trolley/Detail.java @@ -1,4 +1,4 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/src/main/java/ca/paymentrails/paymentrails/EUR.java b/src/main/java/com/trolley/trolley/EUR.java similarity index 97% rename from src/main/java/ca/paymentrails/paymentrails/EUR.java rename to src/main/java/com/trolley/trolley/EUR.java index 7478893..3f91d88 100644 --- a/src/main/java/ca/paymentrails/paymentrails/EUR.java +++ b/src/main/java/com/trolley/trolley/EUR.java @@ -1,4 +1,4 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; public class EUR { diff --git a/src/main/java/ca/paymentrails/paymentrails/Gateway.java b/src/main/java/com/trolley/trolley/Gateway.java similarity index 94% rename from src/main/java/ca/paymentrails/paymentrails/Gateway.java rename to src/main/java/com/trolley/trolley/Gateway.java index b91d77f..25553a9 100644 --- a/src/main/java/ca/paymentrails/paymentrails/Gateway.java +++ b/src/main/java/com/trolley/trolley/Gateway.java @@ -1,4 +1,4 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; public class Gateway { diff --git a/src/main/java/ca/paymentrails/paymentrails/Meta.java b/src/main/java/com/trolley/trolley/Meta.java similarity index 93% rename from src/main/java/ca/paymentrails/paymentrails/Meta.java rename to src/main/java/com/trolley/trolley/Meta.java index 08705b0..84a59f6 100644 --- a/src/main/java/ca/paymentrails/paymentrails/Meta.java +++ b/src/main/java/com/trolley/trolley/Meta.java @@ -1,4 +1,4 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; public class Meta { diff --git a/src/main/java/ca/paymentrails/paymentrails/Payment.java b/src/main/java/com/trolley/trolley/Payment.java similarity index 85% rename from src/main/java/ca/paymentrails/paymentrails/Payment.java rename to src/main/java/com/trolley/trolley/Payment.java index ff49036..827b01e 100644 --- a/src/main/java/ca/paymentrails/paymentrails/Payment.java +++ b/src/main/java/com/trolley/trolley/Payment.java @@ -1,4 +1,4 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; import java.util.List; import com.fasterxml.jackson.annotation.JsonInclude; @@ -297,9 +297,9 @@ public void setMethodDisplay(String methodDisplay) { * @param payment_id * @param batch_id * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException - * @throws ca.paymentrails.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidFieldException */ public static Payment find(String payment_id, String batch_id) throws Exception { return Configuration.gateway().payment.find(payment_id, batch_id); @@ -311,9 +311,9 @@ public static Payment find(String payment_id, String batch_id) throws Exception * @param body * @param batch_id * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException - * @throws ca.paymentrails.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidFieldException */ public static Payment create(String body, String batch_id) throws Exception { return Configuration.gateway().payment.create(body, batch_id); @@ -326,9 +326,9 @@ public static Payment create(String body, String batch_id) throws Exception { * @param body * @param batch_id * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException - * @throws ca.paymentrails.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidFieldException */ public static boolean update(String payment_id, String body, String batch_id) throws Exception { return Configuration.gateway().payment.update(payment_id, body, batch_id); @@ -340,9 +340,9 @@ public static boolean update(String payment_id, String body, String batch_id) th * @param payment_id * @param batch_id * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException - * @throws ca.paymentrails.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidFieldException */ public static boolean delete(String payment_id, String batch_id) throws Exception { return Configuration.gateway().payment.delete(payment_id, batch_id); @@ -357,9 +357,9 @@ public static boolean delete(String payment_id, String batch_id) throws Exceptio * @param pageSize * @param message * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException - * @throws ca.paymentrails.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidFieldException */ public static List query(String batch_id, int page, int pageSize, String message) throws Exception { @@ -373,9 +373,9 @@ public static List query(String batch_id, int page, int pageSize, Strin * @param batch_id * @param message * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException - * @throws ca.paymentrails.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidFieldException */ public static List query(String batch_id, String message) throws Exception { return query(batch_id, 1, 10, message); @@ -386,9 +386,9 @@ public static List query(String batch_id, String message) throws Except * * @param batch_id * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException - * @throws ca.paymentrails.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidFieldException */ public static List query(String batch_id) throws Exception { return query(batch_id, 1, 10, ""); @@ -402,9 +402,9 @@ public static List query(String batch_id) throws Exception { * @param page * @param pageSize * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException - * @throws ca.paymentrails.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidFieldException */ public static List query(String batch_id, int page, int pageSize) throws Exception { diff --git a/src/main/java/ca/paymentrails/paymentrails/PaymentGateway.java b/src/main/java/com/trolley/trolley/PaymentGateway.java similarity index 97% rename from src/main/java/ca/paymentrails/paymentrails/PaymentGateway.java rename to src/main/java/com/trolley/trolley/PaymentGateway.java index d8df8a7..8319798 100644 --- a/src/main/java/ca/paymentrails/paymentrails/PaymentGateway.java +++ b/src/main/java/com/trolley/trolley/PaymentGateway.java @@ -1,8 +1,9 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; -import ca.paymentrails.Exceptions.InvalidFieldException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import com.trolley.Exceptions.InvalidFieldException; + import java.io.IOException; import java.util.ArrayList; import com.fasterxml.jackson.databind.DeserializationFeature; diff --git a/src/main/java/ca/paymentrails/paymentrails/Payments.java b/src/main/java/com/trolley/trolley/Payments.java similarity index 91% rename from src/main/java/ca/paymentrails/paymentrails/Payments.java rename to src/main/java/com/trolley/trolley/Payments.java index db032f9..ea72ccc 100644 --- a/src/main/java/ca/paymentrails/paymentrails/Payments.java +++ b/src/main/java/com/trolley/trolley/Payments.java @@ -1,4 +1,4 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; import java.util.List; diff --git a/src/main/java/ca/paymentrails/paymentrails/Recipient.java b/src/main/java/com/trolley/trolley/Recipient.java similarity index 86% rename from src/main/java/ca/paymentrails/paymentrails/Recipient.java rename to src/main/java/com/trolley/trolley/Recipient.java index d8c6fcb..c0a50e8 100644 --- a/src/main/java/ca/paymentrails/paymentrails/Recipient.java +++ b/src/main/java/com/trolley/trolley/Recipient.java @@ -1,4 +1,4 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; import java.util.List; import com.fasterxml.jackson.annotation.JsonInclude; @@ -342,9 +342,9 @@ public static List findPayments(String recipient_id) throws Exception { * * @param body * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidFieldException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidConnectionException */ public static Recipient create(String body) throws Exception { return Configuration.gateway().recipient.create(body); @@ -357,9 +357,9 @@ public static Recipient create(String body) throws Exception { * @param recipient_id * @param body * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidFieldException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidConnectionException */ public static boolean update(String recipient_id, String body) throws Exception { return Configuration.gateway().recipient.update(recipient_id, body); @@ -370,9 +370,9 @@ public static boolean update(String recipient_id, String body) throws Exception * * @param recipient_id * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidFieldException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidConnectionException */ public static boolean delete(String recipient_id) throws Exception { return Configuration.gateway().recipient.delete(recipient_id); @@ -386,9 +386,9 @@ public static boolean delete(String recipient_id) throws Exception { * @param pageSize * @param term * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException - * @throws ca.paymentrails.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidFieldException */ public static List search(int page, int pageSize, String term) throws Exception { return Configuration.gateway().recipient.search(page, pageSize, term); @@ -399,9 +399,9 @@ public static List search(int page, int pageSize, String term) throws * * @param message * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException - * @throws ca.paymentrails.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidFieldException */ public static List search(String message) throws Exception { return search(1, 10, message); @@ -410,9 +410,9 @@ public static List search(String message) throws Exception { /** * * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException - * @throws ca.paymentrails.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidFieldException */ public static List search() throws Exception { return search(1, 10, ""); @@ -425,9 +425,9 @@ public static List search() throws Exception { * @param page * @param pageNumber * @return The response - * @throws ca.paymentrails.Exceptions.InvalidStatusCodeException - * @throws ca.paymentrails.Exceptions.InvalidConnectionException - * @throws ca.paymentrails.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException + * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidFieldException */ public static List search(int page, int pageNumber) throws Exception { return search(page, pageNumber, ""); diff --git a/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java b/src/main/java/com/trolley/trolley/RecipientAccount.java similarity index 99% rename from src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java rename to src/main/java/com/trolley/trolley/RecipientAccount.java index 709a28c..692e407 100644 --- a/src/main/java/ca/paymentrails/paymentrails/RecipientAccount.java +++ b/src/main/java/com/trolley/trolley/RecipientAccount.java @@ -1,4 +1,4 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; import java.util.List; import com.fasterxml.jackson.annotation.JsonInclude; diff --git a/src/main/java/ca/paymentrails/paymentrails/RecipientAccountGateway.java b/src/main/java/com/trolley/trolley/RecipientAccountGateway.java similarity index 98% rename from src/main/java/ca/paymentrails/paymentrails/RecipientAccountGateway.java rename to src/main/java/com/trolley/trolley/RecipientAccountGateway.java index f6c3ed1..2a9f37c 100644 --- a/src/main/java/ca/paymentrails/paymentrails/RecipientAccountGateway.java +++ b/src/main/java/com/trolley/trolley/RecipientAccountGateway.java @@ -1,8 +1,9 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; -import ca.paymentrails.Exceptions.InvalidFieldException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import com.trolley.Exceptions.InvalidFieldException; + import java.io.IOException; import java.util.ArrayList; import com.fasterxml.jackson.databind.DeserializationFeature; diff --git a/src/main/java/ca/paymentrails/paymentrails/RecipientGateway.java b/src/main/java/com/trolley/trolley/RecipientGateway.java similarity index 98% rename from src/main/java/ca/paymentrails/paymentrails/RecipientGateway.java rename to src/main/java/com/trolley/trolley/RecipientGateway.java index fa655ff..7fd9a6a 100644 --- a/src/main/java/ca/paymentrails/paymentrails/RecipientGateway.java +++ b/src/main/java/com/trolley/trolley/RecipientGateway.java @@ -1,8 +1,9 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; -import ca.paymentrails.Exceptions.InvalidFieldException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import com.trolley.Exceptions.InvalidFieldException; + import java.io.IOException; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/ca/paymentrails/paymentrails/Total.java b/src/main/java/com/trolley/trolley/Total.java similarity index 82% rename from src/main/java/ca/paymentrails/paymentrails/Total.java rename to src/main/java/com/trolley/trolley/Total.java index ef7e67b..c570a19 100644 --- a/src/main/java/ca/paymentrails/paymentrails/Total.java +++ b/src/main/java/com/trolley/trolley/Total.java @@ -1,4 +1,4 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; public class Total { diff --git a/src/main/java/ca/paymentrails/paymentrails/USD.java b/src/main/java/com/trolley/trolley/USD.java similarity index 96% rename from src/main/java/ca/paymentrails/paymentrails/USD.java rename to src/main/java/com/trolley/trolley/USD.java index 2976037..94e4803 100644 --- a/src/main/java/ca/paymentrails/paymentrails/USD.java +++ b/src/main/java/com/trolley/trolley/USD.java @@ -1,4 +1,4 @@ -package ca.paymentrails.paymentrails; +package com.trolley.trolley; public class USD { diff --git a/src/test/java/ca/paymentrails/paymentrails/integration/BatchTest.java b/src/test/java/com/trolley/sdk/integration/BatchTest.java similarity index 94% rename from src/test/java/ca/paymentrails/paymentrails/integration/BatchTest.java rename to src/test/java/com/trolley/sdk/integration/BatchTest.java index 07aa14a..aa734fd 100644 --- a/src/test/java/ca/paymentrails/paymentrails/integration/BatchTest.java +++ b/src/test/java/com/trolley/sdk/integration/BatchTest.java @@ -1,5 +1,5 @@ -package ca.paymentrails.paymentrails.integration; +package com.trolley.sdk.integration; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -8,17 +8,17 @@ import java.util.List; import java.util.UUID; +import com.trolley.trolley.Batch; +import com.trolley.trolley.BatchSummary; +import com.trolley.trolley.Configuration; +import com.trolley.trolley.Gateway; +import com.trolley.trolley.Payment; +import com.trolley.trolley.Payments; +import com.trolley.trolley.Recipient; + import org.junit.Test; import org.powermock.core.classloader.annotations.PrepareForTest; -import ca.paymentrails.paymentrails.Batch; -import ca.paymentrails.paymentrails.BatchSummary; -import ca.paymentrails.paymentrails.Configuration; -import ca.paymentrails.paymentrails.Gateway; -import ca.paymentrails.paymentrails.Payment; -import ca.paymentrails.paymentrails.Payments; -import ca.paymentrails.paymentrails.Recipient; - @PrepareForTest(Recipient.class) public class BatchTest { diff --git a/src/test/java/ca/paymentrails/paymentrails/integration/RecipientTest.java b/src/test/java/com/trolley/sdk/integration/RecipientTest.java similarity index 96% rename from src/test/java/ca/paymentrails/paymentrails/integration/RecipientTest.java rename to src/test/java/com/trolley/sdk/integration/RecipientTest.java index a8bb357..cd46a31 100644 --- a/src/test/java/ca/paymentrails/paymentrails/integration/RecipientTest.java +++ b/src/test/java/com/trolley/sdk/integration/RecipientTest.java @@ -1,5 +1,5 @@ -package ca.paymentrails.paymentrails.integration; +package com.trolley.sdk.integration; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -7,15 +7,15 @@ import org.junit.Test; import org.powermock.core.classloader.annotations.PrepareForTest; -import ca.paymentrails.paymentrails.Address; -import ca.paymentrails.paymentrails.Configuration; -import ca.paymentrails.paymentrails.Recipient; -import ca.paymentrails.paymentrails.RecipientAccount; -import ca.paymentrails.paymentrails.Gateway; - import java.util.List; import java.util.UUID; +import com.trolley.trolley.Address; +import com.trolley.trolley.Configuration; +import com.trolley.trolley.Gateway; +import com.trolley.trolley.Recipient; +import com.trolley.trolley.RecipientAccount; + @PrepareForTest(Recipient.class) public class RecipientTest { From 920fce67b0bb42eeeca9a9f5e3c3929468f19d3f Mon Sep 17 00:00:00 2001 From: Joshua Cunningham Date: Mon, 17 Jan 2022 13:04:20 -0500 Subject: [PATCH 4/5] auto gen docs update --- .gitignore | 3 +- pom.xml | 107 +++-- pom_old.xml | 140 ++++++ src/.gitignore | 1 + .../Exceptions/AuthenticationException.java | 14 + .../Exceptions/AuthorizationException.java | 14 + .../DownForMaintenanceException.java | 14 + .../Exceptions/InvalidFieldException.java | 42 +- .../InvalidServerConnectionException.java | 14 + .../InvalidStatusCodeException.java | 14 + .../Exceptions/MalformedException.java | 14 + .../trolley/Exceptions/NotFoundException.java | 14 + .../Exceptions/TooManyRequestsException.java | 14 + .../Exceptions/UnexpectedException.java | 14 + .../java/com/trolley/trolley/Address.java | 99 ++++- .../java/com/trolley/trolley/Balances.java | 50 ++- .../com/trolley/trolley/BalancesGateway.java | 20 +- .../com/trolley/trolley/BankTransfer.java | 8 +- src/main/java/com/trolley/trolley/Batch.java | 222 ++++++++-- .../com/trolley/trolley/BatchGateway.java | 108 ++++- .../com/trolley/trolley/BatchSummary.java | 8 +- src/main/java/com/trolley/trolley/CAD.java | 68 ++- src/main/java/com/trolley/trolley/Client.java | 42 +- .../java/com/trolley/trolley/Compliance.java | 39 +- .../com/trolley/trolley/Configuration.java | 61 ++- src/main/java/com/trolley/trolley/Detail.java | 8 +- src/main/java/com/trolley/trolley/EUR.java | 69 ++- .../java/com/trolley/trolley/Gateway.java | 13 +- src/main/java/com/trolley/trolley/Meta.java | 38 +- .../java/com/trolley/trolley/Payment.java | 406 +++++++++++++++-- .../com/trolley/trolley/PaymentGateway.java | 56 ++- .../java/com/trolley/trolley/Payments.java | 28 +- .../java/com/trolley/trolley/Recipient.java | 410 ++++++++++++++++-- .../com/trolley/trolley/RecipientAccount.java | 278 +++++++++++- .../trolley/RecipientAccountGateway.java | 70 ++- .../com/trolley/trolley/RecipientGateway.java | 80 +++- src/main/java/com/trolley/trolley/Total.java | 8 +- src/main/java/com/trolley/trolley/USD.java | 68 ++- .../trolley/sdk/integration/BatchTest.java | 18 +- .../sdk/integration/RecipientTest.java | 10 +- 40 files changed, 2465 insertions(+), 239 deletions(-) create mode 100644 pom_old.xml create mode 100644 src/.gitignore diff --git a/.gitignore b/.gitignore index 70088b5..4820219 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ nbproject .project .vscode .vscode/* -src/main/java/com/trolley/trolley/index.java \ No newline at end of file +src/main/java/com/trolley/trolley/index.java +/.metadata/ diff --git a/pom.xml b/pom.xml index 3df5d36..d12ee1d 100644 --- a/pom.xml +++ b/pom.xml @@ -3,24 +3,53 @@ 4.0.0 com.trolley java-sdk - 1.0.1 + 1.0 Java SDK for Trolley API jar Trolley Java SDK + https://github.com/PaymentRails/java-sdk + + + + The MIT License + https://raw.githubusercontent.com/ConvertAPI/convertapi-java/master/LICENSE.txt + repo + + + + + + joshuapr + Joshua Cunningham + joshua@paymentrails.com + Trolley + https://www.trolley.com/ + + architect + developer + + + + + scm:git:git://github.com/PaymentRails/java-sdk.git + scm:git:git://github.com/PaymentRails/java-sdk.git + https://github.com/PaymentRails/java-sdk + HEAD + - UTF-8 - 8 - 8 - 1.6.6 + + 1.8 + 1.8 + ossrh - https://oss.sonatype.org/content/repositories/snapshots + https://s01.oss.sonatype.org/content/repositories/snapshots ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ + https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ @@ -32,7 +61,7 @@ true ossrh - https://oss.sonatype.org/ + https://s01.oss.sonatype.org/ true @@ -73,60 +102,58 @@ sign + + + --pinentry-mode + loopback + + + + + org.apache.httpcomponents httpclient - 4.5.3 + 4.5.13 + - junit - junit - 4.13.1 - test - - - org.hamcrest - hamcrest-core - 1.3 - test + com.fasterxml.jackson.core + jackson-annotations + LATEST + - org.mockito - mockito-core - 1.10.19 + com.fasterxml.jackson.core + jackson-core + LATEST + - org.powermock - powermock-module-junit4 - ${powermock.version} - test + com.fasterxml.jackson.core + jackson-databind + LATEST + org.powermock powermock-api-mockito - ${powermock.version} + 1.6.6 test + + - com.fasterxml.jackson.core - jackson-databind - 2.9.10.1 - - - com.fasterxml.jackson.core - jackson-annotations - LATEST - - - com.fasterxml.jackson.core - jackson-core - LATEST + junit + junit + 4.13.2 + \ No newline at end of file diff --git a/pom_old.xml b/pom_old.xml new file mode 100644 index 0000000..0e8dcc0 --- /dev/null +++ b/pom_old.xml @@ -0,0 +1,140 @@ + + + 4.0.0 + com.trolley + java-sdk + 1.0.1 + Java SDK for Trolley API + jar + Trolley Java SDK + + UTF-8 + 8 + 8 + 1.6.6 + + + + ossrh + https://s01.oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.7 + true + + ossrh + https://s01.oss.sonatype.org/ + true + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + --pinentry-mode + loopback + + + + + + + + + + + + org.apache.httpcomponents + httpclient + 4.5.13 + + + junit + junit + 4.13.1 + test + + + + + org.powermock + powermock-module-junit4 + ${powermock.version} + test + + + org.powermock + powermock-api-mockito + ${powermock.version} + test + + + com.fasterxml.jackson.core + jackson-databind + 2.13.1 + + + com.fasterxml.jackson.core + jackson-annotations + LATEST + + + com.fasterxml.jackson.core + jackson-core + LATEST + + + \ No newline at end of file diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000..ae3c172 --- /dev/null +++ b/src/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/src/main/java/com/trolley/Exceptions/AuthenticationException.java b/src/main/java/com/trolley/Exceptions/AuthenticationException.java index 1d8d878..6b8cd96 100644 --- a/src/main/java/com/trolley/Exceptions/AuthenticationException.java +++ b/src/main/java/com/trolley/Exceptions/AuthenticationException.java @@ -1,11 +1,25 @@ package com.trolley.Exceptions; +/** + *

AuthenticationException class.

+ * + * @author joshua + * @version $Id: $Id + */ public class AuthenticationException extends Exception { + /** + *

Constructor for AuthenticationException.

+ */ public AuthenticationException() { super(); } + /** + *

Constructor for AuthenticationException.

+ * + * @param message a {@link java.lang.String} object. + */ public AuthenticationException(String message) { super(message); } diff --git a/src/main/java/com/trolley/Exceptions/AuthorizationException.java b/src/main/java/com/trolley/Exceptions/AuthorizationException.java index 657bb92..c31e958 100644 --- a/src/main/java/com/trolley/Exceptions/AuthorizationException.java +++ b/src/main/java/com/trolley/Exceptions/AuthorizationException.java @@ -1,11 +1,25 @@ package com.trolley.Exceptions; +/** + *

AuthorizationException class.

+ * + * @author joshua + * @version $Id: $Id + */ public class AuthorizationException extends Exception { + /** + *

Constructor for AuthorizationException.

+ */ public AuthorizationException() { super(); } + /** + *

Constructor for AuthorizationException.

+ * + * @param message a {@link java.lang.String} object. + */ public AuthorizationException(String message) { super(message); } diff --git a/src/main/java/com/trolley/Exceptions/DownForMaintenanceException.java b/src/main/java/com/trolley/Exceptions/DownForMaintenanceException.java index 9eade2a..5b30a12 100644 --- a/src/main/java/com/trolley/Exceptions/DownForMaintenanceException.java +++ b/src/main/java/com/trolley/Exceptions/DownForMaintenanceException.java @@ -1,11 +1,25 @@ package com.trolley.Exceptions; +/** + *

DownForMaintenanceException class.

+ * + * @author joshua + * @version $Id: $Id + */ public class DownForMaintenanceException extends Exception { + /** + *

Constructor for DownForMaintenanceException.

+ */ public DownForMaintenanceException() { super(); } + /** + *

Constructor for DownForMaintenanceException.

+ * + * @param message a {@link java.lang.String} object. + */ public DownForMaintenanceException(String message) { super(message); } diff --git a/src/main/java/com/trolley/Exceptions/InvalidFieldException.java b/src/main/java/com/trolley/Exceptions/InvalidFieldException.java index 895f75f..9ca62d4 100644 --- a/src/main/java/com/trolley/Exceptions/InvalidFieldException.java +++ b/src/main/java/com/trolley/Exceptions/InvalidFieldException.java @@ -1,14 +1,28 @@ - -package com.trolley.Exceptions; - -public class InvalidFieldException extends Exception { - - public InvalidFieldException() { - super(); - } - - public InvalidFieldException(String message) { - super(message); - } - -} + +package com.trolley.Exceptions; + +/** + *

InvalidFieldException class.

+ * + * @author joshua + * @version $Id: $Id + */ +public class InvalidFieldException extends Exception { + + /** + *

Constructor for InvalidFieldException.

+ */ + public InvalidFieldException() { + super(); + } + + /** + *

Constructor for InvalidFieldException.

+ * + * @param message a {@link java.lang.String} object. + */ + public InvalidFieldException(String message) { + super(message); + } + +} diff --git a/src/main/java/com/trolley/Exceptions/InvalidServerConnectionException.java b/src/main/java/com/trolley/Exceptions/InvalidServerConnectionException.java index 4d77eb0..4ccf2ad 100644 --- a/src/main/java/com/trolley/Exceptions/InvalidServerConnectionException.java +++ b/src/main/java/com/trolley/Exceptions/InvalidServerConnectionException.java @@ -1,11 +1,25 @@ package com.trolley.Exceptions; +/** + *

InvalidServerConnectionException class.

+ * + * @author joshua + * @version $Id: $Id + */ public class InvalidServerConnectionException extends Exception { + /** + *

Constructor for InvalidServerConnectionException.

+ */ public InvalidServerConnectionException() { super(); } + /** + *

Constructor for InvalidServerConnectionException.

+ * + * @param message a {@link java.lang.String} object. + */ public InvalidServerConnectionException(String message) { super(message); } diff --git a/src/main/java/com/trolley/Exceptions/InvalidStatusCodeException.java b/src/main/java/com/trolley/Exceptions/InvalidStatusCodeException.java index 3c1e29f..cbd8524 100644 --- a/src/main/java/com/trolley/Exceptions/InvalidStatusCodeException.java +++ b/src/main/java/com/trolley/Exceptions/InvalidStatusCodeException.java @@ -1,11 +1,25 @@ package com.trolley.Exceptions; +/** + *

InvalidStatusCodeException class.

+ * + * @author joshua + * @version $Id: $Id + */ public class InvalidStatusCodeException extends Exception { + /** + *

Constructor for InvalidStatusCodeException.

+ */ public InvalidStatusCodeException() { super(); } + /** + *

Constructor for InvalidStatusCodeException.

+ * + * @param message a {@link java.lang.String} object. + */ public InvalidStatusCodeException(String message) { super(message); } diff --git a/src/main/java/com/trolley/Exceptions/MalformedException.java b/src/main/java/com/trolley/Exceptions/MalformedException.java index e141196..cc1d8f0 100644 --- a/src/main/java/com/trolley/Exceptions/MalformedException.java +++ b/src/main/java/com/trolley/Exceptions/MalformedException.java @@ -1,11 +1,25 @@ package com.trolley.Exceptions; +/** + *

MalformedException class.

+ * + * @author joshua + * @version $Id: $Id + */ public class MalformedException extends Exception { + /** + *

Constructor for MalformedException.

+ */ public MalformedException() { super(); } + /** + *

Constructor for MalformedException.

+ * + * @param message a {@link java.lang.String} object. + */ public MalformedException(String message) { super(message); } diff --git a/src/main/java/com/trolley/Exceptions/NotFoundException.java b/src/main/java/com/trolley/Exceptions/NotFoundException.java index 5218c4f..bdaeef6 100644 --- a/src/main/java/com/trolley/Exceptions/NotFoundException.java +++ b/src/main/java/com/trolley/Exceptions/NotFoundException.java @@ -1,11 +1,25 @@ package com.trolley.Exceptions; +/** + *

NotFoundException class.

+ * + * @author joshua + * @version $Id: $Id + */ public class NotFoundException extends Exception { + /** + *

Constructor for NotFoundException.

+ */ public NotFoundException() { super(); } + /** + *

Constructor for NotFoundException.

+ * + * @param message a {@link java.lang.String} object. + */ public NotFoundException(String message) { super(message); } diff --git a/src/main/java/com/trolley/Exceptions/TooManyRequestsException.java b/src/main/java/com/trolley/Exceptions/TooManyRequestsException.java index c130625..1ceb7a9 100644 --- a/src/main/java/com/trolley/Exceptions/TooManyRequestsException.java +++ b/src/main/java/com/trolley/Exceptions/TooManyRequestsException.java @@ -1,11 +1,25 @@ package com.trolley.Exceptions; +/** + *

TooManyRequestsException class.

+ * + * @author joshua + * @version $Id: $Id + */ public class TooManyRequestsException extends Exception { + /** + *

Constructor for TooManyRequestsException.

+ */ public TooManyRequestsException() { super(); } + /** + *

Constructor for TooManyRequestsException.

+ * + * @param message a {@link java.lang.String} object. + */ public TooManyRequestsException(String message) { super(message); } diff --git a/src/main/java/com/trolley/Exceptions/UnexpectedException.java b/src/main/java/com/trolley/Exceptions/UnexpectedException.java index 46288a4..34bd3b1 100644 --- a/src/main/java/com/trolley/Exceptions/UnexpectedException.java +++ b/src/main/java/com/trolley/Exceptions/UnexpectedException.java @@ -1,11 +1,25 @@ package com.trolley.Exceptions; +/** + *

UnexpectedException class.

+ * + * @author joshua + * @version $Id: $Id + */ public class UnexpectedException extends Exception { + /** + *

Constructor for UnexpectedException.

+ */ public UnexpectedException() { super(); } + /** + *

Constructor for UnexpectedException.

+ * + * @param message a {@link java.lang.String} object. + */ public UnexpectedException(String message) { super(message); } diff --git a/src/main/java/com/trolley/trolley/Address.java b/src/main/java/com/trolley/trolley/Address.java index 213a7b6..cbab7d6 100644 --- a/src/main/java/com/trolley/trolley/Address.java +++ b/src/main/java/com/trolley/trolley/Address.java @@ -3,6 +3,12 @@ import java.util.HashMap; import java.util.Map; +/** + *

Address class.

+ * + * @author joshua + * @version $Id: $Id + */ public class Address { private String street1; private String street2; @@ -14,75 +20,166 @@ public class Address { private Boolean phoneValidated; private Map additionalProperties = new HashMap(); + /** + *

Getter for the field street1.

+ * + * @return a {@link java.lang.String} object. + */ public String getStreet1() { return street1; } + /** + *

Setter for the field street1.

+ * + * @param street1 a {@link java.lang.String} object. + */ public void setStreet1(String street1) { this.street1 = street1; } + /** + *

Getter for the field street2.

+ * + * @return a {@link java.lang.String} object. + */ public String getStreet2() { return street2; } + /** + *

Setter for the field street2.

+ * + * @param street2 a {@link java.lang.String} object. + */ public void setStreet2(String street2) { this.street2 = street2; } + /** + *

Getter for the field city.

+ * + * @return a {@link java.lang.String} object. + */ public String getCity() { return city; } + /** + *

Setter for the field city.

+ * + * @param city a {@link java.lang.String} object. + */ public void setCity(String city) { this.city = city; } + /** + *

Getter for the field postalCode.

+ * + * @return a {@link java.lang.String} object. + */ public String getPostalCode() { return postalCode; } + /** + *

Setter for the field postalCode.

+ * + * @param postalCode a {@link java.lang.String} object. + */ public void setPostalCode(String postalCode) { this.postalCode = postalCode; } + /** + *

Getter for the field country.

+ * + * @return a {@link java.lang.String} object. + */ public String getCountry() { return country; } + /** + *

Setter for the field country.

+ * + * @param country a {@link java.lang.String} object. + */ public void setCountry(String country) { this.country = country; } + /** + *

Getter for the field region.

+ * + * @return a {@link java.lang.String} object. + */ public String getRegion() { return region; } + /** + *

Setter for the field region.

+ * + * @param region a {@link java.lang.String} object. + */ public void setRegion(String region) { this.region = region; } + /** + *

Getter for the field phone.

+ * + * @return a {@link java.lang.String} object. + */ public String getPhone() { return phone; } + /** + *

Setter for the field phone.

+ * + * @param phone a {@link java.lang.String} object. + */ public void setPhone(String phone) { this.phone = phone; } + /** + *

Getter for the field phoneValidated.

+ * + * @return a {@link java.lang.Boolean} object. + */ public Boolean getPhoneValidated() { return phoneValidated; } + /** + *

Setter for the field phoneValidated.

+ * + * @param phoneValidated a {@link java.lang.Boolean} object. + */ public void setPhoneValidated(Boolean phoneValidated) { this.phoneValidated = phoneValidated; } + /** + *

Getter for the field additionalProperties.

+ * + * @return a {@link java.util.Map} object. + */ public Map getAdditionalProperties() { return this.additionalProperties; } + /** + *

setAdditionalProperty.

+ * + * @param name a {@link java.lang.String} object. + * @param value a {@link java.lang.Object} object. + */ public void setAdditionalProperty(String name, Object value) { this.additionalProperties.put(name, value); } -} \ No newline at end of file +} diff --git a/src/main/java/com/trolley/trolley/Balances.java b/src/main/java/com/trolley/trolley/Balances.java index 3b3706d..e62907c 100644 --- a/src/main/java/com/trolley/trolley/Balances.java +++ b/src/main/java/com/trolley/trolley/Balances.java @@ -1,5 +1,11 @@ package com.trolley.trolley; +/** + *

Balances class.

+ * + * @author joshua + * @version $Id: $Id + */ public class Balances { public EUR EUR; @@ -8,26 +14,56 @@ public class Balances { public CAD CAD; + /** + *

getEUR.

+ * + * @return a {@link com.trolley.trolley.EUR} object. + */ public EUR getEUR() { return EUR; } + /** + *

setEUR.

+ * + * @param EUR a {@link com.trolley.trolley.EUR} object. + */ public void setEUR(EUR EUR) { this.EUR = EUR; } + /** + *

getUSD.

+ * + * @return a {@link com.trolley.trolley.USD} object. + */ public USD getUSD() { return USD; } + /** + *

setUSD.

+ * + * @param USD a {@link com.trolley.trolley.USD} object. + */ public void setUSD(USD USD) { this.USD = USD; } + /** + *

getCAD.

+ * + * @return a {@link com.trolley.trolley.CAD} object. + */ public CAD getCAD() { return CAD; } + /** + *

setCAD.

+ * + * @param CAD a {@link com.trolley.trolley.CAD} object. + */ public void setCAD(CAD CAD) { this.CAD = CAD; } @@ -36,9 +72,10 @@ public void setCAD(CAD CAD) { * Retrieves all account balances * * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidFieldException - * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws java.lang.Exception if any. */ public static String find() throws Exception { return find(""); @@ -49,9 +86,10 @@ public static String find() throws Exception { * * @param term (paypal or trolley) * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidFieldException - * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws java.lang.Exception if any. */ public static String find(String term) throws Exception { return Configuration.gateway().balances.find(term); diff --git a/src/main/java/com/trolley/trolley/BalancesGateway.java b/src/main/java/com/trolley/trolley/BalancesGateway.java index f11b06b..411750e 100644 --- a/src/main/java/com/trolley/trolley/BalancesGateway.java +++ b/src/main/java/com/trolley/trolley/BalancesGateway.java @@ -2,13 +2,31 @@ import com.trolley.Exceptions.InvalidFieldException; +/** + *

BalancesGateway class.

+ * + * @author joshua + * @version $Id: $Id + */ public class BalancesGateway { Client client; + /** + *

Constructor for BalancesGateway.

+ * + * @param config a {@link com.trolley.trolley.Configuration} object. + */ public BalancesGateway(Configuration config) { this.client = new Client(config); } + /** + *

find.

+ * + * @param term a {@link java.lang.String} object. + * @return a {@link java.lang.String} object. + * @throws java.lang.Exception if any. + */ public String find(String term) throws Exception { if (term == null) { throw new InvalidFieldException("Term cannot be null"); @@ -17,4 +35,4 @@ public String find(String term) throws Exception { String response = this.client.get(endPoint); return response; } -} \ No newline at end of file +} diff --git a/src/main/java/com/trolley/trolley/BankTransfer.java b/src/main/java/com/trolley/trolley/BankTransfer.java index 594d7fe..c426eea 100644 --- a/src/main/java/com/trolley/trolley/BankTransfer.java +++ b/src/main/java/com/trolley/trolley/BankTransfer.java @@ -1,5 +1,11 @@ package com.trolley.trolley; +/** + *

BankTransfer class.

+ * + * @author joshua + * @version $Id: $Id + */ public class BankTransfer { public Integer count; @@ -7,4 +13,4 @@ public class BankTransfer { public String merchantFees; public String debitAmount; public String sendingAmount; -} \ No newline at end of file +} diff --git a/src/main/java/com/trolley/trolley/Batch.java b/src/main/java/com/trolley/trolley/Batch.java index c0c8e5e..3930e1c 100644 --- a/src/main/java/com/trolley/trolley/Batch.java +++ b/src/main/java/com/trolley/trolley/Batch.java @@ -4,6 +4,12 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; +/** + *

Batch class.

+ * + * @author joshua + * @version $Id: $Id + */ @JsonInclude(Include.NON_NULL) public class Batch { @@ -22,90 +28,200 @@ public class Batch { public String quoteExpiredAt; + /** + *

Getter for the field id.

+ * + * @return a {@link java.lang.String} object. + */ public String getId() { return id; } + /** + *

Setter for the field id.

+ * + * @param id a {@link java.lang.String} object. + */ public void setId(String id) { this.id = id; } + /** + *

Getter for the field status.

+ * + * @return a {@link java.lang.String} object. + */ public String getStatus() { return status; } + /** + *

Setter for the field status.

+ * + * @param status a {@link java.lang.String} object. + */ public void setStatus(String status) { this.status = status; } + /** + *

Getter for the field amount.

+ * + * @return a {@link java.lang.String} object. + */ public String getAmount() { return amount; } + /** + *

Setter for the field amount.

+ * + * @param amount a {@link java.lang.String} object. + */ public void setAmount(String amount) { this.amount = amount; } + /** + *

Getter for the field totalPayments.

+ * + * @return a {@link java.lang.Integer} object. + */ public Integer getTotalPayments() { return totalPayments; } + /** + *

Setter for the field totalPayments.

+ * + * @param totalPayments a {@link java.lang.Integer} object. + */ public void setTotalPayments(Integer totalPayments) { this.totalPayments = totalPayments; } + /** + *

Getter for the field currency.

+ * + * @return a {@link java.lang.String} object. + */ public String getCurrency() { return currency; } + /** + *

Setter for the field currency.

+ * + * @param currency a {@link java.lang.String} object. + */ public void setCurrency(String currency) { this.currency = currency; } + /** + *

Getter for the field description.

+ * + * @return a {@link java.lang.String} object. + */ public String getDescription() { return description; } + /** + *

Setter for the field description.

+ * + * @param description a {@link java.lang.String} object. + */ public void setDescription(String description) { this.description = description; } + /** + *

Getter for the field sentAt.

+ * + * @return a {@link java.lang.Object} object. + */ public Object getSentAt() { return sentAt; } + /** + *

Setter for the field sentAt.

+ * + * @param sentAt a {@link java.lang.Object} object. + */ public void setSentAt(Object sentAt) { this.sentAt = sentAt; } + /** + *

Getter for the field completedAt.

+ * + * @return a {@link java.lang.Object} object. + */ public Object getCompletedAt() { return completedAt; } + /** + *

Setter for the field completedAt.

+ * + * @param completedAt a {@link java.lang.Object} object. + */ public void setCompletedAt(Object completedAt) { this.completedAt = completedAt; } + /** + *

Getter for the field createdAt.

+ * + * @return a {@link java.lang.String} object. + */ public String getCreatedAt() { return createdAt; } + /** + *

Setter for the field createdAt.

+ * + * @param createdAt a {@link java.lang.String} object. + */ public void setCreatedAt(String createdAt) { this.createdAt = createdAt; } + /** + *

Getter for the field updatedAt.

+ * + * @return a {@link java.lang.String} object. + */ public String getUpdatedAt() { return updatedAt; } + /** + *

Setter for the field updatedAt.

+ * + * @param updatedAt a {@link java.lang.String} object. + */ public void setUpdatedAt(String updatedAt) { this.updatedAt = updatedAt; } + /** + *

Getter for the field payments.

+ * + * @return a {@link java.util.List} object. + */ public List getPayments() { return payments; } + /** + *

Setter for the field payments.

+ * + * @param payments a {@link java.util.List} object. + */ public void setPayments(List payments) { this.payments = payments; } @@ -113,11 +229,12 @@ public void setPayments(List payments) { /** * Retrieves a batch based on the batch id given * - * @param batch_id + * @param batch_id a {@link java.lang.String} object. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidFieldException - * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws java.lang.Exception if any. */ public static Batch find(String batch_id) throws Exception { return Configuration.gateway().batch.find(batch_id); @@ -126,12 +243,13 @@ public static Batch find(String batch_id) throws Exception { /** * Updates a batch based on the batch id and body * - * @param batch_id - * @param body + * @param batch_id a {@link java.lang.String} object. + * @param body a {@link java.lang.String} object. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidFieldException - * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws java.lang.Exception if any. */ public static boolean update(String batch_id, String body) throws Exception { return Configuration.gateway().batch.update(batch_id, body); @@ -140,11 +258,12 @@ public static boolean update(String batch_id, String body) throws Exception { /** * Deletes a batch based on batch id * - * @param batch_id + * @param batch_id a {@link java.lang.String} object. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidFieldException - * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws java.lang.Exception if any. */ public static boolean delete(String batch_id) throws Exception { return Configuration.gateway().batch.delete(batch_id); @@ -153,16 +272,24 @@ public static boolean delete(String batch_id) throws Exception { /** * Creates a batch based on batch the body * - * @param body + * @param body a {@link java.lang.String} object. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidFieldException - * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws java.lang.Exception if any. */ public static Batch create(String body) throws Exception { return Configuration.gateway().batch.create(body); } + /** + *

create.

+ * + * @param body a {@link com.trolley.trolley.Batch} object. + * @return a {@link com.trolley.trolley.Batch} object. + * @throws java.lang.Exception if any. + */ public static Batch create(Batch body) throws Exception { return Configuration.gateway().batch.create(body); } @@ -170,11 +297,12 @@ public static Batch create(Batch body) throws Exception { /** * Generate a quote for a batch * - * @param batch_id + * @param batch_id a {@link java.lang.String} object. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidFieldException - * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws java.lang.Exception if any. */ public static String generateQuote(String batch_id) throws Exception { return Configuration.gateway().batch.generateQuote(batch_id); @@ -183,11 +311,12 @@ public static String generateQuote(String batch_id) throws Exception { /** * Process a batch * - * @param batch_id + * @param batch_id a {@link java.lang.String} object. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidFieldException - * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws java.lang.Exception if any. */ public static String processBatch(String batch_id) throws Exception { return Configuration.gateway().batch.processBatch(batch_id); @@ -199,11 +328,13 @@ public static String processBatch(String batch_id) throws Exception { * * @param page * @param pageSize - * @param message + * @param pageSize a int. + * @param message a {@link java.lang.String} object. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidConnectionException - * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws java.lang.Exception if any. */ public static List query(int page, int pageSize, String message) throws Exception { return Configuration.gateway().batch.query(page, pageSize, message); @@ -213,11 +344,12 @@ public static List query(int page, int pageSize, String message) throws E /** * List all batches based on the recipient id and a given wildcard * - * @param message + * @param message a {@link java.lang.String} object. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidConnectionException - * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws java.lang.Exception if any. */ public static List query(String message) throws Exception { return query(1, 10, message); @@ -227,9 +359,10 @@ public static List query(String message) throws Exception { * List all batches * * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidConnectionException - * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws java.lang.Exception if any. */ public static List query() throws Exception { return query(1, 10, ""); @@ -241,10 +374,12 @@ public static List query() throws Exception { * * @param page * @param pageNumber + * @param pageNumber a int. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidConnectionException - * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws java.lang.Exception if any. */ public static List query(int page, int pageNumber) throws Exception { return query(page, pageNumber, ""); @@ -253,11 +388,12 @@ public static List query(int page, int pageNumber) throws Exception { /** * Retrieves summary of batch * - * @param batch_id + * @param batch_id a {@link java.lang.String} object. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidFieldException - * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws java.lang.Exception if any. */ public static BatchSummary summary(String batch_id) throws Exception { return Configuration.gateway().batch.summary(batch_id); diff --git a/src/main/java/com/trolley/trolley/BatchGateway.java b/src/main/java/com/trolley/trolley/BatchGateway.java index c9bba8c..b3dd78a 100644 --- a/src/main/java/com/trolley/trolley/BatchGateway.java +++ b/src/main/java/com/trolley/trolley/BatchGateway.java @@ -8,13 +8,31 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.trolley.Exceptions.InvalidFieldException; +/** + *

BatchGateway class.

+ * + * @author joshua + * @version $Id: $Id + */ public class BatchGateway { Client client; + /** + *

Constructor for BatchGateway.

+ * + * @param config a {@link com.trolley.trolley.Configuration} object. + */ public BatchGateway(Configuration config) { this.client = new Client(config); } + /** + *

find.

+ * + * @param batch_id a {@link java.lang.String} object. + * @return a {@link com.trolley.trolley.Batch} object. + * @throws java.lang.Exception if any. + */ public Batch find(String batch_id) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); @@ -25,6 +43,14 @@ public Batch find(String batch_id) throws Exception { return batchFactory(response); } + /** + *

update.

+ * + * @param batch_id a {@link java.lang.String} object. + * @param body a {@link java.lang.String} object. + * @return a boolean. + * @throws java.lang.Exception if any. + */ public boolean update(String batch_id, String body) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); @@ -38,6 +64,14 @@ public boolean update(String batch_id, String body) throws Exception { return true; } + /** + *

update.

+ * + * @param batch_id a {@link java.lang.String} object. + * @param batch a {@link com.trolley.trolley.Batch} object. + * @return a boolean. + * @throws java.lang.Exception if any. + */ public boolean update(String batch_id, Batch batch) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); @@ -54,6 +88,13 @@ public boolean update(String batch_id, Batch batch) throws Exception { return true; } + /** + *

delete.

+ * + * @param batch_id a {@link java.lang.String} object. + * @return a boolean. + * @throws java.lang.Exception if any. + */ public boolean delete(String batch_id) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); @@ -64,6 +105,13 @@ public boolean delete(String batch_id) throws Exception { return true; } + /** + *

create.

+ * + * @param body a {@link java.lang.String} object. + * @return a {@link com.trolley.trolley.Batch} object. + * @throws java.lang.Exception if any. + */ public Batch create(String body) throws Exception { if (body == null || body.isEmpty()) { throw new InvalidFieldException("Body cannot be null or empty."); @@ -74,6 +122,13 @@ public Batch create(String body) throws Exception { return batchFactory(response); } + /** + *

create.

+ * + * @param batch a {@link com.trolley.trolley.Batch} object. + * @return a {@link com.trolley.trolley.Batch} object. + * @throws java.lang.Exception if any. + */ public Batch create(Batch batch) throws Exception { if (batch == null) { throw new InvalidFieldException("Batch cannot be null."); @@ -86,6 +141,13 @@ public Batch create(Batch batch) throws Exception { return batchFactory(response); } + /** + *

generateQuote.

+ * + * @param batch_id a {@link java.lang.String} object. + * @return a {@link java.lang.String} object. + * @throws java.lang.Exception if any. + */ public String generateQuote(String batch_id) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); @@ -96,6 +158,13 @@ public String generateQuote(String batch_id) throws Exception { return response; } + /** + *

processBatch.

+ * + * @param batch_id a {@link java.lang.String} object. + * @return a {@link java.lang.String} object. + * @throws java.lang.Exception if any. + */ public String processBatch(String batch_id) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); @@ -105,6 +174,15 @@ public String processBatch(String batch_id) throws Exception { return response; } + /** + *

query.

+ * + * @param page a int. + * @param pageSize a int. + * @param message a {@link java.lang.String} object. + * @return a {@link java.util.List} object. + * @throws java.lang.Exception if any. + */ public List query(int page, int pageSize, String message) throws Exception { if (page < 0) { throw new InvalidFieldException("Page cannot be less than 0"); @@ -120,18 +198,46 @@ public List query(int page, int pageSize, String message) throws Exceptio return batchListFactory(response); } + /** + *

query.

+ * + * @param message a {@link java.lang.String} object. + * @return a {@link java.util.List} object. + * @throws java.lang.Exception if any. + */ public List query(String message) throws Exception { return query(1, 10, message); } + /** + *

query.

+ * + * @return a {@link java.util.List} object. + * @throws java.lang.Exception if any. + */ public List query() throws Exception { return query(1, 10, ""); } + /** + *

query.

+ * + * @param page a int. + * @param pageNumber a int. + * @return a {@link java.util.List} object. + * @throws java.lang.Exception if any. + */ public List query(int page, int pageNumber) throws Exception { return query(page, pageNumber, ""); } + /** + *

summary.

+ * + * @param batch_id a {@link java.lang.String} object. + * @return a {@link com.trolley.trolley.BatchSummary} object. + * @throws java.lang.Exception if any. + */ public BatchSummary summary(String batch_id) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null os empty"); @@ -184,4 +290,4 @@ private List batchListFactory(String data) throws IOException { } return batches; } -} \ No newline at end of file +} diff --git a/src/main/java/com/trolley/trolley/BatchSummary.java b/src/main/java/com/trolley/trolley/BatchSummary.java index db3d5c3..45bdf6b 100644 --- a/src/main/java/com/trolley/trolley/BatchSummary.java +++ b/src/main/java/com/trolley/trolley/BatchSummary.java @@ -1,8 +1,14 @@ package com.trolley.trolley; +/** + *

BatchSummary class.

+ * + * @author joshua + * @version $Id: $Id + */ public class BatchSummary { public Total total; public Detail detail; -} \ No newline at end of file +} diff --git a/src/main/java/com/trolley/trolley/CAD.java b/src/main/java/com/trolley/trolley/CAD.java index cf76f1a..f791937 100644 --- a/src/main/java/com/trolley/trolley/CAD.java +++ b/src/main/java/com/trolley/trolley/CAD.java @@ -1,5 +1,11 @@ package com.trolley.trolley; +/** + *

CAD class.

+ * + * @author joshua + * @version $Id: $Id + */ public class CAD { private Boolean primary; @@ -9,52 +15,112 @@ public class CAD { private String accountNumber; private Boolean display; + /** + *

Getter for the field primary.

+ * + * @return a {@link java.lang.Boolean} object. + */ public Boolean getPrimary() { return primary; } + /** + *

Setter for the field primary.

+ * + * @param primary a {@link java.lang.Boolean} object. + */ public void setPrimary(Boolean primary) { this.primary = primary; } + /** + *

Getter for the field amount.

+ * + * @return a {@link java.lang.String} object. + */ public String getAmount() { return amount; } + /** + *

Setter for the field amount.

+ * + * @param amount a {@link java.lang.String} object. + */ public void setAmount(String amount) { this.amount = amount; } + /** + *

Getter for the field currency.

+ * + * @return a {@link java.lang.String} object. + */ public String getCurrency() { return currency; } + /** + *

Setter for the field currency.

+ * + * @param currency a {@link java.lang.String} object. + */ public void setCurrency(String currency) { this.currency = currency; } + /** + *

Getter for the field type.

+ * + * @return a {@link java.lang.String} object. + */ public String getType() { return type; } + /** + *

Setter for the field type.

+ * + * @param type a {@link java.lang.String} object. + */ public void setType(String type) { this.type = type; } + /** + *

Getter for the field accountNumber.

+ * + * @return a {@link java.lang.String} object. + */ public String getAccountNumber() { return accountNumber; } + /** + *

Setter for the field accountNumber.

+ * + * @param accountNumber a {@link java.lang.String} object. + */ public void setAccountNumber(String accountNumber) { this.accountNumber = accountNumber; } + /** + *

Getter for the field display.

+ * + * @return a {@link java.lang.Boolean} object. + */ public Boolean getDisplay() { return display; } + /** + *

Setter for the field display.

+ * + * @param display a {@link java.lang.Boolean} object. + */ public void setDisplay(Boolean display) { this.display = display; } -} \ No newline at end of file +} diff --git a/src/main/java/com/trolley/trolley/Client.java b/src/main/java/com/trolley/trolley/Client.java index ee40d08..f12a549 100644 --- a/src/main/java/com/trolley/trolley/Client.java +++ b/src/main/java/com/trolley/trolley/Client.java @@ -19,10 +19,21 @@ import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.HttpClients; +/** + *

Client class.

+ * + * @author joshua + * @version $Id: $Id + */ public class Client { private Configuration config; + /** + *

Constructor for Client.

+ * + * @param config a {@link com.trolley.trolley.Configuration} object. + */ public Client(Configuration config) { this.config = config; } @@ -31,6 +42,7 @@ public Client(Configuration config) { * Factory Method to create an instance of Client * * @return Client + * @param config a {@link com.trolley.trolley.Configuration} object. */ public static Client create(Configuration config) { return new Client(config); @@ -90,9 +102,9 @@ private String sendRequest(String method, String endPoint) throws Exception { /** * Makes an HTTP GET request to the API * - * @param endPoint + * @param endPoint a {@link java.lang.String} object. * @return The response - * @throws Exception + * @throws java.lang.Exception if any. */ public String get(String endPoint) throws Exception { return sendRequest("GET", endPoint); @@ -101,10 +113,10 @@ public String get(String endPoint) throws Exception { /** * Makes an HTTP POST request to the API * - * @param endPoint - * @param body + * @param endPoint a {@link java.lang.String} object. + * @param body a {@link java.lang.String} object. * @return The response - * @throws Exception + * @throws java.lang.Exception if any. */ public String post(String endPoint, String body) throws Exception { return sendRequest("POST", endPoint, body); @@ -119,9 +131,9 @@ public String post(String endPoint, String body) throws Exception { /** * Makes an HTTP POST request to the API * - * @param endPoint + * @param endPoint a {@link java.lang.String} object. * @return The response - * @throws Exception + * @throws java.lang.Exception if any. */ public String post(String endPoint) throws Exception { return sendRequest("POST", endPoint); @@ -129,11 +141,12 @@ public String post(String endPoint) throws Exception { /** * Makes an HTTP PATCH request to the API * - * @param endPoint - * @param body + * @param endPoint a {@link java.lang.String} object. + * @param body a {@link java.lang.String} object. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws java.lang.Exception if any. */ public String patch(String endPoint, String body) throws Exception { String StringResponse = ""; @@ -177,10 +190,11 @@ public String patch(String endPoint, String body) throws Exception { /** * Makes an HTTP DELETE request to the API * - * @param endPoint + * @param endPoint a {@link java.lang.String} object. * @return The response - * @throws InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws java.lang.Exception if any. */ public String delete(String endPoint) throws Exception { return sendRequest("DELETE", endPoint); diff --git a/src/main/java/com/trolley/trolley/Compliance.java b/src/main/java/com/trolley/trolley/Compliance.java index 74dca5d..7927dfe 100644 --- a/src/main/java/com/trolley/trolley/Compliance.java +++ b/src/main/java/com/trolley/trolley/Compliance.java @@ -3,33 +3,70 @@ import java.util.HashMap; import java.util.Map; +/** + *

Compliance class.

+ * + * @author joshua + * @version $Id: $Id + */ public class Compliance { private String status; private Object checkedAt; private Map additionalProperties = new HashMap(); + /** + *

Getter for the field status.

+ * + * @return a {@link java.lang.String} object. + */ public String getStatus() { return status; } + /** + *

Setter for the field status.

+ * + * @param status a {@link java.lang.String} object. + */ public void setStatus(String status) { this.status = status; } + /** + *

Getter for the field checkedAt.

+ * + * @return a {@link java.lang.Object} object. + */ public Object getCheckedAt() { return checkedAt; } + /** + *

Setter for the field checkedAt.

+ * + * @param checkedAt a {@link java.lang.Object} object. + */ public void setCheckedAt(Object checkedAt) { this.checkedAt = checkedAt; } + /** + *

Getter for the field additionalProperties.

+ * + * @return a {@link java.util.Map} object. + */ public Map getAdditionalProperties() { return this.additionalProperties; } + /** + *

setAdditionalProperty.

+ * + * @param name a {@link java.lang.String} object. + * @param value a {@link java.lang.Object} object. + */ public void setAdditionalProperty(String name, Object value) { this.additionalProperties.put(name, value); } -} \ No newline at end of file +} diff --git a/src/main/java/com/trolley/trolley/Configuration.java b/src/main/java/com/trolley/trolley/Configuration.java index b69e835..6c97214 100644 --- a/src/main/java/com/trolley/trolley/Configuration.java +++ b/src/main/java/com/trolley/trolley/Configuration.java @@ -1,17 +1,39 @@ package com.trolley.trolley; +/** + *

Configuration class.

+ * + * @author joshua + * @version $Id: $Id + */ public class Configuration { String apiBase = "https://api.paymentrails.com"; String privateKey = ""; String publicKey = ""; + /** + *

Constructor for Configuration.

+ */ public Configuration() { } + /** + *

Constructor for Configuration.

+ * + * @param publicKey a {@link java.lang.String} object. + * @param privateKey a {@link java.lang.String} object. + */ public Configuration(String publicKey, String privateKey){ this.publicKey = publicKey; this.privateKey = privateKey; } + /** + *

Constructor for Configuration.

+ * + * @param publicKey a {@link java.lang.String} object. + * @param privateKey a {@link java.lang.String} object. + * @param apiBase a {@link java.lang.String} object. + */ public Configuration(String publicKey, String privateKey, String apiBase) { this.publicKey = publicKey; this.privateKey = privateKey; @@ -30,7 +52,7 @@ public String getApiBase() { /** * Setter for the api base * - * @param apiBase + * @param apiBase a {@link java.lang.String} object. */ public void setApiBase(String apiBase) { this.apiBase = apiBase; @@ -38,7 +60,7 @@ public void setApiBase(String apiBase) { /** * Getter for the public static api key - * + * * @return publicKey */ public String getPublicKey() { @@ -47,8 +69,8 @@ public String getPublicKey() { /** * Setter for the public static key - * - * @param publicKey + * + * @param publicKey a {@link java.lang.String} object. */ public void setPublicKey(String publicKey) { this.publicKey = publicKey; @@ -56,8 +78,8 @@ public void setPublicKey(String publicKey) { /** * Getter for the private key - * - * @param privateKey + * + * @return a {@link java.lang.String} object. */ public String getPrivateKey() { return this.privateKey; @@ -65,29 +87,46 @@ public String getPrivateKey() { /** * Setter for the private key - * - * @param privateKey + * + * @param privatKey a {@link java.lang.String} object. */ public void setPrivateKey(String privatKey) { this.privateKey = privatKey; } + /** + *

gateway.

+ * + * @return a {@link com.trolley.trolley.Gateway} object. + */ public static Gateway gateway() { return new Gateway(Configuration.instantiate()); } + /** + *

client.

+ * + * @param config a {@link com.trolley.trolley.Configuration} object. + * @return a {@link com.trolley.trolley.Client} object. + */ public static Client client(Configuration config) { return new Client(config); } + /** + *

instantiate.

+ * + * @return a {@link com.trolley.trolley.Configuration} object. + */ public static Configuration instantiate() { return new Configuration(); } /** * Set the API enviroment - * - * @param enviroment + * + * @param enviroment a {@link java.lang.String} object. + * @return a {@link java.lang.String} object. */ public String setEnviroment(String enviroment) { switch (enviroment) { @@ -106,4 +145,4 @@ public String setEnviroment(String enviroment) { } return "https://api.paymentrails.com"; } -} \ No newline at end of file +} diff --git a/src/main/java/com/trolley/trolley/Detail.java b/src/main/java/com/trolley/trolley/Detail.java index 47c378a..9a58921 100644 --- a/src/main/java/com/trolley/trolley/Detail.java +++ b/src/main/java/com/trolley/trolley/Detail.java @@ -2,9 +2,15 @@ import com.fasterxml.jackson.annotation.JsonProperty; +/** + *

Detail class.

+ * + * @author joshua + * @version $Id: $Id + */ public class Detail { @JsonProperty("bank-transfer") public BankTransfer bankTransfer; -} \ No newline at end of file +} diff --git a/src/main/java/com/trolley/trolley/EUR.java b/src/main/java/com/trolley/trolley/EUR.java index 3f91d88..ab88d2e 100644 --- a/src/main/java/com/trolley/trolley/EUR.java +++ b/src/main/java/com/trolley/trolley/EUR.java @@ -1,5 +1,11 @@ package com.trolley.trolley; +/** + *

EUR class.

+ * + * @author joshua + * @version $Id: $Id + */ public class EUR { private Boolean primary; @@ -9,58 +15,119 @@ public class EUR { private String accountNumber; private Boolean display; + /** + *

Getter for the field primary.

+ * + * @return a {@link java.lang.Boolean} object. + */ public Boolean getPrimary() { return primary; } + /** + *

Setter for the field primary.

+ * + * @param primary a {@link java.lang.Boolean} object. + */ public void setPrimary(Boolean primary) { this.primary = primary; } + /** + *

Getter for the field amount.

+ * + * @return a {@link java.lang.String} object. + */ public String getAmount() { return amount; } + /** + *

Setter for the field amount.

+ * + * @param amount a {@link java.lang.String} object. + */ public void setAmount(String amount) { this.amount = amount; } + /** + *

Getter for the field currency.

+ * + * @return a {@link java.lang.String} object. + */ public String getCurrency() { return currency; } + /** + *

Setter for the field currency.

+ * + * @param currency a {@link java.lang.String} object. + */ public void setCurrency(String currency) { this.currency = currency; } + /** + *

Getter for the field type.

+ * + * @return a {@link java.lang.String} object. + */ public String getType() { return type; } + /** + *

Setter for the field type.

+ * + * @param type a {@link java.lang.String} object. + */ public void setType(String type) { this.type = type; } + /** + *

Getter for the field accountNumber.

+ * + * @return a {@link java.lang.String} object. + */ public String getAccountNumber() { return accountNumber; } + /** + *

Setter for the field accountNumber.

+ * + * @param accountNumber a {@link java.lang.String} object. + */ public void setAccountNumber(String accountNumber) { this.accountNumber = accountNumber; } + /** + *

Getter for the field display.

+ * + * @return a {@link java.lang.Boolean} object. + */ public Boolean getDisplay() { return display; } + /** + *

Setter for the field display.

+ * + * @param display a {@link java.lang.Boolean} object. + */ public void setDisplay(Boolean display) { this.display = display; } + /** {@inheritDoc} */ @Override public String toString() { return "ClassPojo [amount = " + amount + ", accountNumber = " + accountNumber + ", primary = " + primary + ", display = " + display + ", type = " + type + ", currency = " + currency + "]"; } -} \ No newline at end of file +} diff --git a/src/main/java/com/trolley/trolley/Gateway.java b/src/main/java/com/trolley/trolley/Gateway.java index 25553a9..06a6889 100644 --- a/src/main/java/com/trolley/trolley/Gateway.java +++ b/src/main/java/com/trolley/trolley/Gateway.java @@ -1,5 +1,11 @@ package com.trolley.trolley; +/** + *

Gateway class.

+ * + * @author joshua + * @version $Id: $Id + */ public class Gateway { public Configuration config; @@ -10,6 +16,11 @@ public class Gateway { public BalancesGateway balances; public PaymentGateway payment; + /** + *

Constructor for Gateway.

+ * + * @param config a {@link com.trolley.trolley.Configuration} object. + */ public Gateway(Configuration config) { this.config = config; this.client = new Client(config); @@ -20,4 +31,4 @@ public Gateway(Configuration config) { this.payment = new PaymentGateway(config); } -} \ No newline at end of file +} diff --git a/src/main/java/com/trolley/trolley/Meta.java b/src/main/java/com/trolley/trolley/Meta.java index 84a59f6..9530da8 100644 --- a/src/main/java/com/trolley/trolley/Meta.java +++ b/src/main/java/com/trolley/trolley/Meta.java @@ -1,32 +1,68 @@ package com.trolley.trolley; +/** + *

Meta class.

+ * + * @author joshua + * @version $Id: $Id + */ public class Meta { private Integer page; private Integer pages; private Integer records; + /** + *

Getter for the field page.

+ * + * @return a {@link java.lang.Integer} object. + */ public Integer getPage() { return page; } + /** + *

Setter for the field page.

+ * + * @param page a {@link java.lang.Integer} object. + */ public void setPage(Integer page) { this.page = page; } + /** + *

Getter for the field pages.

+ * + * @return a {@link java.lang.Integer} object. + */ public Integer getPages() { return pages; } + /** + *

Setter for the field pages.

+ * + * @param pages a {@link java.lang.Integer} object. + */ public void setPages(Integer pages) { this.pages = pages; } + /** + *

Getter for the field records.

+ * + * @return a {@link java.lang.Integer} object. + */ public Integer getRecords() { return records; } + /** + *

Setter for the field records.

+ * + * @param records a {@link java.lang.Integer} object. + */ public void setRecords(Integer records) { this.records = records; } -} \ No newline at end of file +} diff --git a/src/main/java/com/trolley/trolley/Payment.java b/src/main/java/com/trolley/trolley/Payment.java index 827b01e..ba77bcc 100644 --- a/src/main/java/com/trolley/trolley/Payment.java +++ b/src/main/java/com/trolley/trolley/Payment.java @@ -4,6 +4,12 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; +/** + *

Payment class.

+ * + * @author joshua + * @version $Id: $Id + */ @JsonInclude(Include.NON_NULL) public class Payment { @@ -43,250 +49,560 @@ public class Payment { String equivalentWithholdingAmount; String equivalentWithholdingCurrency; + /** + *

Setter for the field equivalentWithholdingCurrency.

+ * + * @param equivalentWithholdingCurrency a {@link java.lang.String} object. + */ public void setEquivalentWithholdingCurrency(String equivalentWithholdingCurrency) { this.equivalentWithholdingCurrency = equivalentWithholdingCurrency; } + /** + *

Getter for the field equivalentWithholdingCurrency.

+ * + * @return a {@link java.lang.String} object. + */ public String getEquivalentWithholdingCurrency() { return equivalentWithholdingCurrency; } + /** + *

Setter for the field equivalentWithholdingAmount.

+ * + * @param equivalentWithholdingAmount a {@link java.lang.String} object. + */ public void setEquivalentWithholdingAmount(String equivalentWithholdingAmount) { this.equivalentWithholdingAmount = equivalentWithholdingAmount; } + /** + *

Getter for the field equivalentWithholdingAmount.

+ * + * @return a {@link java.lang.String} object. + */ public String getEquivalentWithholdingAmount() { return equivalentWithholdingAmount; } + /** + *

Setter for the field withholdingCurrency.

+ * + * @param withholdingCurrency a {@link java.lang.String} object. + */ public void setWithholdingCurrency(String withholdingCurrency) { this.withholdingCurrency = withholdingCurrency; } + /** + *

Getter for the field tags.

+ * + * @return a {@link java.util.List} object. + */ public List getTags() { return this.tags; } + /** + *

Setter for the field tags.

+ * + * @param tags a {@link java.util.List} object. + */ public void setTags(List tags) { this.tags = tags; } + /** + *

Getter for the field account.

+ * + * @return a {@link com.trolley.trolley.RecipientAccount} object. + */ public RecipientAccount getAccount() { return account; } + /** + *

Setter for the field account.

+ * + * @param account a {@link com.trolley.trolley.RecipientAccount} object. + */ public void setAccount(RecipientAccount account) { this.account = account; } + /** + *

Getter for the field category.

+ * + * @return a {@link java.lang.String} object. + */ public String getCategory() { return category; } + /** + *

Setter for the field category.

+ * + * @param category a {@link java.lang.String} object. + */ public void setCategory(String category) { this.category = category; } + /** + *

Getter for the field currency.

+ * + * @return a {@link java.lang.String} object. + */ public String getCurrency() { return currency; } + /** + *

Setter for the field currency.

+ * + * @param currency a {@link java.lang.String} object. + */ public void setCurrency(String currency) { this.currency = currency; } + /** + *

Getter for the field amount.

+ * + * @return a {@link java.lang.String} object. + */ public String getAmount() { return amount; } + /** + *

Setter for the field amount.

+ * + * @param amount a {@link java.lang.String} object. + */ public void setAmount(String amount) { this.amount = amount; } + /** + *

Getter for the field withholdingCurrency.

+ * + * @return a {@link java.lang.String} object. + */ public String getWithholdingCurrency() { return withholdingCurrency; } + /** + *

Setter for the field withholdingAmount.

+ * + * @param withholdingAmount a {@link java.lang.String} object. + */ public void setWithholdingAmount(String withholdingAmount) { this.withholdingAmount = withholdingAmount; } + /** + *

Getter for the field withholdingAmount.

+ * + * @return a {@link java.lang.String} object. + */ public String getWithholdingAmount() { return withholdingAmount; } + /** + *

Getter for the field id.

+ * + * @return a {@link java.lang.String} object. + */ public String getId() { return id; } + /** + *

Setter for the field id.

+ * + * @param id a {@link java.lang.String} object. + */ public void setId(String id) { this.id = id; } + /** + *

Getter for the field recipient.

+ * + * @return a {@link com.trolley.trolley.Recipient} object. + */ public Recipient getRecipient() { return recipient; } + /** + *

Setter for the field recipient.

+ * + * @param recipient a {@link com.trolley.trolley.Recipient} object. + */ public void setRecipient(Recipient recipient) { this.recipient = recipient; } + /** + *

Getter for the field status.

+ * + * @return a {@link java.lang.String} object. + */ public String getStatus() { return status; } + /** + *

Setter for the field status.

+ * + * @param status a {@link java.lang.String} object. + */ public void setStatus(String status) { this.status = status; } + /** + *

Getter for the field isSupplyPayment.

+ * + * @return a {@link java.lang.Boolean} object. + */ public Boolean getIsSupplyPayment() { return isSupplyPayment; } + /** + *

Setter for the field isSupplyPayment.

+ * + * @param isSupplyPayment a {@link java.lang.Boolean} object. + */ public void setIsSupplyPayment(Boolean isSupplyPayment) { this.isSupplyPayment = isSupplyPayment; } + /** + *

Getter for the field returnedAmount.

+ * + * @return a {@link java.lang.String} object. + */ public String getReturnedAmount() { return returnedAmount; } + /** + *

Setter for the field returnedAmount.

+ * + * @param returnedAmount a {@link java.lang.String} object. + */ public void setReturnedAmount(String returnedAmount) { this.returnedAmount = returnedAmount; } + /** + *

Getter for the field sourceAmount.

+ * + * @return a {@link java.lang.String} object. + */ public String getSourceAmount() { return sourceAmount; } + /** + *

Setter for the field sourceAmount.

+ * + * @param sourceAmount a {@link java.lang.String} object. + */ public void setSourceAmount(String sourceAmount) { this.sourceAmount = sourceAmount; } + /** + *

Getter for the field sourceCurrency.

+ * + * @return a {@link java.lang.String} object. + */ public String getSourceCurrency() { return sourceCurrency; } + /** + *

Setter for the field sourceCurrency.

+ * + * @param sourceCurrency a {@link java.lang.String} object. + */ public void setSourceCurrency(String sourceCurrency) { this.sourceCurrency = sourceCurrency; } + /** + *

Getter for the field targetAmount.

+ * + * @return a {@link java.lang.String} object. + */ public String getTargetAmount() { return targetAmount; } + /** + *

Setter for the field targetAmount.

+ * + * @param targetAmount a {@link java.lang.String} object. + */ public void setTargetAmount(String targetAmount) { this.targetAmount = targetAmount; } + /** + *

Getter for the field targetCurrency.

+ * + * @return a {@link java.lang.String} object. + */ public String getTargetCurrency() { return targetCurrency; } + /** + *

Setter for the field targetCurrency.

+ * + * @param targetCurrency a {@link java.lang.String} object. + */ public void setTargetCurrency(String targetCurrency) { this.targetCurrency = targetCurrency; } + /** + *

Getter for the field exchangeRate.

+ * + * @return a {@link java.lang.String} object. + */ public String getExchangeRate() { return exchangeRate; } + /** + *

Setter for the field exchangeRate.

+ * + * @param exchangeRate a {@link java.lang.String} object. + */ public void setExchangeRate(String exchangeRate) { this.exchangeRate = exchangeRate; } + /** + *

Getter for the field fees.

+ * + * @return a {@link java.lang.String} object. + */ public String getFees() { return fees; } + /** + *

Setter for the field fees.

+ * + * @param fees a {@link java.lang.String} object. + */ public void setFees(String fees) { this.fees = fees; } + /** + *

Getter for the field recipientFees.

+ * + * @return a {@link java.lang.String} object. + */ public String getRecipientFees() { return recipientFees; } + /** + *

Setter for the field recipientFees.

+ * + * @param recipientFees a {@link java.lang.String} object. + */ public void setRecipientFees(String recipientFees) { this.recipientFees = recipientFees; } + /** + *

Getter for the field fxRate.

+ * + * @return a {@link java.lang.String} object. + */ public String getFxRate() { return fxRate; } + /** + *

Setter for the field fxRate.

+ * + * @param fxRate a {@link java.lang.String} object. + */ public void setFxRate(String fxRate) { this.fxRate = fxRate; } + /** + *

Getter for the field memo.

+ * + * @return a {@link java.lang.String} object. + */ public String getMemo() { return memo; } + /** + *

Setter for the field memo.

+ * + * @param memo a {@link java.lang.String} object. + */ public void setMemo(String memo) { this.memo = memo; } + /** + *

Getter for the field externalId.

+ * + * @return a {@link java.lang.String} object. + */ public String getExternalId() { return externalId; } + /** + *

Setter for the field externalId.

+ * + * @param externalId a {@link java.lang.String} object. + */ public void setExternalId(String externalId) { this.externalId = externalId; } + /** + *

Getter for the field processedAt.

+ * + * @return a {@link java.lang.Object} object. + */ public Object getProcessedAt() { return processedAt; } + /** + *

Setter for the field processedAt.

+ * + * @param processedAt a {@link java.lang.Object} object. + */ public void setProcessedAt(Object processedAt) { this.processedAt = processedAt; } + /** + *

Getter for the field createdAt.

+ * + * @return a {@link java.lang.String} object. + */ public String getCreatedAt() { return createdAt; } + /** + *

Setter for the field createdAt.

+ * + * @param createdAt a {@link java.lang.String} object. + */ public void setCreatedAt(String createdAt) { this.createdAt = createdAt; } + /** + *

Getter for the field updatedAt.

+ * + * @return a {@link java.lang.String} object. + */ public String getUpdatedAt() { return updatedAt; } + /** + *

Setter for the field updatedAt.

+ * + * @param updatedAt a {@link java.lang.String} object. + */ public void setUpdatedAt(String updatedAt) { this.updatedAt = updatedAt; } + /** + *

Getter for the field merchantFees.

+ * + * @return a {@link java.lang.String} object. + */ public String getMerchantFees() { return merchantFees; } + /** + *

Setter for the field merchantFees.

+ * + * @param merchantFees a {@link java.lang.String} object. + */ public void setMerchantFees(String merchantFees) { this.merchantFees = merchantFees; } + /** + *

Getter for the field compliance.

+ * + * @return a {@link com.trolley.trolley.Compliance} object. + */ public Compliance getCompliance() { return compliance; } + /** + *

Setter for the field compliance.

+ * + * @param compliance a {@link com.trolley.trolley.Compliance} object. + */ public void setCompliance(Compliance compliance) { this.compliance = compliance; } + /** + *

Getter for the field payoutMethod.

+ * + * @return a {@link java.lang.String} object. + */ public String getPayoutMethod() { return payoutMethod; } + /** + *

Setter for the field payoutMethod.

+ * + * @param payoutMethod a {@link java.lang.String} object. + */ public void setPayoutMethod(String payoutMethod) { this.payoutMethod = payoutMethod; } + /** + *

Getter for the field methodDisplay.

+ * + * @return a {@link java.lang.String} object. + */ public String getMethodDisplay() { return methodDisplay; } + /** + *

Setter for the field methodDisplay.

+ * + * @param methodDisplay a {@link java.lang.String} object. + */ public void setMethodDisplay(String methodDisplay) { this.methodDisplay = methodDisplay; } @@ -294,12 +610,13 @@ public void setMethodDisplay(String methodDisplay) { /** * Retrieves a batch based on the batch id * - * @param payment_id - * @param batch_id + * @param payment_id a {@link java.lang.String} object. + * @param batch_id a {@link java.lang.String} object. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidConnectionException - * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws java.lang.Exception if any. */ public static Payment find(String payment_id, String batch_id) throws Exception { return Configuration.gateway().payment.find(payment_id, batch_id); @@ -308,12 +625,13 @@ public static Payment find(String payment_id, String batch_id) throws Exception /** * Creates a payment based on the body and batch id * - * @param body - * @param batch_id + * @param body a {@link java.lang.String} object. + * @param batch_id a {@link java.lang.String} object. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidConnectionException - * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws java.lang.Exception if any. */ public static Payment create(String body, String batch_id) throws Exception { return Configuration.gateway().payment.create(body, batch_id); @@ -322,13 +640,14 @@ public static Payment create(String body, String batch_id) throws Exception { /** * Updates a payment based on the payment id, body and batch id * - * @param payment_id - * @param body - * @param batch_id + * @param payment_id a {@link java.lang.String} object. + * @param body a {@link java.lang.String} object. + * @param batch_id a {@link java.lang.String} object. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidConnectionException - * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws java.lang.Exception if any. */ public static boolean update(String payment_id, String body, String batch_id) throws Exception { return Configuration.gateway().payment.update(payment_id, body, batch_id); @@ -337,12 +656,13 @@ public static boolean update(String payment_id, String body, String batch_id) th /** * Deletes a payment based on the payment id and batch id * - * @param payment_id - * @param batch_id + * @param payment_id a {@link java.lang.String} object. + * @param batch_id a {@link java.lang.String} object. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidConnectionException - * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws java.lang.Exception if any. */ public static boolean delete(String payment_id, String batch_id) throws Exception { return Configuration.gateway().payment.delete(payment_id, batch_id); @@ -352,14 +672,16 @@ public static boolean delete(String payment_id, String batch_id) throws Exceptio * List all payments based on the recipient id and (optional) a given * wildcard, page amount and page size * - * @param batch_id + * @param batch_id a {@link java.lang.String} object. * @param page * @param pageSize - * @param message + * @param pageSize a int. + * @param message a {@link java.lang.String} object. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidConnectionException - * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws java.lang.Exception if any. */ public static List query(String batch_id, int page, int pageSize, String message) throws Exception { @@ -370,12 +692,13 @@ public static List query(String batch_id, int page, int pageSize, Strin /** * List all payments based on the recipient id and a given wildcard * - * @param batch_id - * @param message + * @param batch_id a {@link java.lang.String} object. + * @param message a {@link java.lang.String} object. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidConnectionException - * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws java.lang.Exception if any. */ public static List query(String batch_id, String message) throws Exception { return query(batch_id, 1, 10, message); @@ -384,11 +707,12 @@ public static List query(String batch_id, String message) throws Except /** * List all payments * - * @param batch_id + * @param batch_id a {@link java.lang.String} object. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidConnectionException - * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws java.lang.Exception if any. */ public static List query(String batch_id) throws Exception { return query(batch_id, 1, 10, ""); @@ -398,13 +722,15 @@ public static List query(String batch_id) throws Exception { * List all payments based on the recipient id and (optional) page amount * and page size * - * @param batch_id + * @param batch_id a {@link java.lang.String} object. * @param page * @param pageSize + * @param pageSize a int. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidConnectionException - * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws java.lang.Exception if any. */ public static List query(String batch_id, int page, int pageSize) throws Exception { @@ -426,4 +752,4 @@ public static List query(String batch_id, int page, int pageSize) throw // jgen.writeEndArray(); // } -// } \ No newline at end of file +// } diff --git a/src/main/java/com/trolley/trolley/PaymentGateway.java b/src/main/java/com/trolley/trolley/PaymentGateway.java index 8319798..1af6e43 100644 --- a/src/main/java/com/trolley/trolley/PaymentGateway.java +++ b/src/main/java/com/trolley/trolley/PaymentGateway.java @@ -9,13 +9,32 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import java.util.List; +/** + *

PaymentGateway class.

+ * + * @author joshua + * @version $Id: $Id + */ public class PaymentGateway { Client client; + /** + *

Constructor for PaymentGateway.

+ * + * @param config a {@link com.trolley.trolley.Configuration} object. + */ public PaymentGateway(Configuration config) { this.client = new Client(config); } + /** + *

find.

+ * + * @param payment_id a {@link java.lang.String} object. + * @param batch_id a {@link java.lang.String} object. + * @return a {@link com.trolley.trolley.Payment} object. + * @throws java.lang.Exception if any. + */ public Payment find(String payment_id, String batch_id) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); @@ -29,6 +48,14 @@ public Payment find(String payment_id, String batch_id) throws Exception { return paymentFactory(response); } + /** + *

create.

+ * + * @param body a {@link java.lang.String} object. + * @param batch_id a {@link java.lang.String} object. + * @return a {@link com.trolley.trolley.Payment} object. + * @throws java.lang.Exception if any. + */ public Payment create(String body, String batch_id) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); @@ -43,6 +70,15 @@ public Payment create(String body, String batch_id) throws Exception { return paymentFactory(response); } + /** + *

update.

+ * + * @param payment_id a {@link java.lang.String} object. + * @param body a {@link java.lang.String} object. + * @param batch_id a {@link java.lang.String} object. + * @return a boolean. + * @throws java.lang.Exception if any. + */ public boolean update(String payment_id, String body, String batch_id) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); @@ -59,6 +95,14 @@ public boolean update(String payment_id, String body, String batch_id) throws Ex return true; } + /** + *

delete.

+ * + * @param payment_id a {@link java.lang.String} object. + * @param batch_id a {@link java.lang.String} object. + * @return a boolean. + * @throws java.lang.Exception if any. + */ public boolean delete(String payment_id, String batch_id) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); @@ -72,6 +116,16 @@ public boolean delete(String payment_id, String batch_id) throws Exception { return true; } + /** + *

query.

+ * + * @param batch_id a {@link java.lang.String} object. + * @param page a int. + * @param pageSize a int. + * @param message a {@link java.lang.String} object. + * @return a {@link java.util.List} object. + * @throws java.lang.Exception if any. + */ public List query(String batch_id, int page, int pageSize, String message) throws Exception { if (batch_id == null || batch_id.isEmpty()) { @@ -116,4 +170,4 @@ private List paymentListFactory(String data) throws IOException { return payments; } -} \ No newline at end of file +} diff --git a/src/main/java/com/trolley/trolley/Payments.java b/src/main/java/com/trolley/trolley/Payments.java index ea72ccc..0dffb3a 100644 --- a/src/main/java/com/trolley/trolley/Payments.java +++ b/src/main/java/com/trolley/trolley/Payments.java @@ -2,25 +2,51 @@ import java.util.List; +/** + *

Payments class.

+ * + * @author joshua + * @version $Id: $Id + */ public class Payments { private List payments = null; private Meta meta; + /** + *

Getter for the field payments.

+ * + * @return a {@link java.util.List} object. + */ public List getPayments() { return payments; } + /** + *

Setter for the field payments.

+ * + * @param payments a {@link java.util.List} object. + */ public void setPayments(List payments) { this.payments = payments; } + /** + *

Getter for the field meta.

+ * + * @return a {@link com.trolley.trolley.Meta} object. + */ public Meta getMeta() { return meta; } + /** + *

Setter for the field meta.

+ * + * @param meta a {@link com.trolley.trolley.Meta} object. + */ public void setMeta(Meta meta) { this.meta = meta; } -} \ No newline at end of file +} diff --git a/src/main/java/com/trolley/trolley/Recipient.java b/src/main/java/com/trolley/trolley/Recipient.java index c0a50e8..38f1a7a 100644 --- a/src/main/java/com/trolley/trolley/Recipient.java +++ b/src/main/java/com/trolley/trolley/Recipient.java @@ -4,6 +4,12 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; +/** + *

Recipient class.

+ * + * @author joshua + * @version $Id: $Id + */ @JsonInclude(Include.NON_NULL) public class Recipient { @@ -44,258 +50,578 @@ public class Recipient { String taxFormStatus; String taxWithholdingPercentage = "0.0"; + /** + *

Getter for the field taxFormStatus.

+ * + * @return a {@link java.lang.String} object. + */ public String getTaxFormStatus() { return this.taxFormStatus; } + /** + *

Setter for the field taxFormStatus.

+ * + * @param taxFormStatus a {@link java.lang.String} object. + */ public void setTaxFormStatus(String taxFormStatus) { this.taxFormStatus = taxForm; } + /** + *

Getter for the field tags.

+ * + * @return a {@link java.util.List} object. + */ public List getTags() { return this.tags; } + /** + *

Setter for the field tags.

+ * + * @param tags a {@link java.util.List} object. + */ public void setTags(List tags) { this.tags = tags; } + /** + *

Getter for the field taxWithholdingPercentage.

+ * + * @return a {@link java.lang.String} object. + */ public String getTaxWithholdingPercentage() { return this.taxWithholdingPercentage; } + /** + *

Setter for the field taxWithholdingPercentage.

+ * + * @param taxWithholdingPercentage a {@link java.lang.String} object. + */ public void setTaxWithholdingPercentage(String taxWithholdingPercentage) { this.taxWithholdingPercentage = taxWithholdingPercentage; } + /** + *

Getter for the field taxForm.

+ * + * @return a {@link java.lang.String} object. + */ public String getTaxForm() { return this.taxForm; } + /** + *

Setter for the field taxForm.

+ * + * @param taxForm a {@link java.lang.String} object. + */ public void setTaxForm(String taxForm) { this.taxForm = taxForm; } + /** + *

Getter for the field inactiveReasons.

+ * + * @return a {@link java.lang.Object} object. + */ public Object getInactiveReasons() { return inactiveReasons; } + /** + *

Setter for the field inactiveReasons.

+ * + * @param inactiveReasons a {@link java.lang.Object} object. + */ public void setInactiveReasons(Object inactiveReasons) { this.inactiveReasons = inactiveReasons; } + /** + *

Getter for the field accounts.

+ * + * @return a {@link java.util.List} object. + */ public List getAccounts() { return accounts; } + /** + *

Setter for the field accounts.

+ * + * @param accounts a {@link java.util.List} object. + */ public void setAccounts(List accounts) { this.accounts = accounts; } + /** + *

Setter for the field address.

+ * + * @param address a {@link com.trolley.trolley.Address} object. + */ public void setAddress(Address address) { this.address = address; } + /** + *

Getter for the field address.

+ * + * @return a {@link com.trolley.trolley.Address} object. + */ public Address getAddress() { return address; } + /** + *

Getter for the field compliance.

+ * + * @return a {@link com.trolley.trolley.Compliance} object. + */ public Compliance getCompliance() { return compliance; } + /** + *

Setter for the field compliance.

+ * + * @param compliance a {@link com.trolley.trolley.Compliance} object. + */ public void setCompliance(Compliance compliance) { this.compliance = compliance; } + /** + *

Getter for the field lastName.

+ * + * @return a {@link java.lang.String} object. + */ public String getLastName() { return this.lastName; } + /** + *

Setter for the field lastName.

+ * + * @param lastName a {@link java.lang.String} object. + */ public void setLastName(String lastName) { this.lastName = lastName; } + /** + *

Getter for the field routeType.

+ * + * @return a {@link java.lang.String} object. + */ public String getRouteType() { return this.routeType; } + /** + *

Setter for the field routeType.

+ * + * @param routeType a {@link java.lang.String} object. + */ public void setRouteType(String routeType) { this.routeType = routeType; } + /** + *

Getter for the field estimatedFees.

+ * + * @return a {@link java.lang.String} object. + */ public String getEstimatedFees() { return estimatedFees; } + /** + *

Setter for the field estimatedFees.

+ * + * @param estimatedFees a {@link java.lang.String} object. + */ public void setEstimatedFees(String estimatedFees) { this.estimatedFees = estimatedFees; } + /** + *

Getter for the field id.

+ * + * @return a {@link java.lang.String} object. + */ public String getId() { return id; } + /** + *

Setter for the field id.

+ * + * @param id a {@link java.lang.String} object. + */ public void setId(String id) { this.id = id; } + /** + *

Getter for the field referenceId.

+ * + * @return a {@link java.lang.String} object. + */ public String getReferenceId() { return referenceId; } + /** + *

Setter for the field referenceId.

+ * + * @param referenceId a {@link java.lang.String} object. + */ public void setReferenceId(String referenceId) { this.referenceId = referenceId; } + /** + *

Getter for the field email.

+ * + * @return a {@link java.lang.String} object. + */ public String getEmail() { return email; } + /** + *

Setter for the field email.

+ * + * @param email a {@link java.lang.String} object. + */ public void setEmail(String email) { this.email = email; } + /** + *

Getter for the field name.

+ * + * @return a {@link java.lang.String} object. + */ public String getName() { return name; } + /** + *

Setter for the field name.

+ * + * @param name a {@link java.lang.String} object. + */ public void setName(String name) { this.name = name; } + /** + *

Getter for the field firstName.

+ * + * @return a {@link java.lang.String} object. + */ public String getFirstName() { return firstName; } + /** + *

Setter for the field firstName.

+ * + * @param firstName a {@link java.lang.String} object. + */ public void setFirstName(String firstName) { this.firstName = firstName; } + /** + *

Getter for the field type.

+ * + * @return a {@link java.lang.String} object. + */ public String getType() { return type; } + /** + *

Setter for the field type.

+ * + * @param type a {@link java.lang.String} object. + */ public void setType(String type) { this.type = type; } + /** + *

Getter for the field taxType.

+ * + * @return a {@link java.lang.String} object. + */ public String getTaxType() { return taxType; } + /** + *

Setter for the field taxType.

+ * + * @param taxType a {@link java.lang.String} object. + */ public void setTaxType(String taxType) { this.taxType = taxType; } + /** + *

Getter for the field status.

+ * + * @return a {@link java.lang.String} object. + */ public String getStatus() { return status; } + /** + *

Setter for the field status.

+ * + * @param status a {@link java.lang.String} object. + */ public void setStatus(String status) { this.status = status; } + /** + *

Getter for the field language.

+ * + * @return a {@link java.lang.String} object. + */ public String getLanguage() { return language; } + /** + *

Setter for the field language.

+ * + * @param language a {@link java.lang.String} object. + */ public void setLanguage(String language) { this.language = language; } + /** + *

Getter for the field complianceStatus.

+ * + * @return a {@link java.lang.String} object. + */ public String getComplianceStatus() { return complianceStatus; } + /** + *

Setter for the field complianceStatus.

+ * + * @param complianceStatus a {@link java.lang.String} object. + */ public void setComplianceStatus(String complianceStatus) { this.complianceStatus = complianceStatus; } + /** + *

Getter for the field dob.

+ * + * @return a {@link java.lang.String} object. + */ public String getDob() { return dob; } + /** + *

Setter for the field dob.

+ * + * @param dob a {@link java.lang.String} object. + */ public void setDob(String dob) { this.dob = dob; } + /** + *

Getter for the field passport.

+ * + * @return a {@link java.lang.String} object. + */ public String getPassport() { return passport; } + /** + *

Setter for the field passport.

+ * + * @param passport a {@link java.lang.String} object. + */ public void setPassport(String passport) { this.passport = passport; } + /** + *

Getter for the field updatedAt.

+ * + * @return a {@link java.lang.String} object. + */ public String getUpdatedAt() { return updatedAt; } + /** + *

Setter for the field updatedAt.

+ * + * @param updatedAt a {@link java.lang.String} object. + */ public void setUpdatedAt(String updatedAt) { this.updatedAt = updatedAt; } + /** + *

Getter for the field createdAt.

+ * + * @return a {@link java.lang.String} object. + */ public String getCreatedAt() { return createdAt; } + /** + *

Setter for the field createdAt.

+ * + * @param createdAt a {@link java.lang.String} object. + */ public void setCreatedAt(String createdAt) { this.createdAt = createdAt; } + /** + *

Getter for the field gravatarUrl.

+ * + * @return a {@link java.lang.String} object. + */ public String getGravatarUrl() { return gravatarUrl; } + /** + *

Setter for the field gravatarUrl.

+ * + * @param gravatarUrl a {@link java.lang.String} object. + */ public void setGravatarUrl(String gravatarUrl) { this.gravatarUrl = gravatarUrl; } + /** + *

Getter for the field governmentId.

+ * + * @return a {@link java.lang.String} object. + */ public String getGovernmentId() { return governmentId; } + /** + *

Setter for the field governmentId.

+ * + * @param governmentId a {@link java.lang.String} object. + */ public void setGovernmentId(String governmentId) { this.governmentId = governmentId; } + /** + *

Getter for the field ssn.

+ * + * @return a {@link java.lang.String} object. + */ public String getSsn() { return ssn; } + /** + *

Setter for the field ssn.

+ * + * @param ssn a {@link java.lang.String} object. + */ public void setSsn(String ssn) { this.ssn = ssn; } + /** + *

Getter for the field primaryCurrency.

+ * + * @return a {@link java.lang.String} object. + */ public String getPrimaryCurrency() { return primaryCurrency; } + /** + *

Setter for the field primaryCurrency.

+ * + * @param primaryCurrency a {@link java.lang.String} object. + */ public void setPrimaryCurrency(String primaryCurrency) { this.primaryCurrency = primaryCurrency; } + /** + *

Getter for the field placeOfBirth.

+ * + * @return a {@link java.lang.String} object. + */ public String getPlaceOfBirth() { return placeOfBirth; } + /** + *

Setter for the field placeOfBirth.

+ * + * @param placeOfBirth a {@link java.lang.String} object. + */ public void setPlaceOfBirth(String placeOfBirth) { this.placeOfBirth = placeOfBirth; } + /** + *

Getter for the field merchantId.

+ * + * @return a {@link java.lang.String} object. + */ public String getMerchantId() { return merchantId; } + /** + *

Setter for the field merchantId.

+ * + * @param merchantId a {@link java.lang.String} object. + */ public void setMerchantId(String merchantId) { this.merchantId = merchantId; } + /** + *

Getter for the field payoutMethod.

+ * + * @return a {@link java.lang.String} object. + */ public String getPayoutMethod() { return payoutMethod; } + /** + *

Setter for the field payoutMethod.

+ * + * @param payoutMethod a {@link java.lang.String} object. + */ public void setPayoutMethod(String payoutMethod) { this.payoutMethod = payoutMethod; } @@ -303,22 +629,20 @@ public void setPayoutMethod(String payoutMethod) { /** * Retrieves a recipient based on the recipient id given * - * @param recipient_id + * @param recipient_id a {@link java.lang.String} object. * @return The response - * @throws Exception - + * @throws java.lang.Exception if any. */ - public static Recipient find(String recipient_id) throws Exception { return Configuration.gateway().recipient.find(recipient_id); } /** * Retreives the recipient's logs based on the recipient id given - * - * @param recipient_id + * + * @param recipient_id a {@link java.lang.String} object. * @return the response - * @throws Exception + * @throws java.lang.Exception if any. */ public static String findLogs(String recipient_id) throws Exception { String response = Configuration.gateway().recipient.findLogs(recipient_id); @@ -327,10 +651,10 @@ public static String findLogs(String recipient_id) throws Exception { /** * Retreives the recipient's payments based on the recipient id given - * - * @param recipient_id + * + * @param recipient_id a {@link java.lang.String} object. * @return the response - * @throws Exception + * @throws java.lang.Exception if any. */ public static List findPayments(String recipient_id) throws Exception { return Configuration.gateway().recipient.findPayments(recipient_id); @@ -340,11 +664,12 @@ public static List findPayments(String recipient_id) throws Exception { /** * Creates a recipient based on the body given to the client * - * @param body + * @param body a {@link java.lang.String} object. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidFieldException - * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws java.lang.Exception if any. */ public static Recipient create(String body) throws Exception { return Configuration.gateway().recipient.create(body); @@ -354,12 +679,13 @@ public static Recipient create(String body) throws Exception { /** * Updates a recipient based on the body given to the client * - * @param recipient_id - * @param body + * @param recipient_id a {@link java.lang.String} object. + * @param body a {@link java.lang.String} object. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidFieldException - * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws java.lang.Exception if any. */ public static boolean update(String recipient_id, String body) throws Exception { return Configuration.gateway().recipient.update(recipient_id, body); @@ -368,11 +694,12 @@ public static boolean update(String recipient_id, String body) throws Exception /** * Delete a recipient based on the recipient id * - * @param recipient_id + * @param recipient_id a {@link java.lang.String} object. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidFieldException - * @throws com.trolley.Exceptions.InvalidConnectionException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws java.lang.Exception if any. */ public static boolean delete(String recipient_id) throws Exception { return Configuration.gateway().recipient.delete(recipient_id); @@ -384,11 +711,13 @@ public static boolean delete(String recipient_id) throws Exception { * * @param page * @param pageSize - * @param term + * @param pageSize a int. + * @param term a {@link java.lang.String} object. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidConnectionException - * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws java.lang.Exception if any. */ public static List search(int page, int pageSize, String term) throws Exception { return Configuration.gateway().recipient.search(page, pageSize, term); @@ -397,22 +726,25 @@ public static List search(int page, int pageSize, String term) throws /** * List all recipients based on the recipient id and a given wildcard * - * @param message + * @param message a {@link java.lang.String} object. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidConnectionException - * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws java.lang.Exception if any. */ public static List search(String message) throws Exception { return search(1, 10, message); } /** - * + *

search.

+ * * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidConnectionException - * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws java.lang.Exception if any. */ public static List search() throws Exception { return search(1, 10, ""); @@ -424,10 +756,12 @@ public static List search() throws Exception { * * @param page * @param pageNumber + * @param pageNumber a int. * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException - * @throws com.trolley.Exceptions.InvalidConnectionException - * @throws com.trolley.Exceptions.InvalidFieldException + * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. + * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. + * @throws com.trolley.Exceptions.InvalidFieldException if any. + * @throws java.lang.Exception if any. */ public static List search(int page, int pageNumber) throws Exception { return search(page, pageNumber, ""); diff --git a/src/main/java/com/trolley/trolley/RecipientAccount.java b/src/main/java/com/trolley/trolley/RecipientAccount.java index 692e407..b485713 100644 --- a/src/main/java/com/trolley/trolley/RecipientAccount.java +++ b/src/main/java/com/trolley/trolley/RecipientAccount.java @@ -4,6 +4,12 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include;; +/** + *

RecipientAccount class.

+ * + * @author joshua + * @version $Id: $Id + */ @JsonInclude(Include.NON_NULL) public class RecipientAccount { @@ -31,205 +37,475 @@ public class RecipientAccount { String status; String disabledAt; + /** + *

Getter for the field emailAddress.

+ * + * @return a {@link java.lang.String} object. + */ public String getEmailAddress(){ return emailAddress; } + /** + *

Setter for the field emailAddress.

+ * + * @param emailAddress a {@link java.lang.String} object. + */ public void setEmailAddress(String emailAddress){ this.emailAddress = emailAddress; } + /** + *

Getter for the field disabledAt.

+ * + * @return a {@link java.lang.String} object. + */ public String getDisabledAt(){ return disabledAt; } + /** + *

Setter for the field disabledAt.

+ * + * @param disabledAt a {@link java.lang.String} object. + */ public void setDisabledAt(String disabledAt){ this.disabledAt = disabledAt; } + /** + *

Getter for the field status.

+ * + * @return a {@link java.lang.String} object. + */ public String getStatus(){ return status; } + /** + *

Setter for the field status.

+ * + * @param status a {@link java.lang.String} object. + */ public void setStatus(String status){ this.status = status; } + /** + *

Getter for the field recipientId.

+ * + * @return a {@link java.lang.String} object. + */ public String getRecipientId(){ return recipientId; } + /** + *

Setter for the field recipientId.

+ * + * @param recipientId a {@link java.lang.String} object. + */ public void setRecipientId(String recipientId){ this.recipientId = recipientId; } + /** + *

Getter for the field type.

+ * + * @return a {@link java.lang.String} object. + */ public String getType() { return type; } + /** + *

Setter for the field type.

+ * + * @param type a {@link java.lang.String} object. + */ public void setType(String type) { this.type = type; } + /** + *

Getter for the field primary.

+ * + * @return a {@link java.lang.Boolean} object. + */ public Boolean getPrimary() { return primary; } + /** + *

Setter for the field primary.

+ * + * @param primary a {@link java.lang.Boolean} object. + */ public void setPrimary(Boolean primary) { this.primary = primary; } + /** + *

Getter for the field currency.

+ * + * @return a {@link java.lang.String} object. + */ public String getCurrency() { return currency; } + /** + *

Setter for the field currency.

+ * + * @param currency a {@link java.lang.String} object. + */ public void setCurrency(String currency) { this.currency = currency; } + /** + *

Getter for the field id.

+ * + * @return a {@link java.lang.String} object. + */ public String getId() { return id; } + /** + *

Setter for the field id.

+ * + * @param id a {@link java.lang.String} object. + */ public void setId(String id) { this.id = id; } + /** + *

Getter for the field recipientAccountId.

+ * + * @return a {@link java.lang.String} object. + */ public String getRecipientAccountId() { return recipientAccountId; } + /** + *

Setter for the field recipientAccountId.

+ * + * @param recipientAccountId a {@link java.lang.String} object. + */ public void setRecipientAccountId(String recipientAccountId) { this.recipientAccountId = recipientAccountId; } + /** + *

Getter for the field routeType.

+ * + * @return a {@link java.lang.String} object. + */ public String getRouteType() { return routeType; } + /** + *

Setter for the field routeType.

+ * + * @param routeType a {@link java.lang.String} object. + */ public void setRouteType(String routeType) { this.routeType = routeType; } + /** + *

Getter for the field recipientFees.

+ * + * @return a {@link java.lang.String} object. + */ public String getRecipientFees() { return recipientFees; } + /** + *

Setter for the field recipientFees.

+ * + * @param recipientFees a {@link java.lang.String} object. + */ public void setRecipientFees(String recipientFees) { this.recipientFees = recipientFees; } + /** + *

Getter for the field country.

+ * + * @return a {@link java.lang.String} object. + */ public String getCountry() { return country; } + /** + *

Setter for the field country.

+ * + * @param country a {@link java.lang.String} object. + */ public void setCountry(String country) { this.country = country; } + /** + *

Getter for the field iban.

+ * + * @return a {@link java.lang.String} object. + */ public String getIban() { return iban; } + /** + *

Setter for the field iban.

+ * + * @param iban a {@link java.lang.String} object. + */ public void setIban(String iban) { this.iban = iban; } + /** + *

Getter for the field accountNum.

+ * + * @return a {@link java.lang.String} object. + */ public String getAccountNum() { return accountNum; } + /** + *

Setter for the field accountNum.

+ * + * @param accountNum a {@link java.lang.String} object. + */ public void setAccountNum(String accountNum) { this.accountNum = accountNum; } + /** + *

Getter for the field accountHolderName.

+ * + * @return a {@link java.lang.String} object. + */ public String getAccountHolderName() { return accountHolderName; } + /** + *

Setter for the field accountHolderName.

+ * + * @param accountHolderName a {@link java.lang.String} object. + */ public void setAccountHolderName(String accountHolderName) { this.accountHolderName = accountHolderName; } + /** + *

Getter for the field swiftBic.

+ * + * @return a {@link java.lang.String} object. + */ public String getSwiftBic() { return swiftBic; } + /** + *

Setter for the field swiftBic.

+ * + * @param swiftBic a {@link java.lang.String} object. + */ public void setSwiftBic(String swiftBic) { this.swiftBic = swiftBic; } + /** + *

Getter for the field branchId.

+ * + * @return a {@link java.lang.String} object. + */ public String getBranchId() { return branchId; } + /** + *

Setter for the field branchId.

+ * + * @param branchId a {@link java.lang.String} object. + */ public void setBranchId(String branchId) { this.branchId = branchId; } + /** + *

Getter for the field bankId.

+ * + * @return a {@link java.lang.String} object. + */ public String getBankId() { return bankId; } + /** + *

Setter for the field bankId.

+ * + * @param bankId a {@link java.lang.String} object. + */ public void setBankId(String bankId) { this.bankId = bankId; } + /** + *

Getter for the field bankName.

+ * + * @return a {@link java.lang.String} object. + */ public String getBankName() { return bankName; } + /** + *

Setter for the field bankName.

+ * + * @param bankName a {@link java.lang.String} object. + */ public void setBankName(String bankName) { this.bankName = bankName; } + /** + *

Getter for the field bankAddress.

+ * + * @return a {@link java.lang.String} object. + */ public String getBankAddress() { return bankAddress; } + /** + *

Setter for the field bankAddress.

+ * + * @param bankAddress a {@link java.lang.String} object. + */ public void setBankAddress(String bankAddress) { this.bankAddress = bankAddress; } + /** + *

Getter for the field bankCity.

+ * + * @return a {@link java.lang.String} object. + */ public String getBankCity() { return bankCity; } + /** + *

Setter for the field bankCity.

+ * + * @param bankCity a {@link java.lang.String} object. + */ public void setBankCity(String bankCity) { this.bankCity = bankCity; } + /** + *

Getter for the field bankRegionCode.

+ * + * @return a {@link java.lang.String} object. + */ public String getBankRegionCode() { return bankRegionCode; } + /** + *

Setter for the field bankRegionCode.

+ * + * @param bankRegionCode a {@link java.lang.String} object. + */ public void setBankRegionCode(String bankRegionCode) { this.bankRegionCode = bankRegionCode; } + /** + *

Getter for the field bankPostalCode.

+ * + * @return a {@link java.lang.String} object. + */ public String getBankPostalCode() { return bankPostalCode; } + /** + *

Setter for the field bankPostalCode.

+ * + * @param bankPostalCode a {@link java.lang.String} object. + */ public void setBankPostalCode(String bankPostalCode) { this.bankPostalCode = bankPostalCode; } + /** + *

findAll.

+ * + * @param recipient_id a {@link java.lang.String} object. + * @return a {@link java.util.List} object. + * @throws java.lang.Exception if any. + */ public static List findAll(String recipient_id) throws Exception { return Configuration.gateway().recipientAccount.findAll(recipient_id); } + /** + *

find.

+ * + * @param recipient_id a {@link java.lang.String} object. + * @param recipient_account_id a {@link java.lang.String} object. + * @return a {@link com.trolley.trolley.RecipientAccount} object. + * @throws java.lang.Exception if any. + */ public static RecipientAccount find(String recipient_id, String recipient_account_id) throws Exception { return Configuration.gateway().recipientAccount.find(recipient_id, recipient_account_id); } + /** + *

create.

+ * + * @param recipient_id a {@link java.lang.String} object. + * @param body a {@link java.lang.String} object. + * @return a {@link com.trolley.trolley.RecipientAccount} object. + * @throws java.lang.Exception if any. + */ public static RecipientAccount create(String recipient_id, String body) throws Exception { return Configuration.gateway().recipientAccount.create(recipient_id, body); } + /** + *

update.

+ * + * @param recipient_id a {@link java.lang.String} object. + * @param recipient_account_id a {@link java.lang.String} object. + * @param body a {@link java.lang.String} object. + * @return a {@link com.trolley.trolley.RecipientAccount} object. + * @throws java.lang.Exception if any. + */ public static RecipientAccount update(String recipient_id, String recipient_account_id, String body) throws Exception { return Configuration.gateway().recipientAccount.update(recipient_id, recipient_account_id, body); } + /** + *

delete.

+ * + * @param recipient_id a {@link java.lang.String} object. + * @param recipient_account_id a {@link java.lang.String} object. + * @return a boolean. + * @throws java.lang.Exception if any. + */ public static boolean delete(String recipient_id, String recipient_account_id) throws Exception { return Configuration.gateway().recipientAccount.delete(recipient_id, recipient_account_id); } -} \ No newline at end of file +} diff --git a/src/main/java/com/trolley/trolley/RecipientAccountGateway.java b/src/main/java/com/trolley/trolley/RecipientAccountGateway.java index 2a9f37c..8d53369 100644 --- a/src/main/java/com/trolley/trolley/RecipientAccountGateway.java +++ b/src/main/java/com/trolley/trolley/RecipientAccountGateway.java @@ -9,14 +9,32 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import java.util.List; +/** + *

RecipientAccountGateway class.

+ * + * @author joshua + * @version $Id: $Id + */ public class RecipientAccountGateway { Client client; + /** + *

Constructor for RecipientAccountGateway.

+ * + * @param config a {@link com.trolley.trolley.Configuration} object. + */ public RecipientAccountGateway(Configuration config) { this.client = new Client(config); } + /** + *

findAll.

+ * + * @param recipient_id a {@link java.lang.String} object. + * @return a {@link java.util.List} object. + * @throws java.lang.Exception if any. + */ public List findAll(String recipient_id) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); @@ -27,6 +45,14 @@ public List findAll(String recipient_id) throws Exception { return recipientAccountListFactory(response); } + /** + *

find.

+ * + * @param recipient_id a {@link java.lang.String} object. + * @param recipient_account_id a {@link java.lang.String} object. + * @return a {@link com.trolley.trolley.RecipientAccount} object. + * @throws java.lang.Exception if any. + */ public RecipientAccount find(String recipient_id, String recipient_account_id) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); @@ -37,6 +63,14 @@ public RecipientAccount find(String recipient_id, String recipient_account_id) t return recipientAccountFactory(response); } + /** + *

create.

+ * + * @param recipient_id a {@link java.lang.String} object. + * @param body a {@link java.lang.String} object. + * @return a {@link com.trolley.trolley.RecipientAccount} object. + * @throws java.lang.Exception if any. + */ public RecipientAccount create(String recipient_id, String body) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); @@ -50,6 +84,14 @@ public RecipientAccount create(String recipient_id, String body) throws Exceptio return recipientAccountFactory(response); } + /** + *

create.

+ * + * @param recipient_id a {@link java.lang.String} object. + * @param account a {@link com.trolley.trolley.RecipientAccount} object. + * @return a {@link com.trolley.trolley.RecipientAccount} object. + * @throws java.lang.Exception if any. + */ public RecipientAccount create(String recipient_id, RecipientAccount account) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); @@ -65,6 +107,15 @@ public RecipientAccount create(String recipient_id, RecipientAccount account) th return recipientAccountFactory(response); } + /** + *

update.

+ * + * @param recipient_id a {@link java.lang.String} object. + * @param recipient_account_id a {@link java.lang.String} object. + * @param body a {@link java.lang.String} object. + * @return a {@link com.trolley.trolley.RecipientAccount} object. + * @throws java.lang.Exception if any. + */ public RecipientAccount update(String recipient_id, String recipient_account_id, String body) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); @@ -78,6 +129,15 @@ public RecipientAccount update(String recipient_id, String recipient_account_id, return recipientAccountFactory(response); } + /** + *

update.

+ * + * @param recipient_id a {@link java.lang.String} object. + * @param recipient_account_id a {@link java.lang.String} object. + * @param account a {@link com.trolley.trolley.RecipientAccount} object. + * @return a {@link com.trolley.trolley.RecipientAccount} object. + * @throws java.lang.Exception if any. + */ public RecipientAccount update(String recipient_id, String recipient_account_id, RecipientAccount account) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); @@ -93,6 +153,14 @@ public RecipientAccount update(String recipient_id, String recipient_account_id, return recipientAccountFactory(response); } + /** + *

delete.

+ * + * @param recipient_id a {@link java.lang.String} object. + * @param recipient_account_id a {@link java.lang.String} object. + * @return a boolean. + * @throws java.lang.Exception if any. + */ public boolean delete(String recipient_id, String recipient_account_id) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); @@ -125,4 +193,4 @@ private List recipientAccountListFactory(String data) throws I } return recipientAccounts; } -} \ No newline at end of file +} diff --git a/src/main/java/com/trolley/trolley/RecipientGateway.java b/src/main/java/com/trolley/trolley/RecipientGateway.java index 7fd9a6a..95a72e4 100644 --- a/src/main/java/com/trolley/trolley/RecipientGateway.java +++ b/src/main/java/com/trolley/trolley/RecipientGateway.java @@ -9,14 +9,32 @@ import java.util.List; import com.fasterxml.jackson.databind.DeserializationFeature; +/** + *

RecipientGateway class.

+ * + * @author joshua + * @version $Id: $Id + */ public class RecipientGateway { Client client; + /** + *

Constructor for RecipientGateway.

+ * + * @param config a {@link com.trolley.trolley.Configuration} object. + */ public RecipientGateway(Configuration config) { this.client = new Client(config); } + /** + *

find.

+ * + * @param recipient_id a {@link java.lang.String} object. + * @return a {@link com.trolley.trolley.Recipient} object. + * @throws java.lang.Exception if any. + */ public Recipient find(String recipient_id) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); @@ -27,12 +45,26 @@ public Recipient find(String recipient_id) throws Exception { return recipientFactory(response); } + /** + *

findLogs.

+ * + * @param recipient_id a {@link java.lang.String} object. + * @return a {@link java.lang.String} object. + * @throws java.lang.Exception if any. + */ public String findLogs(String recipient_id) throws Exception { String endPoint = "/v1/recipients/" + recipient_id + "/logs"; String response = this.client.get(endPoint); return response; } + /** + *

findPayments.

+ * + * @param recipient_id a {@link java.lang.String} object. + * @return a {@link java.util.List} object. + * @throws java.lang.Exception if any. + */ public List findPayments(String recipient_id) throws Exception { String endPoint = "/v1/recipients/" + recipient_id + "/payments"; String response = this.client.get(endPoint); @@ -51,6 +83,13 @@ public List findPayments(String recipient_id) throws Exception { return payments; } + /** + *

create.

+ * + * @param body a {@link java.lang.String} object. + * @return a {@link com.trolley.trolley.Recipient} object. + * @throws java.lang.Exception if any. + */ public Recipient create(String body) throws Exception { if (body == null || body.isEmpty()) { throw new InvalidFieldException("Body cannot be null or empty"); @@ -60,6 +99,13 @@ public Recipient create(String body) throws Exception { return recipientFactory(response); } + /** + *

create.

+ * + * @param recipient a {@link com.trolley.trolley.Recipient} object. + * @return a {@link com.trolley.trolley.Recipient} object. + * @throws java.lang.Exception if any. + */ public Recipient create(Recipient recipient) throws Exception { if (recipient == null) { throw new InvalidFieldException("Body cannot be null or empty"); @@ -72,6 +118,14 @@ public Recipient create(Recipient recipient) throws Exception { return recipientFactory(response); } + /** + *

update.

+ * + * @param recipient_id a {@link java.lang.String} object. + * @param body a {@link java.lang.String} object. + * @return a boolean. + * @throws java.lang.Exception if any. + */ public boolean update(String recipient_id, String body) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); @@ -85,6 +139,14 @@ public boolean update(String recipient_id, String body) throws Exception { return true; } + /** + *

update.

+ * + * @param recipient_id a {@link java.lang.String} object. + * @param recipient a {@link com.trolley.trolley.Recipient} object. + * @return a boolean. + * @throws java.lang.Exception if any. + */ public boolean update(String recipient_id, Recipient recipient) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); @@ -100,6 +162,13 @@ public boolean update(String recipient_id, Recipient recipient) throws Exception return true; } + /** + *

delete.

+ * + * @param recipient_id a {@link java.lang.String} object. + * @return a boolean. + * @throws java.lang.Exception if any. + */ public boolean delete(String recipient_id) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); @@ -110,6 +179,15 @@ public boolean delete(String recipient_id) throws Exception { return true; } + /** + *

search.

+ * + * @param page a int. + * @param pageSize a int. + * @param term a {@link java.lang.String} object. + * @return a {@link java.util.List} object. + * @throws java.lang.Exception if any. + */ public List search(int page, int pageSize, String term) throws Exception { if (page < 0) { throw new InvalidFieldException("Page cannot be less than 0"); @@ -150,4 +228,4 @@ private List recipientListFactory(String data) throws IOException { } return recipients; } -} \ No newline at end of file +} diff --git a/src/main/java/com/trolley/trolley/Total.java b/src/main/java/com/trolley/trolley/Total.java index c570a19..63c15ae 100644 --- a/src/main/java/com/trolley/trolley/Total.java +++ b/src/main/java/com/trolley/trolley/Total.java @@ -1,5 +1,11 @@ package com.trolley.trolley; +/** + *

Total class.

+ * + * @author joshua + * @version $Id: $Id + */ public class Total { public Integer count; @@ -7,4 +13,4 @@ public class Total { public String merchantFees; public String debitAmount; public String sendingAmount; -} \ No newline at end of file +} diff --git a/src/main/java/com/trolley/trolley/USD.java b/src/main/java/com/trolley/trolley/USD.java index 94e4803..80e7118 100644 --- a/src/main/java/com/trolley/trolley/USD.java +++ b/src/main/java/com/trolley/trolley/USD.java @@ -1,5 +1,11 @@ package com.trolley.trolley; +/** + *

USD class.

+ * + * @author joshua + * @version $Id: $Id + */ public class USD { private Boolean primary; @@ -9,51 +15,111 @@ public class USD { private String accountNumber; private Boolean display; + /** + *

Getter for the field primary.

+ * + * @return a {@link java.lang.Boolean} object. + */ public Boolean getPrimary() { return primary; } + /** + *

Setter for the field primary.

+ * + * @param primary a {@link java.lang.Boolean} object. + */ public void setPrimary(Boolean primary) { this.primary = primary; } + /** + *

Getter for the field amount.

+ * + * @return a {@link java.lang.String} object. + */ public String getAmount() { return amount; } + /** + *

Setter for the field amount.

+ * + * @param amount a {@link java.lang.String} object. + */ public void setAmount(String amount) { this.amount = amount; } + /** + *

Getter for the field currency.

+ * + * @return a {@link java.lang.String} object. + */ public String getCurrency() { return currency; } + /** + *

Setter for the field currency.

+ * + * @param currency a {@link java.lang.String} object. + */ public void setCurrency(String currency) { this.currency = currency; } + /** + *

Getter for the field type.

+ * + * @return a {@link java.lang.String} object. + */ public String getType() { return type; } + /** + *

Setter for the field type.

+ * + * @param type a {@link java.lang.String} object. + */ public void setType(String type) { this.type = type; } + /** + *

Getter for the field accountNumber.

+ * + * @return a {@link java.lang.String} object. + */ public String getAccountNumber() { return accountNumber; } + /** + *

Setter for the field accountNumber.

+ * + * @param accountNumber a {@link java.lang.String} object. + */ public void setAccountNumber(String accountNumber) { this.accountNumber = accountNumber; } + /** + *

Getter for the field display.

+ * + * @return a {@link java.lang.Boolean} object. + */ public Boolean getDisplay() { return display; } + /** + *

Setter for the field display.

+ * + * @param display a {@link java.lang.Boolean} object. + */ public void setDisplay(Boolean display) { this.display = display; } -} \ No newline at end of file +} diff --git a/src/test/java/com/trolley/sdk/integration/BatchTest.java b/src/test/java/com/trolley/sdk/integration/BatchTest.java index aa734fd..cdc5e18 100644 --- a/src/test/java/com/trolley/sdk/integration/BatchTest.java +++ b/src/test/java/com/trolley/sdk/integration/BatchTest.java @@ -19,11 +19,11 @@ import org.junit.Test; import org.powermock.core.classloader.annotations.PrepareForTest; -@PrepareForTest(Recipient.class) +@PrepareForTest(Batch.class) public class BatchTest { private Recipient createRecipient() throws Exception { - Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); + Gateway client = new Gateway(new Configuration("key", "secret", "production")); UUID uuid = UUID.randomUUID(); @@ -42,7 +42,7 @@ private Recipient createRecipient() throws Exception { @Test public void testCreate() throws Exception { - Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); + Gateway client = new Gateway(new Configuration("key", "secret", "production")); String body = "{\"sourceCurrency\": \"GBP\", \"description\":\"Integration Test Create\"}"; Batch batch = client.batch.create(body); @@ -51,7 +51,7 @@ public void testCreate() throws Exception { @Test public void testCreateObject() throws Exception { - Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); + Gateway client = new Gateway(new Configuration("key", "secret", "production")); Batch batchToCreate = new Batch(); batchToCreate.setCurrency("GBP"); @@ -67,7 +67,7 @@ public void testCreateObject() throws Exception { @Test public void testUpdate() throws Exception { - Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); + Gateway client = new Gateway(new Configuration("key", "secret", "production")); String body = "{\"sourceCurrency\": \"GBP\", \"description\":\"Integration Test Create\"}"; Batch batch = client.batch.create(body); @@ -86,7 +86,7 @@ public void testUpdate() throws Exception { @Test public void testUpdateObject() throws Exception { - Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); + Gateway client = new Gateway(new Configuration("key", "secret", "production")); String body = "{\"sourceCurrency\": \"GBP\", \"description\":\"Integration Test Create\"}"; @@ -107,7 +107,7 @@ public void testUpdateObject() throws Exception { @Test public void testCreateWithPayments() throws Exception { - Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); + Gateway client = new Gateway(new Configuration("key", "secret", "production")); Recipient recipientAlpha = createRecipient(); Payment payment = new Payment(); @@ -139,7 +139,7 @@ public void testCreateWithPayments() throws Exception { @Test public void testPayments() throws Exception { - Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); + Gateway client = new Gateway(new Configuration("key", "secret", "production")); String body = "{\"sourceCurrency\": \"GBP\", \"description\":\"Integration Test Create\"}"; Batch batch = client.batch.create(body); @@ -160,7 +160,7 @@ public void testPayments() throws Exception { @Test public void testProcessing() throws Exception { - Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); + Gateway client = new Gateway(new Configuration("key", "secret", "production")); Recipient recipientAlpha = createRecipient(); diff --git a/src/test/java/com/trolley/sdk/integration/RecipientTest.java b/src/test/java/com/trolley/sdk/integration/RecipientTest.java index cd46a31..4645329 100644 --- a/src/test/java/com/trolley/sdk/integration/RecipientTest.java +++ b/src/test/java/com/trolley/sdk/integration/RecipientTest.java @@ -21,7 +21,7 @@ public class RecipientTest { @Test public void testCreateRecipient() throws Exception { - Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); + Gateway client = new Gateway(new Configuration("key", "secret", "production")); UUID uuid = UUID.randomUUID(); @@ -37,7 +37,7 @@ public void testCreateRecipient() throws Exception { @Test public void testCreateRecipientObject() throws Exception { - Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); + Gateway client = new Gateway(new Configuration("key", "secret", "production")); UUID uuid = UUID.randomUUID(); @@ -66,7 +66,7 @@ public void testCreateRecipientObject() throws Exception { @Test public void testLifecycle() throws Exception { - Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); + Gateway client = new Gateway(new Configuration("key", "secret", "production")); UUID uuid = UUID.randomUUID(); @@ -96,7 +96,7 @@ public void testLifecycle() throws Exception { @Test public void testAccount() throws Exception { - Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); + Gateway client = new Gateway(new Configuration("key", "secret", "production")); UUID uuid = UUID.randomUUID(); @@ -131,7 +131,7 @@ public void testAccount() throws Exception { @Test public void testAccountObject() throws Exception { - Gateway client = new Gateway(new Configuration("ASXQRXUnW02MCRVZ8ZBVJGFH", "4m5t5xap00dy9cyetthfxwy6vunef55ern0bed3r", "production")); + Gateway client = new Gateway(new Configuration("key", "secret", "production")); UUID uuid = UUID.randomUUID(); From 016fcb5ce683d7298fb59dfad1469c9e1311392e Mon Sep 17 00:00:00 2001 From: Aman Alam Date: Mon, 15 May 2023 15:46:21 -0400 Subject: [PATCH 5/5] maven version --- .../Exceptions/AuthenticationException.java | 24 +- .../Exceptions/AuthorizationException.java | 24 +- .../DownForMaintenanceException.java | 24 +- .../Exceptions/InvalidFieldException.java | 24 +- .../InvalidServerConnectionException.java | 24 +- .../InvalidStatusCodeException.java | 24 +- .../Exceptions/MalformedException.java | 24 +- .../trolley/Exceptions/NotFoundException.java | 24 +- .../Exceptions/TooManyRequestsException.java | 24 +- .../Exceptions/UnexpectedException.java | 24 +- .../java/com/trolley/trolley/Address.java | 176 +---- .../java/com/trolley/trolley/Balances.java | 92 +-- .../com/trolley/trolley/BalancesGateway.java | 31 +- .../com/trolley/trolley/BankTransfer.java | 10 +- src/main/java/com/trolley/trolley/Batch.java | 385 ++------- .../com/trolley/trolley/BatchGateway.java | 282 ++----- .../com/trolley/trolley/BatchSummary.java | 11 +- src/main/java/com/trolley/trolley/CAD.java | 119 +-- src/main/java/com/trolley/trolley/Client.java | 324 ++++---- .../java/com/trolley/trolley/Compliance.java | 69 +- .../com/trolley/trolley/Configuration.java | 167 ++-- src/main/java/com/trolley/trolley/Detail.java | 11 +- src/main/java/com/trolley/trolley/EUR.java | 125 +-- .../java/com/trolley/trolley/Gateway.java | 20 +- src/main/java/com/trolley/trolley/Meta.java | 64 +- .../java/com/trolley/trolley/Payment.java | 718 ++++------------- .../com/trolley/trolley/PaymentGateway.java | 150 ++-- .../java/com/trolley/trolley/Payments.java | 53 +- .../java/com/trolley/trolley/Recipient.java | 728 ++++-------------- .../com/trolley/trolley/RecipientAccount.java | 506 +++--------- .../trolley/RecipientAccountGateway.java | 192 ++--- .../com/trolley/trolley/RecipientGateway.java | 229 ++---- src/main/java/com/trolley/trolley/Total.java | 11 +- src/main/java/com/trolley/trolley/USD.java | 119 +-- 34 files changed, 1172 insertions(+), 3660 deletions(-) diff --git a/src/main/java/com/trolley/Exceptions/AuthenticationException.java b/src/main/java/com/trolley/Exceptions/AuthenticationException.java index 6b8cd96..6432a11 100644 --- a/src/main/java/com/trolley/Exceptions/AuthenticationException.java +++ b/src/main/java/com/trolley/Exceptions/AuthenticationException.java @@ -1,27 +1,11 @@ package com.trolley.Exceptions; -/** - *

AuthenticationException class.

- * - * @author joshua - * @version $Id: $Id - */ -public class AuthenticationException extends Exception { - - /** - *

Constructor for AuthenticationException.

- */ +public class AuthenticationException extends Exception +{ public AuthenticationException() { - super(); } - - /** - *

Constructor for AuthenticationException.

- * - * @param message a {@link java.lang.String} object. - */ - public AuthenticationException(String message) { + + public AuthenticationException(final String message) { super(message); } - } diff --git a/src/main/java/com/trolley/Exceptions/AuthorizationException.java b/src/main/java/com/trolley/Exceptions/AuthorizationException.java index c31e958..9f24e24 100644 --- a/src/main/java/com/trolley/Exceptions/AuthorizationException.java +++ b/src/main/java/com/trolley/Exceptions/AuthorizationException.java @@ -1,27 +1,11 @@ package com.trolley.Exceptions; -/** - *

AuthorizationException class.

- * - * @author joshua - * @version $Id: $Id - */ -public class AuthorizationException extends Exception { - - /** - *

Constructor for AuthorizationException.

- */ +public class AuthorizationException extends Exception +{ public AuthorizationException() { - super(); } - - /** - *

Constructor for AuthorizationException.

- * - * @param message a {@link java.lang.String} object. - */ - public AuthorizationException(String message) { + + public AuthorizationException(final String message) { super(message); } - } diff --git a/src/main/java/com/trolley/Exceptions/DownForMaintenanceException.java b/src/main/java/com/trolley/Exceptions/DownForMaintenanceException.java index 5b30a12..f2d7aec 100644 --- a/src/main/java/com/trolley/Exceptions/DownForMaintenanceException.java +++ b/src/main/java/com/trolley/Exceptions/DownForMaintenanceException.java @@ -1,27 +1,11 @@ package com.trolley.Exceptions; -/** - *

DownForMaintenanceException class.

- * - * @author joshua - * @version $Id: $Id - */ -public class DownForMaintenanceException extends Exception { - - /** - *

Constructor for DownForMaintenanceException.

- */ +public class DownForMaintenanceException extends Exception +{ public DownForMaintenanceException() { - super(); } - - /** - *

Constructor for DownForMaintenanceException.

- * - * @param message a {@link java.lang.String} object. - */ - public DownForMaintenanceException(String message) { + + public DownForMaintenanceException(final String message) { super(message); } - } diff --git a/src/main/java/com/trolley/Exceptions/InvalidFieldException.java b/src/main/java/com/trolley/Exceptions/InvalidFieldException.java index 9ca62d4..4ec0e6c 100644 --- a/src/main/java/com/trolley/Exceptions/InvalidFieldException.java +++ b/src/main/java/com/trolley/Exceptions/InvalidFieldException.java @@ -1,28 +1,12 @@ package com.trolley.Exceptions; -/** - *

InvalidFieldException class.

- * - * @author joshua - * @version $Id: $Id - */ -public class InvalidFieldException extends Exception { - - /** - *

Constructor for InvalidFieldException.

- */ +public class InvalidFieldException extends Exception +{ public InvalidFieldException() { - super(); } - - /** - *

Constructor for InvalidFieldException.

- * - * @param message a {@link java.lang.String} object. - */ - public InvalidFieldException(String message) { + + public InvalidFieldException(final String message) { super(message); } - } diff --git a/src/main/java/com/trolley/Exceptions/InvalidServerConnectionException.java b/src/main/java/com/trolley/Exceptions/InvalidServerConnectionException.java index 4ccf2ad..d41bafb 100644 --- a/src/main/java/com/trolley/Exceptions/InvalidServerConnectionException.java +++ b/src/main/java/com/trolley/Exceptions/InvalidServerConnectionException.java @@ -1,27 +1,11 @@ package com.trolley.Exceptions; -/** - *

InvalidServerConnectionException class.

- * - * @author joshua - * @version $Id: $Id - */ -public class InvalidServerConnectionException extends Exception { - - /** - *

Constructor for InvalidServerConnectionException.

- */ +public class InvalidServerConnectionException extends Exception +{ public InvalidServerConnectionException() { - super(); } - - /** - *

Constructor for InvalidServerConnectionException.

- * - * @param message a {@link java.lang.String} object. - */ - public InvalidServerConnectionException(String message) { + + public InvalidServerConnectionException(final String message) { super(message); } - } diff --git a/src/main/java/com/trolley/Exceptions/InvalidStatusCodeException.java b/src/main/java/com/trolley/Exceptions/InvalidStatusCodeException.java index cbd8524..a089ce4 100644 --- a/src/main/java/com/trolley/Exceptions/InvalidStatusCodeException.java +++ b/src/main/java/com/trolley/Exceptions/InvalidStatusCodeException.java @@ -1,27 +1,11 @@ package com.trolley.Exceptions; -/** - *

InvalidStatusCodeException class.

- * - * @author joshua - * @version $Id: $Id - */ -public class InvalidStatusCodeException extends Exception { - - /** - *

Constructor for InvalidStatusCodeException.

- */ +public class InvalidStatusCodeException extends Exception +{ public InvalidStatusCodeException() { - super(); } - - /** - *

Constructor for InvalidStatusCodeException.

- * - * @param message a {@link java.lang.String} object. - */ - public InvalidStatusCodeException(String message) { + + public InvalidStatusCodeException(final String message) { super(message); } - } diff --git a/src/main/java/com/trolley/Exceptions/MalformedException.java b/src/main/java/com/trolley/Exceptions/MalformedException.java index cc1d8f0..cf487f8 100644 --- a/src/main/java/com/trolley/Exceptions/MalformedException.java +++ b/src/main/java/com/trolley/Exceptions/MalformedException.java @@ -1,27 +1,11 @@ package com.trolley.Exceptions; -/** - *

MalformedException class.

- * - * @author joshua - * @version $Id: $Id - */ -public class MalformedException extends Exception { - - /** - *

Constructor for MalformedException.

- */ +public class MalformedException extends Exception +{ public MalformedException() { - super(); } - - /** - *

Constructor for MalformedException.

- * - * @param message a {@link java.lang.String} object. - */ - public MalformedException(String message) { + + public MalformedException(final String message) { super(message); } - } diff --git a/src/main/java/com/trolley/Exceptions/NotFoundException.java b/src/main/java/com/trolley/Exceptions/NotFoundException.java index bdaeef6..6b2b405 100644 --- a/src/main/java/com/trolley/Exceptions/NotFoundException.java +++ b/src/main/java/com/trolley/Exceptions/NotFoundException.java @@ -1,27 +1,11 @@ package com.trolley.Exceptions; -/** - *

NotFoundException class.

- * - * @author joshua - * @version $Id: $Id - */ -public class NotFoundException extends Exception { - - /** - *

Constructor for NotFoundException.

- */ +public class NotFoundException extends Exception +{ public NotFoundException() { - super(); } - - /** - *

Constructor for NotFoundException.

- * - * @param message a {@link java.lang.String} object. - */ - public NotFoundException(String message) { + + public NotFoundException(final String message) { super(message); } - } diff --git a/src/main/java/com/trolley/Exceptions/TooManyRequestsException.java b/src/main/java/com/trolley/Exceptions/TooManyRequestsException.java index 1ceb7a9..5ab979f 100644 --- a/src/main/java/com/trolley/Exceptions/TooManyRequestsException.java +++ b/src/main/java/com/trolley/Exceptions/TooManyRequestsException.java @@ -1,27 +1,11 @@ package com.trolley.Exceptions; -/** - *

TooManyRequestsException class.

- * - * @author joshua - * @version $Id: $Id - */ -public class TooManyRequestsException extends Exception { - - /** - *

Constructor for TooManyRequestsException.

- */ +public class TooManyRequestsException extends Exception +{ public TooManyRequestsException() { - super(); } - - /** - *

Constructor for TooManyRequestsException.

- * - * @param message a {@link java.lang.String} object. - */ - public TooManyRequestsException(String message) { + + public TooManyRequestsException(final String message) { super(message); } - } diff --git a/src/main/java/com/trolley/Exceptions/UnexpectedException.java b/src/main/java/com/trolley/Exceptions/UnexpectedException.java index 34bd3b1..7b839fb 100644 --- a/src/main/java/com/trolley/Exceptions/UnexpectedException.java +++ b/src/main/java/com/trolley/Exceptions/UnexpectedException.java @@ -1,27 +1,11 @@ package com.trolley.Exceptions; -/** - *

UnexpectedException class.

- * - * @author joshua - * @version $Id: $Id - */ -public class UnexpectedException extends Exception { - - /** - *

Constructor for UnexpectedException.

- */ +public class UnexpectedException extends Exception +{ public UnexpectedException() { - super(); } - - /** - *

Constructor for UnexpectedException.

- * - * @param message a {@link java.lang.String} object. - */ - public UnexpectedException(String message) { + + public UnexpectedException(final String message) { super(message); } - } diff --git a/src/main/java/com/trolley/trolley/Address.java b/src/main/java/com/trolley/trolley/Address.java index cbab7d6..22fff04 100644 --- a/src/main/java/com/trolley/trolley/Address.java +++ b/src/main/java/com/trolley/trolley/Address.java @@ -3,13 +3,8 @@ import java.util.HashMap; import java.util.Map; -/** - *

Address class.

- * - * @author joshua - * @version $Id: $Id - */ -public class Address { +public class Address +{ private String street1; private String street2; private String city; @@ -18,168 +13,81 @@ public class Address { private String region; private String phone; private Boolean phoneValidated; - private Map additionalProperties = new HashMap(); - - /** - *

Getter for the field street1.

- * - * @return a {@link java.lang.String} object. - */ + private Map additionalProperties; + + public Address() { + this.additionalProperties = new HashMap(); + } + public String getStreet1() { - return street1; + return this.street1; } - - /** - *

Setter for the field street1.

- * - * @param street1 a {@link java.lang.String} object. - */ - public void setStreet1(String street1) { + + public void setStreet1(final String street1) { this.street1 = street1; } - - /** - *

Getter for the field street2.

- * - * @return a {@link java.lang.String} object. - */ + public String getStreet2() { - return street2; + return this.street2; } - - /** - *

Setter for the field street2.

- * - * @param street2 a {@link java.lang.String} object. - */ - public void setStreet2(String street2) { + + public void setStreet2(final String street2) { this.street2 = street2; } - - /** - *

Getter for the field city.

- * - * @return a {@link java.lang.String} object. - */ + public String getCity() { - return city; + return this.city; } - - /** - *

Setter for the field city.

- * - * @param city a {@link java.lang.String} object. - */ - public void setCity(String city) { + + public void setCity(final String city) { this.city = city; } - - /** - *

Getter for the field postalCode.

- * - * @return a {@link java.lang.String} object. - */ + public String getPostalCode() { - return postalCode; + return this.postalCode; } - - /** - *

Setter for the field postalCode.

- * - * @param postalCode a {@link java.lang.String} object. - */ - public void setPostalCode(String postalCode) { + + public void setPostalCode(final String postalCode) { this.postalCode = postalCode; } - - /** - *

Getter for the field country.

- * - * @return a {@link java.lang.String} object. - */ + public String getCountry() { - return country; + return this.country; } - - /** - *

Setter for the field country.

- * - * @param country a {@link java.lang.String} object. - */ - public void setCountry(String country) { + + public void setCountry(final String country) { this.country = country; } - - /** - *

Getter for the field region.

- * - * @return a {@link java.lang.String} object. - */ + public String getRegion() { - return region; + return this.region; } - - /** - *

Setter for the field region.

- * - * @param region a {@link java.lang.String} object. - */ - public void setRegion(String region) { + + public void setRegion(final String region) { this.region = region; } - - /** - *

Getter for the field phone.

- * - * @return a {@link java.lang.String} object. - */ + public String getPhone() { - return phone; + return this.phone; } - - /** - *

Setter for the field phone.

- * - * @param phone a {@link java.lang.String} object. - */ - public void setPhone(String phone) { + + public void setPhone(final String phone) { this.phone = phone; } - - /** - *

Getter for the field phoneValidated.

- * - * @return a {@link java.lang.Boolean} object. - */ + public Boolean getPhoneValidated() { - return phoneValidated; + return this.phoneValidated; } - - /** - *

Setter for the field phoneValidated.

- * - * @param phoneValidated a {@link java.lang.Boolean} object. - */ - public void setPhoneValidated(Boolean phoneValidated) { + + public void setPhoneValidated(final Boolean phoneValidated) { this.phoneValidated = phoneValidated; } - - /** - *

Getter for the field additionalProperties.

- * - * @return a {@link java.util.Map} object. - */ + public Map getAdditionalProperties() { return this.additionalProperties; } - - /** - *

setAdditionalProperty.

- * - * @param name a {@link java.lang.String} object. - * @param value a {@link java.lang.Object} object. - */ - public void setAdditionalProperty(String name, Object value) { + + public void setAdditionalProperty(final String name, final Object value) { this.additionalProperties.put(name, value); } } diff --git a/src/main/java/com/trolley/trolley/Balances.java b/src/main/java/com/trolley/trolley/Balances.java index e62907c..53afd8a 100644 --- a/src/main/java/com/trolley/trolley/Balances.java +++ b/src/main/java/com/trolley/trolley/Balances.java @@ -1,98 +1,40 @@ package com.trolley.trolley; -/** - *

Balances class.

- * - * @author joshua - * @version $Id: $Id - */ -public class Balances { - +public class Balances +{ public EUR EUR; - public USD USD; - public CAD CAD; - - /** - *

getEUR.

- * - * @return a {@link com.trolley.trolley.EUR} object. - */ + public EUR getEUR() { - return EUR; + return this.EUR; } - - /** - *

setEUR.

- * - * @param EUR a {@link com.trolley.trolley.EUR} object. - */ - public void setEUR(EUR EUR) { + + public void setEUR(final EUR EUR) { this.EUR = EUR; } - - /** - *

getUSD.

- * - * @return a {@link com.trolley.trolley.USD} object. - */ + public USD getUSD() { - return USD; + return this.USD; } - - /** - *

setUSD.

- * - * @param USD a {@link com.trolley.trolley.USD} object. - */ - public void setUSD(USD USD) { + + public void setUSD(final USD USD) { this.USD = USD; } - - /** - *

getCAD.

- * - * @return a {@link com.trolley.trolley.CAD} object. - */ + public CAD getCAD() { - return CAD; + return this.CAD; } - - /** - *

setCAD.

- * - * @param CAD a {@link com.trolley.trolley.CAD} object. - */ - public void setCAD(CAD CAD) { + + public void setCAD(final CAD CAD) { this.CAD = CAD; } - - /** - * Retrieves all account balances - * - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws java.lang.Exception if any. - */ + public static String find() throws Exception { return find(""); } - - /** - * Retrieves balance based on term - * - * @param term (paypal or trolley) - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws java.lang.Exception if any. - */ - public static String find(String term) throws Exception { + + public static String find(final String term) throws Exception { return Configuration.gateway().balances.find(term); } - } diff --git a/src/main/java/com/trolley/trolley/BalancesGateway.java b/src/main/java/com/trolley/trolley/BalancesGateway.java index 411750e..7127ebd 100644 --- a/src/main/java/com/trolley/trolley/BalancesGateway.java +++ b/src/main/java/com/trolley/trolley/BalancesGateway.java @@ -2,37 +2,20 @@ import com.trolley.Exceptions.InvalidFieldException; -/** - *

BalancesGateway class.

- * - * @author joshua - * @version $Id: $Id - */ -public class BalancesGateway { +public class BalancesGateway +{ Client client; - /** - *

Constructor for BalancesGateway.

- * - * @param config a {@link com.trolley.trolley.Configuration} object. - */ - public BalancesGateway(Configuration config) { + public BalancesGateway(final Configuration config) { this.client = new Client(config); } - - /** - *

find.

- * - * @param term a {@link java.lang.String} object. - * @return a {@link java.lang.String} object. - * @throws java.lang.Exception if any. - */ - public String find(String term) throws Exception { + + public String find(final String term) throws Exception { if (term == null) { throw new InvalidFieldException("Term cannot be null"); } - String endPoint = "/v1/balances/" + term; - String response = this.client.get(endPoint); + final String endPoint = "/v1/balances/" + term; + final String response = this.client.get(endPoint); return response; } } diff --git a/src/main/java/com/trolley/trolley/BankTransfer.java b/src/main/java/com/trolley/trolley/BankTransfer.java index c426eea..4ff2b46 100644 --- a/src/main/java/com/trolley/trolley/BankTransfer.java +++ b/src/main/java/com/trolley/trolley/BankTransfer.java @@ -1,13 +1,7 @@ package com.trolley.trolley; -/** - *

BankTransfer class.

- * - * @author joshua - * @version $Id: $Id - */ -public class BankTransfer { - +public class BankTransfer +{ public Integer count; public String totalFees; public String merchantFees; diff --git a/src/main/java/com/trolley/trolley/Batch.java b/src/main/java/com/trolley/trolley/Batch.java index 3930e1c..3478d1e 100644 --- a/src/main/java/com/trolley/trolley/Batch.java +++ b/src/main/java/com/trolley/trolley/Batch.java @@ -2,17 +2,10 @@ import java.util.List; import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -/** - *

Batch class.

- * - * @author joshua - * @version $Id: $Id - */ -@JsonInclude(Include.NON_NULL) -public class Batch { +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Batch +{ private String id; private String status; private String amount; @@ -23,380 +16,142 @@ public class Batch { private Object completedAt; private String createdAt; private String updatedAt; - private List payments; - public String quoteExpiredAt; - - /** - *

Getter for the field id.

- * - * @return a {@link java.lang.String} object. - */ + public String getId() { - return id; + return this.id; } - - /** - *

Setter for the field id.

- * - * @param id a {@link java.lang.String} object. - */ - public void setId(String id) { + + public void setId(final String id) { this.id = id; } - - /** - *

Getter for the field status.

- * - * @return a {@link java.lang.String} object. - */ + public String getStatus() { - return status; + return this.status; } - - /** - *

Setter for the field status.

- * - * @param status a {@link java.lang.String} object. - */ - public void setStatus(String status) { + + public void setStatus(final String status) { this.status = status; } - - /** - *

Getter for the field amount.

- * - * @return a {@link java.lang.String} object. - */ + public String getAmount() { - return amount; + return this.amount; } - - /** - *

Setter for the field amount.

- * - * @param amount a {@link java.lang.String} object. - */ - public void setAmount(String amount) { + + public void setAmount(final String amount) { this.amount = amount; } - - /** - *

Getter for the field totalPayments.

- * - * @return a {@link java.lang.Integer} object. - */ + public Integer getTotalPayments() { - return totalPayments; + return this.totalPayments; } - - /** - *

Setter for the field totalPayments.

- * - * @param totalPayments a {@link java.lang.Integer} object. - */ - public void setTotalPayments(Integer totalPayments) { + + public void setTotalPayments(final Integer totalPayments) { this.totalPayments = totalPayments; } - - /** - *

Getter for the field currency.

- * - * @return a {@link java.lang.String} object. - */ + public String getCurrency() { - return currency; + return this.currency; } - - /** - *

Setter for the field currency.

- * - * @param currency a {@link java.lang.String} object. - */ - public void setCurrency(String currency) { + + public void setCurrency(final String currency) { this.currency = currency; } - - /** - *

Getter for the field description.

- * - * @return a {@link java.lang.String} object. - */ + public String getDescription() { - return description; + return this.description; } - - /** - *

Setter for the field description.

- * - * @param description a {@link java.lang.String} object. - */ - public void setDescription(String description) { + + public void setDescription(final String description) { this.description = description; } - - /** - *

Getter for the field sentAt.

- * - * @return a {@link java.lang.Object} object. - */ + public Object getSentAt() { - return sentAt; + return this.sentAt; } - - /** - *

Setter for the field sentAt.

- * - * @param sentAt a {@link java.lang.Object} object. - */ - public void setSentAt(Object sentAt) { + + public void setSentAt(final Object sentAt) { this.sentAt = sentAt; } - - /** - *

Getter for the field completedAt.

- * - * @return a {@link java.lang.Object} object. - */ + public Object getCompletedAt() { - return completedAt; + return this.completedAt; } - - /** - *

Setter for the field completedAt.

- * - * @param completedAt a {@link java.lang.Object} object. - */ - public void setCompletedAt(Object completedAt) { + + public void setCompletedAt(final Object completedAt) { this.completedAt = completedAt; } - - /** - *

Getter for the field createdAt.

- * - * @return a {@link java.lang.String} object. - */ + public String getCreatedAt() { - return createdAt; + return this.createdAt; } - - /** - *

Setter for the field createdAt.

- * - * @param createdAt a {@link java.lang.String} object. - */ - public void setCreatedAt(String createdAt) { + + public void setCreatedAt(final String createdAt) { this.createdAt = createdAt; } - - /** - *

Getter for the field updatedAt.

- * - * @return a {@link java.lang.String} object. - */ + public String getUpdatedAt() { - return updatedAt; + return this.updatedAt; } - - /** - *

Setter for the field updatedAt.

- * - * @param updatedAt a {@link java.lang.String} object. - */ - public void setUpdatedAt(String updatedAt) { + + public void setUpdatedAt(final String updatedAt) { this.updatedAt = updatedAt; } - - /** - *

Getter for the field payments.

- * - * @return a {@link java.util.List} object. - */ + public List getPayments() { - return payments; + return this.payments; } - - /** - *

Setter for the field payments.

- * - * @param payments a {@link java.util.List} object. - */ - public void setPayments(List payments) { + + public void setPayments(final List payments) { this.payments = payments; } - - /** - * Retrieves a batch based on the batch id given - * - * @param batch_id a {@link java.lang.String} object. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws java.lang.Exception if any. - */ - public static Batch find(String batch_id) throws Exception { + + public static Batch find(final String batch_id) throws Exception { return Configuration.gateway().batch.find(batch_id); } - - /** - * Updates a batch based on the batch id and body - * - * @param batch_id a {@link java.lang.String} object. - * @param body a {@link java.lang.String} object. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws java.lang.Exception if any. - */ - public static boolean update(String batch_id, String body) throws Exception { + + public static boolean update(final String batch_id, final String body) throws Exception { return Configuration.gateway().batch.update(batch_id, body); } - - /** - * Deletes a batch based on batch id - * - * @param batch_id a {@link java.lang.String} object. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws java.lang.Exception if any. - */ - public static boolean delete(String batch_id) throws Exception { + + public static boolean delete(final String batch_id) throws Exception { return Configuration.gateway().batch.delete(batch_id); } - - /** - * Creates a batch based on batch the body - * - * @param body a {@link java.lang.String} object. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws java.lang.Exception if any. - */ - public static Batch create(String body) throws Exception { + + public static Batch create(final String body) throws Exception { return Configuration.gateway().batch.create(body); } - - /** - *

create.

- * - * @param body a {@link com.trolley.trolley.Batch} object. - * @return a {@link com.trolley.trolley.Batch} object. - * @throws java.lang.Exception if any. - */ - public static Batch create(Batch body) throws Exception { + + public static Batch create(final Batch body) throws Exception { return Configuration.gateway().batch.create(body); } - - /** - * Generate a quote for a batch - * - * @param batch_id a {@link java.lang.String} object. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws java.lang.Exception if any. - */ - public static String generateQuote(String batch_id) throws Exception { + + public static String generateQuote(final String batch_id) throws Exception { return Configuration.gateway().batch.generateQuote(batch_id); } - - /** - * Process a batch - * - * @param batch_id a {@link java.lang.String} object. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws java.lang.Exception if any. - */ - public static String processBatch(String batch_id) throws Exception { + + public static String processBatch(final String batch_id) throws Exception { return Configuration.gateway().batch.processBatch(batch_id); } - - /** - * List all Batches based on the recipient id and (optional) a given - * wildcard, page amount and page size - * - * @param page - * @param pageSize - * @param pageSize a int. - * @param message a {@link java.lang.String} object. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws java.lang.Exception if any. - */ - public static List query(int page, int pageSize, String message) throws Exception { + + public static List query(final int page, final int pageSize, final String message) throws Exception { return Configuration.gateway().batch.query(page, pageSize, message); - } - - /** - * List all batches based on the recipient id and a given wildcard - * - * @param message a {@link java.lang.String} object. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws java.lang.Exception if any. - */ - public static List query(String message) throws Exception { + + public static List query(final String message) throws Exception { return query(1, 10, message); } - - /** - * List all batches - * - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws java.lang.Exception if any. - */ + public static List query() throws Exception { return query(1, 10, ""); } - - /** - * List all batches based on the recipient id and (optional) page amount and - * page size - * - * @param page - * @param pageNumber - * @param pageNumber a int. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws java.lang.Exception if any. - */ - public static List query(int page, int pageNumber) throws Exception { + + public static List query(final int page, final int pageNumber) throws Exception { return query(page, pageNumber, ""); } - - /** - * Retrieves summary of batch - * - * @param batch_id a {@link java.lang.String} object. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws java.lang.Exception if any. - */ - public static BatchSummary summary(String batch_id) throws Exception { + + public static BatchSummary summary(final String batch_id) throws Exception { return Configuration.gateway().batch.summary(batch_id); - } } diff --git a/src/main/java/com/trolley/trolley/BatchGateway.java b/src/main/java/com/trolley/trolley/BatchGateway.java index b3dd78a..a585cf3 100644 --- a/src/main/java/com/trolley/trolley/BatchGateway.java +++ b/src/main/java/com/trolley/trolley/BatchGateway.java @@ -2,188 +2,101 @@ import java.io.IOException; import java.util.ArrayList; -import java.util.List; -import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.DeserializationFeature; +import java.util.List; import com.fasterxml.jackson.databind.ObjectMapper; import com.trolley.Exceptions.InvalidFieldException; -/** - *

BatchGateway class.

- * - * @author joshua - * @version $Id: $Id - */ -public class BatchGateway { +public class BatchGateway +{ Client client; - - /** - *

Constructor for BatchGateway.

- * - * @param config a {@link com.trolley.trolley.Configuration} object. - */ - public BatchGateway(Configuration config) { + + public BatchGateway(final Configuration config) { this.client = new Client(config); } - - /** - *

find.

- * - * @param batch_id a {@link java.lang.String} object. - * @return a {@link com.trolley.trolley.Batch} object. - * @throws java.lang.Exception if any. - */ - public Batch find(String batch_id) throws Exception { + + public Batch find(final String batch_id) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); } - - String endPoint = "/v1/batches/" + batch_id; - String response = this.client.get(endPoint); - return batchFactory(response); + final String endPoint = "/v1/batches/" + batch_id; + final String response = this.client.get(endPoint); + return this.batchFactory(response); } - - /** - *

update.

- * - * @param batch_id a {@link java.lang.String} object. - * @param body a {@link java.lang.String} object. - * @return a boolean. - * @throws java.lang.Exception if any. - */ - public boolean update(String batch_id, String body) throws Exception { + + public boolean update(final String batch_id, final String body) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); } if (body == null || body.isEmpty()) { throw new InvalidFieldException("Body cannot be null or empty."); } - - String endPoint = "/v1/batches/" + batch_id; + final String endPoint = "/v1/batches/" + batch_id; this.client.patch(endPoint, body); return true; } - - /** - *

update.

- * - * @param batch_id a {@link java.lang.String} object. - * @param batch a {@link com.trolley.trolley.Batch} object. - * @return a boolean. - * @throws java.lang.Exception if any. - */ - public boolean update(String batch_id, Batch batch) throws Exception { + + public boolean update(final String batch_id, final Batch batch) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); } if (batch == null) { throw new InvalidFieldException("Body cannot be null or empty."); } - - String jsonBatch = new ObjectMapper().writeValueAsString(batch); - - String endPoint = "/v1/batches/" + batch_id; + final String jsonBatch = new ObjectMapper().writeValueAsString((Object)batch); + final String endPoint = "/v1/batches/" + batch_id; this.client.patch(endPoint, jsonBatch); - return true; } - - /** - *

delete.

- * - * @param batch_id a {@link java.lang.String} object. - * @return a boolean. - * @throws java.lang.Exception if any. - */ - public boolean delete(String batch_id) throws Exception { + + public boolean delete(final String batch_id) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); } - - String endPoint = "/v1/batches/" + batch_id; + final String endPoint = "/v1/batches/" + batch_id; this.client.delete(endPoint); return true; } - - /** - *

create.

- * - * @param body a {@link java.lang.String} object. - * @return a {@link com.trolley.trolley.Batch} object. - * @throws java.lang.Exception if any. - */ - public Batch create(String body) throws Exception { + + public Batch create(final String body) throws Exception { if (body == null || body.isEmpty()) { throw new InvalidFieldException("Body cannot be null or empty."); } - - String endPoint = "/v1/batches/"; - String response = this.client.post(endPoint, body); - return batchFactory(response); + final String endPoint = "/v1/batches/"; + final String response = this.client.post(endPoint, body); + return this.batchFactory(response); } - - /** - *

create.

- * - * @param batch a {@link com.trolley.trolley.Batch} object. - * @return a {@link com.trolley.trolley.Batch} object. - * @throws java.lang.Exception if any. - */ - public Batch create(Batch batch) throws Exception { + + public Batch create(final Batch batch) throws Exception { if (batch == null) { throw new InvalidFieldException("Batch cannot be null."); } - - String result = new ObjectMapper().writeValueAsString(batch); - String endPoint = "/v1/batches/"; - String response = this.client.post(endPoint, result); - - return batchFactory(response); + final String result = new ObjectMapper().writeValueAsString((Object)batch); + final String endPoint = "/v1/batches/"; + final String response = this.client.post(endPoint, result); + return this.batchFactory(response); } - - /** - *

generateQuote.

- * - * @param batch_id a {@link java.lang.String} object. - * @return a {@link java.lang.String} object. - * @throws java.lang.Exception if any. - */ - public String generateQuote(String batch_id) throws Exception { + + public String generateQuote(final String batch_id) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); } - - String endPoint = "/v1/batches/" + batch_id + "/generate-quote"; - String response = this.client.post(endPoint); + final String endPoint = "/v1/batches/" + batch_id + "/generate-quote"; + final String response = this.client.post(endPoint); return response; } - - /** - *

processBatch.

- * - * @param batch_id a {@link java.lang.String} object. - * @return a {@link java.lang.String} object. - * @throws java.lang.Exception if any. - */ - public String processBatch(String batch_id) throws Exception { + + public String processBatch(final String batch_id) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); } - String endPoint = "/v1/batches/" + batch_id + "/start-processing"; - String response = this.client.post(endPoint); + final String endPoint = "/v1/batches/" + batch_id + "/start-processing"; + final String response = this.client.post(endPoint); return response; } - - /** - *

query.

- * - * @param page a int. - * @param pageSize a int. - * @param message a {@link java.lang.String} object. - * @return a {@link java.util.List} object. - * @throws java.lang.Exception if any. - */ - public List query(int page, int pageSize, String message) throws Exception { + + public List query(final int page, final int pageSize, final String message) throws Exception { if (page < 0) { throw new InvalidFieldException("Page cannot be less than 0"); } @@ -193,99 +106,62 @@ public List query(int page, int pageSize, String message) throws Exceptio if (message == null) { throw new InvalidFieldException("Message cannot be null"); } - String endPoint = "/v1/batches/?" + "&search=" + message + "&page=" + page + "&pageSize=" + pageSize; - String response = this.client.get(endPoint); - return batchListFactory(response); + final String endPoint = "/v1/batches/?&search=" + message + "&page=" + page + "&pageSize=" + pageSize; + final String response = this.client.get(endPoint); + return this.batchListFactory(response); } - - /** - *

query.

- * - * @param message a {@link java.lang.String} object. - * @return a {@link java.util.List} object. - * @throws java.lang.Exception if any. - */ - public List query(String message) throws Exception { - return query(1, 10, message); + + public List query(final String message) throws Exception { + return this.query(1, 10, message); } - - /** - *

query.

- * - * @return a {@link java.util.List} object. - * @throws java.lang.Exception if any. - */ + public List query() throws Exception { - return query(1, 10, ""); + return this.query(1, 10, ""); } - - /** - *

query.

- * - * @param page a int. - * @param pageNumber a int. - * @return a {@link java.util.List} object. - * @throws java.lang.Exception if any. - */ - public List query(int page, int pageNumber) throws Exception { - return query(page, pageNumber, ""); + + public List query(final int page, final int pageNumber) throws Exception { + return this.query(page, pageNumber, ""); } - - /** - *

summary.

- * - * @param batch_id a {@link java.lang.String} object. - * @return a {@link com.trolley.trolley.BatchSummary} object. - * @throws java.lang.Exception if any. - */ - public BatchSummary summary(String batch_id) throws Exception { + + public BatchSummary summary(final String batch_id) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null os empty"); } - - String endPoint = "/v1/batches/" + batch_id + "/summary"; - String response = this.client.get(endPoint); - - ObjectMapper mapper = new ObjectMapper(); + final String endPoint = "/v1/batches/" + batch_id + "/summary"; + final String response = this.client.get(endPoint); + final ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - JsonNode node = mapper.readTree(response); - BatchSummary batchSummary = mapper.readValue(node.get("batchSummary").traverse(), BatchSummary.class); + final JsonNode node = mapper.readTree(response); + final BatchSummary batchSummary = (BatchSummary)mapper.readValue(node.get("batchSummary").traverse(), (Class)BatchSummary.class); return batchSummary; } - - private Batch batchFactory(String data) throws IOException { - ObjectMapper mapper = new ObjectMapper(); - JsonNode node = mapper.readTree(data); - + + private Batch batchFactory(final String data) throws IOException { + final ObjectMapper mapper = new ObjectMapper(); + final JsonNode node = mapper.readTree(data); mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - Object payments = mapper.readValue(node.get("batch").get("payments").get("payments").traverse(), Object.class); - - @SuppressWarnings("unchecked") - List castPayments = (List) payments; - List paymentList = new ArrayList(); - - for (int i = 0; i < castPayments.size(); i++) { - Payment payment = mapper.convertValue(castPayments.get(i), Payment.class); + final Object payments = mapper.readValue(node.get("batch").get("payments").get("payments").traverse(), (Class)Object.class); + final List castPayments = (List)payments; + final List paymentList = new ArrayList(); + for (int i = 0; i < castPayments.size(); ++i) { + final Payment payment = (Payment)mapper.convertValue((Object)castPayments.get(i), (Class)Payment.class); paymentList.add(payment); } - - Batch batch = mapper.readValue(node.get("batch").traverse(), Batch.class); + final Batch batch = (Batch)mapper.readValue(node.get("batch").traverse(), (Class)Batch.class); batch.setPayments(paymentList); return batch; } - - private List batchListFactory(String data) throws IOException { - ObjectMapper mapper = new ObjectMapper(); - JsonNode node = mapper.readTree(data); + + private List batchListFactory(final String data) throws IOException { + final ObjectMapper mapper = new ObjectMapper(); + final JsonNode node = mapper.readTree(data); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - Object batch = mapper.readValue(node.get("batches").traverse(), Object.class); - @SuppressWarnings("unchecked") - List batchs = (List) batch; - List batches = new ArrayList(); - for (int i = 0; i < batchs.size(); i++) { - Batch pojo = mapper.convertValue(batchs.get(i), Batch.class); + final Object batch = mapper.readValue(node.get("batches").traverse(), (Class)Object.class); + final List batchs = (List)batch; + final List batches = new ArrayList(); + for (int i = 0; i < batchs.size(); ++i) { + final Batch pojo = (Batch)mapper.convertValue((Object)batchs.get(i), (Class)Batch.class); batches.add(pojo); } return batches; diff --git a/src/main/java/com/trolley/trolley/BatchSummary.java b/src/main/java/com/trolley/trolley/BatchSummary.java index 45bdf6b..2938941 100644 --- a/src/main/java/com/trolley/trolley/BatchSummary.java +++ b/src/main/java/com/trolley/trolley/BatchSummary.java @@ -1,14 +1,7 @@ package com.trolley.trolley; -/** - *

BatchSummary class.

- * - * @author joshua - * @version $Id: $Id - */ -public class BatchSummary { - +public class BatchSummary +{ public Total total; public Detail detail; - } diff --git a/src/main/java/com/trolley/trolley/CAD.java b/src/main/java/com/trolley/trolley/CAD.java index f791937..31f7af7 100644 --- a/src/main/java/com/trolley/trolley/CAD.java +++ b/src/main/java/com/trolley/trolley/CAD.java @@ -1,126 +1,59 @@ package com.trolley.trolley; -/** - *

CAD class.

- * - * @author joshua - * @version $Id: $Id - */ -public class CAD { - +public class CAD +{ private Boolean primary; private String amount; private String currency; private String type; private String accountNumber; private Boolean display; - - /** - *

Getter for the field primary.

- * - * @return a {@link java.lang.Boolean} object. - */ + public Boolean getPrimary() { - return primary; + return this.primary; } - - /** - *

Setter for the field primary.

- * - * @param primary a {@link java.lang.Boolean} object. - */ - public void setPrimary(Boolean primary) { + + public void setPrimary(final Boolean primary) { this.primary = primary; } - - /** - *

Getter for the field amount.

- * - * @return a {@link java.lang.String} object. - */ + public String getAmount() { - return amount; + return this.amount; } - - /** - *

Setter for the field amount.

- * - * @param amount a {@link java.lang.String} object. - */ - public void setAmount(String amount) { + + public void setAmount(final String amount) { this.amount = amount; } - - /** - *

Getter for the field currency.

- * - * @return a {@link java.lang.String} object. - */ + public String getCurrency() { - return currency; + return this.currency; } - - /** - *

Setter for the field currency.

- * - * @param currency a {@link java.lang.String} object. - */ - public void setCurrency(String currency) { + + public void setCurrency(final String currency) { this.currency = currency; } - - /** - *

Getter for the field type.

- * - * @return a {@link java.lang.String} object. - */ + public String getType() { - return type; + return this.type; } - - /** - *

Setter for the field type.

- * - * @param type a {@link java.lang.String} object. - */ - public void setType(String type) { + + public void setType(final String type) { this.type = type; } - - /** - *

Getter for the field accountNumber.

- * - * @return a {@link java.lang.String} object. - */ + public String getAccountNumber() { - return accountNumber; + return this.accountNumber; } - - /** - *

Setter for the field accountNumber.

- * - * @param accountNumber a {@link java.lang.String} object. - */ - public void setAccountNumber(String accountNumber) { + + public void setAccountNumber(final String accountNumber) { this.accountNumber = accountNumber; } - - /** - *

Getter for the field display.

- * - * @return a {@link java.lang.Boolean} object. - */ + public Boolean getDisplay() { - return display; + return this.display; } - - /** - *

Setter for the field display.

- * - * @param display a {@link java.lang.Boolean} object. - */ - public void setDisplay(Boolean display) { + + public void setDisplay(final Boolean display) { this.display = display; } - } diff --git a/src/main/java/com/trolley/trolley/Client.java b/src/main/java/com/trolley/trolley/Client.java index f12a549..3d008b5 100644 --- a/src/main/java/com/trolley/trolley/Client.java +++ b/src/main/java/com/trolley/trolley/Client.java @@ -1,250 +1,212 @@ package com.trolley.trolley; -import java.io.BufferedReader; -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.URL; -import java.rmi.UnexpectedException; - +import java.security.Key; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; - -import com.trolley.Exceptions.*; - +import com.trolley.Exceptions.DownForMaintenanceException; +import com.trolley.Exceptions.InvalidServerConnectionException; +import com.trolley.Exceptions.TooManyRequestsException; +import com.trolley.Exceptions.InvalidStatusCodeException; +import com.trolley.Exceptions.NotFoundException; +import com.trolley.Exceptions.AuthorizationException; +import com.trolley.Exceptions.AuthenticationException; +import com.trolley.Exceptions.MalformedException; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpPatch; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.HttpEntity; import org.apache.http.entity.StringEntity; +import org.apache.http.client.methods.HttpPatch; import org.apache.http.impl.client.HttpClients; +import java.io.IOException; +import java.rmi.UnexpectedException; +import java.io.Reader; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.DataOutputStream; +import java.net.HttpURLConnection; +import java.net.URL; -/** - *

Client class.

- * - * @author joshua - * @version $Id: $Id - */ -public class Client { - +public class Client +{ private Configuration config; - - /** - *

Constructor for Client.

- * - * @param config a {@link com.trolley.trolley.Configuration} object. - */ - public Client(Configuration config) { + + public Client(final Configuration config) { this.config = config; } - - /** - * Factory Method to create an instance of Client - * - * @return Client - * @param config a {@link com.trolley.trolley.Configuration} object. - */ - public static Client create(Configuration config) { + + public static Client create(final Configuration config) { return new Client(config); } - - private String sendRequest(String method, String endPoint, String body) throws Exception { + + private String sendRequest(final String method, final String endPoint, final String body) throws Exception { String StringResponse = ""; - HttpURLConnection con; try { - String url = this.config.getApiBase() + endPoint; - URL obj = new URL(url); - con = (HttpURLConnection) obj.openConnection(); - - int timeStamp = (int) (System.currentTimeMillis() / 1000L); - String authorizarion = generateAuthorization(timeStamp, method, endPoint, body); - + final String url = this.config.getApiBase() + endPoint; + final URL obj = new URL(url); + final HttpURLConnection con = (HttpURLConnection)obj.openConnection(); + final int timeStamp = (int)(System.currentTimeMillis() / 1000L); + final String authorizarion = this.generateAuthorization(timeStamp, method, endPoint, body); con.setRequestMethod(method); - con.setRequestProperty("X-PR-Timestamp", timeStamp + ""); con.setRequestProperty("Authorization", authorizarion); con.setRequestProperty("Content-Type", "application/json"); if (method == "POST" && body != "") { - con.setDoOutput(true); - try (DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { + final DataOutputStream wr = new DataOutputStream(con.getOutputStream()); + try { wr.writeBytes(body); wr.flush(); + wr.close(); + } + catch (Throwable t) { + try { + wr.close(); + } + catch (Throwable exception) { + t.addSuppressed(exception); + } + throw t; } } - int responseCode = con.getResponseCode(); - + final int responseCode = con.getResponseCode(); if (responseCode != 200) { - throwStatusCodeException(responseCode, con.getResponseMessage()); + this.throwStatusCodeException(responseCode, con.getResponseMessage()); } - StringBuffer response; - try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { - String inputLine; - response = new StringBuffer(); - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); + try { + final BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); + try { + final StringBuffer response = new StringBuffer(); + String inputLine; + while ((inputLine = in.readLine()) != null) { + response.append(inputLine); + } + StringResponse = response.toString(); + in.close(); } - StringResponse = response.toString(); - } catch (IOException e) { + catch (Throwable t2) { + try { + in.close(); + } + catch (Throwable exception2) { + t2.addSuppressed(exception2); + } + throw t2; + } + } + catch (IOException e) { throw new UnexpectedException(StringResponse); } - - } catch (IOException e) { + } + catch (IOException e2) { throw new UnexpectedException(StringResponse); } return StringResponse; } - - private String sendRequest(String method, String endPoint) throws Exception { - return sendRequest(method, endPoint, ""); + + private String sendRequest(final String method, final String endPoint) throws Exception { + return this.sendRequest(method, endPoint, ""); } - - /** - * Makes an HTTP GET request to the API - * - * @param endPoint a {@link java.lang.String} object. - * @return The response - * @throws java.lang.Exception if any. - */ - public String get(String endPoint) throws Exception { - return sendRequest("GET", endPoint); + + public String get(final String endPoint) throws Exception { + return this.sendRequest("GET", endPoint); } - - /** - * Makes an HTTP POST request to the API - * - * @param endPoint a {@link java.lang.String} object. - * @param body a {@link java.lang.String} object. - * @return The response - * @throws java.lang.Exception if any. - */ - public String post(String endPoint, String body) throws Exception { - return sendRequest("POST", endPoint, body); + + public String post(final String endPoint, final String body) throws Exception { + return this.sendRequest("POST", endPoint, body); } - - // public String post(String endPoint, Object body) throws Exception { - // String result = new ObjectMapper().writeValueAsString(body); - - // return sendRequest("POST", endPoint, result); - // } - - /** - * Makes an HTTP POST request to the API - * - * @param endPoint a {@link java.lang.String} object. - * @return The response - * @throws java.lang.Exception if any. - */ - public String post(String endPoint) throws Exception { - return sendRequest("POST", endPoint); + + public String post(final String endPoint) throws Exception { + return this.sendRequest("POST", endPoint); } - /** - * Makes an HTTP PATCH request to the API - * - * @param endPoint a {@link java.lang.String} object. - * @param body a {@link java.lang.String} object. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws java.lang.Exception if any. - */ - public String patch(String endPoint, String body) throws Exception { + + public String patch(final String endPoint, final String body) throws Exception { String StringResponse = ""; try { - - HttpClient httpclient = HttpClients.createDefault(); - HttpPatch httpPatch = new HttpPatch(this.config.getApiBase() + endPoint); - StringEntity params = new StringEntity(body); - - int timeStamp = (int) (System.currentTimeMillis() / 1000L); - String authorizarion = generateAuthorization(timeStamp, "PATCH", endPoint, body); - + final HttpClient httpclient = (HttpClient)HttpClients.createDefault(); + final HttpPatch httpPatch = new HttpPatch(this.config.getApiBase() + endPoint); + final StringEntity params = new StringEntity(body); + final int timeStamp = (int)(System.currentTimeMillis() / 1000L); + final String authorizarion = this.generateAuthorization(timeStamp, "PATCH", endPoint, body); params.setContentType("application/json"); - - httpPatch.setEntity(params); + httpPatch.setEntity((HttpEntity)params); httpPatch.addHeader("X-PR-Timestamp", timeStamp + ""); httpPatch.addHeader("Authorization", authorizarion); - - HttpResponse response = httpclient.execute(httpPatch); - StringBuffer result = new StringBuffer(); + final HttpResponse response = httpclient.execute((HttpUriRequest)httpPatch); + final StringBuffer result = new StringBuffer(); String line = ""; - - BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); + final BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); while ((line = rd.readLine()) != null) { result.append(line); } - StringResponse = result.toString(); - - int responseCode = response.getStatusLine().getStatusCode(); + final int responseCode = response.getStatusLine().getStatusCode(); if (responseCode != 200) { - throwStatusCodeException(responseCode, StringResponse); + this.throwStatusCodeException(responseCode, StringResponse); } - - } catch (IOException e) { + } + catch (IOException e) { throw new UnexpectedException(StringResponse); } return StringResponse; } - - /** - * Makes an HTTP DELETE request to the API - * - * @param endPoint a {@link java.lang.String} object. - * @return The response - * @throws InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws java.lang.Exception if any. - */ - public String delete(String endPoint) throws Exception { - return sendRequest("DELETE", endPoint); + + public String delete(final String endPoint) throws Exception { + return this.sendRequest("DELETE", endPoint); } - - private void throwStatusCodeException(int statusCode, String message) throws Exception { + + private void throwStatusCodeException(final int statusCode, final String message) throws Exception { switch (statusCode) { - case 400: - throw new MalformedException(message); - case 401: - throw new AuthenticationException(message); - case 403: - throw new AuthorizationException(message); - case 404: - throw new NotFoundException(statusCode + " " + message); - case 406: - throw new InvalidStatusCodeException(message); - case 429: - throw new TooManyRequestsException(message); - case 500: - throw new InvalidServerConnectionException(message); - case 503: - throw new DownForMaintenanceException(message); - default: - throw new com.trolley.Exceptions.UnexpectedException(message); + case 400: { + throw new MalformedException(message); + } + case 401: { + throw new AuthenticationException(message); + } + case 403: { + throw new AuthorizationException(message); + } + case 404: { + throw new NotFoundException(statusCode + " " + message); + } + case 406: { + throw new InvalidStatusCodeException(message); + } + case 429: { + throw new TooManyRequestsException(message); + } + case 500: { + throw new InvalidServerConnectionException(message); + } + case 503: { + throw new DownForMaintenanceException(message); + } + default: { + throw new com.trolley.Exceptions.UnexpectedException(message); + } } } - - private String generateAuthorization(int timeStamp, String method, String endPoint, String body) { - String message = timeStamp + "\n" + method + "\n" + endPoint + "\n" + body + "\n"; + + private String generateAuthorization(final int timeStamp, final String method, final String endPoint, final String body) { + final String message = timeStamp + "\n" + method + "\n" + endPoint + "\n" + body + "\n"; try { - String hash = hmacDigest(message, this.config.getPrivateKey(), "HmacSHA256"); + final String hash = this.hmacDigest(message, this.config.getPrivateKey(), "HmacSHA256"); return "prsign " + this.config.getPublicKey() + ":" + hash; - } catch (Exception e) { + } + catch (Exception e) { return "prsign 1:1"; } - } - - private String hmacDigest(String msg, String keyString, String algo) throws Exception { + + private String hmacDigest(final String msg, final String keyString, final String algo) throws Exception { String digest = null; - SecretKeySpec key = new SecretKeySpec((keyString).getBytes("UTF-8"), algo); - Mac mac = Mac.getInstance(algo); + final SecretKeySpec key = new SecretKeySpec(keyString.getBytes("UTF-8"), algo); + final Mac mac = Mac.getInstance(algo); mac.init(key); - - byte[] bytes = mac.doFinal(msg.getBytes("ASCII")); - - StringBuffer hash = new StringBuffer(); - for (int i = 0; i < bytes.length; i++) { - String hex = Integer.toHexString(0xFF & bytes[i]); + final byte[] bytes = mac.doFinal(msg.getBytes("ASCII")); + final StringBuffer hash = new StringBuffer(); + for (int i = 0; i < bytes.length; ++i) { + final String hex = Integer.toHexString(0xFF & bytes[i]); if (hex.length() == 1) { hash.append('0'); } diff --git a/src/main/java/com/trolley/trolley/Compliance.java b/src/main/java/com/trolley/trolley/Compliance.java index 7927dfe..58a3293 100644 --- a/src/main/java/com/trolley/trolley/Compliance.java +++ b/src/main/java/com/trolley/trolley/Compliance.java @@ -3,70 +3,37 @@ import java.util.HashMap; import java.util.Map; -/** - *

Compliance class.

- * - * @author joshua - * @version $Id: $Id - */ -public class Compliance { - +public class Compliance +{ private String status; private Object checkedAt; - private Map additionalProperties = new HashMap(); - - /** - *

Getter for the field status.

- * - * @return a {@link java.lang.String} object. - */ + private Map additionalProperties; + + public Compliance() { + this.additionalProperties = new HashMap(); + } + public String getStatus() { - return status; + return this.status; } - - /** - *

Setter for the field status.

- * - * @param status a {@link java.lang.String} object. - */ - public void setStatus(String status) { + + public void setStatus(final String status) { this.status = status; } - - /** - *

Getter for the field checkedAt.

- * - * @return a {@link java.lang.Object} object. - */ + public Object getCheckedAt() { - return checkedAt; + return this.checkedAt; } - - /** - *

Setter for the field checkedAt.

- * - * @param checkedAt a {@link java.lang.Object} object. - */ - public void setCheckedAt(Object checkedAt) { + + public void setCheckedAt(final Object checkedAt) { this.checkedAt = checkedAt; } - - /** - *

Getter for the field additionalProperties.

- * - * @return a {@link java.util.Map} object. - */ + public Map getAdditionalProperties() { return this.additionalProperties; } - - /** - *

setAdditionalProperty.

- * - * @param name a {@link java.lang.String} object. - * @param value a {@link java.lang.Object} object. - */ - public void setAdditionalProperty(String name, Object value) { + + public void setAdditionalProperty(final String name, final Object value) { this.additionalProperties.put(name, value); } } diff --git a/src/main/java/com/trolley/trolley/Configuration.java b/src/main/java/com/trolley/trolley/Configuration.java index 6c97214..2306a64 100644 --- a/src/main/java/com/trolley/trolley/Configuration.java +++ b/src/main/java/com/trolley/trolley/Configuration.java @@ -1,148 +1,91 @@ package com.trolley.trolley; -/** - *

Configuration class.

- * - * @author joshua - * @version $Id: $Id - */ -public class Configuration { - - String apiBase = "https://api.paymentrails.com"; - String privateKey = ""; - String publicKey = ""; - - /** - *

Constructor for Configuration.

- */ +public class Configuration +{ + String apiBase; + String privateKey; + String publicKey; + public Configuration() { + this.apiBase = "https://api.paymentrails.com"; + this.privateKey = ""; + this.publicKey = ""; } - /** - *

Constructor for Configuration.

- * - * @param publicKey a {@link java.lang.String} object. - * @param privateKey a {@link java.lang.String} object. - */ - public Configuration(String publicKey, String privateKey){ + + public Configuration(final String publicKey, final String privateKey) { + this.apiBase = "https://api.paymentrails.com"; + this.privateKey = ""; + this.publicKey = ""; this.publicKey = publicKey; this.privateKey = privateKey; } - /** - *

Constructor for Configuration.

- * - * @param publicKey a {@link java.lang.String} object. - * @param privateKey a {@link java.lang.String} object. - * @param apiBase a {@link java.lang.String} object. - */ - public Configuration(String publicKey, String privateKey, String apiBase) { + + public Configuration(final String publicKey, final String privateKey, final String apiBase) { + this.apiBase = "https://api.paymentrails.com"; + this.privateKey = ""; + this.publicKey = ""; this.publicKey = publicKey; this.privateKey = privateKey; - this.apiBase = setEnviroment(apiBase); + this.apiBase = this.setEnviroment(apiBase); } - - /** - * Getter for the api base - * - * @return the api base - */ + public String getApiBase() { return this.apiBase; } - - /** - * Setter for the api base - * - * @param apiBase a {@link java.lang.String} object. - */ - public void setApiBase(String apiBase) { + + public void setApiBase(final String apiBase) { this.apiBase = apiBase; } - - /** - * Getter for the public static api key - * - * @return publicKey - */ + public String getPublicKey() { return this.publicKey; } - - /** - * Setter for the public static key - * - * @param publicKey a {@link java.lang.String} object. - */ - public void setPublicKey(String publicKey) { + + public void setPublicKey(final String publicKey) { this.publicKey = publicKey; } - - /** - * Getter for the private key - * - * @return a {@link java.lang.String} object. - */ + public String getPrivateKey() { return this.privateKey; } - - /** - * Setter for the private key - * - * @param privatKey a {@link java.lang.String} object. - */ - public void setPrivateKey(String privatKey) { + + public void setPrivateKey(final String privatKey) { this.privateKey = privatKey; } - - /** - *

gateway.

- * - * @return a {@link com.trolley.trolley.Gateway} object. - */ + public static Gateway gateway() { - return new Gateway(Configuration.instantiate()); + return new Gateway(instantiate()); } - - /** - *

client.

- * - * @param config a {@link com.trolley.trolley.Configuration} object. - * @return a {@link com.trolley.trolley.Client} object. - */ - public static Client client(Configuration config) { + + public static Client client(final Configuration config) { return new Client(config); } - - /** - *

instantiate.

- * - * @return a {@link com.trolley.trolley.Configuration} object. - */ + public static Configuration instantiate() { return new Configuration(); } - - /** - * Set the API enviroment - * - * @param enviroment a {@link java.lang.String} object. - * @return a {@link java.lang.String} object. - */ - public String setEnviroment(String enviroment) { + + public String setEnviroment(final String enviroment) { switch (enviroment) { - case "production": - case "PRODUCTION": - return "https://api.paymentrails.com"; - case "development": - case "DEVELOPMENT": - return "http://api.railz.io"; - case "integration": - case "INTEGRATION": - return "http://api.local.dev:3000"; - case "sandbox": - case "SANDBOX": - return "https://api.paymentrails.com"; + case "production": + case "PRODUCTION": { + return "https://api.paymentrails.com"; + } + case "development": + case "DEVELOPMENT": { + return "http://api.railz.io"; + } + case "integration": + case "INTEGRATION": { + return "http://api.local.dev:3000"; + } + case "sandbox": + case "SANDBOX": { + return "https://api.paymentrails.com"; + } + default: { + return "https://api.paymentrails.com"; + } } - return "https://api.paymentrails.com"; } } diff --git a/src/main/java/com/trolley/trolley/Detail.java b/src/main/java/com/trolley/trolley/Detail.java index 9a58921..0fb6d71 100644 --- a/src/main/java/com/trolley/trolley/Detail.java +++ b/src/main/java/com/trolley/trolley/Detail.java @@ -2,15 +2,8 @@ import com.fasterxml.jackson.annotation.JsonProperty; -/** - *

Detail class.

- * - * @author joshua - * @version $Id: $Id - */ -public class Detail { - +public class Detail +{ @JsonProperty("bank-transfer") public BankTransfer bankTransfer; - } diff --git a/src/main/java/com/trolley/trolley/EUR.java b/src/main/java/com/trolley/trolley/EUR.java index ab88d2e..3528ab9 100644 --- a/src/main/java/com/trolley/trolley/EUR.java +++ b/src/main/java/com/trolley/trolley/EUR.java @@ -1,133 +1,64 @@ package com.trolley.trolley; -/** - *

EUR class.

- * - * @author joshua - * @version $Id: $Id - */ -public class EUR { - +public class EUR +{ private Boolean primary; private String amount; private String currency; private String type; private String accountNumber; private Boolean display; - - /** - *

Getter for the field primary.

- * - * @return a {@link java.lang.Boolean} object. - */ + public Boolean getPrimary() { - return primary; + return this.primary; } - - /** - *

Setter for the field primary.

- * - * @param primary a {@link java.lang.Boolean} object. - */ - public void setPrimary(Boolean primary) { + + public void setPrimary(final Boolean primary) { this.primary = primary; } - - /** - *

Getter for the field amount.

- * - * @return a {@link java.lang.String} object. - */ + public String getAmount() { - return amount; + return this.amount; } - - /** - *

Setter for the field amount.

- * - * @param amount a {@link java.lang.String} object. - */ - public void setAmount(String amount) { + + public void setAmount(final String amount) { this.amount = amount; } - - /** - *

Getter for the field currency.

- * - * @return a {@link java.lang.String} object. - */ + public String getCurrency() { - return currency; + return this.currency; } - - /** - *

Setter for the field currency.

- * - * @param currency a {@link java.lang.String} object. - */ - public void setCurrency(String currency) { + + public void setCurrency(final String currency) { this.currency = currency; } - - /** - *

Getter for the field type.

- * - * @return a {@link java.lang.String} object. - */ + public String getType() { - return type; + return this.type; } - - /** - *

Setter for the field type.

- * - * @param type a {@link java.lang.String} object. - */ - public void setType(String type) { + + public void setType(final String type) { this.type = type; } - - /** - *

Getter for the field accountNumber.

- * - * @return a {@link java.lang.String} object. - */ + public String getAccountNumber() { - return accountNumber; + return this.accountNumber; } - - /** - *

Setter for the field accountNumber.

- * - * @param accountNumber a {@link java.lang.String} object. - */ - public void setAccountNumber(String accountNumber) { + + public void setAccountNumber(final String accountNumber) { this.accountNumber = accountNumber; } - - /** - *

Getter for the field display.

- * - * @return a {@link java.lang.Boolean} object. - */ + public Boolean getDisplay() { - return display; + return this.display; } - - /** - *

Setter for the field display.

- * - * @param display a {@link java.lang.Boolean} object. - */ - public void setDisplay(Boolean display) { + + public void setDisplay(final Boolean display) { this.display = display; } - - /** {@inheritDoc} */ + @Override public String toString() { - return "ClassPojo [amount = " + amount + ", accountNumber = " + accountNumber + ", primary = " + primary - + ", display = " + display + ", type = " + type + ", currency = " + currency + "]"; + return "ClassPojo [amount = " + this.amount + ", accountNumber = " + this.accountNumber + ", primary = " + this.primary + ", display = " + this.display + ", type = " + this.type + ", currency = " + this.currency + "]"; } - } diff --git a/src/main/java/com/trolley/trolley/Gateway.java b/src/main/java/com/trolley/trolley/Gateway.java index 06a6889..c06a0f6 100644 --- a/src/main/java/com/trolley/trolley/Gateway.java +++ b/src/main/java/com/trolley/trolley/Gateway.java @@ -1,13 +1,7 @@ package com.trolley.trolley; -/** - *

Gateway class.

- * - * @author joshua - * @version $Id: $Id - */ -public class Gateway { - +public class Gateway +{ public Configuration config; public RecipientGateway recipient; public Client client; @@ -15,13 +9,8 @@ public class Gateway { public RecipientAccountGateway recipientAccount; public BalancesGateway balances; public PaymentGateway payment; - - /** - *

Constructor for Gateway.

- * - * @param config a {@link com.trolley.trolley.Configuration} object. - */ - public Gateway(Configuration config) { + + public Gateway(final Configuration config) { this.config = config; this.client = new Client(config); this.recipient = new RecipientGateway(config); @@ -29,6 +18,5 @@ public Gateway(Configuration config) { this.recipientAccount = new RecipientAccountGateway(config); this.balances = new BalancesGateway(config); this.payment = new PaymentGateway(config); - } } diff --git a/src/main/java/com/trolley/trolley/Meta.java b/src/main/java/com/trolley/trolley/Meta.java index 9530da8..db7950c 100644 --- a/src/main/java/com/trolley/trolley/Meta.java +++ b/src/main/java/com/trolley/trolley/Meta.java @@ -1,68 +1,32 @@ package com.trolley.trolley; -/** - *

Meta class.

- * - * @author joshua - * @version $Id: $Id - */ -public class Meta { - +public class Meta +{ private Integer page; private Integer pages; private Integer records; - - /** - *

Getter for the field page.

- * - * @return a {@link java.lang.Integer} object. - */ + public Integer getPage() { - return page; + return this.page; } - - /** - *

Setter for the field page.

- * - * @param page a {@link java.lang.Integer} object. - */ - public void setPage(Integer page) { + + public void setPage(final Integer page) { this.page = page; } - - /** - *

Getter for the field pages.

- * - * @return a {@link java.lang.Integer} object. - */ + public Integer getPages() { - return pages; + return this.pages; } - - /** - *

Setter for the field pages.

- * - * @param pages a {@link java.lang.Integer} object. - */ - public void setPages(Integer pages) { + + public void setPages(final Integer pages) { this.pages = pages; } - - /** - *

Getter for the field records.

- * - * @return a {@link java.lang.Integer} object. - */ + public Integer getRecords() { - return records; + return this.records; } - - /** - *

Setter for the field records.

- * - * @param records a {@link java.lang.Integer} object. - */ - public void setRecords(Integer records) { + + public void setRecords(final Integer records) { this.records = records; } } diff --git a/src/main/java/com/trolley/trolley/Payment.java b/src/main/java/com/trolley/trolley/Payment.java index ba77bcc..14123a8 100644 --- a/src/main/java/com/trolley/trolley/Payment.java +++ b/src/main/java/com/trolley/trolley/Payment.java @@ -2,29 +2,20 @@ import java.util.List; import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -/** - *

Payment class.

- * - * @author joshua - * @version $Id: $Id - */ -@JsonInclude(Include.NON_NULL) -public class Payment { +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Payment +{ private String id; private Recipient recipient; private String status; private Boolean isSupplyPayment; private String returnedAmount; - private String amount; private String currency; private String category; private RecipientAccount account; private List tags; - private String sourceAmount; private String sourceCurrency; private String targetAmount; @@ -43,713 +34,288 @@ public class Payment { private String payoutMethod; private String methodDisplay; Object batch; - String withholdingAmount; String withholdingCurrency; String equivalentWithholdingAmount; String equivalentWithholdingCurrency; - - /** - *

Setter for the field equivalentWithholdingCurrency.

- * - * @param equivalentWithholdingCurrency a {@link java.lang.String} object. - */ - public void setEquivalentWithholdingCurrency(String equivalentWithholdingCurrency) { + + public void setEquivalentWithholdingCurrency(final String equivalentWithholdingCurrency) { this.equivalentWithholdingCurrency = equivalentWithholdingCurrency; } - - /** - *

Getter for the field equivalentWithholdingCurrency.

- * - * @return a {@link java.lang.String} object. - */ + public String getEquivalentWithholdingCurrency() { - return equivalentWithholdingCurrency; + return this.equivalentWithholdingCurrency; } - - /** - *

Setter for the field equivalentWithholdingAmount.

- * - * @param equivalentWithholdingAmount a {@link java.lang.String} object. - */ - public void setEquivalentWithholdingAmount(String equivalentWithholdingAmount) { + + public void setEquivalentWithholdingAmount(final String equivalentWithholdingAmount) { this.equivalentWithholdingAmount = equivalentWithholdingAmount; } - - /** - *

Getter for the field equivalentWithholdingAmount.

- * - * @return a {@link java.lang.String} object. - */ + public String getEquivalentWithholdingAmount() { - return equivalentWithholdingAmount; + return this.equivalentWithholdingAmount; } - - /** - *

Setter for the field withholdingCurrency.

- * - * @param withholdingCurrency a {@link java.lang.String} object. - */ - public void setWithholdingCurrency(String withholdingCurrency) { + + public void setWithholdingCurrency(final String withholdingCurrency) { this.withholdingCurrency = withholdingCurrency; } - - /** - *

Getter for the field tags.

- * - * @return a {@link java.util.List} object. - */ + public List getTags() { return this.tags; } - - /** - *

Setter for the field tags.

- * - * @param tags a {@link java.util.List} object. - */ - public void setTags(List tags) { + + public void setTags(final List tags) { this.tags = tags; } - - /** - *

Getter for the field account.

- * - * @return a {@link com.trolley.trolley.RecipientAccount} object. - */ + public RecipientAccount getAccount() { - return account; + return this.account; } - - /** - *

Setter for the field account.

- * - * @param account a {@link com.trolley.trolley.RecipientAccount} object. - */ - public void setAccount(RecipientAccount account) { + + public void setAccount(final RecipientAccount account) { this.account = account; } - - /** - *

Getter for the field category.

- * - * @return a {@link java.lang.String} object. - */ + public String getCategory() { - return category; + return this.category; } - - /** - *

Setter for the field category.

- * - * @param category a {@link java.lang.String} object. - */ - public void setCategory(String category) { + + public void setCategory(final String category) { this.category = category; } - - /** - *

Getter for the field currency.

- * - * @return a {@link java.lang.String} object. - */ + public String getCurrency() { - return currency; + return this.currency; } - - /** - *

Setter for the field currency.

- * - * @param currency a {@link java.lang.String} object. - */ - public void setCurrency(String currency) { + + public void setCurrency(final String currency) { this.currency = currency; } - - /** - *

Getter for the field amount.

- * - * @return a {@link java.lang.String} object. - */ + public String getAmount() { - return amount; + return this.amount; } - - /** - *

Setter for the field amount.

- * - * @param amount a {@link java.lang.String} object. - */ - public void setAmount(String amount) { + + public void setAmount(final String amount) { this.amount = amount; } - - /** - *

Getter for the field withholdingCurrency.

- * - * @return a {@link java.lang.String} object. - */ + public String getWithholdingCurrency() { - return withholdingCurrency; + return this.withholdingCurrency; } - - /** - *

Setter for the field withholdingAmount.

- * - * @param withholdingAmount a {@link java.lang.String} object. - */ - public void setWithholdingAmount(String withholdingAmount) { + + public void setWithholdingAmount(final String withholdingAmount) { this.withholdingAmount = withholdingAmount; } - - /** - *

Getter for the field withholdingAmount.

- * - * @return a {@link java.lang.String} object. - */ + public String getWithholdingAmount() { - return withholdingAmount; + return this.withholdingAmount; } - - /** - *

Getter for the field id.

- * - * @return a {@link java.lang.String} object. - */ + public String getId() { - return id; + return this.id; } - - /** - *

Setter for the field id.

- * - * @param id a {@link java.lang.String} object. - */ - public void setId(String id) { + + public void setId(final String id) { this.id = id; } - - /** - *

Getter for the field recipient.

- * - * @return a {@link com.trolley.trolley.Recipient} object. - */ + public Recipient getRecipient() { - return recipient; + return this.recipient; } - - /** - *

Setter for the field recipient.

- * - * @param recipient a {@link com.trolley.trolley.Recipient} object. - */ - public void setRecipient(Recipient recipient) { + + public void setRecipient(final Recipient recipient) { this.recipient = recipient; } - - /** - *

Getter for the field status.

- * - * @return a {@link java.lang.String} object. - */ + public String getStatus() { - return status; + return this.status; } - - /** - *

Setter for the field status.

- * - * @param status a {@link java.lang.String} object. - */ - public void setStatus(String status) { + + public void setStatus(final String status) { this.status = status; } - - /** - *

Getter for the field isSupplyPayment.

- * - * @return a {@link java.lang.Boolean} object. - */ + public Boolean getIsSupplyPayment() { - return isSupplyPayment; + return this.isSupplyPayment; } - - /** - *

Setter for the field isSupplyPayment.

- * - * @param isSupplyPayment a {@link java.lang.Boolean} object. - */ - public void setIsSupplyPayment(Boolean isSupplyPayment) { + + public void setIsSupplyPayment(final Boolean isSupplyPayment) { this.isSupplyPayment = isSupplyPayment; } - - /** - *

Getter for the field returnedAmount.

- * - * @return a {@link java.lang.String} object. - */ + public String getReturnedAmount() { - return returnedAmount; + return this.returnedAmount; } - - /** - *

Setter for the field returnedAmount.

- * - * @param returnedAmount a {@link java.lang.String} object. - */ - public void setReturnedAmount(String returnedAmount) { + + public void setReturnedAmount(final String returnedAmount) { this.returnedAmount = returnedAmount; } - - /** - *

Getter for the field sourceAmount.

- * - * @return a {@link java.lang.String} object. - */ + public String getSourceAmount() { - return sourceAmount; + return this.sourceAmount; } - - /** - *

Setter for the field sourceAmount.

- * - * @param sourceAmount a {@link java.lang.String} object. - */ - public void setSourceAmount(String sourceAmount) { + + public void setSourceAmount(final String sourceAmount) { this.sourceAmount = sourceAmount; } - - /** - *

Getter for the field sourceCurrency.

- * - * @return a {@link java.lang.String} object. - */ + public String getSourceCurrency() { - return sourceCurrency; + return this.sourceCurrency; } - - /** - *

Setter for the field sourceCurrency.

- * - * @param sourceCurrency a {@link java.lang.String} object. - */ - public void setSourceCurrency(String sourceCurrency) { + + public void setSourceCurrency(final String sourceCurrency) { this.sourceCurrency = sourceCurrency; } - - /** - *

Getter for the field targetAmount.

- * - * @return a {@link java.lang.String} object. - */ + public String getTargetAmount() { - return targetAmount; + return this.targetAmount; } - - /** - *

Setter for the field targetAmount.

- * - * @param targetAmount a {@link java.lang.String} object. - */ - public void setTargetAmount(String targetAmount) { + + public void setTargetAmount(final String targetAmount) { this.targetAmount = targetAmount; } - - /** - *

Getter for the field targetCurrency.

- * - * @return a {@link java.lang.String} object. - */ + public String getTargetCurrency() { - return targetCurrency; + return this.targetCurrency; } - - /** - *

Setter for the field targetCurrency.

- * - * @param targetCurrency a {@link java.lang.String} object. - */ - public void setTargetCurrency(String targetCurrency) { + + public void setTargetCurrency(final String targetCurrency) { this.targetCurrency = targetCurrency; } - - /** - *

Getter for the field exchangeRate.

- * - * @return a {@link java.lang.String} object. - */ + public String getExchangeRate() { - return exchangeRate; + return this.exchangeRate; } - - /** - *

Setter for the field exchangeRate.

- * - * @param exchangeRate a {@link java.lang.String} object. - */ - public void setExchangeRate(String exchangeRate) { + + public void setExchangeRate(final String exchangeRate) { this.exchangeRate = exchangeRate; } - - /** - *

Getter for the field fees.

- * - * @return a {@link java.lang.String} object. - */ + public String getFees() { - return fees; + return this.fees; } - - /** - *

Setter for the field fees.

- * - * @param fees a {@link java.lang.String} object. - */ - public void setFees(String fees) { + + public void setFees(final String fees) { this.fees = fees; } - - /** - *

Getter for the field recipientFees.

- * - * @return a {@link java.lang.String} object. - */ + public String getRecipientFees() { - return recipientFees; + return this.recipientFees; } - - /** - *

Setter for the field recipientFees.

- * - * @param recipientFees a {@link java.lang.String} object. - */ - public void setRecipientFees(String recipientFees) { + + public void setRecipientFees(final String recipientFees) { this.recipientFees = recipientFees; } - - /** - *

Getter for the field fxRate.

- * - * @return a {@link java.lang.String} object. - */ + public String getFxRate() { - return fxRate; + return this.fxRate; } - - /** - *

Setter for the field fxRate.

- * - * @param fxRate a {@link java.lang.String} object. - */ - public void setFxRate(String fxRate) { + + public void setFxRate(final String fxRate) { this.fxRate = fxRate; } - - /** - *

Getter for the field memo.

- * - * @return a {@link java.lang.String} object. - */ + public String getMemo() { - return memo; + return this.memo; } - - /** - *

Setter for the field memo.

- * - * @param memo a {@link java.lang.String} object. - */ - public void setMemo(String memo) { + + public void setMemo(final String memo) { this.memo = memo; } - - /** - *

Getter for the field externalId.

- * - * @return a {@link java.lang.String} object. - */ + public String getExternalId() { - return externalId; + return this.externalId; } - - /** - *

Setter for the field externalId.

- * - * @param externalId a {@link java.lang.String} object. - */ - public void setExternalId(String externalId) { + + public void setExternalId(final String externalId) { this.externalId = externalId; } - - /** - *

Getter for the field processedAt.

- * - * @return a {@link java.lang.Object} object. - */ + public Object getProcessedAt() { - return processedAt; + return this.processedAt; } - - /** - *

Setter for the field processedAt.

- * - * @param processedAt a {@link java.lang.Object} object. - */ - public void setProcessedAt(Object processedAt) { + + public void setProcessedAt(final Object processedAt) { this.processedAt = processedAt; } - - /** - *

Getter for the field createdAt.

- * - * @return a {@link java.lang.String} object. - */ + public String getCreatedAt() { - return createdAt; + return this.createdAt; } - - /** - *

Setter for the field createdAt.

- * - * @param createdAt a {@link java.lang.String} object. - */ - public void setCreatedAt(String createdAt) { + + public void setCreatedAt(final String createdAt) { this.createdAt = createdAt; } - - /** - *

Getter for the field updatedAt.

- * - * @return a {@link java.lang.String} object. - */ + public String getUpdatedAt() { - return updatedAt; + return this.updatedAt; } - - /** - *

Setter for the field updatedAt.

- * - * @param updatedAt a {@link java.lang.String} object. - */ - public void setUpdatedAt(String updatedAt) { + + public void setUpdatedAt(final String updatedAt) { this.updatedAt = updatedAt; } - - /** - *

Getter for the field merchantFees.

- * - * @return a {@link java.lang.String} object. - */ + public String getMerchantFees() { - return merchantFees; + return this.merchantFees; } - - /** - *

Setter for the field merchantFees.

- * - * @param merchantFees a {@link java.lang.String} object. - */ - public void setMerchantFees(String merchantFees) { + + public void setMerchantFees(final String merchantFees) { this.merchantFees = merchantFees; } - - /** - *

Getter for the field compliance.

- * - * @return a {@link com.trolley.trolley.Compliance} object. - */ + public Compliance getCompliance() { - return compliance; + return this.compliance; } - - /** - *

Setter for the field compliance.

- * - * @param compliance a {@link com.trolley.trolley.Compliance} object. - */ - public void setCompliance(Compliance compliance) { + + public void setCompliance(final Compliance compliance) { this.compliance = compliance; } - - /** - *

Getter for the field payoutMethod.

- * - * @return a {@link java.lang.String} object. - */ + public String getPayoutMethod() { - return payoutMethod; + return this.payoutMethod; } - - /** - *

Setter for the field payoutMethod.

- * - * @param payoutMethod a {@link java.lang.String} object. - */ - public void setPayoutMethod(String payoutMethod) { + + public void setPayoutMethod(final String payoutMethod) { this.payoutMethod = payoutMethod; } - - /** - *

Getter for the field methodDisplay.

- * - * @return a {@link java.lang.String} object. - */ + public String getMethodDisplay() { - return methodDisplay; + return this.methodDisplay; } - - /** - *

Setter for the field methodDisplay.

- * - * @param methodDisplay a {@link java.lang.String} object. - */ - public void setMethodDisplay(String methodDisplay) { + + public void setMethodDisplay(final String methodDisplay) { this.methodDisplay = methodDisplay; } - - /** - * Retrieves a batch based on the batch id - * - * @param payment_id a {@link java.lang.String} object. - * @param batch_id a {@link java.lang.String} object. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws java.lang.Exception if any. - */ - public static Payment find(String payment_id, String batch_id) throws Exception { + + public static Payment find(final String payment_id, final String batch_id) throws Exception { return Configuration.gateway().payment.find(payment_id, batch_id); } - - /** - * Creates a payment based on the body and batch id - * - * @param body a {@link java.lang.String} object. - * @param batch_id a {@link java.lang.String} object. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws java.lang.Exception if any. - */ - public static Payment create(String body, String batch_id) throws Exception { + + public static Payment create(final String body, final String batch_id) throws Exception { return Configuration.gateway().payment.create(body, batch_id); } - - /** - * Updates a payment based on the payment id, body and batch id - * - * @param payment_id a {@link java.lang.String} object. - * @param body a {@link java.lang.String} object. - * @param batch_id a {@link java.lang.String} object. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws java.lang.Exception if any. - */ - public static boolean update(String payment_id, String body, String batch_id) throws Exception { + + public static boolean update(final String payment_id, final String body, final String batch_id) throws Exception { return Configuration.gateway().payment.update(payment_id, body, batch_id); } - - /** - * Deletes a payment based on the payment id and batch id - * - * @param payment_id a {@link java.lang.String} object. - * @param batch_id a {@link java.lang.String} object. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws java.lang.Exception if any. - */ - public static boolean delete(String payment_id, String batch_id) throws Exception { + + public static boolean delete(final String payment_id, final String batch_id) throws Exception { return Configuration.gateway().payment.delete(payment_id, batch_id); } - - /** - * List all payments based on the recipient id and (optional) a given - * wildcard, page amount and page size - * - * @param batch_id a {@link java.lang.String} object. - * @param page - * @param pageSize - * @param pageSize a int. - * @param message a {@link java.lang.String} object. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws java.lang.Exception if any. - */ - public static List query(String batch_id, int page, int pageSize, String message) throws Exception { - + + public static List query(final String batch_id, final int page, final int pageSize, final String message) throws Exception { return Configuration.gateway().payment.query(batch_id, page, pageSize, message); - } - - /** - * List all payments based on the recipient id and a given wildcard - * - * @param batch_id a {@link java.lang.String} object. - * @param message a {@link java.lang.String} object. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws java.lang.Exception if any. - */ - public static List query(String batch_id, String message) throws Exception { + + public static List query(final String batch_id, final String message) throws Exception { return query(batch_id, 1, 10, message); } - - /** - * List all payments - * - * @param batch_id a {@link java.lang.String} object. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws java.lang.Exception if any. - */ - public static List query(String batch_id) throws Exception { + + public static List query(final String batch_id) throws Exception { return query(batch_id, 1, 10, ""); } - - /** - * List all payments based on the recipient id and (optional) page amount - * and page size - * - * @param batch_id a {@link java.lang.String} object. - * @param page - * @param pageSize - * @param pageSize a int. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws java.lang.Exception if any. - */ - public static List query(String batch_id, int page, int pageSize) throws Exception { - + + public static List query(final String batch_id, final int page, final int pageSize) throws Exception { return query(batch_id, page, pageSize, ""); } } - -// class PaymentSerializer extends JsonSerializer> { - -// @Override -// public void serialize(List value, JsonGenerator jgen, -// SerializerProvider provider) throws IOException { -// jgen.writeStartArray(); -// for (Payment payment : value) { -// jgen.writeStartObject(); -// jgen.writeObjectField("payment", payment); -// jgen.writeEndObject(); -// } -// jgen.writeEndArray(); -// } - -// } diff --git a/src/main/java/com/trolley/trolley/PaymentGateway.java b/src/main/java/com/trolley/trolley/PaymentGateway.java index 1af6e43..6f07423 100644 --- a/src/main/java/com/trolley/trolley/PaymentGateway.java +++ b/src/main/java/com/trolley/trolley/PaymentGateway.java @@ -1,85 +1,46 @@ package com.trolley.trolley; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.trolley.Exceptions.InvalidFieldException; - -import java.io.IOException; import java.util.ArrayList; +import java.io.IOException; +import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; import java.util.List; +import com.trolley.Exceptions.InvalidFieldException; -/** - *

PaymentGateway class.

- * - * @author joshua - * @version $Id: $Id - */ -public class PaymentGateway { +public class PaymentGateway +{ Client client; - - /** - *

Constructor for PaymentGateway.

- * - * @param config a {@link com.trolley.trolley.Configuration} object. - */ - public PaymentGateway(Configuration config) { + + public PaymentGateway(final Configuration config) { this.client = new Client(config); } - - /** - *

find.

- * - * @param payment_id a {@link java.lang.String} object. - * @param batch_id a {@link java.lang.String} object. - * @return a {@link com.trolley.trolley.Payment} object. - * @throws java.lang.Exception if any. - */ - public Payment find(String payment_id, String batch_id) throws Exception { + + public Payment find(final String payment_id, final String batch_id) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); } if (payment_id == null || payment_id.isEmpty()) { throw new InvalidFieldException("Payment id cannot be null or empty."); } - - String endPoint = "/v1/batches/" + batch_id + "/payments/" + payment_id; - String response = this.client.get(endPoint); - return paymentFactory(response); + final String endPoint = "/v1/batches/" + batch_id + "/payments/" + payment_id; + final String response = this.client.get(endPoint); + return this.paymentFactory(response); } - - /** - *

create.

- * - * @param body a {@link java.lang.String} object. - * @param batch_id a {@link java.lang.String} object. - * @return a {@link com.trolley.trolley.Payment} object. - * @throws java.lang.Exception if any. - */ - public Payment create(String body, String batch_id) throws Exception { + + public Payment create(final String body, final String batch_id) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); } if (body == null || body.isEmpty()) { throw new InvalidFieldException("Body cannot be null or empty."); } - - String endPoint = "/v1/batches/" + batch_id + "/payments"; - String response = this.client.post(endPoint, body); - - return paymentFactory(response); + final String endPoint = "/v1/batches/" + batch_id + "/payments"; + final String response = this.client.post(endPoint, body); + return this.paymentFactory(response); } - - /** - *

update.

- * - * @param payment_id a {@link java.lang.String} object. - * @param body a {@link java.lang.String} object. - * @param batch_id a {@link java.lang.String} object. - * @return a boolean. - * @throws java.lang.Exception if any. - */ - public boolean update(String payment_id, String body, String batch_id) throws Exception { + + public boolean update(final String payment_id, final String body, final String batch_id) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); } @@ -89,45 +50,24 @@ public boolean update(String payment_id, String body, String batch_id) throws Ex if (body == null || body.isEmpty()) { throw new InvalidFieldException("Body cannot be null or empty."); } - - String endPoint = "/v1/batches/" + batch_id + "/payments/" + payment_id; + final String endPoint = "/v1/batches/" + batch_id + "/payments/" + payment_id; this.client.patch(endPoint, body); return true; } - - /** - *

delete.

- * - * @param payment_id a {@link java.lang.String} object. - * @param batch_id a {@link java.lang.String} object. - * @return a boolean. - * @throws java.lang.Exception if any. - */ - public boolean delete(String payment_id, String batch_id) throws Exception { + + public boolean delete(final String payment_id, final String batch_id) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); } if (payment_id == null || payment_id.isEmpty()) { throw new InvalidFieldException("Payment id cannot be null or empty."); } - - String endPoint = "/v1/batches/" + batch_id + "/payments/" + payment_id; + final String endPoint = "/v1/batches/" + batch_id + "/payments/" + payment_id; this.client.delete(endPoint); return true; } - - /** - *

query.

- * - * @param batch_id a {@link java.lang.String} object. - * @param page a int. - * @param pageSize a int. - * @param message a {@link java.lang.String} object. - * @return a {@link java.util.List} object. - * @throws java.lang.Exception if any. - */ - public List query(String batch_id, int page, int pageSize, String message) throws Exception { - + + public List query(final String batch_id, final int page, final int pageSize, final String message) throws Exception { if (batch_id == null || batch_id.isEmpty()) { throw new InvalidFieldException("Batch id cannot be null or empty."); } @@ -140,34 +80,30 @@ public List query(String batch_id, int page, int pageSize, String messa if (message == null) { throw new InvalidFieldException("Message cannot be null"); } - - String endPoint = "/v1/batches/" + batch_id + "/payments/?" + "&search=" + message + "&page=" + page - + "&pageSize=" + pageSize; - String response = this.client.get(endPoint); - return paymentListFactory(response); + final String endPoint = "/v1/batches/" + batch_id + "/payments/?&search=" + message + "&page=" + page + "&pageSize=" + pageSize; + final String response = this.client.get(endPoint); + return this.paymentListFactory(response); } - - private Payment paymentFactory(String data) throws IOException { - ObjectMapper mapper = new ObjectMapper(); + + private Payment paymentFactory(final String data) throws IOException { + final ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - JsonNode node = mapper.readTree(data); - Payment payment = mapper.readValue(node.get("payment").traverse(), Payment.class); + final JsonNode node = mapper.readTree(data); + final Payment payment = (Payment)mapper.readValue(node.get("payment").traverse(), (Class)Payment.class); return payment; } - - private List paymentListFactory(String data) throws IOException { - ObjectMapper mapper = new ObjectMapper(); - JsonNode node = mapper.readTree(data); + + private List paymentListFactory(final String data) throws IOException { + final ObjectMapper mapper = new ObjectMapper(); + final JsonNode node = mapper.readTree(data); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - Object payment = mapper.readValue(node.get("payments").traverse(), Object.class); - @SuppressWarnings("unchecked") - List paymens = (List) payment; - List payments = new ArrayList(); - for (int i = 0; i < paymens.size(); i++) { - Payment pojo = mapper.convertValue(paymens.get(i), Payment.class); + final Object payment = mapper.readValue(node.get("payments").traverse(), (Class)Object.class); + final List paymens = (List)payment; + final List payments = new ArrayList(); + for (int i = 0; i < paymens.size(); ++i) { + final Payment pojo = (Payment)mapper.convertValue((Object)paymens.get(i), (Class)Payment.class); payments.add(pojo); } - return payments; } } diff --git a/src/main/java/com/trolley/trolley/Payments.java b/src/main/java/com/trolley/trolley/Payments.java index 0dffb3a..fb2608b 100644 --- a/src/main/java/com/trolley/trolley/Payments.java +++ b/src/main/java/com/trolley/trolley/Payments.java @@ -2,51 +2,28 @@ import java.util.List; -/** - *

Payments class.

- * - * @author joshua - * @version $Id: $Id - */ -public class Payments { - - private List payments = null; +public class Payments +{ + private List payments; private Meta meta; - - /** - *

Getter for the field payments.

- * - * @return a {@link java.util.List} object. - */ + + public Payments() { + this.payments = null; + } + public List getPayments() { - return payments; + return this.payments; } - - /** - *

Setter for the field payments.

- * - * @param payments a {@link java.util.List} object. - */ - public void setPayments(List payments) { + + public void setPayments(final List payments) { this.payments = payments; } - - /** - *

Getter for the field meta.

- * - * @return a {@link com.trolley.trolley.Meta} object. - */ + public Meta getMeta() { - return meta; + return this.meta; } - - /** - *

Setter for the field meta.

- * - * @param meta a {@link com.trolley.trolley.Meta} object. - */ - public void setMeta(Meta meta) { + + public void setMeta(final Meta meta) { this.meta = meta; } - } diff --git a/src/main/java/com/trolley/trolley/Recipient.java b/src/main/java/com/trolley/trolley/Recipient.java index 38f1a7a..34ac122 100644 --- a/src/main/java/com/trolley/trolley/Recipient.java +++ b/src/main/java/com/trolley/trolley/Recipient.java @@ -2,17 +2,10 @@ import java.util.List; import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -/** - *

Recipient class.

- * - * @author joshua - * @version $Id: $Id - */ -@JsonInclude(Include.NON_NULL) -public class Recipient { +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Recipient +{ String id; String routeType; String estimatedFees; @@ -41,730 +34,311 @@ public class Recipient { public Object payout; String emailAddress; public Object inactiveReasons; - Compliance compliance; List accounts; Address address; - String taxForm; String taxFormStatus; - String taxWithholdingPercentage = "0.0"; - - /** - *

Getter for the field taxFormStatus.

- * - * @return a {@link java.lang.String} object. - */ + String taxWithholdingPercentage; + + public Recipient() { + this.taxWithholdingPercentage = "0.0"; + } + public String getTaxFormStatus() { return this.taxFormStatus; } - - /** - *

Setter for the field taxFormStatus.

- * - * @param taxFormStatus a {@link java.lang.String} object. - */ - public void setTaxFormStatus(String taxFormStatus) { - this.taxFormStatus = taxForm; + + public void setTaxFormStatus(final String taxFormStatus) { + this.taxFormStatus = this.taxForm; } - - /** - *

Getter for the field tags.

- * - * @return a {@link java.util.List} object. - */ + public List getTags() { return this.tags; } - - /** - *

Setter for the field tags.

- * - * @param tags a {@link java.util.List} object. - */ - public void setTags(List tags) { + + public void setTags(final List tags) { this.tags = tags; } - - /** - *

Getter for the field taxWithholdingPercentage.

- * - * @return a {@link java.lang.String} object. - */ + public String getTaxWithholdingPercentage() { return this.taxWithholdingPercentage; } - - /** - *

Setter for the field taxWithholdingPercentage.

- * - * @param taxWithholdingPercentage a {@link java.lang.String} object. - */ - public void setTaxWithholdingPercentage(String taxWithholdingPercentage) { + + public void setTaxWithholdingPercentage(final String taxWithholdingPercentage) { this.taxWithholdingPercentage = taxWithholdingPercentage; } - - /** - *

Getter for the field taxForm.

- * - * @return a {@link java.lang.String} object. - */ + public String getTaxForm() { return this.taxForm; } - - /** - *

Setter for the field taxForm.

- * - * @param taxForm a {@link java.lang.String} object. - */ - public void setTaxForm(String taxForm) { + + public void setTaxForm(final String taxForm) { this.taxForm = taxForm; } - - /** - *

Getter for the field inactiveReasons.

- * - * @return a {@link java.lang.Object} object. - */ + public Object getInactiveReasons() { - return inactiveReasons; + return this.inactiveReasons; } - - /** - *

Setter for the field inactiveReasons.

- * - * @param inactiveReasons a {@link java.lang.Object} object. - */ - public void setInactiveReasons(Object inactiveReasons) { + + public void setInactiveReasons(final Object inactiveReasons) { this.inactiveReasons = inactiveReasons; } - - /** - *

Getter for the field accounts.

- * - * @return a {@link java.util.List} object. - */ + public List getAccounts() { - return accounts; + return this.accounts; } - - /** - *

Setter for the field accounts.

- * - * @param accounts a {@link java.util.List} object. - */ - public void setAccounts(List accounts) { + + public void setAccounts(final List accounts) { this.accounts = accounts; } - - /** - *

Setter for the field address.

- * - * @param address a {@link com.trolley.trolley.Address} object. - */ - public void setAddress(Address address) { + + public void setAddress(final Address address) { this.address = address; } - - /** - *

Getter for the field address.

- * - * @return a {@link com.trolley.trolley.Address} object. - */ + public Address getAddress() { - return address; + return this.address; } - - /** - *

Getter for the field compliance.

- * - * @return a {@link com.trolley.trolley.Compliance} object. - */ + public Compliance getCompliance() { - return compliance; + return this.compliance; } - - /** - *

Setter for the field compliance.

- * - * @param compliance a {@link com.trolley.trolley.Compliance} object. - */ - public void setCompliance(Compliance compliance) { + + public void setCompliance(final Compliance compliance) { this.compliance = compliance; } - - /** - *

Getter for the field lastName.

- * - * @return a {@link java.lang.String} object. - */ + public String getLastName() { return this.lastName; } - - /** - *

Setter for the field lastName.

- * - * @param lastName a {@link java.lang.String} object. - */ - public void setLastName(String lastName) { + + public void setLastName(final String lastName) { this.lastName = lastName; } - - /** - *

Getter for the field routeType.

- * - * @return a {@link java.lang.String} object. - */ + public String getRouteType() { return this.routeType; } - - /** - *

Setter for the field routeType.

- * - * @param routeType a {@link java.lang.String} object. - */ - public void setRouteType(String routeType) { + + public void setRouteType(final String routeType) { this.routeType = routeType; } - - /** - *

Getter for the field estimatedFees.

- * - * @return a {@link java.lang.String} object. - */ + public String getEstimatedFees() { - return estimatedFees; + return this.estimatedFees; } - - /** - *

Setter for the field estimatedFees.

- * - * @param estimatedFees a {@link java.lang.String} object. - */ - public void setEstimatedFees(String estimatedFees) { + + public void setEstimatedFees(final String estimatedFees) { this.estimatedFees = estimatedFees; } - - /** - *

Getter for the field id.

- * - * @return a {@link java.lang.String} object. - */ + public String getId() { - return id; + return this.id; } - - /** - *

Setter for the field id.

- * - * @param id a {@link java.lang.String} object. - */ - public void setId(String id) { + + public void setId(final String id) { this.id = id; } - - /** - *

Getter for the field referenceId.

- * - * @return a {@link java.lang.String} object. - */ + public String getReferenceId() { - return referenceId; + return this.referenceId; } - - /** - *

Setter for the field referenceId.

- * - * @param referenceId a {@link java.lang.String} object. - */ - public void setReferenceId(String referenceId) { + + public void setReferenceId(final String referenceId) { this.referenceId = referenceId; } - - /** - *

Getter for the field email.

- * - * @return a {@link java.lang.String} object. - */ + public String getEmail() { - return email; + return this.email; } - - /** - *

Setter for the field email.

- * - * @param email a {@link java.lang.String} object. - */ - public void setEmail(String email) { + + public void setEmail(final String email) { this.email = email; } - - /** - *

Getter for the field name.

- * - * @return a {@link java.lang.String} object. - */ + public String getName() { - return name; + return this.name; } - - /** - *

Setter for the field name.

- * - * @param name a {@link java.lang.String} object. - */ - public void setName(String name) { + + public void setName(final String name) { this.name = name; } - - /** - *

Getter for the field firstName.

- * - * @return a {@link java.lang.String} object. - */ + public String getFirstName() { - return firstName; + return this.firstName; } - - /** - *

Setter for the field firstName.

- * - * @param firstName a {@link java.lang.String} object. - */ - public void setFirstName(String firstName) { + + public void setFirstName(final String firstName) { this.firstName = firstName; } - - /** - *

Getter for the field type.

- * - * @return a {@link java.lang.String} object. - */ + public String getType() { - return type; + return this.type; } - - /** - *

Setter for the field type.

- * - * @param type a {@link java.lang.String} object. - */ - public void setType(String type) { + + public void setType(final String type) { this.type = type; } - - /** - *

Getter for the field taxType.

- * - * @return a {@link java.lang.String} object. - */ + public String getTaxType() { - return taxType; + return this.taxType; } - - /** - *

Setter for the field taxType.

- * - * @param taxType a {@link java.lang.String} object. - */ - public void setTaxType(String taxType) { + + public void setTaxType(final String taxType) { this.taxType = taxType; } - - /** - *

Getter for the field status.

- * - * @return a {@link java.lang.String} object. - */ + public String getStatus() { - return status; + return this.status; } - - /** - *

Setter for the field status.

- * - * @param status a {@link java.lang.String} object. - */ - public void setStatus(String status) { + + public void setStatus(final String status) { this.status = status; } - - /** - *

Getter for the field language.

- * - * @return a {@link java.lang.String} object. - */ + public String getLanguage() { - return language; + return this.language; } - - /** - *

Setter for the field language.

- * - * @param language a {@link java.lang.String} object. - */ - public void setLanguage(String language) { + + public void setLanguage(final String language) { this.language = language; } - - /** - *

Getter for the field complianceStatus.

- * - * @return a {@link java.lang.String} object. - */ + public String getComplianceStatus() { - return complianceStatus; + return this.complianceStatus; } - - /** - *

Setter for the field complianceStatus.

- * - * @param complianceStatus a {@link java.lang.String} object. - */ - public void setComplianceStatus(String complianceStatus) { + + public void setComplianceStatus(final String complianceStatus) { this.complianceStatus = complianceStatus; } - - /** - *

Getter for the field dob.

- * - * @return a {@link java.lang.String} object. - */ + public String getDob() { - return dob; + return this.dob; } - - /** - *

Setter for the field dob.

- * - * @param dob a {@link java.lang.String} object. - */ - public void setDob(String dob) { + + public void setDob(final String dob) { this.dob = dob; } - - /** - *

Getter for the field passport.

- * - * @return a {@link java.lang.String} object. - */ + public String getPassport() { - return passport; + return this.passport; } - - /** - *

Setter for the field passport.

- * - * @param passport a {@link java.lang.String} object. - */ - public void setPassport(String passport) { + + public void setPassport(final String passport) { this.passport = passport; } - - /** - *

Getter for the field updatedAt.

- * - * @return a {@link java.lang.String} object. - */ + public String getUpdatedAt() { - return updatedAt; + return this.updatedAt; } - - /** - *

Setter for the field updatedAt.

- * - * @param updatedAt a {@link java.lang.String} object. - */ - public void setUpdatedAt(String updatedAt) { + + public void setUpdatedAt(final String updatedAt) { this.updatedAt = updatedAt; } - - /** - *

Getter for the field createdAt.

- * - * @return a {@link java.lang.String} object. - */ + public String getCreatedAt() { - return createdAt; + return this.createdAt; } - - /** - *

Setter for the field createdAt.

- * - * @param createdAt a {@link java.lang.String} object. - */ - public void setCreatedAt(String createdAt) { + + public void setCreatedAt(final String createdAt) { this.createdAt = createdAt; } - - /** - *

Getter for the field gravatarUrl.

- * - * @return a {@link java.lang.String} object. - */ + public String getGravatarUrl() { - return gravatarUrl; + return this.gravatarUrl; } - - /** - *

Setter for the field gravatarUrl.

- * - * @param gravatarUrl a {@link java.lang.String} object. - */ - public void setGravatarUrl(String gravatarUrl) { + + public void setGravatarUrl(final String gravatarUrl) { this.gravatarUrl = gravatarUrl; } - - /** - *

Getter for the field governmentId.

- * - * @return a {@link java.lang.String} object. - */ + public String getGovernmentId() { - return governmentId; + return this.governmentId; } - - /** - *

Setter for the field governmentId.

- * - * @param governmentId a {@link java.lang.String} object. - */ - public void setGovernmentId(String governmentId) { + + public void setGovernmentId(final String governmentId) { this.governmentId = governmentId; } - - /** - *

Getter for the field ssn.

- * - * @return a {@link java.lang.String} object. - */ + public String getSsn() { - return ssn; + return this.ssn; } - - /** - *

Setter for the field ssn.

- * - * @param ssn a {@link java.lang.String} object. - */ - public void setSsn(String ssn) { + + public void setSsn(final String ssn) { this.ssn = ssn; } - - /** - *

Getter for the field primaryCurrency.

- * - * @return a {@link java.lang.String} object. - */ + public String getPrimaryCurrency() { - return primaryCurrency; + return this.primaryCurrency; } - - /** - *

Setter for the field primaryCurrency.

- * - * @param primaryCurrency a {@link java.lang.String} object. - */ - public void setPrimaryCurrency(String primaryCurrency) { + + public void setPrimaryCurrency(final String primaryCurrency) { this.primaryCurrency = primaryCurrency; } - - /** - *

Getter for the field placeOfBirth.

- * - * @return a {@link java.lang.String} object. - */ + public String getPlaceOfBirth() { - return placeOfBirth; + return this.placeOfBirth; } - - /** - *

Setter for the field placeOfBirth.

- * - * @param placeOfBirth a {@link java.lang.String} object. - */ - public void setPlaceOfBirth(String placeOfBirth) { + + public void setPlaceOfBirth(final String placeOfBirth) { this.placeOfBirth = placeOfBirth; } - - /** - *

Getter for the field merchantId.

- * - * @return a {@link java.lang.String} object. - */ + public String getMerchantId() { - return merchantId; + return this.merchantId; } - - /** - *

Setter for the field merchantId.

- * - * @param merchantId a {@link java.lang.String} object. - */ - public void setMerchantId(String merchantId) { + + public void setMerchantId(final String merchantId) { this.merchantId = merchantId; } - - /** - *

Getter for the field payoutMethod.

- * - * @return a {@link java.lang.String} object. - */ + public String getPayoutMethod() { - return payoutMethod; + return this.payoutMethod; } - - /** - *

Setter for the field payoutMethod.

- * - * @param payoutMethod a {@link java.lang.String} object. - */ - public void setPayoutMethod(String payoutMethod) { + + public void setPayoutMethod(final String payoutMethod) { this.payoutMethod = payoutMethod; } - - /** - * Retrieves a recipient based on the recipient id given - * - * @param recipient_id a {@link java.lang.String} object. - * @return The response - * @throws java.lang.Exception if any. - */ - public static Recipient find(String recipient_id) throws Exception { + + public static Recipient find(final String recipient_id) throws Exception { return Configuration.gateway().recipient.find(recipient_id); } - - /** - * Retreives the recipient's logs based on the recipient id given - * - * @param recipient_id a {@link java.lang.String} object. - * @return the response - * @throws java.lang.Exception if any. - */ - public static String findLogs(String recipient_id) throws Exception { - String response = Configuration.gateway().recipient.findLogs(recipient_id); + + public static String findLogs(final String recipient_id) throws Exception { + final String response = Configuration.gateway().recipient.findLogs(recipient_id); return response; } - - /** - * Retreives the recipient's payments based on the recipient id given - * - * @param recipient_id a {@link java.lang.String} object. - * @return the response - * @throws java.lang.Exception if any. - */ - public static List findPayments(String recipient_id) throws Exception { + + public static List findPayments(final String recipient_id) throws Exception { return Configuration.gateway().recipient.findPayments(recipient_id); - } - - /** - * Creates a recipient based on the body given to the client - * - * @param body a {@link java.lang.String} object. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws java.lang.Exception if any. - */ - public static Recipient create(String body) throws Exception { + + public static Recipient create(final String body) throws Exception { return Configuration.gateway().recipient.create(body); - } - - /** - * Updates a recipient based on the body given to the client - * - * @param recipient_id a {@link java.lang.String} object. - * @param body a {@link java.lang.String} object. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws java.lang.Exception if any. - */ - public static boolean update(String recipient_id, String body) throws Exception { + + public static boolean update(final String recipient_id, final String body) throws Exception { return Configuration.gateway().recipient.update(recipient_id, body); } - - /** - * Delete a recipient based on the recipient id - * - * @param recipient_id a {@link java.lang.String} object. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws java.lang.Exception if any. - */ - public static boolean delete(String recipient_id) throws Exception { + + public static boolean delete(final String recipient_id) throws Exception { return Configuration.gateway().recipient.delete(recipient_id); } - - /** - * List all recipients based on the recipient id and (optional) a given - * wildcard, page amount and page size - * - * @param page - * @param pageSize - * @param pageSize a int. - * @param term a {@link java.lang.String} object. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws java.lang.Exception if any. - */ - public static List search(int page, int pageSize, String term) throws Exception { + + public static List search(final int page, final int pageSize, final String term) throws Exception { return Configuration.gateway().recipient.search(page, pageSize, term); } - - /** - * List all recipients based on the recipient id and a given wildcard - * - * @param message a {@link java.lang.String} object. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws java.lang.Exception if any. - */ - public static List search(String message) throws Exception { + + public static List search(final String message) throws Exception { return search(1, 10, message); } - - /** - *

search.

- * - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws java.lang.Exception if any. - */ + public static List search() throws Exception { return search(1, 10, ""); } - - /** - * List all recipients based on the recipient id and (optional) page amount - * and page size - * - * @param page - * @param pageNumber - * @param pageNumber a int. - * @return The response - * @throws com.trolley.Exceptions.InvalidStatusCodeException if any. - * @throws com.trolley.Exceptions.InvalidServerConnectionException if any. - * @throws com.trolley.Exceptions.InvalidFieldException if any. - * @throws java.lang.Exception if any. - */ - public static List search(int page, int pageNumber) throws Exception { + + public static List search(final int page, final int pageNumber) throws Exception { return search(page, pageNumber, ""); } - } diff --git a/src/main/java/com/trolley/trolley/RecipientAccount.java b/src/main/java/com/trolley/trolley/RecipientAccount.java index b485713..e7d0648 100644 --- a/src/main/java/com/trolley/trolley/RecipientAccount.java +++ b/src/main/java/com/trolley/trolley/RecipientAccount.java @@ -1,18 +1,12 @@ + package com.trolley.trolley; import java.util.List; import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include;; - -/** - *

RecipientAccount class.

- * - * @author joshua - * @version $Id: $Id - */ -@JsonInclude(Include.NON_NULL) -public class RecipientAccount { +@JsonInclude(JsonInclude.Include.NON_NULL) +public class RecipientAccount +{ String type; Boolean primary; String currency; @@ -36,476 +30,208 @@ public class RecipientAccount { String emailAddress; String status; String disabledAt; - - /** - *

Getter for the field emailAddress.

- * - * @return a {@link java.lang.String} object. - */ - public String getEmailAddress(){ - return emailAddress; - } - /** - *

Setter for the field emailAddress.

- * - * @param emailAddress a {@link java.lang.String} object. - */ - public void setEmailAddress(String emailAddress){ + + public String getEmailAddress() { + return this.emailAddress; + } + + public void setEmailAddress(final String emailAddress) { this.emailAddress = emailAddress; } - - - /** - *

Getter for the field disabledAt.

- * - * @return a {@link java.lang.String} object. - */ - public String getDisabledAt(){ - return disabledAt; - } - /** - *

Setter for the field disabledAt.

- * - * @param disabledAt a {@link java.lang.String} object. - */ - public void setDisabledAt(String disabledAt){ + + public String getDisabledAt() { + return this.disabledAt; + } + + public void setDisabledAt(final String disabledAt) { this.disabledAt = disabledAt; } - - /** - *

Getter for the field status.

- * - * @return a {@link java.lang.String} object. - */ - public String getStatus(){ - return status; - } - /** - *

Setter for the field status.

- * - * @param status a {@link java.lang.String} object. - */ - public void setStatus(String status){ + + public String getStatus() { + return this.status; + } + + public void setStatus(final String status) { this.status = status; } - - /** - *

Getter for the field recipientId.

- * - * @return a {@link java.lang.String} object. - */ - public String getRecipientId(){ - return recipientId; - } - /** - *

Setter for the field recipientId.

- * - * @param recipientId a {@link java.lang.String} object. - */ - public void setRecipientId(String recipientId){ + + public String getRecipientId() { + return this.recipientId; + } + + public void setRecipientId(final String recipientId) { this.recipientId = recipientId; } - - /** - *

Getter for the field type.

- * - * @return a {@link java.lang.String} object. - */ + public String getType() { - return type; + return this.type; } - - /** - *

Setter for the field type.

- * - * @param type a {@link java.lang.String} object. - */ - public void setType(String type) { + + public void setType(final String type) { this.type = type; } - - /** - *

Getter for the field primary.

- * - * @return a {@link java.lang.Boolean} object. - */ + public Boolean getPrimary() { - return primary; + return this.primary; } - - /** - *

Setter for the field primary.

- * - * @param primary a {@link java.lang.Boolean} object. - */ - public void setPrimary(Boolean primary) { + + public void setPrimary(final Boolean primary) { this.primary = primary; } - - /** - *

Getter for the field currency.

- * - * @return a {@link java.lang.String} object. - */ + public String getCurrency() { - return currency; + return this.currency; } - - /** - *

Setter for the field currency.

- * - * @param currency a {@link java.lang.String} object. - */ - public void setCurrency(String currency) { + + public void setCurrency(final String currency) { this.currency = currency; } - - /** - *

Getter for the field id.

- * - * @return a {@link java.lang.String} object. - */ + public String getId() { - return id; + return this.id; } - - /** - *

Setter for the field id.

- * - * @param id a {@link java.lang.String} object. - */ - public void setId(String id) { + + public void setId(final String id) { this.id = id; } - - /** - *

Getter for the field recipientAccountId.

- * - * @return a {@link java.lang.String} object. - */ + public String getRecipientAccountId() { - return recipientAccountId; + return this.recipientAccountId; } - - /** - *

Setter for the field recipientAccountId.

- * - * @param recipientAccountId a {@link java.lang.String} object. - */ - public void setRecipientAccountId(String recipientAccountId) { + + public void setRecipientAccountId(final String recipientAccountId) { this.recipientAccountId = recipientAccountId; } - - /** - *

Getter for the field routeType.

- * - * @return a {@link java.lang.String} object. - */ + public String getRouteType() { - return routeType; + return this.routeType; } - - /** - *

Setter for the field routeType.

- * - * @param routeType a {@link java.lang.String} object. - */ - public void setRouteType(String routeType) { + + public void setRouteType(final String routeType) { this.routeType = routeType; } - - /** - *

Getter for the field recipientFees.

- * - * @return a {@link java.lang.String} object. - */ + public String getRecipientFees() { - return recipientFees; + return this.recipientFees; } - - /** - *

Setter for the field recipientFees.

- * - * @param recipientFees a {@link java.lang.String} object. - */ - public void setRecipientFees(String recipientFees) { + + public void setRecipientFees(final String recipientFees) { this.recipientFees = recipientFees; } - - /** - *

Getter for the field country.

- * - * @return a {@link java.lang.String} object. - */ + public String getCountry() { - return country; + return this.country; } - - /** - *

Setter for the field country.

- * - * @param country a {@link java.lang.String} object. - */ - public void setCountry(String country) { + + public void setCountry(final String country) { this.country = country; } - - /** - *

Getter for the field iban.

- * - * @return a {@link java.lang.String} object. - */ + public String getIban() { - return iban; + return this.iban; } - - /** - *

Setter for the field iban.

- * - * @param iban a {@link java.lang.String} object. - */ - public void setIban(String iban) { + + public void setIban(final String iban) { this.iban = iban; } - - /** - *

Getter for the field accountNum.

- * - * @return a {@link java.lang.String} object. - */ + public String getAccountNum() { - return accountNum; + return this.accountNum; } - - /** - *

Setter for the field accountNum.

- * - * @param accountNum a {@link java.lang.String} object. - */ - public void setAccountNum(String accountNum) { + + public void setAccountNum(final String accountNum) { this.accountNum = accountNum; } - - /** - *

Getter for the field accountHolderName.

- * - * @return a {@link java.lang.String} object. - */ + public String getAccountHolderName() { - return accountHolderName; + return this.accountHolderName; } - - /** - *

Setter for the field accountHolderName.

- * - * @param accountHolderName a {@link java.lang.String} object. - */ - public void setAccountHolderName(String accountHolderName) { + + public void setAccountHolderName(final String accountHolderName) { this.accountHolderName = accountHolderName; } - - /** - *

Getter for the field swiftBic.

- * - * @return a {@link java.lang.String} object. - */ + public String getSwiftBic() { - return swiftBic; + return this.swiftBic; } - - /** - *

Setter for the field swiftBic.

- * - * @param swiftBic a {@link java.lang.String} object. - */ - public void setSwiftBic(String swiftBic) { + + public void setSwiftBic(final String swiftBic) { this.swiftBic = swiftBic; } - - /** - *

Getter for the field branchId.

- * - * @return a {@link java.lang.String} object. - */ + public String getBranchId() { - return branchId; + return this.branchId; } - - /** - *

Setter for the field branchId.

- * - * @param branchId a {@link java.lang.String} object. - */ - public void setBranchId(String branchId) { + + public void setBranchId(final String branchId) { this.branchId = branchId; } - - /** - *

Getter for the field bankId.

- * - * @return a {@link java.lang.String} object. - */ + public String getBankId() { - return bankId; + return this.bankId; } - - /** - *

Setter for the field bankId.

- * - * @param bankId a {@link java.lang.String} object. - */ - public void setBankId(String bankId) { + + public void setBankId(final String bankId) { this.bankId = bankId; } - - /** - *

Getter for the field bankName.

- * - * @return a {@link java.lang.String} object. - */ + public String getBankName() { - return bankName; + return this.bankName; } - - /** - *

Setter for the field bankName.

- * - * @param bankName a {@link java.lang.String} object. - */ - public void setBankName(String bankName) { + + public void setBankName(final String bankName) { this.bankName = bankName; } - - /** - *

Getter for the field bankAddress.

- * - * @return a {@link java.lang.String} object. - */ + public String getBankAddress() { - return bankAddress; + return this.bankAddress; } - - /** - *

Setter for the field bankAddress.

- * - * @param bankAddress a {@link java.lang.String} object. - */ - public void setBankAddress(String bankAddress) { + + public void setBankAddress(final String bankAddress) { this.bankAddress = bankAddress; } - - /** - *

Getter for the field bankCity.

- * - * @return a {@link java.lang.String} object. - */ + public String getBankCity() { - return bankCity; + return this.bankCity; } - - /** - *

Setter for the field bankCity.

- * - * @param bankCity a {@link java.lang.String} object. - */ - public void setBankCity(String bankCity) { + + public void setBankCity(final String bankCity) { this.bankCity = bankCity; } - - /** - *

Getter for the field bankRegionCode.

- * - * @return a {@link java.lang.String} object. - */ + public String getBankRegionCode() { - return bankRegionCode; + return this.bankRegionCode; } - - /** - *

Setter for the field bankRegionCode.

- * - * @param bankRegionCode a {@link java.lang.String} object. - */ - public void setBankRegionCode(String bankRegionCode) { + + public void setBankRegionCode(final String bankRegionCode) { this.bankRegionCode = bankRegionCode; } - - /** - *

Getter for the field bankPostalCode.

- * - * @return a {@link java.lang.String} object. - */ + public String getBankPostalCode() { - return bankPostalCode; + return this.bankPostalCode; } - - /** - *

Setter for the field bankPostalCode.

- * - * @param bankPostalCode a {@link java.lang.String} object. - */ - public void setBankPostalCode(String bankPostalCode) { + + public void setBankPostalCode(final String bankPostalCode) { this.bankPostalCode = bankPostalCode; } - - /** - *

findAll.

- * - * @param recipient_id a {@link java.lang.String} object. - * @return a {@link java.util.List} object. - * @throws java.lang.Exception if any. - */ - public static List findAll(String recipient_id) throws Exception { + + public static List findAll(final String recipient_id) throws Exception { return Configuration.gateway().recipientAccount.findAll(recipient_id); } - - /** - *

find.

- * - * @param recipient_id a {@link java.lang.String} object. - * @param recipient_account_id a {@link java.lang.String} object. - * @return a {@link com.trolley.trolley.RecipientAccount} object. - * @throws java.lang.Exception if any. - */ - public static RecipientAccount find(String recipient_id, String recipient_account_id) throws Exception { - return Configuration.gateway().recipientAccount.find(recipient_id, recipient_account_id); + + public static RecipientAccount find(final String recipient_id, final String recipient_account_id) throws Exception { + return Configuration.gateway().recipientAccount.find(recipient_id, recipient_account_id); } - - /** - *

create.

- * - * @param recipient_id a {@link java.lang.String} object. - * @param body a {@link java.lang.String} object. - * @return a {@link com.trolley.trolley.RecipientAccount} object. - * @throws java.lang.Exception if any. - */ - public static RecipientAccount create(String recipient_id, String body) throws Exception { - return Configuration.gateway().recipientAccount.create(recipient_id, body); + + public static RecipientAccount create(final String recipient_id, final String body) throws Exception { + return Configuration.gateway().recipientAccount.create(recipient_id, body); } - - /** - *

update.

- * - * @param recipient_id a {@link java.lang.String} object. - * @param recipient_account_id a {@link java.lang.String} object. - * @param body a {@link java.lang.String} object. - * @return a {@link com.trolley.trolley.RecipientAccount} object. - * @throws java.lang.Exception if any. - */ - public static RecipientAccount update(String recipient_id, String recipient_account_id, String body) throws Exception { + + public static RecipientAccount update(final String recipient_id, final String recipient_account_id, final String body) throws Exception { return Configuration.gateway().recipientAccount.update(recipient_id, recipient_account_id, body); } - - /** - *

delete.

- * - * @param recipient_id a {@link java.lang.String} object. - * @param recipient_account_id a {@link java.lang.String} object. - * @return a boolean. - * @throws java.lang.Exception if any. - */ - public static boolean delete(String recipient_id, String recipient_account_id) throws Exception { + + public static boolean delete(final String recipient_id, final String recipient_account_id) throws Exception { return Configuration.gateway().recipientAccount.delete(recipient_id, recipient_account_id); } - } diff --git a/src/main/java/com/trolley/trolley/RecipientAccountGateway.java b/src/main/java/com/trolley/trolley/RecipientAccountGateway.java index 8d53369..1498645 100644 --- a/src/main/java/com/trolley/trolley/RecipientAccountGateway.java +++ b/src/main/java/com/trolley/trolley/RecipientAccountGateway.java @@ -1,194 +1,116 @@ + package com.trolley.trolley; +import java.util.ArrayList; +import java.io.IOException; import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.trolley.Exceptions.InvalidFieldException; - -import java.io.IOException; -import java.util.ArrayList; -import com.fasterxml.jackson.databind.DeserializationFeature; import java.util.List; -/** - *

RecipientAccountGateway class.

- * - * @author joshua - * @version $Id: $Id - */ -public class RecipientAccountGateway { - +public class RecipientAccountGateway +{ Client client; - - /** - *

Constructor for RecipientAccountGateway.

- * - * @param config a {@link com.trolley.trolley.Configuration} object. - */ - public RecipientAccountGateway(Configuration config) { + + public RecipientAccountGateway(final Configuration config) { this.client = new Client(config); } - - /** - *

findAll.

- * - * @param recipient_id a {@link java.lang.String} object. - * @return a {@link java.util.List} object. - * @throws java.lang.Exception if any. - */ - public List findAll(String recipient_id) throws Exception { + + public List findAll(final String recipient_id) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); } - - String endPoint = "/v1/recipients/" + recipient_id + "/accounts"; - String response = this.client.get(endPoint); - return recipientAccountListFactory(response); + final String endPoint = "/v1/recipients/" + recipient_id + "/accounts"; + final String response = this.client.get(endPoint); + return this.recipientAccountListFactory(response); } - - /** - *

find.

- * - * @param recipient_id a {@link java.lang.String} object. - * @param recipient_account_id a {@link java.lang.String} object. - * @return a {@link com.trolley.trolley.RecipientAccount} object. - * @throws java.lang.Exception if any. - */ - public RecipientAccount find(String recipient_id, String recipient_account_id) throws Exception { + + public RecipientAccount find(final String recipient_id, final String recipient_account_id) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); } - - String endPoint = "/v1/recipients/" + recipient_id + "/accounts/" + recipient_account_id; - String response = this.client.get(endPoint); - return recipientAccountFactory(response); + final String endPoint = "/v1/recipients/" + recipient_id + "/accounts/" + recipient_account_id; + final String response = this.client.get(endPoint); + return this.recipientAccountFactory(response); } - - /** - *

create.

- * - * @param recipient_id a {@link java.lang.String} object. - * @param body a {@link java.lang.String} object. - * @return a {@link com.trolley.trolley.RecipientAccount} object. - * @throws java.lang.Exception if any. - */ - public RecipientAccount create(String recipient_id, String body) throws Exception { + + public RecipientAccount create(final String recipient_id, final String body) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); } if (body == null || body.isEmpty()) { throw new InvalidFieldException("Body cannot be null or empty"); } - - String endPoint = "/v1/recipients/" + recipient_id + "/accounts"; - String response = this.client.post(endPoint, body); - return recipientAccountFactory(response); + final String endPoint = "/v1/recipients/" + recipient_id + "/accounts"; + final String response = this.client.post(endPoint, body); + return this.recipientAccountFactory(response); } - - /** - *

create.

- * - * @param recipient_id a {@link java.lang.String} object. - * @param account a {@link com.trolley.trolley.RecipientAccount} object. - * @return a {@link com.trolley.trolley.RecipientAccount} object. - * @throws java.lang.Exception if any. - */ - public RecipientAccount create(String recipient_id, RecipientAccount account) throws Exception { + + public RecipientAccount create(final String recipient_id, final RecipientAccount account) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); } if (account == null) { throw new InvalidFieldException("Body cannot be null or empty"); } - - String jsonAccount = new ObjectMapper().writeValueAsString(account); - - String endPoint = "/v1/recipients/" + recipient_id + "/accounts"; - String response = this.client.post(endPoint, jsonAccount); - return recipientAccountFactory(response); + final String jsonAccount = new ObjectMapper().writeValueAsString((Object)account); + final String endPoint = "/v1/recipients/" + recipient_id + "/accounts"; + final String response = this.client.post(endPoint, jsonAccount); + return this.recipientAccountFactory(response); } - - /** - *

update.

- * - * @param recipient_id a {@link java.lang.String} object. - * @param recipient_account_id a {@link java.lang.String} object. - * @param body a {@link java.lang.String} object. - * @return a {@link com.trolley.trolley.RecipientAccount} object. - * @throws java.lang.Exception if any. - */ - public RecipientAccount update(String recipient_id, String recipient_account_id, String body) throws Exception { + + public RecipientAccount update(final String recipient_id, final String recipient_account_id, final String body) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); } if (body == null || body.isEmpty()) { throw new InvalidFieldException("Body cannot be null or empty"); } - - String endPoint = "/v1/recipients/" + recipient_id + "/accounts/" + recipient_account_id; - String response = this.client.patch(endPoint, body); - return recipientAccountFactory(response); + final String endPoint = "/v1/recipients/" + recipient_id + "/accounts/" + recipient_account_id; + final String response = this.client.patch(endPoint, body); + return this.recipientAccountFactory(response); } - - /** - *

update.

- * - * @param recipient_id a {@link java.lang.String} object. - * @param recipient_account_id a {@link java.lang.String} object. - * @param account a {@link com.trolley.trolley.RecipientAccount} object. - * @return a {@link com.trolley.trolley.RecipientAccount} object. - * @throws java.lang.Exception if any. - */ - public RecipientAccount update(String recipient_id, String recipient_account_id, RecipientAccount account) throws Exception { + + public RecipientAccount update(final String recipient_id, final String recipient_account_id, final RecipientAccount account) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); } if (account == null) { throw new InvalidFieldException("Body cannot be null or empty"); } - - String jsonAccount = new ObjectMapper().writeValueAsString(account); - - String endPoint = "/v1/recipients/" + recipient_id + "/accounts/" + recipient_account_id; - String response = this.client.patch(endPoint, jsonAccount); - return recipientAccountFactory(response); + final String jsonAccount = new ObjectMapper().writeValueAsString((Object)account); + final String endPoint = "/v1/recipients/" + recipient_id + "/accounts/" + recipient_account_id; + final String response = this.client.patch(endPoint, jsonAccount); + return this.recipientAccountFactory(response); } - - /** - *

delete.

- * - * @param recipient_id a {@link java.lang.String} object. - * @param recipient_account_id a {@link java.lang.String} object. - * @return a boolean. - * @throws java.lang.Exception if any. - */ - public boolean delete(String recipient_id, String recipient_account_id) throws Exception { + + public boolean delete(final String recipient_id, final String recipient_account_id) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); } - - String endPoint = "/v1/recipients/" + recipient_id + "/accounts/" + recipient_account_id; + final String endPoint = "/v1/recipients/" + recipient_id + "/accounts/" + recipient_account_id; this.client.delete(endPoint); return true; } - - private RecipientAccount recipientAccountFactory(String data) throws IOException { - ObjectMapper mapper = new ObjectMapper(); - JsonNode node = mapper.readTree(data); + + private RecipientAccount recipientAccountFactory(final String data) throws IOException { + final ObjectMapper mapper = new ObjectMapper(); + final JsonNode node = mapper.readTree(data); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - RecipientAccount recipientAccount = mapper.readValue(node.get("account").traverse(), RecipientAccount.class); + final RecipientAccount recipientAccount = (RecipientAccount)mapper.readValue(node.get("account").traverse(), (Class)RecipientAccount.class); return recipientAccount; } - - private List recipientAccountListFactory(String data) throws IOException { - ObjectMapper mapper = new ObjectMapper(); - JsonNode node = mapper.readTree(data); + + private List recipientAccountListFactory(final String data) throws IOException { + final ObjectMapper mapper = new ObjectMapper(); + final JsonNode node = mapper.readTree(data); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - Object recipientAccount = mapper.readValue(node.get("accounts").traverse(), Object.class); - @SuppressWarnings("unchecked") - List recipAccounts = (List) recipientAccount; - List recipientAccounts = new ArrayList(); - for (int i = 0; i < recipAccounts.size(); i++) { - RecipientAccount pojo = mapper.convertValue(recipAccounts.get(i), RecipientAccount.class); + final Object recipientAccount = mapper.readValue(node.get("accounts").traverse(), (Class)Object.class); + final List recipAccounts = (List)recipientAccount; + final List recipientAccounts = new ArrayList(); + for (int i = 0; i < recipAccounts.size(); ++i) { + final RecipientAccount pojo = (RecipientAccount)mapper.convertValue((Object)recipAccounts.get(i), (Class)RecipientAccount.class); recipientAccounts.add(pojo); } return recipientAccounts; diff --git a/src/main/java/com/trolley/trolley/RecipientGateway.java b/src/main/java/com/trolley/trolley/RecipientGateway.java index 95a72e4..9da04a0 100644 --- a/src/main/java/com/trolley/trolley/RecipientGateway.java +++ b/src/main/java/com/trolley/trolley/RecipientGateway.java @@ -1,194 +1,107 @@ -package com.trolley.trolley; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.trolley.Exceptions.InvalidFieldException; +package com.trolley.trolley; import java.io.IOException; +import com.fasterxml.jackson.databind.JsonNode; import java.util.ArrayList; -import java.util.List; import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.List; +import com.trolley.Exceptions.InvalidFieldException; -/** - *

RecipientGateway class.

- * - * @author joshua - * @version $Id: $Id - */ -public class RecipientGateway { - +public class RecipientGateway +{ Client client; - - /** - *

Constructor for RecipientGateway.

- * - * @param config a {@link com.trolley.trolley.Configuration} object. - */ - public RecipientGateway(Configuration config) { + + public RecipientGateway(final Configuration config) { this.client = new Client(config); } - - /** - *

find.

- * - * @param recipient_id a {@link java.lang.String} object. - * @return a {@link com.trolley.trolley.Recipient} object. - * @throws java.lang.Exception if any. - */ - public Recipient find(String recipient_id) throws Exception { + + public Recipient find(final String recipient_id) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); } - - String endPoint = "/v1/recipients/" + recipient_id; - String response = this.client.get(endPoint); - return recipientFactory(response); + final String endPoint = "/v1/recipients/" + recipient_id; + final String response = this.client.get(endPoint); + return this.recipientFactory(response); } - - /** - *

findLogs.

- * - * @param recipient_id a {@link java.lang.String} object. - * @return a {@link java.lang.String} object. - * @throws java.lang.Exception if any. - */ - public String findLogs(String recipient_id) throws Exception { - String endPoint = "/v1/recipients/" + recipient_id + "/logs"; - String response = this.client.get(endPoint); + + public String findLogs(final String recipient_id) throws Exception { + final String endPoint = "/v1/recipients/" + recipient_id + "/logs"; + final String response = this.client.get(endPoint); return response; } - - /** - *

findPayments.

- * - * @param recipient_id a {@link java.lang.String} object. - * @return a {@link java.util.List} object. - * @throws java.lang.Exception if any. - */ - public List findPayments(String recipient_id) throws Exception { - String endPoint = "/v1/recipients/" + recipient_id + "/payments"; - String response = this.client.get(endPoint); - ObjectMapper mapper = new ObjectMapper(); - JsonNode node = mapper.readTree(response); + + public List findPayments(final String recipient_id) throws Exception { + final String endPoint = "/v1/recipients/" + recipient_id + "/payments"; + final String response = this.client.get(endPoint); + final ObjectMapper mapper = new ObjectMapper(); + final JsonNode node = mapper.readTree(response); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - Object payment = mapper.readValue(node.get("payments").traverse(), Object.class); - @SuppressWarnings("unchecked") - List paymens = (List) payment; - List payments = new ArrayList(); - for (int i = 0; i < paymens.size(); i++) { - Payment pojo = mapper.convertValue(paymens.get(i), Payment.class); + final Object payment = mapper.readValue(node.get("payments").traverse(), (Class)Object.class); + final List paymens = (List)payment; + final List payments = new ArrayList(); + for (int i = 0; i < paymens.size(); ++i) { + final Payment pojo = (Payment)mapper.convertValue((Object)paymens.get(i), (Class)Payment.class); payments.add(pojo); } - return payments; } - - /** - *

create.

- * - * @param body a {@link java.lang.String} object. - * @return a {@link com.trolley.trolley.Recipient} object. - * @throws java.lang.Exception if any. - */ - public Recipient create(String body) throws Exception { + + public Recipient create(final String body) throws Exception { if (body == null || body.isEmpty()) { throw new InvalidFieldException("Body cannot be null or empty"); } - String endPoint = "/v1/recipients/"; - String response = this.client.post(endPoint, body); - return recipientFactory(response); + final String endPoint = "/v1/recipients/"; + final String response = this.client.post(endPoint, body); + return this.recipientFactory(response); } - - /** - *

create.

- * - * @param recipient a {@link com.trolley.trolley.Recipient} object. - * @return a {@link com.trolley.trolley.Recipient} object. - * @throws java.lang.Exception if any. - */ - public Recipient create(Recipient recipient) throws Exception { + + public Recipient create(final Recipient recipient) throws Exception { if (recipient == null) { throw new InvalidFieldException("Body cannot be null or empty"); } - - String jsonRecipient = new ObjectMapper().writeValueAsString(recipient); - - String endPoint = "/v1/recipients/"; - String response = this.client.post(endPoint, jsonRecipient); - return recipientFactory(response); + final String jsonRecipient = new ObjectMapper().writeValueAsString((Object)recipient); + final String endPoint = "/v1/recipients/"; + final String response = this.client.post(endPoint, jsonRecipient); + return this.recipientFactory(response); } - - /** - *

update.

- * - * @param recipient_id a {@link java.lang.String} object. - * @param body a {@link java.lang.String} object. - * @return a boolean. - * @throws java.lang.Exception if any. - */ - public boolean update(String recipient_id, String body) throws Exception { + + public boolean update(final String recipient_id, final String body) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); } if (body == null || body.isEmpty()) { throw new InvalidFieldException("Body cannot be null or empty"); } - - String endPoint = "/v1/recipients/" + recipient_id; + final String endPoint = "/v1/recipients/" + recipient_id; this.client.patch(endPoint, body); return true; } - - /** - *

update.

- * - * @param recipient_id a {@link java.lang.String} object. - * @param recipient a {@link com.trolley.trolley.Recipient} object. - * @return a boolean. - * @throws java.lang.Exception if any. - */ - public boolean update(String recipient_id, Recipient recipient) throws Exception { + + public boolean update(final String recipient_id, final Recipient recipient) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); } if (recipient == null) { throw new InvalidFieldException("Body cannot be null or empty"); } - - String jsonRecipient = new ObjectMapper().writeValueAsString(recipient); - - String endPoint = "/v1/recipients/" + recipient_id; + final String jsonRecipient = new ObjectMapper().writeValueAsString((Object)recipient); + final String endPoint = "/v1/recipients/" + recipient_id; this.client.patch(endPoint, jsonRecipient); return true; } - - /** - *

delete.

- * - * @param recipient_id a {@link java.lang.String} object. - * @return a boolean. - * @throws java.lang.Exception if any. - */ - public boolean delete(String recipient_id) throws Exception { + + public boolean delete(final String recipient_id) throws Exception { if (recipient_id == null || recipient_id.isEmpty()) { throw new InvalidFieldException("Recipient id cannot be null or empty."); } - - String endPoint = "/v1/recipients/" + recipient_id; + final String endPoint = "/v1/recipients/" + recipient_id; this.client.delete(endPoint); return true; } - - /** - *

search.

- * - * @param page a int. - * @param pageSize a int. - * @param term a {@link java.lang.String} object. - * @return a {@link java.util.List} object. - * @throws java.lang.Exception if any. - */ - public List search(int page, int pageSize, String term) throws Exception { + + public List search(final int page, final int pageSize, final String term) throws Exception { if (page < 0) { throw new InvalidFieldException("Page cannot be less than 0"); } @@ -198,32 +111,28 @@ public List search(int page, int pageSize, String term) throws Except if (term == null) { throw new InvalidFieldException("Message cannot be null"); } - - String endPoint = "/v1/recipients/?" + "&search=" + term + "&page=" + page + "&pageSize=" + pageSize; - String response = this.client.get(endPoint); - - return recipientListFactory(response); + final String endPoint = "/v1/recipients/?&search=" + term + "&page=" + page + "&pageSize=" + pageSize; + final String response = this.client.get(endPoint); + return this.recipientListFactory(response); } - - private Recipient recipientFactory(String data) throws IOException { - ObjectMapper mapper = new ObjectMapper(); + + private Recipient recipientFactory(final String data) throws IOException { + final ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - JsonNode node = mapper.readTree(data); - Recipient recipient = mapper.readValue(node.get("recipient").traverse(), Recipient.class); + final JsonNode node = mapper.readTree(data); + final Recipient recipient = (Recipient)mapper.readValue(node.get("recipient").traverse(), (Class)Recipient.class); return recipient; } - - private List recipientListFactory(String data) throws IOException { - ObjectMapper mapper = new ObjectMapper(); + + private List recipientListFactory(final String data) throws IOException { + final ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - JsonNode node = mapper.readTree(data); - - Object recipient = mapper.readValue(node.get("recipients").traverse(), Object.class); - @SuppressWarnings("unchecked") - List recips = (List) recipient; - List recipients = new ArrayList(); - for (int i = 0; i < recips.size(); i++) { - Recipient pojo = mapper.convertValue(recips.get(i), Recipient.class); + final JsonNode node = mapper.readTree(data); + final Object recipient = mapper.readValue(node.get("recipients").traverse(), (Class)Object.class); + final List recips = (List)recipient; + final List recipients = new ArrayList(); + for (int i = 0; i < recips.size(); ++i) { + final Recipient pojo = (Recipient)mapper.convertValue((Object)recips.get(i), (Class)Recipient.class); recipients.add(pojo); } return recipients; diff --git a/src/main/java/com/trolley/trolley/Total.java b/src/main/java/com/trolley/trolley/Total.java index 63c15ae..48aadc1 100644 --- a/src/main/java/com/trolley/trolley/Total.java +++ b/src/main/java/com/trolley/trolley/Total.java @@ -1,13 +1,8 @@ -package com.trolley.trolley; -/** - *

Total class.

- * - * @author joshua - * @version $Id: $Id - */ -public class Total { +package com.trolley.trolley; +public class Total +{ public Integer count; public String totalFees; public String merchantFees; diff --git a/src/main/java/com/trolley/trolley/USD.java b/src/main/java/com/trolley/trolley/USD.java index 80e7118..80cd1c3 100644 --- a/src/main/java/com/trolley/trolley/USD.java +++ b/src/main/java/com/trolley/trolley/USD.java @@ -1,125 +1,60 @@ -package com.trolley.trolley; -/** - *

USD class.

- * - * @author joshua - * @version $Id: $Id - */ -public class USD { +package com.trolley.trolley; +public class USD +{ private Boolean primary; private String amount; private String currency; private String type; private String accountNumber; private Boolean display; - - /** - *

Getter for the field primary.

- * - * @return a {@link java.lang.Boolean} object. - */ + public Boolean getPrimary() { - return primary; + return this.primary; } - - /** - *

Setter for the field primary.

- * - * @param primary a {@link java.lang.Boolean} object. - */ - public void setPrimary(Boolean primary) { + + public void setPrimary(final Boolean primary) { this.primary = primary; } - - /** - *

Getter for the field amount.

- * - * @return a {@link java.lang.String} object. - */ + public String getAmount() { - return amount; + return this.amount; } - - /** - *

Setter for the field amount.

- * - * @param amount a {@link java.lang.String} object. - */ - public void setAmount(String amount) { + + public void setAmount(final String amount) { this.amount = amount; } - - /** - *

Getter for the field currency.

- * - * @return a {@link java.lang.String} object. - */ + public String getCurrency() { - return currency; + return this.currency; } - - /** - *

Setter for the field currency.

- * - * @param currency a {@link java.lang.String} object. - */ - public void setCurrency(String currency) { + + public void setCurrency(final String currency) { this.currency = currency; } - - /** - *

Getter for the field type.

- * - * @return a {@link java.lang.String} object. - */ + public String getType() { - return type; + return this.type; } - - /** - *

Setter for the field type.

- * - * @param type a {@link java.lang.String} object. - */ - public void setType(String type) { + + public void setType(final String type) { this.type = type; } - - /** - *

Getter for the field accountNumber.

- * - * @return a {@link java.lang.String} object. - */ + public String getAccountNumber() { - return accountNumber; + return this.accountNumber; } - - /** - *

Setter for the field accountNumber.

- * - * @param accountNumber a {@link java.lang.String} object. - */ - public void setAccountNumber(String accountNumber) { + + public void setAccountNumber(final String accountNumber) { this.accountNumber = accountNumber; } - - /** - *

Getter for the field display.

- * - * @return a {@link java.lang.Boolean} object. - */ + public Boolean getDisplay() { - return display; + return this.display; } - - /** - *

Setter for the field display.

- * - * @param display a {@link java.lang.Boolean} object. - */ - public void setDisplay(Boolean display) { + + public void setDisplay(final Boolean display) { this.display = display; } }