Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                pnlReceiptError.Visible = false;
                pnlResponse.Visible     = false;
            }

            try
            {
                // Create a new VPCRequest object
                VPCRequest conn = new VPCRequest();

                // Process the response received
                conn.Process3PartyResponse(Page.Request.QueryString);

                // Check if the transaction was successful or if there was an error
                String vpc_TxnResponseCode = conn.GetResultField("vpc_TxnResponseCode", "Unknown");

                // Set the display fields for the receipt with the result fields
                // Core Fields
                Label_vpc_TxnResponseCode.Text   = vpc_TxnResponseCode;
                Label_vpc_MerchTxnRef.Text       = conn.GetResultField("vpc_MerchTxnRef", "Unknown");
                Label_vpc_OrderInfo.Text         = conn.GetResultField("vpc_OrderInfo", "Unknown");
                Label_vpc_Merchant.Text          = conn.GetResultField("vpc_Merchant", "Unknown");
                Label_vpc_Amount.Text            = conn.GetResultField("vpc_Amount", "Unknown");
                Label_vpc_Message.Text           = conn.GetResultField("vpc_Message", "Unknown");
                Label_vpc_ReceiptNo.Text         = conn.GetResultField("vpc_ReceiptNo", "Unknown");
                Label_vpc_AcqResponseCode.Text   = conn.GetResultField("vpc_AcqResponseCode", "Unknown");
                Label_vpc_AuthorizeId.Text       = conn.GetResultField("vpc_AuthorizeId", "Unknown");
                Label_vpc_BatchNo.Text           = conn.GetResultField("vpc_BatchNo", "Unknown");
                Label_vpc_TransactionNo.Text     = conn.GetResultField("vpc_TransactionNo", "Unknown");
                Label_vpc_Card.Text              = conn.GetResultField("vpc_Card", "Unknown");
                Label_vpc_3DSECI.Text            = conn.GetResultField("vpc_3DSECI", "Unknown");
                Label_vpc_3DSXID.Text            = conn.GetResultField("vpc_3DSXID", "Unknown");
                Label_vpc_3DSenrolled.Text       = conn.GetResultField("vpc_3DSenrolled", "Unknown");
                Label_vpc_3DSstatus.Text         = conn.GetResultField("vpc_3DSstatus", "Unknown");
                Label_vpc_VerToken.Text          = conn.GetResultField("vpc_VerToken", "Unknown");
                Label_vpc_VerType.Text           = conn.GetResultField("vpc_VerType", "Unknown");
                Label_vpc_VerSecurityLevel.Text  = conn.GetResultField("vpc_VerSecurityLevel", "Unknown");
                Label_vpc_VerStatus.Text         = conn.GetResultField("vpc_VerStatus", "Unknown");
                Label_vpc_RiskOverallResult.Text = conn.GetResultField("vpc_RiskOverallResult", "Unknown");
                Label_vpc_TxnReversalResult.Text = conn.GetResultField("vpc_TxnReversalResult", "No Value Returned");
                Label_TxnResponseCodeDesc.Text   = PaymentCodesHelper.GetTxnResponseCodeDescription(Label_vpc_TxnResponseCode.Text);

                // Card Security Code Fields
                Label_vpc_cscResultCode.Text = conn.GetResultField("vpc_cscResultCode", "Unknown");
                Label_cscResultCodeDesc.Text = PaymentCodesHelper.GetCSCDescription(Label_vpc_cscResultCode.Text);

                // Display the response fields
                pnlResponse.Visible = true;
            }
            catch (Exception ex)
            {
                // Capture the error and display the error information
                lblReceiptErrorMessage.Text = ex.Message + (ex.InnerException != null ? ex.InnerException.Message : "");
                pnlReceiptError.Visible     = true;
            }
        }
Beispiel #2
0
        private Boolean AmexRefund(string BookingID, string ReferenceNo, string TotalAmount, string TransactionNo)
        {
            VPCRequest conn          = AmexConfig();
            string     MerchantRefNo = BookingID + "_" + ReferenceNo + "~WEB";
            string     vpc_TransNo   = TransactionNo;

            if (TotalAmount.Contains("."))
            {
                TotalAmount = TotalAmount.Replace(".00", "");
            }
            TotalAmount = Convert.ToString(Convert.ToInt32(TotalAmount) * 100);
            string vpc_Amount = TotalAmount;

            conn.AddDigitalOrderField("vpc_Command", "refund");
            conn.AddDigitalOrderField("vpc_MerchTxnRef", MerchantRefNo);
            conn.AddDigitalOrderField("vpc_TransNo", vpc_TransNo);
            conn.AddDigitalOrderField("vpc_Amount", vpc_Amount);
            conn.SendRequest();
            string ResponseResult = null;
            int    CounterChkAmexRefundValue;

            for (CounterChkAmexRefundValue = 1; CounterChkAmexRefundValue <= 2; CounterChkAmexRefundValue++)
            {
                string vpc_TxnResponseCode = conn.GetResultField("vpc_TxnResponseCode", "Unknown");
                ResponseResult = PaymentCodesHelper.GetTxnResponseCodeDescription(vpc_TxnResponseCode);
                if (ResponseResult == "" || ResponseResult == null)
                {
                    conn.SendRequest();
                }
                else
                {
                    StringBuilder RefundDetails = new StringBuilder();
                    RefundDetails.Append(" These are the Refund Details for Booking ID and Reference : " + BookingID + "," + ReferenceNo + "<br/>");
                    RefundDetails.Append(" vpc_TxnResponseCode : " + conn.GetResultField("vpc_TxnResponseCode", "Unknown") + "<br/>");
                    RefundDetails.Append(" vpc_MerchTxnRef : " + conn.GetResultField("vpc_MerchTxnRef", "Unknown") + "<br/>");
                    RefundDetails.Append(" vpc_Merchant : " + conn.GetResultField("vpc_Merchant", "Unknown") + "<br/>");
                    RefundDetails.Append(" vpc_OrderInfo : " + conn.GetResultField("vpc_OrderInfo", "Unknown") + "<br/>");
                    RefundDetails.Append(" vpc_Amount : " + conn.GetResultField("vpc_Amount", "Unknown") + "<br/>");
                    RefundDetails.Append(" vpc_DRExists :" + conn.GetResultField("vpc_DRExists", "Unknown") + "<br/>");
                    RefundDetails.Append(" vpc_FoundMultipleDRs : " + conn.GetResultField("vpc_FoundMultipleDRs", "Unknown") + "<br/>");
                    RefundDetails.Append(" vpc_Message : " + conn.GetResultField("vpc_Message", "Unknown") + "<br/>");
                    RefundDetails.Append(" vpc_AcqResponseCode : " + conn.GetResultField("vpc_AcqResponseCode", "Unknown") + "<br/>");
                    RefundDetails.Append(" vpc_TransactionNo : " + conn.GetResultField("vpc_TransactionNo", "Unknown") + "<br/>");
                    RefundDetails.Append(" vpc_ReceiptNo : " + conn.GetResultField("vpc_ReceiptNo", "Unknown") + "<br/>");
                    RefundDetails.Append(" vpc_AuthorizeId : " + conn.GetResultField("vpc_AuthorizeId", "Unknown") + "<br/>");
                    RefundDetails.Append(" vpc_BatchNo : " + conn.GetResultField("vpc_BatchNo", "Unknown") + "<br/>");
                    RefundDetails.Append(" vpc_TicketNo : " + conn.GetResultField("vpc_TicketNo", "Unknown") + "<br/>");
                    RefundDetails.Append(" vpc_Card : " + conn.GetResultField("vpc_Card", "Unknown") + "<br/>");
                    RefundDetails.Append(" Response Result :" + ResponseResult + "<br/>");
                    RefundDetails.Append(" vpc_AuthorisedAmount : " + conn.GetResultField("vpc_AuthorisedAmount", "Unknown") + "<br/>");
                    RefundDetails.Append(" vpc_CapturedAmount : " + conn.GetResultField("vpc_CapturedAmount", "Unknown") + "<br/>");
                    RefundDetails.Append(" vpc_RefundedAmount : " + conn.GetResultField("vpc_RefundedAmount", "Unknown") + "<br/>");
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Refund Details for Amex : " + RefundDetails);

                    string vpc_avsResultCode = conn.GetResultField("vpc_AVSResultCode", "Unknown");
                    string Transaction       = conn.GetResultField("vpc_TransactionNo", "Unknown");
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("vpc_AVSResultCode : " + vpc_avsResultCode + " and vpc_TransactionNo : " + TransactionNo);
                    if (vpc_TxnResponseCode == "0")//&& (vpc_avsResultCode == "Y" || vpc_avsResultCode == "M")
                    {
                        Boolean IsSuccess = Successfull_1(BookingID);
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Update ISProcessed Value to ' 1 ' and Payment Successful : " + IsSuccess + " for BookingID : " + BookingID);
                        return(IsSuccess);
                    }
                    else
                    {
                        Boolean IsRefundPossible = RefundNotPossible_5(BookingID);
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Update ISProcessed Value to ' 5 ' and Refund : " + IsRefundPossible + " for BookingID : " + BookingID);
                        return(IsRefundPossible);
                    }
                }
            }
            if (CounterChkAmexRefundValue == 3)
            {
                Boolean IsAmexException = ExceptioninRefund_4(BookingID);
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Update ISProcessed Value to ' 4 ' and Refund : " + IsAmexException + " for BookingID : " + BookingID);
                return(IsAmexException);
            }
            return(false);
        }
Beispiel #3
0
        public Boolean AmexQuery(string BookingID, string ReferenceNo, string TotalAmount)
        {
            VPCRequest conn          = AmexConfig();
            string     MerchantRefNo = BookingID + "_" + ReferenceNo + "~WEB";

            conn.AddDigitalOrderField("vpc_Command", "queryDR");
            conn.AddDigitalOrderField("vpc_MerchTxnRef", MerchantRefNo);
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Amex Reversal Payment process for MerchantRefNo. : " + MerchantRefNo);
            // Perform the transaction
            conn.SendRequest();
            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Returning form Amex Gateway");
            string ResponseResult = null;
            int    CounterChkAmexQueryValue;

            for (CounterChkAmexQueryValue = 1; CounterChkAmexQueryValue <= 2; CounterChkAmexQueryValue++)
            {
                string vpc_TxnResponseCode = conn.GetResultField("vpc_TxnResponseCode", "Unknown");
                ResponseResult = PaymentCodesHelper.GetTxnResponseCodeDescription(vpc_TxnResponseCode);
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Response Code : " + ResponseResult);
                if (ResponseResult == "" || ResponseResult == null || ResponseResult == "null response")
                {
                    conn.SendRequest();
                }
                else
                {
                    StringBuilder InquiryDetails = new StringBuilder();
                    InquiryDetails.Append("These are the Inquiry Details for Booking ID and Reference :" + BookingID + "," + ReferenceNo + "<br/>");
                    InquiryDetails.Append(" vpc_TxnResponseCode :" + conn.GetResultField("vpc_TxnResponseCode", "Unknown") + "<br/>");
                    InquiryDetails.Append(" vpc_MerchTxnRef :" + conn.GetResultField("vpc_MerchTxnRef", "Unknown") + "<br/>");
                    InquiryDetails.Append(" vpc_Merchant :" + conn.GetResultField("vpc_Merchant", "Unknown") + "<br/>");
                    InquiryDetails.Append(" vpc_OrderInfo :" + conn.GetResultField("vpc_OrderInfo", "Unknown") + "<br/>");
                    InquiryDetails.Append(" vpc_Amount :" + conn.GetResultField("vpc_Amount", "Unknown") + "<br/>");
                    InquiryDetails.Append(" vpc_DRExists :" + conn.GetResultField("vpc_DRExists", "Unknown"));
                    InquiryDetails.Append(" vpc_FoundMultipleDRs :" + conn.GetResultField("vpc_FoundMultipleDRs", "Unknown") + "<br/>");
                    InquiryDetails.Append(" vpc_Message :" + conn.GetResultField("vpc_Message", "Unknown") + "<br/>");
                    InquiryDetails.Append(" vpc_AcqResponseCode :" + conn.GetResultField("vpc_AcqResponseCode", "Unknown") + "<br/>");
                    InquiryDetails.Append(" vpc_TransactionNo :" + conn.GetResultField("vpc_TransactionNo", "Unknown") + "<br/>");
                    InquiryDetails.Append(" vpc_ReceiptNo :" + conn.GetResultField("vpc_ReceiptNo", "Unknown") + "<br/>");
                    InquiryDetails.Append(" vpc_AuthorizeId :" + conn.GetResultField("vpc_AuthorizeId", "Unknown") + "<br/>");
                    InquiryDetails.Append(" vpc_BatchNo :" + conn.GetResultField("vpc_BatchNo", "Unknown") + "<br/>");
                    InquiryDetails.Append(" vpc_TicketNo :" + conn.GetResultField("vpc_TicketNo", "Unknown") + "<br/>");
                    InquiryDetails.Append(" vpc_Card :" + conn.GetResultField("vpc_Card", "Unknown") + "<br/>");
                    InquiryDetails.Append(" Response Result :" + ResponseResult + "<br/>");
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Inquiry Details for Amex : " + InquiryDetails);
                    string vpc_avsResultCode = conn.GetResultField("vpc_AVSResultCode", "Unknown");
                    string TransactionNo     = conn.GetResultField("vpc_TransactionNo", "Unknown");
                    Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("vpc_AVSResultCode : " + vpc_avsResultCode + " and vpc_TransactionNo : " + TransactionNo);
                    if (vpc_TxnResponseCode == "0" && (vpc_avsResultCode == "Y" || vpc_avsResultCode == "M"))
                    {
                        if ((MerchantRefNo != "" || MerchantRefNo != null) && (TotalAmount != "" || TotalAmount != null) && (TransactionNo != "" || TransactionNo != null))
                        {
                            Boolean Result = AmexRefund(BookingID, ReferenceNo, TotalAmount, TransactionNo);
                            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Value Return from AmexRefund i.e. IsSuccess : " + Result);
                            if (Result == true)
                            {
                                return(true);
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        Boolean IsPaymentSuccess = UserPaymentNotSuccess_3(BookingID);
                        Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Update ISProcessed Value to ' 3 ' and Inquiry Payment Success : " + IsPaymentSuccess + " for BookingID : " + BookingID);
                        return(IsPaymentSuccess);
                    }
                }
            }//for loop end
            if (CounterChkAmexQueryValue == 3)
            {
                Boolean IsHDFCInquirySuccess = ExceptioninInquiry_2(BookingID);
                Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Update ISProcessed Value to ' 2 ' and Inquiry Payment Success : " + IsHDFCInquirySuccess + " for BookingID : " + BookingID);
                return(IsHDFCInquirySuccess);
            }
            return(false);
        }