/// <summary>
        /// Process recurring payment
        /// </summary>
        /// <param name="paymentInfo">Payment info required for an betting processing</param>
        /// <param name="bettingGuid">Unique order identifier</param>
        /// <param name="processPaymentResult">Process payment result</param>
        public void ProcessRecurringPayment(TransactionPayment transactionPayment, Guid bettingGuid, ref ProcessPaymentResult processPaymentResult)
        {
            InitSettings();
            MerchantAuthenticationType authentication = PopulateMerchantAuthentication();
            if (!transactionPayment.IsRecurringPayment)
            {
                ARBSubscriptionType subscription = new ARBSubscriptionType();
                AuthorizeNet.net.authorize.api.CreditCardType creditCard = new AuthorizeNet.net.authorize.api.CreditCardType();

                subscription.name = bettingGuid.ToString();
                creditCard.cardNumber = transactionPayment.PaymentMenthod.CreditCardNumber;
                creditCard.expirationDate = transactionPayment.PaymentMenthod.CardExpirationYear + "-" + transactionPayment.PaymentMenthod.CardExpirationMonth; // required format for API is YYYY-MM
                creditCard.cardCode = transactionPayment.PaymentMenthod.CardCvv2;

                subscription.payment = new PaymentType();
                subscription.payment.Item = creditCard;
                subscription.billTo = new NameAndAddressType();
                subscription.billTo.firstName = transactionPayment.Customer.FirstName;
                subscription.billTo.lastName = transactionPayment.Customer.LastName;
                subscription.billTo.address = transactionPayment.Customer.Address;
                subscription.billTo.city = transactionPayment.Customer.City;
                subscription.billTo.zip = transactionPayment.Customer.PostalCode;
                subscription.customer = new CustomerType();
                subscription.customer.email = transactionPayment.Customer.Email1;
                subscription.customer.phoneNumber = transactionPayment.Customer.Telephone;
                subscription.order = new OrderType();
                subscription.order.description =Constant.Payment.STORENAME+" "+ "Recurring payment";

                // Create a subscription that is leng of specified occurrences and interval is amount of days ad runs

                subscription.paymentSchedule = new PaymentScheduleType();
                DateTime dtNow = DateTime.UtcNow;
                subscription.paymentSchedule.startDate = new DateTime(dtNow.Year, dtNow.Month, dtNow.Day);
                subscription.paymentSchedule.startDateSpecified = true;

                subscription.paymentSchedule.totalOccurrences = Convert.ToInt16(transactionPayment.RecurringTotalCycles);
                subscription.paymentSchedule.totalOccurrencesSpecified = true;

                subscription.amount = transactionPayment.TransactionPaymentTotal;
                subscription.amountSpecified = true;

                // Interval can't be updated once a subscription is created.
                subscription.paymentSchedule.interval = new PaymentScheduleTypeInterval();
                switch (transactionPayment.RecurringCyclePeriod)
                {
                    case (int)RecurringProductCyclePeriodEnum.Days:
                        subscription.paymentSchedule.interval.length = Convert.ToInt16(transactionPayment.RecurringCycleLength);
                        subscription.paymentSchedule.interval.unit = ARBSubscriptionUnitEnum.days;
                        break;
                    case (int)RecurringProductCyclePeriodEnum.Weeks:
                        subscription.paymentSchedule.interval.length = Convert.ToInt16(transactionPayment.RecurringCycleLength * 7);
                        subscription.paymentSchedule.interval.unit = ARBSubscriptionUnitEnum.days;
                        break;
                    case (int)RecurringProductCyclePeriodEnum.Months:
                        subscription.paymentSchedule.interval.length = Convert.ToInt16(transactionPayment.RecurringCycleLength);
                        subscription.paymentSchedule.interval.unit = ARBSubscriptionUnitEnum.months;
                        break;
                    case (int)RecurringProductCyclePeriodEnum.Years:
                        subscription.paymentSchedule.interval.length = Convert.ToInt16(transactionPayment.RecurringCycleLength * 12);
                        subscription.paymentSchedule.interval.unit = ARBSubscriptionUnitEnum.months;
                        break;
                    default:
                        throw new Exception("Not supported cycle period");
                }

                ARBCreateSubscriptionResponseType response = webService.ARBCreateSubscription(authentication, subscription);

                if (response.resultCode == MessageTypeEnum.Ok)
                {
                    processPaymentResult.SubscriptionTransactionId = response.subscriptionId.ToString();
                    processPaymentResult.AuthorizationTransactionCode = response.resultCode.ToString();
                    processPaymentResult.AuthorizationTransactionResult = string.Format("Approved ({0}: {1})", response.resultCode.ToString(), response.subscriptionId.ToString());
                }
                else
                {
                    processPaymentResult.Error = string.Format("Error processing recurring payment. {0}", GetErrors(response));
                    processPaymentResult.FullError = string.Format("Error processing recurring payment. {0}", GetErrors(response));
                }
            }
        }
        /// <summary>
        /// Places an order
        /// </summary>
        /// <param name="transactionPayment">Payment info</param>
        /// <param name="customer">Customer</param>
        /// <param name="orderGuid">Order GUID to use</param>
        /// <param name="orderId">Order identifier</param>
        /// <returns>The error status, or String.Empty if no errors</returns>
        public string PlaceTransactionPayment(TransactionPayment transactionPayment,
            Guid transactionPaymentGuid, out long TransactionPaymentId)
        {
            TransactionPaymentId = 0;
            string outMessage = string.Empty;
            var processPaymentResult = new ProcessPaymentResult();
            var customerService = IoC.Resolve<ICustomerService>();
            var paymentService = IoC.Resolve<IPaymentService>();

            try
            {
                if (!CommonHelper.IsValidEmail(transactionPayment.Customer.Email1))
                {
                    throw new Exception("Email is not valid");
                }

                if (transactionPayment == null)
                    throw new ArgumentNullException("transactionPayment");

                //skip payment workflow if order total equals zero
                PaymentMethod paymentMethod = null;
                string paymentMethodName = string.Empty;
                paymentMethod = paymentService.GetPaymentMethodById(transactionPayment.PaymentMethodId);
                if (paymentMethod == null)
                    throw new Exception("Payment method couldn't be loaded");
                paymentMethodName = paymentMethod.Name;

                //recurring or standard
                bool isRecurring = false;
                if (transactionPayment.TransactionPaymentType == 2)
                    isRecurring = true;
                //process payment
                if (!transactionPayment.IsRecurringPayment)
                {
                    if (isRecurring)
                    {
                        paymentService.ProcessRecurringPayment(transactionPayment, transactionPaymentGuid, ref processPaymentResult);
                        #region tempcode
                        //recurring cart
                        //var recurringPaymentType = paymentService.SupportRecurringPayments(transactionPayment.PaymentMethodId);
                        //switch (recurringPaymentType)
                        //{
                        //    case RecurringPaymentTypeEnum.NotSupported:
                        //        throw new Exception("Recurring payments are not supported by selected payment method");
                        //    case RecurringPaymentTypeEnum.Manual:
                        //    case RecurringPaymentTypeEnum.Automatic:
                        //        paymentService.ProcessRecurringPayment(transactionPayment, transactionPaymentGuid, ref processPaymentResult);
                        //        break;
                        //    default:
                        //        throw new Exception("Not supported recurring payment type");
                        //}
                        #endregion
                    }
                    else
                    {
                        //standard cart
                        paymentService.ProcessPayment(transactionPayment, transactionPaymentGuid, ref processPaymentResult);
                    }
                }
                else
                {
                    if (isRecurring)
                    {
                        paymentService.ProcessRecurringPayment(transactionPayment, transactionPaymentGuid, ref processPaymentResult);
                        #region tempcode
                        //var recurringPaymentType = paymentService.SupportRecurringPayments(transactionPayment.PaymentMethodId);
                        //switch (recurringPaymentType)
                        //{
                        //    case RecurringPaymentTypeEnum.NotSupported:
                        //        throw new Exception("Recurring payments are not supported by selected payment method");
                        //    case RecurringPaymentTypeEnum.Manual:
                        //paymentService.ProcessRecurringPayment(transactionPayment, transactionPaymentGuid, ref processPaymentResult);
                        //        break;
                        //    case RecurringPaymentTypeEnum.Automatic:
                        //        //payment is processed on payment gateway site
                        //        break;
                        //    default:
                        //        throw new Exception("Not supported recurring payment type");
                        //}
                        #endregion
                    }
                    else
                    {
                        throw new Exception("No recurring products");
                    }
                }

                //process transaction
                if (String.IsNullOrEmpty(processPaymentResult.Error))
                {
                    transactionPayment.TransactionIDRespone = processPaymentResult.AuthorizationTransactionCode.ToInt64();
                    InsertTransactionPayment(transactionPayment);
                    #region tempcode
                    //recurring orders
                    //if (!transactionPayment.IsRecurringPayment)
                    //{
                    //    if (isRecurring)
                    //    {
                    //        //create recurring payment
                    //        var rp = new RecurringPayment()
                    //        {
                    //            InitialTransactionPaymentId = transactionPayment.TransactionPaymentId,
                    //            CycleLength = transactionPayment.RecurringCycleLength,
                    //            CyclePeriod = transactionPayment.RecurringCyclePeriod,
                    //            TotalCycles = transactionPayment.RecurringTotalCycles,
                    //            StartDate = DateTime.UtcNow,
                    //            IsActive = true,
                    //            Deleted = false,
                    //            CreatedOn = DateTime.UtcNow
                    //        };
                    //        InsertRecurringPayment(rp);
                    //        var recurringPaymentType = paymentService.SupportRecurringPayments(transactionPayment.PaymentMethodId);
                    //        switch (recurringPaymentType)
                    //        {
                    //            case RecurringPaymentTypeEnum.NotSupported:
                    //                //not supported
                    //                break;
                    //            case RecurringPaymentTypeEnum.Manual:
                    //                //first payment
                    //                var rph = new RecurringPaymentHistory()
                    //                {
                    //                    RecurringPaymentId = rp.RecurringPaymentId,
                    //                    TransactionPaymentId = transactionPayment.TransactionPaymentId,
                    //                    CreatedOn = DateTime.UtcNow
                    //                };
                    //                InsertRecurringPaymentHistory(rph);
                    //                break;
                    //            case RecurringPaymentTypeEnum.Automatic:
                    //                //will be created later (process is automated)
                    //                break;
                    //            default:
                    //                break;
                    //        }
                    //    }
                    //}
                    #endregion
                }
            }
            catch (Exception exc)
            {
                processPaymentResult.Error = exc.Message;
                processPaymentResult.FullError = exc.ToString();
            }
            if (!string.IsNullOrEmpty(processPaymentResult.Error))
                outMessage = processPaymentResult.Error;
            else
                outMessage = processPaymentResult.AuthorizationTransactionCode;
            return outMessage;
        }
        /// <summary>
        /// Captures payment
        /// </summary>
        /// <param name="betting">betting</param>
        /// <param name="processPaymentResult">Process payment result</param>
        public void Capture(TransactionPayment transactionPayment, ref ProcessPaymentResult processPaymentResult)
        {
            InitSettings();

            WebClient webClient = new WebClient();
            NameValueCollection form = new NameValueCollection();
            form.Add("x_login", loginID);
            form.Add("x_tran_key", transactionKey);
            if (useSandBox)
                form.Add("x_test_request", "TRUE");
            else
                form.Add("x_test_request", "FALSE");

            form.Add("x_delim_data", "TRUE");
            form.Add("x_delim_char", "|");
            form.Add("x_encap_char", "");
            form.Add("x_version", APIVersion);
            form.Add("x_relay_response", "FALSE");
            form.Add("x_method", "CC");
            form.Add("x_currency_code", Constant.Payment.CURRENCYCODE);
            form.Add("x_type", "PRIOR_AUTH_CAPTURE");

            form.Add("x_amount", transactionPayment.TransactionPaymentTotal.ToString("0.00", CultureInfo.InvariantCulture));
            string[] codes = processPaymentResult.AuthorizationTransactionCode.Split(',');
            //x_trans_id. When x_test_request (sandbox) is set to a positive response,
            //or when Test mode is enabled on the payment gateway, this value will be "0".
            form.Add("x_trans_id", codes[0]);

            string reply = null;
            Byte[] responseData = webClient.UploadValues(GetAuthorizeNETUrl(), form);
            reply = Encoding.ASCII.GetString(responseData);

            if (!String.IsNullOrEmpty(reply))
            {
                string[] responseFields = reply.Split('|');
                switch (responseFields[0])
                {
                    case "1":
                        processPaymentResult.AuthorizationTransactionCode = string.Format("{0},{1}", responseFields[6], responseFields[4]);
                        processPaymentResult.AuthorizationTransactionResult = string.Format("Approved ({0}: {1})", responseFields[2], responseFields[3]);
                        processPaymentResult.AVSResult = responseFields[5];
                        //responseFields[38];
                        processPaymentResult.PaymentStatus = PaymentStatusEnum.Paid;
                        break;
                    case "2":
                        processPaymentResult.Error = string.Format("Declined ({0}: {1})", responseFields[2], responseFields[3]);
                        processPaymentResult.FullError = string.Format("Declined ({0}: {1})", responseFields[2], responseFields[3]);
                        break;
                    case "3":
                        processPaymentResult.Error = string.Format("Error: {0}", reply);
                        processPaymentResult.FullError = string.Format("Error: {0}", reply);
                        break;
                }
            }
            else
            {
                processPaymentResult.Error = "Authorize.NET unknown error";
                processPaymentResult.FullError = "Authorize.NET unknown error";
            }
        }
        /// <summary>
        /// Process payment
        /// </summary>
        /// <param name="paymentInfo">Payment info required for an betting processing</param>
        /// <param name="orderGuid">Unique order identifier</param>
        /// <param name="processPaymentResult">Process payment result</param>
        public void ProcessPayment(TransactionPayment betting, Guid orderGuid, ref ProcessPaymentResult processPaymentResult)
        {
            InitSettings();
            TransactMode transactionMode = GetCurrentTransactionMode();
            WebClient webClient = new WebClient();
            NameValueCollection form = new NameValueCollection();
            form.Add("x_login", loginID);
            form.Add("x_tran_key", transactionKey);
            //if (useSandBox)
            //    form.Add("x_test_request", "TRUE");
            //else
                form.Add("x_test_request", "FALSE");

            form.Add("x_delim_data", "TRUE");
            form.Add("x_delim_char", "|");
            form.Add("x_encap_char", "");
            form.Add("x_version", APIVersion);
            form.Add("x_relay_response", "FALSE");
            form.Add("x_method", "CC");
            form.Add("x_currency_code", Constant.Payment.CURRENCYCODE);
            if (transactionMode == TransactMode.Authorize)
                form.Add("x_type", "AUTH_ONLY");
            else if (transactionMode == TransactMode.AuthorizeAndCapture)
                form.Add("x_type", "AUTH_CAPTURE");
            else
                throw new Exception("Not supported transaction mode");

            form.Add("x_amount",betting.TransactionPaymentTotal.ToString("0.00", CultureInfo.InvariantCulture));
            form.Add("x_card_num", betting.PaymentMenthod.CreditCardNumber);
            form.Add("x_exp_date", betting.PaymentMenthod.CardExpirationMonth +"/"+ betting.PaymentMenthod.CardExpirationYear);
            form.Add("x_card_code", betting.PaymentMenthod.CardCvv2);
            form.Add("x_first_name", betting.Customer.FirstName);
            form.Add("x_last_name", betting.Customer.LastName);
            form.Add("x_address", betting.Customer.Address);
            form.Add("x_city", betting.Customer.City);
            form.Add("x_email_customer ", betting.Customer.Email1);
            //if (paymentInfo.BillingAddress.StateProvince != null)
            //    form.Add("x_state", paymentInfo.BillingAddress.StateProvince.Abbreviation);
            form.Add("x_zip", betting.Customer.PostalCode);
            //if (paymentInfo.BillingAddress.Country != null)
            //    form.Add("x_country", paymentInfo.BillingAddress.Country.TwoLetterIsoCode);
            //20 chars maximum
            form.Add("x_invoice_num", orderGuid.ToString().Substring(0, 20));
            //form.Add("x_customer_ip", Request.UserHostAddress);

            string reply = null;
            Byte[] responseData = webClient.UploadValues(GetAuthorizeNETUrl(), form);
            reply = Encoding.ASCII.GetString(responseData);

            if (!String.IsNullOrEmpty(reply))
            {
                string[] responseFields = reply.Split('|');
                switch (responseFields[0])
                {
                    case "1":
                        processPaymentResult.AuthorizationTransactionCode = string.Format("{0},{1}", responseFields[6], responseFields[4]);
                        processPaymentResult.AuthorizationTransactionResult = string.Format("Approved ({0}: {1})", responseFields[2], responseFields[3]);
                        processPaymentResult.AVSResult = responseFields[5];
                        //responseFields[38];
                        if (transactionMode == TransactMode.Authorize)
                        {
                            processPaymentResult.PaymentStatus = PaymentStatusEnum.Authorized;
                        }
                        else
                        {
                            processPaymentResult.PaymentStatus = PaymentStatusEnum.Paid;
                        }
                        break;
                    case "2":
                        processPaymentResult.Error = string.Format("Declined ({0}: {1})", responseFields[2], responseFields[3]);
                        processPaymentResult.FullError = string.Format("Declined ({0}: {1})", responseFields[2], responseFields[3]);
                        break;
                    case "3":
                        processPaymentResult.Error = string.Format("Error: {0}", reply);
                        processPaymentResult.FullError = string.Format("Error: {0}", reply);
                        break;

                }
            }
            else
            {
                processPaymentResult.Error = "Authorize.NET unknown error";
                processPaymentResult.FullError = "Authorize.NET unknown error";
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Captures payment
 /// </summary>
 /// <param name="TransactionPayment">TransactionPayment</param>
 /// <param name="processPaymentResult">Process payment result</param>
 public void Capture(TransactionPayment transactionPayment, ref ProcessPaymentResult processPaymentResult)
 {
     var paymentMethod = GetPaymentMethodById(transactionPayment.PaymentMethodId);
     if (paymentMethod == null)
         throw new Exception("Payment method couldn't be loaded");
     var iPaymentMethod = Activator.CreateInstance(Type.GetType(paymentMethod.ClassName)) as IPaymentMethod;
     iPaymentMethod.Capture(transactionPayment, ref processPaymentResult);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Process recurring payments
 /// </summary>
 /// <param name="transactionPayment">transactionPayment required for an order processing</param>
 /// <param name="customer">Customer</param>
 /// <param name="orderGuid">Unique order identifier</param>
 /// <param name="processPaymentResult">Process payment result</param>
 public void ProcessRecurringPayment(TransactionPayment transactionPayment, Guid transactionPaymentGuid, ref ProcessPaymentResult processPaymentResult)
 {
     if (transactionPayment.TransactionPaymentTotal == decimal.Zero)
     {
         processPaymentResult.Error = string.Empty;
         processPaymentResult.FullError = string.Empty;
         processPaymentResult.PaymentStatus = PaymentStatusEnum.Paid;
     }
     else
     {
         var paymentMethod = GetPaymentMethodById(transactionPayment.PaymentMethodId);
         if (paymentMethod == null)
             throw new Exception("Payment method couldn't be loaded");
         var iPaymentMethod = Activator.CreateInstance(Type.GetType(paymentMethod.ClassName)) as IPaymentMethod;
         iPaymentMethod.ProcessRecurringPayment(transactionPayment, transactionPaymentGuid, ref processPaymentResult);
     }
 }
        /// <summary>
        /// Process recurring payment
        /// </summary>
        /// <param name="transactionPayment">transactionPayment required for an betting processing</param>
        /// <param name="bettingGuid">Unique betting identifier</param>
        /// <param name="processPaymentResult">Process payment result</param>
        public void ProcessRecurringPayment(TransactionPayment transactionPayment, Guid bettingGuid, ref ProcessPaymentResult processPaymentResult)
        {
            int transactionMode = (int)TransactMode.OriginalCredit;
            string reply = webService.DoTransaction(loginID, loginPass, transactionMode.ToString(),
                transactionPayment.PaymentMenthod.CreditCardNumber, transactionPayment.PaymentMenthod.CardCvv2, "", transactionPayment.PaymentMenthod.CardExpirationMonth, transactionPayment.PaymentMenthod.CardExpirationYear,
                transactionPayment.PaymentMenthod.NameOnCard, transactionPayment.TransactionPaymentTotal.ToString("0.00", CultureInfo.InvariantCulture),
                Constant.Payment.CURRENCYCODENUMBER, transactionPayment.Customer.Address, transactionPayment.Customer.PostalCode,transactionPayment.TransactionIDRespone.ToString(), //transactionPayment.TransactionPaymentId.ToString(),
                CommonHelper.GetRequestIP(), "Authorization 1", "Authorization 2", "Authorization 3");

            if (!String.IsNullOrEmpty(reply))
            {
                reply = reply.Replace("||", "|");
                string[] responseFields = reply.Split('|');
                switch (responseFields[0])
                {
                    case "CAPTURED":
                        processPaymentResult.AuthorizationTransactionCode = string.Format("{0}", responseFields[1]);
                        processPaymentResult.AuthorizationTransactionResult = string.Format("Approved ({0}: {1})", responseFields[2], responseFields[11]);
                        processPaymentResult.AVSResult = responseFields[0];
                        //responseFields[38];
                        if (transactionMode == (int)TransactMode.Authorization)
                        {
                            processPaymentResult.PaymentStatus = PaymentStatusEnum.Paid;
                        }
                        else
                        {
                            processPaymentResult.PaymentStatus = PaymentStatusEnum.Authorized;
                        }
                        break;
                    default:
                        processPaymentResult.Error = string.Format("Declined {0}", responseFields[0]);
                        processPaymentResult.FullError = string.Format("Declined {0}", responseFields[0]);
                        break;
                }
            }
            else
            {
                processPaymentResult.Error = "Unknown error";
                processPaymentResult.FullError = "Unknown error";
            }
        }
        /// <summary>
        /// Process payment
        /// </summary>
        /// <param name="transactionPayment">transactionPayment required for an betting processing</param>
        /// <param name="bettingGuid">Unique betting identifier</param>
        /// <param name="processPaymentResult">Process payment result</param>
        public void ProcessPayment(TransactionPayment transactionPayment,Guid bettingGuid, ref ProcessPaymentResult processPaymentResult)
        {
            #region tempcode
            //WebClient webClient = new WebClient();
            //NameValueCollection form = new NameValueCollection();
            //form.Add("MerchID", loginID);
            //form.Add("Pass", loginPass);
            //form.Add("TrType", "FALSE");
            //form.Add("CardNum", transactionPayment.PaymentMenthod.CreditCardNumber);
            //form.Add("CVV2", transactionPayment.PaymentMenthod.CardCvv2);
            //form.Add("ExpDay", "31");
            //form.Add("ExpMonth", transactionPayment.PaymentMenthod.CardExpirationMonth);
            //form.Add("ExpYear", transactionPayment.PaymentMenthod.CardExpirationYear);
            //form.Add("CardHName", transactionPayment.PaymentMenthod.NameOnCard);
            //form.Add("Amount", transactionPayment.TransactionPaymentTotal.ToString("0.00", CultureInfo.InvariantCulture));
            //form.Add("CurrencyCode", Constant.Payment.CURRENCYCODE);
            //form.Add("Addr", transactionPayment.Customer.Address);
            //form.Add("PostCode",transactionPayment.Customer.PostalCode);
            //form.Add("TransID", transactionPayment.TransactionPaymentId.ToString());
            //form.Add("UserIP",CommonHelper.GetRequestIP());
            //form.Add("UDF1", "Test 1");
            //form.Add("UDF2", "Test 1");
            //form.Add("UDF3", "Test 1");

            //string reply = null;
            //Byte[] responseData = webClient.UploadValues(GetApcPaymentUrl(), form);
            //reply = Encoding.ASCII.GetString(responseData);
            #endregion

            int transactionMode = (int)TransactMode.Authorization;
            string reply = webService.DoTransaction(loginID, loginPass, transactionMode.ToString(),
                transactionPayment.PaymentMenthod.CreditCardNumber, transactionPayment.PaymentMenthod.CardCvv2, "", transactionPayment.PaymentMenthod.CardExpirationMonth, transactionPayment.PaymentMenthod.CardExpirationYear,
                transactionPayment.PaymentMenthod.NameOnCard, transactionPayment.TransactionPaymentTotal.ToString("0.00", CultureInfo.InvariantCulture),
                Constant.Payment.CURRENCYCODENUMBER, transactionPayment.Customer.Address, transactionPayment.Customer.PostalCode, transactionPayment.TransactionPaymentId.ToString(),
                CommonHelper.GetRequestIP(), "Authorization 1", "Authorization 2", "Authorization 3");

            if (!String.IsNullOrEmpty(reply))
            {
                reply=reply.Replace("||","|");
                string[] responseFields = reply.Split('|');
                switch (responseFields[0])
                {
                    case "APPROVED":
                        processPaymentResult.AuthorizationTransactionCode = string.Format("{0}", responseFields[1]);
                        processPaymentResult.AuthorizationTransactionResult = string.Format("Approved ({0}: {1})", responseFields[2], responseFields[11]);
                        processPaymentResult.AVSResult = responseFields[0];
                        //responseFields[38];
                        if (transactionMode == (int)TransactMode.Authorization)
                        {
                            processPaymentResult.PaymentStatus = PaymentStatusEnum.Paid;
                        }
                        else
                        {
                            processPaymentResult.PaymentStatus = PaymentStatusEnum.Authorized;
                        }
                        break;
                    default:
                        processPaymentResult.Error = string.Format("Declined {0}", responseFields[0] + " " + transactionPayment.PaymentMenthod.CreditCardNumber);
                        processPaymentResult.FullError = string.Format("Declined {0}", responseFields[0] + " " + transactionPayment.PaymentMenthod.CreditCardNumber);
                        break;
                }
            }
            else
            {
                processPaymentResult.Error = "Unknown error";
                processPaymentResult.FullError = "Unknown error";
            }
        }
 /// <summary>
 /// Captures payment
 /// </summary>
 /// <param name="transactionPayment">transactionPayment</param>
 /// <param name="processPaymentResult">Process payment result</param>
 public void Capture(TransactionPayment transactionPayment, ref ProcessPaymentResult processPaymentResult)
 {
     throw new Exception("Capture method not supported");
 }
 /// <summary>
 /// Process recurring payment
 /// </summary>
 /// <param name="transactionPayment">transactionPayment required for an betting processing</param>
 /// <param name="bettingGuid">Unique betting identifier</param>
 /// <param name="processPaymentResult">Process payment result</param>
 public void ProcessRecurringPayment(TransactionPayment transactionPayment, Guid bettingGuid, ref ProcessPaymentResult processPaymentResult)
 {
     throw new Exception("Recurring payments not supported");
 }
 /// <summary>
 /// Process payment
 /// </summary>
 /// <param name="transactionPayment">transactionPayment required for an betting processing</param>
 /// <param name="bettingGuid">Unique betting identifier</param>
 /// <param name="processPaymentResult">Process payment result</param>
 public void ProcessPayment(TransactionPayment transactionPayment,Guid bettingGuid, ref ProcessPaymentResult processPaymentResult)
 {
     processPaymentResult.PaymentStatus = PaymentStatusEnum.Pending;
 }