Пример #1
0
        public ActionResult Index()
        {
            // Create new payment viewmodel and load issuers with ideal service.
            // Normally the list of issuers should be cached and refreshed once a day
            var paymentViewModel = new PaymentViewModel();
            paymentViewModel.SetIssuers(_iDealService.SendDirectoryRequest().Issuers);

            return View(paymentViewModel);
        }
Пример #2
0
        public ActionResult Index(PaymentViewModel paymentViewModel)
        {
            if (ModelState.IsValid)
            {
                // Send transaction request to selected issuer
                var transactionResponse = _iDealService.SendTransactionRequest(
                    issuerId: paymentViewModel.Issuer, 
                    merchantReturnUrl: Url.Action("Status", "Home", null, Request.Url.Scheme, null), 
                    purchaseId: Guid.NewGuid().ToString().Substring(0, 16), 
                    amount: (int)paymentViewModel.Amount * 100, 
                    expirationPeriod: TimeSpan.FromMinutes(5), 
                    description: "Test payment",
                    entranceCode: Guid.NewGuid().ToString().Substring(0, 16));

                // Redirect user to transaction page of issuer
                Response.Redirect(transactionResponse.IssuerAuthenticationUrl);
            }

            paymentViewModel.SetIssuers(_iDealService.SendDirectoryRequest().Issuers);

            return View(paymentViewModel);
        }