예제 #1
0
        public IActionResult Purchase(string amazonCheckoutSessionId)
        {
            var returnUrl = Url.Action("Complete", null, null, Request.Scheme);

            var checkoutSession = _amazonPayHelper.UpdateCheckoutSession(
                checkoutSessionId: amazonCheckoutSessionId,
                merchantReferenceId: "SAMPLE-" + amazonCheckoutSessionId,
                amount: Amount,
                checkoutResultReturnUrl: returnUrl);

            // OK
            if (checkoutSession.Success &&
                !string.IsNullOrEmpty(checkoutSession.WebCheckoutDetails.AmazonPayRedirectUrl))
            {
                return(Redirect(checkoutSession.WebCheckoutDetails.AmazonPayRedirectUrl));
            }

            // NG
            var model = new FrontConfirmViewModel
            {
                CheckoutSession = checkoutSession
            };

            return(View("Confirm", model));
        }
예제 #2
0
        public IActionResult Confirm(string amazonCheckoutSessionId)
        {
            if (amazonCheckoutSessionId == null)
            {
                throw new ArgumentNullException(nameof(amazonCheckoutSessionId));
            }

            var model = new FrontConfirmViewModel
            {
                CheckoutSession = _amazonPayHelper.GetCheckoutSession(amazonCheckoutSessionId)
            };

            return(View(model));
        }