예제 #1
0
        public async Task <IActionResult> Order(
            [FromServices] IEmailSink emailSink,
            [FromServices] IWebHostEnvironment env,
            [FromServices] GetOrder getOrder)
        {
            if (env.IsProduction())
            {
                return(Ok());
            }

            var order          = getOrder.Do("dummy");
            var templatePath   = Path.Combine(env.WebRootPath, "email-templates", "order.liquid");
            var templateString = await System.IO.File.ReadAllTextAsync(templatePath);

            var template = Template.Parse(templateString);

            await emailSink.SendAsync(new EmailRequest
            {
                Subject = "Test",
                To      = "*****@*****.**",
                Message = template.Render(Hash.FromAnonymousObject(ToAnon(order))),
                Html    = true,
            });

            return(Ok());
        }
예제 #2
0
        public IActionResult OnGet(string id,
                                   [FromServices] GetOrder getOrder)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(RedirectToPage("/Index"));
            }

            Order = getOrder.Do(id);

            if (Order == null)
            {
                return(RedirectToPage("/Index"));
            }

            return(Page());
        }
예제 #3
0
        private async Task <IActionResult> ReturnToPayment(string orderNumber)
        {
            var userType   = GetUserType();
            var isBusiness = userType != "user";

            var PaymentReference = Guid.NewGuid().ToString();

            var order = _getOrder.Do(orderNumber);

            var redirectUrl = _payment.GetRedirectLink(new OneOffPayment.Request
            {
                BuyerEmail = GetUserEmail(),
                //PaymentReference = PaymentReference,
                PaymentReference = order.OrderNumber,
                TotalValue       = order.Subtotal
            });

            return(Redirect(redirectUrl));
        }
예제 #4
0
 public IActionResult GetOrder(
     int id,
     [FromServices] GetOrder getOrder) =>
 Ok(getOrder.Do(id));
예제 #5
0
 public async Task OnGet([FromServices] GetOrder getOrder, string orderRef)
 {
     Order = await getOrder.Do(orderRef);
 }
예제 #6
0
파일: Order.cshtml.cs 프로젝트: Astrank/epe
 public void OnGet([FromServices] GetOrder getOrder, string reference)
 {
     Order = getOrder.Do(reference);
 }
예제 #7
0
 public void OnGet(string refrence, [FromServices] GetOrder getOrder)
 {
     Order = getOrder.Do(refrence);
 }
예제 #8
0
 public async Task <IActionResult> GetOrder(
     int id,
     [FromServices] GetOrder getOrder) => Ok(await getOrder.Do(id));
예제 #9
0
 public void OnGet(int id, [FromServices] GetOrder getOrder)
 {
     Order = getOrder.Do(id);
 }