mirror of https://github.com/EasyAbp/EShop.git
107 changed files with 17607 additions and 323 deletions
@ -0,0 +1,12 @@ |
|||
using Volo.Abp; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders |
|||
{ |
|||
public class InvalidRefundAmountException : BusinessException |
|||
{ |
|||
public InvalidRefundAmountException(decimal amount) |
|||
: base("InvalidRefundAmount", $"The refund amount ({amount}) is invalid.") |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
using Volo.Abp; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders |
|||
{ |
|||
public class InvalidRefundQuantityException : BusinessException |
|||
{ |
|||
public InvalidRefundQuantityException(int quantity) |
|||
: base("InvalidRefundQuantity", $"The refund quantity ({quantity}) is invalid.") |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
using System.Threading.Tasks; |
|||
using EasyAbp.EShop.Payments.Refunds; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Domain.Entities.Events.Distributed; |
|||
using Volo.Abp.EventBus.Distributed; |
|||
using Volo.Abp.Uow; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders |
|||
{ |
|||
public class OrderRefundEventHandler : IDistributedEventHandler<EntityCreatedEto<EShopRefundEto>>, ITransientDependency |
|||
{ |
|||
private readonly IOrderRepository _orderRepository; |
|||
|
|||
public OrderRefundEventHandler(IOrderRepository orderRepository) |
|||
{ |
|||
_orderRepository = orderRepository; |
|||
} |
|||
|
|||
[UnitOfWork(true)] |
|||
public virtual async Task HandleEventAsync(EntityCreatedEto<EShopRefundEto> eventData) |
|||
{ |
|||
foreach (var refundItem in eventData.Entity.RefundItems) |
|||
{ |
|||
var order = await _orderRepository.GetAsync(refundItem.OrderId); |
|||
|
|||
foreach (var eto in refundItem.RefundItemOrderLines) |
|||
{ |
|||
order.Refund(eto.OrderLineId, eto.RefundedQuantity, eto.RefundAmount); |
|||
} |
|||
|
|||
await _orderRepository.UpdateAsync(order, true); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,43 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Linq; |
|||
using JetBrains.Annotations; |
|||
|
|||
namespace EasyAbp.EShop.Payments.Refunds.Dtos |
|||
{ |
|||
public class CreateEShopRefundInput : IValidatableObject |
|||
{ |
|||
public Guid PaymentId { get; set; } |
|||
|
|||
[CanBeNull] |
|||
public string DisplayReason { get; set; } |
|||
|
|||
[CanBeNull] |
|||
public string CustomerRemark { get; set; } |
|||
|
|||
[CanBeNull] |
|||
public string StaffRemark { get; set; } |
|||
|
|||
public List<CreateEShopRefundItemInput> RefundItems { get; set; } = new List<CreateEShopRefundItemInput>(); |
|||
|
|||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
|||
{ |
|||
if (RefundItems.IsNullOrEmpty()) |
|||
{ |
|||
yield return new ValidationResult( |
|||
"RefundItems should not be empty!", |
|||
new[] { nameof(RefundItems) } |
|||
); |
|||
} |
|||
|
|||
if (RefundItems.Any(x => x.OrderLines.IsNullOrEmpty())) |
|||
{ |
|||
yield return new ValidationResult( |
|||
"RefundItem.OrderLines should not be empty!", |
|||
new[] { nameof(CreateEShopRefundItemInput.OrderLines) } |
|||
); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using JetBrains.Annotations; |
|||
|
|||
namespace EasyAbp.EShop.Payments.Refunds.Dtos |
|||
{ |
|||
public class CreateEShopRefundItemInput |
|||
{ |
|||
public Guid OrderId { get; set; } |
|||
|
|||
[CanBeNull] |
|||
public string CustomerRemark { get; set; } |
|||
|
|||
[CanBeNull] |
|||
public string StaffRemark { get; set; } |
|||
|
|||
public List<OrderLineRefundInfoModel> OrderLines { get; set; } = new List<OrderLineRefundInfoModel>(); |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
using System; |
|||
using EasyAbp.PaymentService.Payments; |
|||
using EasyAbp.PaymentService.Refunds; |
|||
using Volo.Abp.Application.Dtos; |
|||
|
|||
namespace EasyAbp.EShop.Payments.Refunds.Dtos |
|||
{ |
|||
public class RefundItemDto : ExtensibleFullAuditedEntityDto<Guid>, IRefund |
|||
{ |
|||
public virtual Guid PaymentId { get; set; } |
|||
|
|||
public virtual string RefundPaymentMethod { get; set; } |
|||
|
|||
public virtual string ExternalTradingCode { get; set; } |
|||
|
|||
public virtual string Currency { get; set; } |
|||
|
|||
public virtual decimal RefundAmount { get; set; } |
|||
|
|||
public virtual string DisplayReason { get; set; } |
|||
|
|||
public virtual string CustomerRemark { get; set; } |
|||
|
|||
public virtual string StaffRemark { get; set; } |
|||
|
|||
public virtual DateTime? CompletedTime { get; set; } |
|||
|
|||
public virtual DateTime? CanceledTime { get; set; } |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
using Volo.Abp; |
|||
|
|||
namespace EasyAbp.EShop.Payments.Refunds |
|||
{ |
|||
public class InvalidRefundQuantityException : BusinessException |
|||
{ |
|||
public InvalidRefundQuantityException(int quantity) |
|||
: base("InvalidRefundQuantity", $"The refund quantity ({quantity}) is invalid.") |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using EasyAbp.PaymentService.Refunds; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.MultiTenancy; |
|||
|
|||
namespace EasyAbp.EShop.Payments.Refunds |
|||
{ |
|||
[Serializable] |
|||
public class EShopRefundEto : IRefund, IMultiTenant, IHasExtraProperties |
|||
{ |
|||
#region Base properties
|
|||
|
|||
public Guid Id { get; set; } |
|||
|
|||
public Guid? TenantId { get; set; } |
|||
|
|||
public Guid PaymentId { get; set; } |
|||
|
|||
public string RefundPaymentMethod { get; set; } |
|||
|
|||
public string ExternalTradingCode { get; set; } |
|||
|
|||
public string Currency { get; set; } |
|||
|
|||
public decimal RefundAmount { get; set; } |
|||
|
|||
public string DisplayReason { get; set; } |
|||
|
|||
public string CustomerRemark { get; set; } |
|||
|
|||
public string StaffRemark { get; set; } |
|||
|
|||
public DateTime? CompletedTime { get; set; } |
|||
|
|||
public DateTime? CanceledTime { get; set; } |
|||
|
|||
public Dictionary<string, object> ExtraProperties { get; set; } |
|||
|
|||
#endregion
|
|||
|
|||
public List<EShopRefundItemEto> RefundItems { get; set; } = new List<EShopRefundItemEto>(); |
|||
} |
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using EasyAbp.PaymentService.Refunds; |
|||
using Volo.Abp.Data; |
|||
|
|||
namespace EasyAbp.EShop.Payments.Refunds |
|||
{ |
|||
[Serializable] |
|||
public class EShopRefundItemEto : IRefundItem, IHasExtraProperties |
|||
{ |
|||
#region Base properties
|
|||
|
|||
public Guid Id { get; set; } |
|||
|
|||
public Guid PaymentItemId { get; set; } |
|||
|
|||
public decimal RefundAmount { get; set; } |
|||
|
|||
public string CustomerRemark { get; set; } |
|||
|
|||
public string StaffRemark { get; set; } |
|||
|
|||
public Dictionary<string, object> ExtraProperties { get; set; } |
|||
|
|||
#endregion
|
|||
|
|||
public Guid StoreId { get; set; } |
|||
|
|||
public Guid OrderId { get; set; } |
|||
|
|||
public List<RefundItemOrderLineEto> RefundItemOrderLines { get; set; } = new List<RefundItemOrderLineEto>(); |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
using System; |
|||
|
|||
namespace EasyAbp.EShop.Payments.Refunds |
|||
{ |
|||
public class OrderLineRefundInfoModel |
|||
{ |
|||
public Guid OrderLineId { get; set; } |
|||
|
|||
public int Quantity { get; set; } |
|||
|
|||
public decimal TotalAmount { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using System; |
|||
|
|||
namespace EasyAbp.EShop.Payments.Refunds |
|||
{ |
|||
[Serializable] |
|||
public class RefundItemOrderLineEto |
|||
{ |
|||
public Guid OrderLineId { get; set; } |
|||
|
|||
public int RefundedQuantity { get; set; } |
|||
|
|||
public decimal RefundAmount { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using Volo.Abp; |
|||
|
|||
namespace EasyAbp.EShop.Payments |
|||
{ |
|||
public class OrderIdNotFoundException : BusinessException |
|||
{ |
|||
public OrderIdNotFoundException() : base(message: $"Cannot get valid OrderId from ExtraProperties.") |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
namespace EasyAbp.EShop.Payments.Refunds |
|||
{ |
|||
public interface IRefundSynchronizer |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,32 @@ |
|||
using System; |
|||
using AutoMapper; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace EasyAbp.EShop.Payments.Refunds |
|||
{ |
|||
[AutoMap(typeof(RefundItemOrderLineEto))] |
|||
public class RefundItemOrderLine : Entity<Guid> |
|||
{ |
|||
public virtual Guid OrderLineId { get; protected set; } |
|||
|
|||
public virtual int RefundedQuantity { get; protected set; } |
|||
|
|||
public virtual decimal RefundAmount { get; protected set; } |
|||
|
|||
protected RefundItemOrderLine() |
|||
{ |
|||
} |
|||
|
|||
public RefundItemOrderLine( |
|||
Guid id, |
|||
Guid orderLineId, |
|||
int refundedQuantity, |
|||
decimal refundAmount |
|||
) : base(id) |
|||
{ |
|||
OrderLineId = orderLineId; |
|||
RefundedQuantity = refundedQuantity; |
|||
RefundAmount = refundAmount; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,134 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using EasyAbp.PaymentService.Refunds; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Domain.Entities.Events.Distributed; |
|||
using Volo.Abp.EventBus.Distributed; |
|||
using Volo.Abp.Guids; |
|||
using Volo.Abp.Json; |
|||
using Volo.Abp.ObjectMapping; |
|||
using Volo.Abp.Uow; |
|||
|
|||
namespace EasyAbp.EShop.Payments.Refunds |
|||
{ |
|||
public class RefundSynchronizer : |
|||
IDistributedEventHandler<EntityUpdatedEto<EShopRefundEto>>, |
|||
IDistributedEventHandler<EntityDeletedEto<EShopRefundEto>>, |
|||
IRefundSynchronizer, |
|||
ITransientDependency |
|||
{ |
|||
private readonly IObjectMapper _objectMapper; |
|||
private readonly IGuidGenerator _guidGenerator; |
|||
private readonly IJsonSerializer _jsonSerializer; |
|||
private readonly IRefundRepository _refundRepository; |
|||
|
|||
public RefundSynchronizer( |
|||
IObjectMapper objectMapper, |
|||
IGuidGenerator guidGenerator, |
|||
IJsonSerializer jsonSerializer, |
|||
IRefundRepository refundRepository) |
|||
{ |
|||
_objectMapper = objectMapper; |
|||
_guidGenerator = guidGenerator; |
|||
_jsonSerializer = jsonSerializer; |
|||
_refundRepository = refundRepository; |
|||
} |
|||
|
|||
[UnitOfWork(true)] |
|||
public virtual async Task HandleEventAsync(EntityUpdatedEto<EShopRefundEto> eventData) |
|||
{ |
|||
var refund = await _refundRepository.FindAsync(eventData.Entity.Id); |
|||
|
|||
if (refund == null) |
|||
{ |
|||
refund = _objectMapper.Map<EShopRefundEto, Refund>(eventData.Entity); |
|||
|
|||
refund.SetRefundItems( |
|||
_objectMapper.Map<List<EShopRefundItemEto>, List<RefundItem>>(eventData.Entity.RefundItems)); |
|||
|
|||
await _refundRepository.InsertAsync(refund, true); |
|||
} |
|||
else |
|||
{ |
|||
_objectMapper.Map(eventData.Entity, refund); |
|||
|
|||
foreach (var etoItem in eventData.Entity.RefundItems) |
|||
{ |
|||
var item = refund.RefundItems.FirstOrDefault(i => i.Id == etoItem.Id); |
|||
|
|||
if (item == null) |
|||
{ |
|||
if (!Guid.TryParse(etoItem.GetProperty<string>("StoreId"), out var storeId)) |
|||
{ |
|||
throw new StoreIdNotFoundException(); |
|||
} |
|||
|
|||
if (!Guid.TryParse(etoItem.GetProperty<string>("OrderId"), out var orderId)) |
|||
{ |
|||
throw new OrderIdNotFoundException(); |
|||
} |
|||
|
|||
item = _objectMapper.Map<EShopRefundItemEto, RefundItem>(etoItem); |
|||
|
|||
item.SetStoreId(storeId); |
|||
item.SetOrderId(orderId); |
|||
|
|||
refund.RefundItems.Add(item); |
|||
} |
|||
else |
|||
{ |
|||
_objectMapper.Map(etoItem, item); |
|||
} |
|||
} |
|||
|
|||
var etoRefundItemIds = eventData.Entity.RefundItems.Select(i => i.Id).ToList(); |
|||
|
|||
refund.RefundItems.RemoveAll(i => !etoRefundItemIds.Contains(i.Id)); |
|||
} |
|||
|
|||
foreach (var refundItem in refund.RefundItems) |
|||
{ |
|||
var orderLineInfoModels = |
|||
_jsonSerializer.Deserialize<List<OrderLineRefundInfoModel>>( |
|||
refundItem.GetProperty<string>("OrderLines")); |
|||
|
|||
foreach (var orderLineInfoModel in orderLineInfoModels) |
|||
{ |
|||
var refundItemOrderLineEntity = |
|||
refundItem.RefundItemOrderLines.FirstOrDefault(x => |
|||
x.OrderLineId == orderLineInfoModel.OrderLineId); |
|||
|
|||
if (refundItemOrderLineEntity == null) |
|||
{ |
|||
refundItemOrderLineEntity = new RefundItemOrderLine(_guidGenerator.Create(), |
|||
orderLineInfoModel.OrderLineId, orderLineInfoModel.Quantity, |
|||
orderLineInfoModel.TotalAmount); |
|||
|
|||
refundItem.RefundItemOrderLines.Add(refundItemOrderLineEntity); |
|||
} |
|||
|
|||
var orderLineIds = orderLineInfoModels.Select(i => i.OrderLineId).ToList(); |
|||
|
|||
refundItem.RefundItemOrderLines.RemoveAll(i => !orderLineIds.Contains(i.OrderLineId)); |
|||
} |
|||
} |
|||
|
|||
await _refundRepository.UpdateAsync(refund, true); |
|||
} |
|||
|
|||
public virtual async Task HandleEventAsync(EntityDeletedEto<EShopRefundEto> eventData) |
|||
{ |
|||
var refund = await _refundRepository.FindAsync(eventData.Entity.Id); |
|||
|
|||
if (refund == null) |
|||
{ |
|||
return; |
|||
} |
|||
|
|||
await _refundRepository.DeleteAsync(refund, true); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,54 @@ |
|||
@page |
|||
@using EasyAbp.EShop.Payments.Localization |
|||
@using EasyAbp.EShop.Payments.Web.Menus |
|||
@using Microsoft.AspNetCore.Mvc.Localization |
|||
@using Volo.Abp.AspNetCore.Mvc.UI.Layout |
|||
@using EasyAbp.EShop.Payments.Web.Pages.EShop.Payments.Payments.PaymentItem |
|||
@model IndexModel |
|||
@inject IPageLayout PageLayout |
|||
@inject IHtmlLocalizer<PaymentsResource> L |
|||
@{ |
|||
PageLayout.Content.Title = L["PaymentItem"].Value; |
|||
PageLayout.Content.BreadCrumb.Add(L["Menu:PaymentItem"].Value); |
|||
PageLayout.Content.MenuItemName = PaymentsMenus.Payment; |
|||
} |
|||
|
|||
@section scripts |
|||
{ |
|||
<abp-script src="/Pages/EShop/Payments/Payments/PaymentItem/index.js" /> |
|||
} |
|||
@section styles |
|||
{ |
|||
<abp-style src="/Pages/EShop/Payments/Payments/PaymentItem/index.css"/> |
|||
} |
|||
|
|||
<script> |
|||
var paymentId = '@Model.PaymentId'; |
|||
</script> |
|||
|
|||
<abp-card> |
|||
<abp-card-header> |
|||
<abp-row> |
|||
<abp-column size-md="_6"> |
|||
<abp-card-title>@L["PaymentItem"]</abp-card-title> |
|||
</abp-column> |
|||
</abp-row> |
|||
</abp-card-header> |
|||
<abp-card-body> |
|||
<abp-table striped-rows="true" id="PaymentItemTable" class="nowrap"> |
|||
<thead> |
|||
<tr> |
|||
<th>@L["Actions"]</th> |
|||
<th>@L["PaymentItemStoreId"]</th> |
|||
<th>@L["PaymentItemItemType"]</th> |
|||
<th>@L["PaymentItemItemKey"]</th> |
|||
<th>@L["PaymentItemOriginalPaymentAmount"]</th> |
|||
<th>@L["PaymentItemPaymentDiscount"]</th> |
|||
<th>@L["PaymentItemActualPaymentAmount"]</th> |
|||
<th>@L["PaymentItemRefundAmount"]</th> |
|||
<th>@L["PaymentItemPendingRefundAmount"]</th> |
|||
</tr> |
|||
</thead> |
|||
</abp-table> |
|||
</abp-card-body> |
|||
</abp-card> |
|||
@ -0,0 +1,17 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
|
|||
namespace EasyAbp.EShop.Payments.Web.Pages.EShop.Payments.Payments.PaymentItem |
|||
{ |
|||
public class IndexModel : PaymentsPageModel |
|||
{ |
|||
[BindProperty(SupportsGet = true)] |
|||
public Guid PaymentId { get; set; } |
|||
|
|||
public async Task OnGetAsync() |
|||
{ |
|||
await Task.CompletedTask; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,49 @@ |
|||
$(function () { |
|||
|
|||
var l = abp.localization.getResource('EasyAbpEShopPayments'); |
|||
|
|||
var service = easyAbp.eShop.payments.payments.payment; |
|||
|
|||
var dataTable = $('#PaymentItemTable').DataTable(abp.libs.datatables.normalizeConfiguration({ |
|||
processing: true, |
|||
serverSide: true, |
|||
paging: true, |
|||
searching: false, |
|||
autoWidth: false, |
|||
scrollCollapse: true, |
|||
order: [[1, "asc"]], |
|||
ajax: function (requestData, callback, settings) { |
|||
if (callback) { |
|||
service.get(paymentId).then(function (result) { |
|||
callback({ |
|||
recordsTotal: result.paymentItems.length, |
|||
recordsFiltered: result.paymentItems.length, |
|||
data: result.paymentItems |
|||
}); |
|||
}); |
|||
} |
|||
}, |
|||
columnDefs: [ |
|||
{ |
|||
rowAction: { |
|||
items: |
|||
[ |
|||
{ |
|||
text: l('Detail'), |
|||
action: function (data) { |
|||
} |
|||
} |
|||
] |
|||
} |
|||
}, |
|||
{ data: "storeId" }, |
|||
{ data: "itemType" }, |
|||
{ data: "itemKey" }, |
|||
{ data: "originalPaymentAmount" }, |
|||
{ data: "paymentDiscount" }, |
|||
{ data: "actualPaymentAmount" }, |
|||
{ data: "refundAmount" }, |
|||
{ data: "pendingRefundAmount" }, |
|||
] |
|||
})); |
|||
}); |
|||
@ -0,0 +1,50 @@ |
|||
@page |
|||
@using EasyAbp.EShop.Payments.Localization |
|||
@using EasyAbp.EShop.Payments.Web.Menus |
|||
@using Microsoft.AspNetCore.Mvc.Localization |
|||
@using Volo.Abp.AspNetCore.Mvc.UI.Layout |
|||
@model EasyAbp.EShop.Payments.Web.Pages.EShop.Payments.Refunds.RefundItem.IndexModel |
|||
@inject IPageLayout PageLayout |
|||
@inject IHtmlLocalizer<PaymentsResource> L |
|||
@{ |
|||
PageLayout.Content.Title = L["RefundItem"].Value; |
|||
PageLayout.Content.BreadCrumb.Add(L["Menu:RefundItem"].Value); |
|||
PageLayout.Content.MenuItemName = PaymentsMenus.Refund; |
|||
} |
|||
|
|||
@section scripts |
|||
{ |
|||
<abp-script src="/Pages/EShop/Payments/Refunds/RefundItem/index.js" /> |
|||
} |
|||
@section styles |
|||
{ |
|||
<abp-style src="/Pages/EShop/Payments/Refunds/RefundItem/index.css"/> |
|||
} |
|||
|
|||
<script> |
|||
var refundId = '@Model.RefundId'; |
|||
</script> |
|||
|
|||
<abp-card> |
|||
<abp-card-header> |
|||
<abp-row> |
|||
<abp-column size-md="_6"> |
|||
<abp-card-title>@L["RefundItem"]</abp-card-title> |
|||
</abp-column> |
|||
</abp-row> |
|||
</abp-card-header> |
|||
<abp-card-body> |
|||
<abp-table striped-rows="true" id="RefundTable" class="nowrap"> |
|||
<thead> |
|||
<tr> |
|||
<th>@L["Actions"]</th> |
|||
<th>@L["RefundItemStoreId"]</th> |
|||
<th>@L["RefundItemPaymentItemId"]</th> |
|||
<th>@L["RefundItemRefundAmount"]</th> |
|||
<th>@L["RefundItemCustomerRemark"]</th> |
|||
<th>@L["RefundItemStaffRemark"]</th> |
|||
</tr> |
|||
</thead> |
|||
</abp-table> |
|||
</abp-card-body> |
|||
</abp-card> |
|||
@ -0,0 +1,17 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
|
|||
namespace EasyAbp.EShop.Payments.Web.Pages.EShop.Payments.Refunds.RefundItem |
|||
{ |
|||
public class IndexModel : PaymentsPageModel |
|||
{ |
|||
[BindProperty(SupportsGet = true)] |
|||
public Guid RefundId { get; set; } |
|||
|
|||
public async Task OnGetAsync() |
|||
{ |
|||
await Task.CompletedTask; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
$(function () { |
|||
|
|||
var l = abp.localization.getResource('EasyAbpEShopPayments'); |
|||
|
|||
var service = easyAbp.eShop.payments.refunds.refund; |
|||
|
|||
var dataTable = $('#RefundTable').DataTable(abp.libs.datatables.normalizeConfiguration({ |
|||
processing: true, |
|||
serverSide: true, |
|||
paging: true, |
|||
searching: false, |
|||
autoWidth: false, |
|||
scrollCollapse: true, |
|||
order: [[1, "asc"]], |
|||
ajax: function (requestData, callback, settings) { |
|||
if (callback) { |
|||
service.get(refundId).then(function (result) { |
|||
callback({ |
|||
recordsTotal: result.refundItems.length, |
|||
recordsFiltered: result.refundItems.length, |
|||
data: result.refundItems |
|||
}); |
|||
}); |
|||
} |
|||
}, |
|||
columnDefs: [ |
|||
{ |
|||
rowAction: { |
|||
items: |
|||
[ |
|||
{ |
|||
text: l('Detail'), |
|||
action: function (data) { |
|||
} |
|||
}, |
|||
] |
|||
} |
|||
}, |
|||
{ data: "storeId" }, |
|||
{ data: "paymentItemId" }, |
|||
{ data: "refundAmount" }, |
|||
{ data: "customerRemark" }, |
|||
{ data: "staffRemark" }, |
|||
] |
|||
})); |
|||
}); |
|||
File diff suppressed because it is too large
@ -0,0 +1,52 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace EShopSample.Migrations |
|||
{ |
|||
public partial class AddedRefundItem : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.CreateTable( |
|||
name: "RefundItem", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
CreationTime = table.Column<DateTime>(nullable: false), |
|||
CreatorId = table.Column<Guid>(nullable: true), |
|||
LastModificationTime = table.Column<DateTime>(nullable: true), |
|||
LastModifierId = table.Column<Guid>(nullable: true), |
|||
IsDeleted = table.Column<bool>(nullable: false), |
|||
DeleterId = table.Column<Guid>(nullable: true), |
|||
DeletionTime = table.Column<DateTime>(nullable: true), |
|||
PaymentItemId = table.Column<Guid>(nullable: false), |
|||
RefundAmount = table.Column<decimal>(nullable: false), |
|||
CustomerRemark = table.Column<string>(nullable: true), |
|||
StaffRemark = table.Column<string>(nullable: true), |
|||
StoreId = table.Column<Guid>(nullable: true), |
|||
RefundId = table.Column<Guid>(nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_RefundItem", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_RefundItem_EasyAbpEShopPaymentsRefunds_RefundId", |
|||
column: x => x.RefundId, |
|||
principalTable: "EasyAbpEShopPaymentsRefunds", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Restrict); |
|||
}); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_RefundItem_RefundId", |
|||
table: "RefundItem", |
|||
column: "RefundId"); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "RefundItem"); |
|||
} |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,105 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace EShopSample.Migrations |
|||
{ |
|||
public partial class AddedRefundItemToDbContext : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropForeignKey( |
|||
name: "FK_RefundItem_EasyAbpEShopPaymentsRefunds_RefundId", |
|||
table: "RefundItem"); |
|||
|
|||
migrationBuilder.DropPrimaryKey( |
|||
name: "PK_RefundItem", |
|||
table: "RefundItem"); |
|||
|
|||
migrationBuilder.RenameTable( |
|||
name: "RefundItem", |
|||
newName: "EasyAbpEShopPaymentsRefundItems"); |
|||
|
|||
migrationBuilder.RenameIndex( |
|||
name: "IX_RefundItem_RefundId", |
|||
table: "EasyAbpEShopPaymentsRefundItems", |
|||
newName: "IX_EasyAbpEShopPaymentsRefundItems_RefundId"); |
|||
|
|||
migrationBuilder.AlterColumn<decimal>( |
|||
name: "RefundAmount", |
|||
table: "EasyAbpEShopPaymentsRefundItems", |
|||
type: "decimal(20,8)", |
|||
nullable: false, |
|||
oldClrType: typeof(decimal), |
|||
oldType: "decimal(18,2)"); |
|||
|
|||
migrationBuilder.AlterColumn<bool>( |
|||
name: "IsDeleted", |
|||
table: "EasyAbpEShopPaymentsRefundItems", |
|||
nullable: false, |
|||
defaultValue: false, |
|||
oldClrType: typeof(bool), |
|||
oldType: "bit"); |
|||
|
|||
migrationBuilder.AddPrimaryKey( |
|||
name: "PK_EasyAbpEShopPaymentsRefundItems", |
|||
table: "EasyAbpEShopPaymentsRefundItems", |
|||
column: "Id"); |
|||
|
|||
migrationBuilder.AddForeignKey( |
|||
name: "FK_EasyAbpEShopPaymentsRefundItems_EasyAbpEShopPaymentsRefunds_RefundId", |
|||
table: "EasyAbpEShopPaymentsRefundItems", |
|||
column: "RefundId", |
|||
principalTable: "EasyAbpEShopPaymentsRefunds", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Restrict); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropForeignKey( |
|||
name: "FK_EasyAbpEShopPaymentsRefundItems_EasyAbpEShopPaymentsRefunds_RefundId", |
|||
table: "EasyAbpEShopPaymentsRefundItems"); |
|||
|
|||
migrationBuilder.DropPrimaryKey( |
|||
name: "PK_EasyAbpEShopPaymentsRefundItems", |
|||
table: "EasyAbpEShopPaymentsRefundItems"); |
|||
|
|||
migrationBuilder.RenameTable( |
|||
name: "EasyAbpEShopPaymentsRefundItems", |
|||
newName: "RefundItem"); |
|||
|
|||
migrationBuilder.RenameIndex( |
|||
name: "IX_EasyAbpEShopPaymentsRefundItems_RefundId", |
|||
table: "RefundItem", |
|||
newName: "IX_RefundItem_RefundId"); |
|||
|
|||
migrationBuilder.AlterColumn<decimal>( |
|||
name: "RefundAmount", |
|||
table: "RefundItem", |
|||
type: "decimal(18,2)", |
|||
nullable: false, |
|||
oldClrType: typeof(decimal), |
|||
oldType: "decimal(20,8)"); |
|||
|
|||
migrationBuilder.AlterColumn<bool>( |
|||
name: "IsDeleted", |
|||
table: "RefundItem", |
|||
type: "bit", |
|||
nullable: false, |
|||
oldClrType: typeof(bool), |
|||
oldDefaultValue: false); |
|||
|
|||
migrationBuilder.AddPrimaryKey( |
|||
name: "PK_RefundItem", |
|||
table: "RefundItem", |
|||
column: "Id"); |
|||
|
|||
migrationBuilder.AddForeignKey( |
|||
name: "FK_RefundItem_EasyAbpEShopPaymentsRefunds_RefundId", |
|||
table: "RefundItem", |
|||
column: "RefundId", |
|||
principalTable: "EasyAbpEShopPaymentsRefunds", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Restrict); |
|||
} |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,116 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace EShopSample.Migrations |
|||
{ |
|||
public partial class ChangesForOrderRefund : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.RenameColumn( |
|||
name: "RefundedAmount", |
|||
table: "EasyAbpEShopOrdersOrders", |
|||
newName: "RefundAmount"); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "ExtraProperties", |
|||
table: "EasyAbpPaymentServiceRefundItems", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AlterColumn<Guid>( |
|||
name: "StoreId", |
|||
table: "EasyAbpEShopPaymentsRefundItems", |
|||
nullable: false, |
|||
oldClrType: typeof(Guid), |
|||
oldType: "uniqueidentifier", |
|||
oldNullable: true); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "ExtraProperties", |
|||
table: "EasyAbpEShopPaymentsRefundItems", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<Guid>( |
|||
name: "OrderId", |
|||
table: "EasyAbpEShopPaymentsRefundItems", |
|||
nullable: false, |
|||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); |
|||
|
|||
migrationBuilder.AddColumn<decimal>( |
|||
name: "RefundAmount", |
|||
table: "EasyAbpEShopOrdersOrderLines", |
|||
nullable: false, |
|||
defaultValue: 0m); |
|||
|
|||
migrationBuilder.AddColumn<int>( |
|||
name: "RefundedQuantity", |
|||
table: "EasyAbpEShopOrdersOrderLines", |
|||
nullable: false, |
|||
defaultValue: 0); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "RefundItemOrderLine", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
OrderLineId = table.Column<Guid>(nullable: false), |
|||
RefundedQuantity = table.Column<int>(nullable: false), |
|||
RefundAmount = table.Column<decimal>(nullable: false), |
|||
RefundItemId = table.Column<Guid>(nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_RefundItemOrderLine", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_RefundItemOrderLine_EasyAbpEShopPaymentsRefundItems_RefundItemId", |
|||
column: x => x.RefundItemId, |
|||
principalTable: "EasyAbpEShopPaymentsRefundItems", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Restrict); |
|||
}); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_RefundItemOrderLine_RefundItemId", |
|||
table: "RefundItemOrderLine", |
|||
column: "RefundItemId"); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "RefundItemOrderLine"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "ExtraProperties", |
|||
table: "EasyAbpPaymentServiceRefundItems"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "ExtraProperties", |
|||
table: "EasyAbpEShopPaymentsRefundItems"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "OrderId", |
|||
table: "EasyAbpEShopPaymentsRefundItems"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "RefundAmount", |
|||
table: "EasyAbpEShopOrdersOrderLines"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "RefundedQuantity", |
|||
table: "EasyAbpEShopOrdersOrderLines"); |
|||
|
|||
migrationBuilder.RenameColumn( |
|||
name: "RefundAmount", |
|||
table: "EasyAbpEShopOrdersOrders", |
|||
newName: "RefundedAmount"); |
|||
|
|||
migrationBuilder.AlterColumn<Guid>( |
|||
name: "StoreId", |
|||
table: "EasyAbpEShopPaymentsRefundItems", |
|||
type: "uniqueidentifier", |
|||
nullable: true, |
|||
oldClrType: typeof(Guid)); |
|||
} |
|||
} |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue