Matching debit card details example code

/// 1. Create and populate a MatchDebitCardDetailsRequest instance. In this example 'Primary Account Number' is 1234567890123456, 'Card Verification Value' is 123, 'Valid Until' is December 2020 and sort code is 309786.

var request = new MatchDebitCardDetailsRequest()

{

itemisationID = "User defined -> Branch id",

reportString = "User defined -> User ID",

CardDetails = new CardDetails()

{

PAN = "1234567890123456",

CVV = "123",

ValidUntil = new CardDate() { Month = 12, Year = 2020},

SortCode = "309786"

}

};

/// 2. Create a service proxy. Change the hostedServiceURL to the URL supplied by Experian.
using
(var hostedService = new BankWizardCardService())

{

hostedService.Url = "bankwizardhosted url";

hostedService.Timeout = 5000;

/// 3. To access the SoapContext see the files provided in Service\src.
/// The first argument in the WASPToken constructor comes from a successful WASP authentication request.

hostedService.RequestSoapContext.Security.Tokens.Add(new WASPToken(token));

hostedService.RequestSoapContext.Security.MustUnderstand = false;

/// 4. Perform a debit card match and validation.

var response = hostedService.MatchDebitCardDetails(request);

/// 5. Check to see if there were errors.

if (response.CardValidationResponse.CardCondition != null)

{

/// 6. Grab all the validation failure bits as an anonymous name, value type.

foreach(var CardCondition in response.CardValidationResponse.CardCondition)

Console.WriteLine("Card validation failed with code: (0) Severity: (1) Reason: (2)")

CardCondition.Code, CardCondition.Severity, CardCondition.Reason);

}

else

{

/// 7. Validation successful ~ process the returned data.

if (response.CardValidationResponse.CardType.HasValue)

Console.WriteLine("Card type => {0}", Enum.GetName(typeof(TypeOfCard), response.CardValidationResponse.CardType.Value));

if (response.CardValidationResponse.SubType.HasValue)

Console.WriteLine("Card sub-type => {0}", Enum.GetName(typeof(SubTypeOfCard), response.CardValidationResponse.SubType.Value));

if (!string.IsNullOrEmpty(response.CardValidationResponse.IssuerName))

Console.WriteLine("Card issuer => {0}", response.CardValidationResponse.IssuerName);

if (!string.IsNullOrEmpty(response.CardValidationResponse.SchemeName))

Console.WriteLine("Card scheme => {0}", response.CardValidationResponse.SchemeName);

if (response.MatchResult != null)

Console.WriteLine("Debit card match response => {0}", Enum.GetName(typeof(MatchResult), response.MatchResult.Value));

}

}

This step: Matching debit card details