Example #1
0
        public CreditCardPaymentProcessingResponse ProcessCreditCard(CreditCardRequest request)
        {
            string cardNumber = request.CardNumber;
            string swipe      = request.CardSwipe;
            var    encryptor  = new CreditCardEncryption();

            request.CardNumber = encryptor.Encrypt(cardNumber);
            request.CardSwipe  = encryptor.Encrypt(swipe);
            var returnValue = new CreditCardPaymentProcessingResponse();

            try
            {
                using (var client = new PaymentServiceClient())
                {
                    client.Open();
                    returnValue = client.ProcessCreditCard(request);
                    return(returnValue);
                }
            }
            finally
            {
                request.CardNumber     = cardNumber;
                request.CardSwipe      = swipe;
                returnValue.CardNumber = cardNumber;
            }
        }
 /// <summary>
 /// Applies a credit card payment to the specified invoice
 /// </summary>
 /// <param name="context">The store id, station id, and cashier id the information should be restricted to.</param>
 /// <param name="invoiceNumber">The number of the invoice that should be paid</param>
 /// <param name="splitCheckNumber">The split check number, 0-based. Provide -1 if there are no split checks.</param>
 /// <param name="response">Provides the details of the card payment</param>
 /// <param name="paymentIndex">Index for a payment being updated(post authing Credit Cards). Provide -1 if not updating a payment</param>
 /// <returns>An object that contains the success/failure of the request</returns>
 public AppliedPaymentResponse ApplyCardPayment(Context context, long invoiceNumber, int splitCheckNumber,
                                                CreditCardPaymentProcessingResponse response, int paymentIndex)
 {
     string cardNumber = response.CardNumber;
     var encryptor = new CreditCardEncryption();
     response.CardNumber = encryptor.Encrypt(cardNumber);
     try
     {
         using (var client = new SalesServiceClient())
         {
             client.Open();
             return client.ApplyCardPayment(context, invoiceNumber, splitCheckNumber, response,
                                            paymentIndex);
         }
     }
     finally
     {
         response.CardNumber = cardNumber;
     }
 }
        /// <summary>
        /// Applies a credit card payment to the specified invoice
        /// </summary>
        /// <param name="context">The store id, station id, and cashier id the information should be restricted to.</param>
        /// <param name="invoiceNumber">The number of the invoice that should be paid</param>
        /// <param name="splitCheckNumber">The split check number, 0-based. Provide -1 if there are no split checks.</param>
        /// <param name="response">Provides the details of the card payment</param>
        /// <param name="paymentIndex">Index for a payment being updated(post authing Credit Cards). Provide -1 if not updating a payment</param>
        /// <returns>An object that contains the success/failure of the request</returns>
        public AppliedPaymentResponse ApplyCardPayment(Context context, long invoiceNumber, int splitCheckNumber,
                                                       CreditCardPaymentProcessingResponse response, int paymentIndex)
        {
            string cardNumber = response.CardNumber;
            var    encryptor  = new CreditCardEncryption();

            response.CardNumber = encryptor.Encrypt(cardNumber);
            try
            {
                using (var client = new SalesServiceClient())
                {
                    client.Open();
                    return(client.ApplyCardPayment(context, invoiceNumber, splitCheckNumber, response,
                                                   paymentIndex));
                }
            }
            finally
            {
                response.CardNumber = cardNumber;
            }
        }
 public CreditCardPaymentProcessingResponse CompletePreAuth(CreditCardRequest request, long invoiceNumber)
 {
     string cardNumber = request.CardNumber;
     string swipe = request.CardSwipe;
     var encryptor = new CreditCardEncryption();
     request.CardNumber = encryptor.Encrypt(cardNumber);
     request.CardSwipe = encryptor.Encrypt(swipe);
     var returnValue = new CreditCardPaymentProcessingResponse();
     try
     {
         using (var client = new PaymentServiceClient())
         {
             client.Open();
             returnValue = client.CompletePreAuth(request, invoiceNumber);
             return returnValue;
         }
     }
     finally
     {
         request.CardNumber = cardNumber;
         request.CardSwipe = swipe;
         returnValue.CardNumber = cardNumber;
     }
 }