Exemplo n.º 1
0
 /// <summary>
 /// Instantiates a new <see cref="MobilePayPaymentCaptureRequest"/> with the provided parameters.
 /// </summary>
 /// <param name="amount">The <seealso cref="Amount"/> to capture for this payment.</param>
 /// <param name="vatAmount">The <seealso cref="Amount"/> to capture as VAT for this payment.</param>
 /// <param name="description">A textual description of the purchase.</param>
 /// <param name="payeeReference">Transactionally unique reference for this payment, set by the merchant system.</param>
 public MobilePayPaymentCaptureRequest(Amount amount, Amount vatAmount, string description, string payeeReference)
 {
     Transaction = new CaptureTransaction(amount, vatAmount, description, payeeReference);
 }
Exemplo n.º 2
0
        public override void ProcessTransaction(Transaction t)
        {
            bool result = false;

            //'Get Configuration Settings
            string MerchantPartner = Settings.MerchantPartner;
            string MerchantLogin = Settings.MerchantLogin;
            string MerchantUser = Settings.MerchantUser;
            string MerchantPassword = Settings.MerchantPassword;
            string CurrencyCode = Settings.CurrencyCode;
            bool TestMode = Settings.TestMode;
            bool DebugMode = Settings.DeveloperMode;

            UserInfo User = new UserInfo(MerchantUser, MerchantLogin, MerchantPartner, MerchantPassword);
        

            //Set HostAddress URL
            string HostAddress = LiveUrl;
            if (TestMode) HostAddress = TestUrl;

            //Connection Info
            PayflowConnectionData Connection = new PayflowConnectionData(HostAddress, 443, 45); //', CertLocation)

            // *** Create a new Invoice data object ***
            // Set Invoice object with the Amount, Billing & Shipping Address, etc. ***
            Invoice Inv = new Invoice();

            // Set the amount object. A valid amount is a two decimal value.  An invalid amount will generate a result code                
            Currency Amt = new Currency(Decimal.Round(t.Amount, 2), CurrencyCode); //' 840 is US ISO currency code.  If no code passed, 840 is default.
            Inv.Amt = Amt;

            // Generate a unique transaction ID
            string strRequestID = PayflowUtility.RequestId + t.MerchantInvoiceNumber;

            //InvNum and CustRef are sent to the processors and could show up on a customers
            // or your bank statement. These fields are reportable but not searchable in PayPal Manager.

            Inv.InvNum = t.MerchantInvoiceNumber;
            Inv.CustRef = t.Customer.Email;

            //' Comment1 and Comment2 fields are searchable within PayPal Manager .
            Inv.Comment1 = "Order Number: " + Inv.InvNum;
            Inv.Comment2 = "Customer Email: " + t.Customer.Email;

            // Create the BillTo object.
            BillTo Bill = new BillTo();

            Bill.FirstName = t.Customer.FirstName;
            Bill.LastName = t.Customer.LastName;
            Bill.Street = t.Customer.Street;
            Bill.City = t.Customer.City;
            Bill.Zip = t.Customer.PostalCode;
            Bill.PhoneNum = t.Customer.Phone;
            Bill.Email = t.Customer.Email;
            Bill.State = t.Customer.Region;                        

            //' BillToCountry code is based on numeric ISO country codes. (e.g. 840 = USA)
            //Get Country Code
            string CountryCode = MerchantTribe.Web.Geography.Country.FindByName(t.Customer.Country).IsoNumeric;
            Bill.BillToCountry = CountryCode;
        
            // Set the BillTo object into invoice.
            Inv.BillTo = Bill;

            CustomerInfo CustInfo = new CustomerInfo();

            CustInfo.CustId = t.Customer.Email;
            CustInfo.CustIP = t.Customer.IpAddress;

            // *** Create a new Payment Device - Credit Card data object. ***
            // Note: Expiration date is in the format MMYY
            string CCExpDate = t.Card.ExpirationMonthPadded + t.Card.ExpirationYearTwoDigits;

            CreditCard CC = new CreditCard(t.Card.CardNumber, CCExpDate);

            //' *** Card Security Code ***
            //' This is the 3 or 4 digit code on either side of the Credit Card.
            if (t.Card.SecurityCode.Length > 0)
            {
                CC.Cvv2 = t.Card.SecurityCode;
            }

            // Name on Credit Card is optional.
            CC.Name = t.Card.CardHolderName;

            // *** Create a new Tender - Card Tender data object. ***
            CardTender Card = new CardTender(CC);

            // *** Create a new Transaction. ***
            // The Request Id is the unique id necessary for each transaction. 
            // If you pass a non-unique request id, you will receive the transaction details from the original request.

            //'DO TRANSACTION
            try
            {
                BaseTransaction Trans = null;

                switch(t.Action)
                {
                    case ActionType.CreditCardHold:
                        Trans = new AuthorizationTransaction(User,Connection, Inv, Card, strRequestID);
                        break;
                    case ActionType.CreditCardCharge:
                        Trans = new SaleTransaction(User,Connection, Inv, Card, strRequestID);
                        break;
                    case ActionType.CreditCardCapture:
                        Trans = new CaptureTransaction(t.PreviousTransactionNumber, User, Connection, Inv, strRequestID);
                        break;
                    case ActionType.CreditCardRefund:
                        Trans = new CreditTransaction(t.PreviousTransactionNumber, User, Connection, Inv, strRequestID);
                        break;
                    case ActionType.CreditCardVoid:
                       Trans = new VoidTransaction(t.PreviousTransactionNumber, User, Connection, strRequestID);
                        break;
                }

                int Result = 0;
                System.Globalization.CultureInfo currCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
                Response Resp = null;

                try
                {
                    System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
                    //' Submit the Transaction
                    Resp = Trans.SubmitTransaction();
                }
                finally
                {
                    System.Threading.Thread.CurrentThread.CurrentCulture = currCulture;
                }

                if (Resp != null)
                {
            
                    // Get the Transaction Response parameters.
                    TransactionResponse TrxnResponse = Resp.TransactionResponse;
                                
                    // RESULT codes returns.
                    if (TrxnResponse != null)
                    {

                        //Check for Approval (0 = approved, all else = Decline or Error)
                        Result = TrxnResponse.Result;
                        string RespMsg = TrxnResponse.RespMsg;

                        //if success then save our reference number
                        if (Result == 0)
                        {
                            t.Result.ReferenceNumber = TrxnResponse.Pnref;
                        }

                        t.Result.ResponseCode = TrxnResponse.AuthCode;

                        //Custom Properties
                        t.Result.AvsCode = AvsResponseType.Unavailable;
                        t.Result.AvsCodeDescription = "AVSADDR: " + TrxnResponse.AVSAddr + " AVSZIP: " + TrxnResponse.AVSZip + " IAVS: " + TrxnResponse.IAVS;
                        t.Result.ResponseCode = TrxnResponse.Result.ToString();
                        t.Result.CvvCode = CvnResponseType.Unavailable;
                        t.Result.CvvCodeDescription = TrxnResponse.CVV2Match;
                        t.Result.ResponseCodeDescription = TrxnResponse.RespMsg;
                        
                    }
                    else
                    {
                        t.Result.Messages.Add(new Message("Payment Error: Transaction Response is Null", "BVP_PFP_1003", MessageType.Error));
                    }

                    //Show Complete Response if Debug Mode
                    if (DebugMode)
                    {
                        t.Result.Messages.Add(new Message("PayflowPro Request:" + Trans.Request, "REQ", MessageType.Information));
                        t.Result.Messages.Add(new Message("PayflowPro Request:" + Trans.Response.ResponseString, "RES", MessageType.Information));

                        // Get the Transaction Context
                        Context TransCtx = Resp.TransactionContext;

                        if ((TransCtx != null) && (TransCtx.getErrorCount() > 0))
                        {
                            t.Result.Messages.Add(new Message("PayflowPro Context:" + TransCtx.ToString(), "CTX", MessageType.Information));
                        }
                    }

                    if (Result == 0)
                    {
                        result = true;
                    }
                    else
                    {
                        result = false;
                    }
                }
                else
                {
                    t.Result.Messages.Add(new Message("Payment Error: Response is Null", "BVP_PFP_1002", MessageType.Error));
                }
            }
            catch(Exception ex)
            {
                result = false;
                t.Result.Messages.Add(new Message("Payment Error: " + ex.Message, "BVP_PFP_1001", MessageType.Error));
                t.Result.Messages.Add(new Message("Stack Trace " + ex.StackTrace, "STACKTRACE", MessageType.Error));
            }
            
            t.Result.Succeeded = result;                     
        }
Exemplo n.º 3
0
        public static void Main(string[] Args)
        {
            Console.WriteLine("------------------------------------------------------");
            Console.WriteLine("Executing Sample from File: DOCapture.cs");
            Console.WriteLine("------------------------------------------------------");

            // Create the Data Objects.
            // Create the User data object with the required user details.
            UserInfo User = new UserInfo("<user>", "<vendor>", "<partner>", "<password>");

            // Create the Payflow  Connection data object with the required connection details.
            // The PAYFLOW_HOST property is defined in the App config file.
            PayflowConnectionData Connection = new PayflowConnectionData();
            ///////////////////////////////////////////////////////////////////

            // If you want to change the amount being captured, you'll need to set the Amount object.
            // Invoice Inv = new Invoice();
            // Set the amount object if you want to change the amount from the original authorization.
            // Currency Code USD is US ISO currency code.  If no code passed, USD is default.
            // See the Developer//s Guide for the list of three-character currency codes available.
            // Currency Amt = new Currency(new decimal(25.12));
            // Inv.Amt = Amt;
            // CaptureTransaction Trans = new CaptureTransaction("<ORIGINAL_PNREF>", User, Connection, Inv, PayflowUtility.RequestId);

            // Create a new Capture Transaction for the original amount of the authorization.  See above if you
            // need to change the amount.
            CaptureTransaction Trans = new CaptureTransaction("<ORIGINAL_PNREF>", User, Connection, PayflowUtility.RequestId);

            // Indicates if this Delayed Capture transaction is the last capture you intend to make.
            // The values are: Y (default) / N
            // NOTE: If CAPTURECOMPLETE is Y, any remaining amount of the original reauthorized transaction
            // is automatically voided.  Also, this is only used for UK and US accounts where PayPal is acting
            // as your bank.
            // Trans.CaptureComplete = "N";

            // Set the transaction verbosity to HIGH to display most details.
            Trans.Verbosity = "HIGH";

            // Submit the Transaction
            Response Resp = Trans.SubmitTransaction();

            // Display the transaction response parameters.
            if (Resp != null)
            {
                // Get the Transaction Response parameters.
                TransactionResponse TrxnResponse = Resp.TransactionResponse;

                if (TrxnResponse != null)
                {
                    Console.WriteLine("RESULT = " + TrxnResponse.Result);
                    Console.WriteLine("PNREF = " + TrxnResponse.Pnref);
                    Console.WriteLine("RESPMSG = " + TrxnResponse.RespMsg);
                    Console.WriteLine("AUTHCODE = " + TrxnResponse.AuthCode);
                    Console.WriteLine("AVSADDR = " + TrxnResponse.AVSAddr);
                    Console.WriteLine("AVSZIP = " + TrxnResponse.AVSZip);
                    Console.WriteLine("IAVS = " + TrxnResponse.IAVS);
                    // If value is true, then the Request ID has not been changed and the original response
                    // of the original transction is returned.
                    Console.WriteLine("DUPLICATE = " + TrxnResponse.Duplicate);
                }

                // Get the Fraud Response parameters.
                FraudResponse FraudResp = Resp.FraudResponse;

                // Display Fraud Response parameter
                if (FraudResp != null)
                {
                    Console.WriteLine("PREFPSMSG = " + FraudResp.PreFpsMsg);
                    Console.WriteLine("POSTFPSMSG = " + FraudResp.PostFpsMsg);
                }

                // Display the response.
                Console.WriteLine(Environment.NewLine + PayflowUtility.GetStatus(Resp));

                // Get the Transaction Context and check for any contained SDK specific errors (optional code).
                Context TransCtx = Resp.TransactionContext;
                if (TransCtx != null && TransCtx.getErrorCount() > 0)
                {
                    Console.WriteLine(Environment.NewLine + "Transaction Errors = " + TransCtx.ToString());
                }
            }
            Console.WriteLine("Press Enter to Exit ...");
            Console.ReadLine();
        }
        /// <summary>
        /// Captures payment
        /// </summary>
        /// <param name="capturePaymentRequest">Capture payment request</param>
        /// <returns>Capture payment result</returns>
        public CapturePaymentResult Capture(CapturePaymentRequest capturePaymentRequest)
        {
            var result = new CapturePaymentResult();

            // Check license
            bool isLicensed = this._licenseService.IsLicensed(HttpContext.Current.Request.Url.Host);
            if (!isLicensed && capturePaymentRequest.Order.OrderTotal > 5.00M)
            {
                result.AddError("The trial license can be used to submit order of $5.00 or less. Please purchase a full license at our website.");
                return result;
            }

            string authorizationId = capturePaymentRequest.Order.AuthorizationTransactionId;

            // Create the Payflow Data Objects.
            // Create the User data object with the required user details.
            UserInfo payflowUser = _payPalHelper.GetUserInfo();

            // Create the Payflow Connection data object with the required connection details.            
            PayflowConnectionData payflowConn = new PayflowConnectionData(_payPalHelper.GetPayflowProHost());
                        
            CaptureTransaction trans = new CaptureTransaction(authorizationId, payflowUser, payflowConn, PayflowUtility.RequestId);
            Response resp = trans.SubmitTransaction();
                        
            // Process the Payflow response.
            if (resp != null)
            {
                // Get the Transaction Response parameters.
                TransactionResponse trxResp = resp.TransactionResponse;
                if (trxResp != null)
                {
                    if (trxResp.Result == 0)
                    {
                        result.NewPaymentStatus = PaymentStatus.Paid;
                        result.CaptureTransactionId = trxResp.Pnref;
                        result.CaptureTransactionResult = trxResp.RespMsg;
                    }
                    else
                    {
                        result.AddError(string.Format("Capture RESULT: {0}-{1}", trxResp.Result, trxResp.RespMsg));
                    }
                }
            }
                                    
            return result;
        }
Exemplo n.º 5
0
        public static void Main(string[] Args)
        {
            Console.WriteLine("---------------------------------------------------------");
            Console.WriteLine("Executing Sample from File: DO_TeleCheck.cs");
            Console.WriteLine("---------------------------------------------------------");

            // Create the Data Objects.
            // Create the User data object with the required user details.
            UserInfo User = new UserInfo("<user>", "<vendor>", "<partner>", "<password>");

            // Create the Payflow  Connection data object with the required connection details.
            // The PAYFLOW_HOST property is defined in the App config file.
            PayflowConnectionData Connection = new PayflowConnectionData();

            // Create a new Invoice data object with the Amount, Billing Address etc. details.
            Invoice Inv = new Invoice();

            // Set Amount.
            Currency Amt = new Currency(new decimal(25.12));

            Inv.Amt    = Amt;
            Inv.PoNum  = "PO12345";
            Inv.InvNum = "INV12345";

            // Set the Billing Address details.
            BillTo Bill = new BillTo();

            Bill.BillToStreet  = "123 Main St.";
            Bill.BillToZip     = "12345";
            Bill.BillToCity    = "New York";
            Bill.BillToState   = "PA";
            Bill.BillToZip     = "12345";
            Bill.BillToPhone   = "123-4546-7890";
            Bill.BillToEmail   = "*****@*****.**";
            Bill.BillToCountry = "US";
            Inv.BillTo         = Bill;

            // Set the IP address of the customer
            CustomerInfo custInfo = new CustomerInfo();

            custInfo.CustIP  = "111.111.11.111";
            Inv.CustomerInfo = custInfo;

            // Create a new Payment Device - Check Payment data object.
            // The input parameters is MICR. Magnetic Ink Check Reader. This is the entire line
            // of numbers at the bottom of all checks. It includes the transit number, account
            // number, and check number.
            CheckPayment ChkPayment = new CheckPayment("1234567804390850001234");

            // Name property needs to be set for the Check Payment.
            ChkPayment.Name = "Ivan Smith";
            // Create a new Tender - Check Tender data object.
            CheckTender ChkTender = new CheckTender(ChkPayment);

            // Account holder’s next unused (available) check number. Up to 7 characters.
            ChkTender.ChkNum = "1234";
            // DL or SS is required for a TeleCheck transaction.
            // If CHKTYPE=P, a value for either DL or SS must be passed as an identifier.
            // If CHKTYPE=C, the Federal Tax ID must be passed as the SS value.
            ChkTender.ChkType = "P";
            // Driver’s License number. If CHKTYPE=P, a value for either DL or SS must be passed as an identifier.
            // Format: XXnnnnnnnn
            // XX = State Code, nnnnnnnn = DL Number - up to 31 characters.
            ChkTender.DL = "CAN85452345";
            // Social Security number.  Needed if ChkType = P
            ChkTender.SS = "456765833";
            // AuthType = I-Internet Check, P-Checks by Phone, D-Prearranged Deposit
            ChkTender.AuthType = "I";

            // Create a new TeleCheck - Authorization Transaction.
            AuthorizationTransaction Trans = new AuthorizationTransaction(
                User, Connection, Inv, ChkTender, PayflowUtility.RequestId);

            //Want VERBOSITY=HIGH to get all the response values back.
            Trans.Verbosity = "HIGH";

            // Submit the Transaction
            Response Resp = Trans.SubmitTransaction();

            // Display the transaction response parameters.
            if (Resp != null)
            {
                // Get the Transaction Response parameters.
                TransactionResponse TrxnResponse = Resp.TransactionResponse;
                if (TrxnResponse != null)
                {
                    Console.WriteLine("RESULT = " + TrxnResponse.Result);
                    Console.WriteLine("PNREF = " + TrxnResponse.Pnref);
                    Console.WriteLine("RESPMSG = " + TrxnResponse.RespMsg);
                    Console.WriteLine("AUTHCODE = " + TrxnResponse.AuthCode);
                    Console.WriteLine("HOSTCODE = " + TrxnResponse.HostCode);
                    Console.WriteLine("TRACEID = " + TrxnResponse.TraceId);
                    Console.WriteLine("ACHSTATUS = " + TrxnResponse.AchStatus);
                }
                // Display the response.
                Console.WriteLine(PayflowUtility.GetStatus(Resp) + Environment.NewLine);
                // Get the Transaction Context and check for any contained SDK specific errors (optional code).
                Context TransCtx = Resp.TransactionContext;
                if (TransCtx != null && TransCtx.getErrorCount() > 0)
                {
                    Console.WriteLine("Transaction Errors = " + TransCtx.ToString() + Environment.NewLine);
                }
                if (TrxnResponse.Result == 0)
                {
                    // Transaction approved, display acceptance verbiage, after consumer accepts, capture the
                    // transaction to finalize it.
                    CaptureTransaction capTrans = new CaptureTransaction(TrxnResponse.Pnref, User, Connection, null, ChkTender, PayflowUtility.RequestId);
                    // Set the transaction verbosity to HIGH to display most details.
                    capTrans.Verbosity = "HIGH";

                    // Submit the Transaction
                    Response capResp = capTrans.SubmitTransaction();

                    // Display the transaction response parameters.
                    if (capResp != null)
                    {
                        // Get the Transaction Response parameters.
                        TransactionResponse capTrxnResponse = capResp.TransactionResponse;
                        if (capTrxnResponse != null)
                        {
                            Console.WriteLine("RESULT = " + capTrxnResponse.Result);
                            Console.WriteLine("PNREF = " + capTrxnResponse.Pnref);
                            Console.WriteLine("RESPMSG = " + capTrxnResponse.RespMsg);
                            Console.WriteLine("HOSTCODE = " + capTrxnResponse.HostCode);
                            Console.WriteLine("TRACEID = " + capTrxnResponse.TraceId);
                        }
                        // Display the response.
                        Console.WriteLine(PayflowUtility.GetStatus(capResp) + Environment.NewLine);
                        // Get the Transaction Context and check for any contained SDK specific errors (optional code).
                        Context capTransCtx = capResp.TransactionContext;
                        if (capTransCtx != null && capTransCtx.getErrorCount() > 0)
                        {
                            Console.WriteLine("Transaction Errors = " + capTransCtx.ToString() + Environment.NewLine);
                        }
                    }
                    else
                    {
                        Console.WriteLine("Unable to capture transaction as it declined or failed." + Environment.NewLine);
                    }
                }
            }
            Console.WriteLine("Press Enter to Exit ...");
            Console.ReadLine();
        }
Exemplo n.º 6
0
        public override void ProcessTransaction(Transaction t)
        {
            bool result = false;

            //'Get Configuration Settings
            string MerchantPartner  = Settings.MerchantPartner;
            string MerchantLogin    = Settings.MerchantLogin;
            string MerchantUser     = Settings.MerchantUser;
            string MerchantPassword = Settings.MerchantPassword;
            string CurrencyCode     = Settings.CurrencyCode;
            bool   TestMode         = Settings.TestMode;
            bool   DebugMode        = Settings.DeveloperMode;

            UserInfo User = new UserInfo(MerchantUser, MerchantLogin, MerchantPartner, MerchantPassword);


            //Set HostAddress URL
            string HostAddress = LiveUrl;

            if (TestMode)
            {
                HostAddress = TestUrl;
            }

            //Connection Info
            PayflowConnectionData Connection = new PayflowConnectionData(HostAddress, 443, 45); //', CertLocation)

            // *** Create a new Invoice data object ***
            // Set Invoice object with the Amount, Billing & Shipping Address, etc. ***
            Invoice Inv = new Invoice();

            // Set the amount object. A valid amount is a two decimal value.  An invalid amount will generate a result code
            Currency Amt = new Currency(Decimal.Round(t.Amount, 2), CurrencyCode); //' 840 is US ISO currency code.  If no code passed, 840 is default.

            Inv.Amt = Amt;

            // Generate a unique transaction ID
            string strRequestID = PayflowUtility.RequestId + t.MerchantInvoiceNumber;

            //InvNum and CustRef are sent to the processors and could show up on a customers
            // or your bank statement. These fields are reportable but not searchable in PayPal Manager.

            Inv.InvNum  = t.MerchantInvoiceNumber;
            Inv.CustRef = t.Customer.Email;

            //' Comment1 and Comment2 fields are searchable within PayPal Manager .
            Inv.Comment1 = "Order Number: " + Inv.InvNum;
            Inv.Comment2 = "Customer Email: " + t.Customer.Email;

            // Create the BillTo object.
            BillTo Bill = new BillTo();

            Bill.FirstName = t.Customer.FirstName;
            Bill.LastName  = t.Customer.LastName;
            Bill.Street    = t.Customer.Street;
            Bill.City      = t.Customer.City;
            Bill.Zip       = t.Customer.PostalCode;
            Bill.PhoneNum  = t.Customer.Phone;
            Bill.Email     = t.Customer.Email;
            Bill.State     = t.Customer.Region;

            //' BillToCountry code is based on numeric ISO country codes. (e.g. 840 = USA)
            //Get Country Code
            string CountryCode = MerchantTribe.Web.Geography.Country.FindByName(t.Customer.Country).IsoNumeric;

            Bill.BillToCountry = CountryCode;

            // Set the BillTo object into invoice.
            Inv.BillTo = Bill;

            CustomerInfo CustInfo = new CustomerInfo();

            CustInfo.CustId = t.Customer.Email;
            CustInfo.CustIP = t.Customer.IpAddress;

            // *** Create a new Payment Device - Credit Card data object. ***
            // Note: Expiration date is in the format MMYY
            string CCExpDate = t.Card.ExpirationMonthPadded + t.Card.ExpirationYearTwoDigits;

            CreditCard CC = new CreditCard(t.Card.CardNumber, CCExpDate);

            //' *** Card Security Code ***
            //' This is the 3 or 4 digit code on either side of the Credit Card.
            if (t.Card.SecurityCode.Length > 0)
            {
                CC.Cvv2 = t.Card.SecurityCode;
            }

            // Name on Credit Card is optional.
            CC.Name = t.Card.CardHolderName;

            // *** Create a new Tender - Card Tender data object. ***
            CardTender Card = new CardTender(CC);

            // *** Create a new Transaction. ***
            // The Request Id is the unique id necessary for each transaction.
            // If you pass a non-unique request id, you will receive the transaction details from the original request.

            //'DO TRANSACTION
            try
            {
                BaseTransaction Trans = null;

                switch (t.Action)
                {
                case ActionType.CreditCardHold:
                    Trans = new AuthorizationTransaction(User, Connection, Inv, Card, strRequestID);
                    break;

                case ActionType.CreditCardCharge:
                    Trans = new SaleTransaction(User, Connection, Inv, Card, strRequestID);
                    break;

                case ActionType.CreditCardCapture:
                    Trans = new CaptureTransaction(t.PreviousTransactionNumber, User, Connection, Inv, strRequestID);
                    break;

                case ActionType.CreditCardRefund:
                    Trans = new CreditTransaction(t.PreviousTransactionNumber, User, Connection, Inv, strRequestID);
                    break;

                case ActionType.CreditCardVoid:
                    Trans = new VoidTransaction(t.PreviousTransactionNumber, User, Connection, strRequestID);
                    break;
                }

                int Result = 0;
                System.Globalization.CultureInfo currCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
                Response Resp = null;

                try
                {
                    System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
                    //' Submit the Transaction
                    Resp = Trans.SubmitTransaction();
                }
                finally
                {
                    System.Threading.Thread.CurrentThread.CurrentCulture = currCulture;
                }

                if (Resp != null)
                {
                    // Get the Transaction Response parameters.
                    TransactionResponse TrxnResponse = Resp.TransactionResponse;

                    // RESULT codes returns.
                    if (TrxnResponse != null)
                    {
                        //Check for Approval (0 = approved, all else = Decline or Error)
                        Result = TrxnResponse.Result;
                        string RespMsg = TrxnResponse.RespMsg;

                        //if success then save our reference number
                        if (Result == 0)
                        {
                            t.Result.ReferenceNumber = TrxnResponse.Pnref;
                        }

                        t.Result.ResponseCode = TrxnResponse.AuthCode;

                        //Custom Properties
                        t.Result.AvsCode                 = AvsResponseType.Unavailable;
                        t.Result.AvsCodeDescription      = "AVSADDR: " + TrxnResponse.AVSAddr + " AVSZIP: " + TrxnResponse.AVSZip + " IAVS: " + TrxnResponse.IAVS;
                        t.Result.ResponseCode            = TrxnResponse.Result.ToString();
                        t.Result.CvvCode                 = CvnResponseType.Unavailable;
                        t.Result.CvvCodeDescription      = TrxnResponse.CVV2Match;
                        t.Result.ResponseCodeDescription = TrxnResponse.RespMsg;
                    }
                    else
                    {
                        t.Result.Messages.Add(new Message("Payment Error: Transaction Response is Null", "BVP_PFP_1003", MessageType.Error));
                    }

                    //Show Complete Response if Debug Mode
                    if (DebugMode)
                    {
                        t.Result.Messages.Add(new Message("PayflowPro Request:" + Trans.Request, "REQ", MessageType.Information));
                        t.Result.Messages.Add(new Message("PayflowPro Request:" + Trans.Response.ResponseString, "RES", MessageType.Information));

                        // Get the Transaction Context
                        Context TransCtx = Resp.TransactionContext;

                        if ((TransCtx != null) && (TransCtx.getErrorCount() > 0))
                        {
                            t.Result.Messages.Add(new Message("PayflowPro Context:" + TransCtx.ToString(), "CTX", MessageType.Information));
                        }
                    }

                    if (Result == 0)
                    {
                        result = true;
                    }
                    else
                    {
                        result = false;
                    }
                }
                else
                {
                    t.Result.Messages.Add(new Message("Payment Error: Response is Null", "BVP_PFP_1002", MessageType.Error));
                }
            }
            catch (Exception ex)
            {
                result = false;
                t.Result.Messages.Add(new Message("Payment Error: " + ex.Message, "BVP_PFP_1001", MessageType.Error));
                t.Result.Messages.Add(new Message("Stack Trace " + ex.StackTrace, "STACKTRACE", MessageType.Error));
            }

            t.Result.Succeeded = result;
        }