-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/ach pull #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dexter-onboard
wants to merge
18
commits into
master
Choose a base branch
from
feat/ACH-pull
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feat/ach pull #11
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
8a7dc16
INT-1976 added ACH pull class in payment cs
b0e89cf
CS-1992 added ACH transfers for c-sharp
64cdbb6
CS-1976 added review fixes to ACH pull
f336207
CS-1976 added base class paramater fix
50d73e4
CS-1976 added createACHTRansfer in readme file
6df69d4
feat/ACH-get
86a220e
CS-1992 Added ACH pull get and create endpoints as ACH products
37b3590
CS-2166 added getACHpull and createACHPull fixes
fb750cd
Merge branch 'feat/ACH-pull' of github.com:dapi-co/dapi-csharp into f…
d37ce39
CS-2166 fixed readme file
9aba1c8
CS-2166 added review fixes
16231c7
CS-2166: formatting
asmsh 5a32784
CS-2166 added getACHPull and createACHpull with userinputs and operat…
7f1dd64
Merge branch 'feat/ACH-pull' of github.com:dapi-co/dapi-csharp into f…
da98d05
CS-2166 added getACHPull and createACHpull with userinputs and operat…
7e23091
CS-2166 added getACHPull and createACHpull with userinputs and operat…
a0a7d56
CS-2166 changed ACHTransfer type to ACHPullTransferInfo
8944d62
CS-2166 added build error fixes
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| 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(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); | ||
|
|
||
| // Construct the headers needed for this request | ||
| var headers = new List<KeyValuePair<string, string>>(); | ||
| headers.Add(new KeyValuePair<string, string>("Authorization", "Bearer " + accessToken)); | ||
|
|
||
| // Make the request and get the response | ||
| var respBody = DapiRequest.Do<CreateACHPullRequest, CreateACHPullResponse>(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<KeyValuePair<string, string>>(); | ||
| headers.Add(new KeyValuePair<string, string>("Authorization", "Bearer " + accessToken)); | ||
|
|
||
| // Make the request and get the response | ||
| var respBody = DapiRequest.Do<GetACHPullRequest, GetACHPullResponse>(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 PullTransfer { | ||
| public string senderID { get; } | ||
| public float amount { get; } | ||
| public string description { get; } | ||
|
|
||
| /// <summary> | ||
| /// 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. | ||
| /// </summary> | ||
| /// <param name="senderID"> | ||
| /// the id of the account which the money should be sent from. | ||
| /// retrieved from one of the accounts array returned from the getAccounts method. | ||
| /// </param> | ||
| /// <param name="amount"> | ||
| /// the amount of money which should be sent. | ||
| /// </param> | ||
| /// <param name="description"> | ||
| /// the id of the beneficiary which the money should be sent to. | ||
| /// retrieved from one of the beneficiaries array returned from the getBeneficiaries method. | ||
| /// </param> | ||
| public PullTransfer(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 PullTransfer transfer { get; } | ||
|
|
||
| public CreateACHPullRequest(PullTransfer transfer, string appSecret, string userSecret, string operationID, UserInput[] userInputs) : | ||
| base(appSecret, userSecret, operationID, userInputs) { | ||
| this.transfer = transfer; | ||
| } | ||
| } | ||
|
|
||
| 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) { | ||
| } | ||
| } | ||
| } | ||
| } |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| using Dapi.Types; | ||
| using Newtonsoft.Json; | ||
|
|
||
| namespace Dapi.Response { | ||
| public class CreateACHPullResponse : BaseResponse { | ||
|
|
||
| /// <summary> | ||
| /// This is used only to automate the deserialization of the get response. | ||
| /// This is a private constructor to this lib. | ||
| /// </summary> | ||
| [JsonConstructor] | ||
| internal CreateACHPullResponse(APIStatus status, bool success, string operationID, UserInput[] userInputs, string type, string msg) : | ||
| base(status, success, operationID, userInputs, type, msg) { | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// This is used to construct an error response from the reading of the got response. | ||
| /// This is a private constructor to this lib. | ||
| /// </summary> | ||
| internal CreateACHPullResponse(string errType, string errMsg) : base(errType, errMsg) { | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| using Dapi.Types; | ||
| using Newtonsoft.Json; | ||
|
|
||
| namespace Dapi.Response { | ||
| public class GetACHPullResponse : BaseResponse { | ||
| public ACHPullTransferInfo transfer { get; } | ||
|
|
||
| /// <summary> | ||
| /// This is used only to automate the deserialization of the get response. | ||
| /// This is a private constructor to this lib. | ||
| /// </summary> | ||
| [JsonConstructor] | ||
| 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; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// This is used to construct an error response from the reading of the got response. | ||
| /// This is a private constructor to this lib. | ||
| /// </summary> | ||
| internal GetACHPullResponse(string errType, string errMsg) : base(errType, errMsg) { | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| namespace Dapi.Types { | ||
| public class ACHPullTransferInfo { | ||
| public float amount { get; } | ||
| public Currency currency { get; } | ||
| public string status { get; } | ||
|
|
||
| public ACHPullTransferInfo(float amount, Currency currency, string status) { | ||
| this.amount = amount; | ||
| this.currency = currency; | ||
| this.status = status; | ||
| } | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.