Beispiel #1
0
        public async Task <ActionResult> IndividualBankTransfer(HttpPostedFileBase BankFile, string id)
        {
            try
            {
                DomesticInvoicePaymentManager Mgr; bool offline;
                if (Request.IsAuthenticated && User.Identity.IsAuthenticated)
                {
                    offline = false;
                    Mgr     = new DomesticInvoicePaymentManager(Lang, UserManager.FindById(User.Identity.GetUserId()));
                }
                else
                {
                    offline = true;
                    Mgr     = new OfflineDomesticInvoicePaymentManager(Lang);
                }
                ViewBag.Offline = offline;

                var result = await Mgr.UploadBankTransferFile(BankFile, id);

                if (result.IsSuccessStatusCode)
                {
                    var successMsg = IndividualSuccessBankTransferFileUploadMsg(id, offline);
                    return(View("Success", successMsg));
                }
            }
            catch (Exception ex)
            {
            }

            var failMsg = IndividualFailBankTransferFileUploadMsg(id);

            return(View("Failure", failMsg));
        }
Beispiel #2
0
        public async Task <ActionResult> IndividualPaymentMethod(string id)
        {
            DomesticInvoicePaymentManager Mgr; bool offline;

            if (Request.IsAuthenticated && User.Identity.IsAuthenticated)
            {
                offline = false;
                Mgr     = new DomesticInvoicePaymentManager(Lang, UserManager.FindById(User.Identity.GetUserId()));
            }
            else
            {
                offline = true;
                Mgr     = new OfflineDomesticInvoicePaymentManager(Lang);
            }

            DomesticInvoice invoice = await Mgr.GetDomesticInvoice(id);

            if (invoice == null)
            {
                return(HttpNotFound());
            }

            if (invoice.IsPaid)
            {
                var resultMsg = IndividualPaidDomesticInvoice(id, offline);
                return(View("Warning", resultMsg));
            }

            ViewBag.Offline = offline;
            return(View(invoice));
        }
Beispiel #3
0
        public async Task <ActionResult> IndividualOnlineResponse(string InvoiceId)
        {
            DomesticInvoicePaymentManager Mgr; bool offline;

            if (Request.IsAuthenticated && User.Identity.IsAuthenticated)
            {
                offline = false;
                Mgr     = new DomesticInvoicePaymentManager(Lang, UserManager.FindById(User.Identity.GetUserId()));
            }
            else
            {
                offline = true;
                Mgr     = new OfflineDomesticInvoicePaymentManager(Lang);
            }
            ViewBag.Offline = offline;

            DomesticInvoice invoice = await Mgr.GetDomesticInvoice(InvoiceId);


            var paymentResponse = Mgr.GetPaymentResponse(Request.QueryString["id"].ToString());

            if (paymentResponse.Status == HyperPayStatus.Success)
            {
                // Add Succeed Transaction to LaborServices Db
                var transaction = Mgr.AddSuccessTransaction(invoice.CustomerId, invoice.Number, InvoiceId, invoice.InvoiceAmount.Value, paymentResponse);

                // Add reciept voucher & Update Invoice IsPaid Field
                var response = await Mgr.CreateReceiptVoucher(invoice);

                if (response.StatusCode == HttpStatusCode.OK)
                {
                    // success CRM voucher creation
                    transaction.IsVoucherSaved = true;
                    Mgr.UpdatePaymentTransaction(transaction);
                }
                else
                {
                    // fail CRM voucher creation
                    Mgr.SaveFailedReceiptVoucher(response.Result, transaction.Id);
                }
                // return success msg
                return(View("Success", IndividualSuccessOnlinePayment(InvoiceId, offline)));
            }
            else
            {
                // Add Failed Transaction to LaborServices Db
                Mgr.AddFailTransaction(invoice.CustomerId, invoice.Number, InvoiceId, invoice.InvoiceAmount.Value, paymentResponse);

                // return fail msg
                return(View("Failure", PaymentFailureMsg(InvoiceId, paymentResponse.Reason,
                                                         Url.Action("IndividualOnlinePayment", "Pay", new { id = InvoiceId, lang = LangCode }))));
            }
        }
Beispiel #4
0
        public async Task <ActionResult> IndividualOnlinePayment(string id)
        {
            DomesticInvoicePaymentManager Mgr; bool offline;

            if (Request.IsAuthenticated && User.Identity.IsAuthenticated)
            {
                offline = false;
                Mgr     = new DomesticInvoicePaymentManager(Lang, UserManager.FindById(User.Identity.GetUserId()));
            }
            else
            {
                offline = true;
                Mgr     = new OfflineDomesticInvoicePaymentManager(Lang);
            }

            DomesticInvoice invoice = await Mgr.GetDomesticInvoice(id);

            //System.Globalization.CultureInfo enUS = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");
            //DateTime tempdate;
            //string s = invoice.DueDate.Value.ToString("dd-MM-yyyy", enUS);
            //tempdate = DateTime.Parse(s);
            //invoice.DueDate = tempdate;
            if (invoice == null)
            {
                return(HttpNotFound());
            }

            if (invoice.IsPaid)
            {
                var resultMsg = IndividualPaidDomesticInvoice(id, offline);
                return(View("Warning", resultMsg));
            }

            ViewBag.Offline = offline;


            var _responseData = Mgr.CheckOutRequestToPayOnline(invoice.CustomerMobilePhone, invoice.Number, invoice.InvoiceAmount.Value);

            ViewBag.CheckoutId = _responseData["id"];

            return(View(invoice));
        }