From 8a7dc16aecaf8218af2a8d67741e1ef1d418b9c7 Mon Sep 17 00:00:00 2001 From: dexter-onboard Date: Fri, 13 Jan 2023 10:36:33 +0530 Subject: [PATCH 01/16] INT-1976 added ACH pull class in payment cs --- src/Dapi/Products/Payment.cs | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/Dapi/Products/Payment.cs b/src/Dapi/Products/Payment.cs index 3467397..c738817 100644 --- a/src/Dapi/Products/Payment.cs +++ b/src/Dapi/Products/Payment.cs @@ -70,6 +70,21 @@ public TransferAutoflowResponse transferAutoflow(TransferAutoflow transferAutofl return respBody ?? new TransferAutoflowResponse("UNEXPECTED_RESPONSE", "Unexpected response body"); } + public CreateTransferResponse createACHTransfer(Transfer transfer, string accessToken, string userSecret, string operationID, UserInput[] userInputs) { + // Create the request body of this call + var reqBody = new CreateTransferRequest(transfer, appSecret, userSecret, operationID, userInputs); + + // Construct the headers needed for this request + var headers = new List>(); + headers.Add(new KeyValuePair("Authorization", "Bearer " + accessToken)); + + // Make the request and get the response + var respBody = DapiRequest.Do(reqBody, reqBody.action, headers); + + // return the data if it's valid, otherwise return an error response + return respBody ?? new CreateTransferResponse("UNEXPECTED_RESPONSE", "Unexpected response body"); + } + public class BeneficiaryInfo { public string name { get; } public string accountNumber { get; } @@ -451,5 +466,30 @@ public TransferAutoflowRequest(TransferAutoflow transferAutoflow, string appSecr this.remark = transferAutoflow.remark; } } + + private class CreateTransferRequest : DapiRequest.BaseRequest { + internal string action => "/ach/pull/create"; + + public string senderID { get; } + public float amount { get; } + public string receiverID { get; } + public string name { get; } + public string iban { get; } + public string accountNumber { get; } + public string remark { get; } + public string nickname { get; } + + public CreateTransferRequest(Transfer transfer, string appSecret, string userSecret, string operationID, UserInput[] userInputs) : + base(appSecret, userSecret, operationID, userInputs) { + this.senderID = transfer.senderID; + this.amount = transfer.amount; + this.receiverID = transfer.receiverID; + this.name = transfer.name; + this.iban = transfer.iban; + this.accountNumber = transfer.accountNumber; + this.remark = transfer.remark; + this.nickname = transfer.nickname; + } + } } } From b0e89cf83fdad7f610dc5daa75ce3efc67517a73 Mon Sep 17 00:00:00 2001 From: dexter-onboard Date: Tue, 17 Jan 2023 11:34:47 +0530 Subject: [PATCH 02/16] CS-1992 added ACH transfers for c-sharp --- src/Dapi/DapiApp.cs | 17 ++++++ src/Dapi/Products/Payment.cs | 52 +++++++++++++------ .../Response/CreateACHTransferResponse.cs | 23 ++++++++ 3 files changed, 75 insertions(+), 17 deletions(-) create mode 100644 src/Dapi/Response/CreateACHTransferResponse.cs diff --git a/src/Dapi/DapiApp.cs b/src/Dapi/DapiApp.cs index 12bd6b6..90821d2 100644 --- a/src/Dapi/DapiApp.cs +++ b/src/Dapi/DapiApp.cs @@ -405,6 +405,23 @@ public CreateTransferResponse createTransfer(Payment.Transfer transfer, string a return this.p.createTransfer(transfer, accessToken, userSecret, "", null); } + /// + /// createTransfer talks to the CreateTransfer endpoint of Dapi, with this DapiApp's appSecret. + /// + /// + /// + /// the details of the transfer that should be initiate. + /// + /// + /// retrieved from the ExchangeToken process. + /// + /// + /// retrieved from the user login. + /// + public CreateACHTransferResponse createACHTransfer(Payment.ACHTransfer transfer, string accessToken, string userSecret) { + return this.p.createACHTransfer(transfer, accessToken, userSecret, "", null); + } + /// /// createTransfer talks to the CreateTransfer endpoint of Dapi, with this DapiApp's appSecret, /// to continue a previous operation that required to provide some userInputs. diff --git a/src/Dapi/Products/Payment.cs b/src/Dapi/Products/Payment.cs index c738817..358277a 100644 --- a/src/Dapi/Products/Payment.cs +++ b/src/Dapi/Products/Payment.cs @@ -70,7 +70,7 @@ public TransferAutoflowResponse transferAutoflow(TransferAutoflow transferAutofl return respBody ?? new TransferAutoflowResponse("UNEXPECTED_RESPONSE", "Unexpected response body"); } - public CreateTransferResponse createACHTransfer(Transfer transfer, string accessToken, string userSecret, string operationID, UserInput[] userInputs) { + public CreateACHTransferResponse createACHTransfer(ACHTransfer transfer, string accessToken, string userSecret, string operationID, UserInput[] userInputs) { // Create the request body of this call var reqBody = new CreateTransferRequest(transfer, appSecret, userSecret, operationID, userInputs); @@ -79,10 +79,10 @@ public CreateTransferResponse createACHTransfer(Transfer transfer, string access headers.Add(new KeyValuePair("Authorization", "Bearer " + accessToken)); // Make the request and get the response - var respBody = DapiRequest.Do(reqBody, reqBody.action, headers); + var respBody = DapiRequest.Do(reqBody, reqBody.action, headers); // return the data if it's valid, otherwise return an error response - return respBody ?? new CreateTransferResponse("UNEXPECTED_RESPONSE", "Unexpected response body"); + return respBody ?? new CreateACHTransferResponse("UNEXPECTED_RESPONSE", "Unexpected response body"); } public class BeneficiaryInfo { @@ -372,6 +372,34 @@ public TransferAutoflow(string bundleID, string appKey, string userID, string ba } } + public class ACHTransfer { + public string senderID { get; } + public float amount { get; } + public string description { get; } + + /// + /// Create an object that holds the info for a transfer from a bank that requires the receiver to be already + /// registered as a beneficiary to perform a transaction. + /// + /// + /// + /// the id of the account which the money should be sent from. + /// retrieved from one of the accounts array returned from the getAccounts method. + /// + /// + /// the amount of money which should be sent. + /// + /// + /// the id of the beneficiary which the money should be sent to. + /// retrieved from one of the beneficiaries array returned from the getBeneficiaries method. + /// + public ACHTransfer(string senderID, float amount, string description) { + this.senderID = senderID; + this.amount = amount; + this.description = description; + } + } + private class GetBeneficiariesRequest : DapiRequest.BaseRequest { internal string action => "/payment/beneficiaries/get"; @@ -467,28 +495,18 @@ public TransferAutoflowRequest(TransferAutoflow transferAutoflow, string appSecr } } - private class CreateTransferRequest : DapiRequest.BaseRequest { + private class CreateACHTransferRequest : DapiRequest.BaseRequest { internal string action => "/ach/pull/create"; public string senderID { get; } public float amount { get; } - public string receiverID { get; } - public string name { get; } - public string iban { get; } - public string accountNumber { get; } - public string remark { get; } - public string nickname { get; } + public string description { get; } - public CreateTransferRequest(Transfer transfer, string appSecret, string userSecret, string operationID, UserInput[] userInputs) : + public CreateACHTransferRequest(Transfer transfer, string appSecret, string userSecret, string operationID, UserInput[] userInputs) : base(appSecret, userSecret, operationID, userInputs) { this.senderID = transfer.senderID; this.amount = transfer.amount; - this.receiverID = transfer.receiverID; - this.name = transfer.name; - this.iban = transfer.iban; - this.accountNumber = transfer.accountNumber; - this.remark = transfer.remark; - this.nickname = transfer.nickname; + this.description = transfer.description; } } } diff --git a/src/Dapi/Response/CreateACHTransferResponse.cs b/src/Dapi/Response/CreateACHTransferResponse.cs new file mode 100644 index 0000000..8593e35 --- /dev/null +++ b/src/Dapi/Response/CreateACHTransferResponse.cs @@ -0,0 +1,23 @@ +using Dapi.Types; +using Newtonsoft.Json; + +namespace Dapi.Response { + public class CreateACHTransferResponse : BaseResponse { + + /// + /// This is used only to automate the deserialization of the got response. + /// This is a private constructor to this lib. + /// + [JsonConstructor] + internal CreateACHTransferResponse(string reference, APIStatus status, bool success, string operationID) : + base(status, success, operationID) { + } + + /// + /// This is used to construct an error response from the reading of the got response. + /// This is a private constructor to this lib. + /// + internal CreateACHTransferResponse(string errType, string errMsg) : base(errType, errMsg) { + } + } +} From 64cdbb60557d0204f7599a6719c365021ae8b0e4 Mon Sep 17 00:00:00 2001 From: dexter-onboard Date: Wed, 18 Jan 2023 08:51:48 +0530 Subject: [PATCH 03/16] CS-1976 added review fixes to ACH pull --- src/Dapi/DapiApp.cs | 4 ++-- src/Dapi/Products/Payment.cs | 4 ++-- src/Dapi/Response/CreateACHTransferResponse.cs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Dapi/DapiApp.cs b/src/Dapi/DapiApp.cs index 90821d2..1c6a304 100644 --- a/src/Dapi/DapiApp.cs +++ b/src/Dapi/DapiApp.cs @@ -406,10 +406,10 @@ public CreateTransferResponse createTransfer(Payment.Transfer transfer, string a } /// - /// createTransfer talks to the CreateTransfer endpoint of Dapi, with this DapiApp's appSecret. + /// createACHTransfer talks to the CreateACHTransfer endpoint of Dapi, with this DapiApp's appSecret. /// /// - /// + /// /// the details of the transfer that should be initiate. /// /// diff --git a/src/Dapi/Products/Payment.cs b/src/Dapi/Products/Payment.cs index 358277a..b91e7f6 100644 --- a/src/Dapi/Products/Payment.cs +++ b/src/Dapi/Products/Payment.cs @@ -72,7 +72,7 @@ public TransferAutoflowResponse transferAutoflow(TransferAutoflow transferAutofl public CreateACHTransferResponse createACHTransfer(ACHTransfer transfer, string accessToken, string userSecret, string operationID, UserInput[] userInputs) { // Create the request body of this call - var reqBody = new CreateTransferRequest(transfer, appSecret, userSecret, operationID, userInputs); + var reqBody = new CreateACHTransferRequest(transfer, appSecret, userSecret, operationID, userInputs); // Construct the headers needed for this request var headers = new List>(); @@ -502,7 +502,7 @@ private class CreateACHTransferRequest : DapiRequest.BaseRequest { public float amount { get; } public string description { get; } - public CreateACHTransferRequest(Transfer transfer, string appSecret, string userSecret, string operationID, UserInput[] userInputs) : + public CreateACHTransferRequest(ACHTransfer transfer, string appSecret, string userSecret, string operationID, UserInput[] userInputs) : base(appSecret, userSecret, operationID, userInputs) { this.senderID = transfer.senderID; this.amount = transfer.amount; diff --git a/src/Dapi/Response/CreateACHTransferResponse.cs b/src/Dapi/Response/CreateACHTransferResponse.cs index 8593e35..bea05dd 100644 --- a/src/Dapi/Response/CreateACHTransferResponse.cs +++ b/src/Dapi/Response/CreateACHTransferResponse.cs @@ -5,7 +5,7 @@ namespace Dapi.Response { public class CreateACHTransferResponse : BaseResponse { /// - /// This is used only to automate the deserialization of the got response. + /// This is used only to automate the deserialization of the get response. /// This is a private constructor to this lib. /// [JsonConstructor] From f336207979dad9efb9187e90cd2a853a7dacef5c Mon Sep 17 00:00:00 2001 From: dexter-onboard Date: Wed, 18 Jan 2023 08:59:36 +0530 Subject: [PATCH 04/16] CS-1976 added base class paramater fix --- src/Dapi/Response/CreateACHTransferResponse.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Dapi/Response/CreateACHTransferResponse.cs b/src/Dapi/Response/CreateACHTransferResponse.cs index bea05dd..fc84863 100644 --- a/src/Dapi/Response/CreateACHTransferResponse.cs +++ b/src/Dapi/Response/CreateACHTransferResponse.cs @@ -10,7 +10,7 @@ public class CreateACHTransferResponse : BaseResponse { /// [JsonConstructor] internal CreateACHTransferResponse(string reference, APIStatus status, bool success, string operationID) : - base(status, success, operationID) { + base(status, success, operationID, null, "", "") { } /// From 50d73e4e35d5bb32ff0c1ad73e4183b158143c81 Mon Sep 17 00:00:00 2001 From: dexter-onboard Date: Wed, 18 Jan 2023 09:15:58 +0530 Subject: [PATCH 05/16] CS-1976 added createACHTRansfer in readme file --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.md b/README.md index 991db1b..a3a9983 100644 --- a/README.md +++ b/README.md @@ -480,3 +480,32 @@ In addition to the fields described in the BaseResponse, it has the following fi --- + +#### DapiApp.createACHTransfer + +Method is used to initiate a new ACH transfer. + +##### Method Description + +```c# +public CreateACHTransferResponse createACHTransfer(Payment.ACHTransfer transfer, string accessToken, string userSecret) + +``` + +##### Input Parameters + +| Parameter | Type | Description | +|---|---|---| +| **transfer**
_REQUIRED_ | `Payment.Transfer` | An object that contains info about the transfer that should be initiated. | +| **accessToken**
_REQUIRED_ | `string` | Access Token obtained using the `exchangeToken` method. | +| **userSecret**
_REQUIRED_ | `string` | The `userSecret` from a user’s successful log in to **Connect**. | + +##### Response + +In addition to the fields described in the BaseResponse, it has the following fields, which will only be returned if the status is `done`: + +| Parameter | Type | Description | +|---|---|---| +| reference | `string` | Transaction reference string returned by the bank. | + +--- From 6df69d4b4d76bcc04e0aa914a6270f8ddfe1d21f Mon Sep 17 00:00:00 2001 From: dexter-onboard Date: Tue, 31 Jan 2023 11:42:03 +0530 Subject: [PATCH 06/16] feat/ACH-get --- src/Dapi/DapiApp.cs | 18 +++- src/Dapi/Products/ACH.cs | 96 +++++++++++++++++++ ...erResponse.cs => CreateACHPullResponse.cs} | 6 +- src/Dapi/Response/GetACHPullResponse.cs | 23 +++++ 4 files changed, 137 insertions(+), 6 deletions(-) create mode 100644 src/Dapi/Products/ACH.cs rename src/Dapi/Response/{CreateACHTransferResponse.cs => CreateACHPullResponse.cs} (67%) create mode 100644 src/Dapi/Response/GetACHPullResponse.cs diff --git a/src/Dapi/DapiApp.cs b/src/Dapi/DapiApp.cs index 1c6a304..774b4e3 100644 --- a/src/Dapi/DapiApp.cs +++ b/src/Dapi/DapiApp.cs @@ -17,12 +17,14 @@ public class DapiApp { private readonly Data d; private readonly Payment p; private readonly Metadata m; + private readonly ACH c; public DapiApp(string appSecret) { this.appSecret = appSecret; this.a = new Auth(appSecret); this.d = new Data(appSecret); this.p = new Payment(appSecret); + this.c = new ACH(appSecret); this.m = new Metadata(appSecret); } @@ -406,7 +408,7 @@ public CreateTransferResponse createTransfer(Payment.Transfer transfer, string a } /// - /// createACHTransfer talks to the CreateACHTransfer endpoint of Dapi, with this DapiApp's appSecret. + /// createACHPull talks to the CreateACHPull endpoint of Dapi, with this DapiApp's appSecret. /// /// /// @@ -418,8 +420,18 @@ public CreateTransferResponse createTransfer(Payment.Transfer transfer, string a /// /// retrieved from the user login. /// - public CreateACHTransferResponse createACHTransfer(Payment.ACHTransfer transfer, string accessToken, string userSecret) { - return this.p.createACHTransfer(transfer, accessToken, userSecret, "", null); + public CreateACHPullResponse createACHPull(ACH.ACHPull transfer, string accessToken, string userSecret) { + return this.c.createACHPull(transfer, accessToken, userSecret, "", null); + } + + /// + /// createACHPull talks to the CreateACHPull endpoint of Dapi, with this DapiApp's appSecret. + /// + /// + /// retrieved from the user login. + /// + public GetACHPullResponse getACHPull(string accessToken, string userSecret) { + return this.c.getACHPull(accessToken, userSecret, "", null); } /// diff --git a/src/Dapi/Products/ACH.cs b/src/Dapi/Products/ACH.cs new file mode 100644 index 0000000..58ade79 --- /dev/null +++ b/src/Dapi/Products/ACH.cs @@ -0,0 +1,96 @@ +using System.Collections.Generic; +using Dapi.Response; +using Dapi.Types; + +namespace Dapi.Products { + + public class ACH { + private string appSecret { get; } + + public ACH(string appSecret) { + this.appSecret = appSecret; + } + + + public CreateACHPullResponse createACHPull(ACHPull transfer, string accessToken, string userSecret, string operationID, UserInput[] userInputs) { + // Create the request body of this call + var reqBody = new CreateACHPullRequest(transfer, appSecret, userSecret, operationID, userInputs); + + // Construct the headers needed for this request + var headers = new List>(); + headers.Add(new KeyValuePair("Authorization", "Bearer " + accessToken)); + + // Make the request and get the response + var respBody = DapiRequest.Do(reqBody, reqBody.action, headers); + + // return the data if it's valid, otherwise return an error response + return respBody ?? new CreateACHPullResponse("UNEXPECTED_RESPONSE", "Unexpected response body"); + } + + public getACHPullResponse getACHPull(string accessToken, string userSecret, string operationID, UserInput[] userInputs) { + // Create the request body of this call + var reqBody = new getACHPullRequest(appSecret, userSecret, operationID, userInputs); + + // Construct the headers needed for this request + var headers = new List>(); + headers.Add(new KeyValuePair("Authorization", "Bearer " + accessToken)); + + // Make the request and get the response + var respBody = DapiRequest.Do(reqBody, reqBody.action, headers); + + // return the data if it's valid, otherwise return an error response + return respBody ?? new getACHPullResponse("UNEXPECTED_RESPONSE", "Unexpected response body"); + } + + public class ACHPull { + public string senderID { get; } + public float amount { get; } + public string description { get; } + + /// + /// Create an object that holds the info for a transfer from a bank that requires the receiver to be already + /// registered as a beneficiary to perform a transaction. + /// + /// + /// + /// the id of the account which the money should be sent from. + /// retrieved from one of the accounts array returned from the getAccounts method. + /// + /// + /// the amount of money which should be sent. + /// + /// + /// the id of the beneficiary which the money should be sent to. + /// retrieved from one of the beneficiaries array returned from the getBeneficiaries method. + /// + public ACHPull(string senderID, float amount, string description) { + this.senderID = senderID; + this.amount = amount; + this.description = description; + } + } + + private class CreateACHPullRequest : DapiRequest.BaseRequest { + internal string action => "/ach/pull/create"; + + public string senderID { get; } + public float amount { get; } + public string description { get; } + + public CreateACHPullRequest(ACHPull transfer, string appSecret, string userSecret, string operationID, UserInput[] userInputs) : + base(appSecret, userSecret, operationID, userInputs) { + this.senderID = transfer.senderID; + this.amount = transfer.amount; + this.description = transfer.description; + } + } + + private class GetACHPullRequest : DapiRequest.BaseRequest { + internal string action => "/ach/pull/get"; + + public GetACHPullRequest(string appSecret, string userSecret, string operationID, UserInput[] userInputs) : + base(appSecret, userSecret, operationID, userInputs) { + } + } + } +} \ No newline at end of file diff --git a/src/Dapi/Response/CreateACHTransferResponse.cs b/src/Dapi/Response/CreateACHPullResponse.cs similarity index 67% rename from src/Dapi/Response/CreateACHTransferResponse.cs rename to src/Dapi/Response/CreateACHPullResponse.cs index fc84863..5ed380b 100644 --- a/src/Dapi/Response/CreateACHTransferResponse.cs +++ b/src/Dapi/Response/CreateACHPullResponse.cs @@ -2,14 +2,14 @@ using Newtonsoft.Json; namespace Dapi.Response { - public class CreateACHTransferResponse : BaseResponse { + public class CreateACHPullResponse : BaseResponse { /// /// This is used only to automate the deserialization of the get response. /// This is a private constructor to this lib. /// [JsonConstructor] - internal CreateACHTransferResponse(string reference, APIStatus status, bool success, string operationID) : + internal CreateACHPullResponse(string reference, APIStatus status, bool success, string operationID) : base(status, success, operationID, null, "", "") { } @@ -17,7 +17,7 @@ internal CreateACHTransferResponse(string reference, APIStatus status, bool succ /// This is used to construct an error response from the reading of the got response. /// This is a private constructor to this lib. /// - internal CreateACHTransferResponse(string errType, string errMsg) : base(errType, errMsg) { + internal CreateACHPullResponse(string errType, string errMsg) : base(errType, errMsg) { } } } diff --git a/src/Dapi/Response/GetACHPullResponse.cs b/src/Dapi/Response/GetACHPullResponse.cs new file mode 100644 index 0000000..69c46a2 --- /dev/null +++ b/src/Dapi/Response/GetACHPullResponse.cs @@ -0,0 +1,23 @@ +using Dapi.Types; +using Newtonsoft.Json; + +namespace Dapi.Response { + public class GetACHPullResponse : BaseResponse { + + /// + /// This is used only to automate the deserialization of the get response. + /// This is a private constructor to this lib. + /// + [JsonConstructor] + internal GetACHPullResponse(string reference, APIStatus status, bool success, string operationID) : + base(status, success, operationID, null, "", "") { + } + + /// + /// This is used to construct an error response from the reading of the got response. + /// This is a private constructor to this lib. + /// + internal GetACHPullResponse(string errType, string errMsg) : base(errType, errMsg) { + } + } +} From 86a220ed57d1a1a29d79622dbeddb4246d032dc3 Mon Sep 17 00:00:00 2001 From: dexter-onboard Date: Wed, 1 Feb 2023 11:09:53 +0530 Subject: [PATCH 07/16] CS-1992 Added ACH pull get and create endpoints as ACH products --- README.md | 29 +++++++++++ src/Dapi/DapiApp.cs | 0 src/Dapi/Products/ACH.cs | 8 +-- src/Dapi/Products/Payment.cs | 58 ---------------------- src/Dapi/Response/CreateACHPullResponse.cs | 0 src/Dapi/Response/GetACHPullResponse.cs | 0 6 files changed, 33 insertions(+), 62 deletions(-) mode change 100644 => 100755 README.md mode change 100644 => 100755 src/Dapi/DapiApp.cs mode change 100644 => 100755 src/Dapi/Products/ACH.cs mode change 100644 => 100755 src/Dapi/Products/Payment.cs mode change 100644 => 100755 src/Dapi/Response/CreateACHPullResponse.cs mode change 100644 => 100755 src/Dapi/Response/GetACHPullResponse.cs diff --git a/README.md b/README.md old mode 100644 new mode 100755 index a3a9983..826a570 --- a/README.md +++ b/README.md @@ -509,3 +509,32 @@ In addition to the fields described in the BaseResponse, it has the following fi | reference | `string` | Transaction reference string returned by the bank. | --- + + +#### DapiApp.getACHPull + +Method is used to initiate a new ACH pull. + +##### Method Description + +```c# +CGetACHPullResponse getACHPull(string accessToken, string userSecret, string operationID, UserInput[] userInputs) + +``` + +##### Input Parameters + +| Parameter | Type | Description | +|---|---|---| +| **accessToken**
_REQUIRED_ | `string` | Access Token obtained using the `exchangeToken` method. | +| **userSecret**
_REQUIRED_ | `string` | The `userSecret` from a user’s successful log in to **Connect**. | + +##### Response + +In addition to the fields described in the BaseResponse, it has the following fields, which will only be returned if the status is `done`: + +| Parameter | Type | Description | +|---|---|---| +| reference | `string` | Transaction reference string returned by the bank. | + +--- diff --git a/src/Dapi/DapiApp.cs b/src/Dapi/DapiApp.cs old mode 100644 new mode 100755 diff --git a/src/Dapi/Products/ACH.cs b/src/Dapi/Products/ACH.cs old mode 100644 new mode 100755 index 58ade79..57945a5 --- a/src/Dapi/Products/ACH.cs +++ b/src/Dapi/Products/ACH.cs @@ -27,19 +27,19 @@ public CreateACHPullResponse createACHPull(ACHPull transfer, string accessToken, return respBody ?? new CreateACHPullResponse("UNEXPECTED_RESPONSE", "Unexpected response body"); } - public getACHPullResponse getACHPull(string accessToken, string userSecret, string operationID, UserInput[] userInputs) { + public GetACHPullResponse getACHPull(string accessToken, string userSecret, string operationID, UserInput[] userInputs) { // Create the request body of this call - var reqBody = new getACHPullRequest(appSecret, userSecret, operationID, userInputs); + var reqBody = new GetACHPullRequest(appSecret, userSecret, operationID, userInputs); // Construct the headers needed for this request var headers = new List>(); headers.Add(new KeyValuePair("Authorization", "Bearer " + accessToken)); // Make the request and get the response - var respBody = DapiRequest.Do(reqBody, reqBody.action, headers); + var respBody = DapiRequest.Do(reqBody, reqBody.action, headers); // return the data if it's valid, otherwise return an error response - return respBody ?? new getACHPullResponse("UNEXPECTED_RESPONSE", "Unexpected response body"); + return respBody ?? new GetACHPullResponse("UNEXPECTED_RESPONSE", "Unexpected response body"); } public class ACHPull { diff --git a/src/Dapi/Products/Payment.cs b/src/Dapi/Products/Payment.cs old mode 100644 new mode 100755 index b91e7f6..3467397 --- a/src/Dapi/Products/Payment.cs +++ b/src/Dapi/Products/Payment.cs @@ -70,21 +70,6 @@ public TransferAutoflowResponse transferAutoflow(TransferAutoflow transferAutofl return respBody ?? new TransferAutoflowResponse("UNEXPECTED_RESPONSE", "Unexpected response body"); } - public CreateACHTransferResponse createACHTransfer(ACHTransfer transfer, string accessToken, string userSecret, string operationID, UserInput[] userInputs) { - // Create the request body of this call - var reqBody = new CreateACHTransferRequest(transfer, appSecret, userSecret, operationID, userInputs); - - // Construct the headers needed for this request - var headers = new List>(); - headers.Add(new KeyValuePair("Authorization", "Bearer " + accessToken)); - - // Make the request and get the response - var respBody = DapiRequest.Do(reqBody, reqBody.action, headers); - - // return the data if it's valid, otherwise return an error response - return respBody ?? new CreateACHTransferResponse("UNEXPECTED_RESPONSE", "Unexpected response body"); - } - public class BeneficiaryInfo { public string name { get; } public string accountNumber { get; } @@ -372,34 +357,6 @@ public TransferAutoflow(string bundleID, string appKey, string userID, string ba } } - public class ACHTransfer { - public string senderID { get; } - public float amount { get; } - public string description { get; } - - /// - /// Create an object that holds the info for a transfer from a bank that requires the receiver to be already - /// registered as a beneficiary to perform a transaction. - /// - /// - /// - /// the id of the account which the money should be sent from. - /// retrieved from one of the accounts array returned from the getAccounts method. - /// - /// - /// the amount of money which should be sent. - /// - /// - /// the id of the beneficiary which the money should be sent to. - /// retrieved from one of the beneficiaries array returned from the getBeneficiaries method. - /// - public ACHTransfer(string senderID, float amount, string description) { - this.senderID = senderID; - this.amount = amount; - this.description = description; - } - } - private class GetBeneficiariesRequest : DapiRequest.BaseRequest { internal string action => "/payment/beneficiaries/get"; @@ -494,20 +451,5 @@ public TransferAutoflowRequest(TransferAutoflow transferAutoflow, string appSecr this.remark = transferAutoflow.remark; } } - - private class CreateACHTransferRequest : DapiRequest.BaseRequest { - internal string action => "/ach/pull/create"; - - public string senderID { get; } - public float amount { get; } - public string description { get; } - - public CreateACHTransferRequest(ACHTransfer transfer, string appSecret, string userSecret, string operationID, UserInput[] userInputs) : - base(appSecret, userSecret, operationID, userInputs) { - this.senderID = transfer.senderID; - this.amount = transfer.amount; - this.description = transfer.description; - } - } } } diff --git a/src/Dapi/Response/CreateACHPullResponse.cs b/src/Dapi/Response/CreateACHPullResponse.cs old mode 100644 new mode 100755 diff --git a/src/Dapi/Response/GetACHPullResponse.cs b/src/Dapi/Response/GetACHPullResponse.cs old mode 100644 new mode 100755 From 37b359065f9de0cdc1256cbf0c52db9fcd9ba2b2 Mon Sep 17 00:00:00 2001 From: dexter-onboard Date: Thu, 9 Feb 2023 07:40:31 +0530 Subject: [PATCH 08/16] CS-2166 added getACHpull and createACHPull fixes --- README.md | 39 +++++++++++++-- src/Dapi/Products/ACH.cs | 8 +-- src/Dapi/Products/Payment.cs | 58 ---------------------- src/Dapi/Response/CreateACHPullResponse.cs | 2 +- src/Dapi/Response/GetACHPullResponse.cs | 5 +- src/Dapi/Types/ACHGetTransfer.cs | 13 +++++ 6 files changed, 56 insertions(+), 69 deletions(-) create mode 100644 src/Dapi/Types/ACHGetTransfer.cs diff --git a/README.md b/README.md index a3a9983..543d116 100644 --- a/README.md +++ b/README.md @@ -481,14 +481,42 @@ In addition to the fields described in the BaseResponse, it has the following fi --- -#### DapiApp.createACHTransfer +#### DapiApp.createACHPull -Method is used to initiate a new ACH transfer. +Method is used to initiate a new ACH pull create. ##### Method Description ```c# -public CreateACHTransferResponse createACHTransfer(Payment.ACHTransfer transfer, string accessToken, string userSecret) +public CreateACHPullResponse createACHPull(ACHPull transfer, string accessToken, string userSecret, string operationID, UserInput[] userInputs) + +``` + +##### Input Parameters + +| Parameter | Type | Description | +|---|---|---| +| **transfer**
_REQUIRED_ | `ACH.ACHPull` | An object that contains info about the transfer that should be initiated. | +| **accessToken**
_REQUIRED_ | `string` | Access Token obtained using the `exchangeToken` method. | +| **userSecret**
_REQUIRED_ | `string` | The `userSecret` from a user’s successful log in to **Connect**. | +| **operationID**
_OPTIONAL_ | `string` | The `operationID` from a previous call's response.
Required only when resuming a previous call that responded with `user_input_required` status, to provided user inputs. | +| **userInputs**
_OPTIONAL_ | `UserInput[]` | Array of `UserInput` object, that are needed to complete this operation.
Required only if a previous call responded with `user_input_required` status.

You can read more about user inputs specification on [Specify User Input](https://dapi-api.readme.io/docs/specify-user-input) | + +##### Response + +Method returns only the fields defined in the BaseResponse. + +--- + + +#### DapiApp.getACHPull + +Method is used to initiate a new get ACH pull. + +##### Method Description + +```c# +public GetACHPullResponse getACHPull(string accessToken, string userSecret, string operationID, UserInput[] userInputs) ``` @@ -496,9 +524,10 @@ public CreateACHTransferResponse createACHTransfer(Payment.ACHTransfer transfer, | Parameter | Type | Description | |---|---|---| -| **transfer**
_REQUIRED_ | `Payment.Transfer` | An object that contains info about the transfer that should be initiated. | | **accessToken**
_REQUIRED_ | `string` | Access Token obtained using the `exchangeToken` method. | | **userSecret**
_REQUIRED_ | `string` | The `userSecret` from a user’s successful log in to **Connect**. | +| **operationID**
_OPTIONAL_ | `string` | The `operationID` from a previous call's response.
Required only when resuming a previous call that responded with `user_input_required` status, to provided user inputs. | +| **userInputs**
_OPTIONAL_ | `UserInput[]` | Array of `UserInput` object, that are needed to complete this operation.
Required only if a previous call responded with `user_input_required` status.

You can read more about user inputs specification on [Specify User Input](https://dapi-api.readme.io/docs/specify-user-input) | ##### Response @@ -506,6 +535,6 @@ In addition to the fields described in the BaseResponse, it has the following fi | Parameter | Type | Description | |---|---|---| -| reference | `string` | Transaction reference string returned by the bank. | +| transfer | `ACHGetTransfer` | ACH transfer details returned by the bank. | --- diff --git a/src/Dapi/Products/ACH.cs b/src/Dapi/Products/ACH.cs index 58ade79..57945a5 100644 --- a/src/Dapi/Products/ACH.cs +++ b/src/Dapi/Products/ACH.cs @@ -27,19 +27,19 @@ public CreateACHPullResponse createACHPull(ACHPull transfer, string accessToken, return respBody ?? new CreateACHPullResponse("UNEXPECTED_RESPONSE", "Unexpected response body"); } - public getACHPullResponse getACHPull(string accessToken, string userSecret, string operationID, UserInput[] userInputs) { + public GetACHPullResponse getACHPull(string accessToken, string userSecret, string operationID, UserInput[] userInputs) { // Create the request body of this call - var reqBody = new getACHPullRequest(appSecret, userSecret, operationID, userInputs); + var reqBody = new GetACHPullRequest(appSecret, userSecret, operationID, userInputs); // Construct the headers needed for this request var headers = new List>(); headers.Add(new KeyValuePair("Authorization", "Bearer " + accessToken)); // Make the request and get the response - var respBody = DapiRequest.Do(reqBody, reqBody.action, headers); + var respBody = DapiRequest.Do(reqBody, reqBody.action, headers); // return the data if it's valid, otherwise return an error response - return respBody ?? new getACHPullResponse("UNEXPECTED_RESPONSE", "Unexpected response body"); + return respBody ?? new GetACHPullResponse("UNEXPECTED_RESPONSE", "Unexpected response body"); } public class ACHPull { diff --git a/src/Dapi/Products/Payment.cs b/src/Dapi/Products/Payment.cs index b91e7f6..3467397 100644 --- a/src/Dapi/Products/Payment.cs +++ b/src/Dapi/Products/Payment.cs @@ -70,21 +70,6 @@ public TransferAutoflowResponse transferAutoflow(TransferAutoflow transferAutofl return respBody ?? new TransferAutoflowResponse("UNEXPECTED_RESPONSE", "Unexpected response body"); } - public CreateACHTransferResponse createACHTransfer(ACHTransfer transfer, string accessToken, string userSecret, string operationID, UserInput[] userInputs) { - // Create the request body of this call - var reqBody = new CreateACHTransferRequest(transfer, appSecret, userSecret, operationID, userInputs); - - // Construct the headers needed for this request - var headers = new List>(); - headers.Add(new KeyValuePair("Authorization", "Bearer " + accessToken)); - - // Make the request and get the response - var respBody = DapiRequest.Do(reqBody, reqBody.action, headers); - - // return the data if it's valid, otherwise return an error response - return respBody ?? new CreateACHTransferResponse("UNEXPECTED_RESPONSE", "Unexpected response body"); - } - public class BeneficiaryInfo { public string name { get; } public string accountNumber { get; } @@ -372,34 +357,6 @@ public TransferAutoflow(string bundleID, string appKey, string userID, string ba } } - public class ACHTransfer { - public string senderID { get; } - public float amount { get; } - public string description { get; } - - /// - /// Create an object that holds the info for a transfer from a bank that requires the receiver to be already - /// registered as a beneficiary to perform a transaction. - /// - /// - /// - /// the id of the account which the money should be sent from. - /// retrieved from one of the accounts array returned from the getAccounts method. - /// - /// - /// the amount of money which should be sent. - /// - /// - /// the id of the beneficiary which the money should be sent to. - /// retrieved from one of the beneficiaries array returned from the getBeneficiaries method. - /// - public ACHTransfer(string senderID, float amount, string description) { - this.senderID = senderID; - this.amount = amount; - this.description = description; - } - } - private class GetBeneficiariesRequest : DapiRequest.BaseRequest { internal string action => "/payment/beneficiaries/get"; @@ -494,20 +451,5 @@ public TransferAutoflowRequest(TransferAutoflow transferAutoflow, string appSecr this.remark = transferAutoflow.remark; } } - - private class CreateACHTransferRequest : DapiRequest.BaseRequest { - internal string action => "/ach/pull/create"; - - public string senderID { get; } - public float amount { get; } - public string description { get; } - - public CreateACHTransferRequest(ACHTransfer transfer, string appSecret, string userSecret, string operationID, UserInput[] userInputs) : - base(appSecret, userSecret, operationID, userInputs) { - this.senderID = transfer.senderID; - this.amount = transfer.amount; - this.description = transfer.description; - } - } } } diff --git a/src/Dapi/Response/CreateACHPullResponse.cs b/src/Dapi/Response/CreateACHPullResponse.cs index 5ed380b..e16003f 100644 --- a/src/Dapi/Response/CreateACHPullResponse.cs +++ b/src/Dapi/Response/CreateACHPullResponse.cs @@ -9,7 +9,7 @@ public class CreateACHPullResponse : BaseResponse { /// This is a private constructor to this lib. ///
[JsonConstructor] - internal CreateACHPullResponse(string reference, APIStatus status, bool success, string operationID) : + internal CreateACHPullResponse(APIStatus status, bool success, string operationID) : base(status, success, operationID, null, "", "") { } diff --git a/src/Dapi/Response/GetACHPullResponse.cs b/src/Dapi/Response/GetACHPullResponse.cs index 69c46a2..72f4308 100644 --- a/src/Dapi/Response/GetACHPullResponse.cs +++ b/src/Dapi/Response/GetACHPullResponse.cs @@ -4,13 +4,16 @@ namespace Dapi.Response { public class GetACHPullResponse : BaseResponse { + public ACHGetTransfer transfer { get; } + /// /// This is used only to automate the deserialization of the get response. /// This is a private constructor to this lib. /// [JsonConstructor] - internal GetACHPullResponse(string reference, APIStatus status, bool success, string operationID) : + internal GetACHPullResponse(ACHGetTransfer transfer, string reference, APIStatus status, bool success, string operationID) : base(status, success, operationID, null, "", "") { + this.transfer = transfer } /// diff --git a/src/Dapi/Types/ACHGetTransfer.cs b/src/Dapi/Types/ACHGetTransfer.cs new file mode 100644 index 0000000..9cb1dbc --- /dev/null +++ b/src/Dapi/Types/ACHGetTransfer.cs @@ -0,0 +1,13 @@ +namespace Dapi.Types { + public class ACHGetTransfer { + public number amount { get; } + public Currency currency { get; } + public string status { get; } + + public ACHGetTransfer(number amount, Currency currency, string status) { + this.amount = amount; + this.currency = currency; + this.status = status; + } + } +} \ No newline at end of file From d37ce39dc5e43f6401602714948ba0bb2036b7f9 Mon Sep 17 00:00:00 2001 From: dexter-onboard Date: Thu, 9 Feb 2023 07:44:31 +0530 Subject: [PATCH 09/16] CS-2166 fixed readme file --- README.md | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/README.md b/README.md index 6efbf8e..543d116 100755 --- a/README.md +++ b/README.md @@ -538,32 +538,3 @@ In addition to the fields described in the BaseResponse, it has the following fi | transfer | `ACHGetTransfer` | ACH transfer details returned by the bank. | --- - - -#### DapiApp.getACHPull - -Method is used to initiate a new ACH pull. - -##### Method Description - -```c# -CGetACHPullResponse getACHPull(string accessToken, string userSecret, string operationID, UserInput[] userInputs) - -``` - -##### Input Parameters - -| Parameter | Type | Description | -|---|---|---| -| **accessToken**
_REQUIRED_ | `string` | Access Token obtained using the `exchangeToken` method. | -| **userSecret**
_REQUIRED_ | `string` | The `userSecret` from a user’s successful log in to **Connect**. | - -##### Response - -In addition to the fields described in the BaseResponse, it has the following fields, which will only be returned if the status is `done`: - -| Parameter | Type | Description | -|---|---|---| -| reference | `string` | Transaction reference string returned by the bank. | - ---- From 9aba1c8d7f50738a20e3966cda934b98f2185c9d Mon Sep 17 00:00:00 2001 From: dexter-onboard Date: Thu, 9 Feb 2023 10:33:01 +0530 Subject: [PATCH 10/16] CS-2166 added review fixes --- src/Dapi/Response/GetACHPullResponse.cs | 2 +- src/Dapi/Types/ACHGetTransfer.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Dapi/Response/GetACHPullResponse.cs b/src/Dapi/Response/GetACHPullResponse.cs index 72f4308..68b40e4 100755 --- a/src/Dapi/Response/GetACHPullResponse.cs +++ b/src/Dapi/Response/GetACHPullResponse.cs @@ -13,7 +13,7 @@ public class GetACHPullResponse : BaseResponse { [JsonConstructor] internal GetACHPullResponse(ACHGetTransfer transfer, string reference, APIStatus status, bool success, string operationID) : base(status, success, operationID, null, "", "") { - this.transfer = transfer + this.transfer = transfer; } /// diff --git a/src/Dapi/Types/ACHGetTransfer.cs b/src/Dapi/Types/ACHGetTransfer.cs index 9cb1dbc..ce323c3 100644 --- a/src/Dapi/Types/ACHGetTransfer.cs +++ b/src/Dapi/Types/ACHGetTransfer.cs @@ -1,10 +1,10 @@ namespace Dapi.Types { public class ACHGetTransfer { - public number amount { get; } + public float amount { get; } public Currency currency { get; } public string status { get; } - public ACHGetTransfer(number amount, Currency currency, string status) { + public ACHGetTransfer(float amount, Currency currency, string status) { this.amount = amount; this.currency = currency; this.status = status; From 16231c72d06484341e102021f9a0e7451c42cf10 Mon Sep 17 00:00:00 2001 From: Ahmad Sameh <8120013+asmsh@users.noreply.github.com> Date: Fri, 10 Feb 2023 12:42:38 +0400 Subject: [PATCH 11/16] CS-2166: formatting --- src/Dapi/Products/ACH.cs | 4 +--- src/Dapi/Response/GetACHPullResponse.cs | 3 +-- src/Dapi/Types/ACHGetTransfer.cs | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Dapi/Products/ACH.cs b/src/Dapi/Products/ACH.cs index 57945a5..09d60ce 100755 --- a/src/Dapi/Products/ACH.cs +++ b/src/Dapi/Products/ACH.cs @@ -3,7 +3,6 @@ using Dapi.Types; namespace Dapi.Products { - public class ACH { private string appSecret { get; } @@ -11,7 +10,6 @@ public ACH(string appSecret) { this.appSecret = appSecret; } - public CreateACHPullResponse createACHPull(ACHPull transfer, string accessToken, string userSecret, string operationID, UserInput[] userInputs) { // Create the request body of this call var reqBody = new CreateACHPullRequest(transfer, appSecret, userSecret, operationID, userInputs); @@ -93,4 +91,4 @@ public GetACHPullRequest(string appSecret, string userSecret, string operationID } } } -} \ No newline at end of file +} diff --git a/src/Dapi/Response/GetACHPullResponse.cs b/src/Dapi/Response/GetACHPullResponse.cs index 68b40e4..891aab6 100755 --- a/src/Dapi/Response/GetACHPullResponse.cs +++ b/src/Dapi/Response/GetACHPullResponse.cs @@ -3,7 +3,6 @@ namespace Dapi.Response { public class GetACHPullResponse : BaseResponse { - public ACHGetTransfer transfer { get; } /// @@ -13,7 +12,7 @@ public class GetACHPullResponse : BaseResponse { [JsonConstructor] internal GetACHPullResponse(ACHGetTransfer transfer, string reference, APIStatus status, bool success, string operationID) : base(status, success, operationID, null, "", "") { - this.transfer = transfer; + this.transfer = transfer; } /// diff --git a/src/Dapi/Types/ACHGetTransfer.cs b/src/Dapi/Types/ACHGetTransfer.cs index ce323c3..568f86c 100644 --- a/src/Dapi/Types/ACHGetTransfer.cs +++ b/src/Dapi/Types/ACHGetTransfer.cs @@ -10,4 +10,4 @@ public ACHGetTransfer(float amount, Currency currency, string status) { this.status = status; } } -} \ No newline at end of file +} From 5a32784ffa6feb7651fc9ebd97a5fdafc0da60d1 Mon Sep 17 00:00:00 2001 From: dexter-onboard Date: Fri, 10 Feb 2023 16:09:02 +0530 Subject: [PATCH 12/16] CS-2166 added getACHPull and createACHpull with userinputs and operationID param --- src/Dapi/DapiApp.cs | 102 ++++++++++++++++++++++++++++++++------------ 1 file changed, 75 insertions(+), 27 deletions(-) diff --git a/src/Dapi/DapiApp.cs b/src/Dapi/DapiApp.cs index 774b4e3..6a2ae52 100755 --- a/src/Dapi/DapiApp.cs +++ b/src/Dapi/DapiApp.cs @@ -407,33 +407,6 @@ public CreateTransferResponse createTransfer(Payment.Transfer transfer, string a return this.p.createTransfer(transfer, accessToken, userSecret, "", null); } - /// - /// createACHPull talks to the CreateACHPull endpoint of Dapi, with this DapiApp's appSecret. - /// - /// - /// - /// the details of the transfer that should be initiate. - /// - /// - /// retrieved from the ExchangeToken process. - /// - /// - /// retrieved from the user login. - /// - public CreateACHPullResponse createACHPull(ACH.ACHPull transfer, string accessToken, string userSecret) { - return this.c.createACHPull(transfer, accessToken, userSecret, "", null); - } - - /// - /// createACHPull talks to the CreateACHPull endpoint of Dapi, with this DapiApp's appSecret. - /// - /// - /// retrieved from the user login. - /// - public GetACHPullResponse getACHPull(string accessToken, string userSecret) { - return this.c.getACHPull(accessToken, userSecret, "", null); - } - /// /// createTransfer talks to the CreateTransfer endpoint of Dapi, with this DapiApp's appSecret, /// to continue a previous operation that required to provide some userInputs. @@ -533,6 +506,81 @@ public GetAccountsMetadataResponse getAccountsMetadata(string accessToken, strin return this.m.getAccountsMetadata(accessToken, userSecret, operationID, userInputs); } + /// + /// createACHPull talks to the CreateACHPull endpoint of Dapi, with this DapiApp's appSecret. + /// + /// + /// + /// the details of the transfer that should be initiate. + /// + /// + /// retrieved from the ExchangeToken process. + /// + /// + /// retrieved from the user login. + /// + /// + /// retrieved from the previous call's response. + /// + /// + /// built from the previous call's response, and the required user input. + /// + public CreateACHPullResponse createACHPull(ACH.ACHPull transfer, string accessToken, string userSecret, string operationID, UserInput[] userInputs) { + return this.c.createACHPull(transfer, accessToken, userSecret, operationID, userInputs); + } + + /// + /// createACHPull talks to the CreateACHPull endpoint of Dapi, with this DapiApp's appSecret. + /// + /// + /// retrieved from the ExchangeToken process. + /// + /// + /// retrieved from the user login. + /// + /// + /// retrieved from the previous call's response. + /// + /// + /// built from the previous call's response, and the required user input. + /// + public GetACHPullResponse getACHPull(string accessToken, string userSecret, string operationID, UserInput[] userInputs) { + return this.c.getACHPull(accessToken, userSecret, operationID, userInputs); + } + + /// + /// createACHPull talks to the CreateACHPull endpoint of Dapi, with this DapiApp's appSecret. + /// + /// + /// + /// the details of the transfer that should be initiate. + /// + /// + /// retrieved from the ExchangeToken process. + /// + /// + /// retrieved from the user login. + /// + public CreateACHPullResponse createACHPull(ACH.ACHPull transfer, string accessToken, string userSecret) { + return this.c.createACHPull(transfer, accessToken, userSecret, "", null); + } + + /// + /// createACHPull talks to the CreateACHPull endpoint of Dapi, with this DapiApp's appSecret. + /// + /// + /// retrieved from the ExchangeToken process. + /// + /// + /// retrieved from the user login. + /// + /// + /// retrieved from the previous call's response. + /// + public GetACHPullResponse getACHPull(string accessToken, string userSecret, string operationID) { + return this.c.getACHPull(accessToken, userSecret, operationID, null); + } + /// /// handleSDKRequest injects this {@link DapiApp}'s appSecret in the passed request body, bodyJson, and then /// forwards the request to Dapi, with the passed headers, headersMap, and returns the RAW response got. From da98d05aaf85949883cee71e87e7479486be9d31 Mon Sep 17 00:00:00 2001 From: dexter-onboard Date: Fri, 10 Feb 2023 16:29:26 +0530 Subject: [PATCH 13/16] CS-2166 added getACHPull and createACHpull with userinputs and operationID param --- src/Dapi/DapiApp.cs | 4 ++-- src/Dapi/Products/ACH.cs | 17 ++++++----------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/Dapi/DapiApp.cs b/src/Dapi/DapiApp.cs index 6a2ae52..3b87160 100755 --- a/src/Dapi/DapiApp.cs +++ b/src/Dapi/DapiApp.cs @@ -525,7 +525,7 @@ public GetAccountsMetadataResponse getAccountsMetadata(string accessToken, strin /// /// built from the previous call's response, and the required user input. /// - public CreateACHPullResponse createACHPull(ACH.ACHPull transfer, string accessToken, string userSecret, string operationID, UserInput[] userInputs) { + public CreateACHPullResponse createACHPull(ACH.PullTransfer transfer, string accessToken, string userSecret, string operationID, UserInput[] userInputs) { return this.c.createACHPull(transfer, accessToken, userSecret, operationID, userInputs); } @@ -561,7 +561,7 @@ public GetACHPullResponse getACHPull(string accessToken, string userSecret, stri /// /// retrieved from the user login. /// - public CreateACHPullResponse createACHPull(ACH.ACHPull transfer, string accessToken, string userSecret) { + public CreateACHPullResponse createACHPull(ACH.PullTransfer transfer, string accessToken, string userSecret) { return this.c.createACHPull(transfer, accessToken, userSecret, "", null); } diff --git a/src/Dapi/Products/ACH.cs b/src/Dapi/Products/ACH.cs index 09d60ce..67dc5a6 100755 --- a/src/Dapi/Products/ACH.cs +++ b/src/Dapi/Products/ACH.cs @@ -10,7 +10,7 @@ public ACH(string appSecret) { this.appSecret = appSecret; } - public CreateACHPullResponse createACHPull(ACHPull transfer, string accessToken, string userSecret, string operationID, UserInput[] userInputs) { + public CreateACHPullResponse createACHPull(PullTransfer transfer, string accessToken, string userSecret, string operationID, UserInput[] userInputs) { // Create the request body of this call var reqBody = new CreateACHPullRequest(transfer, appSecret, userSecret, operationID, userInputs); @@ -40,7 +40,7 @@ public GetACHPullResponse getACHPull(string accessToken, string userSecret, stri return respBody ?? new GetACHPullResponse("UNEXPECTED_RESPONSE", "Unexpected response body"); } - public class ACHPull { + public class PullTransfer { public string senderID { get; } public float amount { get; } public string description { get; } @@ -49,7 +49,6 @@ public class ACHPull { /// Create an object that holds the info for a transfer from a bank that requires the receiver to be already /// registered as a beneficiary to perform a transaction. /// - /// /// /// the id of the account which the money should be sent from. /// retrieved from one of the accounts array returned from the getAccounts method. @@ -61,7 +60,7 @@ public class ACHPull { /// the id of the beneficiary which the money should be sent to. /// retrieved from one of the beneficiaries array returned from the getBeneficiaries method. /// - public ACHPull(string senderID, float amount, string description) { + public PullTransfer(string senderID, float amount, string description) { this.senderID = senderID; this.amount = amount; this.description = description; @@ -71,15 +70,11 @@ public ACHPull(string senderID, float amount, string description) { private class CreateACHPullRequest : DapiRequest.BaseRequest { internal string action => "/ach/pull/create"; - public string senderID { get; } - public float amount { get; } - public string description { get; } + public PullTransfer transfer { get; } - public CreateACHPullRequest(ACHPull transfer, string appSecret, string userSecret, string operationID, UserInput[] userInputs) : + public CreateACHPullRequest(PullTransfer transfer, string appSecret, string userSecret, string operationID, UserInput[] userInputs) : base(appSecret, userSecret, operationID, userInputs) { - this.senderID = transfer.senderID; - this.amount = transfer.amount; - this.description = transfer.description; + this.transfer = transfer } } From 7e230912b2e8d8a02458e86471dd2bd1f8e5ff2d Mon Sep 17 00:00:00 2001 From: dexter-onboard Date: Fri, 10 Feb 2023 16:32:59 +0530 Subject: [PATCH 14/16] CS-2166 added getACHPull and createACHpull with userinputs and operationID param --- src/Dapi/Response/CreateACHPullResponse.cs | 4 ++-- src/Dapi/Response/GetACHPullResponse.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Dapi/Response/CreateACHPullResponse.cs b/src/Dapi/Response/CreateACHPullResponse.cs index e16003f..7674e06 100755 --- a/src/Dapi/Response/CreateACHPullResponse.cs +++ b/src/Dapi/Response/CreateACHPullResponse.cs @@ -9,8 +9,8 @@ public class CreateACHPullResponse : BaseResponse { /// This is a private constructor to this lib. /// [JsonConstructor] - internal CreateACHPullResponse(APIStatus status, bool success, string operationID) : - base(status, success, operationID, null, "", "") { + internal CreateACHPullResponse(APIStatus status, bool success, string operationID, UserInput[] userInputs, string type, string msg) : + base(status, success, operationID, userInputs, type, msg) { } /// diff --git a/src/Dapi/Response/GetACHPullResponse.cs b/src/Dapi/Response/GetACHPullResponse.cs index 891aab6..2bc2ff5 100755 --- a/src/Dapi/Response/GetACHPullResponse.cs +++ b/src/Dapi/Response/GetACHPullResponse.cs @@ -10,8 +10,8 @@ public class GetACHPullResponse : BaseResponse { /// This is a private constructor to this lib. /// [JsonConstructor] - internal GetACHPullResponse(ACHGetTransfer transfer, string reference, APIStatus status, bool success, string operationID) : - base(status, success, operationID, null, "", "") { + internal GetACHPullResponse(ACHGetTransfer transfer, string reference, APIStatus status, bool success, string operationID, UserInput[] userInputs, string type, string msg) : + base(status, success, operationID, userInputs, type, msg) { this.transfer = transfer; } From a0a7d568e2a48f45f3142ab56ff17bb5465db72b Mon Sep 17 00:00:00 2001 From: dexter-onboard Date: Fri, 10 Feb 2023 16:37:11 +0530 Subject: [PATCH 15/16] CS-2166 changed ACHTransfer type to ACHPullTransferInfo --- README.md | 2 +- src/Dapi/Response/GetACHPullResponse.cs | 4 ++-- src/Dapi/Types/ACHGetTransfer.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 543d116..7b59bde 100755 --- a/README.md +++ b/README.md @@ -535,6 +535,6 @@ In addition to the fields described in the BaseResponse, it has the following fi | Parameter | Type | Description | |---|---|---| -| transfer | `ACHGetTransfer` | ACH transfer details returned by the bank. | +| transfer | `ACHPullTransferInfo` | ACH transfer details returned by the bank. | --- diff --git a/src/Dapi/Response/GetACHPullResponse.cs b/src/Dapi/Response/GetACHPullResponse.cs index 2bc2ff5..c5bcfa7 100755 --- a/src/Dapi/Response/GetACHPullResponse.cs +++ b/src/Dapi/Response/GetACHPullResponse.cs @@ -3,14 +3,14 @@ namespace Dapi.Response { public class GetACHPullResponse : BaseResponse { - public ACHGetTransfer transfer { get; } + public ACHPullTransferInfo transfer { get; } /// /// This is used only to automate the deserialization of the get response. /// This is a private constructor to this lib. /// [JsonConstructor] - internal GetACHPullResponse(ACHGetTransfer transfer, string reference, APIStatus status, bool success, string operationID, UserInput[] userInputs, string type, string msg) : + internal GetACHPullResponse(ACHPullTransferInfo transfer, string reference, APIStatus status, bool success, string operationID, UserInput[] userInputs, string type, string msg) : base(status, success, operationID, userInputs, type, msg) { this.transfer = transfer; } diff --git a/src/Dapi/Types/ACHGetTransfer.cs b/src/Dapi/Types/ACHGetTransfer.cs index 568f86c..495fb10 100644 --- a/src/Dapi/Types/ACHGetTransfer.cs +++ b/src/Dapi/Types/ACHGetTransfer.cs @@ -1,10 +1,10 @@ namespace Dapi.Types { - public class ACHGetTransfer { + public class ACHPullTransferInfo { public float amount { get; } public Currency currency { get; } public string status { get; } - public ACHGetTransfer(float amount, Currency currency, string status) { + public ACHPullTransferInfo(float amount, Currency currency, string status) { this.amount = amount; this.currency = currency; this.status = status; From 8944d626fb991baae611b87fed540ccc34b58568 Mon Sep 17 00:00:00 2001 From: dexter-onboard Date: Fri, 10 Feb 2023 16:54:14 +0530 Subject: [PATCH 16/16] CS-2166 added build error fixes --- src/Dapi/Products/ACH.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Dapi/Products/ACH.cs b/src/Dapi/Products/ACH.cs index 67dc5a6..a3aeab1 100755 --- a/src/Dapi/Products/ACH.cs +++ b/src/Dapi/Products/ACH.cs @@ -74,7 +74,7 @@ private class CreateACHPullRequest : DapiRequest.BaseRequest { public CreateACHPullRequest(PullTransfer transfer, string appSecret, string userSecret, string operationID, UserInput[] userInputs) : base(appSecret, userSecret, operationID, userInputs) { - this.transfer = transfer + this.transfer = transfer; } }