forked from tsai/eShopOnAbp
committed by
GitHub
65 changed files with 923 additions and 170 deletions
@ -0,0 +1,35 @@ |
|||
using System.Collections.Generic; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace EShopOnAbp.PublicWeb.Basket; |
|||
|
|||
public class UserAddressProvider : ITransientDependency |
|||
{ |
|||
public List<AddressDto> GetDemoAddresses() |
|||
{ |
|||
return new List<AddressDto>() |
|||
{ |
|||
new() |
|||
{ |
|||
Id = 1, |
|||
Name = EShopOnAbpPaymentConsts.DemoAddressTypes.Home, |
|||
Description = "Cecilia Chapman Senior 711-2880 Nulla St. Mankato Mississippi 96522/USA", |
|||
IsDefault = true |
|||
}, |
|||
new() |
|||
{ |
|||
Id = 2, |
|||
Name = EShopOnAbpPaymentConsts.DemoAddressTypes.Work, |
|||
Description = "Yeşilköy Serbest Bölge Mah. E-Blok Sokak E1 Blok No:2, Bakırköy/İstanbul" |
|||
} |
|||
}; |
|||
} |
|||
} |
|||
|
|||
public class AddressDto |
|||
{ |
|||
public int Id { get; set; } |
|||
public string Name { get; set; } |
|||
public string Description { get; set; } |
|||
public bool IsDefault { get; set; } = false; |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using EShopOnAbp.Shared.Hosting.AspNetCore; |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.Extensions.Logging; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Widgets; |
|||
using Volo.Abp.Guids; |
|||
|
|||
namespace EShopOnAbp.PublicWeb.Components.AnonymousUser; |
|||
|
|||
[Widget( |
|||
AutoInitialize = true |
|||
)] |
|||
public class AnonymousUserViewComponent : AbpViewComponent |
|||
{ |
|||
private readonly ILogger<AnonymousUserViewComponent> _logger; |
|||
private readonly IGuidGenerator _guidGenerator; |
|||
|
|||
public AnonymousUserViewComponent(ILogger<AnonymousUserViewComponent> logger, IGuidGenerator guidGenerator) |
|||
{ |
|||
_logger = logger; |
|||
_guidGenerator = guidGenerator; |
|||
} |
|||
|
|||
public async Task<IViewComponentResult> InvokeAsync() |
|||
{ |
|||
// Get anonymous user id from cookie
|
|||
HttpContext.Request.Cookies.TryGetValue(EShopConstants.AnonymousUserClaimName, |
|||
out string anonymousUserId); |
|||
_logger.LogInformation($"========= Anonymous User Id from Cookie:{anonymousUserId} ========= "); |
|||
|
|||
// Generate new id for anonymous user
|
|||
if (string.IsNullOrEmpty(anonymousUserId)) |
|||
{ |
|||
anonymousUserId = _guidGenerator.Create().ToString(); |
|||
HttpContext.Response.Cookies.Append(EShopConstants.AnonymousUserClaimName, anonymousUserId, |
|||
new CookieOptions |
|||
{ |
|||
SameSite = SameSiteMode.Lax |
|||
}); |
|||
_logger.LogInformation( |
|||
$"========= Generated new User Id:{anonymousUserId} ========= APPENDED TO COOKIE ====== "); |
|||
} |
|||
return await Task.FromResult(View("~/Components/AnonymousUser/Default.cshtml")); |
|||
} |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
<div> |
|||
|
|||
</div> |
|||
@ -0,0 +1,54 @@ |
|||
@using EShopOnAbp.Localization |
|||
@using EShopOnAbp.PublicWeb.Components.Purchase |
|||
@using Microsoft.Extensions.Localization |
|||
@model EShopOnAbp.PublicWeb.Components.Payment.PaymentViewModel |
|||
|
|||
@inject IStringLocalizer<EShopOnAbpResource> L |
|||
|
|||
@{ |
|||
const int defaultColumnSize = 4; |
|||
} |
|||
|
|||
<div class="row"> |
|||
<div class="col-lg-9"> |
|||
<div class="address-list p-5"> |
|||
<h3>Select Address</h3> |
|||
@for (int i = 0; i < Math.Ceiling(Model.Address.Count / (double) defaultColumnSize); i++) |
|||
{ |
|||
<abp-row> |
|||
@for (int j = 0; j < defaultColumnSize; j++) |
|||
{ |
|||
<abp-column size-lg="_3" size-md="_4" size-sm="_6"> |
|||
@if (i * defaultColumnSize + j < Model.Address.Count) |
|||
{ |
|||
var address = Model.Address[(i * defaultColumnSize) + j]; |
|||
string isSelected = address.IsDefault ? "is-selected" : string.Empty; |
|||
<div class="card @isSelected" data-address-id="@address.Id"> |
|||
<div class="card-body"> |
|||
<h4 class="card-title">@address.Name</h4> |
|||
<p class="card-text">@address.Description</p> |
|||
</div> |
|||
</div> |
|||
} |
|||
</abp-column> |
|||
} |
|||
</abp-row> |
|||
} |
|||
</div> |
|||
|
|||
<div class="payment-list p-5"> |
|||
<h3>Select Payment Method</h3> |
|||
<abp-row> |
|||
<abp-column size-lg="_3" size-md="_4" size-sm="_6"> |
|||
<abp-card> |
|||
<img class="" src="https://upload.wikimedia.org/wikipedia/commons/b/b5/PayPal.svg" alt="paypal logo"> |
|||
</abp-card> |
|||
</abp-column> |
|||
</abp-row> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-3"> |
|||
@await Component.InvokeAsync(typeof(PurchaseWidgetViewComponent), |
|||
new {Basket = Model.Basket, ButtonDescription = "CompleteOrder"}) |
|||
</div> |
|||
</div> |
|||
@ -0,0 +1,15 @@ |
|||
using System.Collections.Generic; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bundling; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Packages.SignalR; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace EShopOnAbp.PublicWeb.Components.Payment; |
|||
|
|||
[DependsOn(typeof(SignalRBrowserScriptContributor))] |
|||
public class PaymentWidgetScriptContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
context.Files.AddIfNotContains("/components/payment/payment-widget.js"); |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
using System.Collections.Generic; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bundling; |
|||
|
|||
namespace EShopOnAbp.PublicWeb.Components.Payment; |
|||
|
|||
public class PaymentWidgetStyleContributor: BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
context.Files.AddIfNotContains("/components/payment/payment-widget.css"); |
|||
} |
|||
} |
|||
@ -0,0 +1,43 @@ |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using EShopOnAbp.BasketService; |
|||
using EShopOnAbp.PublicWeb.Basket; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Widgets; |
|||
|
|||
namespace EShopOnAbp.PublicWeb.Components.Payment; |
|||
|
|||
[Widget( |
|||
AutoInitialize = true, |
|||
RefreshUrl = "/Widgets/Payment", |
|||
StyleTypes = new[] {typeof(PaymentWidgetStyleContributor)}, |
|||
ScriptTypes = new[] {typeof(PaymentWidgetScriptContributor)} |
|||
)] |
|||
public class PaymentWidgetViewComponent : AbpViewComponent |
|||
{ |
|||
private readonly UserBasketProvider _userBasketProvider; |
|||
private readonly UserAddressProvider _userAddressProvider; |
|||
|
|||
public PaymentWidgetViewComponent(UserBasketProvider userBasketProvider, UserAddressProvider userAddressProvider) |
|||
{ |
|||
_userBasketProvider = userBasketProvider; |
|||
_userAddressProvider = userAddressProvider; |
|||
} |
|||
|
|||
public async Task<IViewComponentResult> InvokeAsync() |
|||
{ |
|||
var viewModel = new PaymentViewModel() |
|||
{ |
|||
Basket = await _userBasketProvider.GetBasketAsync(), |
|||
Address = _userAddressProvider.GetDemoAddresses() |
|||
}; |
|||
return View("~/Components/Payment/Default.cshtml", viewModel); |
|||
} |
|||
} |
|||
|
|||
public class PaymentViewModel |
|||
{ |
|||
public BasketDto Basket { get; set; } |
|||
public List<AddressDto> Address { get; set; } |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
namespace EShopOnAbp.PublicWeb |
|||
{ |
|||
public static class EShopOnAbpPaymentConsts |
|||
{ |
|||
public const string Currency = "USD"; |
|||
|
|||
public static class DemoAddressTypes |
|||
{ |
|||
public const string Work = "Work"; |
|||
public const string Home = "Home"; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
using AutoMapper; |
|||
using EShopOnAbp.BasketService; |
|||
using EShopOnAbp.PaymentService; |
|||
|
|||
namespace EShopOnAbp.PublicWeb |
|||
{ |
|||
public class EShopOnAbpPublicAutoMapperProfile : Profile |
|||
{ |
|||
public EShopOnAbpPublicAutoMapperProfile() |
|||
{ |
|||
CreateMap<BasketItemDto, PaymentRequestProductCreationDto>() |
|||
.ForMember(p => p.ReferenceId, opts => opts.MapFrom(p => p.ProductId.ToString())) |
|||
.ForMember(p => p.Name, opts => opts.MapFrom(p => p.ProductName)) |
|||
.ForMember(p => p.UnitPrice, opts => opts.MapFrom(p => p.TotalPrice / p.Count)) |
|||
.ForMember(p => p.Quantity, opts => opts.MapFrom(p => p.Count)); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
namespace EShopOnAbp.PublicWeb |
|||
{ |
|||
public class EShopOnAbpPublicWebPaymentOptions |
|||
{ |
|||
public string PaymentSuccessfulCallbackUrl { get; set; } |
|||
public string PaymentFailureCallbackUrl { get; set; } |
|||
} |
|||
} |
|||
@ -1,10 +1,14 @@ |
|||
@page |
|||
|
|||
@using EShopOnAbp.Localization |
|||
@using EShopOnAbp.PublicWeb.Components.Payment |
|||
@using Microsoft.Extensions.Localization |
|||
@model EShopOnAbp.PublicWeb.Pages.PaymentModel |
|||
|
|||
@inject IStringLocalizer<EShopOnAbpResource> L |
|||
|
|||
<div class="row"> |
|||
<h3 class="pt-5 pb-4 text-center">@L["Payment"]</h3> |
|||
@* <h3 class="pt-5 pb-4 text-center">@L["Payment"]</h3> *@ |
|||
<div id="PaymentArea" class="pt-5"> |
|||
@await Component.InvokeAsync(typeof(PaymentWidgetViewComponent)) |
|||
</div> |
|||
</div> |
|||
@ -1,10 +1,59 @@ |
|||
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; |
|||
using EShopOnAbp.BasketService; |
|||
using EShopOnAbp.PaymentService; |
|||
using EShopOnAbp.PaymentService.PaymentRequests; |
|||
using EShopOnAbp.PublicWeb.Basket; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.Extensions.Logging; |
|||
using Microsoft.Extensions.Options; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; |
|||
using Volo.Abp.Users; |
|||
|
|||
namespace EShopOnAbp.PublicWeb.Pages; |
|||
|
|||
[Authorize] |
|||
public class PaymentModel : AbpPageModel |
|||
{ |
|||
private readonly IPaymentRequestAppService _paymentRequestAppService; |
|||
private readonly UserBasketProvider _userBasketProvider; |
|||
private readonly EShopOnAbpPublicWebPaymentOptions _publicWebPaymentOptions; |
|||
|
|||
public PaymentModel( |
|||
IPaymentRequestAppService paymentRequestAppService, |
|||
UserBasketProvider userBasketProvider, |
|||
IOptions<EShopOnAbpPublicWebPaymentOptions> publicWebPaymentOptions) |
|||
{ |
|||
_paymentRequestAppService = paymentRequestAppService; |
|||
_userBasketProvider = userBasketProvider; |
|||
_publicWebPaymentOptions = publicWebPaymentOptions.Value; |
|||
} |
|||
|
|||
public void OnGet() |
|||
{ |
|||
} |
|||
|
|||
public async Task<IActionResult> OnPostAsync() |
|||
{ |
|||
Logger.LogInformation("Payment Proceeded..."); |
|||
|
|||
var basket = await _userBasketProvider.GetBasketAsync(); |
|||
|
|||
var paymentRequest = await _paymentRequestAppService.CreateAsync(new PaymentRequestCreationDto |
|||
{ |
|||
BuyerId = CurrentUser.GetId().ToString(), |
|||
Currency = EShopOnAbpPaymentConsts.Currency, |
|||
Products = ObjectMapper.Map<List<BasketItemDto>, List<PaymentRequestProductCreationDto>>(basket.Items) |
|||
}); |
|||
|
|||
var response = await _paymentRequestAppService.StartAsync(new PaymentRequestStartDto |
|||
{ |
|||
PaymentRequestId = paymentRequest.Id, |
|||
ReturnUrl = _publicWebPaymentOptions.PaymentSuccessfulCallbackUrl, |
|||
CancelUrl = _publicWebPaymentOptions.PaymentFailureCallbackUrl, |
|||
}); |
|||
|
|||
return Redirect(response.CheckoutLink); |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
@page |
|||
@model EShopOnAbp.PublicWeb.Pages.PaymentCompletedModel |
|||
|
|||
<div> |
|||
|
|||
@if (Model.IsSuccessful) |
|||
{ |
|||
<h1>Thank you for the payment!</h1> |
|||
<hr /> |
|||
<h1>Purchase completed!</h1> |
|||
<hr /> |
|||
<h3>click <a href="/">here</a> to return to home page</h3> |
|||
|
|||
} |
|||
|
|||
</div> |
|||
@ -0,0 +1,32 @@ |
|||
using EShopOnAbp.PaymentService.PaymentRequests; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; |
|||
|
|||
namespace EShopOnAbp.PublicWeb.Pages; |
|||
|
|||
[Authorize] |
|||
public class PaymentCompletedModel : AbpPageModel |
|||
{ |
|||
private readonly IPaymentRequestAppService _paymentRequestAppService; |
|||
|
|||
public PaymentCompletedModel(IPaymentRequestAppService paymentRequestAppService) |
|||
{ |
|||
_paymentRequestAppService = paymentRequestAppService; |
|||
} |
|||
|
|||
[BindProperty(SupportsGet = true)] |
|||
public string Token { get; set; } |
|||
|
|||
public PaymentRequestDto PaymentRequest { get; private set; } |
|||
|
|||
public bool IsSuccessful { get; private set; } |
|||
|
|||
public async Task OnGetAsync() |
|||
{ |
|||
PaymentRequest = await _paymentRequestAppService.CompleteAsync(Token); |
|||
|
|||
IsSuccessful = PaymentRequest.State == PaymentRequestState.Completed; |
|||
} |
|||
} |
|||
@ -1,5 +1,7 @@ |
|||
@using Volo.Abp.AspNetCore.Mvc.UI.Theming |
|||
@using EShopOnAbp.PublicWeb.Components.AnonymousUser |
|||
@using Volo.Abp.AspNetCore.Mvc.UI.Theming |
|||
@inject IThemeManager ThemeManager |
|||
@{ |
|||
Layout = ThemeManager.CurrentTheme.GetPublicLayout(); |
|||
} |
|||
@await Component.InvokeAsync(typeof(AnonymousUserViewComponent)) |
|||
@ -0,0 +1,20 @@ |
|||
.card { |
|||
/* Add shadows to create the "card" effect */ |
|||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); |
|||
transition: 0.3s; |
|||
} |
|||
|
|||
/* On mouse-over, add a deeper shadow */ |
|||
.card:hover { |
|||
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2); |
|||
cursor: default; |
|||
} |
|||
|
|||
/* Add some padding inside the card container */ |
|||
.card-body { |
|||
padding: 2px 16px; |
|||
} |
|||
|
|||
.is-selected { |
|||
border: solid #bfbfe3; |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
(function () { |
|||
abp.widgets.PaymentWidget = function ($wrapper) { |
|||
var widgetManager = $wrapper.data('abp-widget-manager'); |
|||
|
|||
var init = function (filters) { |
|||
$wrapper |
|||
.find('.address-list .card') |
|||
.click(function () { |
|||
var $this = $(this); |
|||
var addressId = $this.attr('data-address-id'); |
|||
abp.utils.setCookieValue("selected-address", addressId); |
|||
$this.parents(".address-list").find('.card').removeClass("is-selected"); |
|||
$this.addClass("is-selected"); |
|||
}); |
|||
}; |
|||
|
|||
return { |
|||
init: init |
|||
}; |
|||
}; |
|||
})(); |
|||
@ -1,8 +0,0 @@ |
|||
using System.Collections.Generic; |
|||
|
|||
namespace EShopOnAbp.BasketService; |
|||
|
|||
public class OrderAcceptedEto |
|||
{ |
|||
public List<OrderItemEto> Items { get; set; } |
|||
} |
|||
@ -1,9 +0,0 @@ |
|||
using System; |
|||
|
|||
namespace EShopOnAbp.BasketService; |
|||
|
|||
public class OrderItemEto |
|||
{ |
|||
public Guid ProductId { get; set; } |
|||
public int Count { get; set; } |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
using EShopOnAbp.OrderingService.Orders; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.EventBus.Distributed; |
|||
|
|||
namespace EShopOnAbp.BasketService.Orders |
|||
{ |
|||
public class OrderAcceptedEventHandler : |
|||
IDistributedEventHandler<OrderAcceptedEto>, |
|||
ITransientDependency |
|||
{ |
|||
private readonly IBasketRepository _basketRepository; |
|||
|
|||
public OrderAcceptedEventHandler(IBasketRepository basketRepository) |
|||
{ |
|||
_basketRepository = basketRepository; |
|||
} |
|||
|
|||
public async Task HandleEventAsync(OrderAcceptedEto eventData) |
|||
{ |
|||
var basket = await _basketRepository.GetAsync(eventData.BuyerId); |
|||
basket.Clear(); |
|||
await _basketRepository.UpdateAsync(basket); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Volo.Abp.Domain.Entities.Events.Distributed; |
|||
using Volo.Abp.EventBus; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Orders |
|||
{ |
|||
[Serializable] |
|||
[EventName("EShopOnAbp.Order.Accepted")] |
|||
public class OrderAcceptedEto : EtoBase |
|||
{ |
|||
public Guid OrderId { get; set; } |
|||
public Guid BuyerId { get; set; } |
|||
public List<OrderItemEto> Items { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace EShopOnAbp.OrderingService.Orders |
|||
{ |
|||
public class OrderItemEto |
|||
{ |
|||
public Guid ProductId { get; set; } |
|||
public int Count { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,45 @@ |
|||
using EShopOnAbp.OrderingService.Orders; |
|||
using EShopOnAbp.PaymentService.PaymentRequests; |
|||
using System; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Domain.Repositories; |
|||
using Volo.Abp.EventBus.Distributed; |
|||
|
|||
namespace EShopOnAbp.OrderingService.PaymentRequests |
|||
{ |
|||
public class PaymentRequestEventHandler : |
|||
IDistributedEventHandler<PaymentRequestCompletedEto>, |
|||
ITransientDependency |
|||
{ |
|||
private readonly IDistributedEventBus _eventBus; |
|||
|
|||
public PaymentRequestEventHandler(IDistributedEventBus eventBus) |
|||
{ |
|||
_eventBus = eventBus; |
|||
} |
|||
|
|||
public async Task HandleEventAsync(PaymentRequestCompletedEto eventData) |
|||
{ |
|||
// TODO: Insert Order here.
|
|||
//throw new NotImplementedException();
|
|||
|
|||
await _eventBus.PublishAsync(new OrderAcceptedEto |
|||
{ |
|||
Items = eventData.Products.Select(MapProductToOrderItem).ToList(), |
|||
BuyerId = Guid.Parse(eventData.BuyerId), |
|||
OrderId = Guid.Empty, // TODO: Inserted OrderId,
|
|||
}); |
|||
} |
|||
|
|||
private static OrderItemEto MapProductToOrderItem(PaymentRequestProductEto arg) |
|||
{ |
|||
return new OrderItemEto |
|||
{ |
|||
Count = arg.Quantity, |
|||
ProductId = Guid.Parse(arg.ReferenceId) |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using Volo.Abp.Domain.Entities.Events.Distributed; |
|||
using Volo.Abp.EventBus; |
|||
|
|||
namespace EShopOnAbp.PaymentService.PaymentRequests |
|||
{ |
|||
[EventName("EShopOnAbp.Payment.Completed")] |
|||
public class PaymentCompletedEto : EtoBase |
|||
{ |
|||
public PaymentRequestDto PaymentRequest { get; set; } |
|||
} |
|||
} |
|||
@ -1,15 +1,25 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.Domain.Entities.Events.Distributed; |
|||
using Volo.Abp.EventBus; |
|||
|
|||
namespace EShopOnAbp.PaymentService |
|||
namespace EShopOnAbp.PaymentService.PaymentRequests |
|||
{ |
|||
[Serializable] |
|||
[EventName("Payment.Completed")] |
|||
public class PaymentRequestCompletedEto: EtoBase, IHasExtraProperties |
|||
[EventName("EShopOnAbp.Payment.Completed")] |
|||
public class PaymentRequestCompletedEto : EtoBase, IHasExtraProperties |
|||
{ |
|||
public Guid PaymentRequestId { get; set; } |
|||
|
|||
public string Currency { get; set; } |
|||
|
|||
public string BuyerId { get; set; } |
|||
|
|||
public PaymentRequestState State { get; set; } |
|||
|
|||
public ICollection<PaymentRequestProductEto> Products { get; set; } = new List<PaymentRequestProductEto>(); |
|||
|
|||
public ExtraPropertyDictionary ExtraProperties { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
using System; |
|||
|
|||
namespace EShopOnAbp.PaymentService.PaymentRequests |
|||
{ |
|||
[Serializable] |
|||
public class PaymentRequestProductEto |
|||
{ |
|||
public string ReferenceId { get; set; } |
|||
|
|||
public string Name { get; set; } |
|||
|
|||
public decimal UnitPrice { get; set; } |
|||
|
|||
public int Quantity { get; set; } |
|||
|
|||
public decimal TotalPrice { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,50 @@ |
|||
// This file is automatically generated by ABP framework to use MVC Controllers from CSharp
|
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.Http.Client; |
|||
using Volo.Abp.Http.Modeling; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Http.Client.ClientProxying; |
|||
using EShopOnAbp.PaymentService.PaymentRequests; |
|||
|
|||
// ReSharper disable once CheckNamespace
|
|||
namespace EShopOnAbp.PaymentService.Controllers.ClientProxies |
|||
{ |
|||
[Dependency(ReplaceServices = true)] |
|||
[ExposeServices(typeof(IPaymentRequestAppService), typeof(PaymentRequestClientProxy))] |
|||
public partial class PaymentRequestClientProxy : ClientProxyBase<IPaymentRequestAppService>, IPaymentRequestAppService |
|||
{ |
|||
public virtual async Task<PaymentRequestDto> CompleteAsync(string token) |
|||
{ |
|||
return await RequestAsync<PaymentRequestDto>(nameof(CompleteAsync), new ClientProxyRequestTypeValue |
|||
{ |
|||
{ typeof(string), token } |
|||
}); |
|||
} |
|||
|
|||
public virtual async Task<PaymentRequestDto> CreateAsync(PaymentRequestCreationDto input) |
|||
{ |
|||
return await RequestAsync<PaymentRequestDto>(nameof(CreateAsync), new ClientProxyRequestTypeValue |
|||
{ |
|||
{ typeof(PaymentRequestCreationDto), input } |
|||
}); |
|||
} |
|||
|
|||
public virtual async Task<bool> HandleWebhookAsync(string payload) |
|||
{ |
|||
return await RequestAsync<bool>(nameof(HandleWebhookAsync), new ClientProxyRequestTypeValue |
|||
{ |
|||
{ typeof(string), payload } |
|||
}); |
|||
} |
|||
|
|||
public virtual async Task<PaymentRequestStartResultDto> StartAsync(PaymentRequestStartDto input) |
|||
{ |
|||
return await RequestAsync<PaymentRequestStartResultDto>(nameof(StartAsync), new ClientProxyRequestTypeValue |
|||
{ |
|||
{ typeof(PaymentRequestStartDto), input } |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
// This file is part of PaymentRequestClientProxy, you can customize it here
|
|||
// ReSharper disable once CheckNamespace
|
|||
namespace EShopOnAbp.PaymentService.Controllers.ClientProxies |
|||
{ |
|||
public partial class PaymentRequestClientProxy |
|||
{ |
|||
} |
|||
} |
|||
@ -1,53 +0,0 @@ |
|||
{ |
|||
"modules": { |
|||
"PaymentService": { |
|||
"rootPath": "PaymentService", |
|||
"remoteServiceName": "PaymentService", |
|||
"controllers": { |
|||
"EShopOnAbp.PaymentService.Samples.SampleController": { |
|||
"controllerName": "Sample", |
|||
"controllerGroupName": "Sample", |
|||
"type": "EShopOnAbp.PaymentService.Samples.SampleController", |
|||
"interfaces": [ |
|||
{ |
|||
"type": "EShopOnAbp.PaymentService.Samples.ISampleAppService" |
|||
} |
|||
], |
|||
"actions": { |
|||
"GetAsync": { |
|||
"uniqueName": "GetAsync", |
|||
"name": "GetAsync", |
|||
"httpMethod": "GET", |
|||
"url": "api/PaymentService/sample", |
|||
"supportedVersions": [], |
|||
"parametersOnMethod": [], |
|||
"parameters": [], |
|||
"returnValue": { |
|||
"type": "EShopOnAbp.PaymentService.Samples.SampleDto", |
|||
"typeSimple": "EShopOnAbp.PaymentService.Samples.SampleDto" |
|||
}, |
|||
"allowAnonymous": null, |
|||
"implementFrom": "EShopOnAbp.PaymentService.Samples.ISampleAppService" |
|||
}, |
|||
"GetAuthorizedAsync": { |
|||
"uniqueName": "GetAuthorizedAsync", |
|||
"name": "GetAuthorizedAsync", |
|||
"httpMethod": "GET", |
|||
"url": "api/PaymentService/sample/authorized", |
|||
"supportedVersions": [], |
|||
"parametersOnMethod": [], |
|||
"parameters": [], |
|||
"returnValue": { |
|||
"type": "EShopOnAbp.PaymentService.Samples.SampleDto", |
|||
"typeSimple": "EShopOnAbp.PaymentService.Samples.SampleDto" |
|||
}, |
|||
"allowAnonymous": false, |
|||
"implementFrom": "EShopOnAbp.PaymentService.Samples.ISampleAppService" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
"types": {} |
|||
} |
|||
@ -1,15 +0,0 @@ |
|||
// This file is automatically generated by ABP framework to use MVC Controllers from CSharp
|
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Dtos; |
|||
using Volo.Abp.Http.Client; |
|||
using Volo.Abp.Http.Modeling; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Http.Client.ClientProxying; |
|||
using EShopOnAbp.PaymentService.Samples; |
|||
|
|||
// ReSharper disable once CheckNamespace
|
|||
namespace EShopOnAbp.PaymentService.Samples.ClientProxies |
|||
{ |
|||
|
|||
} |
|||
@ -1,8 +0,0 @@ |
|||
// This file is part of SampleClientProxy, you can customize it here
|
|||
// ReSharper disable once CheckNamespace
|
|||
namespace EShopOnAbp.PaymentService.Samples.ClientProxies |
|||
{ |
|||
public partial class SampleClientProxy |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,171 @@ |
|||
{ |
|||
"modules": { |
|||
"payment": { |
|||
"rootPath": "payment", |
|||
"remoteServiceName": "PaymentService", |
|||
"controllers": { |
|||
"EShopOnAbp.PaymentService.Controllers.PaymentRequestController": { |
|||
"controllerName": "PaymentRequest", |
|||
"controllerGroupName": "PaymentRequest", |
|||
"type": "EShopOnAbp.PaymentService.Controllers.PaymentRequestController", |
|||
"interfaces": [ |
|||
{ |
|||
"type": "EShopOnAbp.PaymentService.PaymentRequests.IPaymentRequestAppService" |
|||
} |
|||
], |
|||
"actions": { |
|||
"CompleteAsyncByToken": { |
|||
"uniqueName": "CompleteAsyncByToken", |
|||
"name": "CompleteAsync", |
|||
"httpMethod": "POST", |
|||
"url": "api/payment/requests/complete", |
|||
"supportedVersions": [], |
|||
"parametersOnMethod": [ |
|||
{ |
|||
"name": "token", |
|||
"typeAsString": "System.String, System.Private.CoreLib", |
|||
"type": "System.String", |
|||
"typeSimple": "string", |
|||
"isOptional": false, |
|||
"defaultValue": null |
|||
} |
|||
], |
|||
"parameters": [ |
|||
{ |
|||
"nameOnMethod": "token", |
|||
"name": "token", |
|||
"jsonName": null, |
|||
"type": "System.String", |
|||
"typeSimple": "string", |
|||
"isOptional": false, |
|||
"defaultValue": null, |
|||
"constraintTypes": null, |
|||
"bindingSourceId": "ModelBinding", |
|||
"descriptorName": "" |
|||
} |
|||
], |
|||
"returnValue": { |
|||
"type": "EShopOnAbp.PaymentService.PaymentRequests.PaymentRequestDto", |
|||
"typeSimple": "EShopOnAbp.PaymentService.PaymentRequests.PaymentRequestDto" |
|||
}, |
|||
"allowAnonymous": null, |
|||
"implementFrom": "EShopOnAbp.PaymentService.PaymentRequests.IPaymentRequestAppService" |
|||
}, |
|||
"CreateAsyncByInput": { |
|||
"uniqueName": "CreateAsyncByInput", |
|||
"name": "CreateAsync", |
|||
"httpMethod": "POST", |
|||
"url": "api/payment/requests", |
|||
"supportedVersions": [], |
|||
"parametersOnMethod": [ |
|||
{ |
|||
"name": "input", |
|||
"typeAsString": "EShopOnAbp.PaymentService.PaymentRequests.PaymentRequestCreationDto, EShopOnAbp.PaymentService.Application.Contracts", |
|||
"type": "EShopOnAbp.PaymentService.PaymentRequests.PaymentRequestCreationDto", |
|||
"typeSimple": "EShopOnAbp.PaymentService.PaymentRequests.PaymentRequestCreationDto", |
|||
"isOptional": false, |
|||
"defaultValue": null |
|||
} |
|||
], |
|||
"parameters": [ |
|||
{ |
|||
"nameOnMethod": "input", |
|||
"name": "input", |
|||
"jsonName": null, |
|||
"type": "EShopOnAbp.PaymentService.PaymentRequests.PaymentRequestCreationDto", |
|||
"typeSimple": "EShopOnAbp.PaymentService.PaymentRequests.PaymentRequestCreationDto", |
|||
"isOptional": false, |
|||
"defaultValue": null, |
|||
"constraintTypes": null, |
|||
"bindingSourceId": "Body", |
|||
"descriptorName": "" |
|||
} |
|||
], |
|||
"returnValue": { |
|||
"type": "EShopOnAbp.PaymentService.PaymentRequests.PaymentRequestDto", |
|||
"typeSimple": "EShopOnAbp.PaymentService.PaymentRequests.PaymentRequestDto" |
|||
}, |
|||
"allowAnonymous": null, |
|||
"implementFrom": "EShopOnAbp.PaymentService.PaymentRequests.IPaymentRequestAppService" |
|||
}, |
|||
"HandleWebhookAsyncByPayload": { |
|||
"uniqueName": "HandleWebhookAsyncByPayload", |
|||
"name": "HandleWebhookAsync", |
|||
"httpMethod": "POST", |
|||
"url": "api/payment/requests/webhook", |
|||
"supportedVersions": [], |
|||
"parametersOnMethod": [ |
|||
{ |
|||
"name": "payload", |
|||
"typeAsString": "System.String, System.Private.CoreLib", |
|||
"type": "System.String", |
|||
"typeSimple": "string", |
|||
"isOptional": false, |
|||
"defaultValue": null |
|||
} |
|||
], |
|||
"parameters": [ |
|||
{ |
|||
"nameOnMethod": "payload", |
|||
"name": "payload", |
|||
"jsonName": null, |
|||
"type": "System.String", |
|||
"typeSimple": "string", |
|||
"isOptional": false, |
|||
"defaultValue": null, |
|||
"constraintTypes": null, |
|||
"bindingSourceId": "ModelBinding", |
|||
"descriptorName": "" |
|||
} |
|||
], |
|||
"returnValue": { |
|||
"type": "System.Boolean", |
|||
"typeSimple": "boolean" |
|||
}, |
|||
"allowAnonymous": null, |
|||
"implementFrom": "EShopOnAbp.PaymentService.PaymentRequests.IPaymentRequestAppService" |
|||
}, |
|||
"StartAsyncByInput": { |
|||
"uniqueName": "StartAsyncByInput", |
|||
"name": "StartAsync", |
|||
"httpMethod": "POST", |
|||
"url": "api/payment/requests/start", |
|||
"supportedVersions": [], |
|||
"parametersOnMethod": [ |
|||
{ |
|||
"name": "input", |
|||
"typeAsString": "EShopOnAbp.PaymentService.PaymentRequests.PaymentRequestStartDto, EShopOnAbp.PaymentService.Application.Contracts", |
|||
"type": "EShopOnAbp.PaymentService.PaymentRequests.PaymentRequestStartDto", |
|||
"typeSimple": "EShopOnAbp.PaymentService.PaymentRequests.PaymentRequestStartDto", |
|||
"isOptional": false, |
|||
"defaultValue": null |
|||
} |
|||
], |
|||
"parameters": [ |
|||
{ |
|||
"nameOnMethod": "input", |
|||
"name": "input", |
|||
"jsonName": null, |
|||
"type": "EShopOnAbp.PaymentService.PaymentRequests.PaymentRequestStartDto", |
|||
"typeSimple": "EShopOnAbp.PaymentService.PaymentRequests.PaymentRequestStartDto", |
|||
"isOptional": false, |
|||
"defaultValue": null, |
|||
"constraintTypes": null, |
|||
"bindingSourceId": "Body", |
|||
"descriptorName": "" |
|||
} |
|||
], |
|||
"returnValue": { |
|||
"type": "EShopOnAbp.PaymentService.PaymentRequests.PaymentRequestStartResultDto", |
|||
"typeSimple": "EShopOnAbp.PaymentService.PaymentRequests.PaymentRequestStartResultDto" |
|||
}, |
|||
"allowAnonymous": null, |
|||
"implementFrom": "EShopOnAbp.PaymentService.PaymentRequests.IPaymentRequestAppService" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
"types": {} |
|||
} |
|||
Loading…
Reference in new issue