public ActionResult PaymentProcess(CardInfoViewModel data) { if (string.IsNullOrEmpty(data.customerProfile_Id)) { data.customerProfile_Id = _helper.CreateCust(data); } if (data.addnewcard.isCardSave) { data.addPayment.CCID = true; string message = UpdateCust(data); if (string.IsNullOrEmpty(message)) { var response = new PaymentResponse { aTranId = data.aTranId, cutomerProfileId = data.customerProfile_Id, statusCode = "200", message = "Card Added Successfully!!", transAmount = data.Amount, }; _helper.PostPaymentResponse(response, data.reqId); TempData["Success"] = "Card Added Successfully!!"; } else { TempData["Error"] = message; } return(RedirectToAction("Payment", "Payment", new { aTranId = data.aTranId })); } if (data.PostType == "Pay") { if (data.addnewcard.CCAddCard || data.addnewcard.BankAddCard) { var response = _helper.PaymentMethod(data); _helper.PostPaymentResponse(response, data.reqId); if (response.statusCode == "200") { return(RedirectToAction("ThanKYou", "Payment")); } else { TempData["Error"] = response.message; } } else if (data.addnewcard.SaveCard) { var response = _helper.CustTransection(data, data.addnewcard.custumerCardId); response.aTranId = data.aTranId; _helper.PostPaymentResponse(response, data.reqId); if (response.statusCode == "200") { return(RedirectToAction("ThanKYou", "Payment")); } else { TempData["Error"] = response.message; } return(RedirectToAction("Payment", "Payment", new { aTranId = data.aTranId })); //foreach (var item in data.savecard) //{ // if (item.CCDynamic) // { // var response = _helper.CustTransection(item.customerPaymentProfileId, data.customerProfile_Id, data.Amount, data.ANET_ApiLoginID, data.ANET_ApiTransactionKey); // if (response.statusCode == "200") // { // return RedirectToAction("ThanKYou", "Payment"); // } // else // { // TempData["Error"] = response.message; // } // } //} } if (!data.addnewcard.CCAddCard && !data.addnewcard.BankAddCard) { TempData["Error"] = "No Payment Method is Selected"; } } else if (data.PostType == "CreateCustomer") { string cusProfileId = _helper.CreateCust(data); if (!string.IsNullOrEmpty(cusProfileId)) { TempData["Success"] = "Profile Create Successfully!!"; return(RedirectToAction("Payment", "Payment", new { aTranId = data.aTranId, CusProfilId = cusProfileId })); } else { TempData["Error"] = "Error while saving customer!!"; } } //else if(data.savecard.)s return(RedirectToAction("Payment", "Payment", new { aTranId = data.aTranId })); }