Validate BMS Credentials
POS can call this to check that BMS Credentials (bmsUsername and bmsPassword) are valid.
Code Samples
CWS
Request
{
"method" : "validateBmsCredentials",
"requestId" : "7571358",
"targetType" : "paymentGatewayConverge",
"version" : "1.0",
"parameters" : {
"paymentGatewayId" : "6f95a650-b56f-4b45-88d6-b2f53d55e4f6"
}
}
Response - credentials are valid
{
"requestId" : "7571358",
"statusDetails" : "REQUEST_ACCEPTED",
"data" : {
"paymentGatewayCommand" : {
"completed" : true,
"eventQueue" : [ ],
"paymentTransactionData" : {
"result" : "SUCCESS"
},
"warnings" : [ ]
}
}
}
Response - credentials are invalid
{
"requestId" : "7571361",
"statusDetails" : "REQUEST_ACCEPTED",
"data" : {
"paymentGatewayCommand" : {
"completed" : true,
"eventQueue" : [ ],
"paymentTransactionData" : {
"result" : "FAILED",
"errors" : [ "ECLCommerceError ECLAccountInvalidCredentials" ]
},
"warnings" : [ ]
}
}
}
Java
Create an instance of com.elavon.commerce.ECLAccountValidationListener, as shown below.
// The following code is copied from MainActivity.java in the sample application code.
// The code displays results on UI.
ECLAccountValidationListener delegate = new ECLAccountValidationListener()
{
@Override
public void accountDidValidate(ECLAccountInterface eclAccountInterface)
{
displayMessageInProgressView("validate BMS Credentials - succeeded", false);
}
@Override
public void accountDidFailToValidate(ECLAccountInterface eclAccountInterface, ECCError eccError)
{
displayErrorInProgressView("validate BMS Credentials - failed", eccError);
}
};
Then pass the instance to method validateBmsCredentials
on interface com.elavon.commerce.ECLAccountInterface
. CSDK internally validates the combination of bmsUsername and bmsPassword provided by the POS.
If the BMS cannot validate the credentials, ECLCommerceError.Codes.ECLAccountInvalidCredentials will be returned in ECLAccountValidationListener.accountDidFailToValidate.
TransactionSavedState.INSTANCE.account.validateBmsCredentials(delegate);
Objective-C
Create a class implementing the ECLAccountValidationDelegate protocol and implement the methods accountDidValidate and accountDidFailToValidate, as shown below.
@interface ValidateBmsCredentialsDelegate : NSObject<ECLAccountValidationDelegate>
@property MainViewController *mainViewController;
@end
@implementation ValidateBmsCredentialsDelegate
- (void)accountDidValidate:(id<ECLAccountValidationDelegate>)delegate {
[_mainViewController addStatusString:@"BMS credentials validated\n"];
}
- (void)accountDidFailToValidate:(id<ECLAccountValidationDelegate>)delegate error:(NSError *)error {
[_mainViewController addStatusString:[NSString stringWithFormat:@"BMS credentials failed to be validated: %@\n", [error debugDescription]]];
}
@end
Then, pass an instance of the delegate to the method validateBmsCredentials of protocol ECLAccountProtocol. CSDK internally validates the combination of bmsUsername and bmsPassword provided by the POS.
If the BMS cannot validate the credentials, an ECLError with code ECLAccountInvalidCredentials will be returned in accountDidFailToValidate.
// inside MainViewController implementation
id<ECLAccountValidationDelegate> delegate = [[ValidateBmsCredentialsDelegate alloc] initWithMainViewController:self];
[_account validateBmsCredentials:delegate];
C#
// Asynchronous
StartValidateBmsCredentials(String paymentGatewayId, NotifyCWSEvent ne, PaymentTransactionComplete ptc)
// Synchronous
PaymentTransactionResults results = m_CWS.ValidateBmsCredentials(String paymentGatewayId);
MyValidateBmsCredentialsComplete(results, results.Warnings);
// Do something with the response
public void MyValidateBmsCredentialsComplete(PaymentTransactionResults paymentResults, String[] warnings)
{
lock (myPaymentCompleteLock)
{
Log("----------- Validate BMS Credentials Complete ------------");