Browse Source

Added checkout page

pull/69/head
Halil İbrahim Kalkan 5 years ago
parent
commit
ba9000c88c
  1. 5
      modules/payment/src/Payment.Application.Contracts/PaymentRequests/IPaymentRequestAppService.cs
  2. 12
      modules/payment/src/Payment.Application/PaymentRequests/PaymentRequestAppService.cs
  3. 34
      modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml
  4. 32
      modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs
  5. 17
      modules/payment/src/Payment.Web/Pages/Payment/Index.cshtml
  6. 9
      modules/payment/src/Payment.Web/Pages/Payment/Index.cshtml.cs

5
modules/payment/src/Payment.Application.Contracts/PaymentRequests/IPaymentRequestAppService.cs

@ -1,10 +1,13 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
namespace Payment.PaymentRequests
{
public interface IPaymentRequestAppService : IApplicationService
{
Task<PaymentRequestDto> GetAsync(Guid id);
Task<PaymentRequestDto> CreateAsync(PaymentRequestCreationDto input);
}
}

12
modules/payment/src/Payment.Application/PaymentRequests/PaymentRequestAppService.cs

@ -1,4 +1,5 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
namespace Payment.PaymentRequests
{
@ -10,7 +11,14 @@ namespace Payment.PaymentRequests
{
_paymentRequestRepository = paymentRequestRepository;
}
public async Task<PaymentRequestDto> GetAsync(Guid id)
{
var paymentRequest = await _paymentRequestRepository.GetAsync(id);
return ObjectMapper.Map<PaymentRequest, PaymentRequestDto>(paymentRequest);
}
public async Task<PaymentRequestDto> CreateAsync(PaymentRequestCreationDto input)
{
var paymentRequest = new PaymentRequest(

34
modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml

@ -0,0 +1,34 @@
@page
@using Microsoft.Extensions.Localization
@using Payment.Localization
@using Payment.Web.Pages.Payment
@model Payment.Web.Pages.Payment.CheckoutPageModel
@inject IStringLocalizer<PaymentResource> L
@section scripts {
<abp-script-bundle name="@typeof(CheckoutPageModel).FullName">
<abp-script src="/client-proxies/Payment-proxy.js" />
</abp-script-bundle>
}
<h1>Checkout</h1>
<abp-card>
<abp-card-header>
<h2>Product Information</h2>
</abp-card-header>
<abp-card-body>
<ul>
<li>Product name: @Model.PaymentRequest.ProductName</li>
<li>Amount: @Model.PaymentRequest.Amount</li>
</ul>
</abp-card-body>
</abp-card>
<abp-card>
<abp-card-body>
<form method="post">
<abp-button type="submit" button-type="Primary">Complete the payment</abp-button>
</form>
</abp-card-body>
</abp-card>

32
modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs

@ -0,0 +1,32 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Payment.PaymentRequests;
namespace Payment.Web.Pages.Payment
{
public class CheckoutPageModel : PaymentPageModel
{
[BindProperty(SupportsGet = true)]
public Guid PaymentRequestId { get; set; }
public PaymentRequestDto PaymentRequest { get; set; }
private readonly IPaymentRequestAppService _paymentRequestAppService;
public CheckoutPageModel(IPaymentRequestAppService paymentRequestAppService)
{
_paymentRequestAppService = paymentRequestAppService;
}
public async Task OnGetAsync()
{
PaymentRequest = await _paymentRequestAppService.GetAsync(PaymentRequestId);
}
public async Task OnPostAsync()
{
PaymentRequest = await _paymentRequestAppService.GetAsync(PaymentRequestId);
}
}
}

17
modules/payment/src/Payment.Web/Pages/Payment/Index.cshtml

@ -1,17 +0,0 @@
@page
@using Microsoft.Extensions.Localization
@using Payment.Localization
@using Payment.Web.Pages.Payment
@model Payment.Web.Pages.Payment.IndexModel
@inject IStringLocalizer<PaymentResource> L
@section scripts {
<abp-script-bundle name="@typeof(IndexModel).FullName">
<abp-script src="/client-proxies/Payment-proxy.js" />
</abp-script-bundle>
}
@{
}
<h1>Payment</h1>
<p>@L["SamplePageMessage"]</p>

9
modules/payment/src/Payment.Web/Pages/Payment/Index.cshtml.cs

@ -1,9 +0,0 @@
namespace Payment.Web.Pages.Payment
{
public class IndexModel : PaymentPageModel
{
public void OnGet()
{
}
}
}
Loading…
Cancel
Save