예제 #1
0
        public ActionResult Pay(decimal amount, string type, int loanId, int rolloverId)
        {
            try {
                log.Msg("Payment request for customer id {0}, amount {1}", this.context.Customer.Id, amount);

                amount = CalculateRealAmount(type, loanId, amount);
                if (amount < 0)
                {
                    return(View("Error"));
                }

                var oCustomer = this.context.Customer;

                PayPointFacade payPointFacade = new PayPointFacade(
                    oCustomer.MinOpenLoanDate(),
                    oCustomer.CustomerOrigin.Name
                    );

                int      payPointCardExpiryMonths = payPointFacade.PayPointAccount.CardExpiryMonths;
                DateTime cardMinExpiryDate        = DateTime.UtcNow.AddMonths(payPointCardExpiryMonths);

                var callback = Url.Action("Callback", "Paypoint", new {
                    Area = "Customer",
                    loanId,
                    type,
                    username          = (this.context.User != null ? this.context.User.Name : ""),
                    cardMinExpiryDate = FormattingUtils.FormatDateToString(cardMinExpiryDate),
                    hideSteps         = true,
                    payEarly          = true,
                    origin            = oCustomer.CustomerOrigin.Name
                }, "https");

                var url = payPointFacade.GeneratePaymentUrl(oCustomer, amount, callback);

                this.logRepository.Log(
                    this.context.UserId,
                    DateTime.UtcNow,
                    "Paypoint Pay Redirect to " + url,
                    "Successful",
                    ""
                    );

                return(Redirect(url));
            } catch (Exception e) {
                log.Alert(
                    e,
                    "Error while executing Pay(amount = {0}, type = '{1}', loan id = {2}, rollover id = {3}).",
                    amount,
                    type,
                    loanId,
                    rolloverId
                    );
                return(View("Error"));
            }     // try
        }         // Pay
예제 #2
0
        public RedirectResult AddPayPoint(int id)
        {
            var            oCustomer                = this.customersRepository.Get(id);
            PayPointFacade payPointFacade           = new PayPointFacade(oCustomer.MinOpenLoanDate(), oCustomer.CustomerOrigin.Name);
            int            payPointCardExpiryMonths = payPointFacade.PayPointAccount.CardExpiryMonths;
            DateTime       cardMinExpiryDate        = DateTime.UtcNow.AddMonths(payPointCardExpiryMonths);
            var            callback = Url.Action("PayPointCallback", "PaymentAccounts", new { Area = "Underwriter", customerId = id, cardMinExpiryDate = FormattingUtils.FormatDateToString(cardMinExpiryDate), hideSteps = true }, "https");

            var url = payPointFacade.GeneratePaymentUrl(oCustomer, 5.00m, callback);

            return(Redirect(url));
        }
예제 #3
0
        public RedirectResult GetTransactionId(decimal loan_amount, int loanType, int repaymentPeriod)
        {
            Customer customer = this.context.Customer;

            CheckCustomerStatus(customer);

            if (loan_amount < 0)
            {
                loan_amount = (int)Math.Floor(customer.CreditSum ?? 0);
            }

            var cr = customer.LastCashRequest;

            PayPointFacade payPointFacade = new PayPointFacade(customer.MinOpenLoanDate(), customer.CustomerOrigin.Name);

            if (customer.IsLoanTypeSelectionAllowed == 1)
            {
                var oDBHelper = ObjectFactory.GetInstance <IDatabaseDataHelper>() as DatabaseDataHelper;
                cr.RepaymentPeriod = repaymentPeriod;
                cr.LoanType        = oDBHelper.LoanTypeRepository.Get(loanType);
            } // if

            DateTime cardMinExpiryDate = DateTime.UtcNow.AddMonths(payPointFacade.PayPointAccount.CardExpiryMonths);

            var fee = new SetupFeeCalculator(cr.ManualSetupFeePercent, cr.BrokerSetupFeePercent).Calculate(loan_amount).Total;

            string callback = Url.Action("PayPointCallback", "GetCash",
                                         new {
                Area = "Customer",
                loan_amount,
                fee,
                username          = this.context.User.Name,
                cardMinExpiryDate = FormattingUtils.FormatDateToString(cardMinExpiryDate),
                origin            = customer.CustomerOrigin.Name
            },
                                         "https");

            string url = payPointFacade.GeneratePaymentUrl(customer, 5.00m, callback);

            this.logRepository.Log(this.context.UserId, DateTime.Now, "Paypoint GetCash Redirect to " + url, "Successful", "");
            return(Redirect(url));
        }
예제 #4
0
        }         // SetDefaultCard

        public RedirectResult AddPayPoint()
        {
            var            oCustomer                = m_oContext.Customer;
            PayPointFacade payPointFacade           = new PayPointFacade(oCustomer.MinOpenLoanDate(), oCustomer.CustomerOrigin.Name);
            int            payPointCardExpiryMonths = payPointFacade.PayPointAccount.CardExpiryMonths;
            DateTime       cardMinExpiryDate        = DateTime.UtcNow.AddMonths(payPointCardExpiryMonths);
            var            callback = Url.Action("PayPointCallback", "Profile",
                                                 new {
                Area              = "Customer",
                customerId        = oCustomer.Id,
                cardMinExpiryDate = FormattingUtils.FormatDateToString(cardMinExpiryDate),
                hideSteps         = true,
                origin            = oCustomer.CustomerOrigin.Name
            }, "https");



            var url = payPointFacade.GeneratePaymentUrl(oCustomer, 5.00m, callback);

            return(Redirect(url));
        }         // AddPayPoint