示例#1
0
        public override bool initiatePaymentConsumer(CreditCard creditCard)
        {
            LogRequest("initiatePaymentConsumer", "start");

            Errors.Clear();

            var BCResponse = new BankcardTransactionResponse();

            if (string.IsNullOrEmpty((string) PaymentData["TokenID"]))
            {
                BCResponse = GetCreditCardTokenID(PaymentData["Number"].ToString(),
                                                  ((DateTime) PaymentData["ExpDate"]).ToString("MMyy"),
                                                  (int) ((PayCrediCard) PaymentData).Type);
                PaymentData["TokenID"] = BCResponse.PaymentAccountDataToken;

                if (string.IsNullOrEmpty((string) PaymentData["TokenID"]))
                {
                    Errors.Add(1, "Unable to generate a valid payment account data token");
                    return false;
                }
            }
            else
            {
                LogRequest("initiatePaymentConsumer", "Token=" + (string) PaymentData["TokenID"]);
            }

            var PayingInvoiceID = (int?) PaymentData["InvoiceID"];
            var userHostAddress = (string) PaymentData["UserHostAddress"];
            var sessionID = (string) PaymentData["SessionID"];
            var Amount = (decimal) PaymentData["Amount"];
            var AddressLine1 = (string) PaymentData["AddressLine1"];
            var AddressLine2 = (string) PaymentData["AddressLine2"];
            var PostCode = (string) PaymentData["PostalCode"];
            var Town = (string) PaymentData["Town"];
            var Country = (string) PaymentData["Country"];

            var DB = new DataClassesDataContext();
            /*var billingAddress = new Address();

            billingAddress.add_AddressLine1 = AddressLine1;
            billingAddress.add_AddressLine2 = AddressLine2;
            billingAddress.add_DateModified = DateTime.Now;
            billingAddress.add_IsDeleted = false;
            billingAddress.add_PostalCode = PostCode;
            billingAddress.add_Town = Town;
            billingAddress.add_Country = Country;
            billingAddress.Add(DB);*/

            creditCard.cca_IsDeleted = false;
            creditCard.cca_IsActive = true;
            creditCard.cca_Ref = (string) PaymentData["TransactionID"];
            creditCard.cca_IPCTokenID = (string) PaymentData["TokenID"];
            creditCard.cca_Is3DS = false;

            var payment = new Payment();
            payment.pay_IsPaidByService = false;
            payment.pay_TypeID = (int) PaymentTypeEnum.CreditCard;
            payment.pay_StatusID = (int) PaymentStatusEnum.Initiated;
            payment.pay_InvoiceID = PayingInvoiceID;
            payment.pay_UserID = null;
            payment.pay_DateModified = DateTime.Now;
            payment.pay_DatePaid = DateTime.Now;
            payment.pay_IP = userHostAddress;
            payment.pay_Amount = Amount;
            payment.pay_UserID = null;
            payment.pay_UsedPP = Convert.ToInt32(PaymentProcessorEnum.IPCommerce);
            payment.pay_InternalRefID = (string) PaymentData["TransactionID"];

            try
            {
                payment.Add(DB, userHostAddress, sessionID);
            }
            catch (Exception ex)
            {
                LogRequest("initiatePaymentConsumer", "Error Mesage : " + ex.Message);
                LogRequest("initiatePaymentConsumer", "Error Stacktrace : " + ex.StackTrace);
            }

            PaymentData["PaymentID"] = payment.pay_ID;
            PaymentData["TransactionID"] = "PID_" + PaymentData["PaymentID"].ToString().PadLeft(7, '0');

            return Errors.Count == 0;
        }
示例#2
0
        private BankcardTransactionResponse GetCreditCardTokenID(string pan, string expiry, int cctype)
        {
            LogRequest("GetCreditCardTokenID", "start");

            var result = new BankcardTransactionResponse();

            if (PrepareToTransact())
            {
                var BCTransaction = new BankcardTransaction();
                var BCResponse = new BankcardTransactionResponse();

            //                BCTransaction = SetBankCardTxnData("5454545454545454", "0112", 4,"0.00", null);
            //                BCResponse = (BankcardTransactionResponse)CWSTPC.AuthorizeAndCapture(strSessionToken, BCTransaction, strApplicationProfileID, strProfileID, strServiceID);
            //                ProcessResponse(new ResponseDetails(BCTransaction.TransactionData.Amount, BCResponse,"AuthorizeAndCapture", true));
                BCTransaction = SetBankCardTxnData(pan, expiry, cctype, 0.00M, null, "123456");

                try
                {
                    BCResponse =
                        (BankcardTransactionResponse)
                        CWSTPC.AuthorizeAndCapture(strSessionToken, BCTransaction, strApplicationProfileID, strProfileID,
                                                   strServiceID);
                }
                catch (Exception ex)
                {
                }

                LogRequest("GetCreditCardTokenID", "status=" + BCResponse.Status +
                                                   " statusCode=" + BCResponse.StatusCode +
                                                   " statusMessage=" + BCResponse.StatusMessage + " amount=" +
                                                   BCResponse.Amount);

                result = BCResponse;
            }

            return result;
        }
示例#3
0
        public override bool initiatePayment()
        {
            LogRequest("initiatePayment", "start");
            Errors.Clear();

            var BCResponse = new BankcardTransactionResponse();

            if (string.IsNullOrEmpty((string) PaymentData["TokenID"]))
            {
                BCResponse = GetCreditCardTokenID(PaymentData["Number"].ToString(),
                                                  ((DateTime) PaymentData["ExpDate"]).ToString("MMyy"),
                                                  (int) ((PayCrediCard) PaymentData).Type);
                PaymentData["TokenID"] = BCResponse.PaymentAccountDataToken;

                if (string.IsNullOrEmpty((string) PaymentData["TokenID"]))
                {
                    Errors.Add(1, "Unable to generate a valid payment account data token");
                    return false;
                }
            }

            var PayingInvoiceID = (int) PaymentData["InvoiceID"];
            var userHostAddress = (string) PaymentData["UserHostAddress"];
            var sessionID = (string) PaymentData["SessionID"];
            var Amount = (decimal) PaymentData["Amount"];
            var AddressLine1 = (string) PaymentData["AddressLine1"];
            var AddressLine2 = (string) PaymentData["AddressLine2"];
            var PostCode = (string) PaymentData["PostalCode"];
            var Town = (string) PaymentData["Town"];
            var Country = (string) PaymentData["Country"];

            var DB = new DataClassesDataContext();
            var billingAddress = new Address();

            billingAddress.add_AddressLine1 = AddressLine1;
            billingAddress.add_AddressLine2 = AddressLine2;
            billingAddress.add_DateModified = DateTime.Now;
            billingAddress.add_IsDeleted = false;
            billingAddress.add_PostalCode = PostCode;
            billingAddress.add_Town = Town;
            billingAddress.add_Country = Country;
            billingAddress.Add(DB);

            var cc = new CreditCard();
            cc.cca_AddressID = billingAddress.add_ID;
            cc.cca_CardNumber = BCResponse.MaskedPAN;
            cc.cca_IsDeleted = false;
            cc.cca_IsActive = true;
            cc.cca_Ref = (string) PaymentData["TransactionID"];
            cc.cca_Is3DS = false;
            cc.cca_ExpirationDate = ((PayCrediCard) PaymentData).ExpirationDate;
            cc.cca_DateModified = DateTime.Now;
            cc.cca_NameOnCard = ((PayCrediCard) PaymentData).HolderName;
            cc.cca_IssueNumber = ((PayCrediCard) PaymentData).IssueNumber;
            cc.CVV = ((PayCrediCard) PaymentData).CVV;
            cc.cca_CardType = (short) ((PayCrediCard) PaymentData).Type;
            cc.cca_IPCTokenID = (string) PaymentData["TokenID"];
            cc.Add(DB);

            var payment = new Payment();
            payment.pay_CreditCardID = cc.cca_ID;
            payment.pay_IsPaidByService = false;
            payment.pay_TypeID = (int) PaymentTypeEnum.CreditCard;
            payment.pay_StatusID = (int) PaymentStatusEnum.Initiated;
            payment.pay_InvoiceID = PayingInvoiceID;
            payment.pay_UserID = null; //logged user
            payment.pay_DateModified = DateTime.Now;
            payment.pay_DatePaid = DateTime.Now;
            payment.pay_IP = userHostAddress;
            payment.pay_Amount = Amount;
            payment.pay_UserID = null;
            payment.pay_Email = PaymentData["Email"].ToString();
            ;
            payment.pay_UsedPP = Convert.ToInt32(PaymentProcessorEnum.IPCommerce);
            payment.pay_InternalRefID = (string) PaymentData["TransactionID"];
            payment.pay_ExternalRefID = BCResponse.TransactionId;
            payment.CreditCard = cc;
            payment.Add(DB, userHostAddress, sessionID);

            PaymentData["PaymentID"] = payment.pay_ID;
            PaymentData["TransactionID"] = "PID_" + PaymentData["PaymentID"].ToString().PadLeft(7, '0');

            return Errors.Count == 0;
        }
示例#4
0
        public override bool completePaymentDirectDebit(CreditCard cc)
        {
            LogRequest("completePaymentDirectDebit", "start");

            DataClassesDataContext DB = (DataClassesDataContext) PaymentData["DB"] ?? new DataClassesDataContext();
            DirectDebit currentDirectDebit = DirectDebit.GetByID(DB, (int) PaymentData["DirectDebitID"]);
            Payment currentPayment = Payment.GetByID(DB, (int) PaymentData["PaymentID"]);
            Invoice currentInvoice = currentPayment.Invoice; // Invoice.GetByID(DB, (int)PaymentData["InvoiceID"]);
            CreditCard currentCreditCard = currentPayment.CreditCard;
                // CreditCard.GetById(DB, currentDirectDebit.ddd_CreditCardID);

            PaymentData["TransactionID"] = string.Format("PID_{0}", PaymentData["PaymentID"].ToString().PadLeft(7, '0'));

            if (PrepareToTransact())
            {
                var BCTransaction = new BankcardTransaction();
                var BCResponse = new BankcardTransactionResponse();

                BCTransaction = SetBankCardTxnData(null, null, 0, (decimal) PaymentData["Amount"],
                                                   (string) PaymentData["TokenID"],
                                                   (string) PaymentData["TransactionID"]);
                try
                {
                    BCResponse =
                        (BankcardTransactionResponse)
                        CWSTPC.AuthorizeAndCapture(strSessionToken, BCTransaction, strApplicationProfileID, strProfileID,
                                                   strServiceID);
                }
                catch (Exception ex)
                {
                    Errors.Add(2, ex.Message);
                    LogRequest("completePaymentDirectDebit", ex.Message);
                    return false;
                }

                LogRequest("completePaymentDirectDebit", "status=" + BCResponse.Status +
                                                      " statusCode=" + BCResponse.StatusCode +
                                                      " statusMessage=" + BCResponse.StatusMessage + " amount=" +
                                                      BCResponse.Amount);
                //ProcessResponse(new ResponseDetails(BCTransaction.TransactionData.Amount, BCResponse,"AuthorizeAndCapture", true));

                if (BCResponse.Status == Status.Failure)
                {
                    Errors.Add(2, BCResponse.StatusCode + " : " + BCResponse.StatusMessage);

                    currentPayment.pay_StatusID = (int) PaymentStatusEnum.Failed;
                    currentPayment.pay_ResultCode = BCResponse.StatusCode;
                    currentPayment.pay_ResultMessage = BCResponse.StatusMessage;
                    currentPayment.Update(DB, "", "");

                    currentDirectDebit.ddd_NonTechnicalFailures++;
                    currentDirectDebit.ddd_TechnicalFailures++;
                    currentDirectDebit.Update(DB);

                    if (currentDirectDebit.ddd_IsRecurring && (currentDirectDebit.ddd_TechnicalFailures > 2
                                                               || currentDirectDebit.ddd_NonTechnicalFailures >= 2))
                    {
                        //E add record in the failedDDD because the allowed re-attempt are done
                        var fdd = new FailedDirectDebit
                                      {
                                          fdd_DirectDebitID = currentDirectDebit.ddd_ID,
                                          fdd_DateFailed = DateTime.Now,
                                          fdd_ErrorTypeID = (int) FailedDDErrorTypeEnum.PaymentError,
                                          fdd_InvoiceID = (int) PaymentData["InvoiceID"],
                                      };
                        fdd.Add(DB);
                    }
                    return false;
                }

                currentCreditCard.cca_Ref = "ipcommerce";
                currentCreditCard.Update(DB);

                currentPayment.pay_DatePaid = DateTime.Now;
                currentPayment.pay_StatusID = (int) PaymentStatusEnum.Paid;
                currentPayment.pay_IsPaidByService = true;
                currentPayment.Update(DB, "", "");

                currentPayment.pay_ResultCode = BCResponse.StatusCode;
                currentPayment.pay_ResultMessage = BCResponse.StatusMessage;

                var amountToPay = (decimal) PaymentData["Amount"];
                decimal paidAmount = currentInvoice.inv_PaidAmount ?? 0;

                currentInvoice.inv_StatusID =
                    (short)
                    ((amountToPay + paidAmount) < currentInvoice.inv_DueAmount
                         ? (int) InvoiceStatusEnum.PartPaid
                         : (int) InvoiceStatusEnum.Paid);
                currentInvoice.inv_PaidAmount = (currentInvoice.inv_PaidAmount ?? 0) + amountToPay;
                currentInvoice.inv_PaidDate = DateTime.Now;
                currentInvoice.inv_IsMarkedAsPaid = false;

                if (currentInvoice.inv_StatusID == (int) InvoiceStatusEnum.Paid)
                {
                    //E lock the invoice for other users if the CC has user associated
                    currentInvoice.inv_FinalOwnerID = currentCreditCard.cca_UserID;
                }

                currentInvoice.Update(DB);
                //Fee.InsertPaymentFee(DB, currentPayment, currentDirectDebit.ddd_IsRecurring, currentInvoice.inv_MerchantID.Value, "", "");
                if (currentDirectDebit.ddd_IsSingle)
                {
                    //E disable the SP
                    currentDirectDebit.ddd_IsActive = false;
                }
                else if (currentDirectDebit.ddd_IsRecurring)
                {
                    //E add record in the failedDDD just to prevent the next executions
                    var fdd = new FailedDirectDebit();
                    fdd.fdd_DirectDebitID = currentDirectDebit.ddd_ID;
                    fdd.fdd_DateFailed = DateTime.Now;
                    fdd.fdd_ErrorTypeID = (int) FailedDDErrorTypeEnum.Paid;
                    fdd.fdd_InvoiceID = currentInvoice.inv_ID;
                    fdd.Add(DB);
                }

                currentDirectDebit.ddd_PaymentsCommited++;
                currentDirectDebit.ddd_TechnicalFailures = 0;
                currentDirectDebit.ddd_NonTechnicalFailures = 0;
                currentDirectDebit.Update(DB);

                DB.SubmitChanges();
            }
            else
            {
                LogRequest("completePaymentConsumer", "failed to complete payment");
                Errors.Add(2, "Failed to PrepareToTransact");

                currentPayment.pay_StatusID = (int) PaymentStatusEnum.Failed;
                currentPayment.pay_ResultCode = "X";
                currentPayment.pay_ResultMessage = "GATEWAY ERROR";
                //currentPayment.pay_UsedPP = Convert.ToInt32(UtilityServices.Enums.PaymentProcessorEnum.IPCommerce);
                currentPayment.Update(DB, "", "");

                currentDirectDebit.ddd_NonTechnicalFailures++;
                currentDirectDebit.ddd_TechnicalFailures++;
                currentDirectDebit.Update(DB);
                return false;
            }

            LogRequest("completePaymentConsumer", "end");
            return true;
        }
示例#5
0
        public override bool completePaymentConsumer(CreditCard creditCard)
        {
            LogRequest("completePaymentConsumer", "start");

            //var DB = new DataClassesDataContext();

            DataClassesDataContext DB = (DataClassesDataContext)PaymentData["DB"] ?? new DataClassesDataContext();

            if (PrepareToTransact())
            {
                var PayingInvoiceID = (int) PaymentData["InvoiceID"];
                var userHostAddress = (string) PaymentData["UserHostAddress"];
                var sessionID = (string) PaymentData["SessionID"];
                var Amount = (decimal) PaymentData["Amount"];
                var AddressLine1 = (string) PaymentData["AddressLine1"];
                var AddressLine2 = (string) PaymentData["AddressLine2"];
                var PostCode = (string) PaymentData["PostalCode"];
                var Town = (string) PaymentData["Town"];
                var Country = (string) PaymentData["Country"];

                var BCTransaction = new BankcardTransaction();
                var BCResponse = new BankcardTransactionResponse();

                BCTransaction = SetBankCardTxnData(null, null, 0, Amount, (string) PaymentData["TokenID"],
                                                   (string) PaymentData["TransactionID"]);
                try
                {
                    BCResponse =
                        (BankcardTransactionResponse)
                        CWSTPC.AuthorizeAndCapture(strSessionToken, BCTransaction, strApplicationProfileID, strProfileID,
                                                   strServiceID);
                }
                catch (Exception ex)
                {
                    Errors.Add(2, ex.Message);
                    LogRequest("completePayment", ex.Message);
                    return false;
                }
                //LogRequest("completePaymentConsumer", "status={0} statusCode={1} statusMessage={2} amount={3}", BCResponse.Status, BCResponse.StatusCode, BCResponse.StatusMessage, BCResponse.Amount);
                LogRequest("completePaymentConsumer", "status=" + BCResponse.Status +
                                                      " statusCode=" + BCResponse.StatusCode +
                                                      " statusMessage=" + BCResponse.StatusMessage + " amount=" +
                                                      BCResponse.Amount);
                //ProcessResponse(new ResponseDetails(BCTransaction.TransactionData.Amount, BCResponse,"AuthorizeAndCapture", true));

                if (BCResponse.Status == Status.Failure)
                {
                    Errors.Add(2, BCResponse.StatusCode + " : " + BCResponse.StatusMessage);
                    return false;
                }

                Payment payment = Payment.GetByID(DB, (int) PaymentData["PaymentID"]);
                payment.pay_UsedPP = Convert.ToInt32(PaymentProcessorEnum.IPCommerce);
                payment.pay_ResultCode = BCResponse.StatusCode;
                payment.pay_ResultMessage = BCResponse.StatusMessage;
                payment.pay_InternalRefID = (string) PaymentData["TransactionID"];
                payment.pay_ExternalRefID = BCResponse.TransactionId;
                payment.pay_DateModified = DateTime.Now;
                payment.Update(DB, userHostAddress, sessionID);
            }
            else
            {
                LogRequest("completePaymentConsumer", "failed to complete payment");
                Errors.Add(2, "Failed to PrepareToTransact");
                return false;
            }

            creditCard.cca_IsDeleted = false;
            creditCard.cca_IsActive = true;

            if (creditCard.cca_ID > 0)
            {
                creditCard.Update(DB);
            }
            else
            {
                creditCard.Add(DB);
            }

            DB.SubmitChanges();

            return true;
        }
示例#6
0
        public override bool completePayment()
        {
            LogRequest("completePayment", "start");

            if (PrepareToTransact())
            {
                var PayingInvoiceID = (int) PaymentData["InvoiceID"];
                var userHostAddress = (string) PaymentData["UserHostAddress"];
                var sessionID = (string) PaymentData["SessionID"];
                var Amount = (decimal) PaymentData["Amount"];
                var AddressLine1 = (string) PaymentData["AddressLine1"];
                var AddressLine2 = (string) PaymentData["AddressLine2"];
                var PostCode = (string) PaymentData["PostalCode"];
                var Town = (string) PaymentData["Town"];
                var Country = (string) PaymentData["Country"];

                var BCTransaction = new BankcardTransaction();
                var BCResponse = new BankcardTransactionResponse();

                BCTransaction = SetBankCardTxnData(null, null, 0, Amount, (string) PaymentData["TokenID"],
                                                   (string) PaymentData["TransactionID"]);
                try
                {
                    BCResponse =
                        (BankcardTransactionResponse)
                        CWSTPC.AuthorizeAndCapture(strSessionToken, BCTransaction, strApplicationProfileID, strProfileID,
                                                   strServiceID);
                }
                catch (Exception ex)
                {
                    Errors.Add(2, ex.Message);
                    LogRequest("completePayment", ex.Message);
                    return false;
                }
                LogRequest("completePayment", "status=" + BCResponse.Status +
                                              " statusCode=" + BCResponse.StatusCode +
                                              " statusMessage=" + BCResponse.StatusMessage +
                                              " amount=" + BCResponse.Amount);
                //ProcessResponse(new ResponseDetails(BCTransaction.TransactionData.Amount, BCResponse,"AuthorizeAndCapture", true));

                if (BCResponse.Status == Status.Failure)
                {
                    Errors.Add(2, BCResponse.StatusCode + " : " + BCResponse.StatusMessage);
                    return false;
                }

                var DB = new DataClassesDataContext();

                Payment payment = Payment.GetByID(DB, (int) PaymentData["PaymentID"]);
                payment.pay_StatusID = (int) PaymentStatusEnum.Paid;
                payment.pay_DateModified = DateTime.Now;
                payment.pay_DatePaid = DateTime.Now;
                payment.pay_IP = userHostAddress;
                payment.pay_UsedPP = Convert.ToInt32(PaymentProcessorEnum.IPCommerce);
                payment.pay_ResultCode = BCResponse.StatusCode;
                payment.pay_ResultMessage = BCResponse.StatusMessage;

                payment.pay_InternalRefID = (string) PaymentData["TransactionID"];
                payment.pay_ExternalRefID = BCResponse.TransactionId;

                Invoice invoice = Invoice.GetByID(DB, PayingInvoiceID);
                decimal paidAmount = invoice.inv_PaidAmount ?? 0;
                invoice.inv_StatusID =
                    (short)
                    ((Amount + paidAmount) < invoice.inv_DueAmount
                         ? (int) InvoiceStatusEnum.PartPaid
                         : (int) InvoiceStatusEnum.Paid);
                invoice.inv_PaidAmount = (invoice.inv_PaidAmount ?? 0) + Amount;
                invoice.inv_PaidDate = DateTime.Now;
                invoice.inv_IsMarkedAsPaid = false;

                payment.Update(DB, userHostAddress, sessionID);
                invoice.Update(DB);

                //Fee.InsertPaymentFee(DB, payment, false, invoice.inv_MerchantID.Value, userHostAddress, sessionID);
            }
            else
            {
                LogRequest("completePayment", "failed to complete payment");
                Errors.Add(2, "Failed to PrepareToTransact");
                return false;
            }

            return true;
        }
示例#7
0
        private void ProcessBankcardTransactionResponse(ResponseDetails _Response)
        {
            var _BCResponse = new BankcardTransactionResponse();
            _BCResponse = (BankcardTransactionResponse) _Response.Response;
            //Note : IMPORTANT Always verify the approved amount was the same as the requested approval amount for "AuthorizeAndCapture" as well as "Authorize"
            if (_Response.TransactionType == "AuthorizeAndCapture" | _Response.TransactionType == "Authorize")
            {
                if (_BCResponse.Amount != _Response.TxnAmount)
                {
            //                    log.Debug("The transaction was approved for " + _BCResponse.Amount +
            //                                               " which is an amount less than the requested amount of " +
            //                                               _Response.TxnAmount +
            //                                               ". Please provide alternate payment to complete transaction");
                }
            }

            if (!_Response.Verbose)
            {
                // In this case don't present to the user all of the data.
                if (_BCResponse.Status == Status.Successful)
                {
                    //The transaction was approved
                    //NOTE : Please reference the developers guide for a more complete explination of the return fields
                    //Note Highly recommended to save
                    //The unique id of the transaction. TransactionId is required for all subsequent transactions such as Return, Undo, etc.
                    //Must be stored with the TransactionId in order to identify which merchant sent which transaction. Required to support multi-merchant.
                    //Note Optional but recommended to save
                    //Status code generated by the Service Provider. This code should be displayed to the user as verification of the transaction.
                    //Explains the StatusCode which is generated by the Service Provider. This message should be displayed to the user as verification of the transaction.
                    //A value returned when a transaction is approved. This value should be printed on the receipt, and also recorded for every off-line transaction, such as a voice authorization. This same data element and value must be provided during settlement. Required.
                    //Specifies the authorization amount of the transaction. This is the actual amount authorized.
            //                    log.Debug(((((((("Your transaction type of " + _Response.TransactionType.ToString() +
            //                                                     " was APPROVED" + "\r\n" +
            //                                                     "TransactionId : ") + _BCResponse.TransactionId + "\r\n" + "MerchantProfileId : " + HID_strProfileID +
            //                                                    "\r\n" + "Status Code : ") +
            //                                                   _BCResponse.StatusCode.ToString() + "\r\n" +
            //                                                   "Status Message : ") + _BCResponse.StatusMessage.ToString() +
            //                                                  "\r\n" + "ApprovalCode : ") +
            //                                                 _BCResponse.ApprovalCode.ToString() + "\r\n" +
            //                                                 "Amount : ") + _BCResponse.Amount.ToString())));
                }
                if (_BCResponse.Status == Status.Failure)
                {
                    //The transaction was declined
                    //NOTE : Please reference the developers guide for a more complete explination of the return fields
                    //Note Highly recommended to save
                    //The unique id of the transaction. TransactionId is required for all subsequent transactions such as Return, Undo, etc.
                    //Must be stored with the TransactionId in order to identify which merchant sent which transaction. Required to support multi-merchant.
                    //Note Optional but recommended to save
                    //Status code generated by the Service Provider. This code should be displayed to the user as verification of the transaction.
                    //Explains the StatusCode which is generated by the Service Provider. This message should be displayed to the user as verification of the transaction.
            //                    log.Debug(((("Your transaction type of " + _Response.TransactionType.ToString() +
            //                                                  " was DECLINED" + "\r\n" + "TransactionId : ") +
            //                                                 _BCResponse.TransactionId + "\r\n" +
            //                                                 "MerchantProfileId : " + HID_strProfileID + "\r\n" + "Status Code : ") + _BCResponse.StatusCode +
            //                                                "\r\n" + "Status Message : ") +
            //                                               _BCResponse.StatusMessage);
                }
                return;
            }
            if (_BCResponse.Status == Status.Successful)
            {
                //The transaction was approved
                string strMessage = "";
                //NOTE : Please reference the developers guide for a more complete explination of the return fields
                strMessage = "Your transaction type of " + _Response.TransactionType + " was APPROVED";
                //Note Highly recommended to save
                strMessage = (strMessage + "\r\n" + "TransactionId : ") +
                             _BCResponse.TransactionId;
                //The unique id of the transaction. TransactionId is required for all subsequent transactions such as Return, Undo, etc.
                strMessage = strMessage + "\r\n" + "MerchantProfileId : " + strProfileID;
                //Must be stored with the TransactionId in order to identify which merchant sent which transaction. Required to support multi-merchant.
                //Note Highly recommended to save if Tokenization will be used
                //+  vbCrLf + "PaymentAccountDataToken : " + _BCResponse.PaymentAccountDataToken //If tokenization purchased this field represents the actual token returned in the transaction for future use.
                //Note Optional but recommended to save
                strMessage = (strMessage + "\r\n" + "Status Code : ") +
                             _BCResponse.StatusCode;
                //Status code generated by the Service Provider. This code should be displayed to the user as verification of the transaction.
                strMessage = (strMessage + "\r\n" + "Status Message : ") +
                             _BCResponse.StatusMessage;
                //Explains the StatusCode which is generated by the Service Provider. This message should be displayed to the user as verification of the transaction.
                strMessage = (strMessage + "\r\n" + "ApprovalCode : ") +
                             _BCResponse.ApprovalCode;
                //A value returned when a transaction is approved. This value should be printed on the receipt, and also recorded for every off-line transaction, such as a voice authorization. This same data element and value must be provided during settlement. Required.
                strMessage = (strMessage + "\r\n" + "Amount : ") + _BCResponse.Amount;
                //Specifies the authorization amount of the transaction. This is the actual amount authorized.
                //Note Optional but recommended if AVS is supported
                if (_BCResponse.AVSResult != null)
                {
                    strMessage = (strMessage + "\r\n" + "AVSResult ActualResult : ") +
                                 _BCResponse.AVSResult.ActualResult;
                    //Specifies the actual result of AVS from the Service Provider.
                    strMessage = (strMessage + "\r\n" + "AVSResult AddressResult : ") +
                                 _BCResponse.AVSResult.AddressResult;
                    //Specifies the result of AVS as it pertains to Address matching
                    //Specifies the result of AVS as it pertains to Postal Code matching
                    strMessage = (strMessage + "\r\n" + "AVSResult PostalCodeResult : ") +
                                 _BCResponse.AVSResult.PostalCodeResult;
                }
                //Note Optional but recommended if CV data is supported
                strMessage = (strMessage + "\r\n" + "CVResult : ") +
                             _BCResponse.CVResult;
                //Response code returned by the card issuer indicating the result of Card Verification (CVV2/CVC2/CID).
                //Note Optional
                strMessage = (strMessage + "\r\n" + "OrderId : ") +
                             _BCResponse.OrderId;
                //A unique ID used to identify a specific order.  This is used to process further transactions on Virtual Terminals.
                strMessage = (strMessage + "\r\n" + "BatchId : ") +
                             _BCResponse.BatchId;
                //A unique ID used to identify a specific batch settlement
                strMessage = (strMessage + "\r\n" + "DowngradeCode : ") +
                             _BCResponse.DowngradeCode;
                //Indicates downgrade reason.
                strMessage = (strMessage + "\r\n" + "FeeAmount : ") +
                             _BCResponse.FeeAmount;
                //Fee amount charged for the transaction.
                strMessage = (strMessage + "\r\n" + "FinalBalance : ") +
                             _BCResponse.FinalBalance;
                //Fee amount charged for the transaction.
                strMessage = (strMessage + "\r\n" + "Resubmit : ") +
                             _BCResponse.Resubmit;
                //Specifies whether resubmission is supported for PIN Debit transactions.
                strMessage = (strMessage + "\r\n" + "ServiceTransactionId : ") +
                             _BCResponse.ServiceTransactionId;

                //+  vbCrLf + "SettlementDate : " + _BCResponse.SettlementDate //Settlement date. Conditional, if present in the authorization response, this same data element and value must be provided during settlement

                //Token generated
                strMessage = (strMessage + "\r\n" + "Token : ") +
                             _BCResponse.PaymentAccountDataToken;

            //                log.Debug(strMessage);
            }
            if (_BCResponse.Status == Status.Failure)
            {
                //The transaction was declined
                //NOTE : Please reference the developers guide for a more complete explination of the return fields
                //Note Highly recommended to save
                //The unique id of the transaction. TransactionId is required for all subsequent transactions such as Return, Undo, etc.
                //Must be stored with the TransactionId in order to identify which merchant sent which transaction. Required to support multi-merchant.
                //Note Optional but recommended to save
                //Status code generated by the Service Provider. This code should be displayed to the user as verification of the transaction.
                //Explains the StatusCode which is generated by the Service Provider. This message should be displayed to the user as verification of the transaction.
                //Note Optional but recommended if CV data is supported
                //Response code returned by the card issuer indicating the result of Card Verification (CVV2/CVC2/CID).
                //Note Optional
            //                log.Debug(((((("Your transaction type of " + _Response.TransactionType.ToString() +
            //                                                " was DECLINED" + "\r\n" + "TransactionId : ") +
            //                                               _BCResponse.TransactionId.ToString() + "\r\n" +
            //                                               "MerchantProfileId : " + HID_strProfileID + "\r\n" + "Status Code : ") + _BCResponse.StatusCode.ToString() +
            //                                              "\r\n" + "Status Message : ") +
            //                                             _BCResponse.StatusMessage.ToString() + "\r\n" +
            //                                             "CVResult : ") + _BCResponse.CVResult.ToString() + "\r\n" + "ServiceTransactionId : ") +
            //                                           _BCResponse.ServiceTransactionId.ToString());
            }
        }