-
Notifications
You must be signed in to change notification settings - Fork 46
Feature/bav sample code #126
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
33c015c
added Sample code for Bank Account Validation and related config
aastgoel 49e3517
Merge branch 'master' into feature/bav-sample-code
aastgoel 44ef10a
renamed BAV Sample code and added comments
aastgoel 3b17f01
added comment and removed commented config
aastgoel 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.IO; | ||
| using System.Text; | ||
| using Cybersource_rest_samples_dotnet.Samples.Payments; | ||
|
|
||
| namespace Cybersource_rest_samples_dotnet | ||
| { | ||
| class BankAccountValidationConfiguration | ||
| { | ||
| // initialize dictionary object | ||
| private readonly Dictionary<string, string> _configurationDictionary = new Dictionary<string, string>(); | ||
|
|
||
| public Dictionary<string, string> GetConfiguration() | ||
| { | ||
| _configurationDictionary.Add("authenticationType", "JWT"); //mle only support with JWT Auth Type | ||
| _configurationDictionary.Add("merchantID", "testcasmerchpd01001"); | ||
| _configurationDictionary.Add("keysDirectory", Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\..\\Source\\Resource")); | ||
| _configurationDictionary.Add("keyFilename", "testcasmerchpd01001"); | ||
| _configurationDictionary.Add("runEnvironment", "apitest.cybersource.com"); | ||
| _configurationDictionary.Add("keyAlias", "testcasmerchpd01001"); | ||
| _configurationDictionary.Add("keyPass", "Authnet101!"); | ||
|
|
||
|
|
||
| return _configurationDictionary; | ||
| } | ||
|
|
||
| } | ||
| } | ||
|
|
Binary file not shown.
81 changes: 81 additions & 0 deletions
81
Source/Samples/VisaBankAccountValidation/BankAccountValidationValidated.cs
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,81 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Globalization; | ||
| using ApiSdk.model; | ||
| using CyberSource.Api; | ||
| using CyberSource.Client; | ||
| using CyberSource.Model; | ||
|
|
||
| // The Bank Account Validation API requires encrypted requests as a mandatory requirement. The SDK by default sends encrypted requests for APIs where Request MLE (Message Level Encryption) is mandatory. | ||
| //MLE is supported only on the JWT authentication type | ||
| // For additional configuration options related to MLE, refer to the documentation at https://github.com/CyberSource/cybersource-rest-client-dotnet/blob/master/MLE.md | ||
| // For MLE related sample codes look in the folder Samples/MLEFeature | ||
|
|
||
| namespace Cybersource_rest_samples_dotnet.Samples.VisaBankAccountValidation | ||
| { | ||
| public class BankAccountValidationValidated | ||
| { | ||
| public static void WriteLogAudit(int status) | ||
| { | ||
| var filePath = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.'); | ||
| var filename = filePath[filePath.Length - 1]; | ||
| Console.WriteLine($"[Sample Code Testing] [{filename}] {status}"); | ||
| } | ||
|
|
||
| public static InlineResponse20013 Run() | ||
| { | ||
| string clientReferenceInformationCode = "TC50171_100"; | ||
| Bavsv1accountvalidationsClientReferenceInformation clientReferenceInformation = new Bavsv1accountvalidationsClientReferenceInformation( | ||
| Code: clientReferenceInformationCode | ||
| ); | ||
|
|
||
| int processingInformationValidationLevel = 1; | ||
| Bavsv1accountvalidationsProcessingInformation processingInformation = new Bavsv1accountvalidationsProcessingInformation( | ||
| ValidationLevel: processingInformationValidationLevel | ||
| ); | ||
|
|
||
| string paymentInformationBankRoutingNumber = "041210163"; | ||
| string paymentInformationBankAccountNumber = "99970"; | ||
| Bavsv1accountvalidationsPaymentInformationBankAccount paymentInformationBankAccount = new Bavsv1accountvalidationsPaymentInformationBankAccount( | ||
| Number: paymentInformationBankAccountNumber | ||
| ); | ||
|
|
||
| Bavsv1accountvalidationsPaymentInformationBank paymentInformationBank = new Bavsv1accountvalidationsPaymentInformationBank( | ||
| RoutingNumber: paymentInformationBankRoutingNumber, | ||
| Account: paymentInformationBankAccount | ||
| ); | ||
|
|
||
| Bavsv1accountvalidationsPaymentInformation paymentInformation = new Bavsv1accountvalidationsPaymentInformation( | ||
| Bank: paymentInformationBank | ||
| ); | ||
|
|
||
| var requestObj = new AccountValidationsRequest( | ||
| ClientReferenceInformation: clientReferenceInformation, | ||
| ProcessingInformation: processingInformation, | ||
| PaymentInformation: paymentInformation | ||
| ); | ||
|
|
||
| try | ||
| { | ||
| var configDictionary = new BankAccountValidationConfiguration().GetConfiguration(); | ||
| //MLE is supported only on the JWT authentication type | ||
| //Refer BankAccountValidationConfiguration for more details | ||
| var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); | ||
|
|
||
| var apiInstance = new BankAccountValidationApi(clientConfig); | ||
| InlineResponse20013 result = apiInstance.BankAccountValidationRequest(requestObj); | ||
| Console.WriteLine(result); | ||
| WriteLogAudit(apiInstance.GetStatusCode()); | ||
| return result; | ||
| } | ||
| catch (ApiException e) | ||
| { | ||
| Console.WriteLine("Error Code: " + e.ErrorCode); | ||
| Console.WriteLine("Error Message: " + e.Message); | ||
| Console.WriteLine("Exception on calling the API : " + e.Message); | ||
| WriteLogAudit(e.ErrorCode); | ||
| return null; | ||
| } | ||
| } | ||
| } | ||
| } | ||
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.