Пример #1
0
        public ActionResult Create(PaymentRequest request)
        {
            if (ModelState.IsValid)
            {
                int BP_PR = _ApplicationSettingService.getPaymentRequestWorkflow();

                if (BP_PR != 0)
                {
                    BusinessProcessState createdstate = new BusinessProcessState
                    {
                        DatePerformed = DateTime.Now,
                        PerformedBy   = "System",
                        Comment       = "Created workflow for Payment Request"
                    };
                    //_PaymentRequestservice.Create(request);

                    BusinessProcess bp = _BusinessProcessService.CreateBusinessProcess(BP_PR, request.PaymentRequestID,
                                                                                       "PaymentRequest", createdstate);
                    request.BusinessProcessID = bp.BusinessProcessID;
                    request.RequestedDate     = DateTime.Now;
                    _PaymentRequestservice.Create(request);
                    //_PaymentRequestservice.Update(request);
                    return(RedirectToAction("Index"));
                }
                ViewBag.ErrorMessage1 = "The workflow assosiated with Payment Request doesnot exist.";
                ViewBag.ErrorMessage2 = "Please make sure the workflow is created and configured.";
            }
            LoadLookups();
            ModelState.AddModelError("Errors", @"Could not create Request Plan.");
            return(View(request));
        }
Пример #2
0
        private void StartNewPayment()
        {
            paymentCode = GenerateRandomAddress();

            try
            {
                var response = paymentRequestService.Create(new NewPaymentRequest
                {
                    UserId  = userProfile.UserId,
                    Amount  = 0,
                    Address = paymentCode
                });
                response.ContinueWith(r =>
                {
                    paymentRequestId = r.Result.NewPaymentRequestId;
                });
            }
            catch (Exception ex)
            {
                Crashes.TrackError(ex, new Dictionary <string, string> {
                    { "page", "receive payment" }, { "operation", "creating payment request" }
                });
            }


            string GenerateRandomAddress()
            {
                var codes  = "ABCDEF1234567890";
                var random = new Random((int)DateTime.Now.Ticks);

                return(string.Concat(Enumerable.Range(1, 32).Select(i => codes[random.Next(0, codes.Length - 1)])));
            }
        }