void Populate() { CCAvenueHelper myUtility = new CCAvenueHelper(); string WorkingKey, Order_Id, Merchant_Id, Amount, AuthDesc, checksum; //Assign following values to send it to verifychecksum function. WorkingKey = this.SettingManager.GetSettingValue("PaymentMethod.CCAvenue.Key"); // put in the 32 bit working key in the quotes provided here if (String.IsNullOrWhiteSpace(WorkingKey)) { throw new NopException("CCAvenue key is not set"); } Merchant_Id = Request.Form["Merchant_Id"]; Order_Id = Request.Form["Order_Id"]; Amount = Request.Form["Amount"]; AuthDesc = Request.Form["AuthDesc"]; checksum = Request.Form["Checksum"]; checksum = myUtility.verifychecksum(Merchant_Id, Order_Id, Amount, AuthDesc, WorkingKey, checksum); if ((checksum == "true") && (AuthDesc == "Y")) { /* * Here you need to put in the routines for a successful * transaction such as sending an email to customer, * setting database status, informing logistics etc etc */ Order order = this.OrderService.GetOrderById(Convert.ToInt32(Order_Id)); if (this.OrderService.CanMarkOrderAsPaid(order)) { this.OrderService.MarkOrderAsPaid(order.OrderId); } lInfo.Text = "<br>Thank you for shopping with us. Your credit card has been charged and your transaction is successful."; } else if ((checksum == "true") && (AuthDesc == "N")) { /* * Here you need to put in the routines for a failed * transaction such as sending an email to customer * setting database status etc etc */ string message = "<br>Thank you for shopping with us. However, the transaction has been declined."; lInfo.Text = message; } else if ((checksum == "true") && (AuthDesc == "B")) { /* * Here you need to put in the routines/e-mail for a "Batch Processing" order * This is only if payment for this transaction has been made by an American Express Card * since American Express authorisation status is available only after 5-6 hours by mail from ccavenue and at the "View Pending Orders" */ string message = "<br>Thank you for shopping with us. We will keep you posted regarding the status of your order through e-mail"; lInfo.Text = message; } else { /* * Here you need to simply ignore this and dont need * to perform any operation in this condition */ string message = "<br>Security Error. Illegal access detected"; lInfo.Text = message; } }
public ActionResult ReturnOLD() { var form = Request.Form; var processor = _paymentService.LoadPaymentMethodBySystemName("Payments.CCAvenue") as CCAvenuePaymentProcessor; if (processor == null || !processor.IsPaymentMethodActive(_paymentSettings) || !processor.PluginDescriptor.Installed) { throw new NopException("CCAvenue module cannot be loaded"); } var myUtility = new CCAvenueHelper(); //assign following values to send it to verifychecksum function. if (string.IsNullOrWhiteSpace(_ccAvenuePaymentSettings.Key)) { throw new NopException("CCAvenue key is not set"); } var merchantId = form["Merchant_Id"]; var orderId = form["Order_Id"]; var amount = form["Amount"]; var authDesc = form["AuthDesc"]; var checksum = form["Checksum"]; checksum = myUtility.VerifyCheckSum(merchantId, orderId, amount, authDesc, _ccAvenuePaymentSettings.Key, checksum); if (checksum == "true" && authDesc == "Y") { //here you need to put in the routines for a successful transaction such as sending an email to customer, //setting database status, informing logistics etc etc var order = _orderService.GetOrderById(Convert.ToInt32(orderId)); if (_orderProcessingService.CanMarkOrderAsPaid(order)) { _orderProcessingService.MarkOrderAsPaid(order); } //thank you for shopping with us. Your credit card has been charged and your transaction is successful return(RedirectToRoute("CheckoutCompleted", new { orderId = order.Id })); } if (checksum == "true" && authDesc == "N") { //here you need to put in the routines for a failed transaction such as sending an email to customer //setting database status etc etc return(Content("Thank you for shopping with us. However, the transaction has been declined")); } if (checksum == "true" && authDesc == "B") { //here you need to put in the routines/e-mail for a "Batch Processing" order. //This is only if payment for this transaction has been made by an American Express Card //since American Express authorisation status is available only after 5-6 hours by mail from ccavenue and at the "View Pending Orders" return(Content("Thank you for shopping with us. We will keep you posted regarding the status of your order through e-mail")); } //here you need to simply ignore this and dont need to perform any operation in this condition return(Content("Security Error. Illegal access detected")); }