public ActionResult BouquetTypes() { ViewBag.Types = "current"; var response = new List <BouquetTypeModel>(); try { response = _request.MakeRequest <List <BouquetTypeModel> >(ApiConstantService.TYPES); return(View(response)); } catch (Exception exception) { ShowMessage(exception.Message, AlertType.Danger); return(View(response)); } }
public ActionResult TransactionInquiries(int id) { ViewBag.TransactionInquiries = "current"; var response = new TransactionsResponseModel(); try { var url = ApiConstantService.BASE_URL + "transactions/" + id; response = _request.MakeRequest <TransactionsResponseModel>(url); return(View(response)); } catch (Exception exception) { this.ShowMessage(exception.Message, AlertType.Danger); return(View(response)); } }
public ActionResult MakePaymentCustomerNumber( string type, string productKey, string customernumber, string basketId, decimal amount, int invoicePeriod, string emailAddress, string mobileNumber, string paymentMode ) { if (string.IsNullOrEmpty(type) || string.IsNullOrEmpty(productKey) || string.IsNullOrEmpty(customernumber) || string.IsNullOrEmpty(emailAddress) || string.IsNullOrEmpty(mobileNumber) || string.IsNullOrEmpty(paymentMode)) { ShowMessage("All the fields are required.", AlertType.Warning); return(RedirectToAction("Index", "Home")); } ViewBag.MakePaymentCustomerNumber = "current"; var response = new MakePaymentCustomerNumberResponseModel(); try { var user = _appDbContext.Users.First(u => u.UserName == User.Identity.Name); var accountNumber = user.AccountNumber; var url = ApiConstantService.BASE_URL + type.ToLower() + "/payment/" + productKey + "/" + customernumber; var headers = new NameValueCollection(); headers.Add("Authorization", "bearer " + this.UserInfo.accessToken); var postData = new Dictionary <string, string>(); postData.Add("amount", amount + ""); postData.Add("invoicePeriod", invoicePeriod + ""); postData.Add("emailAddress", emailAddress); postData.Add("accountNumber", accountNumber); postData.Add("mobileNumber", mobileNumber); postData.Add("paymentMode", paymentMode); response = _request.MakeRequest <MakePaymentCustomerNumberResponseModel>(url, postData, HttpVerb.POST, headers); if (response != null) { var transactionEnquiriesUrl = ApiConstantService.BASE_URL + "transactions/" + response.transactionNumber; var transactionEnquiries = _request.MakeRequest <TransactionsResponseModel>(transactionEnquiriesUrl); var transaction = _appDbContext.Transactions.Add(new Transaction { accountNumber = transactionEnquiries.accountNumber, transactionDate = transactionEnquiries.transactionDate, apiClientId = transactionEnquiries.apiClientId, customerNumber = transactionEnquiries.customerNumber, deviceNumber = transactionEnquiries.deviceNumber, packageCode = transactionEnquiries.packageCode, businessType = transactionEnquiries.businessType, emailAddress = transactionEnquiries.emailAddress, mobileNumber = transactionEnquiries.mobileNumber, amount = transactionEnquiries.amount, transFees = transactionEnquiries.transFees, posted = transactionEnquiries.posted, auditReferenceNo = transactionEnquiries.auditReferenceNo, success = transactionEnquiries.success, url = transactionEnquiries.url, CreatedDate = DateTime.UtcNow }); if (this._appDbContext.SaveChanges() > 0) { ViewBag.Id = transaction.id; } } return(View(response)); } catch (Exception exception) { this.ShowMessage(exception.Message, AlertType.Danger); return(View(response)); } }