Using the Payment Web Service

Just as we did with MyGolfGear.NET's Tax Web service, we also decided to create a Payment Web service. The reasons are really the same. MyGolfGear.NET will most likely begin using a third-party payment package when the company gets off the ground. Until then, we'll do basic payment validation before accepting orders. Listing 15.10 shows the code necessary to create this Web service.

Listing 15.10. Creating the ccService Web Service
 public class ccService : System.Web.Services.WebService { ... public bool LundCheck( string ccNum ) { int iSum = 0; int iLength = ccNum.Length; int iOddEven = iLength & 1; char[] sCardNumber = ccNum.ToCharArray(); for(int i = 0; i < iLength; i ++) { int iDigit = System.Int32.Parse(sCardNumber[i].ToString()); ...

Get Building e-Commerce Sites with the .NET Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.