Browse Source

Remove PaymentType from Order Service

pull/64/head
enisn 5 years ago
parent
commit
7f2b0c96f5
  1. 16
      apps/public-web/src/EShopOnAbp.PublicWeb/Components/Payment/Default.cshtml
  2. 15
      apps/public-web/src/EShopOnAbp.PublicWeb/Components/Payment/PaymentWidgetViewComponent.cs
  3. 2
      apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbpPaymentConsts.cs
  4. 21
      apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbpPublicWebModule.cs
  5. 5
      apps/public-web/src/EShopOnAbp.PublicWeb/Pages/OrderReceived.cshtml
  6. 7
      apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Payment.cshtml.cs
  7. 8
      apps/public-web/src/EShopOnAbp.PublicWeb/Pages/PaymentCompleted.cshtml.cs
  8. 4
      apps/public-web/src/EShopOnAbp.PublicWeb/Pages/payment.js
  9. 17
      apps/public-web/src/EShopOnAbp.PublicWeb/PaymentMethods/PaymentMethodUiOptions.cs
  10. 43
      apps/public-web/src/EShopOnAbp.PublicWeb/ServiceProviders/PaymentMethodProvider.cs
  11. 24
      apps/public-web/src/EShopOnAbp.PublicWeb/ServiceProviders/PaymentTypeProvider.cs
  12. 17
      apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/payment/payment-widget.css
  13. 8
      apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/payment/payment-widget.js
  14. 2
      services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/OrderCreateDto.cs
  15. 3
      services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/OrderDto.cs
  16. 5
      services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs
  17. 1
      services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/OrderingServiceErrorCodes.cs
  18. 2
      services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Orders/OrderConstants.cs
  19. 7
      services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/Order.cs
  20. 4
      services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/OrderManager.cs
  21. 46
      services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/PaymentType.cs
  22. 10
      services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/EntityFrameworkCore/OrderServiceDataSeedContributor.cs
  23. 148
      services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/EntityFrameworkCore/OrderingServiceDbContext.cs
  24. 206
      services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/Migrations/20220118084223_Removed_PaymentType.Designer.cs
  25. 72
      services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/Migrations/20220118084223_Removed_PaymentType.cs
  26. 33
      services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/Migrations/OrderingServiceDbContextModelSnapshot.cs
  27. 1
      services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/Orders/EfCoreOrderQueryableExtensions.cs
  28. 1
      services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/Orders/EfCoreOrderRepository.cs
  29. 1
      services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/Orders/OrderEfCoreQueryableExtensions.cs
  30. 2
      services/ordering/test/EShopOnAbp.OrderingService.Application.Tests/Orders/OrderApplication_Tests.cs
  31. 5
      services/ordering/test/EShopOnAbp.OrderingService.Domain.Tests/Orders/OrderManager_Tests.cs
  32. 23
      services/payment/src/EShopOnAbp.PaymentService.HttpApi.Client/ClientProxies/PaymentMethodClientProxy.Generated.cs
  33. 7
      services/payment/src/EShopOnAbp.PaymentService.HttpApi.Client/ClientProxies/PaymentMethodClientProxy.cs
  34. 12
      services/payment/src/EShopOnAbp.PaymentService.HttpApi.Client/ClientProxies/PaymentRequestClientProxy.Generated.cs
  35. 63
      services/payment/src/EShopOnAbp.PaymentService.HttpApi.Client/ClientProxies/payment-generate-proxy.json
  36. 1
      services/payment/src/EShopOnAbp.PaymentService.HttpApi/Controllers/PaymentMethodController.cs

16
apps/public-web/src/EShopOnAbp.PublicWeb/Components/Payment/Default.cshtml

@ -14,7 +14,7 @@
{
string isSelectedAddressClass = address.IsDefault ? "is-selected" : string.Empty;
<abp-column size="_3">
<div class="card @isSelectedAddressClass" data-address-id="@address.Id">
<div class="card selectable @isSelectedAddressClass" data-address-id="@address.Id">
<div class="card-header">
<h4>@address.Type</h4>
</div>
@ -31,17 +31,17 @@
<div class="payment-list p-5">
<h5 class="mb-5">@L["Payment:SelectPaymentMethod"]</h5>
<abp-row>
@foreach (var paymentType in Model.PaymentTypes)
@foreach (var paymentMethod in Model.PaymentMethods)
{
string isSelectedClass = paymentType.IsDefault ? "is-selected" : "";
string isSelectedClass = paymentMethod.IsDefault ? "is-selected" : "";
<abp-column size="_2">
<abp-card class="@isSelectedClass" data-payment-type="@paymentType.Type">
<abp-card class="selectable @isSelectedClass" data-payment-method="@paymentMethod.Name">
<abp-card-body>
<p class="card-title payment-type-header" style="text-align: center">
@paymentType.Name
<p class="card-title payment-method-header" style="text-align: center">
@paymentMethod.Name
</p>
<p class="card-text">
<i class="fa fa-5x @paymentType.IconCss"></i>
<p class="card-text payment-method-icon">
<i class="fa fa-5x @paymentMethod.IconCss"></i>
</p>
</abp-card-body>
</abp-card>

15
apps/public-web/src/EShopOnAbp.PublicWeb/Components/Payment/PaymentWidgetViewComponent.cs

@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using EShopOnAbp.BasketService;
using EShopOnAbp.PaymentService.PaymentMethods;
using EShopOnAbp.PublicWeb.ServiceProviders;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc;
@ -11,23 +12,23 @@ namespace EShopOnAbp.PublicWeb.Components.Payment;
[Widget(
AutoInitialize = true,
RefreshUrl = "/Widgets/Payment",
StyleTypes = new[] {typeof(PaymentWidgetStyleContributor)},
ScriptTypes = new[] {typeof(PaymentWidgetScriptContributor)}
StyleTypes = new[] { typeof(PaymentWidgetStyleContributor) },
ScriptTypes = new[] { typeof(PaymentWidgetScriptContributor) }
)]
public class PaymentWidgetViewComponent : AbpViewComponent
{
private readonly UserBasketProvider _userBasketProvider;
private readonly UserAddressProvider _userAddressProvider;
private readonly PaymentTypeProvider _paymentTypeProvider;
private readonly PaymentMethodProvider _paymentMethodProvider;
public PaymentWidgetViewComponent(
UserBasketProvider userBasketProvider,
UserAddressProvider userAddressProvider,
PaymentTypeProvider paymentTypeProvider)
PaymentMethodProvider paymentMethodProvider)
{
_userBasketProvider = userBasketProvider;
_userAddressProvider = userAddressProvider;
_paymentTypeProvider = paymentTypeProvider;
_paymentMethodProvider = paymentMethodProvider;
}
public async Task<IViewComponentResult> InvokeAsync()
@ -36,7 +37,7 @@ public class PaymentWidgetViewComponent : AbpViewComponent
{
Basket = await _userBasketProvider.GetBasketAsync(),
Address = _userAddressProvider.GetDemoAddresses(),
PaymentTypes = _paymentTypeProvider.GetPaymentTypes()
PaymentMethods = await _paymentMethodProvider.GetPaymentMethodsAsync()
};
return View("~/Components/Payment/Default.cshtml", viewModel);
}
@ -46,5 +47,5 @@ public class PaymentViewModel
{
public BasketDto Basket { get; set; }
public List<AddressDto> Address { get; set; }
public List<PaymentType> PaymentTypes { get; set; }
public List<PaymentMethodViewModel> PaymentMethods { get; set; }
}

2
apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbpPaymentConsts.cs

@ -3,7 +3,7 @@
public static class EShopOnAbpPaymentConsts
{
public const string Currency = "USD";
public const string PaymentTypeCookie = "selected_payment_type"; // Setted in payment-widget.js
public const string PaymentMethodCookie = "selected_payment_method"; // Setted in payment-widget.js
public static class DemoAddressTypes
{

21
apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbpPublicWebModule.cs

@ -36,6 +36,9 @@ using Yarp.ReverseProxy.Transforms;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Bundling;
using EShopOnAbp.PublicWeb.Components.Toolbar.Cart;
using EShopOnAbp.PublicWeb.PaymentMethods;
using EShopOnAbp.PaymentService.PaymentMethods;
using Microsoft.Extensions.Configuration;
namespace EShopOnAbp.PublicWeb
{
@ -107,10 +110,7 @@ namespace EShopOnAbp.PublicWeb
options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"];
});
Configure<EShopOnAbpPublicWebPaymentOptions>(options =>
{
options.PaymentSuccessfulCallbackUrl = configuration["App:SelfUrl"].EnsureEndsWith('/') + "PaymentCompleted";
});
ConfigurePayment(configuration);
context.Services.AddAuthentication(options =>
{
@ -176,6 +176,19 @@ namespace EShopOnAbp.PublicWeb
});
}
private void ConfigurePayment(IConfiguration configuration)
{
Configure<EShopOnAbpPublicWebPaymentOptions>(options =>
{
options.PaymentSuccessfulCallbackUrl = configuration["App:SelfUrl"].EnsureEndsWith('/') + "PaymentCompleted";
});
Configure<PaymentMethodUiOptions>(options =>
{
options.ConfigureIcon(PaymentMethodNames.PayPal, "fa-cc-paypal paypal");
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();

5
apps/public-web/src/EShopOnAbp.PublicWeb/Pages/OrderReceived.cshtml

@ -1,9 +1,12 @@
@page "{orderNo:int}"
@using System.Globalization
@using EShopOnAbp.Localization
@using EShopOnAbp.PublicWeb.PaymentMethods
@using Microsoft.Extensions.Localization
@using Microsoft.Extensions.Options
@model EShopOnAbp.PublicWeb.Pages.OrderReceivedModel
@inject IStringLocalizer<EShopOnAbpResource> L
@inject IOptions<PaymentMethodUiOptions> PaymentMethodUiOptions
@{
decimal orderTotal = Model.ReceivedOrder.Items.Sum(q => q.UnitPrice * q.Units);
string orderTotalString = orderTotal.ToString("C", new CultureInfo("en-US")); // We work with USD any ways
@ -15,7 +18,7 @@
}
@{
var paymentIcon = Model.ReceivedOrder.PaymentType == "paypal" ? "fa-cc-paypal" : "fa-credit-card";
var paymentIcon = PaymentMethodUiOptions.Value.Icons.GetValueOrDefault(Model.ReceivedOrder.PaymentMethod, PaymentMethodUiOptions.Value.DefaultIcon);
}
<abp-row class="justify-content-center p-5">
<abp-card class="col-lg-10 col-md-10 col-sm-12 shadow">

7
apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Payment.cshtml.cs

@ -46,7 +46,7 @@ public class PaymentModel : AbpPageModel
{
Logger.LogInformation("Payment Proceeded...");
Logger.LogInformation($"AddressId: {model.SelectedAddressId}");
Logger.LogInformation($"PaymentType: {model.SelectedPaymentType}");
Logger.LogInformation($"PaymentMethod: {model.SelectedPaymentMethod}");
Logger.LogInformation($"Total Discount: {model.TotalDiscountPercentage}");
var basket = await _userBasketProvider.GetBasketAsync();
@ -59,6 +59,7 @@ public class PaymentModel : AbpPageModel
var placedOrder = await _orderAppService.CreateAsync(new OrderCreateDto()
{
PaymentMethod = model.SelectedPaymentMethod,
Address = GetUserAddress(model.SelectedAddressId),
Products = productItems
});
@ -73,7 +74,7 @@ public class PaymentModel : AbpPageModel
});
var response = await _paymentRequestAppService.StartAsync(
model.SelectedPaymentType,
model.SelectedPaymentMethod,
new PaymentRequestStartDto
{
PaymentRequestId = paymentRequest.Id,
@ -87,7 +88,7 @@ public class PaymentModel : AbpPageModel
public class PaymentPageViewModel
{
public int SelectedAddressId { get; set; }
public string SelectedPaymentType { get; set; }
public string SelectedPaymentMethod { get; set; }
public decimal TotalDiscountPercentage { get; set; }
}

8
apps/public-web/src/EShopOnAbp.PublicWeb/Pages/PaymentCompleted.cshtml.cs

@ -25,15 +25,15 @@ public class PaymentCompletedModel : AbpPageModel
public async Task<IActionResult> OnGetAsync()
{
if (!HttpContext.Request.Cookies.TryGetValue(EShopOnAbpPaymentConsts.PaymentTypeCookie,
out var selectedPaymentType))
if (!HttpContext.Request.Cookies.TryGetValue(EShopOnAbpPaymentConsts.PaymentMethodCookie,
out var selectedPaymentMethod))
{
throw new InvalidOperationException("A payment type must be selected!");
}
PaymentRequest = await _paymentRequestAppService.CompleteAsync(
// TODO: Use string name
selectedPaymentType,
selectedPaymentMethod,
new PaymentRequestCompleteInputDto() { Token = Token });
IsSuccessful = PaymentRequest.State == PaymentRequestState.Completed;
@ -41,7 +41,7 @@ public class PaymentCompletedModel : AbpPageModel
if (IsSuccessful)
{
// Remove cookie so that can be set again when default payment type is set
HttpContext.Response.Cookies.Delete(EShopOnAbpPaymentConsts.PaymentTypeCookie);
HttpContext.Response.Cookies.Delete(EShopOnAbpPaymentConsts.PaymentMethodCookie);
return RedirectToPage("OrderReceived", new { orderNo = PaymentRequest.OrderNo });
}

4
apps/public-web/src/EShopOnAbp.PublicWeb/Pages/payment.js

@ -9,8 +9,8 @@
form.appendChild(addressInput);
let paymentInput = document.createElement('input');
paymentInput.setAttribute('name', "model.SelectedPaymentType");
paymentInput.setAttribute('value', document.querySelector(".payment-list .card.is-selected").getAttribute("data-payment-type"));
paymentInput.setAttribute('name', "model.SelectedPaymentMethod");
paymentInput.setAttribute('value', document.querySelector(".payment-list .card.is-selected").getAttribute("data-payment-method"));
paymentInput.setAttribute('type', "hidden");
form.appendChild(paymentInput);
};

17
apps/public-web/src/EShopOnAbp.PublicWeb/PaymentMethods/PaymentMethodUiOptions.cs

@ -0,0 +1,17 @@
using JetBrains.Annotations;
using System.Collections.Generic;
namespace EShopOnAbp.PublicWeb.PaymentMethods;
public class PaymentMethodUiOptions
{
[NotNull]
public Dictionary<string, string> Icons { get; } = new();
public string DefaultIcon { get; set; } = "fa-credit-card demo";
public void ConfigureIcon(string paymentMethod, string iconCss)
{
Icons[paymentMethod] = iconCss;
}
}

43
apps/public-web/src/EShopOnAbp.PublicWeb/ServiceProviders/PaymentMethodProvider.cs

@ -0,0 +1,43 @@
using EShopOnAbp.PaymentService.PaymentMethods;
using EShopOnAbp.PublicWeb.PaymentMethods;
using Microsoft.Extensions.Options;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
namespace EShopOnAbp.PublicWeb.ServiceProviders;
public class PaymentMethodProvider : ITransientDependency
{
protected IPaymentMethodAppService PaymentMethodAppService { get; }
private readonly PaymentMethodUiOptions _options;
public PaymentMethodProvider(
IPaymentMethodAppService paymentMethodAppService,
IOptions<PaymentMethodUiOptions> options)
{
PaymentMethodAppService = paymentMethodAppService;
_options = options.Value;
}
public async Task<List<PaymentMethodViewModel>> GetPaymentMethodsAsync()
{
var paymentMethods = await PaymentMethodAppService.GetListAsync();
return paymentMethods.Select((pm, i) => new PaymentMethodViewModel
{
Name = pm.Name,
IsDefault = i == 0,
IconCss = _options.Icons.GetOrDefault(pm.Name)?? _options.DefaultIcon
}).ToList();
}
}
public class PaymentMethodViewModel
{
public string Name { get; set; }
public string IconCss { get; set; }
public bool IsDefault { get; set; }
}

24
apps/public-web/src/EShopOnAbp.PublicWeb/ServiceProviders/PaymentTypeProvider.cs

@ -1,24 +0,0 @@
using System.Collections.Generic;
using Volo.Abp.DependencyInjection;
namespace EShopOnAbp.PublicWeb.ServiceProviders;
public class PaymentTypeProvider : ITransientDependency
{
public List<PaymentType> GetPaymentTypes()
{
return new List<PaymentType>
{
new() { Type = "demo", Name = "Demo", IconCss = "fa-credit-card demo", IsDefault = true},
new() { Type = "paypal", Name = "Paypal", IconCss = "fa-cc-paypal paypal"}
};
}
}
public class PaymentType
{
public string Type { get; set; }
public string Name { get; set; }
public string IconCss { get; set; }
public bool IsDefault { get; set; } = false;
}

17
apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/payment/payment-widget.css

@ -15,18 +15,19 @@
padding: 2px 16px;
}
.is-selected {
border: solid #bfbfe3;
.payment-method-icon {
opacity:0.8;
}
.payment-type-header {
font-weight: 500;
.selectable {
cursor: pointer;
}
.paypal {
color: #6c84fa;
.is-selected {
border: solid #bfbfe3;
color: #6c84fa !important;
}
.demo {
color: darkgray;
.payment-method-header {
font-weight: 500;
}

8
apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/payment/payment-widget.js

@ -1,7 +1,7 @@
(function () {
// Write selected payment type to cookie anyways
const paymentType = $(".payment-list").find(".is-selected").attr('data-payment-type');
abp.utils.setCookieValue("selected_payment_type", paymentType);
const paymentMethod = $(".payment-list").find(".is-selected").attr('data-payment-method');
abp.utils.setCookieValue("selected_payment_method", paymentMethod);
abp.widgets.PaymentWidget = function ($wrapper) {
var widgetManager = $wrapper.data('abp-widget-manager');
@ -19,8 +19,8 @@
.find('.payment-list .card')
.click(el => {
const $this = $(el.currentTarget);
const paymentTypeId = $this.attr('data-payment-type');
abp.utils.setCookieValue("selected_payment_type", paymentTypeId);
const paymentMethod = $this.attr('data-payment-method');
abp.utils.setCookieValue("selected_payment_method", paymentMethod);
$this.parents(".payment-list").find('.card').removeClass("is-selected");
$this.addClass("is-selected");
});

2
services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/OrderCreateDto.cs

@ -4,7 +4,7 @@ namespace EShopOnAbp.OrderingService.Orders;
public class OrderCreateDto
{
public int PaymentTypeId { get; set; }
public string PaymentMethod { get; set; }
public OrderAddressDto Address { get; set; } = new();
public List<OrderItemCreateDto> Products { get; set; } = new();
}

3
services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/OrderDto.cs

@ -10,8 +10,7 @@ public class OrderDto : EntityDto<Guid>
public int OrderNo {get;set;}
public int OrderStatusId { get; set; }
public string OrderStatus { get; set; }
public int PaymentTypeId { get; set; }
public string PaymentType { get; set; }
public string PaymentMethod { get; set; }
public BuyerDto Buyer { get; set; }
public OrderAddressDto Address { get; set; } = new();
public List<OrderItemDto> Items { get; set; } = new();

5
services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs

@ -53,7 +53,7 @@ public class OrderAppService : ApplicationService, IOrderAppService
var placedOrder = await _orderManager.CreateOrderAsync
(
paymentTypeId: input.PaymentTypeId,
paymentMethod: input.PaymentMethod,
buyerId: CurrentUser.GetId(),
buyerName: CurrentUser.Name,
buyerEmail: CurrentUser.Email,
@ -108,8 +108,7 @@ public class OrderAppService : ApplicationService, IOrderAppService
OrderDate = order.OrderDate,
OrderStatus = order.OrderStatus.Name,
OrderStatusId = order.OrderStatus.Id,
PaymentType = order.PaymentType.Name,
PaymentTypeId = order.PaymentType.Id
PaymentMethod = order.PaymentMethod
};
}
}

1
services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/OrderingServiceErrorCodes.cs

@ -3,7 +3,6 @@
public static class OrderingServiceErrorCodes
{
public const string OrderingStatusNotFound = "Ordering:00001";
public const string PaymentTypeNotFound = "Ordering:00011";
public const string InvalidUnits = "Ordering:00002";
public const string InvalidDiscount = "Ordering:00003";
public const string InvalidTotalForDiscount = "Ordering:00004";

2
services/ordering/src/EShopOnAbp.OrderingService.Domain.Shared/Orders/OrderConstants.cs

@ -2,7 +2,7 @@
public static class OrderConstants
{
public const int OrderPaymentTypeNameMaxLength = 128;
public const int OrderPaymentMethodNameMaxLength = 128;
public const int OrderStatusNameMaxLength = 256;
public const int PaymentStatusMaxLength = 256;

7
services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/Order.cs

@ -8,10 +8,9 @@ namespace EShopOnAbp.OrderingService.Orders;
public class Order : AggregateRoot<Guid>
{
private int _orderStatusId;
private int _paymentTypeId;
public DateTime OrderDate { get; private set; }
public int OrderNo { get; private set; }
public PaymentType PaymentType { get; private set; }
public string PaymentMethod { get; private set; }
public Guid? PaymentRequestId { get; private set; }
public string PaymentStatus { get; private set; }
public Buyer Buyer { get; private set; }
@ -23,16 +22,16 @@ public class Order : AggregateRoot<Guid>
{
}
internal Order(Guid id, Buyer buyer, Address address, PaymentType paymentType,
internal Order(Guid id, Buyer buyer, Address address, string paymentMethod,
Guid? paymentRequestId = null) : base(id)
{
_orderStatusId = OrderStatus.Placed.Id;
_paymentTypeId = paymentType.Id;
OrderDate = DateTime.UtcNow;
OrderNo = GenerateOrderNo(id);
Buyer = buyer;
Address = address;
PaymentRequestId = paymentRequestId;
PaymentMethod = paymentMethod;
PaymentStatus = "Waiting"; // TODO: magic string
OrderItems = new List<OrderItem>();
}

4
services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/OrderManager.cs

@ -21,7 +21,7 @@ public class OrderManager : DomainService
}
public async Task<Order> CreateOrderAsync(
int paymentTypeId,
string paymentMethod,
Guid buyerId,
string buyerName,
string buyerEmail,
@ -44,7 +44,7 @@ public class OrderManager : DomainService
country: addressCountry,
zipcode: addressZipCode,
description: addressDescription),
paymentType: PaymentType.From(paymentTypeId)
paymentMethod: paymentMethod
);
// Add new order items

46
services/ordering/src/EShopOnAbp.OrderingService.Domain/Orders/PaymentType.cs

@ -1,46 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Volo.Abp;
namespace EShopOnAbp.OrderingService.Orders;
public class PaymentType : Enumeration
{
public static PaymentType Demo = new PaymentType(0, nameof(Demo).ToLowerInvariant());
public static PaymentType Paypal = new PaymentType(1, nameof(Paypal).ToLowerInvariant());
public PaymentType(int id, string name) : base(id, name)
{
}
public static IEnumerable<PaymentType> List() =>
new[] {Demo, Paypal};
public static PaymentType FromName(string name)
{
var state = List()
.SingleOrDefault(s => String.Equals(s.Name, name, StringComparison.CurrentCultureIgnoreCase));
if (state == null)
{
throw new BusinessException(OrderingServiceErrorCodes.PaymentTypeNotFound)
.WithData("PaymentType", String.Join(",", List().Select(s => s.Name)));
}
return state;
}
public static PaymentType From(int id)
{
var state = List().SingleOrDefault(s => s.Id == id);
if (state == null)
{
throw new BusinessException(OrderingServiceErrorCodes.PaymentTypeNotFound)
.WithData("PaymentType", String.Join(",", List().Select(s => s.Name)));
}
return state;
}
}

10
services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/EntityFrameworkCore/OrderServiceDataSeedContributor.cs

@ -24,16 +24,6 @@ public class OrderServiceDataSeedContributor : IDataSeedContributor, ITransientD
public async Task SeedAsync(DataSeedContext context)
{
await SeedOrderStatusAsync();
await SeedPaymentTypesAsync();
}
private async Task SeedPaymentTypesAsync()
{
if (!await _dbContext.Set<PaymentType>().AnyAsync())
{
await _dbContext.Set<PaymentType>().AddRangeAsync(PaymentType.List());
await _dbContext.SaveChangesAsync();
}
}
private async Task SeedOrderStatusAsync()

148
services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/EntityFrameworkCore/OrderingServiceDbContext.cs

@ -5,103 +5,79 @@ using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.Modeling;
namespace EShopOnAbp.OrderingService.EntityFrameworkCore
namespace EShopOnAbp.OrderingService.EntityFrameworkCore;
[ConnectionStringName(OrderingServiceDbProperties.ConnectionStringName)]
public class OrderingServiceDbContext : AbpDbContext<OrderingServiceDbContext>, IOrderingServiceDbContext
{
[ConnectionStringName(OrderingServiceDbProperties.ConnectionStringName)]
public class OrderingServiceDbContext : AbpDbContext<OrderingServiceDbContext>, IOrderingServiceDbContext
public virtual DbSet<Order> Orders { get; set; }
public OrderingServiceDbContext(DbContextOptions<OrderingServiceDbContext> options)
: base(options)
{
public virtual DbSet<Order> Orders { get; set; }
}
public OrderingServiceDbContext(DbContextOptions<OrderingServiceDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
/* Include modules to your migration db context */
builder.ConfigureOrderingService();
/* Configure your own tables/entities inside here */
/* Include modules to your migration db context */
builder.ConfigureOrderingService();
/* Configure your own tables/entities inside here */
builder.Entity<Order>(b =>
{
b.ToTable(OrderingServiceDbProperties.DbTablePrefix + "Orders", OrderingServiceDbProperties.DbSchema);
b.ConfigureByConvention(); //auto configure for the base class props
builder.Entity<Order>(b =>
{
b.ToTable(OrderingServiceDbProperties.DbTablePrefix + "Orders", OrderingServiceDbProperties.DbSchema);
b.ConfigureByConvention(); //auto configure for the base class props
b.Property(q => q.PaymentStatus).HasMaxLength(OrderConstants.PaymentStatusMaxLength);
b.OwnsOne(o => o.Address, a => { a.WithOwner(); });
b.OwnsOne(o => o.Buyer, a => { a.WithOwner(); });
b.Property<int>("_orderStatusId").UsePropertyAccessMode(PropertyAccessMode.Field)
.HasColumnName("OrderStatusId")
.IsRequired();
b.Property<int>("_paymentTypeId").UsePropertyAccessMode(PropertyAccessMode.Field)
.HasColumnName("PaymentTypeId")
.IsRequired();
b.HasOne(q => q.OrderStatus).WithMany().HasForeignKey("_orderStatusId");
b.HasOne(q => q.PaymentType).WithMany().HasForeignKey("_paymentTypeId");
b.Navigation(q => q.OrderItems).UsePropertyAccessMode(PropertyAccessMode.Property);
});
builder.Entity<OrderItem>(b =>
{
b.ToTable(OrderingServiceDbProperties.DbTablePrefix + "OrderItems",
OrderingServiceDbProperties.DbSchema);
b.ConfigureByConvention(); //auto configure for the base class props
b.OwnsOne(o => o.Address, a => { a.WithOwner(); });
b.OwnsOne(o => o.Buyer, a => { a.WithOwner(); });
b.Property<int>("_orderStatusId").UsePropertyAccessMode(PropertyAccessMode.Field)
.HasColumnName("OrderStatusId")
.IsRequired();
b.HasOne(q => q.OrderStatus).WithMany().HasForeignKey("_orderStatusId");
b.Navigation(q => q.OrderItems).UsePropertyAccessMode(PropertyAccessMode.Property);
});
builder.Entity<OrderItem>(b =>
{
b.ToTable(OrderingServiceDbProperties.DbTablePrefix + "OrderItems",
OrderingServiceDbProperties.DbSchema);
b.ConfigureByConvention(); //auto configure for the base class props
b.Property<Guid>("OrderId").IsRequired();
b.Property(q => q.ProductId).IsRequired();
b.Property(q => q.ProductCode).IsRequired();
b.Property(q => q.ProductName).IsRequired();
b.Property(q => q.Discount).IsRequired();
b.Property(q => q.UnitPrice).IsRequired();
b.Property(q => q.Units).IsRequired();
b.Property(q => q.PictureUrl).IsRequired(false);
});
builder.Entity<OrderStatus>(b =>
{
b.ToTable(OrderingServiceDbProperties.DbTablePrefix + "OrderStatus",
OrderingServiceDbProperties.DbSchema);
b.ConfigureByConvention(); //auto configure for the base class props
b.Property(q => q.ProductId).IsRequired();
b.Property(q => q.ProductCode).IsRequired();
b.Property(q => q.ProductName).IsRequired();
b.Property(q => q.Discount).IsRequired();
b.Property(q => q.UnitPrice).IsRequired();
b.Property(q => q.Units).IsRequired();
b.Property(q => q.PictureUrl).IsRequired(false);
});
b.HasKey(q => q.Id);
b.Property(q => q.Id)
.HasDefaultValue(1)
.ValueGeneratedNever()
.IsRequired();
b.Property(o => o.Name)
.HasMaxLength(OrderConstants.OrderStatusNameMaxLength)
.IsRequired();
});
builder.Entity<PaymentType>(b =>
{
b.ToTable(OrderingServiceDbProperties.DbTablePrefix + "PaymentTypes",
OrderingServiceDbProperties.DbSchema);
b.ConfigureByConvention(); //auto configure for the base class props
builder.Entity<OrderStatus>(b =>
{
b.ToTable(OrderingServiceDbProperties.DbTablePrefix + "OrderStatus",
OrderingServiceDbProperties.DbSchema);
b.ConfigureByConvention(); //auto configure for the base class props
b.HasKey(q => q.Id);
b.Property(q => q.Id)
.HasDefaultValue(1)
.ValueGeneratedNever()
.IsRequired();
b.Property(o => o.Name)
.HasMaxLength(OrderConstants.OrderPaymentTypeNameMaxLength)
.IsRequired();
});
}
b.Property(q => q.Id)
.HasDefaultValue(1)
.ValueGeneratedNever()
.IsRequired();
b.Property(o => o.Name)
.HasMaxLength(OrderConstants.OrderStatusNameMaxLength)
.IsRequired();
});
}
}
}

206
services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/Migrations/20220118084223_Removed_PaymentType.Designer.cs

@ -0,0 +1,206 @@
// <auto-generated />
using System;
using EShopOnAbp.OrderingService.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using Volo.Abp.EntityFrameworkCore;
#nullable disable
namespace EShopOnAbp.OrderingService.Migrations
{
[DbContext(typeof(OrderingServiceDbContext))]
[Migration("20220118084223_Removed_PaymentType")]
partial class Removed_PaymentType
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.PostgreSql)
.HasAnnotation("ProductVersion", "6.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.Order", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("character varying(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<string>("ExtraProperties")
.HasColumnType("text")
.HasColumnName("ExtraProperties");
b.Property<DateTime>("OrderDate")
.HasColumnType("timestamp with time zone");
b.Property<int>("OrderNo")
.HasColumnType("integer");
b.Property<string>("PaymentMethod")
.HasColumnType("text");
b.Property<Guid?>("PaymentRequestId")
.HasColumnType("uuid");
b.Property<string>("PaymentStatus")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<int>("_orderStatusId")
.HasColumnType("integer")
.HasColumnName("OrderStatusId");
b.HasKey("Id");
b.HasIndex("_orderStatusId");
b.ToTable("Orders", (string)null);
});
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.OrderItem", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
b.Property<decimal>("Discount")
.HasColumnType("numeric");
b.Property<Guid>("OrderId")
.HasColumnType("uuid");
b.Property<string>("PictureUrl")
.HasColumnType("text");
b.Property<string>("ProductCode")
.IsRequired()
.HasColumnType("text");
b.Property<Guid>("ProductId")
.HasColumnType("uuid");
b.Property<string>("ProductName")
.IsRequired()
.HasColumnType("text");
b.Property<decimal>("UnitPrice")
.HasColumnType("numeric");
b.Property<int>("Units")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("OrderId");
b.ToTable("OrderItems", (string)null);
});
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.OrderStatus", b =>
{
b.Property<int>("Id")
.HasColumnType("integer")
.HasDefaultValue(1);
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.ToTable("OrderStatus", (string)null);
});
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.Order", b =>
{
b.HasOne("EShopOnAbp.OrderingService.Orders.OrderStatus", "OrderStatus")
.WithMany()
.HasForeignKey("_orderStatusId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("EShopOnAbp.OrderingService.Orders.Address", "Address", b1 =>
{
b1.Property<Guid>("OrderId")
.HasColumnType("uuid");
b1.Property<string>("City")
.HasColumnType("text");
b1.Property<string>("Country")
.HasColumnType("text");
b1.Property<string>("Description")
.HasColumnType("text");
b1.Property<string>("Street")
.HasColumnType("text");
b1.Property<string>("ZipCode")
.HasColumnType("text");
b1.HasKey("OrderId");
b1.ToTable("Orders");
b1.WithOwner()
.HasForeignKey("OrderId");
});
b.OwnsOne("EShopOnAbp.OrderingService.Orders.Buyer", "Buyer", b1 =>
{
b1.Property<Guid>("OrderId")
.HasColumnType("uuid");
b1.Property<string>("Email")
.HasColumnType("text");
b1.Property<Guid?>("Id")
.HasColumnType("uuid");
b1.Property<string>("Name")
.HasColumnType("text");
b1.HasKey("OrderId");
b1.ToTable("Orders");
b1.WithOwner()
.HasForeignKey("OrderId");
});
b.Navigation("Address");
b.Navigation("Buyer");
b.Navigation("OrderStatus");
});
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.OrderItem", b =>
{
b.HasOne("EShopOnAbp.OrderingService.Orders.Order", null)
.WithMany("OrderItems")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.Order", b =>
{
b.Navigation("OrderItems");
});
#pragma warning restore 612, 618
}
}
}

72
services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/Migrations/20220118084223_Removed_PaymentType.cs

@ -0,0 +1,72 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EShopOnAbp.OrderingService.Migrations
{
public partial class Removed_PaymentType : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Orders_PaymentTypes_PaymentTypeId",
table: "Orders");
migrationBuilder.DropTable(
name: "PaymentTypes");
migrationBuilder.DropIndex(
name: "IX_Orders_PaymentTypeId",
table: "Orders");
migrationBuilder.DropColumn(
name: "PaymentTypeId",
table: "Orders");
migrationBuilder.AddColumn<string>(
name: "PaymentMethod",
table: "Orders",
type: "text",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PaymentMethod",
table: "Orders");
migrationBuilder.AddColumn<int>(
name: "PaymentTypeId",
table: "Orders",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateTable(
name: "PaymentTypes",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false, defaultValue: 1),
Name = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_PaymentTypes", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_Orders_PaymentTypeId",
table: "Orders",
column: "PaymentTypeId");
migrationBuilder.AddForeignKey(
name: "FK_Orders_PaymentTypes_PaymentTypeId",
table: "Orders",
column: "PaymentTypeId",
principalTable: "PaymentTypes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

33
services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/Migrations/OrderingServiceDbContextModelSnapshot.cs

@ -24,22 +24,6 @@ namespace EShopOnAbp.OrderingService.Migrations
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("EShopOnAbp.OrderingService.Buyers.PaymentType", b =>
{
b.Property<int>("Id")
.HasColumnType("integer")
.HasDefaultValue(1);
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.HasKey("Id");
b.ToTable("PaymentTypes", (string)null);
});
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.Order", b =>
{
b.Property<Guid>("Id")
@ -61,6 +45,9 @@ namespace EShopOnAbp.OrderingService.Migrations
b.Property<int>("OrderNo")
.HasColumnType("integer");
b.Property<string>("PaymentMethod")
.HasColumnType("text");
b.Property<Guid?>("PaymentRequestId")
.HasColumnType("uuid");
@ -72,16 +59,10 @@ namespace EShopOnAbp.OrderingService.Migrations
.HasColumnType("integer")
.HasColumnName("OrderStatusId");
b.Property<int>("_paymentTypeId")
.HasColumnType("integer")
.HasColumnName("PaymentTypeId");
b.HasKey("Id");
b.HasIndex("_orderStatusId");
b.HasIndex("_paymentTypeId");
b.ToTable("Orders", (string)null);
});
@ -147,12 +128,6 @@ namespace EShopOnAbp.OrderingService.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("EShopOnAbp.OrderingService.Buyers.PaymentType", "PaymentType")
.WithMany()
.HasForeignKey("_paymentTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("EShopOnAbp.OrderingService.Orders.Address", "Address", b1 =>
{
b1.Property<Guid>("OrderId")
@ -208,8 +183,6 @@ namespace EShopOnAbp.OrderingService.Migrations
b.Navigation("Buyer");
b.Navigation("OrderStatus");
b.Navigation("PaymentType");
});
modelBuilder.Entity("EShopOnAbp.OrderingService.Orders.OrderItem", b =>

1
services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/Orders/EfCoreOrderQueryableExtensions.cs

@ -10,7 +10,6 @@ public static class EfCoreOrderQueryableExtensions
? queryable
: queryable
.Include(q => q.OrderStatus)
.Include(q => q.PaymentType)
.Include(q => q.Address)
.Include(q => q.Buyer)
.Include(q => q.OrderItems);

1
services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/Orders/EfCoreOrderRepository.cs

@ -25,7 +25,6 @@ public class EfCoreOrderRepository : EfCoreRepository<OrderingServiceDbContext,
{
var newEntity = await base.InsertAsync(entity, autoSave, GetCancellationToken(cancellationToken));
await EnsurePropertyLoadedAsync(newEntity, o => o.OrderStatus, GetCancellationToken(cancellationToken));
await EnsurePropertyLoadedAsync(newEntity, o => o.PaymentType, GetCancellationToken(cancellationToken));
return newEntity;
}

1
services/ordering/src/EShopOnAbp.OrderingService.EntityFrameworkCore/Orders/OrderEfCoreQueryableExtensions.cs

@ -16,7 +16,6 @@ public static class OrderEfCoreQueryableExtensions
.Include(x => x.Address)
.Include(x => x.Buyer)
.Include(x => x.OrderItems)
.Include(x => x.PaymentType)
.Include(x => x.OrderStatus);
}
}

2
services/ordering/test/EShopOnAbp.OrderingService.Application.Tests/Orders/OrderApplication_Tests.cs

@ -45,7 +45,7 @@ public class OrderApplication_Tests:OrderingServiceApplicationTestBase
var placedOrder = await _orderAppService.CreateAsync(new OrderCreateDto()
{
PaymentTypeId = 1,
PaymentMethod = 1,
Address = new OrderAddressDto()
{
City = "Test City", Country = "Test Country", Description = "No Description", Street = "Test Street",

5
services/ordering/test/EShopOnAbp.OrderingService.Domain.Tests/Orders/OrderManager_Tests.cs

@ -18,13 +18,14 @@ public class OrderManagerUnitTests : OrderingServiceDomainTestBase
[Fact]
public async Task Should_CreateOrderAsync()
{
var paymentMethod = "Cash on Delivery";
var orderItems =
new List<(Guid productId, string productName, string productCode, decimal unitPrice, decimal discount,
string pictureUrl, int
units)>();
orderItems.Add((Guid.NewGuid(), "Test product", "Code:001", 15, 0, "", 1));
var createdOrder = await _orderManager.CreateOrderAsync(
1,
paymentMethod,
Guid.Parse("11CA0F6D-208E-441A-9F9B-3611C96E4383"),
"gterdem",
"gterdem@volosoft.com",
@ -36,6 +37,6 @@ public class OrderManagerUnitTests : OrderingServiceDomainTestBase
createdOrder.ShouldNotBeNull();
createdOrder.OrderStatus.ShouldBe(OrderStatus.Placed);
createdOrder.PaymentType.ShouldBe(PaymentType.Paypal);
createdOrder.PaymentMethod.ShouldBe(paymentMethod);
}
}

23
services/payment/src/EShopOnAbp.PaymentService.HttpApi.Client/ClientProxies/PaymentMethodClientProxy.Generated.cs

@ -0,0 +1,23 @@
// 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.PaymentMethods;
using System.Collections.Generic;
// ReSharper disable once CheckNamespace
namespace EShopOnAbp.PaymentService.Controllers.ClientProxies;
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IPaymentMethodAppService), typeof(PaymentMethodClientProxy))]
public partial class PaymentMethodClientProxy : ClientProxyBase<IPaymentMethodAppService>, IPaymentMethodAppService
{
public virtual async Task<List<PaymentMethodDto>> GetListAsync()
{
return await RequestAsync<List<PaymentMethodDto>>(nameof(GetListAsync));
}
}

7
services/payment/src/EShopOnAbp.PaymentService.HttpApi.Client/ClientProxies/PaymentMethodClientProxy.cs

@ -0,0 +1,7 @@
// This file is part of PaymentMethodClientProxy, you can customize it here
// ReSharper disable once CheckNamespace
namespace EShopOnAbp.PaymentService.Controllers.ClientProxies;
public partial class PaymentMethodClientProxy
{
}

12
services/payment/src/EShopOnAbp.PaymentService.HttpApi.Client/ClientProxies/PaymentRequestClientProxy.Generated.cs

@ -15,11 +15,11 @@ namespace EShopOnAbp.PaymentService.Controllers.ClientProxies;
[ExposeServices(typeof(IPaymentRequestAppService), typeof(PaymentRequestClientProxy))]
public partial class PaymentRequestClientProxy : ClientProxyBase<IPaymentRequestAppService>, IPaymentRequestAppService
{
public virtual async Task<PaymentRequestDto> CompleteAsync(string paymentType, PaymentRequestCompleteInputDto input)
public virtual async Task<PaymentRequestDto> CompleteAsync(string paymentMethod, PaymentRequestCompleteInputDto input)
{
return await RequestAsync<PaymentRequestDto>(nameof(CompleteAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), paymentType },
{ typeof(string), paymentMethod },
{ typeof(PaymentRequestCompleteInputDto), input }
});
}
@ -32,20 +32,20 @@ public partial class PaymentRequestClientProxy : ClientProxyBase<IPaymentRequest
});
}
public virtual async Task<bool> HandleWebhookAsync(string paymentType, string payload)
public virtual async Task<bool> HandleWebhookAsync(string paymentMethod, string payload)
{
return await RequestAsync<bool>(nameof(HandleWebhookAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), paymentType },
{ typeof(string), paymentMethod },
{ typeof(string), payload }
});
}
public virtual async Task<PaymentRequestStartResultDto> StartAsync(string paymentType, PaymentRequestStartDto input)
public virtual async Task<PaymentRequestStartResultDto> StartAsync(string paymentMethod, PaymentRequestStartDto input)
{
return await RequestAsync<PaymentRequestStartResultDto>(nameof(StartAsync), new ClientProxyRequestTypeValue
{
{ typeof(string), paymentType },
{ typeof(string), paymentMethod },
{ typeof(PaymentRequestStartDto), input }
});
}

63
services/payment/src/EShopOnAbp.PaymentService.HttpApi.Client/ClientProxies/payment-generate-proxy.json

@ -4,6 +4,33 @@
"rootPath": "payment",
"remoteServiceName": "PaymentService",
"controllers": {
"EShopOnAbp.PaymentService.Controllers.PaymentMethodController": {
"controllerName": "PaymentMethod",
"controllerGroupName": "PaymentMethod",
"type": "EShopOnAbp.PaymentService.Controllers.PaymentMethodController",
"interfaces": [
{
"type": "EShopOnAbp.PaymentService.PaymentMethods.IPaymentMethodAppService"
}
],
"actions": {
"GetListAsync": {
"uniqueName": "GetListAsync",
"name": "GetListAsync",
"httpMethod": "GET",
"url": "api/payment/methods",
"supportedVersions": [],
"parametersOnMethod": [],
"parameters": [],
"returnValue": {
"type": "System.Collections.Generic.List<EShopOnAbp.PaymentService.PaymentMethods.PaymentMethodDto>",
"typeSimple": "[EShopOnAbp.PaymentService.PaymentMethods.PaymentMethodDto]"
},
"allowAnonymous": null,
"implementFrom": "EShopOnAbp.PaymentService.PaymentMethods.IPaymentMethodAppService"
}
}
},
"EShopOnAbp.PaymentService.Controllers.PaymentRequestController": {
"controllerName": "PaymentRequest",
"controllerGroupName": "PaymentRequest",
@ -14,15 +41,15 @@
}
],
"actions": {
"CompleteAsyncByPaymentTypeAndInput": {
"uniqueName": "CompleteAsyncByPaymentTypeAndInput",
"CompleteAsyncByPaymentMethodAndInput": {
"uniqueName": "CompleteAsyncByPaymentMethodAndInput",
"name": "CompleteAsync",
"httpMethod": "POST",
"url": "api/payment/requests/{paymentType}/complete",
"url": "api/payment/requests/{paymentMethod}/complete",
"supportedVersions": [],
"parametersOnMethod": [
{
"name": "paymentType",
"name": "paymentMethod",
"typeAsString": "System.String, System.Private.CoreLib",
"type": "System.String",
"typeSimple": "string",
@ -40,8 +67,8 @@
],
"parameters": [
{
"nameOnMethod": "paymentType",
"name": "paymentType",
"nameOnMethod": "paymentMethod",
"name": "paymentMethod",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
@ -108,15 +135,15 @@
"allowAnonymous": null,
"implementFrom": "EShopOnAbp.PaymentService.PaymentRequests.IPaymentRequestAppService"
},
"HandleWebhookAsyncByPaymentTypeAndPayload": {
"uniqueName": "HandleWebhookAsyncByPaymentTypeAndPayload",
"HandleWebhookAsyncByPaymentMethodAndPayload": {
"uniqueName": "HandleWebhookAsyncByPaymentMethodAndPayload",
"name": "HandleWebhookAsync",
"httpMethod": "POST",
"url": "api/payment/requests/{paymentType}/webhook",
"url": "api/payment/requests/{paymentMethod}/webhook",
"supportedVersions": [],
"parametersOnMethod": [
{
"name": "paymentType",
"name": "paymentMethod",
"typeAsString": "System.String, System.Private.CoreLib",
"type": "System.String",
"typeSimple": "string",
@ -134,8 +161,8 @@
],
"parameters": [
{
"nameOnMethod": "paymentType",
"name": "paymentType",
"nameOnMethod": "paymentMethod",
"name": "paymentMethod",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",
@ -165,15 +192,15 @@
"allowAnonymous": null,
"implementFrom": "EShopOnAbp.PaymentService.PaymentRequests.IPaymentRequestAppService"
},
"StartAsyncByPaymentTypeAndInput": {
"uniqueName": "StartAsyncByPaymentTypeAndInput",
"StartAsyncByPaymentMethodAndInput": {
"uniqueName": "StartAsyncByPaymentMethodAndInput",
"name": "StartAsync",
"httpMethod": "POST",
"url": "api/payment/requests/{paymentType}/start",
"url": "api/payment/requests/{paymentMethod}/start",
"supportedVersions": [],
"parametersOnMethod": [
{
"name": "paymentType",
"name": "paymentMethod",
"typeAsString": "System.String, System.Private.CoreLib",
"type": "System.String",
"typeSimple": "string",
@ -191,8 +218,8 @@
],
"parameters": [
{
"nameOnMethod": "paymentType",
"name": "paymentType",
"nameOnMethod": "paymentMethod",
"name": "paymentMethod",
"jsonName": null,
"type": "System.String",
"typeSimple": "string",

1
services/payment/src/EShopOnAbp.PaymentService.HttpApi/Controllers/PaymentMethodController.cs

@ -18,6 +18,7 @@ public class PaymentMethodController : PaymentServiceController, IPaymentMethodA
PaymentMethodAppService = paymentMethodAppService;
}
[HttpGet]
public Task<List<PaymentMethodDto>> GetListAsync()
{
return PaymentMethodAppService.GetListAsync();

Loading…
Cancel
Save