From 50dce1d42e6a81d801127d94466d2ba28475cb7e Mon Sep 17 00:00:00 2001 From: enisn Date: Mon, 18 Oct 2021 14:16:14 +0300 Subject: [PATCH] Add IPaymentUrlBuilder --- .../Pages/Payment/Checkout.cshtml.cs | 5 +++++ .../PaymentRequest/IPaymentUrlBuilder.cs | 9 ++++++++ .../PaymentRequest/PaymentUrlBuilder.cs | 22 +++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 modules/payment/src/Payment.Web/PaymentRequest/IPaymentUrlBuilder.cs create mode 100644 modules/payment/src/Payment.Web/PaymentRequest/PaymentUrlBuilder.cs diff --git a/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs b/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs index 732d2b2..9d8385e 100644 --- a/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs +++ b/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs @@ -27,6 +27,11 @@ namespace Payment.Web.Pages.Payment public async Task OnPostAsync() { PaymentRequest = await _paymentRequestAppService.GetAsync(PaymentRequestId); + + // TODO: Redirect from here. + + + } } } \ No newline at end of file diff --git a/modules/payment/src/Payment.Web/PaymentRequest/IPaymentUrlBuilder.cs b/modules/payment/src/Payment.Web/PaymentRequest/IPaymentUrlBuilder.cs new file mode 100644 index 0000000..b71880e --- /dev/null +++ b/modules/payment/src/Payment.Web/PaymentRequest/IPaymentUrlBuilder.cs @@ -0,0 +1,9 @@ +using System; + +namespace Payment.Web.PaymentRequest +{ + public interface IPaymentUrlBuilder + { + Uri BuildCheckoutUrl(Guid paymentRequestId); + } +} \ No newline at end of file diff --git a/modules/payment/src/Payment.Web/PaymentRequest/PaymentUrlBuilder.cs b/modules/payment/src/Payment.Web/PaymentRequest/PaymentUrlBuilder.cs new file mode 100644 index 0000000..3398911 --- /dev/null +++ b/modules/payment/src/Payment.Web/PaymentRequest/PaymentUrlBuilder.cs @@ -0,0 +1,22 @@ +using Microsoft.Extensions.Options; +using System; +using Volo.Abp.DependencyInjection; +using Volo.Abp.UI.Navigation.Urls; + +namespace Payment.Web.PaymentRequest +{ + public class PaymentUrlBuilder : ITransientDependency, IPaymentUrlBuilder + { + private readonly AppUrlOptions urlOptions; + + public PaymentUrlBuilder(IOptions urlOptions) + { + this.urlOptions = urlOptions.Value; + } + + public virtual Uri BuildCheckoutUrl(Guid paymentRequestId) + { + return new Uri(urlOptions.Applications["MVC"].RootUrl.EnsureEndsWith('/') + "Payment/Checkout?paymentRequestId=" + paymentRequestId); + } + } +}