mirror of https://github.com/EasyAbp/EShop.git
101 changed files with 13643 additions and 347 deletions
@ -0,0 +1,88 @@ |
|||
# ASP.NET Core (.NET Framework) |
|||
# Build and test ASP.NET Core projects targeting the full .NET Framework. |
|||
# Add steps that publish symbols, save build artifacts, and more: |
|||
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core |
|||
|
|||
schedules: |
|||
- cron: "0 */6 * * *" |
|||
displayName: Daily midnight build |
|||
branches: |
|||
include: |
|||
- master |
|||
always: true |
|||
|
|||
trigger: |
|||
- master |
|||
|
|||
pool: |
|||
vmImage: 'ubuntu-latest' |
|||
|
|||
variables: |
|||
solution: '**/*.sln' |
|||
buildPlatform: 'Any CPU' |
|||
buildConfiguration: 'Release' |
|||
|
|||
steps: |
|||
- task: UseDotNet@2 |
|||
inputs: |
|||
packageType: 'sdk' |
|||
version: '3.x' |
|||
- task: CmdLine@2 |
|||
displayName: 'install dotnet-ef' |
|||
inputs: |
|||
script: 'dotnet tool install -g dotnet-ef' |
|||
|
|||
- task: CmdLine@2 |
|||
inputs: |
|||
script: | |
|||
echo commands |
|||
sed -i '0,/Default[^,]*/s//$(ConnectionStrings)"/g' samples/EShopSample/aspnet-core/src/EShopSample.Web/appsettings.json |
|||
echo commands executed |
|||
- task: CmdLine@2 |
|||
inputs: |
|||
script: | |
|||
echo commands |
|||
sed -i '0,/Default[^,]*/s//$(ConnectionStrings)"/g' samples/EShopSample/aspnet-core/src/EShopSample.DbMigrator/appsettings.json |
|||
echo commands executed |
|||
- task: DotNetCoreCLI@2 |
|||
displayName: 'restore' |
|||
inputs: |
|||
command: 'restore' |
|||
feedsToUse: 'select' |
|||
|
|||
- task: DotNetCoreCLI@2 |
|||
displayName: 'build' |
|||
inputs: |
|||
command: 'build' |
|||
|
|||
- task: CmdLine@2 |
|||
displayName: 'publish' |
|||
inputs: |
|||
script: | |
|||
dotnet publish |
|||
- task: CmdLine@2 |
|||
displayName: 'drop database' |
|||
inputs: |
|||
script: | |
|||
dotnet ef database drop --project samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/EShopSample.EntityFrameworkCore.DbMigrations.csproj -s samples/EShopSample/aspnet-core/src/EShopSample.Web/EShopSample.Web.csproj -f |
|||
|
|||
- task: CmdLine@2 |
|||
displayName: 'update database' |
|||
inputs: |
|||
script: | |
|||
dotnet ef database update --project samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore.DbMigrations/EShopSample.EntityFrameworkCore.DbMigrations.csproj -s samples/EShopSample/aspnet-core/src/EShopSample.Web/EShopSample.Web.csproj |
|||
- task: CmdLine@2 |
|||
inputs: |
|||
script: | |
|||
cd samples/EShopSample/aspnet-core/src/EShopSample.DbMigrator |
|||
|
|||
dotnet run |
|||
- task: Docker@2 |
|||
displayName: 'build and push docker' |
|||
inputs: |
|||
containerRegistry: $(DockerRegistry) |
|||
repository: $(repository) |
|||
command: 'buildAndPush' |
|||
Dockerfile: 'samples/EShopSample/aspnet-core/src/EShopSample.Web/Dockerfile' |
|||
buildContext: . |
|||
tags: 'latest' |
|||
@ -1,10 +1,10 @@ |
|||
using System.Threading.Tasks; |
|||
using EasyAbp.PaymentService.Payments; |
|||
using EasyAbp.EShop.Payments.Payments; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders |
|||
{ |
|||
public interface IOrderPaymentChecker |
|||
{ |
|||
Task<bool> IsValidPaymentAsync(Order order, PaymentEto payment, PaymentItemEto paymentItem); |
|||
Task<bool> IsValidPaymentAsync(Order order, EShopPaymentEto payment, EShopPaymentItemEto paymentItem); |
|||
} |
|||
} |
|||
@ -1,11 +0,0 @@ |
|||
using EasyAbp.PaymentService.Payments; |
|||
using Volo.Abp.Domain.Entities.Events.Distributed; |
|||
using Volo.Abp.EventBus.Distributed; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders |
|||
{ |
|||
public interface IOrderPaymentCompletedEventHandler : IDistributedEventHandler<PaymentCompletedEto> |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -1,11 +0,0 @@ |
|||
using EasyAbp.PaymentService.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,10 @@ |
|||
using EasyAbp.EShop.Payments.Payments; |
|||
using Volo.Abp.EventBus.Distributed; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders |
|||
{ |
|||
public interface IPaymentCompletedEventHandler : IDistributedEventHandler<EShopPaymentCompletedEto> |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -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 IPaymentCreatedEventHandler : IDistributedEventHandler<EntityCreatedEto<EShopPaymentEto>> |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
using System; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using EasyAbp.EShop.Payments; |
|||
using EasyAbp.EShop.Payments.Payments; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.EventBus.Distributed; |
|||
using Volo.Abp.Uow; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders |
|||
{ |
|||
public class PaymentCanceledEventHandler : IDistributedEventHandler<EShopPaymentCanceledEto>, ITransientDependency |
|||
{ |
|||
private readonly IOrderRepository _orderRepository; |
|||
|
|||
public PaymentCanceledEventHandler(IOrderRepository orderRepository) |
|||
{ |
|||
_orderRepository = orderRepository; |
|||
} |
|||
|
|||
[UnitOfWork(true)] |
|||
public virtual async Task HandleEventAsync(EShopPaymentCanceledEto eventData) |
|||
{ |
|||
foreach (var paymentItem in eventData.Payment.PaymentItems.Where(item => |
|||
item.ItemType == PaymentsConsts.PaymentItemType)) |
|||
{ |
|||
var order = await _orderRepository.GetAsync(Guid.Parse(paymentItem.ItemKey)); |
|||
|
|||
order.SetPaymentId(null); |
|||
|
|||
await _orderRepository.UpdateAsync(order, true); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,31 +1,28 @@ |
|||
using System; |
|||
using EasyAbp.PaymentService.Payments; |
|||
using System.Collections.Generic; |
|||
using EasyAbp.PaymentService.Refunds; |
|||
using Volo.Abp.Application.Dtos; |
|||
|
|||
namespace EasyAbp.EShop.Payments.Refunds.Dtos |
|||
{ |
|||
public class RefundItemDto : ExtensibleFullAuditedEntityDto<Guid>, IRefund |
|||
public class RefundItemDto : ExtensibleFullAuditedEntityDto<Guid>, IRefundItem |
|||
{ |
|||
public virtual Guid PaymentId { get; set; } |
|||
#region Base properties
|
|||
|
|||
public virtual string RefundPaymentMethod { get; set; } |
|||
public Guid PaymentItemId { get; set; } |
|||
|
|||
public virtual string ExternalTradingCode { get; set; } |
|||
public decimal RefundAmount { 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; } |
|||
public string CustomerRemark { get; set; } |
|||
|
|||
public string StaffRemark { get; set; } |
|||
|
|||
#endregion
|
|||
|
|||
public Guid StoreId { get; set; } |
|||
|
|||
public Guid OrderId { get; set; } |
|||
|
|||
public List<RefundItemOrderLineDto> RefundItemOrderLines { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using System; |
|||
|
|||
namespace EasyAbp.EShop.Payments.Refunds.Dtos |
|||
{ |
|||
[Serializable] |
|||
public class RefundItemOrderLineDto |
|||
{ |
|||
public Guid OrderLineId { get; set; } |
|||
|
|||
public int RefundedQuantity { get; set; } |
|||
|
|||
public decimal RefundAmount { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
using System; |
|||
using Volo.Abp; |
|||
|
|||
namespace EasyAbp.EShop.Payments.Refunds |
|||
{ |
|||
public class OrderIsNotInSpecifiedPaymentException : BusinessException |
|||
{ |
|||
public OrderIsNotInSpecifiedPaymentException(Guid orderId, Guid paymentId) |
|||
: base("OrderIsNotInSpecifiedPayment", $"The order ({orderId}) is not in the specified payment ({paymentId}).") |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
using System; |
|||
|
|||
namespace EasyAbp.EShop.Payments.Payments |
|||
{ |
|||
[Serializable] |
|||
public class EShopPaymentCanceledEto |
|||
{ |
|||
public EShopPaymentEto Payment { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
using System; |
|||
|
|||
namespace EasyAbp.EShop.Payments.Payments |
|||
{ |
|||
[Serializable] |
|||
public class EShopPaymentCompletedEto |
|||
{ |
|||
public EShopPaymentEto Payment { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using EasyAbp.PaymentService.Payments; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.MultiTenancy; |
|||
|
|||
namespace EasyAbp.EShop.Payments.Payments |
|||
{ |
|||
[Serializable] |
|||
public class EShopPaymentEto : IPayment, IMultiTenant, IHasExtraProperties |
|||
{ |
|||
#region Base properties
|
|||
|
|||
public Guid Id { get; set; } |
|||
|
|||
public Guid? TenantId { get; set; } |
|||
|
|||
public Guid UserId { get; set; } |
|||
|
|||
public string PaymentMethod { get; set; } |
|||
|
|||
public string PayeeAccount { 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 decimal PendingRefundAmount { get; set; } |
|||
|
|||
public DateTime? CompletionTime { get; set; } |
|||
|
|||
public DateTime? CanceledTime { get; set; } |
|||
|
|||
public Dictionary<string, object> ExtraProperties { get; set; } |
|||
|
|||
#endregion
|
|||
|
|||
public List<EShopPaymentItemEto> PaymentItems { get; set; } = new List<EShopPaymentItemEto>(); |
|||
} |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using EasyAbp.PaymentService.Payments; |
|||
using Volo.Abp.Data; |
|||
|
|||
namespace EasyAbp.EShop.Payments.Payments |
|||
{ |
|||
[Serializable] |
|||
public class EShopPaymentItemEto : IPaymentItem, IHasExtraProperties |
|||
{ |
|||
#region Base properties
|
|||
|
|||
public Guid Id { get; set; } |
|||
|
|||
public string ItemType { get; set; } |
|||
|
|||
public string ItemKey { get; set; } |
|||
|
|||
public decimal OriginalPaymentAmount { get; set; } |
|||
|
|||
public decimal PaymentDiscount { get; set; } |
|||
|
|||
public decimal ActualPaymentAmount { get; set; } |
|||
|
|||
public decimal RefundAmount { get; set; } |
|||
|
|||
public decimal PendingRefundAmount { get; set; } |
|||
|
|||
public Dictionary<string, object> ExtraProperties { get; set; } |
|||
|
|||
#endregion
|
|||
|
|||
public Guid StoreId { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
namespace EasyAbp.EShop.Payments.Refunds |
|||
{ |
|||
public class EShopRefundCompletedEto |
|||
{ |
|||
public EShopRefundEto Refund { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace EasyAbp.EShop.Products.Products |
|||
{ |
|||
public class DefaultProductPriceProvider : IProductPriceProvider, ITransientDependency |
|||
{ |
|||
public virtual Task<decimal> GetPriceAsync(Product product, ProductSku productSku, Guid storeId) |
|||
{ |
|||
return Task.FromResult(productSku.Price); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace EasyAbp.EShop.Products.Products |
|||
{ |
|||
public interface IProductPriceProvider |
|||
{ |
|||
Task<decimal> GetPriceAsync(Product product, ProductSku productSku, Guid storeId); |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
namespace EasyAbp.EShop.Products.Products |
|||
{ |
|||
public class PriceDataModel |
|||
{ |
|||
public decimal Price { get; set; } |
|||
|
|||
public decimal DiscountedPrice { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
using EasyAbp.PaymentService.Prepayment.Options.AccountGroups; |
|||
|
|||
namespace EShopSample |
|||
{ |
|||
[AccountGroupName("default")] |
|||
public class DefaultAccountGroup |
|||
{ |
|||
|
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,86 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace EShopSample.Migrations |
|||
{ |
|||
public partial class AddedPrepaymentModule : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.CreateTable( |
|||
name: "EasyAbpPaymentServicePrepaymentAccounts", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
ExtraProperties = table.Column<string>(nullable: true), |
|||
ConcurrencyStamp = table.Column<string>(maxLength: 40, nullable: true), |
|||
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, defaultValue: false), |
|||
DeleterId = table.Column<Guid>(nullable: true), |
|||
DeletionTime = table.Column<DateTime>(nullable: true), |
|||
TenantId = table.Column<Guid>(nullable: true), |
|||
AccountGroupName = table.Column<string>(nullable: true), |
|||
UserId = table.Column<Guid>(nullable: false), |
|||
Balance = table.Column<decimal>(type: "decimal(20,8)", nullable: false), |
|||
LockedBalance = table.Column<decimal>(type: "decimal(20,8)", nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_EasyAbpPaymentServicePrepaymentAccounts", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "EasyAbpPaymentServicePrepaymentTransactions", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(nullable: false), |
|||
ExtraProperties = table.Column<string>(nullable: true), |
|||
ConcurrencyStamp = table.Column<string>(maxLength: 40, nullable: true), |
|||
CreationTime = table.Column<DateTime>(nullable: false), |
|||
CreatorId = table.Column<Guid>(nullable: true), |
|||
TenantId = table.Column<Guid>(nullable: true), |
|||
AccountId = table.Column<Guid>(nullable: false), |
|||
AccountUserId = table.Column<Guid>(nullable: false), |
|||
PaymentId = table.Column<Guid>(nullable: true), |
|||
TransactionType = table.Column<int>(nullable: false), |
|||
ActionName = table.Column<string>(nullable: true), |
|||
PaymentMethod = table.Column<string>(nullable: true), |
|||
ExternalTradingCode = table.Column<string>(nullable: true), |
|||
Currency = table.Column<string>(nullable: true), |
|||
ChangedBalance = table.Column<decimal>(type: "decimal(20,8)", nullable: false), |
|||
OriginalBalance = table.Column<decimal>(type: "decimal(20,8)", nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_EasyAbpPaymentServicePrepaymentTransactions", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_EasyAbpPaymentServicePrepaymentAccounts_UserId", |
|||
table: "EasyAbpPaymentServicePrepaymentAccounts", |
|||
column: "UserId"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_EasyAbpPaymentServicePrepaymentTransactions_AccountId", |
|||
table: "EasyAbpPaymentServicePrepaymentTransactions", |
|||
column: "AccountId"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_EasyAbpPaymentServicePrepaymentTransactions_AccountUserId", |
|||
table: "EasyAbpPaymentServicePrepaymentTransactions", |
|||
column: "AccountUserId"); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "EasyAbpPaymentServicePrepaymentAccounts"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "EasyAbpPaymentServicePrepaymentTransactions"); |
|||
} |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,23 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace EShopSample.Migrations |
|||
{ |
|||
public partial class RemovedCurrencyFromPaymentItem : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "Currency", |
|||
table: "EasyAbpEShopPaymentsPaymentItems"); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AddColumn<string>( |
|||
name: "Currency", |
|||
table: "EasyAbpEShopPaymentsPaymentItems", |
|||
type: "nvarchar(max)", |
|||
nullable: true); |
|||
} |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,33 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace EShopSample.Migrations |
|||
{ |
|||
public partial class RemovedSpecifiedInventoryProviderName : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "SpecifiedInventoryProviderName", |
|||
table: "EasyAbpEShopProductsProductSkus"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "SpecifiedInventoryProviderName", |
|||
table: "EasyAbpEShopProductsProducts"); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AddColumn<string>( |
|||
name: "SpecifiedInventoryProviderName", |
|||
table: "EasyAbpEShopProductsProductSkus", |
|||
type: "nvarchar(max)", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "SpecifiedInventoryProviderName", |
|||
table: "EasyAbpEShopProductsProducts", |
|||
type: "nvarchar(max)", |
|||
nullable: true); |
|||
} |
|||
} |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue