/// 1. Create and populate a VerifyAvsCvvRequest instance. In this example: 'Primary Account Number' is 4921819777496762, 'Card Verification Value' is 123 and 'Valid Until' date is December 2012. var request = new VerifyAvsCvvRequest() { ItemisationID = "User defined -> Branch id", ReportString = "User defined -> User ID", NameOnCard = "Ashley Marma", CardDetails = new CardDetails() { PAN = "************6762", CVV = "123", ValidUntil = new CardDate() { Month = 12, Year = 2012 } }, Address = new Address() { deliveryPoint = new DeliveryPoint[] { new DeliveryPoint() { deliveryType = DeliveryPointType.houseName, Value = "1" } }, postalPoint = new PostalPoint[] { new PostalPoint() { postalType = PostalPointType.postcode, Value = "NE9 6EH" } } }, }; /// 2. Create a service proxy. Change the hostedServiceURL to the URL supplied by Experian. using (var hostedService = new BankWizardCardService()) { hostedService.Url = "http://localhost:3201/Server/BankWizardCardService.asmx"; hostedService.Timeout = 5000; /// 3. To access
the SoapContext see the files provided in Service\src. hostedService.RequestSoapContext.Security.Tokens.Add(new WASPToken(token)); hostedService.RequestSoapContext.Security.MustUnderstand = false; /// 4. Perform an AVS CVV verification request. var response = hostedService.VerifyAvsCvv(request); /// 5. Check how many errors there were. int errorCount = response.CardValidationResponse.CardCondition.Count(c => c.Severity == ConditionSeverity.error); if (errorCount > 0) { /// 6. Grab all the avs cvv failure conditions as an anonymous name, value type. foreach (var CardCondition in response.CardValidationResponse.CardCondition) { Console.WriteLine("Card validation condition code: {0} severity: {1} reason: {2}", CardCondition.Code, CardCondition.Severity, CardCondition.Reason); } } else { /// 7. AVS CVV successful ~ process the returned data. if (response.PreAuthorised.HasValue) Console.WriteLine("Pre-Authorised => {0}", response.PreAuthorised.Value); if (response.AvsMatched.HasValue) Console.WriteLine("AVS Matched => {0}", response.AvsMatched.Value); if (response.CvvMatched.HasValue) Console.WriteLine("CVV Matched => {0}", response.CvvMatched.Value); if (response.PostcodeMatched.HasValue) Console.WriteLine("Postcode Matched => {0}", response.PostcodeMatched.Value); } } |