mirror of https://github.com/EasyAbp/EShop.git
146 changed files with 14240 additions and 276 deletions
@ -0,0 +1,11 @@ |
|||||
|
using EasyAbp.EShop.Payments.Payments; |
||||
|
using Volo.Abp.Domain.Entities.Events.Distributed; |
||||
|
using Volo.Abp.EventBus.Distributed; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Orders.Orders |
||||
|
{ |
||||
|
public interface IOrderPaymentCompletedEventHandler : IDistributedEventHandler<EntityUpdatedEto<PaymentEto>> |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
using EasyAbp.EShop.Payments.Payments; |
||||
|
using Volo.Abp.Domain.Entities.Events.Distributed; |
||||
|
using Volo.Abp.EventBus.Distributed; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Orders.Orders |
||||
|
{ |
||||
|
public interface IOrderPaymentCreatedEventHandler : IDistributedEventHandler<EntityCreatedEto<PaymentEto>> |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,48 @@ |
|||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using EasyAbp.EShop.Payments.Payments; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Domain.Entities.Events.Distributed; |
||||
|
using Volo.Abp.Timing; |
||||
|
using Volo.Abp.Uow; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Orders.Orders |
||||
|
{ |
||||
|
public class OrderPaymentCompletedEventHandler : IOrderPaymentCompletedEventHandler, ITransientDependency |
||||
|
{ |
||||
|
private readonly IClock _clock; |
||||
|
private readonly IOrderRepository _orderRepository; |
||||
|
|
||||
|
public OrderPaymentCompletedEventHandler( |
||||
|
IClock clock, |
||||
|
IOrderRepository orderRepository) |
||||
|
{ |
||||
|
_clock = clock; |
||||
|
_orderRepository = orderRepository; |
||||
|
} |
||||
|
|
||||
|
[UnitOfWork(true)] |
||||
|
public virtual async Task HandleEventAsync(EntityUpdatedEto<PaymentEto> eventData) |
||||
|
{ |
||||
|
if (!eventData.Entity.CompletionTime.HasValue) |
||||
|
{ |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
foreach (var item in eventData.Entity.PaymentItems.Where(item => item.ItemType == "EasyAbpEShopOrder")) |
||||
|
{ |
||||
|
var order = await _orderRepository.FindAsync(item.ItemKey); |
||||
|
|
||||
|
if (order == null || order.PaidTime.HasValue) |
||||
|
{ |
||||
|
continue; |
||||
|
} |
||||
|
|
||||
|
order.SetPaidTime(_clock.Now); |
||||
|
order.SetOrderStatus(OrderStatus.Processing); |
||||
|
|
||||
|
await _orderRepository.UpdateAsync(order, true); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,37 @@ |
|||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using EasyAbp.EShop.Payments.Payments; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Domain.Entities.Events.Distributed; |
||||
|
using Volo.Abp.Uow; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Orders.Orders |
||||
|
{ |
||||
|
public class OrderPaymentCreatedEventHandler : IOrderPaymentCreatedEventHandler, ITransientDependency |
||||
|
{ |
||||
|
private readonly IOrderRepository _orderRepository; |
||||
|
|
||||
|
public OrderPaymentCreatedEventHandler(IOrderRepository orderRepository) |
||||
|
{ |
||||
|
_orderRepository = orderRepository; |
||||
|
} |
||||
|
|
||||
|
[UnitOfWork(true)] |
||||
|
public virtual async Task HandleEventAsync(EntityCreatedEto<PaymentEto> eventData) |
||||
|
{ |
||||
|
foreach (var item in eventData.Entity.PaymentItems.Where(item => item.ItemType == "EasyAbpEShopOrder")) |
||||
|
{ |
||||
|
var order = await _orderRepository.FindAsync(item.ItemKey); |
||||
|
|
||||
|
if (order == null || order.PaymentId.HasValue) |
||||
|
{ |
||||
|
continue; |
||||
|
} |
||||
|
|
||||
|
order.SetPaymentId(eventData.Entity.Id); |
||||
|
|
||||
|
await _orderRepository.UpdateAsync(order, true); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,19 +0,0 @@ |
|||||
using EasyAbp.EShop.Payments.Localization; |
|
||||
using Volo.Abp.Authorization.Permissions; |
|
||||
using Volo.Abp.Localization; |
|
||||
|
|
||||
namespace EasyAbp.EShop.Payments.Authorization |
|
||||
{ |
|
||||
public class PaymentsPermissionDefinitionProvider : PermissionDefinitionProvider |
|
||||
{ |
|
||||
public override void Define(IPermissionDefinitionContext context) |
|
||||
{ |
|
||||
//var moduleGroup = context.AddGroup(PaymentsPermissions.GroupName, L("Permission:Payments"));
|
|
||||
} |
|
||||
|
|
||||
private static LocalizableString L(string name) |
|
||||
{ |
|
||||
return LocalizableString.Create<PaymentsResource>(name); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,14 +0,0 @@ |
|||||
using Volo.Abp.Reflection; |
|
||||
|
|
||||
namespace EasyAbp.EShop.Payments.Authorization |
|
||||
{ |
|
||||
public class PaymentsPermissions |
|
||||
{ |
|
||||
public const string GroupName = "EasyAbp.EShop.Payments"; |
|
||||
|
|
||||
public static string[] GetAll() |
|
||||
{ |
|
||||
return ReflectionHelper.GetPublicConstantsRecursively(typeof(PaymentsPermissions)); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,29 @@ |
|||||
|
using EasyAbp.EShop.Payments.Localization; |
||||
|
using Volo.Abp.Authorization.Permissions; |
||||
|
using Volo.Abp.Localization; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Authorization |
||||
|
{ |
||||
|
public class PaymentsPermissionDefinitionProvider : PermissionDefinitionProvider |
||||
|
{ |
||||
|
public override void Define(IPermissionDefinitionContext context) |
||||
|
{ |
||||
|
var moduleGroup = context.AddGroup(PaymentsPermissions.GroupName, L("Permission:Payments")); |
||||
|
|
||||
|
var payment = moduleGroup.AddPermission(PaymentsPermissions.Payments.Default, L("Permission:Payment")); |
||||
|
payment.AddChild(PaymentsPermissions.Payments.Manage, L("Permission:Manage")); |
||||
|
payment.AddChild(PaymentsPermissions.Payments.CrossStore, L("Permission:CrossStore")); |
||||
|
payment.AddChild(PaymentsPermissions.Payments.Create, L("Permission:Create")); |
||||
|
|
||||
|
var refund = moduleGroup.AddPermission(PaymentsPermissions.Refunds.Default, L("Permission:Refund")); |
||||
|
refund.AddChild(PaymentsPermissions.Refunds.Manage, L("Permission:Manage")); |
||||
|
refund.AddChild(PaymentsPermissions.Refunds.CrossStore, L("Permission:CrossStore")); |
||||
|
refund.AddChild(PaymentsPermissions.Refunds.Create, L("Permission:Create")); |
||||
|
} |
||||
|
|
||||
|
private static LocalizableString L(string name) |
||||
|
{ |
||||
|
return LocalizableString.Create<PaymentsResource>(name); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,30 @@ |
|||||
|
using Volo.Abp.Reflection; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Authorization |
||||
|
{ |
||||
|
public class PaymentsPermissions |
||||
|
{ |
||||
|
public const string GroupName = "EasyAbp.EShop.Payments"; |
||||
|
|
||||
|
public static string[] GetAll() |
||||
|
{ |
||||
|
return ReflectionHelper.GetPublicConstantsRecursively(typeof(PaymentsPermissions)); |
||||
|
} |
||||
|
|
||||
|
public class Payments |
||||
|
{ |
||||
|
public const string Default = GroupName + ".Payment"; |
||||
|
public const string Manage = Default + ".Manage"; |
||||
|
public const string CrossStore = Default + ".CrossStore"; |
||||
|
public const string Create = Default + ".Create"; |
||||
|
} |
||||
|
|
||||
|
public class Refunds |
||||
|
{ |
||||
|
public const string Default = GroupName + ".Refund"; |
||||
|
public const string Manage = Default + ".Manage"; |
||||
|
public const string CrossStore = Default + ".CrossStore"; |
||||
|
public const string Create = Default + ".Create"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel; |
||||
|
namespace EasyAbp.EShop.Payments.Payments.Dtos |
||||
|
{ |
||||
|
public class CreatePaymentDto |
||||
|
{ |
||||
|
[DisplayName("PaymentPaymentMethod")] |
||||
|
public string PaymentMethod { get; set; } |
||||
|
|
||||
|
[DisplayName("PaymentCurrency")] |
||||
|
public string Currency { get; set; } |
||||
|
|
||||
|
[DisplayName("PaymentExtraProperties")] |
||||
|
public Dictionary<string, object> ExtraProperties { get; set; } |
||||
|
|
||||
|
[DisplayName("PaymentItem")] |
||||
|
public List<CreatePaymentItemDto> PaymentItems { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel; |
||||
|
namespace EasyAbp.EShop.Payments.Payments.Dtos |
||||
|
{ |
||||
|
public class CreatePaymentItemDto |
||||
|
{ |
||||
|
[DisplayName("PaymentItemItemType")] |
||||
|
public string ItemType { get; set; } |
||||
|
|
||||
|
[DisplayName("PaymentItemItemKey")] |
||||
|
public Guid ItemKey { get; set; } |
||||
|
|
||||
|
[DisplayName("PaymentItemCurrency")] |
||||
|
public string Currency { get; set; } |
||||
|
|
||||
|
[DisplayName("PaymentItemOriginalPaymentAmount")] |
||||
|
public decimal OriginalPaymentAmount { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Payments.Dtos |
||||
|
{ |
||||
|
public class PaymentDto : ExtensibleFullAuditedEntityDto<Guid> |
||||
|
{ |
||||
|
public string PaymentMethod { get; set; } |
||||
|
|
||||
|
public string ExternalTradingCode { get; set; } |
||||
|
|
||||
|
public string Currency { get; set; } |
||||
|
|
||||
|
public decimal OriginalPaymentAmount { get; set; } |
||||
|
|
||||
|
public decimal PaymentDiscount { get; set; } |
||||
|
|
||||
|
public decimal ActualPaymentAmount { get; set; } |
||||
|
|
||||
|
public decimal RefundAmount { get; set; } |
||||
|
|
||||
|
public DateTime? CompletionTime { get; set; } |
||||
|
|
||||
|
public List<PaymentItemDto> PaymentItems { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Payments.Dtos |
||||
|
{ |
||||
|
public class PaymentItemDto : FullAuditedEntityDto<Guid> |
||||
|
{ |
||||
|
public string ItemType { get; set; } |
||||
|
|
||||
|
public Guid ItemKey { get; set; } |
||||
|
|
||||
|
public string Currency { get; set; } |
||||
|
|
||||
|
public decimal OriginalPaymentAmount { get; set; } |
||||
|
|
||||
|
public decimal PaymentDiscount { get; set; } |
||||
|
|
||||
|
public decimal ActualPaymentAmount { get; set; } |
||||
|
|
||||
|
public decimal RefundAmount { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
using System; |
||||
|
using EasyAbp.EShop.Payments.Payments.Dtos; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Payments |
||||
|
{ |
||||
|
public interface IPaymentAppService : |
||||
|
ICrudAppService< |
||||
|
PaymentDto, |
||||
|
Guid, |
||||
|
PagedAndSortedResultRequestDto, |
||||
|
CreatePaymentDto, |
||||
|
object> |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel; |
||||
|
namespace EasyAbp.EShop.Payments.Refunds.Dtos |
||||
|
{ |
||||
|
public class CreateRefundDto |
||||
|
{ |
||||
|
[DisplayName("RefundStoreId")] |
||||
|
public Guid StoreId { get; set; } |
||||
|
|
||||
|
[DisplayName("RefundOrderId")] |
||||
|
public Guid OrderId { get; set; } |
||||
|
|
||||
|
[DisplayName("RefundRefundPaymentMethod")] |
||||
|
public string RefundPaymentMethod { get; set; } |
||||
|
|
||||
|
[DisplayName("RefundExternalTradingCode")] |
||||
|
public string ExternalTradingCode { get; set; } |
||||
|
|
||||
|
[DisplayName("RefundCurrency")] |
||||
|
public string Currency { get; set; } |
||||
|
|
||||
|
[DisplayName("RefundRefundAmount")] |
||||
|
public decimal RefundAmount { get; set; } |
||||
|
|
||||
|
[DisplayName("RefundCustomerRemark")] |
||||
|
public string CustomerRemark { get; set; } |
||||
|
|
||||
|
[DisplayName("RefundStaffRemark")] |
||||
|
public string StaffRemark { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Refunds.Dtos |
||||
|
{ |
||||
|
public class RefundDto : FullAuditedEntityDto<Guid> |
||||
|
{ |
||||
|
public Guid StoreId { get; set; } |
||||
|
|
||||
|
public Guid OrderId { get; set; } |
||||
|
|
||||
|
public string RefundPaymentMethod { get; set; } |
||||
|
|
||||
|
public string ExternalTradingCode { get; set; } |
||||
|
|
||||
|
public string Currency { get; set; } |
||||
|
|
||||
|
public decimal RefundAmount { get; set; } |
||||
|
|
||||
|
public string CustomerRemark { get; set; } |
||||
|
|
||||
|
public string StaffRemark { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
using System; |
||||
|
using EasyAbp.EShop.Payments.Refunds.Dtos; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Refunds |
||||
|
{ |
||||
|
public interface IRefundAppService : |
||||
|
ICrudAppService< |
||||
|
RefundDto, |
||||
|
Guid, |
||||
|
PagedAndSortedResultRequestDto, |
||||
|
CreateRefundDto, |
||||
|
object> |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,45 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using EasyAbp.EShop.Orders.Orders; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Users; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Payments |
||||
|
{ |
||||
|
public class EShopOrderPaymentAuthorizer : IPaymentAuthorizer, ITransientDependency |
||||
|
{ |
||||
|
private readonly ICurrentUser _currentUser; |
||||
|
private readonly IOrderAppService _orderAppService; |
||||
|
|
||||
|
public EShopOrderPaymentAuthorizer( |
||||
|
ICurrentUser currentUser, |
||||
|
IOrderAppService orderAppService) |
||||
|
{ |
||||
|
_currentUser = currentUser; |
||||
|
_orderAppService = orderAppService; |
||||
|
} |
||||
|
|
||||
|
public virtual async Task<bool> IsPaymentItemAllowedAsync(Payment payment, PaymentItem paymentItem, |
||||
|
Dictionary<string, object> inputExtraProperties) |
||||
|
{ |
||||
|
if (paymentItem.ItemType != "EasyAbpEShopOrder") |
||||
|
{ |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
var order = await _orderAppService.GetAsync(paymentItem.ItemKey); |
||||
|
|
||||
|
if (order.CustomerUserId != _currentUser.Id) |
||||
|
{ |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
if (order.TotalPrice != paymentItem.OriginalPaymentAmount) |
||||
|
{ |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
return order.OrderStatus == OrderStatus.Pending; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Payments |
||||
|
{ |
||||
|
public interface IPaymentAuthorizer |
||||
|
{ |
||||
|
Task<bool> IsPaymentItemAllowedAsync(Payment payment, PaymentItem paymentItem, |
||||
|
Dictionary<string, object> inputExtraProperties); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using Volo.Abp; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Payments |
||||
|
{ |
||||
|
public class MultiCurrencyNotSupportedException : BusinessException |
||||
|
{ |
||||
|
public MultiCurrencyNotSupportedException() : base(message: $"Multi-currency is not supported.") |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,107 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
using EasyAbp.EShop.Payments.Payments.Dtos; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Payments |
||||
|
{ |
||||
|
public class PaymentAppService : CrudAppService<Payment, PaymentDto, Guid, PagedAndSortedResultRequestDto, CreatePaymentDto, object>, |
||||
|
IPaymentAppService |
||||
|
{ |
||||
|
private readonly IPaymentPayeeAccountProvider _paymentPayeeAccountProvider; |
||||
|
private readonly IPaymentServiceResolver _paymentServiceResolver; |
||||
|
private readonly IPaymentRepository _repository; |
||||
|
|
||||
|
public PaymentAppService( |
||||
|
IPaymentPayeeAccountProvider paymentPayeeAccountProvider, |
||||
|
IPaymentServiceResolver paymentServiceResolver, |
||||
|
IPaymentRepository repository) : base(repository) |
||||
|
{ |
||||
|
_paymentPayeeAccountProvider = paymentPayeeAccountProvider; |
||||
|
_paymentServiceResolver = paymentServiceResolver; |
||||
|
_repository = repository; |
||||
|
} |
||||
|
|
||||
|
public override async Task<PaymentDto> CreateAsync(CreatePaymentDto input) |
||||
|
{ |
||||
|
await CheckCreatePolicyAsync(); |
||||
|
|
||||
|
var providerType = await _paymentServiceResolver.GetProviderTypeOrDefaultAsync(input.PaymentMethod); |
||||
|
|
||||
|
var provider = ServiceProvider.GetService(providerType) as IPaymentServiceProvider; |
||||
|
|
||||
|
if (providerType == null || provider == null) |
||||
|
{ |
||||
|
throw new UnknownPaymentMethodException(input.PaymentMethod); |
||||
|
} |
||||
|
|
||||
|
var paymentItems = input.PaymentItems.Select(inputPaymentItem => |
||||
|
new PaymentItem(GuidGenerator.Create(), inputPaymentItem.ItemType, inputPaymentItem.ItemKey, |
||||
|
inputPaymentItem.Currency, inputPaymentItem.OriginalPaymentAmount)).ToList(); |
||||
|
|
||||
|
if (paymentItems.Select(item => item.Currency).Any(c => c != input.Currency)) |
||||
|
{ |
||||
|
throw new MultiCurrencyNotSupportedException(); |
||||
|
} |
||||
|
|
||||
|
var payment = new Payment(GuidGenerator.Create(), CurrentTenant.Id, input.PaymentMethod, input.Currency, |
||||
|
paymentItems.Select(item => item.OriginalPaymentAmount).Sum(), paymentItems); |
||||
|
|
||||
|
await Repository.InsertAsync(payment, autoSave: true); |
||||
|
|
||||
|
await CheckPayableAsync(payment, input.ExtraProperties); |
||||
|
|
||||
|
await FillPayeeAccountAsync(payment, input.ExtraProperties); |
||||
|
|
||||
|
// Todo: payment discount
|
||||
|
|
||||
|
await provider.PayAsync(payment); |
||||
|
|
||||
|
return MapToGetOutputDto(payment); |
||||
|
} |
||||
|
|
||||
|
protected virtual async Task FillPayeeAccountAsync(Payment payment, Dictionary<string, object> inputExtraProperties) |
||||
|
{ |
||||
|
payment.SetPayeeAccount( |
||||
|
await _paymentPayeeAccountProvider.GetPayeeAccountAsync(payment, inputExtraProperties)); |
||||
|
} |
||||
|
|
||||
|
protected virtual async Task CheckPayableAsync(Payment payment, Dictionary<string, object> inputExtraProperties) |
||||
|
{ |
||||
|
var itemSet = new HashSet<PaymentItem>(payment.PaymentItems); |
||||
|
|
||||
|
foreach (var authorizer in ServiceProvider.GetServices<IPaymentAuthorizer>()) |
||||
|
{ |
||||
|
foreach (var item in itemSet.ToList()) |
||||
|
{ |
||||
|
if (await authorizer.IsPaymentItemAllowedAsync(payment, item, inputExtraProperties)) |
||||
|
{ |
||||
|
itemSet.Remove(item); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
if (!itemSet.IsNullOrEmpty()) |
||||
|
{ |
||||
|
throw new PaymentItemNotPayableException(itemSet.Select(item => item.ItemKey).ToList()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
[RemoteService(false)] |
||||
|
public override Task<PaymentDto> UpdateAsync(Guid id, object input) |
||||
|
{ |
||||
|
throw new NotSupportedException(); |
||||
|
} |
||||
|
|
||||
|
[RemoteService(false)] |
||||
|
public override Task DeleteAsync(Guid id) |
||||
|
{ |
||||
|
throw new NotSupportedException(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using Volo.Abp; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Payments |
||||
|
{ |
||||
|
public class PaymentItemNotPayableException : BusinessException |
||||
|
{ |
||||
|
public PaymentItemNotPayableException(Guid itemKey) : base( |
||||
|
message: $"Payment item ({itemKey}) is not payable") |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
public PaymentItemNotPayableException(IEnumerable<Guid> itemKeys) : base( |
||||
|
message: $"Payment item ({itemKeys.JoinAsString(", ")}) is not payable") |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
using EasyAbp.EShop.Payments.Payments; |
||||
|
using EasyAbp.EShop.Payments.Payments.Dtos; |
||||
|
using EasyAbp.EShop.Payments.Refunds; |
||||
|
using EasyAbp.EShop.Payments.Refunds.Dtos; |
||||
|
using AutoMapper; |
||||
|
using Volo.Abp.AutoMapper; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments |
||||
|
{ |
||||
|
public class PaymentsApplicationAutoMapperProfile : Profile |
||||
|
{ |
||||
|
public PaymentsApplicationAutoMapperProfile() |
||||
|
{ |
||||
|
/* You can configure your AutoMapper mapping configuration here. |
||||
|
* Alternatively, you can split your mapping configurations |
||||
|
* into multiple profile classes for a better organization. */ |
||||
|
CreateMap<Payment, PaymentDto>(); |
||||
|
CreateMap<Refund, RefundDto>(); |
||||
|
CreateMap<CreateRefundDto, Refund>(MemberList.Source); |
||||
|
CreateMap<PaymentItem, PaymentItemDto>(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
using System; |
||||
|
using EasyAbp.EShop.Payments.Refunds.Dtos; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Refunds |
||||
|
{ |
||||
|
public class RefundAppService : CrudAppService<Refund, RefundDto, Guid, PagedAndSortedResultRequestDto, CreateRefundDto, object>, |
||||
|
IRefundAppService |
||||
|
{ |
||||
|
private readonly IRefundRepository _repository; |
||||
|
|
||||
|
public RefundAppService(IRefundRepository repository) : base(repository) |
||||
|
{ |
||||
|
_repository = repository; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,47 @@ |
|||||
|
{ |
||||
|
"culture": "cs", |
||||
|
"texts": { |
||||
|
"Menu:Payment": "MenuPayment", |
||||
|
"Payment": "Payment", |
||||
|
"PaymentTenantId": "PaymentTenantId", |
||||
|
"PaymentPaymentMethod": "PaymentPaymentMethod", |
||||
|
"PaymentExternalTradingCode": "PaymentExternalTradingCode", |
||||
|
"PaymentCurrency": "PaymentCurrency", |
||||
|
"PaymentOriginalPaymentAmount": "PaymentOriginalPaymentAmount", |
||||
|
"PaymentExtraProperties": "PaymentExtraProperties", |
||||
|
"PaymentPaymentDiscount": "PaymentPaymentDiscount", |
||||
|
"PaymentActualPaymentAmount": "PaymentActualPaymentAmount", |
||||
|
"PaymentRefundAmount": "PaymentRefundAmount", |
||||
|
"PaymentCompletionTime": "PaymentCompletionTime", |
||||
|
"CreatePayment": "CreatePayment", |
||||
|
"EditPayment": "EditPayment", |
||||
|
"PaymentDeletionConfirmationMessage": "Are you sure to delete the payment {0}?", |
||||
|
"SuccessfullyDeleted": "Successfully deleted", |
||||
|
"Menu:Refund": "MenuRefund", |
||||
|
"Refund": "Refund", |
||||
|
"RefundTenantId": "RefundTenantId", |
||||
|
"RefundStoreId": "RefundStoreId", |
||||
|
"RefundOrderId": "RefundOrderId", |
||||
|
"RefundRefundPaymentMethod": "RefundRefundPaymentMethod", |
||||
|
"RefundExternalTradingCode": "RefundExternalTradingCode", |
||||
|
"RefundCurrency": "RefundCurrency", |
||||
|
"RefundRefundAmount": "RefundRefundAmount", |
||||
|
"RefundCustomerRemark": "RefundCustomerRemark", |
||||
|
"RefundStaffRemark": "RefundStaffRemark", |
||||
|
"CreateRefund": "CreateRefund", |
||||
|
"EditRefund": "EditRefund", |
||||
|
"RefundDeletionConfirmationMessage": "Are you sure to delete the refund {0}?", |
||||
|
"Menu:PaymentItem": "MenuPaymentItem", |
||||
|
"PaymentItem": "PaymentItem", |
||||
|
"PaymentItemItemType": "PaymentItemItemType", |
||||
|
"PaymentItemItemKey": "PaymentItemItemKey", |
||||
|
"PaymentItemCurrency": "PaymentItemCurrency", |
||||
|
"PaymentItemOriginalPaymentAmount": "PaymentItemOriginalPaymentAmount", |
||||
|
"PaymentItemPaymentDiscount": "PaymentItemPaymentDiscount", |
||||
|
"PaymentItemActualPaymentAmount": "PaymentItemActualPaymentAmount", |
||||
|
"PaymentItemRefundAmount": "PaymentItemRefundAmount", |
||||
|
"CreatePaymentItem": "CreatePaymentItem", |
||||
|
"EditPaymentItem": "EditPaymentItem", |
||||
|
"PaymentItemDeletionConfirmationMessage": "Are you sure to delete the PaymentItem {0}?" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,48 @@ |
|||||
|
{ |
||||
|
"culture": "en", |
||||
|
"texts": { |
||||
|
"ManageYourProfile": "Manage your profile", |
||||
|
"Menu:Payment": "MenuPayment", |
||||
|
"Payment": "Payment", |
||||
|
"PaymentTenantId": "PaymentTenantId", |
||||
|
"PaymentPaymentMethod": "PaymentPaymentMethod", |
||||
|
"PaymentExternalTradingCode": "PaymentExternalTradingCode", |
||||
|
"PaymentCurrency": "PaymentCurrency", |
||||
|
"PaymentOriginalPaymentAmount": "PaymentOriginalPaymentAmount", |
||||
|
"PaymentExtraProperties": "PaymentExtraProperties", |
||||
|
"PaymentPaymentDiscount": "PaymentPaymentDiscount", |
||||
|
"PaymentActualPaymentAmount": "PaymentActualPaymentAmount", |
||||
|
"PaymentRefundAmount": "PaymentRefundAmount", |
||||
|
"PaymentCompletionTime": "PaymentCompletionTime", |
||||
|
"CreatePayment": "CreatePayment", |
||||
|
"EditPayment": "EditPayment", |
||||
|
"PaymentDeletionConfirmationMessage": "Are you sure to delete the payment {0}?", |
||||
|
"SuccessfullyDeleted": "Successfully deleted", |
||||
|
"Menu:Refund": "MenuRefund", |
||||
|
"Refund": "Refund", |
||||
|
"RefundTenantId": "RefundTenantId", |
||||
|
"RefundStoreId": "RefundStoreId", |
||||
|
"RefundOrderId": "RefundOrderId", |
||||
|
"RefundRefundPaymentMethod": "RefundRefundPaymentMethod", |
||||
|
"RefundExternalTradingCode": "RefundExternalTradingCode", |
||||
|
"RefundCurrency": "RefundCurrency", |
||||
|
"RefundRefundAmount": "RefundRefundAmount", |
||||
|
"RefundCustomerRemark": "RefundCustomerRemark", |
||||
|
"RefundStaffRemark": "RefundStaffRemark", |
||||
|
"CreateRefund": "CreateRefund", |
||||
|
"EditRefund": "EditRefund", |
||||
|
"RefundDeletionConfirmationMessage": "Are you sure to delete the refund {0}?", |
||||
|
"Menu:PaymentItem": "MenuPaymentItem", |
||||
|
"PaymentItem": "PaymentItem", |
||||
|
"PaymentItemItemType": "PaymentItemItemType", |
||||
|
"PaymentItemItemKey": "PaymentItemItemKey", |
||||
|
"PaymentItemCurrency": "PaymentItemCurrency", |
||||
|
"PaymentItemOriginalPaymentAmount": "PaymentItemOriginalPaymentAmount", |
||||
|
"PaymentItemPaymentDiscount": "PaymentItemPaymentDiscount", |
||||
|
"PaymentItemActualPaymentAmount": "PaymentItemActualPaymentAmount", |
||||
|
"PaymentItemRefundAmount": "PaymentItemRefundAmount", |
||||
|
"CreatePaymentItem": "CreatePaymentItem", |
||||
|
"EditPaymentItem": "EditPaymentItem", |
||||
|
"PaymentItemDeletionConfirmationMessage": "Are you sure to delete the PaymentItem {0}?" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,47 @@ |
|||||
|
{ |
||||
|
"culture": "pl", |
||||
|
"texts": { |
||||
|
"Menu:Payment": "MenuPayment", |
||||
|
"Payment": "Payment", |
||||
|
"PaymentTenantId": "PaymentTenantId", |
||||
|
"PaymentPaymentMethod": "PaymentPaymentMethod", |
||||
|
"PaymentExternalTradingCode": "PaymentExternalTradingCode", |
||||
|
"PaymentCurrency": "PaymentCurrency", |
||||
|
"PaymentOriginalPaymentAmount": "PaymentOriginalPaymentAmount", |
||||
|
"PaymentExtraProperties": "PaymentExtraProperties", |
||||
|
"PaymentPaymentDiscount": "PaymentPaymentDiscount", |
||||
|
"PaymentActualPaymentAmount": "PaymentActualPaymentAmount", |
||||
|
"PaymentRefundAmount": "PaymentRefundAmount", |
||||
|
"PaymentCompletionTime": "PaymentCompletionTime", |
||||
|
"CreatePayment": "CreatePayment", |
||||
|
"EditPayment": "EditPayment", |
||||
|
"PaymentDeletionConfirmationMessage": "Are you sure to delete the payment {0}?", |
||||
|
"SuccessfullyDeleted": "Successfully deleted", |
||||
|
"Menu:Refund": "MenuRefund", |
||||
|
"Refund": "Refund", |
||||
|
"RefundTenantId": "RefundTenantId", |
||||
|
"RefundStoreId": "RefundStoreId", |
||||
|
"RefundOrderId": "RefundOrderId", |
||||
|
"RefundRefundPaymentMethod": "RefundRefundPaymentMethod", |
||||
|
"RefundExternalTradingCode": "RefundExternalTradingCode", |
||||
|
"RefundCurrency": "RefundCurrency", |
||||
|
"RefundRefundAmount": "RefundRefundAmount", |
||||
|
"RefundCustomerRemark": "RefundCustomerRemark", |
||||
|
"RefundStaffRemark": "RefundStaffRemark", |
||||
|
"CreateRefund": "CreateRefund", |
||||
|
"EditRefund": "EditRefund", |
||||
|
"RefundDeletionConfirmationMessage": "Are you sure to delete the refund {0}?", |
||||
|
"Menu:PaymentItem": "MenuPaymentItem", |
||||
|
"PaymentItem": "PaymentItem", |
||||
|
"PaymentItemItemType": "PaymentItemItemType", |
||||
|
"PaymentItemItemKey": "PaymentItemItemKey", |
||||
|
"PaymentItemCurrency": "PaymentItemCurrency", |
||||
|
"PaymentItemOriginalPaymentAmount": "PaymentItemOriginalPaymentAmount", |
||||
|
"PaymentItemPaymentDiscount": "PaymentItemPaymentDiscount", |
||||
|
"PaymentItemActualPaymentAmount": "PaymentItemActualPaymentAmount", |
||||
|
"PaymentItemRefundAmount": "PaymentItemRefundAmount", |
||||
|
"CreatePaymentItem": "CreatePaymentItem", |
||||
|
"EditPaymentItem": "EditPaymentItem", |
||||
|
"PaymentItemDeletionConfirmationMessage": "Are you sure to delete the PaymentItem {0}?" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,47 @@ |
|||||
|
{ |
||||
|
"culture": "pt-BR", |
||||
|
"texts": { |
||||
|
"Menu:Payment": "MenuPayment", |
||||
|
"Payment": "Payment", |
||||
|
"PaymentTenantId": "PaymentTenantId", |
||||
|
"PaymentPaymentMethod": "PaymentPaymentMethod", |
||||
|
"PaymentExternalTradingCode": "PaymentExternalTradingCode", |
||||
|
"PaymentCurrency": "PaymentCurrency", |
||||
|
"PaymentOriginalPaymentAmount": "PaymentOriginalPaymentAmount", |
||||
|
"PaymentExtraProperties": "PaymentExtraProperties", |
||||
|
"PaymentPaymentDiscount": "PaymentPaymentDiscount", |
||||
|
"PaymentActualPaymentAmount": "PaymentActualPaymentAmount", |
||||
|
"PaymentRefundAmount": "PaymentRefundAmount", |
||||
|
"PaymentCompletionTime": "PaymentCompletionTime", |
||||
|
"CreatePayment": "CreatePayment", |
||||
|
"EditPayment": "EditPayment", |
||||
|
"PaymentDeletionConfirmationMessage": "Are you sure to delete the payment {0}?", |
||||
|
"SuccessfullyDeleted": "Successfully deleted", |
||||
|
"Menu:Refund": "MenuRefund", |
||||
|
"Refund": "Refund", |
||||
|
"RefundTenantId": "RefundTenantId", |
||||
|
"RefundStoreId": "RefundStoreId", |
||||
|
"RefundOrderId": "RefundOrderId", |
||||
|
"RefundRefundPaymentMethod": "RefundRefundPaymentMethod", |
||||
|
"RefundExternalTradingCode": "RefundExternalTradingCode", |
||||
|
"RefundCurrency": "RefundCurrency", |
||||
|
"RefundRefundAmount": "RefundRefundAmount", |
||||
|
"RefundCustomerRemark": "RefundCustomerRemark", |
||||
|
"RefundStaffRemark": "RefundStaffRemark", |
||||
|
"CreateRefund": "CreateRefund", |
||||
|
"EditRefund": "EditRefund", |
||||
|
"RefundDeletionConfirmationMessage": "Are you sure to delete the refund {0}?", |
||||
|
"Menu:PaymentItem": "MenuPaymentItem", |
||||
|
"PaymentItem": "PaymentItem", |
||||
|
"PaymentItemItemType": "PaymentItemItemType", |
||||
|
"PaymentItemItemKey": "PaymentItemItemKey", |
||||
|
"PaymentItemCurrency": "PaymentItemCurrency", |
||||
|
"PaymentItemOriginalPaymentAmount": "PaymentItemOriginalPaymentAmount", |
||||
|
"PaymentItemPaymentDiscount": "PaymentItemPaymentDiscount", |
||||
|
"PaymentItemActualPaymentAmount": "PaymentItemActualPaymentAmount", |
||||
|
"PaymentItemRefundAmount": "PaymentItemRefundAmount", |
||||
|
"CreatePaymentItem": "CreatePaymentItem", |
||||
|
"EditPaymentItem": "EditPaymentItem", |
||||
|
"PaymentItemDeletionConfirmationMessage": "Are you sure to delete the PaymentItem {0}?" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,48 @@ |
|||||
|
{ |
||||
|
"culture": "sl", |
||||
|
"texts": { |
||||
|
"ManageYourProfile": "Upravljajte svojim profilom", |
||||
|
"Menu:Payment": "MenuPayment", |
||||
|
"Payment": "Payment", |
||||
|
"PaymentTenantId": "PaymentTenantId", |
||||
|
"PaymentPaymentMethod": "PaymentPaymentMethod", |
||||
|
"PaymentExternalTradingCode": "PaymentExternalTradingCode", |
||||
|
"PaymentCurrency": "PaymentCurrency", |
||||
|
"PaymentOriginalPaymentAmount": "PaymentOriginalPaymentAmount", |
||||
|
"PaymentExtraProperties": "PaymentExtraProperties", |
||||
|
"PaymentPaymentDiscount": "PaymentPaymentDiscount", |
||||
|
"PaymentActualPaymentAmount": "PaymentActualPaymentAmount", |
||||
|
"PaymentRefundAmount": "PaymentRefundAmount", |
||||
|
"PaymentCompletionTime": "PaymentCompletionTime", |
||||
|
"CreatePayment": "CreatePayment", |
||||
|
"EditPayment": "EditPayment", |
||||
|
"PaymentDeletionConfirmationMessage": "Are you sure to delete the payment {0}?", |
||||
|
"SuccessfullyDeleted": "Successfully deleted", |
||||
|
"Menu:Refund": "MenuRefund", |
||||
|
"Refund": "Refund", |
||||
|
"RefundTenantId": "RefundTenantId", |
||||
|
"RefundStoreId": "RefundStoreId", |
||||
|
"RefundOrderId": "RefundOrderId", |
||||
|
"RefundRefundPaymentMethod": "RefundRefundPaymentMethod", |
||||
|
"RefundExternalTradingCode": "RefundExternalTradingCode", |
||||
|
"RefundCurrency": "RefundCurrency", |
||||
|
"RefundRefundAmount": "RefundRefundAmount", |
||||
|
"RefundCustomerRemark": "RefundCustomerRemark", |
||||
|
"RefundStaffRemark": "RefundStaffRemark", |
||||
|
"CreateRefund": "CreateRefund", |
||||
|
"EditRefund": "EditRefund", |
||||
|
"RefundDeletionConfirmationMessage": "Are you sure to delete the refund {0}?", |
||||
|
"Menu:PaymentItem": "MenuPaymentItem", |
||||
|
"PaymentItem": "PaymentItem", |
||||
|
"PaymentItemItemType": "PaymentItemItemType", |
||||
|
"PaymentItemItemKey": "PaymentItemItemKey", |
||||
|
"PaymentItemCurrency": "PaymentItemCurrency", |
||||
|
"PaymentItemOriginalPaymentAmount": "PaymentItemOriginalPaymentAmount", |
||||
|
"PaymentItemPaymentDiscount": "PaymentItemPaymentDiscount", |
||||
|
"PaymentItemActualPaymentAmount": "PaymentItemActualPaymentAmount", |
||||
|
"PaymentItemRefundAmount": "PaymentItemRefundAmount", |
||||
|
"CreatePaymentItem": "CreatePaymentItem", |
||||
|
"EditPaymentItem": "EditPaymentItem", |
||||
|
"PaymentItemDeletionConfirmationMessage": "Are you sure to delete the PaymentItem {0}?" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,48 @@ |
|||||
|
{ |
||||
|
"culture": "tr", |
||||
|
"texts": { |
||||
|
"ManageYourProfile": "Profil y�netimi", |
||||
|
"Menu:Payment": "MenuPayment", |
||||
|
"Payment": "Payment", |
||||
|
"PaymentTenantId": "PaymentTenantId", |
||||
|
"PaymentPaymentMethod": "PaymentPaymentMethod", |
||||
|
"PaymentExternalTradingCode": "PaymentExternalTradingCode", |
||||
|
"PaymentCurrency": "PaymentCurrency", |
||||
|
"PaymentOriginalPaymentAmount": "PaymentOriginalPaymentAmount", |
||||
|
"PaymentExtraProperties": "PaymentExtraProperties", |
||||
|
"PaymentPaymentDiscount": "PaymentPaymentDiscount", |
||||
|
"PaymentActualPaymentAmount": "PaymentActualPaymentAmount", |
||||
|
"PaymentRefundAmount": "PaymentRefundAmount", |
||||
|
"PaymentCompletionTime": "PaymentCompletionTime", |
||||
|
"CreatePayment": "CreatePayment", |
||||
|
"EditPayment": "EditPayment", |
||||
|
"PaymentDeletionConfirmationMessage": "Are you sure to delete the payment {0}?", |
||||
|
"SuccessfullyDeleted": "Successfully deleted", |
||||
|
"Menu:Refund": "MenuRefund", |
||||
|
"Refund": "Refund", |
||||
|
"RefundTenantId": "RefundTenantId", |
||||
|
"RefundStoreId": "RefundStoreId", |
||||
|
"RefundOrderId": "RefundOrderId", |
||||
|
"RefundRefundPaymentMethod": "RefundRefundPaymentMethod", |
||||
|
"RefundExternalTradingCode": "RefundExternalTradingCode", |
||||
|
"RefundCurrency": "RefundCurrency", |
||||
|
"RefundRefundAmount": "RefundRefundAmount", |
||||
|
"RefundCustomerRemark": "RefundCustomerRemark", |
||||
|
"RefundStaffRemark": "RefundStaffRemark", |
||||
|
"CreateRefund": "CreateRefund", |
||||
|
"EditRefund": "EditRefund", |
||||
|
"RefundDeletionConfirmationMessage": "Are you sure to delete the refund {0}?", |
||||
|
"Menu:PaymentItem": "MenuPaymentItem", |
||||
|
"PaymentItem": "PaymentItem", |
||||
|
"PaymentItemItemType": "PaymentItemItemType", |
||||
|
"PaymentItemItemKey": "PaymentItemItemKey", |
||||
|
"PaymentItemCurrency": "PaymentItemCurrency", |
||||
|
"PaymentItemOriginalPaymentAmount": "PaymentItemOriginalPaymentAmount", |
||||
|
"PaymentItemPaymentDiscount": "PaymentItemPaymentDiscount", |
||||
|
"PaymentItemActualPaymentAmount": "PaymentItemActualPaymentAmount", |
||||
|
"PaymentItemRefundAmount": "PaymentItemRefundAmount", |
||||
|
"CreatePaymentItem": "CreatePaymentItem", |
||||
|
"EditPaymentItem": "EditPaymentItem", |
||||
|
"PaymentItemDeletionConfirmationMessage": "Are you sure to delete the PaymentItem {0}?" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,47 @@ |
|||||
|
{ |
||||
|
"culture": "vi", |
||||
|
"texts": { |
||||
|
"Menu:Payment": "MenuPayment", |
||||
|
"Payment": "Payment", |
||||
|
"PaymentTenantId": "PaymentTenantId", |
||||
|
"PaymentPaymentMethod": "PaymentPaymentMethod", |
||||
|
"PaymentExternalTradingCode": "PaymentExternalTradingCode", |
||||
|
"PaymentCurrency": "PaymentCurrency", |
||||
|
"PaymentOriginalPaymentAmount": "PaymentOriginalPaymentAmount", |
||||
|
"PaymentExtraProperties": "PaymentExtraProperties", |
||||
|
"PaymentPaymentDiscount": "PaymentPaymentDiscount", |
||||
|
"PaymentActualPaymentAmount": "PaymentActualPaymentAmount", |
||||
|
"PaymentRefundAmount": "PaymentRefundAmount", |
||||
|
"PaymentCompletionTime": "PaymentCompletionTime", |
||||
|
"CreatePayment": "CreatePayment", |
||||
|
"EditPayment": "EditPayment", |
||||
|
"PaymentDeletionConfirmationMessage": "Are you sure to delete the payment {0}?", |
||||
|
"SuccessfullyDeleted": "Successfully deleted", |
||||
|
"Menu:Refund": "MenuRefund", |
||||
|
"Refund": "Refund", |
||||
|
"RefundTenantId": "RefundTenantId", |
||||
|
"RefundStoreId": "RefundStoreId", |
||||
|
"RefundOrderId": "RefundOrderId", |
||||
|
"RefundRefundPaymentMethod": "RefundRefundPaymentMethod", |
||||
|
"RefundExternalTradingCode": "RefundExternalTradingCode", |
||||
|
"RefundCurrency": "RefundCurrency", |
||||
|
"RefundRefundAmount": "RefundRefundAmount", |
||||
|
"RefundCustomerRemark": "RefundCustomerRemark", |
||||
|
"RefundStaffRemark": "RefundStaffRemark", |
||||
|
"CreateRefund": "CreateRefund", |
||||
|
"EditRefund": "EditRefund", |
||||
|
"RefundDeletionConfirmationMessage": "Are you sure to delete the refund {0}?", |
||||
|
"Menu:PaymentItem": "MenuPaymentItem", |
||||
|
"PaymentItem": "PaymentItem", |
||||
|
"PaymentItemItemType": "PaymentItemItemType", |
||||
|
"PaymentItemItemKey": "PaymentItemItemKey", |
||||
|
"PaymentItemCurrency": "PaymentItemCurrency", |
||||
|
"PaymentItemOriginalPaymentAmount": "PaymentItemOriginalPaymentAmount", |
||||
|
"PaymentItemPaymentDiscount": "PaymentItemPaymentDiscount", |
||||
|
"PaymentItemActualPaymentAmount": "PaymentItemActualPaymentAmount", |
||||
|
"PaymentItemRefundAmount": "PaymentItemRefundAmount", |
||||
|
"CreatePaymentItem": "CreatePaymentItem", |
||||
|
"EditPaymentItem": "EditPaymentItem", |
||||
|
"PaymentItemDeletionConfirmationMessage": "Are you sure to delete the PaymentItem {0}?" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,48 @@ |
|||||
|
{ |
||||
|
"culture": "zh-Hans", |
||||
|
"texts": { |
||||
|
"ManageYourProfile": "管理个人资料", |
||||
|
"Menu:Payment": "MenuPayment", |
||||
|
"Payment": "Payment", |
||||
|
"PaymentTenantId": "PaymentTenantId", |
||||
|
"PaymentPaymentMethod": "PaymentPaymentMethod", |
||||
|
"PaymentExternalTradingCode": "PaymentExternalTradingCode", |
||||
|
"PaymentCurrency": "PaymentCurrency", |
||||
|
"PaymentOriginalPaymentAmount": "PaymentOriginalPaymentAmount", |
||||
|
"PaymentExtraProperties": "PaymentExtraProperties", |
||||
|
"PaymentPaymentDiscount": "PaymentPaymentDiscount", |
||||
|
"PaymentActualPaymentAmount": "PaymentActualPaymentAmount", |
||||
|
"PaymentRefundAmount": "PaymentRefundAmount", |
||||
|
"PaymentCompletionTime": "PaymentCompletionTime", |
||||
|
"CreatePayment": "CreatePayment", |
||||
|
"EditPayment": "EditPayment", |
||||
|
"PaymentDeletionConfirmationMessage": "Are you sure to delete the payment {0}?", |
||||
|
"SuccessfullyDeleted": "Successfully deleted", |
||||
|
"Menu:Refund": "MenuRefund", |
||||
|
"Refund": "Refund", |
||||
|
"RefundTenantId": "RefundTenantId", |
||||
|
"RefundStoreId": "RefundStoreId", |
||||
|
"RefundOrderId": "RefundOrderId", |
||||
|
"RefundRefundPaymentMethod": "RefundRefundPaymentMethod", |
||||
|
"RefundExternalTradingCode": "RefundExternalTradingCode", |
||||
|
"RefundCurrency": "RefundCurrency", |
||||
|
"RefundRefundAmount": "RefundRefundAmount", |
||||
|
"RefundCustomerRemark": "RefundCustomerRemark", |
||||
|
"RefundStaffRemark": "RefundStaffRemark", |
||||
|
"CreateRefund": "CreateRefund", |
||||
|
"EditRefund": "EditRefund", |
||||
|
"RefundDeletionConfirmationMessage": "Are you sure to delete the refund {0}?", |
||||
|
"Menu:PaymentItem": "MenuPaymentItem", |
||||
|
"PaymentItem": "PaymentItem", |
||||
|
"PaymentItemItemType": "PaymentItemItemType", |
||||
|
"PaymentItemItemKey": "PaymentItemItemKey", |
||||
|
"PaymentItemCurrency": "PaymentItemCurrency", |
||||
|
"PaymentItemOriginalPaymentAmount": "PaymentItemOriginalPaymentAmount", |
||||
|
"PaymentItemPaymentDiscount": "PaymentItemPaymentDiscount", |
||||
|
"PaymentItemActualPaymentAmount": "PaymentItemActualPaymentAmount", |
||||
|
"PaymentItemRefundAmount": "PaymentItemRefundAmount", |
||||
|
"CreatePaymentItem": "CreatePaymentItem", |
||||
|
"EditPaymentItem": "EditPaymentItem", |
||||
|
"PaymentItemDeletionConfirmationMessage": "Are you sure to delete the PaymentItem {0}?" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,48 @@ |
|||||
|
{ |
||||
|
"culture": "zh-Hant", |
||||
|
"texts": { |
||||
|
"ManageYourProfile": "管理個人資料", |
||||
|
"Menu:Payment": "MenuPayment", |
||||
|
"Payment": "Payment", |
||||
|
"PaymentTenantId": "PaymentTenantId", |
||||
|
"PaymentPaymentMethod": "PaymentPaymentMethod", |
||||
|
"PaymentExternalTradingCode": "PaymentExternalTradingCode", |
||||
|
"PaymentCurrency": "PaymentCurrency", |
||||
|
"PaymentOriginalPaymentAmount": "PaymentOriginalPaymentAmount", |
||||
|
"PaymentExtraProperties": "PaymentExtraProperties", |
||||
|
"PaymentPaymentDiscount": "PaymentPaymentDiscount", |
||||
|
"PaymentActualPaymentAmount": "PaymentActualPaymentAmount", |
||||
|
"PaymentRefundAmount": "PaymentRefundAmount", |
||||
|
"PaymentCompletionTime": "PaymentCompletionTime", |
||||
|
"CreatePayment": "CreatePayment", |
||||
|
"EditPayment": "EditPayment", |
||||
|
"PaymentDeletionConfirmationMessage": "Are you sure to delete the payment {0}?", |
||||
|
"SuccessfullyDeleted": "Successfully deleted", |
||||
|
"Menu:Refund": "MenuRefund", |
||||
|
"Refund": "Refund", |
||||
|
"RefundTenantId": "RefundTenantId", |
||||
|
"RefundStoreId": "RefundStoreId", |
||||
|
"RefundOrderId": "RefundOrderId", |
||||
|
"RefundRefundPaymentMethod": "RefundRefundPaymentMethod", |
||||
|
"RefundExternalTradingCode": "RefundExternalTradingCode", |
||||
|
"RefundCurrency": "RefundCurrency", |
||||
|
"RefundRefundAmount": "RefundRefundAmount", |
||||
|
"RefundCustomerRemark": "RefundCustomerRemark", |
||||
|
"RefundStaffRemark": "RefundStaffRemark", |
||||
|
"CreateRefund": "CreateRefund", |
||||
|
"EditRefund": "EditRefund", |
||||
|
"RefundDeletionConfirmationMessage": "Are you sure to delete the refund {0}?", |
||||
|
"Menu:PaymentItem": "MenuPaymentItem", |
||||
|
"PaymentItem": "PaymentItem", |
||||
|
"PaymentItemItemType": "PaymentItemItemType", |
||||
|
"PaymentItemItemKey": "PaymentItemItemKey", |
||||
|
"PaymentItemCurrency": "PaymentItemCurrency", |
||||
|
"PaymentItemOriginalPaymentAmount": "PaymentItemOriginalPaymentAmount", |
||||
|
"PaymentItemPaymentDiscount": "PaymentItemPaymentDiscount", |
||||
|
"PaymentItemActualPaymentAmount": "PaymentItemActualPaymentAmount", |
||||
|
"PaymentItemRefundAmount": "PaymentItemRefundAmount", |
||||
|
"CreatePaymentItem": "CreatePaymentItem", |
||||
|
"EditPaymentItem": "EditPaymentItem", |
||||
|
"PaymentItemDeletionConfirmationMessage": "Are you sure to delete the PaymentItem {0}?" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Payments |
||||
|
{ |
||||
|
[Serializable] |
||||
|
public class PaymentEto |
||||
|
{ |
||||
|
public Guid Id { get; set; } |
||||
|
|
||||
|
public Guid? TenantId { get; set; } |
||||
|
|
||||
|
public string PaymentMethod { get; set; } |
||||
|
|
||||
|
public string ExternalTradingCode { get; set; } |
||||
|
|
||||
|
public string Currency { get; set; } |
||||
|
|
||||
|
public decimal OriginalPaymentAmount { get; set; } |
||||
|
|
||||
|
public decimal PaymentDiscount { get; set; } |
||||
|
|
||||
|
public decimal ActualPaymentAmount { get; set; } |
||||
|
|
||||
|
public decimal RefundAmount { get; set; } |
||||
|
|
||||
|
public DateTime? CompletionTime { get; set; } |
||||
|
|
||||
|
public List<PaymentItemEto> PaymentItems { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
using System; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Payments |
||||
|
{ |
||||
|
[Serializable] |
||||
|
public class PaymentItemEto |
||||
|
{ |
||||
|
public Guid Id { get; set; } |
||||
|
|
||||
|
public string ItemType { get; set; } |
||||
|
|
||||
|
public Guid ItemKey { get; set; } |
||||
|
|
||||
|
public string Currency { get; set; } |
||||
|
|
||||
|
public decimal OriginalPaymentAmount { get; set; } |
||||
|
|
||||
|
public decimal PaymentDiscount { get; set; } |
||||
|
|
||||
|
public decimal ActualPaymentAmount { get; set; } |
||||
|
|
||||
|
public decimal RefundAmount { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -1,6 +0,0 @@ |
|||||
{ |
|
||||
"culture": "cs", |
|
||||
"texts": { |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
@ -1,6 +0,0 @@ |
|||||
{ |
|
||||
"culture": "en", |
|
||||
"texts": { |
|
||||
"ManageYourProfile": "Manage your profile" |
|
||||
} |
|
||||
} |
|
||||
@ -1,6 +0,0 @@ |
|||||
{ |
|
||||
"culture": "pl", |
|
||||
"texts": { |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
@ -1,6 +0,0 @@ |
|||||
{ |
|
||||
"culture": "pt-BR", |
|
||||
"texts": { |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
@ -1,6 +0,0 @@ |
|||||
{ |
|
||||
"culture": "sl", |
|
||||
"texts": { |
|
||||
"ManageYourProfile": "Upravljajte svojim profilom" |
|
||||
} |
|
||||
} |
|
||||
@ -1,6 +0,0 @@ |
|||||
{ |
|
||||
"culture": "tr", |
|
||||
"texts": { |
|
||||
"ManageYourProfile": "Profil yönetimi" |
|
||||
} |
|
||||
} |
|
||||
@ -1,6 +0,0 @@ |
|||||
{ |
|
||||
"culture": "vi", |
|
||||
"texts": { |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
@ -1,6 +0,0 @@ |
|||||
{ |
|
||||
"culture": "zh-Hans", |
|
||||
"texts": { |
|
||||
"ManageYourProfile": "管理个人资料" |
|
||||
} |
|
||||
} |
|
||||
@ -1,6 +0,0 @@ |
|||||
{ |
|
||||
"culture": "zh-Hant", |
|
||||
"texts": { |
|
||||
"ManageYourProfile": "管理個人資料" |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,33 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Timing; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Payments |
||||
|
{ |
||||
|
[Dependency(ServiceLifetime.Transient, TryRegister = true)] |
||||
|
public class FreePaymentServiceProvider : IPaymentServiceProvider |
||||
|
{ |
||||
|
private readonly IClock _clock; |
||||
|
private readonly IPaymentRepository _paymentRepository; |
||||
|
public const string PaymentMethod = "Free"; |
||||
|
|
||||
|
public FreePaymentServiceProvider( |
||||
|
IClock clock, |
||||
|
IPaymentRepository paymentRepository) |
||||
|
{ |
||||
|
_clock = clock; |
||||
|
_paymentRepository = paymentRepository; |
||||
|
} |
||||
|
|
||||
|
public async Task<Payment> PayAsync(Payment payment, Dictionary<string, object> extraProperties = null) |
||||
|
{ |
||||
|
payment.SetExternalTradingCode(payment.Id.ToString()); |
||||
|
|
||||
|
payment.CompletePayment(_clock.Now); |
||||
|
|
||||
|
return await _paymentRepository.UpdateAsync(payment, true); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Payments |
||||
|
{ |
||||
|
public interface IPaymentPayeeAccountProvider |
||||
|
{ |
||||
|
Task<string> GetPayeeAccountAsync(Payment payment, Dictionary<string, object> inputExtraProperties); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Payments |
||||
|
{ |
||||
|
public interface IPaymentRepository : IRepository<Payment, Guid> |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
using Volo.Abp; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Payments |
||||
|
{ |
||||
|
public class PayeeAccountNotFoundException : BusinessException |
||||
|
{ |
||||
|
public PayeeAccountNotFoundException(string paymentMethod) : base( |
||||
|
message: $"Cannot find the payee account of payment method {paymentMethod}.") |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,97 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using JetBrains.Annotations; |
||||
|
using Volo.Abp.Domain.Entities.Auditing; |
||||
|
using Volo.Abp.MultiTenancy; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Payments |
||||
|
{ |
||||
|
public class Payment : FullAuditedAggregateRoot<Guid>, IMultiTenant |
||||
|
{ |
||||
|
public virtual Guid? TenantId { get; protected set; } |
||||
|
|
||||
|
[NotNull] |
||||
|
public virtual string PaymentMethod { get; protected set; } |
||||
|
|
||||
|
[CanBeNull] |
||||
|
public virtual string PayeeAccount { get; protected set; } |
||||
|
|
||||
|
[CanBeNull] |
||||
|
public virtual string ExternalTradingCode { get; protected set; } |
||||
|
|
||||
|
[NotNull] |
||||
|
public virtual string Currency { get; protected set; } |
||||
|
|
||||
|
public virtual decimal OriginalPaymentAmount { get; protected set; } |
||||
|
|
||||
|
public virtual decimal PaymentDiscount { get; protected set; } |
||||
|
|
||||
|
public virtual decimal ActualPaymentAmount { get; protected set; } |
||||
|
|
||||
|
public virtual decimal RefundAmount { get; protected set; } |
||||
|
|
||||
|
public virtual DateTime? CompletionTime { get; protected set; } |
||||
|
|
||||
|
public virtual List<PaymentItem> PaymentItems { get; protected set; } |
||||
|
|
||||
|
protected Payment() |
||||
|
{ |
||||
|
PaymentItems = new List<PaymentItem>(); |
||||
|
} |
||||
|
|
||||
|
public Payment( |
||||
|
Guid id, |
||||
|
Guid? tenantId, |
||||
|
[NotNull] string paymentMethod, |
||||
|
[NotNull] string currency, |
||||
|
decimal originalPaymentAmount, |
||||
|
List<PaymentItem> paymentItems |
||||
|
) :base(id) |
||||
|
{ |
||||
|
TenantId = tenantId; |
||||
|
PaymentMethod = paymentMethod; |
||||
|
Currency = currency; |
||||
|
OriginalPaymentAmount = originalPaymentAmount; |
||||
|
PaymentItems = paymentItems; |
||||
|
} |
||||
|
|
||||
|
public void SetPayeeAccount([NotNull] string payeeAccount) |
||||
|
{ |
||||
|
PayeeAccount = payeeAccount; |
||||
|
} |
||||
|
|
||||
|
public void SetExternalTradingCode([NotNull] string externalTradingCode) |
||||
|
{ |
||||
|
CheckPaymentIsNotCompleted(); |
||||
|
|
||||
|
ExternalTradingCode = externalTradingCode; |
||||
|
} |
||||
|
|
||||
|
public void SetPaymentDiscount( |
||||
|
decimal paymentDiscount, |
||||
|
decimal actualPaymentAmount, |
||||
|
decimal refundAmount) |
||||
|
{ |
||||
|
CheckPaymentIsNotCompleted(); |
||||
|
|
||||
|
PaymentDiscount = paymentDiscount; |
||||
|
ActualPaymentAmount = actualPaymentAmount; |
||||
|
RefundAmount = refundAmount; |
||||
|
} |
||||
|
|
||||
|
public void CompletePayment(DateTime completionTime) |
||||
|
{ |
||||
|
CheckPaymentIsNotCompleted(); |
||||
|
|
||||
|
CompletionTime = completionTime; |
||||
|
} |
||||
|
|
||||
|
private void CheckPaymentIsNotCompleted() |
||||
|
{ |
||||
|
if (CompletionTime.HasValue) |
||||
|
{ |
||||
|
throw new PaymentHasAlreadyBeenCompletedException(Id); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Payments |
||||
|
{ |
||||
|
public class PaymentHasAlreadyBeenCompletedException : BusinessException |
||||
|
{ |
||||
|
public PaymentHasAlreadyBeenCompletedException(Guid id) : base( |
||||
|
message: $"Payment({id}) has already been completed.") |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,53 @@ |
|||||
|
using System; |
||||
|
using JetBrains.Annotations; |
||||
|
using Volo.Abp.Domain.Entities.Auditing; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Payments |
||||
|
{ |
||||
|
public class PaymentItem : FullAuditedEntity<Guid> |
||||
|
{ |
||||
|
[NotNull] |
||||
|
public virtual string ItemType { get; protected set; } |
||||
|
|
||||
|
public virtual Guid ItemKey { get; protected set; } |
||||
|
|
||||
|
[NotNull] |
||||
|
public virtual string Currency { get; protected set; } |
||||
|
|
||||
|
public virtual decimal OriginalPaymentAmount { get; protected set; } |
||||
|
|
||||
|
public virtual decimal PaymentDiscount { get; protected set; } |
||||
|
|
||||
|
public virtual decimal ActualPaymentAmount { get; protected set; } |
||||
|
|
||||
|
public virtual decimal RefundAmount { get; protected set; } |
||||
|
|
||||
|
protected PaymentItem() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
public PaymentItem( |
||||
|
Guid id, |
||||
|
[NotNull] string itemType, |
||||
|
Guid itemKey, |
||||
|
[NotNull] string currency, |
||||
|
decimal originalPaymentAmount |
||||
|
) :base(id) |
||||
|
{ |
||||
|
ItemType = itemType; |
||||
|
ItemKey = itemKey; |
||||
|
Currency = currency; |
||||
|
OriginalPaymentAmount = originalPaymentAmount; |
||||
|
} |
||||
|
|
||||
|
public void CompletePayment( |
||||
|
decimal paymentDiscount, |
||||
|
decimal actualPaymentAmount, |
||||
|
decimal refundAmount) |
||||
|
{ |
||||
|
PaymentDiscount = paymentDiscount; |
||||
|
ActualPaymentAmount = actualPaymentAmount; |
||||
|
RefundAmount = refundAmount; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,36 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using EasyAbp.EShop.Payments.Settings; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.Settings; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Payments |
||||
|
{ |
||||
|
public class PaymentPayeeAccountProvider : IPaymentPayeeAccountProvider, ITransientDependency |
||||
|
{ |
||||
|
private readonly IPaymentRepository _paymentRepository; |
||||
|
private readonly ISettingProvider _settingProvider; |
||||
|
|
||||
|
public PaymentPayeeAccountProvider( |
||||
|
IPaymentRepository paymentRepository, |
||||
|
ISettingProvider settingProvider) |
||||
|
{ |
||||
|
_paymentRepository = paymentRepository; |
||||
|
_settingProvider = settingProvider; |
||||
|
} |
||||
|
public async Task<string> GetPayeeAccountAsync(Payment payment, Dictionary<string, object> inputExtraProperties) |
||||
|
{ |
||||
|
// Todo: support multi-store.
|
||||
|
|
||||
|
var payeeAccount = await _settingProvider.GetOrNullAsync( |
||||
|
PaymentsSettings.GroupName + "." + payment.PaymentMethod + ".DefaultPayeeAccount"); |
||||
|
|
||||
|
if (payeeAccount == null) |
||||
|
{ |
||||
|
throw new PayeeAccountNotFoundException(payment.PaymentMethod); |
||||
|
} |
||||
|
|
||||
|
return payeeAccount; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
using Volo.Abp; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Payments |
||||
|
{ |
||||
|
public class UnknownPaymentMethodException : BusinessException |
||||
|
{ |
||||
|
public UnknownPaymentMethodException(string paymentMethod) : base( |
||||
|
message: $"Payment method {paymentMethod} does not exist.") |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,14 +1,17 @@ |
|||||
using AutoMapper; |
using AutoMapper; |
||||
|
using EasyAbp.EShop.Payments.Payments; |
||||
|
|
||||
namespace EasyAbp.EShop.Payments |
namespace EasyAbp.EShop.Payments |
||||
{ |
{ |
||||
public class PaymentsApplicationAutoMapperProfile : Profile |
public class PaymentsDomainAutoMapperProfile : Profile |
||||
{ |
{ |
||||
public PaymentsApplicationAutoMapperProfile() |
public PaymentsDomainAutoMapperProfile() |
||||
{ |
{ |
||||
/* You can configure your AutoMapper mapping configuration here. |
/* You can configure your AutoMapper mapping configuration here. |
||||
* Alternatively, you can split your mapping configurations |
* Alternatively, you can split your mapping configurations |
||||
* into multiple profile classes for a better organization. */ |
* into multiple profile classes for a better organization. */ |
||||
|
CreateMap<Payment, PaymentEto>(); |
||||
|
CreateMap<PaymentItem, PaymentItemEto>(); |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Refunds |
||||
|
{ |
||||
|
public interface IRefundRepository : IRepository<Refund, Guid> |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
@ -1,23 +0,0 @@ |
|||||
using System.Collections.Generic; |
|
||||
using System.Threading.Tasks; |
|
||||
using Microsoft.Extensions.DependencyInjection; |
|
||||
using Volo.Abp.DependencyInjection; |
|
||||
|
|
||||
namespace EasyAbp.EShop.Payments.Payments |
|
||||
{ |
|
||||
[Dependency(ServiceLifetime.Transient, TryRegister = true)] |
|
||||
public class FreePaymentServiceProvider : IPaymentServiceProvider |
|
||||
{ |
|
||||
public const string PaymentMethod = "Free"; |
|
||||
|
|
||||
public FreePaymentServiceProvider() |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public async Task<Payment> PayForOrderAsync(Payment payment, Dictionary<string, object> extraProperties = null) |
|
||||
{ |
|
||||
throw new System.NotImplementedException(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,32 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using JetBrains.Annotations; |
|
||||
using Volo.Abp.Domain.Entities.Auditing; |
|
||||
using Volo.Abp.MultiTenancy; |
|
||||
|
|
||||
namespace EasyAbp.EShop.Payments.Payments |
|
||||
{ |
|
||||
public class Payment : FullAuditedAggregateRoot<Guid>, IMultiTenant |
|
||||
{ |
|
||||
public virtual Guid? TenantId { get; protected set; } |
|
||||
|
|
||||
[NotNull] |
|
||||
public virtual string PaymentMethod { get; protected set; } |
|
||||
|
|
||||
[NotNull] |
|
||||
public virtual string ExternalTradingCode { get; protected set; } |
|
||||
|
|
||||
[NotNull] |
|
||||
public virtual string Currency { get; protected set; } |
|
||||
|
|
||||
public virtual decimal OriginalPaymentAmount { get; protected set; } |
|
||||
|
|
||||
public virtual decimal PaymentDiscount { get; protected set; } |
|
||||
|
|
||||
public virtual decimal ActualPaymentAmount { get; protected set; } |
|
||||
|
|
||||
public virtual decimal RefundAmount { get; protected set; } |
|
||||
|
|
||||
public virtual List<PaymentOrder> PaymentOrders { get; protected set; } |
|
||||
} |
|
||||
} |
|
||||
@ -1,22 +0,0 @@ |
|||||
using System; |
|
||||
using JetBrains.Annotations; |
|
||||
using Volo.Abp.Domain.Entities.Auditing; |
|
||||
|
|
||||
namespace EasyAbp.EShop.Payments.Payments |
|
||||
{ |
|
||||
public class PaymentOrder : FullAuditedEntity<Guid> |
|
||||
{ |
|
||||
public virtual Guid OrderId { get; protected set; } |
|
||||
|
|
||||
[NotNull] |
|
||||
public virtual string Currency { get; protected set; } |
|
||||
|
|
||||
public virtual decimal OriginalPaymentAmount { get; protected set; } |
|
||||
|
|
||||
public virtual decimal PaymentDiscount { get; protected set; } |
|
||||
|
|
||||
public virtual decimal ActualPaymentAmount { get; protected set; } |
|
||||
|
|
||||
public virtual decimal RefundAmount { get; protected set; } |
|
||||
} |
|
||||
} |
|
||||
8
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.EntityFrameworkCore/EntityFrameworkCore/EShopPaymentsEntityFrameworkCoreModule.cs → modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.EntityFrameworkCore/EasyAbp/EShop/Payments/EntityFrameworkCore/EShopPaymentsEntityFrameworkCoreModule.cs
8
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.EntityFrameworkCore/EntityFrameworkCore/EShopPaymentsEntityFrameworkCoreModule.cs → modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.EntityFrameworkCore/EasyAbp/EShop/Payments/EntityFrameworkCore/EShopPaymentsEntityFrameworkCoreModule.cs
@ -0,0 +1,76 @@ |
|||||
|
using EasyAbp.EShop.Payments.Refunds; |
||||
|
using EasyAbp.EShop.Payments.Payments; |
||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.EntityFrameworkCore.Modeling; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.EntityFrameworkCore |
||||
|
{ |
||||
|
public static class PaymentsDbContextModelCreatingExtensions |
||||
|
{ |
||||
|
public static void ConfigurePayments( |
||||
|
this ModelBuilder builder, |
||||
|
Action<PaymentsModelBuilderConfigurationOptions> optionsAction = null) |
||||
|
{ |
||||
|
Check.NotNull(builder, nameof(builder)); |
||||
|
|
||||
|
var options = new PaymentsModelBuilderConfigurationOptions( |
||||
|
PaymentsDbProperties.DbTablePrefix, |
||||
|
PaymentsDbProperties.DbSchema |
||||
|
); |
||||
|
|
||||
|
optionsAction?.Invoke(options); |
||||
|
|
||||
|
/* Configure all entities here. Example: |
||||
|
|
||||
|
builder.Entity<Question>(b => |
||||
|
{ |
||||
|
//Configure table & schema name
|
||||
|
b.ToTable(options.TablePrefix + "Questions", options.Schema); |
||||
|
|
||||
|
b.ConfigureByConvention(); |
||||
|
|
||||
|
//Properties
|
||||
|
b.Property(q => q.Title).IsRequired().HasMaxLength(QuestionConsts.MaxTitleLength); |
||||
|
|
||||
|
//Relations
|
||||
|
b.HasMany(question => question.Tags).WithOne().HasForeignKey(qt => qt.QuestionId); |
||||
|
|
||||
|
//Indexes
|
||||
|
b.HasIndex(q => q.CreationTime); |
||||
|
}); |
||||
|
*/ |
||||
|
|
||||
|
builder.Entity<Payment>(b => |
||||
|
{ |
||||
|
b.ToTable(options.TablePrefix + "Payments", options.Schema); |
||||
|
b.ConfigureByConvention(); |
||||
|
/* Configure more properties here */ |
||||
|
b.Property(x => x.ActualPaymentAmount).HasColumnType("decimal(18,6)"); |
||||
|
b.Property(x => x.OriginalPaymentAmount).HasColumnType("decimal(18,6)"); |
||||
|
b.Property(x => x.PaymentDiscount).HasColumnType("decimal(18,6)"); |
||||
|
b.Property(x => x.RefundAmount).HasColumnType("decimal(18,6)"); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<Refund>(b => |
||||
|
{ |
||||
|
b.ToTable(options.TablePrefix + "Refunds", options.Schema); |
||||
|
b.ConfigureByConvention(); |
||||
|
/* Configure more properties here */ |
||||
|
b.Property(x => x.RefundAmount).HasColumnType("decimal(18,6)"); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<PaymentItem>(b => |
||||
|
{ |
||||
|
b.ToTable(options.TablePrefix + "PaymentItems", options.Schema); |
||||
|
b.ConfigureByConvention(); |
||||
|
/* Configure more properties here */ |
||||
|
b.Property(x => x.ActualPaymentAmount).HasColumnType("decimal(18,6)"); |
||||
|
b.Property(x => x.OriginalPaymentAmount).HasColumnType("decimal(18,6)"); |
||||
|
b.Property(x => x.PaymentDiscount).HasColumnType("decimal(18,6)"); |
||||
|
b.Property(x => x.RefundAmount).HasColumnType("decimal(18,6)"); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
0
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.EntityFrameworkCore/EntityFrameworkCore/PaymentsModelBuilderConfigurationOptions.cs → modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.EntityFrameworkCore/EasyAbp/EShop/Payments/EntityFrameworkCore/PaymentsModelBuilderConfigurationOptions.cs
0
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.EntityFrameworkCore/EntityFrameworkCore/PaymentsModelBuilderConfigurationOptions.cs → modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.EntityFrameworkCore/EasyAbp/EShop/Payments/EntityFrameworkCore/PaymentsModelBuilderConfigurationOptions.cs
@ -0,0 +1,14 @@ |
|||||
|
using System; |
||||
|
using EasyAbp.EShop.Payments.EntityFrameworkCore; |
||||
|
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Payments |
||||
|
{ |
||||
|
public class PaymentRepository : EfCoreRepository<PaymentsDbContext, Payment, Guid>, IPaymentRepository |
||||
|
{ |
||||
|
public PaymentRepository(IDbContextProvider<PaymentsDbContext> dbContextProvider) : base(dbContextProvider) |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
using System; |
||||
|
using EasyAbp.EShop.Payments.EntityFrameworkCore; |
||||
|
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Payments.Refunds |
||||
|
{ |
||||
|
public class RefundRepository : EfCoreRepository<PaymentsDbContext, Refund, Guid>, IRefundRepository |
||||
|
{ |
||||
|
public RefundRepository(IDbContextProvider<PaymentsDbContext> dbContextProvider) : base(dbContextProvider) |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,43 +0,0 @@ |
|||||
using System; |
|
||||
using Microsoft.EntityFrameworkCore; |
|
||||
using Volo.Abp; |
|
||||
|
|
||||
namespace EasyAbp.EShop.Payments.EntityFrameworkCore |
|
||||
{ |
|
||||
public static class PaymentsDbContextModelCreatingExtensions |
|
||||
{ |
|
||||
public static void ConfigurePayments( |
|
||||
this ModelBuilder builder, |
|
||||
Action<PaymentsModelBuilderConfigurationOptions> optionsAction = null) |
|
||||
{ |
|
||||
Check.NotNull(builder, nameof(builder)); |
|
||||
|
|
||||
var options = new PaymentsModelBuilderConfigurationOptions( |
|
||||
PaymentsDbProperties.DbTablePrefix, |
|
||||
PaymentsDbProperties.DbSchema |
|
||||
); |
|
||||
|
|
||||
optionsAction?.Invoke(options); |
|
||||
|
|
||||
/* Configure all entities here. Example: |
|
||||
|
|
||||
builder.Entity<Question>(b => |
|
||||
{ |
|
||||
//Configure table & schema name
|
|
||||
b.ToTable(options.TablePrefix + "Questions", options.Schema); |
|
||||
|
|
||||
b.ConfigureByConvention(); |
|
||||
|
|
||||
//Properties
|
|
||||
b.Property(q => q.Title).IsRequired().HasMaxLength(QuestionConsts.MaxTitleLength); |
|
||||
|
|
||||
//Relations
|
|
||||
b.HasMany(question => question.Tags).WithOne().HasForeignKey(qt => qt.QuestionId); |
|
||||
|
|
||||
//Indexes
|
|
||||
b.HasIndex(q => q.CreationTime); |
|
||||
}); |
|
||||
*/ |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue