From 0aa3b0c52ddfa5ec9edf28db9a0b23d8f2a1ec63 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Thu, 7 Oct 2021 14:01:11 +0300
Subject: [PATCH 01/75] Added Payment.HttpApi.Client
---
modules/payment/Payment.sln | 7 +++
.../ClientProxies/Payment-generate-proxy.json | 53 +++++++++++++++++++
.../SampleClientProxy.Generated.cs | 28 ++++++++++
.../ClientProxies/SampleClientProxy.cs | 8 +++
.../Payment.HttpApi.Client/FodyWeavers.xml | 3 ++
.../Payment.HttpApi.Client/FodyWeavers.xsd | 30 +++++++++++
.../Payment.HttpApi.Client.csproj | 20 +++++++
.../PaymentHttpApiClientModule.cs | 27 ++++++++++
8 files changed, 176 insertions(+)
create mode 100644 modules/payment/src/Payment.HttpApi.Client/ClientProxies/Payment-generate-proxy.json
create mode 100644 modules/payment/src/Payment.HttpApi.Client/ClientProxies/SampleClientProxy.Generated.cs
create mode 100644 modules/payment/src/Payment.HttpApi.Client/ClientProxies/SampleClientProxy.cs
create mode 100644 modules/payment/src/Payment.HttpApi.Client/FodyWeavers.xml
create mode 100644 modules/payment/src/Payment.HttpApi.Client/FodyWeavers.xsd
create mode 100644 modules/payment/src/Payment.HttpApi.Client/Payment.HttpApi.Client.csproj
create mode 100644 modules/payment/src/Payment.HttpApi.Client/PaymentHttpApiClientModule.cs
diff --git a/modules/payment/Payment.sln b/modules/payment/Payment.sln
index 0806097..03efb75 100644
--- a/modules/payment/Payment.sln
+++ b/modules/payment/Payment.sln
@@ -41,6 +41,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "www", "www", "{D3FD0217-A8C
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "admin", "admin", "{FC718EF0-43EB-4767-9578-95FA0B3727A5}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Payment.HttpApi.Client", "src\Payment.HttpApi.Client\Payment.HttpApi.Client.csproj", "{3FF65447-69D5-4115-8398-8156FB381215}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -91,6 +93,10 @@ Global
{3B7B6317-1B85-4164-8E11-75574F80AE17}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B7B6317-1B85-4164-8E11-75574F80AE17}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3B7B6317-1B85-4164-8E11-75574F80AE17}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3FF65447-69D5-4115-8398-8156FB381215}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3FF65447-69D5-4115-8398-8156FB381215}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3FF65447-69D5-4115-8398-8156FB381215}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3FF65447-69D5-4115-8398-8156FB381215}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -113,6 +119,7 @@ Global
{D3FD0217-A8C7-4BAF-BF77-962F1B055515} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D}
{90CB5DC4-C040-45C7-8900-9688B26405BC} = {D3FD0217-A8C7-4BAF-BF77-962F1B055515}
{FC718EF0-43EB-4767-9578-95FA0B3727A5} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D}
+ {3FF65447-69D5-4115-8398-8156FB381215} = {4EF8B98A-E7A3-48A6-9C1F-10DE32001213}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6AAFA1C6-603E-13FA-45E5-7910AA9F661D}
diff --git a/modules/payment/src/Payment.HttpApi.Client/ClientProxies/Payment-generate-proxy.json b/modules/payment/src/Payment.HttpApi.Client/ClientProxies/Payment-generate-proxy.json
new file mode 100644
index 0000000..8f9c667
--- /dev/null
+++ b/modules/payment/src/Payment.HttpApi.Client/ClientProxies/Payment-generate-proxy.json
@@ -0,0 +1,53 @@
+{
+ "modules": {
+ "Payment": {
+ "rootPath": "Payment",
+ "remoteServiceName": "Payment",
+ "controllers": {
+ "Payment.Samples.SampleController": {
+ "controllerName": "Sample",
+ "controllerGroupName": "Sample",
+ "type": "Payment.Samples.SampleController",
+ "interfaces": [
+ {
+ "type": "Payment.Samples.ISampleAppService"
+ }
+ ],
+ "actions": {
+ "GetAsync": {
+ "uniqueName": "GetAsync",
+ "name": "GetAsync",
+ "httpMethod": "GET",
+ "url": "api/Payment/sample",
+ "supportedVersions": [],
+ "parametersOnMethod": [],
+ "parameters": [],
+ "returnValue": {
+ "type": "Payment.Samples.SampleDto",
+ "typeSimple": "Payment.Samples.SampleDto"
+ },
+ "allowAnonymous": null,
+ "implementFrom": "Payment.Samples.ISampleAppService"
+ },
+ "GetAuthorizedAsync": {
+ "uniqueName": "GetAuthorizedAsync",
+ "name": "GetAuthorizedAsync",
+ "httpMethod": "GET",
+ "url": "api/Payment/sample/authorized",
+ "supportedVersions": [],
+ "parametersOnMethod": [],
+ "parameters": [],
+ "returnValue": {
+ "type": "Payment.Samples.SampleDto",
+ "typeSimple": "Payment.Samples.SampleDto"
+ },
+ "allowAnonymous": false,
+ "implementFrom": "Payment.Samples.ISampleAppService"
+ }
+ }
+ }
+ }
+ }
+ },
+ "types": {}
+}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.HttpApi.Client/ClientProxies/SampleClientProxy.Generated.cs b/modules/payment/src/Payment.HttpApi.Client/ClientProxies/SampleClientProxy.Generated.cs
new file mode 100644
index 0000000..970605e
--- /dev/null
+++ b/modules/payment/src/Payment.HttpApi.Client/ClientProxies/SampleClientProxy.Generated.cs
@@ -0,0 +1,28 @@
+// This file is automatically generated by ABP framework to use MVC Controllers from CSharp
+using System;
+using System.Threading.Tasks;
+using Volo.Abp.Application.Dtos;
+using Volo.Abp.Http.Client;
+using Volo.Abp.Http.Modeling;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Http.Client.ClientProxying;
+using Payment.Samples;
+
+// ReSharper disable once CheckNamespace
+namespace Payment.Samples.ClientProxies
+{
+ [Dependency(ReplaceServices = true)]
+ [ExposeServices(typeof(ISampleAppService), typeof(SampleClientProxy))]
+ public partial class SampleClientProxy : ClientProxyBase, ISampleAppService
+ {
+ public virtual async Task GetAsync()
+ {
+ return await RequestAsync(nameof(GetAsync));
+ }
+
+ public virtual async Task GetAuthorizedAsync()
+ {
+ return await RequestAsync(nameof(GetAuthorizedAsync));
+ }
+ }
+}
diff --git a/modules/payment/src/Payment.HttpApi.Client/ClientProxies/SampleClientProxy.cs b/modules/payment/src/Payment.HttpApi.Client/ClientProxies/SampleClientProxy.cs
new file mode 100644
index 0000000..948c2ea
--- /dev/null
+++ b/modules/payment/src/Payment.HttpApi.Client/ClientProxies/SampleClientProxy.cs
@@ -0,0 +1,8 @@
+// This file is part of SampleClientProxy, you can customize it here
+// ReSharper disable once CheckNamespace
+namespace Payment.Samples.ClientProxies
+{
+ public partial class SampleClientProxy
+ {
+ }
+}
diff --git a/modules/payment/src/Payment.HttpApi.Client/FodyWeavers.xml b/modules/payment/src/Payment.HttpApi.Client/FodyWeavers.xml
new file mode 100644
index 0000000..1715698
--- /dev/null
+++ b/modules/payment/src/Payment.HttpApi.Client/FodyWeavers.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/modules/payment/src/Payment.HttpApi.Client/FodyWeavers.xsd b/modules/payment/src/Payment.HttpApi.Client/FodyWeavers.xsd
new file mode 100644
index 0000000..ffa6fc4
--- /dev/null
+++ b/modules/payment/src/Payment.HttpApi.Client/FodyWeavers.xsd
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.
+
+
+
+
+ A comma-separated list of error codes that can be safely ignored in assembly verification.
+
+
+
+
+ 'false' to turn off automatic generation of the XML Schema file.
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/payment/src/Payment.HttpApi.Client/Payment.HttpApi.Client.csproj b/modules/payment/src/Payment.HttpApi.Client/Payment.HttpApi.Client.csproj
new file mode 100644
index 0000000..628fafc
--- /dev/null
+++ b/modules/payment/src/Payment.HttpApi.Client/Payment.HttpApi.Client.csproj
@@ -0,0 +1,20 @@
+
+
+
+
+
+ netstandard2.0
+ Payment
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/payment/src/Payment.HttpApi.Client/PaymentHttpApiClientModule.cs b/modules/payment/src/Payment.HttpApi.Client/PaymentHttpApiClientModule.cs
new file mode 100644
index 0000000..7ad7e88
--- /dev/null
+++ b/modules/payment/src/Payment.HttpApi.Client/PaymentHttpApiClientModule.cs
@@ -0,0 +1,27 @@
+using Microsoft.Extensions.DependencyInjection;
+using Volo.Abp.Http.Client;
+using Volo.Abp.Modularity;
+using Volo.Abp.VirtualFileSystem;
+
+namespace Payment
+{
+ [DependsOn(
+ typeof(PaymentApplicationContractsModule),
+ typeof(AbpHttpClientModule))]
+ public class PaymentHttpApiClientModule : AbpModule
+ {
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+ context.Services.AddStaticHttpClientProxies(
+ typeof(PaymentApplicationContractsModule).Assembly,
+ PaymentRemoteServiceConsts.RemoteServiceName
+ );
+
+ Configure(options =>
+ {
+ options.FileSets.AddEmbedded();
+ });
+
+ }
+ }
+}
From e3b50eefff81f63bf5bc401370d65f21780fc0a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Thu, 7 Oct 2021 14:57:15 +0300
Subject: [PATCH 02/75] Added PaymentRequest aggregate root and mapped to EF
Core
---
.../PaymentRequests/PaymentRequestConsts.cs | 8 +++++
.../PaymentRequests/PaymentRequestState.cs | 9 +++++
.../src/Payment.Domain/PaymentDbProperties.cs | 2 +-
.../PaymentRequests/PaymentRequest.cs | 33 +++++++++++++++++++
.../EntityFrameworkCore/IPaymentDbContext.cs | 8 ++---
.../EntityFrameworkCore/PaymentDbContext.cs | 5 ++-
...PaymentDbContextModelCreatingExtensions.cs | 23 +++++--------
7 files changed, 65 insertions(+), 23 deletions(-)
create mode 100644 modules/payment/src/Payment.Domain.Shared/PaymentRequests/PaymentRequestConsts.cs
create mode 100644 modules/payment/src/Payment.Domain.Shared/PaymentRequests/PaymentRequestState.cs
create mode 100644 modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs
diff --git a/modules/payment/src/Payment.Domain.Shared/PaymentRequests/PaymentRequestConsts.cs b/modules/payment/src/Payment.Domain.Shared/PaymentRequests/PaymentRequestConsts.cs
new file mode 100644
index 0000000..02574dc
--- /dev/null
+++ b/modules/payment/src/Payment.Domain.Shared/PaymentRequests/PaymentRequestConsts.cs
@@ -0,0 +1,8 @@
+namespace Payment.PaymentRequests
+{
+ public static class PaymentRequestConsts
+ {
+ public const int MaxProductIdLength = 100;
+ public const int MaxProductNameLength = 200;
+ }
+}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Domain.Shared/PaymentRequests/PaymentRequestState.cs b/modules/payment/src/Payment.Domain.Shared/PaymentRequests/PaymentRequestState.cs
new file mode 100644
index 0000000..faa3bce
--- /dev/null
+++ b/modules/payment/src/Payment.Domain.Shared/PaymentRequests/PaymentRequestState.cs
@@ -0,0 +1,9 @@
+namespace Payment.PaymentRequests
+{
+ public enum PaymentRequestState : byte
+ {
+ Waiting = 0,
+ Completed,
+ Failed
+ }
+}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Domain/PaymentDbProperties.cs b/modules/payment/src/Payment.Domain/PaymentDbProperties.cs
index 258bc24..ae502eb 100644
--- a/modules/payment/src/Payment.Domain/PaymentDbProperties.cs
+++ b/modules/payment/src/Payment.Domain/PaymentDbProperties.cs
@@ -2,7 +2,7 @@
{
public static class PaymentDbProperties
{
- public static string DbTablePrefix { get; set; } = "Payment";
+ public static string DbTablePrefix { get; set; } = "Pay";
public static string DbSchema { get; set; } = null;
diff --git a/modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs b/modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs
new file mode 100644
index 0000000..ae8c9ed
--- /dev/null
+++ b/modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs
@@ -0,0 +1,33 @@
+using System;
+using JetBrains.Annotations;
+using Volo.Abp;
+using Volo.Abp.Domain.Entities.Auditing;
+
+namespace Payment.PaymentRequests
+{
+ public class PaymentRequest : CreationAuditedAggregateRoot
+ {
+ public string CustomerId { get; private set; }
+
+ public string ProductId { get; private set; }
+
+ [NotNull]
+ public string ProductName { get; private set; }
+
+ public decimal Amount { get; private set; }
+
+ public PaymentRequestState State { get; set; }
+
+ public PaymentRequest(
+ Guid id,
+ [NotNull] string productName,
+ [CanBeNull] string productId,
+ decimal amount)
+ : base(id)
+ {
+ ProductName = Check.NotNullOrWhiteSpace(productName, nameof(productName));
+ ProductId = productId;
+ Amount = amount;
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.EntityFrameworkCore/EntityFrameworkCore/IPaymentDbContext.cs b/modules/payment/src/Payment.EntityFrameworkCore/EntityFrameworkCore/IPaymentDbContext.cs
index 3259838..28e4b20 100644
--- a/modules/payment/src/Payment.EntityFrameworkCore/EntityFrameworkCore/IPaymentDbContext.cs
+++ b/modules/payment/src/Payment.EntityFrameworkCore/EntityFrameworkCore/IPaymentDbContext.cs
@@ -1,4 +1,6 @@
-using Volo.Abp.Data;
+using Microsoft.EntityFrameworkCore;
+using Payment.PaymentRequests;
+using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
namespace Payment.EntityFrameworkCore
@@ -6,8 +8,6 @@ namespace Payment.EntityFrameworkCore
[ConnectionStringName(PaymentDbProperties.ConnectionStringName)]
public interface IPaymentDbContext : IEfCoreDbContext
{
- /* Add DbSet for each Aggregate Root here. Example:
- * DbSet Questions { get; }
- */
+ DbSet PaymentRequests { get; }
}
}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentDbContext.cs b/modules/payment/src/Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentDbContext.cs
index aa87890..c2a066e 100644
--- a/modules/payment/src/Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentDbContext.cs
+++ b/modules/payment/src/Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentDbContext.cs
@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
+using Payment.PaymentRequests;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
@@ -7,9 +8,7 @@ namespace Payment.EntityFrameworkCore
[ConnectionStringName(PaymentDbProperties.ConnectionStringName)]
public class PaymentDbContext : AbpDbContext, IPaymentDbContext
{
- /* Add DbSet for each Aggregate Root here. Example:
- * public DbSet Questions { get; set; }
- */
+ public DbSet PaymentRequests { get; set; }
public PaymentDbContext(DbContextOptions options)
: base(options)
diff --git a/modules/payment/src/Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentDbContextModelCreatingExtensions.cs b/modules/payment/src/Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentDbContextModelCreatingExtensions.cs
index 18c6740..512724e 100644
--- a/modules/payment/src/Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentDbContextModelCreatingExtensions.cs
+++ b/modules/payment/src/Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentDbContextModelCreatingExtensions.cs
@@ -1,5 +1,7 @@
using Microsoft.EntityFrameworkCore;
+using Payment.PaymentRequests;
using Volo.Abp;
+using Volo.Abp.EntityFrameworkCore.Modeling;
namespace Payment.EntityFrameworkCore
{
@@ -10,25 +12,16 @@ namespace Payment.EntityFrameworkCore
{
Check.NotNull(builder, nameof(builder));
- /* Configure all entities here. Example:
-
- builder.Entity(b =>
+ builder.Entity(b =>
{
- //Configure table & schema name
- b.ToTable(PaymentDbProperties.DbTablePrefix + "Questions", PaymentDbProperties.DbSchema);
-
+ b.ToTable(PaymentDbProperties.DbTablePrefix + "PaymentRequests", PaymentDbProperties.DbSchema);
b.ConfigureByConvention();
+ b.Property(x => x.ProductName).IsRequired().HasMaxLength(PaymentRequestConsts.MaxProductNameLength);
+ b.Property(x => x.ProductId).IsRequired().HasMaxLength(PaymentRequestConsts.MaxProductIdLength);
- //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);
+ b.HasIndex(x => x.CustomerId);
+ b.HasIndex(x => x.State);
});
- */
}
}
}
From 45d2e940eb25a5bcf0615f241c65a77420890ebe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Thu, 7 Oct 2021 15:11:18 +0300
Subject: [PATCH 03/75] Added initial IPaymentRequestAppService
---
.../IPaymentRequestAppService.cs | 10 +++++++
.../PaymentRequestCreationDto.cs | 17 +++++++++++
.../PaymentRequests/PaymentRequestDto.cs | 18 ++++++++++++
.../PaymentApplicationAutoMapperProfile.cs | 5 ++--
.../PaymentRequestAppService.cs | 29 +++++++++++++++++++
.../IPaymentRequestRepository.cs | 10 +++++++
.../PaymentRequests/PaymentRequest.cs | 8 +++--
.../Repositories/PaymentRequestRepository.cs | 15 ++++++++++
8 files changed, 107 insertions(+), 5 deletions(-)
create mode 100644 modules/payment/src/Payment.Application.Contracts/PaymentRequests/IPaymentRequestAppService.cs
create mode 100644 modules/payment/src/Payment.Application.Contracts/PaymentRequests/PaymentRequestCreationDto.cs
create mode 100644 modules/payment/src/Payment.Application.Contracts/PaymentRequests/PaymentRequestDto.cs
create mode 100644 modules/payment/src/Payment.Application/PaymentRequests/PaymentRequestAppService.cs
create mode 100644 modules/payment/src/Payment.Domain/PaymentRequests/IPaymentRequestRepository.cs
create mode 100644 modules/payment/src/Payment.EntityFrameworkCore/EntityFrameworkCore/Repositories/PaymentRequestRepository.cs
diff --git a/modules/payment/src/Payment.Application.Contracts/PaymentRequests/IPaymentRequestAppService.cs b/modules/payment/src/Payment.Application.Contracts/PaymentRequests/IPaymentRequestAppService.cs
new file mode 100644
index 0000000..0467c6d
--- /dev/null
+++ b/modules/payment/src/Payment.Application.Contracts/PaymentRequests/IPaymentRequestAppService.cs
@@ -0,0 +1,10 @@
+using System.Threading.Tasks;
+using Volo.Abp.Application.Services;
+
+namespace Payment.PaymentRequests
+{
+ public interface IPaymentRequestAppService : IApplicationService
+ {
+ Task CreateAsync(PaymentRequestCreationDto input);
+ }
+}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Application.Contracts/PaymentRequests/PaymentRequestCreationDto.cs b/modules/payment/src/Payment.Application.Contracts/PaymentRequests/PaymentRequestCreationDto.cs
new file mode 100644
index 0000000..78baab2
--- /dev/null
+++ b/modules/payment/src/Payment.Application.Contracts/PaymentRequests/PaymentRequestCreationDto.cs
@@ -0,0 +1,17 @@
+using System.ComponentModel.DataAnnotations;
+using Volo.Abp.ObjectExtending;
+
+namespace Payment.PaymentRequests
+{
+ public class PaymentRequestCreationDto : ExtensibleObject
+ {
+ public string CustomerId { get; set; }
+
+ public string ProductId { get; set; }
+
+ [Required]
+ public string ProductName { get; set; }
+
+ public decimal Amount { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Application.Contracts/PaymentRequests/PaymentRequestDto.cs b/modules/payment/src/Payment.Application.Contracts/PaymentRequests/PaymentRequestDto.cs
new file mode 100644
index 0000000..528a6f1
--- /dev/null
+++ b/modules/payment/src/Payment.Application.Contracts/PaymentRequests/PaymentRequestDto.cs
@@ -0,0 +1,18 @@
+using System;
+using Volo.Abp.Application.Dtos;
+
+namespace Payment.PaymentRequests
+{
+ public class PaymentRequestDto : CreationAuditedEntityDto
+ {
+ public string CustomerId { get; set; }
+
+ public string ProductId { get; set; }
+
+ public string ProductName { get; set; }
+
+ public decimal Amount { get; set; }
+
+ public PaymentRequestState State { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Application/PaymentApplicationAutoMapperProfile.cs b/modules/payment/src/Payment.Application/PaymentApplicationAutoMapperProfile.cs
index a15ddeb..bf8c80d 100644
--- a/modules/payment/src/Payment.Application/PaymentApplicationAutoMapperProfile.cs
+++ b/modules/payment/src/Payment.Application/PaymentApplicationAutoMapperProfile.cs
@@ -1,4 +1,5 @@
using AutoMapper;
+using Payment.PaymentRequests;
namespace Payment
{
@@ -6,9 +7,7 @@ namespace Payment
{
public PaymentApplicationAutoMapperProfile()
{
- /* You can configure your AutoMapper mapping configuration here.
- * Alternatively, you can split your mapping configurations
- * into multiple profile classes for a better organization. */
+ CreateMap();
}
}
}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Application/PaymentRequests/PaymentRequestAppService.cs b/modules/payment/src/Payment.Application/PaymentRequests/PaymentRequestAppService.cs
new file mode 100644
index 0000000..bfe3504
--- /dev/null
+++ b/modules/payment/src/Payment.Application/PaymentRequests/PaymentRequestAppService.cs
@@ -0,0 +1,29 @@
+using System.Threading.Tasks;
+
+namespace Payment.PaymentRequests
+{
+ public class PaymentRequestAppService : PaymentAppService, IPaymentRequestAppService
+ {
+ private readonly IPaymentRequestRepository _paymentRequestRepository;
+
+ public PaymentRequestAppService(IPaymentRequestRepository paymentRequestRepository)
+ {
+ _paymentRequestRepository = paymentRequestRepository;
+ }
+
+ public async Task CreateAsync(PaymentRequestCreationDto input)
+ {
+ var paymentRequest = new PaymentRequest(
+ GuidGenerator.Create(),
+ input.CustomerId,
+ input.ProductId,
+ input.ProductName,
+ input.Amount
+ );
+
+ await _paymentRequestRepository.InsertAsync(paymentRequest);
+
+ return ObjectMapper.Map(paymentRequest);
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Domain/PaymentRequests/IPaymentRequestRepository.cs b/modules/payment/src/Payment.Domain/PaymentRequests/IPaymentRequestRepository.cs
new file mode 100644
index 0000000..1269daa
--- /dev/null
+++ b/modules/payment/src/Payment.Domain/PaymentRequests/IPaymentRequestRepository.cs
@@ -0,0 +1,10 @@
+using System;
+using Volo.Abp.Domain.Repositories;
+
+namespace Payment.PaymentRequests
+{
+ public interface IPaymentRequestRepository : IRepository
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs b/modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs
index ae8c9ed..80049b4 100644
--- a/modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs
+++ b/modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs
@@ -7,8 +7,10 @@ namespace Payment.PaymentRequests
{
public class PaymentRequest : CreationAuditedAggregateRoot
{
+ [CanBeNull]
public string CustomerId { get; private set; }
+ [CanBeNull]
public string ProductId { get; private set; }
[NotNull]
@@ -20,13 +22,15 @@ namespace Payment.PaymentRequests
public PaymentRequest(
Guid id,
- [NotNull] string productName,
+ [CanBeNull] string customerId,
[CanBeNull] string productId,
+ [NotNull] string productName,
decimal amount)
: base(id)
{
- ProductName = Check.NotNullOrWhiteSpace(productName, nameof(productName));
+ CustomerId = customerId;
ProductId = productId;
+ ProductName = Check.NotNullOrWhiteSpace(productName, nameof(productName));
Amount = amount;
}
}
diff --git a/modules/payment/src/Payment.EntityFrameworkCore/EntityFrameworkCore/Repositories/PaymentRequestRepository.cs b/modules/payment/src/Payment.EntityFrameworkCore/EntityFrameworkCore/Repositories/PaymentRequestRepository.cs
new file mode 100644
index 0000000..d0e236d
--- /dev/null
+++ b/modules/payment/src/Payment.EntityFrameworkCore/EntityFrameworkCore/Repositories/PaymentRequestRepository.cs
@@ -0,0 +1,15 @@
+using System;
+using Payment.PaymentRequests;
+using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
+using Volo.Abp.EntityFrameworkCore;
+
+namespace Payment.EntityFrameworkCore.Repositories
+{
+ public class PaymentRequestRepository : EfCoreRepository, IPaymentRequestRepository
+ {
+ public PaymentRequestRepository(IDbContextProvider dbContextProvider)
+ : base(dbContextProvider)
+ {
+ }
+ }
+}
\ No newline at end of file
From 7ed48a66413545a47afff1c307962cd45d88d41b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Thu, 7 Oct 2021 15:39:03 +0300
Subject: [PATCH 04/75] Remove docker files
---
modules/payment/docker-compose.migrations.yml | 13 ---------
modules/payment/docker-compose.override.yml | 29 -------------------
modules/payment/docker-compose.yml | 25 ----------------
3 files changed, 67 deletions(-)
delete mode 100644 modules/payment/docker-compose.migrations.yml
delete mode 100644 modules/payment/docker-compose.override.yml
delete mode 100644 modules/payment/docker-compose.yml
diff --git a/modules/payment/docker-compose.migrations.yml b/modules/payment/docker-compose.migrations.yml
deleted file mode 100644
index e9b751f..0000000
--- a/modules/payment/docker-compose.migrations.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-version: '3.4'
-
-services:
- migrations:
- build:
- context: ../../
- dockerfile: templates/service/database/Dockerfile
- depends_on:
- - sqlserver
- environment:
- - IdentityServer_DB=Payment_Identity
- - Payment_DB=Payment_ModuleDb
- - SA_PASSWORD=yourStrong(!)Password
diff --git a/modules/payment/docker-compose.override.yml b/modules/payment/docker-compose.override.yml
deleted file mode 100644
index cea9b3a..0000000
--- a/modules/payment/docker-compose.override.yml
+++ /dev/null
@@ -1,29 +0,0 @@
-version: '3.4'
-
-services:
- sqlserver:
- environment:
- - SA_PASSWORD=yourStrong(!)Password
- - ACCEPT_EULA=Y
- ports:
- - "51599:1433"
-
- identity-server:
- environment:
- - ASPNETCORE_URLS=http://0.0.0.0:80
- - ConnectionStrings__Default=Server=sqlserver;Database=Payment_Identity;Trusted_Connection=True;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- - ConnectionStrings__SqlServerCache=Server=sqlserver;Database=Payment_Cache;Trusted_Connection=True;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- ports:
- - "51600:80"
-
- payment:
- environment:
- - ASPNETCORE_URLS=http://0.0.0.0:80
- - ConnectionStrings__Default=Server=sqlserver;Database=Payment_ModuleDb;Trusted_Connection=True;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- - ConnectionStrings__AbpSettingManagement=Server=sqlserver;Database=Payment_Identity;Trusted_Connection=True;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- - ConnectionStrings__AbpPermissionManagement=Server=sqlserver;Database=Payment_Identity;Trusted_Connection=True;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- - ConnectionStrings__AbpAuditLogging=Server=sqlserver;Database=Payment_Identity;Trusted_Connection=True;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- - ConnectionStrings__SqlServerCache=Server=sqlserver;Database=Payment_Cache;Trusted_Connection=True;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- - AuthServer__Authority=http://identity-server
- ports:
- - "51601:80"
\ No newline at end of file
diff --git a/modules/payment/docker-compose.yml b/modules/payment/docker-compose.yml
deleted file mode 100644
index cbf2052..0000000
--- a/modules/payment/docker-compose.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-version: '3.4'
-
-services:
- sqlserver:
- image: mcr.microsoft.com/mssql/server
- volumes:
- - dbdata:/var/opt/mssql
-
- identity-server:
- build:
- context: ../../
- dockerfile: templates/service/host/IdentityServerHost/Dockerfile
- depends_on:
- - sqlserver
-
- payment:
- build:
- context: ../../
- dockerfile: templates/service/host/Payment.Host/Dockerfile
- depends_on:
- - sqlserver
- - identity-server
-
-volumes:
- dbdata:
\ No newline at end of file
From 436ea8dac6e46953c074a3806332fdecf09ded5d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Thu, 7 Oct 2021 15:39:14 +0300
Subject: [PATCH 05/75] Create PaymentRequestAppService_Tests
---
.../PaymentRequests/PaymentRequestConsts.cs | 1 +
...PaymentDbContextModelCreatingExtensions.cs | 3 +-
.../PaymentRequestAppService_Tests.cs | 33 +++++++++++++++++++
3 files changed, 36 insertions(+), 1 deletion(-)
create mode 100644 modules/payment/test/Payment.Application.Tests/PaymentRequests/PaymentRequestAppService_Tests.cs
diff --git a/modules/payment/src/Payment.Domain.Shared/PaymentRequests/PaymentRequestConsts.cs b/modules/payment/src/Payment.Domain.Shared/PaymentRequests/PaymentRequestConsts.cs
index 02574dc..bd3a2a7 100644
--- a/modules/payment/src/Payment.Domain.Shared/PaymentRequests/PaymentRequestConsts.cs
+++ b/modules/payment/src/Payment.Domain.Shared/PaymentRequests/PaymentRequestConsts.cs
@@ -2,6 +2,7 @@
{
public static class PaymentRequestConsts
{
+ public const int MaxCustomerIdLength = 100;
public const int MaxProductIdLength = 100;
public const int MaxProductNameLength = 200;
}
diff --git a/modules/payment/src/Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentDbContextModelCreatingExtensions.cs b/modules/payment/src/Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentDbContextModelCreatingExtensions.cs
index 512724e..ef9b081 100644
--- a/modules/payment/src/Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentDbContextModelCreatingExtensions.cs
+++ b/modules/payment/src/Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentDbContextModelCreatingExtensions.cs
@@ -16,8 +16,9 @@ namespace Payment.EntityFrameworkCore
{
b.ToTable(PaymentDbProperties.DbTablePrefix + "PaymentRequests", PaymentDbProperties.DbSchema);
b.ConfigureByConvention();
+ b.Property(x => x.CustomerId).HasMaxLength(PaymentRequestConsts.MaxCustomerIdLength);
+ b.Property(x => x.ProductId).HasMaxLength(PaymentRequestConsts.MaxProductIdLength);
b.Property(x => x.ProductName).IsRequired().HasMaxLength(PaymentRequestConsts.MaxProductNameLength);
- b.Property(x => x.ProductId).IsRequired().HasMaxLength(PaymentRequestConsts.MaxProductIdLength);
b.HasIndex(x => x.CustomerId);
b.HasIndex(x => x.State);
diff --git a/modules/payment/test/Payment.Application.Tests/PaymentRequests/PaymentRequestAppService_Tests.cs b/modules/payment/test/Payment.Application.Tests/PaymentRequests/PaymentRequestAppService_Tests.cs
new file mode 100644
index 0000000..0a5bb3e
--- /dev/null
+++ b/modules/payment/test/Payment.Application.Tests/PaymentRequests/PaymentRequestAppService_Tests.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Threading.Tasks;
+using Shouldly;
+using Xunit;
+
+namespace Payment.PaymentRequests
+{
+ public class PaymentRequestAppService_Tests : PaymentApplicationTestBase
+ {
+ private readonly IPaymentRequestAppService _paymentRequestAppService;
+
+ public PaymentRequestAppService_Tests()
+ {
+ _paymentRequestAppService = GetRequiredService();
+ }
+
+ [Fact]
+ public async Task Should_Create_Minimal_Payment_Request()
+ {
+ var result = await _paymentRequestAppService.CreateAsync(
+ new PaymentRequestCreationDto
+ {
+ ProductName = "My product 1",
+ Amount = 99.99m
+ }
+ );
+
+ result.Id.ShouldNotBe(Guid.Empty);
+ result.Amount.ShouldBe(99.99m);
+ result.ProductName.ShouldBe("My product 1");
+ }
+ }
+}
\ No newline at end of file
From ba9000c88c005eb7732462cdd28234da9acfb7c8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Thu, 7 Oct 2021 16:47:08 +0300
Subject: [PATCH 06/75] Added checkout page
---
.../IPaymentRequestAppService.cs | 5 ++-
.../PaymentRequestAppService.cs | 12 +++++--
.../Payment.Web/Pages/Payment/Checkout.cshtml | 34 +++++++++++++++++++
.../Pages/Payment/Checkout.cshtml.cs | 32 +++++++++++++++++
.../Payment.Web/Pages/Payment/Index.cshtml | 17 ----------
.../Payment.Web/Pages/Payment/Index.cshtml.cs | 9 -----
6 files changed, 80 insertions(+), 29 deletions(-)
create mode 100644 modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml
create mode 100644 modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs
delete mode 100644 modules/payment/src/Payment.Web/Pages/Payment/Index.cshtml
delete mode 100644 modules/payment/src/Payment.Web/Pages/Payment/Index.cshtml.cs
diff --git a/modules/payment/src/Payment.Application.Contracts/PaymentRequests/IPaymentRequestAppService.cs b/modules/payment/src/Payment.Application.Contracts/PaymentRequests/IPaymentRequestAppService.cs
index 0467c6d..b2ddaac 100644
--- a/modules/payment/src/Payment.Application.Contracts/PaymentRequests/IPaymentRequestAppService.cs
+++ b/modules/payment/src/Payment.Application.Contracts/PaymentRequests/IPaymentRequestAppService.cs
@@ -1,10 +1,13 @@
-using System.Threading.Tasks;
+using System;
+using System.Threading.Tasks;
using Volo.Abp.Application.Services;
namespace Payment.PaymentRequests
{
public interface IPaymentRequestAppService : IApplicationService
{
+ Task GetAsync(Guid id);
+
Task CreateAsync(PaymentRequestCreationDto input);
}
}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Application/PaymentRequests/PaymentRequestAppService.cs b/modules/payment/src/Payment.Application/PaymentRequests/PaymentRequestAppService.cs
index bfe3504..9f4cc6e 100644
--- a/modules/payment/src/Payment.Application/PaymentRequests/PaymentRequestAppService.cs
+++ b/modules/payment/src/Payment.Application/PaymentRequests/PaymentRequestAppService.cs
@@ -1,4 +1,5 @@
-using System.Threading.Tasks;
+using System;
+using System.Threading.Tasks;
namespace Payment.PaymentRequests
{
@@ -10,7 +11,14 @@ namespace Payment.PaymentRequests
{
_paymentRequestRepository = paymentRequestRepository;
}
-
+
+ public async Task GetAsync(Guid id)
+ {
+ var paymentRequest = await _paymentRequestRepository.GetAsync(id);
+
+ return ObjectMapper.Map(paymentRequest);
+ }
+
public async Task CreateAsync(PaymentRequestCreationDto input)
{
var paymentRequest = new PaymentRequest(
diff --git a/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml b/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml
new file mode 100644
index 0000000..f1f30e4
--- /dev/null
+++ b/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml
@@ -0,0 +1,34 @@
+@page
+@using Microsoft.Extensions.Localization
+@using Payment.Localization
+@using Payment.Web.Pages.Payment
+@model Payment.Web.Pages.Payment.CheckoutPageModel
+@inject IStringLocalizer L
+
+@section scripts {
+
+
+
+}
+
+Checkout
+
+
+
+ Product Information
+
+
+
+ - Product name: @Model.PaymentRequest.ProductName
+ - Amount: @Model.PaymentRequest.Amount
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs b/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs
new file mode 100644
index 0000000..732d2b2
--- /dev/null
+++ b/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Payment.PaymentRequests;
+
+namespace Payment.Web.Pages.Payment
+{
+ public class CheckoutPageModel : PaymentPageModel
+ {
+ [BindProperty(SupportsGet = true)]
+ public Guid PaymentRequestId { get; set; }
+
+ public PaymentRequestDto PaymentRequest { get; set; }
+
+ private readonly IPaymentRequestAppService _paymentRequestAppService;
+
+ public CheckoutPageModel(IPaymentRequestAppService paymentRequestAppService)
+ {
+ _paymentRequestAppService = paymentRequestAppService;
+ }
+
+ public async Task OnGetAsync()
+ {
+ PaymentRequest = await _paymentRequestAppService.GetAsync(PaymentRequestId);
+ }
+
+ public async Task OnPostAsync()
+ {
+ PaymentRequest = await _paymentRequestAppService.GetAsync(PaymentRequestId);
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Web/Pages/Payment/Index.cshtml b/modules/payment/src/Payment.Web/Pages/Payment/Index.cshtml
deleted file mode 100644
index 80d5365..0000000
--- a/modules/payment/src/Payment.Web/Pages/Payment/Index.cshtml
+++ /dev/null
@@ -1,17 +0,0 @@
-@page
-@using Microsoft.Extensions.Localization
-@using Payment.Localization
-@using Payment.Web.Pages.Payment
-@model Payment.Web.Pages.Payment.IndexModel
-@inject IStringLocalizer L
-
-@section scripts {
-
-
-
-}
-
-@{
-}
-Payment
-@L["SamplePageMessage"]
diff --git a/modules/payment/src/Payment.Web/Pages/Payment/Index.cshtml.cs b/modules/payment/src/Payment.Web/Pages/Payment/Index.cshtml.cs
deleted file mode 100644
index d57c76c..0000000
--- a/modules/payment/src/Payment.Web/Pages/Payment/Index.cshtml.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace Payment.Web.Pages.Payment
-{
- public class IndexModel : PaymentPageModel
- {
- public void OnGet()
- {
- }
- }
-}
\ No newline at end of file
From e60fdbbc7ff091d27abce13208ab0851a42dae90 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Fri, 8 Oct 2021 11:46:42 +0300
Subject: [PATCH 07/75] added PaymentBackgroundServicesModule
---
modules/payment/Payment.sln | 7 +++++++
.../Payment.BackgroundServices.csproj | 14 ++++++++++++++
.../PaymentBackgroundServicesModule.cs | 15 +++++++++++++++
.../PaymentRequests/PaymentRequest.cs | 4 +++-
4 files changed, 39 insertions(+), 1 deletion(-)
create mode 100644 modules/payment/src/Payment.BackgroundServices/Payment.BackgroundServices.csproj
create mode 100644 modules/payment/src/Payment.BackgroundServices/PaymentBackgroundServicesModule.cs
diff --git a/modules/payment/Payment.sln b/modules/payment/Payment.sln
index 03efb75..0366988 100644
--- a/modules/payment/Payment.sln
+++ b/modules/payment/Payment.sln
@@ -43,6 +43,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "admin", "admin", "{FC718EF0
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Payment.HttpApi.Client", "src\Payment.HttpApi.Client\Payment.HttpApi.Client.csproj", "{3FF65447-69D5-4115-8398-8156FB381215}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Payment.BackgroundServices", "src\Payment.BackgroundServices\Payment.BackgroundServices.csproj", "{98CAA357-46A3-48EC-B5D9-27C706862351}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -97,6 +99,10 @@ Global
{3FF65447-69D5-4115-8398-8156FB381215}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3FF65447-69D5-4115-8398-8156FB381215}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3FF65447-69D5-4115-8398-8156FB381215}.Release|Any CPU.Build.0 = Release|Any CPU
+ {98CAA357-46A3-48EC-B5D9-27C706862351}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {98CAA357-46A3-48EC-B5D9-27C706862351}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {98CAA357-46A3-48EC-B5D9-27C706862351}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {98CAA357-46A3-48EC-B5D9-27C706862351}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -120,6 +126,7 @@ Global
{90CB5DC4-C040-45C7-8900-9688B26405BC} = {D3FD0217-A8C7-4BAF-BF77-962F1B055515}
{FC718EF0-43EB-4767-9578-95FA0B3727A5} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D}
{3FF65447-69D5-4115-8398-8156FB381215} = {4EF8B98A-E7A3-48A6-9C1F-10DE32001213}
+ {98CAA357-46A3-48EC-B5D9-27C706862351} = {E46CF089-D16A-4761-BE24-1B1B1D49225A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6AAFA1C6-603E-13FA-45E5-7910AA9F661D}
diff --git a/modules/payment/src/Payment.BackgroundServices/Payment.BackgroundServices.csproj b/modules/payment/src/Payment.BackgroundServices/Payment.BackgroundServices.csproj
new file mode 100644
index 0000000..b7c107a
--- /dev/null
+++ b/modules/payment/src/Payment.BackgroundServices/Payment.BackgroundServices.csproj
@@ -0,0 +1,14 @@
+
+
+
+
+
+ netstandard2.0
+ Payment
+
+
+
+
+
+
+
diff --git a/modules/payment/src/Payment.BackgroundServices/PaymentBackgroundServicesModule.cs b/modules/payment/src/Payment.BackgroundServices/PaymentBackgroundServicesModule.cs
new file mode 100644
index 0000000..e64fb55
--- /dev/null
+++ b/modules/payment/src/Payment.BackgroundServices/PaymentBackgroundServicesModule.cs
@@ -0,0 +1,15 @@
+using Volo.Abp.Modularity;
+
+namespace Payment
+{
+ [DependsOn(
+ typeof(PaymentDomainModule)
+ )]
+ public class PaymentBackgroundServicesModule : AbpModule
+ {
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs b/modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs
index 80049b4..648a24e 100644
--- a/modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs
+++ b/modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs
@@ -5,7 +5,7 @@ using Volo.Abp.Domain.Entities.Auditing;
namespace Payment.PaymentRequests
{
- public class PaymentRequest : CreationAuditedAggregateRoot
+ public class PaymentRequest : CreationAuditedAggregateRoot, ISoftDelete
{
[CanBeNull]
public string CustomerId { get; private set; }
@@ -20,6 +20,8 @@ namespace Payment.PaymentRequests
public PaymentRequestState State { get; set; }
+ public bool IsDeleted { get; set; }
+
public PaymentRequest(
Guid id,
[CanBeNull] string customerId,
From 198dd38c5535a34ee77cba4cfe74c7f618469ea2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?=
Date: Fri, 8 Oct 2021 15:54:37 +0300
Subject: [PATCH 08/75] Added private ctor to PaymentRequest
---
.../src/Payment.Domain/PaymentRequests/PaymentRequest.cs | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs b/modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs
index 648a24e..5d47f26 100644
--- a/modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs
+++ b/modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs
@@ -22,6 +22,11 @@ namespace Payment.PaymentRequests
public bool IsDeleted { get; set; }
+ private PaymentRequest()
+ {
+
+ }
+
public PaymentRequest(
Guid id,
[CanBeNull] string customerId,
From 397e1c74644060b0eec05876fba8654b46d56148 Mon Sep 17 00:00:00 2001
From: enisn
Date: Mon, 18 Oct 2021 14:15:50 +0300
Subject: [PATCH 09/75] Remove git files from module
---
modules/payment/src/Payment.Web/PaymentWebModule.cs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/modules/payment/src/Payment.Web/PaymentWebModule.cs b/modules/payment/src/Payment.Web/PaymentWebModule.cs
index 15497f8..2e89082 100644
--- a/modules/payment/src/Payment.Web/PaymentWebModule.cs
+++ b/modules/payment/src/Payment.Web/PaymentWebModule.cs
@@ -9,13 +9,15 @@ using Volo.Abp.Modularity;
using Volo.Abp.UI.Navigation;
using Volo.Abp.VirtualFileSystem;
using Payment.Permissions;
+using Volo.Abp.AspNetCore.Mvc;
namespace Payment.Web
{
[DependsOn(
typeof(PaymentApplicationContractsModule),
typeof(AbpAspNetCoreMvcUiThemeSharedModule),
- typeof(AbpAutoMapperModule)
+ typeof(AbpAutoMapperModule),
+ typeof(AbpAspNetCoreMvcModule)
)]
public class PaymentWebModule : AbpModule
{
From db77b385ac2319926a424953494769018a5d86d4 Mon Sep 17 00:00:00 2001
From: enisn
Date: Mon, 18 Oct 2021 14:15:54 +0300
Subject: [PATCH 10/75] Create README.md
---
modules/payment/README.md | 54 +++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
create mode 100644 modules/payment/README.md
diff --git a/modules/payment/README.md b/modules/payment/README.md
new file mode 100644
index 0000000..2e896ac
--- /dev/null
+++ b/modules/payment/README.md
@@ -0,0 +1,54 @@
+# Payment Module
+
+Payment module provides an API to make payments via using PayPal easily.
+
+
+
+## Installation
+
+TODO
+
+
+
+## Usage
+
+1. Create a Payment Request via using `IPaymentRequestAppService`
+
+
+
+2. Build an URL to redirect to checkout page via using `IPaymentUrlBuilder`
+
+ ```csharp
+ public class MyPageModel : AbpPageModel
+ {
+ protected IPaymentRequestAppService PaymentRequestAppService { get; }
+ protected IPaymentUrlBuilder PaymentUrlBuilder { get; }
+
+ public MyPageModel(
+ IPaymentRequestAppService paymentRequestAppService,
+ IPaymentUrlBuilder paymentUrlBuilder)
+ {
+ PaymentRequestAppService = paymentRequestAppService;
+ PaymentUrlBuilder = paymentUrlBuilder;
+ }
+
+ public async Task OnPostAsync()
+ {
+ var paymentRequest = await PaymentRequestAppService.CreateAsync(new PaymentRequestCreationDto
+ {
+ Amount = 9.90m,
+ CustomerId = CurrentUser.Id.ToString(),
+ ProductId = "UniqueProductId",
+ ProductName = "Awesome Product"
+ });
+
+ var checkoutUrl = PaymentUrlBuilder.BuildCheckoutUrl(paymentRequest.Id).AbsoluteUri;
+
+ Response.Redirect(checkoutUrl);
+ }
+ }
+ ```
+
+
+
+
\ No newline at end of file
From 50dce1d42e6a81d801127d94466d2ba28475cb7e Mon Sep 17 00:00:00 2001
From: enisn
Date: Mon, 18 Oct 2021 14:16:14 +0300
Subject: [PATCH 11/75] Add IPaymentUrlBuilder
---
.../Pages/Payment/Checkout.cshtml.cs | 5 +++++
.../PaymentRequest/IPaymentUrlBuilder.cs | 9 ++++++++
.../PaymentRequest/PaymentUrlBuilder.cs | 22 +++++++++++++++++++
3 files changed, 36 insertions(+)
create mode 100644 modules/payment/src/Payment.Web/PaymentRequest/IPaymentUrlBuilder.cs
create mode 100644 modules/payment/src/Payment.Web/PaymentRequest/PaymentUrlBuilder.cs
diff --git a/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs b/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs
index 732d2b2..9d8385e 100644
--- a/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs
+++ b/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs
@@ -27,6 +27,11 @@ namespace Payment.Web.Pages.Payment
public async Task OnPostAsync()
{
PaymentRequest = await _paymentRequestAppService.GetAsync(PaymentRequestId);
+
+ // TODO: Redirect from here.
+
+
+
}
}
}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Web/PaymentRequest/IPaymentUrlBuilder.cs b/modules/payment/src/Payment.Web/PaymentRequest/IPaymentUrlBuilder.cs
new file mode 100644
index 0000000..b71880e
--- /dev/null
+++ b/modules/payment/src/Payment.Web/PaymentRequest/IPaymentUrlBuilder.cs
@@ -0,0 +1,9 @@
+using System;
+
+namespace Payment.Web.PaymentRequest
+{
+ public interface IPaymentUrlBuilder
+ {
+ Uri BuildCheckoutUrl(Guid paymentRequestId);
+ }
+}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Web/PaymentRequest/PaymentUrlBuilder.cs b/modules/payment/src/Payment.Web/PaymentRequest/PaymentUrlBuilder.cs
new file mode 100644
index 0000000..3398911
--- /dev/null
+++ b/modules/payment/src/Payment.Web/PaymentRequest/PaymentUrlBuilder.cs
@@ -0,0 +1,22 @@
+using Microsoft.Extensions.Options;
+using System;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.UI.Navigation.Urls;
+
+namespace Payment.Web.PaymentRequest
+{
+ public class PaymentUrlBuilder : ITransientDependency, IPaymentUrlBuilder
+ {
+ private readonly AppUrlOptions urlOptions;
+
+ public PaymentUrlBuilder(IOptions urlOptions)
+ {
+ this.urlOptions = urlOptions.Value;
+ }
+
+ public virtual Uri BuildCheckoutUrl(Guid paymentRequestId)
+ {
+ return new Uri(urlOptions.Applications["MVC"].RootUrl.EnsureEndsWith('/') + "Payment/Checkout?paymentRequestId=" + paymentRequestId);
+ }
+ }
+}
From cc9be5dc7b9ad3550d1e01721bf5b93e72ab0d4f Mon Sep 17 00:00:00 2001
From: enisn
Date: Mon, 18 Oct 2021 15:22:46 +0300
Subject: [PATCH 12/75] Creating Payment Checkout scenario
---
.../IPaymentRequestAppService.cs | 2 +-
.../PaymentRequestCreationDto.cs | 17 +++--
.../PaymentRequests/PaymentRequestDto.cs | 12 ++--
.../PaymentRequestAppService.cs | 14 ++--
.../FodyWeavers.xml | 3 +
.../FodyWeavers.xsd | 30 +++++++++
.../src/Payment.Domain/PayPal/PayPalConsts.cs | 18 ++++++
.../Payment.Domain/PayPal/PayPalOptions.cs | 22 +++++++
.../src/Payment.Domain/PaymentDomainModule.cs | 10 ++-
.../src/Payment.Domain/PaymentOptions.cs | 7 ++
.../PaymentRequests/PaymentRequest.cs | 18 ++++--
.../Payment.Web/Pages/Payment/Checkout.cshtml | 6 +-
.../Pages/Payment/Checkout.cshtml.cs | 64 ++++++++++++++++++-
.../Pages/Payment/CheckoutCallback.cshtml | 8 +++
.../Pages/Payment/CheckoutCallback.cshtml.cs | 6 ++
.../src/Payment.Web/Pages/PaymentPageBase.cs | 20 ++++++
.../src/Payment.Web/Payment.Web.csproj | 1 +
.../PaymentRequest/IPaymentUrlBuilder.cs | 2 +
.../PaymentRequest/PaymentUrlBuilder.cs | 5 ++
.../PaymentRequestAppService_Tests.cs | 4 +-
src/EventHub.Web/appsettings.json | 8 +++
21 files changed, 247 insertions(+), 30 deletions(-)
create mode 100644 modules/payment/src/Payment.BackgroundServices/FodyWeavers.xml
create mode 100644 modules/payment/src/Payment.BackgroundServices/FodyWeavers.xsd
create mode 100644 modules/payment/src/Payment.Domain/PayPal/PayPalConsts.cs
create mode 100644 modules/payment/src/Payment.Domain/PayPal/PayPalOptions.cs
create mode 100644 modules/payment/src/Payment.Domain/PaymentOptions.cs
create mode 100644 modules/payment/src/Payment.Web/Pages/Payment/CheckoutCallback.cshtml
create mode 100644 modules/payment/src/Payment.Web/Pages/Payment/CheckoutCallback.cshtml.cs
create mode 100644 modules/payment/src/Payment.Web/Pages/PaymentPageBase.cs
diff --git a/modules/payment/src/Payment.Application.Contracts/PaymentRequests/IPaymentRequestAppService.cs b/modules/payment/src/Payment.Application.Contracts/PaymentRequests/IPaymentRequestAppService.cs
index b2ddaac..85fc4a0 100644
--- a/modules/payment/src/Payment.Application.Contracts/PaymentRequests/IPaymentRequestAppService.cs
+++ b/modules/payment/src/Payment.Application.Contracts/PaymentRequests/IPaymentRequestAppService.cs
@@ -7,7 +7,7 @@ namespace Payment.PaymentRequests
public interface IPaymentRequestAppService : IApplicationService
{
Task GetAsync(Guid id);
-
+
Task CreateAsync(PaymentRequestCreationDto input);
}
}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Application.Contracts/PaymentRequests/PaymentRequestCreationDto.cs b/modules/payment/src/Payment.Application.Contracts/PaymentRequests/PaymentRequestCreationDto.cs
index 78baab2..5f043ff 100644
--- a/modules/payment/src/Payment.Application.Contracts/PaymentRequests/PaymentRequestCreationDto.cs
+++ b/modules/payment/src/Payment.Application.Contracts/PaymentRequests/PaymentRequestCreationDto.cs
@@ -1,3 +1,4 @@
+using JetBrains.Annotations;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.ObjectExtending;
@@ -6,12 +7,20 @@ namespace Payment.PaymentRequests
public class PaymentRequestCreationDto : ExtensibleObject
{
public string CustomerId { get; set; }
-
+
public string ProductId { get; set; }
-
+
[Required]
public string ProductName { get; set; }
-
- public decimal Amount { get; set; }
+
+ public decimal Price { get; set; }
+
+ ///
+ /// 3 Letter Language Code in ISO 4217 Standards.
+ /// For example: USD, EUR.
+ ///
+ [StringLength(3)]
+ [CanBeNull]
+ public string Currency { get; set; }
}
}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Application.Contracts/PaymentRequests/PaymentRequestDto.cs b/modules/payment/src/Payment.Application.Contracts/PaymentRequests/PaymentRequestDto.cs
index 528a6f1..8e453fc 100644
--- a/modules/payment/src/Payment.Application.Contracts/PaymentRequests/PaymentRequestDto.cs
+++ b/modules/payment/src/Payment.Application.Contracts/PaymentRequests/PaymentRequestDto.cs
@@ -6,13 +6,15 @@ namespace Payment.PaymentRequests
public class PaymentRequestDto : CreationAuditedEntityDto
{
public string CustomerId { get; set; }
-
+
public string ProductId { get; set; }
-
+
public string ProductName { get; set; }
-
- public decimal Amount { get; set; }
-
+
+ public decimal Price { get; set; }
+
+ public string Currency { get; set; }
+
public PaymentRequestState State { get; set; }
}
}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Application/PaymentRequests/PaymentRequestAppService.cs b/modules/payment/src/Payment.Application/PaymentRequests/PaymentRequestAppService.cs
index 9f4cc6e..8bf1759 100644
--- a/modules/payment/src/Payment.Application/PaymentRequests/PaymentRequestAppService.cs
+++ b/modules/payment/src/Payment.Application/PaymentRequests/PaymentRequestAppService.cs
@@ -1,4 +1,5 @@
-using System;
+using Microsoft.Extensions.Options;
+using System;
using System.Threading.Tasks;
namespace Payment.PaymentRequests
@@ -6,16 +7,20 @@ namespace Payment.PaymentRequests
public class PaymentRequestAppService : PaymentAppService, IPaymentRequestAppService
{
private readonly IPaymentRequestRepository _paymentRequestRepository;
+ private readonly PaymentOptions _paymentOptions;
- public PaymentRequestAppService(IPaymentRequestRepository paymentRequestRepository)
+ public PaymentRequestAppService(
+ IPaymentRequestRepository paymentRequestRepository,
+ IOptions paymentOptions)
{
_paymentRequestRepository = paymentRequestRepository;
+ _paymentOptions = paymentOptions.Value;
}
public async Task GetAsync(Guid id)
{
var paymentRequest = await _paymentRequestRepository.GetAsync(id);
-
+
return ObjectMapper.Map(paymentRequest);
}
@@ -26,7 +31,8 @@ namespace Payment.PaymentRequests
input.CustomerId,
input.ProductId,
input.ProductName,
- input.Amount
+ input.Price,
+ input.Currency ?? _paymentOptions.DefaultCurrency
);
await _paymentRequestRepository.InsertAsync(paymentRequest);
diff --git a/modules/payment/src/Payment.BackgroundServices/FodyWeavers.xml b/modules/payment/src/Payment.BackgroundServices/FodyWeavers.xml
new file mode 100644
index 0000000..00e1d9a
--- /dev/null
+++ b/modules/payment/src/Payment.BackgroundServices/FodyWeavers.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/modules/payment/src/Payment.BackgroundServices/FodyWeavers.xsd b/modules/payment/src/Payment.BackgroundServices/FodyWeavers.xsd
new file mode 100644
index 0000000..3f3946e
--- /dev/null
+++ b/modules/payment/src/Payment.BackgroundServices/FodyWeavers.xsd
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.
+
+
+
+
+ A comma-separated list of error codes that can be safely ignored in assembly verification.
+
+
+
+
+ 'false' to turn off automatic generation of the XML Schema file.
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Domain/PayPal/PayPalConsts.cs b/modules/payment/src/Payment.Domain/PayPal/PayPalConsts.cs
new file mode 100644
index 0000000..0544336
--- /dev/null
+++ b/modules/payment/src/Payment.Domain/PayPal/PayPalConsts.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Payment.PayPal
+{
+ public static class PayPalConsts
+ {
+ public static class Environment
+ {
+ public const string Sandbox = "Sandbox";
+
+ public const string Live = "Live";
+ }
+ }
+}
diff --git a/modules/payment/src/Payment.Domain/PayPal/PayPalOptions.cs b/modules/payment/src/Payment.Domain/PayPal/PayPalOptions.cs
new file mode 100644
index 0000000..1511ba0
--- /dev/null
+++ b/modules/payment/src/Payment.Domain/PayPal/PayPalOptions.cs
@@ -0,0 +1,22 @@
+using System.Collections.Generic;
+
+namespace Payment.PayPal
+{
+ public class PayPalOptions
+ {
+ public string ClientId { get; set; }
+
+ public string Secret { get; set; }
+
+ public string Locale { get; set; }
+
+ ///
+ /// "Sandbox" or "Live". Default value is "Sandbox"
+ ///
+ public string Environment { get; set; } = PayPalConsts.Environment.Sandbox;
+
+ public bool Recommended { get; set; }
+
+ public List ExtraInfos { get; set; } = new();
+ }
+}
diff --git a/modules/payment/src/Payment.Domain/PaymentDomainModule.cs b/modules/payment/src/Payment.Domain/PaymentDomainModule.cs
index b5a2a41..4b76dba 100644
--- a/modules/payment/src/Payment.Domain/PaymentDomainModule.cs
+++ b/modules/payment/src/Payment.Domain/PaymentDomainModule.cs
@@ -1,4 +1,6 @@
-using Volo.Abp.Domain;
+using Microsoft.Extensions.DependencyInjection;
+using Payment.PayPal;
+using Volo.Abp.Domain;
using Volo.Abp.Modularity;
namespace Payment
@@ -9,6 +11,12 @@ namespace Payment
)]
public class PaymentDomainModule : AbpModule
{
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+ var configuration = context.Services.GetConfiguration();
+ Configure(configuration.GetSection("Payment:PayPal"));
+ Configure(configuration.GetSection("Payment"));
+ }
}
}
diff --git a/modules/payment/src/Payment.Domain/PaymentOptions.cs b/modules/payment/src/Payment.Domain/PaymentOptions.cs
new file mode 100644
index 0000000..bf069b0
--- /dev/null
+++ b/modules/payment/src/Payment.Domain/PaymentOptions.cs
@@ -0,0 +1,7 @@
+namespace Payment
+{
+ public class PaymentOptions
+ {
+ public string DefaultCurrency { get; set; }
+ }
+}
diff --git a/modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs b/modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs
index 5d47f26..dbbcc81 100644
--- a/modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs
+++ b/modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs
@@ -9,14 +9,16 @@ namespace Payment.PaymentRequests
{
[CanBeNull]
public string CustomerId { get; private set; }
-
+
[CanBeNull]
public string ProductId { get; private set; }
-
+
[NotNull]
public string ProductName { get; private set; }
-
- public decimal Amount { get; private set; }
+
+ public decimal Price { get; private set; }
+
+ public string Currency { get; private set; }
public PaymentRequestState State { get; set; }
@@ -24,7 +26,7 @@ namespace Payment.PaymentRequests
private PaymentRequest()
{
-
+
}
public PaymentRequest(
@@ -32,13 +34,15 @@ namespace Payment.PaymentRequests
[CanBeNull] string customerId,
[CanBeNull] string productId,
[NotNull] string productName,
- decimal amount)
+ decimal price,
+ [NotNull] string currency)
: base(id)
{
CustomerId = customerId;
ProductId = productId;
ProductName = Check.NotNullOrWhiteSpace(productName, nameof(productName));
- Amount = amount;
+ Price = price;
+ Currency = currency;
}
}
}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml b/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml
index f1f30e4..2823565 100644
--- a/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml
+++ b/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml
@@ -1,9 +1,7 @@
@page
-@using Microsoft.Extensions.Localization
-@using Payment.Localization
@using Payment.Web.Pages.Payment
+@inherits Payment.Web.Pages.PaymentPageBase
@model Payment.Web.Pages.Payment.CheckoutPageModel
-@inject IStringLocalizer L
@section scripts {
@@ -20,7 +18,7 @@
- Product name: @Model.PaymentRequest.ProductName
- - Amount: @Model.PaymentRequest.Amount
+ - Amount: @Model.PaymentRequest.Price
diff --git a/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs b/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs
index 9d8385e..0468b07 100644
--- a/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs
+++ b/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs
@@ -1,7 +1,14 @@
using System;
+using System.Collections.Generic;
+using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Options;
+using NUglify.Helpers;
using Payment.PaymentRequests;
+using Payment.Web.PaymentRequest;
+using PayPalCheckoutSdk.Core;
+using PayPalCheckoutSdk.Orders;
namespace Payment.Web.Pages.Payment
{
@@ -13,10 +20,17 @@ namespace Payment.Web.Pages.Payment
public PaymentRequestDto PaymentRequest { get; set; }
private readonly IPaymentRequestAppService _paymentRequestAppService;
+ private readonly IPaymentUrlBuilder _paymentUrlBuilder;
+ private readonly PayPalHttpClient _payPalHttpClient;
- public CheckoutPageModel(IPaymentRequestAppService paymentRequestAppService)
+ public CheckoutPageModel(
+ IPaymentRequestAppService paymentRequestAppService,
+ IPaymentUrlBuilder paymentUrlBuilder,
+ PayPalHttpClient payPalHttpClient)
{
_paymentRequestAppService = paymentRequestAppService;
+ this._paymentUrlBuilder = paymentUrlBuilder;
+ this._payPalHttpClient = payPalHttpClient;
}
public async Task OnGetAsync()
@@ -28,10 +42,56 @@ namespace Payment.Web.Pages.Payment
{
PaymentRequest = await _paymentRequestAppService.GetAsync(PaymentRequestId);
- // TODO: Redirect from here.
+ var order = new OrderRequest
+ {
+ CheckoutPaymentIntent = "CAPTURE",
+ ApplicationContext = new ApplicationContext
+ {
+ ReturnUrl = _paymentUrlBuilder.BuildReturnUrl(PaymentRequest.Id).AbsoluteUri,
+ CancelUrl = _paymentUrlBuilder.BuildCheckoutUrl(PaymentRequest.Id).AbsoluteUri,
+ },
+ PurchaseUnits = new List
+ {
+ new PurchaseUnitRequest
+ {
+ AmountWithBreakdown = new AmountWithBreakdown
+ {
+ AmountBreakdown = new AmountBreakdown
+ {
+ ItemTotal = new Money
+ {
+ CurrencyCode = PaymentRequest.Currency,
+ Value = PaymentRequest.Price.ToString(".00")
+ }
+ },
+ CurrencyCode = PaymentRequest.Currency,
+ Value = PaymentRequest.Price.ToString(".00"),
+ },
+ Items = new List-
+ {
+ new Item
+ {
+ Quantity = 1.ToString(),
+ Name = PaymentRequest.ProductName,
+ UnitAmount = new Money
+ {
+ CurrencyCode = PaymentRequest.Currency,
+ Value = PaymentRequest.Price.ToString(".00")
+ }
+ }
+ },
+ ReferenceId = PaymentRequest.Id.ToString()
+ }
+ }
+ };
+ var request = new OrdersCreateRequest();
+ request.Prefer("return=representation");
+ request.RequestBody(order);
+ var result = (await _payPalHttpClient.Execute(request)).Result();
+ Response.Redirect(result.Links.First(x => x.Rel == "approve").Href);
}
}
}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Web/Pages/Payment/CheckoutCallback.cshtml b/modules/payment/src/Payment.Web/Pages/Payment/CheckoutCallback.cshtml
new file mode 100644
index 0000000..cec29af
--- /dev/null
+++ b/modules/payment/src/Payment.Web/Pages/Payment/CheckoutCallback.cshtml
@@ -0,0 +1,8 @@
+@page
+@using Payment.Web.Pages.Payment
+@inherits Payment.Web.Pages.PaymentPageBase
+@model Payment.Web.Pages.Payment.CheckoutCallbackModel
+@{
+ PageLayout.Content.Title = L["Redirecting"];
+}
+
@L["Redirecting"]
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Web/Pages/Payment/CheckoutCallback.cshtml.cs b/modules/payment/src/Payment.Web/Pages/Payment/CheckoutCallback.cshtml.cs
new file mode 100644
index 0000000..a5d2b66
--- /dev/null
+++ b/modules/payment/src/Payment.Web/Pages/Payment/CheckoutCallback.cshtml.cs
@@ -0,0 +1,6 @@
+namespace Payment.Web.Pages.Payment
+{
+ public class CheckoutCallbackModel : PaymentPageModel
+ {
+ }
+}
diff --git a/modules/payment/src/Payment.Web/Pages/PaymentPageBase.cs b/modules/payment/src/Payment.Web/Pages/PaymentPageBase.cs
new file mode 100644
index 0000000..8e2dc9e
--- /dev/null
+++ b/modules/payment/src/Payment.Web/Pages/PaymentPageBase.cs
@@ -0,0 +1,20 @@
+using Microsoft.AspNetCore.Mvc.Razor.Internal;
+using Microsoft.Extensions.Localization;
+using Payment.Localization;
+using System.Threading.Tasks;
+using Volo.Abp.AspNetCore.Mvc.UI.Layout;
+
+namespace Payment.Web.Pages
+{
+ public class PaymentPageBase : Microsoft.AspNetCore.Mvc.RazorPages.Page
+ {
+ [RazorInject] public IStringLocalizer L { get; set; }
+
+ [RazorInject] public IPageLayout PageLayout { get; set; }
+
+ public override Task ExecuteAsync()
+ {
+ return Task.CompletedTask; // Will be overriden by razor pages. (.cshtml)
+ }
+ }
+}
diff --git a/modules/payment/src/Payment.Web/Payment.Web.csproj b/modules/payment/src/Payment.Web/Payment.Web.csproj
index 8989689..e136494 100644
--- a/modules/payment/src/Payment.Web/Payment.Web.csproj
+++ b/modules/payment/src/Payment.Web/Payment.Web.csproj
@@ -12,6 +12,7 @@
+
diff --git a/modules/payment/src/Payment.Web/PaymentRequest/IPaymentUrlBuilder.cs b/modules/payment/src/Payment.Web/PaymentRequest/IPaymentUrlBuilder.cs
index b71880e..31e6649 100644
--- a/modules/payment/src/Payment.Web/PaymentRequest/IPaymentUrlBuilder.cs
+++ b/modules/payment/src/Payment.Web/PaymentRequest/IPaymentUrlBuilder.cs
@@ -5,5 +5,7 @@ namespace Payment.Web.PaymentRequest
public interface IPaymentUrlBuilder
{
Uri BuildCheckoutUrl(Guid paymentRequestId);
+
+ Uri BuildReturnUrl(Guid paymentRequestId);
}
}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Web/PaymentRequest/PaymentUrlBuilder.cs b/modules/payment/src/Payment.Web/PaymentRequest/PaymentUrlBuilder.cs
index 3398911..ebc7e20 100644
--- a/modules/payment/src/Payment.Web/PaymentRequest/PaymentUrlBuilder.cs
+++ b/modules/payment/src/Payment.Web/PaymentRequest/PaymentUrlBuilder.cs
@@ -18,5 +18,10 @@ namespace Payment.Web.PaymentRequest
{
return new Uri(urlOptions.Applications["MVC"].RootUrl.EnsureEndsWith('/') + "Payment/Checkout?paymentRequestId=" + paymentRequestId);
}
+
+ public Uri BuildReturnUrl(Guid paymentRequestId)
+ {
+ return new Uri(urlOptions.Applications["MVC"].RootUrl.EnsureEndsWith('/') + "Payment/CheckoutCallback?paymentRequestId=" + paymentRequestId);
+ }
}
}
diff --git a/modules/payment/test/Payment.Application.Tests/PaymentRequests/PaymentRequestAppService_Tests.cs b/modules/payment/test/Payment.Application.Tests/PaymentRequests/PaymentRequestAppService_Tests.cs
index 0a5bb3e..361716f 100644
--- a/modules/payment/test/Payment.Application.Tests/PaymentRequests/PaymentRequestAppService_Tests.cs
+++ b/modules/payment/test/Payment.Application.Tests/PaymentRequests/PaymentRequestAppService_Tests.cs
@@ -21,12 +21,12 @@ namespace Payment.PaymentRequests
new PaymentRequestCreationDto
{
ProductName = "My product 1",
- Amount = 99.99m
+ Price = 99.99m
}
);
result.Id.ShouldNotBe(Guid.Empty);
- result.Amount.ShouldBe(99.99m);
+ result.Price.ShouldBe(99.99m);
result.ProductName.ShouldBe("My product 1");
}
}
diff --git a/src/EventHub.Web/appsettings.json b/src/EventHub.Web/appsettings.json
index 2c4a520..ad787a5 100644
--- a/src/EventHub.Web/appsettings.json
+++ b/src/EventHub.Web/appsettings.json
@@ -7,5 +7,13 @@
"RequireHttpsMetadata": "true",
"ClientId": "EventHub_Web",
"ClientSecret": "1q2w3e*"
+ },
+ "Payment": {
+ "DefaultCurrency": "USD",
+ "PayPal": {
+ "ClientId": "{ClientId}",
+ "Secret": "{Secret}",
+ "Environment": "Sandbox"
+ }
}
}
From de0d8b20c948ffd22a755306f6b00838edd0038f Mon Sep 17 00:00:00 2001
From: enisn
Date: Mon, 18 Oct 2021 16:50:14 +0300
Subject: [PATCH 13/75] Move entire PayPal logic to Application layer
---
.../IPaymentRequestAppService.cs | 4 +
.../PaymentRequests/StartPaymentDto.cs | 17 ++++
.../PaymentRequests/StartPaymentResultDto.cs | 7 ++
.../Payment.Application.csproj | 3 +
.../PaymentApplicationModule.cs | 16 ++++
.../PaymentRequestAppService.cs | 92 ++++++++++++++++++-
.../Localization/Payment/en.json | 6 +-
.../PayPal/PayPalConsts.cs | 47 ++++++++++
.../src/Payment.Domain/PayPal/PayPalConsts.cs | 18 ----
.../Pages/Payment/Checkout.cshtml.cs | 71 ++------------
.../Pages/Payment/CheckoutCallback.cshtml | 31 ++++++-
.../Pages/Payment/CheckoutCallback.cshtml.cs | 49 +++++++++-
.../src/Payment.Web/Payment.Web.csproj | 1 -
.../src/Payment.Web/PaymentWebOptions.cs | 8 ++
14 files changed, 283 insertions(+), 87 deletions(-)
create mode 100644 modules/payment/src/Payment.Application.Contracts/PaymentRequests/StartPaymentDto.cs
create mode 100644 modules/payment/src/Payment.Application.Contracts/PaymentRequests/StartPaymentResultDto.cs
create mode 100644 modules/payment/src/Payment.Domain.Shared/PayPal/PayPalConsts.cs
delete mode 100644 modules/payment/src/Payment.Domain/PayPal/PayPalConsts.cs
create mode 100644 modules/payment/src/Payment.Web/PaymentWebOptions.cs
diff --git a/modules/payment/src/Payment.Application.Contracts/PaymentRequests/IPaymentRequestAppService.cs b/modules/payment/src/Payment.Application.Contracts/PaymentRequests/IPaymentRequestAppService.cs
index 85fc4a0..4cf5295 100644
--- a/modules/payment/src/Payment.Application.Contracts/PaymentRequests/IPaymentRequestAppService.cs
+++ b/modules/payment/src/Payment.Application.Contracts/PaymentRequests/IPaymentRequestAppService.cs
@@ -9,5 +9,9 @@ namespace Payment.PaymentRequests
Task GetAsync(Guid id);
Task CreateAsync(PaymentRequestCreationDto input);
+
+ Task StartPaymentAsync(StartPaymentDto input);
+
+ Task CompleteAsync(string token);
}
}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Application.Contracts/PaymentRequests/StartPaymentDto.cs b/modules/payment/src/Payment.Application.Contracts/PaymentRequests/StartPaymentDto.cs
new file mode 100644
index 0000000..00b1cc3
--- /dev/null
+++ b/modules/payment/src/Payment.Application.Contracts/PaymentRequests/StartPaymentDto.cs
@@ -0,0 +1,17 @@
+using JetBrains.Annotations;
+using System;
+using System.ComponentModel.DataAnnotations;
+
+namespace Payment.PaymentRequests
+{
+ public class StartPaymentDto
+ {
+ public Guid PaymentRequestId { get; set; }
+
+ [NotNull]
+ [Required]
+ public string ReturnUrl { get; set; }
+
+ public string CancelUrl { get; set; }
+ }
+}
diff --git a/modules/payment/src/Payment.Application.Contracts/PaymentRequests/StartPaymentResultDto.cs b/modules/payment/src/Payment.Application.Contracts/PaymentRequests/StartPaymentResultDto.cs
new file mode 100644
index 0000000..da2be6b
--- /dev/null
+++ b/modules/payment/src/Payment.Application.Contracts/PaymentRequests/StartPaymentResultDto.cs
@@ -0,0 +1,7 @@
+namespace Payment.PaymentRequests
+{
+ public class StartPaymentResultDto
+ {
+ public string CheckoutLink { get; set; }
+ }
+}
diff --git a/modules/payment/src/Payment.Application/Payment.Application.csproj b/modules/payment/src/Payment.Application/Payment.Application.csproj
index dc0b6f5..cef131a 100644
--- a/modules/payment/src/Payment.Application/Payment.Application.csproj
+++ b/modules/payment/src/Payment.Application/Payment.Application.csproj
@@ -14,4 +14,7 @@
+
+
+
diff --git a/modules/payment/src/Payment.Application/PaymentApplicationModule.cs b/modules/payment/src/Payment.Application/PaymentApplicationModule.cs
index 309ee80..b700bc9 100644
--- a/modules/payment/src/Payment.Application/PaymentApplicationModule.cs
+++ b/modules/payment/src/Payment.Application/PaymentApplicationModule.cs
@@ -2,6 +2,10 @@
using Volo.Abp.AutoMapper;
using Volo.Abp.Modularity;
using Volo.Abp.Application;
+using Microsoft.Extensions.Options;
+using Payment.PayPal;
+using System;
+using PayPalCheckoutSdk.Core;
namespace Payment
{
@@ -20,6 +24,18 @@ namespace Payment
{
options.AddMaps(validate: true);
});
+
+ context.Services.AddTransient(provider =>
+ {
+ var options = provider.GetService>().Value;
+
+ if (options.Environment.IsNullOrWhiteSpace() || options.Environment == PayPalConsts.Environment.Sandbox)
+ {
+ return new PayPalHttpClient(new SandboxEnvironment(options.ClientId, options.Secret));
+ }
+
+ return new PayPalHttpClient(new LiveEnvironment(options.ClientId, options.Secret));
+ });
}
}
}
diff --git a/modules/payment/src/Payment.Application/PaymentRequests/PaymentRequestAppService.cs b/modules/payment/src/Payment.Application/PaymentRequests/PaymentRequestAppService.cs
index 8bf1759..bd5de42 100644
--- a/modules/payment/src/Payment.Application/PaymentRequests/PaymentRequestAppService.cs
+++ b/modules/payment/src/Payment.Application/PaymentRequests/PaymentRequestAppService.cs
@@ -1,5 +1,10 @@
using Microsoft.Extensions.Options;
+using Payment.PayPal;
+using PayPalCheckoutSdk.Core;
+using PayPalCheckoutSdk.Orders;
using System;
+using System.Collections.Generic;
+using System.Linq;
using System.Threading.Tasks;
namespace Payment.PaymentRequests
@@ -8,13 +13,16 @@ namespace Payment.PaymentRequests
{
private readonly IPaymentRequestRepository _paymentRequestRepository;
private readonly PaymentOptions _paymentOptions;
+ private readonly PayPalHttpClient _payPalHttpClient;
public PaymentRequestAppService(
IPaymentRequestRepository paymentRequestRepository,
- IOptions paymentOptions)
+ IOptions paymentOptions,
+ PayPalHttpClient payPalHttpClient)
{
_paymentRequestRepository = paymentRequestRepository;
_paymentOptions = paymentOptions.Value;
+ _payPalHttpClient = payPalHttpClient;
}
public async Task GetAsync(Guid id)
@@ -39,5 +47,87 @@ namespace Payment.PaymentRequests
return ObjectMapper.Map(paymentRequest);
}
+
+ public async Task StartPaymentAsync(StartPaymentDto input)
+ {
+ var paymentRequest = await _paymentRequestRepository.GetAsync(input.PaymentRequestId);
+
+ var order = new OrderRequest
+ {
+ CheckoutPaymentIntent = "CAPTURE",
+ ApplicationContext = new ApplicationContext
+ {
+ //ReturnUrl = _paymentUrlBuilder.BuildReturnUrl(PaymentRequest.Id).AbsoluteUri,
+ //CancelUrl = _paymentUrlBuilder.BuildCheckoutUrl(PaymentRequest.Id).AbsoluteUri,
+ ReturnUrl = input.ReturnUrl,
+ CancelUrl = input.CancelUrl,
+ },
+ PurchaseUnits = new List
+ {
+ new PurchaseUnitRequest
+ {
+ AmountWithBreakdown = new AmountWithBreakdown
+ {
+ AmountBreakdown = new AmountBreakdown
+ {
+ ItemTotal = new Money
+ {
+ CurrencyCode = paymentRequest.Currency,
+ Value = paymentRequest.Price.ToString(".00")
+ }
+ },
+ CurrencyCode = paymentRequest.Currency,
+ Value = paymentRequest.Price.ToString(".00"),
+ },
+ Items = new List-
+ {
+ new Item
+ {
+ Quantity = 1.ToString(),
+ Name = paymentRequest.ProductName,
+ UnitAmount = new Money
+ {
+ CurrencyCode = paymentRequest.Currency,
+ Value = paymentRequest.Price.ToString(".00")
+ }
+ }
+ },
+ ReferenceId = paymentRequest.Id.ToString()
+ }
+ }
+ };
+
+ var request = new OrdersCreateRequest();
+ request.Prefer("return=representation");
+ request.RequestBody(order);
+
+ var result = (await _payPalHttpClient.Execute(request)).Result();
+
+ return new StartPaymentResultDto
+ {
+ CheckoutLink = result.Links.First(x => x.Rel == "approve").Href
+ };
+ }
+
+ public async Task CompleteAsync(string token)
+ {
+ var request = new OrdersCaptureRequest(token);
+ request.RequestBody(new OrderActionRequest());
+
+ var order = (await _payPalHttpClient.Execute(request)).Result();
+
+ var paymentRequestId = Guid.Parse(order.PurchaseUnits.First().ReferenceId);
+
+ var paymentRequest = await _paymentRequestRepository.GetAsync(paymentRequestId);
+
+ paymentRequest.State = order.Status == PayPalConsts.OrderStatus.Approved || order.Status == PayPalConsts.OrderStatus.Completed ?
+ PaymentRequestState.Completed : PaymentRequestState.Failed;
+
+ paymentRequest.ExtraProperties.Add(PayPalConsts.OrderIdPropertyName, order.Id);
+
+ await _paymentRequestRepository.UpdateAsync(paymentRequest);
+
+ return ObjectMapper.Map(paymentRequest);
+ }
}
}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Domain.Shared/Localization/Payment/en.json b/modules/payment/src/Payment.Domain.Shared/Localization/Payment/en.json
index 0838f51..5cf8ce3 100644
--- a/modules/payment/src/Payment.Domain.Shared/Localization/Payment/en.json
+++ b/modules/payment/src/Payment.Domain.Shared/Localization/Payment/en.json
@@ -1,7 +1,9 @@
{
"culture": "en",
"texts": {
- "MyAccount": "My account",
- "SamplePageMessage": "A sample page for the Payment module"
+ "MyAccount": "My account",
+ "SamplePageMessage": "A sample page for the Payment module",
+ "YourPaymentCompletedSuccessfully": "Your payment has been completed successfully!",
+ "YourPaymentFailed": "Your payment has been failed unfortunetely!"
}
}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Domain.Shared/PayPal/PayPalConsts.cs b/modules/payment/src/Payment.Domain.Shared/PayPal/PayPalConsts.cs
new file mode 100644
index 0000000..51f4374
--- /dev/null
+++ b/modules/payment/src/Payment.Domain.Shared/PayPal/PayPalConsts.cs
@@ -0,0 +1,47 @@
+namespace Payment.PayPal
+{
+ public static class PayPalConsts
+ {
+ public const string OrderIdPropertyName = "OrderId";
+
+ public static class OrderStatus
+ {
+ ///
+ /// The order was created with the specified context.
+ ///
+ public const string Created = "CREATED";
+
+ ///
+ /// The order was saved and persisted. The order status continues to be in progress until a capture is made with final_capture = true for all purchase units within the order.
+ ///
+ public const string Saved = "SAVED";
+
+ ///
+ /// The customer approved the payment through the PayPal wallet or another form of guest or unbranded payment. For example, a card, bank account, or so on.
+ ///
+ public const string Approved = "APPROVED";
+
+ ///
+ /// All purchase units in the order are voided.
+ ///
+ public const string Voided = "VOIDED";
+
+ ///
+ /// The payment was authorized or the authorized payment was captured for the order.
+ ///
+ public const string Completed = "COMPLETED";
+
+ ///
+ /// The order requires an action from the payer (e.g. 3DS authentication). Redirect the payer to the "rel":"payer-action" HATEOAS link returned as part of the response prior to authorizing or capturing the order.
+ ///
+ public const string PlayerActionRequired = "PAYER_ACTION_REQUIRED";
+ }
+
+ public static class Environment
+ {
+ public const string Sandbox = "Sandbox";
+
+ public const string Live = "Live";
+ }
+ }
+}
diff --git a/modules/payment/src/Payment.Domain/PayPal/PayPalConsts.cs b/modules/payment/src/Payment.Domain/PayPal/PayPalConsts.cs
deleted file mode 100644
index 0544336..0000000
--- a/modules/payment/src/Payment.Domain/PayPal/PayPalConsts.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Payment.PayPal
-{
- public static class PayPalConsts
- {
- public static class Environment
- {
- public const string Sandbox = "Sandbox";
-
- public const string Live = "Live";
- }
- }
-}
diff --git a/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs b/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs
index 0468b07..4f9cb23 100644
--- a/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs
+++ b/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs
@@ -1,14 +1,8 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Options;
-using NUglify.Helpers;
using Payment.PaymentRequests;
using Payment.Web.PaymentRequest;
-using PayPalCheckoutSdk.Core;
-using PayPalCheckoutSdk.Orders;
+using System;
+using System.Threading.Tasks;
namespace Payment.Web.Pages.Payment
{
@@ -21,16 +15,13 @@ namespace Payment.Web.Pages.Payment
private readonly IPaymentRequestAppService _paymentRequestAppService;
private readonly IPaymentUrlBuilder _paymentUrlBuilder;
- private readonly PayPalHttpClient _payPalHttpClient;
public CheckoutPageModel(
IPaymentRequestAppService paymentRequestAppService,
- IPaymentUrlBuilder paymentUrlBuilder,
- PayPalHttpClient payPalHttpClient)
+ IPaymentUrlBuilder paymentUrlBuilder)
{
_paymentRequestAppService = paymentRequestAppService;
this._paymentUrlBuilder = paymentUrlBuilder;
- this._payPalHttpClient = payPalHttpClient;
}
public async Task OnGetAsync()
@@ -40,58 +31,14 @@ namespace Payment.Web.Pages.Payment
public async Task OnPostAsync()
{
- PaymentRequest = await _paymentRequestAppService.GetAsync(PaymentRequestId);
-
- var order = new OrderRequest
+ var result = await _paymentRequestAppService.StartPaymentAsync(new StartPaymentDto
{
- CheckoutPaymentIntent = "CAPTURE",
- ApplicationContext = new ApplicationContext
- {
- ReturnUrl = _paymentUrlBuilder.BuildReturnUrl(PaymentRequest.Id).AbsoluteUri,
- CancelUrl = _paymentUrlBuilder.BuildCheckoutUrl(PaymentRequest.Id).AbsoluteUri,
- },
- PurchaseUnits = new List
- {
- new PurchaseUnitRequest
- {
- AmountWithBreakdown = new AmountWithBreakdown
- {
- AmountBreakdown = new AmountBreakdown
- {
- ItemTotal = new Money
- {
- CurrencyCode = PaymentRequest.Currency,
- Value = PaymentRequest.Price.ToString(".00")
- }
- },
- CurrencyCode = PaymentRequest.Currency,
- Value = PaymentRequest.Price.ToString(".00"),
- },
- Items = new List
-
- {
- new Item
- {
- Quantity = 1.ToString(),
- Name = PaymentRequest.ProductName,
- UnitAmount = new Money
- {
- CurrencyCode = PaymentRequest.Currency,
- Value = PaymentRequest.Price.ToString(".00")
- }
- }
- },
- ReferenceId = PaymentRequest.Id.ToString()
- }
- }
- };
-
- var request = new OrdersCreateRequest();
- request.Prefer("return=representation");
- request.RequestBody(order);
-
- var result = (await _payPalHttpClient.Execute(request)).Result();
+ PaymentRequestId = PaymentRequestId,
+ ReturnUrl = _paymentUrlBuilder.BuildReturnUrl(PaymentRequestId).AbsoluteUri,
+ CancelUrl = _paymentUrlBuilder.BuildCheckoutUrl(PaymentRequestId).AbsoluteUri
+ });
- Response.Redirect(result.Links.First(x => x.Rel == "approve").Href);
+ Response.Redirect(result.CheckoutLink);
}
}
}
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Web/Pages/Payment/CheckoutCallback.cshtml b/modules/payment/src/Payment.Web/Pages/Payment/CheckoutCallback.cshtml
index cec29af..bf85e61 100644
--- a/modules/payment/src/Payment.Web/Pages/Payment/CheckoutCallback.cshtml
+++ b/modules/payment/src/Payment.Web/Pages/Payment/CheckoutCallback.cshtml
@@ -1,8 +1,35 @@
@page
@using Payment.Web.Pages.Payment
+@using Payment.PaymentRequests
@inherits Payment.Web.Pages.PaymentPageBase
@model Payment.Web.Pages.Payment.CheckoutCallbackModel
@{
- PageLayout.Content.Title = L["Redirecting"];
+ PageLayout.Content.Title = L["PaymentResult"] + L["Enum:PaymentRequestState:" + Model.PaymentRequest.State];
}
-
@L["Redirecting"]
\ No newline at end of file
+
+
+
+ @L["PaymentResult"]
+
+
+
+
+ @if (Model.PaymentRequest.State == PaymentRequestState.Completed)
+ {
+
+
+ @L["YourPaymentCompletedSuccessfully"]
+
+ }
+ else
+ {
+
+
+ @L["YourPaymentFailed"]
+
+
+
+ }
+
+
+
\ No newline at end of file
diff --git a/modules/payment/src/Payment.Web/Pages/Payment/CheckoutCallback.cshtml.cs b/modules/payment/src/Payment.Web/Pages/Payment/CheckoutCallback.cshtml.cs
index a5d2b66..0a1315c 100644
--- a/modules/payment/src/Payment.Web/Pages/Payment/CheckoutCallback.cshtml.cs
+++ b/modules/payment/src/Payment.Web/Pages/Payment/CheckoutCallback.cshtml.cs
@@ -1,6 +1,53 @@
-namespace Payment.Web.Pages.Payment
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Options;
+using Payment.PaymentRequests;
+using System;
+using System.Threading.Tasks;
+
+namespace Payment.Web.Pages.Payment
{
public class CheckoutCallbackModel : PaymentPageModel
{
+ [BindProperty(SupportsGet = true)]
+ public string Token { get; set; }
+
+ public PaymentRequestDto PaymentRequest { get; protected set; }
+
+ private readonly IPaymentRequestAppService _paymentRequestAppService;
+ private readonly PaymentWebOptions _paymentWebOptions;
+
+ public CheckoutCallbackModel(
+ IPaymentRequestAppService appService,
+ IOptions paymentWebOptions)
+ {
+ _paymentRequestAppService = appService;
+ _paymentWebOptions = paymentWebOptions.Value;
+ }
+
+ public async Task OnGetAsync()
+ {
+ if (Token.IsNullOrWhiteSpace())
+ {
+ return BadRequest();
+ }
+
+ PaymentRequest = await _paymentRequestAppService.CompleteAsync(Token);
+
+ if (PaymentRequest.State == PaymentRequestState.Completed
+ && !_paymentWebOptions.PaymentSuccessfulCallbackUrl.IsNullOrWhiteSpace())
+ {
+ var callbackUrl = _paymentWebOptions.PaymentSuccessfulCallbackUrl + "?paymentRequestId=" + PaymentRequest.Id;
+ Response.Redirect(callbackUrl);
+ }
+
+ if (PaymentRequest.State == PaymentRequestState.Failed
+ && !_paymentWebOptions.PaymentFailureCallbackUrl.IsNullOrWhiteSpace())
+ {
+ var callbackUrl = _paymentWebOptions.PaymentFailureCallbackUrl + "?paymentRequestId=" + PaymentRequest.Id;
+ Response.Redirect(callbackUrl);
+ }
+
+ return Page();
+ }
}
}
diff --git a/modules/payment/src/Payment.Web/Payment.Web.csproj b/modules/payment/src/Payment.Web/Payment.Web.csproj
index e136494..8989689 100644
--- a/modules/payment/src/Payment.Web/Payment.Web.csproj
+++ b/modules/payment/src/Payment.Web/Payment.Web.csproj
@@ -12,7 +12,6 @@
-
diff --git a/modules/payment/src/Payment.Web/PaymentWebOptions.cs b/modules/payment/src/Payment.Web/PaymentWebOptions.cs
new file mode 100644
index 0000000..4e6017e
--- /dev/null
+++ b/modules/payment/src/Payment.Web/PaymentWebOptions.cs
@@ -0,0 +1,8 @@
+namespace Payment.Web
+{
+ public class PaymentWebOptions
+ {
+ public string PaymentSuccessfulCallbackUrl { get; set; }
+ public string PaymentFailureCallbackUrl { get; set; }
+ }
+}
From 1333306da8008d58e1dcfca335fab3b6a6639b58 Mon Sep 17 00:00:00 2001
From: enisn
Date: Mon, 18 Oct 2021 16:58:15 +0300
Subject: [PATCH 14/75] Create PaymentRequestController.cs
---
.../PaymentRequestController.cs | 47 +++++++++++++++++++
1 file changed, 47 insertions(+)
create mode 100644 modules/payment/src/Payment.HttpApi/PaymentRequests/PaymentRequestController.cs
diff --git a/modules/payment/src/Payment.HttpApi/PaymentRequests/PaymentRequestController.cs b/modules/payment/src/Payment.HttpApi/PaymentRequests/PaymentRequestController.cs
new file mode 100644
index 0000000..ebf45b1
--- /dev/null
+++ b/modules/payment/src/Payment.HttpApi/PaymentRequests/PaymentRequestController.cs
@@ -0,0 +1,47 @@
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Threading.Tasks;
+using Volo.Abp;
+
+namespace Payment.PaymentRequests
+{
+ [RemoteService(Name = PaymentRemoteServiceConsts.RemoteServiceName)]
+ [Area("payment")]
+ [Route("api/payment/requests")]
+ public class PaymentRequestController : PaymentController, IPaymentRequestAppService
+ {
+ protected IPaymentRequestAppService PaymentRequestAppService { get; }
+
+ public PaymentRequestController(IPaymentRequestAppService paymentRequestAppService)
+ {
+ PaymentRequestAppService = paymentRequestAppService;
+ }
+
+ [HttpPost]
+ [Route("complete/{token}")]
+ public Task CompleteAsync([FromRoute] string token)
+ {
+ return PaymentRequestAppService.CompleteAsync(token);
+ }
+
+ [HttpPost]
+ public Task CreateAsync(PaymentRequestCreationDto input)
+ {
+ return PaymentRequestAppService.CreateAsync(input);
+ }
+
+ [HttpGet]
+ [Route("{id}")]
+ public Task GetAsync(Guid id)
+ {
+ return PaymentRequestAppService.GetAsync(id);
+ }
+
+ [HttpPost]
+ [Route("start")]
+ public Task StartPaymentAsync(StartPaymentDto input)
+ {
+ return PaymentRequestAppService.StartPaymentAsync(input);
+ }
+ }
+}
From 3ddd9f57c900ae344f84da4cf7a488c83721ce58 Mon Sep 17 00:00:00 2001
From: enisn
Date: Wed, 20 Oct 2021 12:38:33 +0300
Subject: [PATCH 15/75] Add FailReason to PaymentRequest
---
.../PaymentRequestAppService.cs | 10 +++++--
.../PaymentRequests/PaymentRequest.cs | 26 ++++++++++++++-----
2 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/modules/payment/src/Payment.Application/PaymentRequests/PaymentRequestAppService.cs b/modules/payment/src/Payment.Application/PaymentRequests/PaymentRequestAppService.cs
index bd5de42..08d0cbf 100644
--- a/modules/payment/src/Payment.Application/PaymentRequests/PaymentRequestAppService.cs
+++ b/modules/payment/src/Payment.Application/PaymentRequests/PaymentRequestAppService.cs
@@ -120,8 +120,14 @@ namespace Payment.PaymentRequests
var paymentRequest = await _paymentRequestRepository.GetAsync(paymentRequestId);
- paymentRequest.State = order.Status == PayPalConsts.OrderStatus.Approved || order.Status == PayPalConsts.OrderStatus.Completed ?
- PaymentRequestState.Completed : PaymentRequestState.Failed;
+ if (order.Status == PayPalConsts.OrderStatus.Approved || order.Status == PayPalConsts.OrderStatus.Completed)
+ {
+ paymentRequest.SetAsCompleted();
+ }
+ else
+ {
+ paymentRequest.SetAsFailed(order.Status);
+ }
paymentRequest.ExtraProperties.Add(PayPalConsts.OrderIdPropertyName, order.Id);
diff --git a/modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs b/modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs
index dbbcc81..e8038bf 100644
--- a/modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs
+++ b/modules/payment/src/Payment.Domain/PaymentRequests/PaymentRequest.cs
@@ -8,22 +8,24 @@ namespace Payment.PaymentRequests
public class PaymentRequest : CreationAuditedAggregateRoot, ISoftDelete
{
[CanBeNull]
- public string CustomerId { get; private set; }
+ public string CustomerId { get; protected set; }
[CanBeNull]
- public string ProductId { get; private set; }
+ public string ProductId { get; protected set; }
[NotNull]
- public string ProductName { get; private set; }
+ public string ProductName { get; protected set; }
- public decimal Price { get; private set; }
+ public decimal Price { get; protected set; }
- public string Currency { get; private set; }
+ public string Currency { get; protected set; }
- public PaymentRequestState State { get; set; }
+ public PaymentRequestState State { get; protected set; }
public bool IsDeleted { get; set; }
+ public string FailReason { get; protected set; }
+
private PaymentRequest()
{
@@ -44,5 +46,17 @@ namespace Payment.PaymentRequests
Price = price;
Currency = currency;
}
+
+ public virtual void SetAsCompleted()
+ {
+ State = PaymentRequestState.Completed;
+ FailReason = null;
+ }
+
+ public virtual void SetAsFailed(string failReason)
+ {
+ State = PaymentRequestState.Failed;
+ FailReason = failReason;
+ }
}
}
\ No newline at end of file
From 8d24b99be1e4ae66707d52f5df3df044beef0d0f Mon Sep 17 00:00:00 2001
From: enisn
Date: Wed, 20 Oct 2021 12:39:22 +0300
Subject: [PATCH 16/75] Rename payment pages as PreCheckout & PostCheckout
---
.../Payment/{CheckoutCallback.cshtml => PostCheckout.cshtml} | 2 +-
.../{CheckoutCallback.cshtml.cs => PostCheckout.cshtml.cs} | 4 ++--
.../Pages/Payment/{Checkout.cshtml => PreCheckout.cshtml} | 4 ++--
.../Payment/{Checkout.cshtml.cs => PreCheckout.cshtml.cs} | 4 ++--
4 files changed, 7 insertions(+), 7 deletions(-)
rename modules/payment/src/Payment.Web/Pages/Payment/{CheckoutCallback.cshtml => PostCheckout.cshtml} (92%)
rename modules/payment/src/Payment.Web/Pages/Payment/{CheckoutCallback.cshtml.cs => PostCheckout.cshtml.cs} (94%)
rename modules/payment/src/Payment.Web/Pages/Payment/{Checkout.cshtml => PreCheckout.cshtml} (83%)
rename modules/payment/src/Payment.Web/Pages/Payment/{Checkout.cshtml.cs => PreCheckout.cshtml.cs} (93%)
diff --git a/modules/payment/src/Payment.Web/Pages/Payment/CheckoutCallback.cshtml b/modules/payment/src/Payment.Web/Pages/Payment/PostCheckout.cshtml
similarity index 92%
rename from modules/payment/src/Payment.Web/Pages/Payment/CheckoutCallback.cshtml
rename to modules/payment/src/Payment.Web/Pages/Payment/PostCheckout.cshtml
index bf85e61..213df80 100644
--- a/modules/payment/src/Payment.Web/Pages/Payment/CheckoutCallback.cshtml
+++ b/modules/payment/src/Payment.Web/Pages/Payment/PostCheckout.cshtml
@@ -2,7 +2,7 @@
@using Payment.Web.Pages.Payment
@using Payment.PaymentRequests
@inherits Payment.Web.Pages.PaymentPageBase
-@model Payment.Web.Pages.Payment.CheckoutCallbackModel
+@model Payment.Web.Pages.Payment.PostCheckoutPageModel
@{
PageLayout.Content.Title = L["PaymentResult"] + L["Enum:PaymentRequestState:" + Model.PaymentRequest.State];
}
diff --git a/modules/payment/src/Payment.Web/Pages/Payment/CheckoutCallback.cshtml.cs b/modules/payment/src/Payment.Web/Pages/Payment/PostCheckout.cshtml.cs
similarity index 94%
rename from modules/payment/src/Payment.Web/Pages/Payment/CheckoutCallback.cshtml.cs
rename to modules/payment/src/Payment.Web/Pages/Payment/PostCheckout.cshtml.cs
index 0a1315c..b88eb4b 100644
--- a/modules/payment/src/Payment.Web/Pages/Payment/CheckoutCallback.cshtml.cs
+++ b/modules/payment/src/Payment.Web/Pages/Payment/PostCheckout.cshtml.cs
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Payment.Web.Pages.Payment
{
- public class CheckoutCallbackModel : PaymentPageModel
+ public class PostCheckoutPageModel : PaymentPageModel
{
[BindProperty(SupportsGet = true)]
public string Token { get; set; }
@@ -16,7 +16,7 @@ namespace Payment.Web.Pages.Payment
private readonly IPaymentRequestAppService _paymentRequestAppService;
private readonly PaymentWebOptions _paymentWebOptions;
- public CheckoutCallbackModel(
+ public PostCheckoutPageModel(
IPaymentRequestAppService appService,
IOptions paymentWebOptions)
{
diff --git a/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml b/modules/payment/src/Payment.Web/Pages/Payment/PreCheckout.cshtml
similarity index 83%
rename from modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml
rename to modules/payment/src/Payment.Web/Pages/Payment/PreCheckout.cshtml
index 2823565..38b27e6 100644
--- a/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml
+++ b/modules/payment/src/Payment.Web/Pages/Payment/PreCheckout.cshtml
@@ -1,10 +1,10 @@
@page
@using Payment.Web.Pages.Payment
@inherits Payment.Web.Pages.PaymentPageBase
-@model Payment.Web.Pages.Payment.CheckoutPageModel
+@model Payment.Web.Pages.Payment.PreCheckoutPageModel
@section scripts {
-
+
}
diff --git a/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs b/modules/payment/src/Payment.Web/Pages/Payment/PreCheckout.cshtml.cs
similarity index 93%
rename from modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs
rename to modules/payment/src/Payment.Web/Pages/Payment/PreCheckout.cshtml.cs
index 4f9cb23..57aeeed 100644
--- a/modules/payment/src/Payment.Web/Pages/Payment/Checkout.cshtml.cs
+++ b/modules/payment/src/Payment.Web/Pages/Payment/PreCheckout.cshtml.cs
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace Payment.Web.Pages.Payment
{
- public class CheckoutPageModel : PaymentPageModel
+ public class PreCheckoutPageModel : PaymentPageModel
{
[BindProperty(SupportsGet = true)]
public Guid PaymentRequestId { get; set; }
@@ -16,7 +16,7 @@ namespace Payment.Web.Pages.Payment
private readonly IPaymentRequestAppService _paymentRequestAppService;
private readonly IPaymentUrlBuilder _paymentUrlBuilder;
- public CheckoutPageModel(
+ public PreCheckoutPageModel(
IPaymentRequestAppService paymentRequestAppService,
IPaymentUrlBuilder paymentUrlBuilder)
{
From 5e7bc911f5e6e753912e378b3ba424940597d3dc Mon Sep 17 00:00:00 2001
From: enisn
Date: Wed, 20 Oct 2021 12:39:32 +0300
Subject: [PATCH 17/75] Update PaymentUrlBuilder.cs
---
.../src/Payment.Web/PaymentRequest/PaymentUrlBuilder.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules/payment/src/Payment.Web/PaymentRequest/PaymentUrlBuilder.cs b/modules/payment/src/Payment.Web/PaymentRequest/PaymentUrlBuilder.cs
index ebc7e20..03e797f 100644
--- a/modules/payment/src/Payment.Web/PaymentRequest/PaymentUrlBuilder.cs
+++ b/modules/payment/src/Payment.Web/PaymentRequest/PaymentUrlBuilder.cs
@@ -16,12 +16,12 @@ namespace Payment.Web.PaymentRequest
public virtual Uri BuildCheckoutUrl(Guid paymentRequestId)
{
- return new Uri(urlOptions.Applications["MVC"].RootUrl.EnsureEndsWith('/') + "Payment/Checkout?paymentRequestId=" + paymentRequestId);
+ return new Uri(urlOptions.Applications["MVC"].RootUrl.EnsureEndsWith('/') + "Payment/PreCheckout?paymentRequestId=" + paymentRequestId);
}
public Uri BuildReturnUrl(Guid paymentRequestId)
{
- return new Uri(urlOptions.Applications["MVC"].RootUrl.EnsureEndsWith('/') + "Payment/CheckoutCallback?paymentRequestId=" + paymentRequestId);
+ return new Uri(urlOptions.Applications["MVC"].RootUrl.EnsureEndsWith('/') + "Payment/PostCheckout?paymentRequestId=" + paymentRequestId);
}
}
}
From 0126ef46fc868dd6cdbc36e6e60f6c7e59e6b923 Mon Sep 17 00:00:00 2001
From: enisn
Date: Wed, 20 Oct 2021 12:47:03 +0300
Subject: [PATCH 18/75] Add Payment module to EventHub project
---
.../EventHub.Application.Contracts.csproj | 1 +
.../EventHubApplicationContractsModule.cs | 6 ++++--
src/EventHub.Application/EventHub.Application.csproj | 1 +
src/EventHub.Application/EventHubApplicationModule.cs | 6 ++++--
src/EventHub.Domain.Shared/EventHub.Domain.Shared.csproj | 4 ++++
src/EventHub.Domain.Shared/EventHubDomainSharedModule.cs | 4 +++-
src/EventHub.Domain/EventHub.Domain.csproj | 1 +
src/EventHub.Domain/EventHubDomainModule.cs | 4 +++-
.../EventHubEntityFrameworkCoreModule.cs | 4 +++-
.../EventHub.EntityFrameworkCore.csproj | 5 +++++
.../EventHub.HttpApi.Client.csproj | 1 +
.../EventHubHttpApiClientModule.cs | 4 +++-
src/EventHub.HttpApi.Host/appsettings.json | 8 ++++++++
src/EventHub.HttpApi/EventHub.HttpApi.csproj | 1 +
src/EventHub.HttpApi/EventHubHttpApiModule.cs | 3 ++-
src/EventHub.Web/EventHub.Web.csproj | 1 +
src/EventHub.Web/EventHubWebModule.cs | 4 +++-
src/EventHub.Web/appsettings.json | 8 --------
18 files changed, 48 insertions(+), 18 deletions(-)
diff --git a/src/EventHub.Application.Contracts/EventHub.Application.Contracts.csproj b/src/EventHub.Application.Contracts/EventHub.Application.Contracts.csproj
index a15a062..69cc07f 100644
--- a/src/EventHub.Application.Contracts/EventHub.Application.Contracts.csproj
+++ b/src/EventHub.Application.Contracts/EventHub.Application.Contracts.csproj
@@ -9,6 +9,7 @@
+
diff --git a/src/EventHub.Application.Contracts/EventHubApplicationContractsModule.cs b/src/EventHub.Application.Contracts/EventHubApplicationContractsModule.cs
index e6a02a7..56fc60a 100644
--- a/src/EventHub.Application.Contracts/EventHubApplicationContractsModule.cs
+++ b/src/EventHub.Application.Contracts/EventHubApplicationContractsModule.cs
@@ -1,11 +1,13 @@
-using Volo.Abp.Application;
+using Payment;
+using Volo.Abp.Application;
using Volo.Abp.Modularity;
namespace EventHub
{
[DependsOn(
typeof(EventHubDomainSharedModule),
- typeof(AbpDddApplicationContractsModule)
+ typeof(AbpDddApplicationContractsModule),
+ typeof(PaymentApplicationContractsModule)
)]
public class EventHubApplicationContractsModule : AbpModule
{
diff --git a/src/EventHub.Application/EventHub.Application.csproj b/src/EventHub.Application/EventHub.Application.csproj
index 65385e6..62dc5a8 100644
--- a/src/EventHub.Application/EventHub.Application.csproj
+++ b/src/EventHub.Application/EventHub.Application.csproj
@@ -10,6 +10,7 @@
+
diff --git a/src/EventHub.Application/EventHubApplicationModule.cs b/src/EventHub.Application/EventHubApplicationModule.cs
index 767fdbb..6ffb16d 100644
--- a/src/EventHub.Application/EventHubApplicationModule.cs
+++ b/src/EventHub.Application/EventHubApplicationModule.cs
@@ -1,4 +1,5 @@
-using Volo.Abp.Application;
+using Payment;
+using Volo.Abp.Application;
using Volo.Abp.AutoMapper;
using Volo.Abp.Modularity;
@@ -7,7 +8,8 @@ namespace EventHub
[DependsOn(
typeof(EventHubDomainModule),
typeof(EventHubApplicationContractsModule),
- typeof(AbpDddApplicationModule)
+ typeof(AbpDddApplicationModule),
+ typeof(PaymentApplicationModule)
)]
public class EventHubApplicationModule : AbpModule
{
diff --git a/src/EventHub.Domain.Shared/EventHub.Domain.Shared.csproj b/src/EventHub.Domain.Shared/EventHub.Domain.Shared.csproj
index eed8d21..5da33a0 100644
--- a/src/EventHub.Domain.Shared/EventHub.Domain.Shared.csproj
+++ b/src/EventHub.Domain.Shared/EventHub.Domain.Shared.csproj
@@ -8,6 +8,10 @@
true
+
+
+
+
diff --git a/src/EventHub.Domain.Shared/EventHubDomainSharedModule.cs b/src/EventHub.Domain.Shared/EventHubDomainSharedModule.cs
index efa5dc2..f686ff2 100644
--- a/src/EventHub.Domain.Shared/EventHubDomainSharedModule.cs
+++ b/src/EventHub.Domain.Shared/EventHubDomainSharedModule.cs
@@ -13,6 +13,7 @@ using Volo.Abp.SettingManagement;
using Volo.Abp.Validation.Localization;
using Volo.Abp.VirtualFileSystem;
using Volo.Abp.BlobStoring.Database;
+using Payment;
namespace EventHub
{
@@ -23,7 +24,8 @@ namespace EventHub
typeof(AbpIdentityServerDomainSharedModule),
typeof(AbpPermissionManagementDomainSharedModule),
typeof(AbpSettingManagementDomainSharedModule),
- typeof(BlobStoringDatabaseDomainSharedModule)
+ typeof(BlobStoringDatabaseDomainSharedModule),
+ typeof(PaymentDomainSharedModule)
)]
public class EventHubDomainSharedModule : AbpModule
{
diff --git a/src/EventHub.Domain/EventHub.Domain.csproj b/src/EventHub.Domain/EventHub.Domain.csproj
index 73ea415..b890675 100644
--- a/src/EventHub.Domain/EventHub.Domain.csproj
+++ b/src/EventHub.Domain/EventHub.Domain.csproj
@@ -10,6 +10,7 @@
+
diff --git a/src/EventHub.Domain/EventHubDomainModule.cs b/src/EventHub.Domain/EventHubDomainModule.cs
index 8c17cf5..6e98046 100644
--- a/src/EventHub.Domain/EventHubDomainModule.cs
+++ b/src/EventHub.Domain/EventHubDomainModule.cs
@@ -11,6 +11,7 @@ using Volo.Abp.PermissionManagement.IdentityServer;
using Volo.Abp.SettingManagement;
using Volo.Abp.BlobStoring.Database;
using Volo.Abp.VirtualFileSystem;
+using Payment;
namespace EventHub
{
@@ -24,7 +25,8 @@ namespace EventHub
typeof(AbpPermissionManagementDomainIdentityServerModule),
typeof(AbpSettingManagementDomainModule),
typeof(AbpEmailingModule),
- typeof(BlobStoringDatabaseDomainModule)
+ typeof(BlobStoringDatabaseDomainModule),
+ typeof(PaymentDomainModule)
)]
public class EventHubDomainModule : AbpModule
{
diff --git a/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubEntityFrameworkCoreModule.cs b/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubEntityFrameworkCoreModule.cs
index 5ccfe62..cce1631 100644
--- a/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubEntityFrameworkCoreModule.cs
+++ b/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubEntityFrameworkCoreModule.cs
@@ -10,6 +10,7 @@ using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.BlobStoring.Database.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.PostgreSql;
using System;
+using Payment.EntityFrameworkCore;
namespace EventHub.EntityFrameworkCore
{
@@ -22,7 +23,8 @@ namespace EventHub.EntityFrameworkCore
typeof(AbpEntityFrameworkCorePostgreSqlModule),
typeof(AbpBackgroundJobsEntityFrameworkCoreModule),
typeof(AbpAuditLoggingEntityFrameworkCoreModule),
- typeof(BlobStoringDatabaseEntityFrameworkCoreModule)
+ typeof(BlobStoringDatabaseEntityFrameworkCoreModule),
+ typeof(PaymentEntityFrameworkCoreModule)
)]
public class EventHubEntityFrameworkCoreModule : AbpModule
{
diff --git a/src/EventHub.EntityFrameworkCore/EventHub.EntityFrameworkCore.csproj b/src/EventHub.EntityFrameworkCore/EventHub.EntityFrameworkCore.csproj
index 9e8ea50..b8b4b35 100644
--- a/src/EventHub.EntityFrameworkCore/EventHub.EntityFrameworkCore.csproj
+++ b/src/EventHub.EntityFrameworkCore/EventHub.EntityFrameworkCore.csproj
@@ -7,6 +7,11 @@
EventHub
+
+
+
+
+
diff --git a/src/EventHub.HttpApi.Client/EventHub.HttpApi.Client.csproj b/src/EventHub.HttpApi.Client/EventHub.HttpApi.Client.csproj
index 59df771..7af1285 100644
--- a/src/EventHub.HttpApi.Client/EventHub.HttpApi.Client.csproj
+++ b/src/EventHub.HttpApi.Client/EventHub.HttpApi.Client.csproj
@@ -9,6 +9,7 @@
+
diff --git a/src/EventHub.HttpApi.Client/EventHubHttpApiClientModule.cs b/src/EventHub.HttpApi.Client/EventHubHttpApiClientModule.cs
index f799384..5b3604c 100644
--- a/src/EventHub.HttpApi.Client/EventHubHttpApiClientModule.cs
+++ b/src/EventHub.HttpApi.Client/EventHubHttpApiClientModule.cs
@@ -1,12 +1,14 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Http.Client;
using Volo.Abp.Modularity;
+using Payment;
namespace EventHub
{
[DependsOn(
typeof(EventHubApplicationContractsModule),
- typeof(AbpHttpClientModule)
+ typeof(AbpHttpClientModule),
+ typeof(PaymentHttpApiClientModule)
)]
public class EventHubHttpApiClientModule : AbpModule
{
diff --git a/src/EventHub.HttpApi.Host/appsettings.json b/src/EventHub.HttpApi.Host/appsettings.json
index aca9ac1..1a74ce3 100644
--- a/src/EventHub.HttpApi.Host/appsettings.json
+++ b/src/EventHub.HttpApi.Host/appsettings.json
@@ -10,5 +10,13 @@
"RequireHttpsMetadata": "true",
"SwaggerClientId": "EventHub_Swagger",
"SwaggerClientSecret": "1q2w3e*"
+ },
+ "Payment": {
+ "DefaultCurrency": "USD",
+ "PayPal": {
+ "ClientId": "{ClientId}",
+ "Secret": "{Secret}",
+ "Environment": "Sandbox"
+ }
}
}
diff --git a/src/EventHub.HttpApi/EventHub.HttpApi.csproj b/src/EventHub.HttpApi/EventHub.HttpApi.csproj
index 5b941d6..f38eecb 100644
--- a/src/EventHub.HttpApi/EventHub.HttpApi.csproj
+++ b/src/EventHub.HttpApi/EventHub.HttpApi.csproj
@@ -9,6 +9,7 @@
+
diff --git a/src/EventHub.HttpApi/EventHubHttpApiModule.cs b/src/EventHub.HttpApi/EventHubHttpApiModule.cs
index a137f45..287a993 100644
--- a/src/EventHub.HttpApi/EventHubHttpApiModule.cs
+++ b/src/EventHub.HttpApi/EventHubHttpApiModule.cs
@@ -8,7 +8,8 @@ namespace EventHub
{
[DependsOn(
typeof(EventHubApplicationContractsModule),
- typeof(AbpAspNetCoreMvcModule)
+ typeof(AbpAspNetCoreMvcModule),
+ typeof(EventHubHttpApiModule)
)]
public class EventHubHttpApiModule : AbpModule
{
diff --git a/src/EventHub.Web/EventHub.Web.csproj b/src/EventHub.Web/EventHub.Web.csproj
index fa0ee57..d83e1a4 100644
--- a/src/EventHub.Web/EventHub.Web.csproj
+++ b/src/EventHub.Web/EventHub.Web.csproj
@@ -17,6 +17,7 @@
+
diff --git a/src/EventHub.Web/EventHubWebModule.cs b/src/EventHub.Web/EventHubWebModule.cs
index 5fae0ba..e8e10d2 100644
--- a/src/EventHub.Web/EventHubWebModule.cs
+++ b/src/EventHub.Web/EventHubWebModule.cs
@@ -36,6 +36,7 @@ using Volo.Abp.Swashbuckle;
using Volo.Abp.UI.Navigation.Urls;
using Volo.Abp.UI.Navigation;
using Volo.Abp.VirtualFileSystem;
+using Payment.Web;
namespace EventHub.Web
{
@@ -51,7 +52,8 @@ namespace EventHub.Web
typeof(AbpHttpClientIdentityModelWebModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpSwashbuckleModule),
- typeof(AbpAccountApplicationContractsModule)
+ typeof(AbpAccountApplicationContractsModule),
+ typeof(PaymentWebModule)
)]
public class EventHubWebModule : AbpModule
{
diff --git a/src/EventHub.Web/appsettings.json b/src/EventHub.Web/appsettings.json
index ad787a5..2c4a520 100644
--- a/src/EventHub.Web/appsettings.json
+++ b/src/EventHub.Web/appsettings.json
@@ -7,13 +7,5 @@
"RequireHttpsMetadata": "true",
"ClientId": "EventHub_Web",
"ClientSecret": "1q2w3e*"
- },
- "Payment": {
- "DefaultCurrency": "USD",
- "PayPal": {
- "ClientId": "{ClientId}",
- "Secret": "{Secret}",
- "Environment": "Sandbox"
- }
}
}
From 347070cefea8fdcf4636c138a49d02f5fa6a43eb Mon Sep 17 00:00:00 2001
From: enisn
Date: Wed, 20 Oct 2021 13:09:51 +0300
Subject: [PATCH 19/75] Fix Circular Dependency
---
src/EventHub.HttpApi/EventHubHttpApiModule.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/EventHub.HttpApi/EventHubHttpApiModule.cs b/src/EventHub.HttpApi/EventHubHttpApiModule.cs
index 287a993..03842eb 100644
--- a/src/EventHub.HttpApi/EventHubHttpApiModule.cs
+++ b/src/EventHub.HttpApi/EventHubHttpApiModule.cs
@@ -3,13 +3,14 @@ using EventHub.Localization;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
+using Payment;
namespace EventHub
{
[DependsOn(
typeof(EventHubApplicationContractsModule),
typeof(AbpAspNetCoreMvcModule),
- typeof(EventHubHttpApiModule)
+ typeof(PaymentHttpApiModule)
)]
public class EventHubHttpApiModule : AbpModule
{
From 0ab3ee8bb671fba6c7392964f83b222ed2e36f60 Mon Sep 17 00:00:00 2001
From: enisn
Date: Wed, 20 Oct 2021 13:10:12 +0300
Subject: [PATCH 20/75] Add missing Static Proxies for Payment module
---
.../ClientProxies/Payment-generate-proxy.json | 170 +++++++++++++++---
.../PaymentRequestClientProxy.Generated.cs | 50 ++++++
.../PaymentRequestClientProxy.cs | 8 +
3 files changed, 202 insertions(+), 26 deletions(-)
create mode 100644 modules/payment/src/Payment.HttpApi.Client/ClientProxies/PaymentRequestClientProxy.Generated.cs
create mode 100644 modules/payment/src/Payment.HttpApi.Client/ClientProxies/PaymentRequestClientProxy.cs
diff --git a/modules/payment/src/Payment.HttpApi.Client/ClientProxies/Payment-generate-proxy.json b/modules/payment/src/Payment.HttpApi.Client/ClientProxies/Payment-generate-proxy.json
index 8f9c667..6681ec8 100644
--- a/modules/payment/src/Payment.HttpApi.Client/ClientProxies/Payment-generate-proxy.json
+++ b/modules/payment/src/Payment.HttpApi.Client/ClientProxies/Payment-generate-proxy.json
@@ -1,48 +1,166 @@
{
"modules": {
- "Payment": {
- "rootPath": "Payment",
+ "payment": {
+ "rootPath": "payment",
"remoteServiceName": "Payment",
"controllers": {
- "Payment.Samples.SampleController": {
- "controllerName": "Sample",
- "controllerGroupName": "Sample",
- "type": "Payment.Samples.SampleController",
+ "Payment.PaymentRequests.PaymentRequestController": {
+ "controllerName": "PaymentRequest",
+ "controllerGroupName": "PaymentRequest",
+ "type": "Payment.PaymentRequests.PaymentRequestController",
"interfaces": [
{
- "type": "Payment.Samples.ISampleAppService"
+ "type": "Payment.PaymentRequests.IPaymentRequestAppService"
}
],
"actions": {
- "GetAsync": {
- "uniqueName": "GetAsync",
+ "CompleteAsyncByToken": {
+ "uniqueName": "CompleteAsyncByToken",
+ "name": "CompleteAsync",
+ "httpMethod": "POST",
+ "url": "api/payment/requests/complete/{token}",
+ "supportedVersions": [],
+ "parametersOnMethod": [
+ {
+ "name": "token",
+ "typeAsString": "System.String, System.Private.CoreLib",
+ "type": "System.String",
+ "typeSimple": "string",
+ "isOptional": false,
+ "defaultValue": null
+ }
+ ],
+ "parameters": [
+ {
+ "nameOnMethod": "token",
+ "name": "token",
+ "jsonName": null,
+ "type": "System.String",
+ "typeSimple": "string",
+ "isOptional": false,
+ "defaultValue": null,
+ "constraintTypes": [],
+ "bindingSourceId": "Path",
+ "descriptorName": ""
+ }
+ ],
+ "returnValue": {
+ "type": "Payment.PaymentRequests.PaymentRequestDto",
+ "typeSimple": "Payment.PaymentRequests.PaymentRequestDto"
+ },
+ "allowAnonymous": null,
+ "implementFrom": "Payment.PaymentRequests.IPaymentRequestAppService"
+ },
+ "CreateAsyncByInput": {
+ "uniqueName": "CreateAsyncByInput",
+ "name": "CreateAsync",
+ "httpMethod": "POST",
+ "url": "api/payment/requests",
+ "supportedVersions": [],
+ "parametersOnMethod": [
+ {
+ "name": "input",
+ "typeAsString": "Payment.PaymentRequests.PaymentRequestCreationDto, Payment.Application.Contracts",
+ "type": "Payment.PaymentRequests.PaymentRequestCreationDto",
+ "typeSimple": "Payment.PaymentRequests.PaymentRequestCreationDto",
+ "isOptional": false,
+ "defaultValue": null
+ }
+ ],
+ "parameters": [
+ {
+ "nameOnMethod": "input",
+ "name": "input",
+ "jsonName": null,
+ "type": "Payment.PaymentRequests.PaymentRequestCreationDto",
+ "typeSimple": "Payment.PaymentRequests.PaymentRequestCreationDto",
+ "isOptional": false,
+ "defaultValue": null,
+ "constraintTypes": null,
+ "bindingSourceId": "Body",
+ "descriptorName": ""
+ }
+ ],
+ "returnValue": {
+ "type": "Payment.PaymentRequests.PaymentRequestDto",
+ "typeSimple": "Payment.PaymentRequests.PaymentRequestDto"
+ },
+ "allowAnonymous": null,
+ "implementFrom": "Payment.PaymentRequests.IPaymentRequestAppService"
+ },
+ "GetAsyncById": {
+ "uniqueName": "GetAsyncById",
"name": "GetAsync",
"httpMethod": "GET",
- "url": "api/Payment/sample",
+ "url": "api/payment/requests/{id}",
"supportedVersions": [],
- "parametersOnMethod": [],
- "parameters": [],
+ "parametersOnMethod": [
+ {
+ "name": "id",
+ "typeAsString": "System.Guid, System.Private.CoreLib",
+ "type": "System.Guid",
+ "typeSimple": "string",
+ "isOptional": false,
+ "defaultValue": null
+ }
+ ],
+ "parameters": [
+ {
+ "nameOnMethod": "id",
+ "name": "id",
+ "jsonName": null,
+ "type": "System.Guid",
+ "typeSimple": "string",
+ "isOptional": false,
+ "defaultValue": null,
+ "constraintTypes": [],
+ "bindingSourceId": "Path",
+ "descriptorName": ""
+ }
+ ],
"returnValue": {
- "type": "Payment.Samples.SampleDto",
- "typeSimple": "Payment.Samples.SampleDto"
+ "type": "Payment.PaymentRequests.PaymentRequestDto",
+ "typeSimple": "Payment.PaymentRequests.PaymentRequestDto"
},
"allowAnonymous": null,
- "implementFrom": "Payment.Samples.ISampleAppService"
+ "implementFrom": "Payment.PaymentRequests.IPaymentRequestAppService"
},
- "GetAuthorizedAsync": {
- "uniqueName": "GetAuthorizedAsync",
- "name": "GetAuthorizedAsync",
- "httpMethod": "GET",
- "url": "api/Payment/sample/authorized",
+ "StartPaymentAsyncByInput": {
+ "uniqueName": "StartPaymentAsyncByInput",
+ "name": "StartPaymentAsync",
+ "httpMethod": "POST",
+ "url": "api/payment/requests/start",
"supportedVersions": [],
- "parametersOnMethod": [],
- "parameters": [],
+ "parametersOnMethod": [
+ {
+ "name": "input",
+ "typeAsString": "Payment.PaymentRequests.StartPaymentDto, Payment.Application.Contracts",
+ "type": "Payment.PaymentRequests.StartPaymentDto",
+ "typeSimple": "Payment.PaymentRequests.StartPaymentDto",
+ "isOptional": false,
+ "defaultValue": null
+ }
+ ],
+ "parameters": [
+ {
+ "nameOnMethod": "input",
+ "name": "input",
+ "jsonName": null,
+ "type": "Payment.PaymentRequests.StartPaymentDto",
+ "typeSimple": "Payment.PaymentRequests.StartPaymentDto",
+ "isOptional": false,
+ "defaultValue": null,
+ "constraintTypes": null,
+ "bindingSourceId": "Body",
+ "descriptorName": ""
+ }
+ ],
"returnValue": {
- "type": "Payment.Samples.SampleDto",
- "typeSimple": "Payment.Samples.SampleDto"
+ "type": "Payment.PaymentRequests.StartPaymentResultDto",
+ "typeSimple": "Payment.PaymentRequests.StartPaymentResultDto"
},
- "allowAnonymous": false,
- "implementFrom": "Payment.Samples.ISampleAppService"
+ "allowAnonymous": null,
+ "implementFrom": "Payment.PaymentRequests.IPaymentRequestAppService"
}
}
}
diff --git a/modules/payment/src/Payment.HttpApi.Client/ClientProxies/PaymentRequestClientProxy.Generated.cs b/modules/payment/src/Payment.HttpApi.Client/ClientProxies/PaymentRequestClientProxy.Generated.cs
new file mode 100644
index 0000000..0b336a6
--- /dev/null
+++ b/modules/payment/src/Payment.HttpApi.Client/ClientProxies/PaymentRequestClientProxy.Generated.cs
@@ -0,0 +1,50 @@
+// This file is automatically generated by ABP framework to use MVC Controllers from CSharp
+using System;
+using System.Threading.Tasks;
+using Volo.Abp.Application.Dtos;
+using Volo.Abp.Http.Client;
+using Volo.Abp.Http.Modeling;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Http.Client.ClientProxying;
+using Payment.PaymentRequests;
+
+// ReSharper disable once CheckNamespace
+namespace Payment.PaymentRequests.ClientProxies
+{
+ [Dependency(ReplaceServices = true)]
+ [ExposeServices(typeof(IPaymentRequestAppService), typeof(PaymentRequestClientProxy))]
+ public partial class PaymentRequestClientProxy : ClientProxyBase, IPaymentRequestAppService
+ {
+ public virtual async Task CompleteAsync(string token)
+ {
+ return await RequestAsync(nameof(CompleteAsync), new ClientProxyRequestTypeValue
+ {
+ { typeof(string), token }
+ });
+ }
+
+ public virtual async Task CreateAsync(PaymentRequestCreationDto input)
+ {
+ return await RequestAsync(nameof(CreateAsync), new ClientProxyRequestTypeValue
+ {
+ { typeof(PaymentRequestCreationDto), input }
+ });
+ }
+
+ public virtual async Task GetAsync(Guid id)
+ {
+ return await RequestAsync(nameof(GetAsync), new ClientProxyRequestTypeValue
+ {
+ { typeof(Guid), id }
+ });
+ }
+
+ public virtual async Task StartPaymentAsync(StartPaymentDto input)
+ {
+ return await RequestAsync(nameof(StartPaymentAsync), new ClientProxyRequestTypeValue
+ {
+ { typeof(StartPaymentDto), input }
+ });
+ }
+ }
+}
diff --git a/modules/payment/src/Payment.HttpApi.Client/ClientProxies/PaymentRequestClientProxy.cs b/modules/payment/src/Payment.HttpApi.Client/ClientProxies/PaymentRequestClientProxy.cs
new file mode 100644
index 0000000..6c18a0a
--- /dev/null
+++ b/modules/payment/src/Payment.HttpApi.Client/ClientProxies/PaymentRequestClientProxy.cs
@@ -0,0 +1,8 @@
+// This file is part of PaymentRequestClientProxy, you can customize it here
+// ReSharper disable once CheckNamespace
+namespace Payment.PaymentRequests.ClientProxies
+{
+ public partial class PaymentRequestClientProxy
+ {
+ }
+}
From c2613045775a7f5ec2676a8533c77228039553d8 Mon Sep 17 00:00:00 2001
From: enisn
Date: Wed, 20 Oct 2021 13:24:04 +0300
Subject: [PATCH 21/75] Add a donation sample
---
src/EventHub.Web/Pages/Donate.cshtml | 32 +++++++++++++++++++
src/EventHub.Web/Pages/Donate.cshtml.cs | 42 +++++++++++++++++++++++++
src/EventHub.Web/Pages/Index.cshtml | 1 +
3 files changed, 75 insertions(+)
create mode 100644 src/EventHub.Web/Pages/Donate.cshtml
create mode 100644 src/EventHub.Web/Pages/Donate.cshtml.cs
diff --git a/src/EventHub.Web/Pages/Donate.cshtml b/src/EventHub.Web/Pages/Donate.cshtml
new file mode 100644
index 0000000..efba79d
--- /dev/null
+++ b/src/EventHub.Web/Pages/Donate.cshtml
@@ -0,0 +1,32 @@
+@page
+@using EventHub.Localization
+@using EventHub.Web.Pages
+@using Microsoft.Extensions.Localization
+
+@model DonateModel
+@inject IStringLocalizer L
+
+
+
+
\ No newline at end of file
diff --git a/src/EventHub.Web/Pages/Donate.cshtml.cs b/src/EventHub.Web/Pages/Donate.cshtml.cs
new file mode 100644
index 0000000..0668afd
--- /dev/null
+++ b/src/EventHub.Web/Pages/Donate.cshtml.cs
@@ -0,0 +1,42 @@
+using Microsoft.AspNetCore.Http.Metadata;
+using Microsoft.AspNetCore.Mvc;
+using Payment.PaymentRequests;
+using Payment.Web.PaymentRequest;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Users;
+
+namespace EventHub.Web.Pages
+{
+ public class DonateModel : EventHubPageModel
+ {
+ private readonly IPaymentRequestAppService _paymentRequestAppService;
+ private readonly IPaymentUrlBuilder _paymentUrlBuilder;
+
+ public DonateModel(
+ IPaymentRequestAppService paymentRequestAppService,
+ IPaymentUrlBuilder paymentUrlBuilder)
+ {
+ _paymentRequestAppService = paymentRequestAppService;
+ _paymentUrlBuilder = paymentUrlBuilder;
+ }
+
+ public decimal Amount { get; set; } = 5;
+
+ public async Task OnPostAsync()
+ {
+ var paymentRequest = await _paymentRequestAppService.CreateAsync(new PaymentRequestCreationDto
+ {
+ CustomerId = CurrentUser.IsAuthenticated ? CurrentUser.Id.ToString() : Request.HttpContext.Connection.Id,
+ Price = Amount,
+ ProductId = "eventhub.donation",
+ ProductName = $"EventHub Donation | " + CurrentUser.UserName ?? Request.HttpContext.Connection.Id,
+ });
+
+ return Redirect(_paymentUrlBuilder.BuildCheckoutUrl(paymentRequest.Id).AbsoluteUri);
+ }
+ }
+}
diff --git a/src/EventHub.Web/Pages/Index.cshtml b/src/EventHub.Web/Pages/Index.cshtml
index 881f098..d0b9c48 100644
--- a/src/EventHub.Web/Pages/Index.cshtml
+++ b/src/EventHub.Web/Pages/Index.cshtml
@@ -41,6 +41,7 @@
From 44a7b75a1993f079f867c0c630f626c648acaf5b Mon Sep 17 00:00:00 2001
From: enisn
Date: Wed, 20 Oct 2021 13:50:44 +0300
Subject: [PATCH 22/75] Improvement on Donate sample
---
src/EventHub.Web/Pages/Donate.cshtml.cs | 1 +
src/EventHub.Web/Pages/Index.cshtml | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/EventHub.Web/Pages/Donate.cshtml.cs b/src/EventHub.Web/Pages/Donate.cshtml.cs
index 0668afd..735451a 100644
--- a/src/EventHub.Web/Pages/Donate.cshtml.cs
+++ b/src/EventHub.Web/Pages/Donate.cshtml.cs
@@ -24,6 +24,7 @@ namespace EventHub.Web.Pages
_paymentUrlBuilder = paymentUrlBuilder;
}
+ [BindProperty]
public decimal Amount { get; set; } = 5;
public async Task OnPostAsync()
diff --git a/src/EventHub.Web/Pages/Index.cshtml b/src/EventHub.Web/Pages/Index.cshtml
index d0b9c48..2df64b0 100644
--- a/src/EventHub.Web/Pages/Index.cshtml
+++ b/src/EventHub.Web/Pages/Index.cshtml
@@ -41,7 +41,7 @@
From 17395f0015e5bb8d9abb37d608266f5b4fd43d80 Mon Sep 17 00:00:00 2001
From: enisn
Date: Wed, 20 Oct 2021 15:07:36 +0300
Subject: [PATCH 23/75] Add Payment migrations to EventHub
---
.../EntityFrameworkCore/EventHubDbContext.cs | 2 +
...020111440_Added_Payment_Module.Designer.cs | 2698 +++++++++++++++++
.../20211020111440_Added_Payment_Module.cs | 52 +
.../EventHubDbContextModelSnapshot.cs | 66 +-
4 files changed, 2817 insertions(+), 1 deletion(-)
create mode 100644 src/EventHub.EntityFrameworkCore/Migrations/20211020111440_Added_Payment_Module.Designer.cs
create mode 100644 src/EventHub.EntityFrameworkCore/Migrations/20211020111440_Added_Payment_Module.cs
diff --git a/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubDbContext.cs b/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubDbContext.cs
index 3a86f73..03ffdb0 100644
--- a/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubDbContext.cs
+++ b/src/EventHub.EntityFrameworkCore/EntityFrameworkCore/EventHubDbContext.cs
@@ -4,6 +4,7 @@ using EventHub.Events.Registrations;
using EventHub.Organizations;
using EventHub.Organizations.Memberships;
using Microsoft.EntityFrameworkCore;
+using Payment.EntityFrameworkCore;
using System;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.BackgroundJobs.EntityFrameworkCore;
@@ -70,6 +71,7 @@ namespace EventHub.EntityFrameworkCore
builder.ConfigureBlobStoring();
builder.ConfigureEventHub();
+ builder.ConfigurePayment();
}
}
}
diff --git a/src/EventHub.EntityFrameworkCore/Migrations/20211020111440_Added_Payment_Module.Designer.cs b/src/EventHub.EntityFrameworkCore/Migrations/20211020111440_Added_Payment_Module.Designer.cs
new file mode 100644
index 0000000..9ec70da
--- /dev/null
+++ b/src/EventHub.EntityFrameworkCore/Migrations/20211020111440_Added_Payment_Module.Designer.cs
@@ -0,0 +1,2698 @@
+//
+using System;
+using EventHub.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+using Volo.Abp.EntityFrameworkCore;
+
+#nullable disable
+
+namespace EventHub.Migrations
+{
+ [DbContext(typeof(EventHubDbContext))]
+ [Migration("20211020111440_Added_Payment_Module")]
+ partial class Added_Payment_Module
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.PostgreSql)
+ .HasAnnotation("ProductVersion", "6.0.0-rc.2.21480.5")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("EventHub.Countries.Country", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uuid");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(64)
+ .HasColumnType("character varying(64)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Name");
+
+ b.ToTable("EhCountries", (string)null);
+ });
+
+ modelBuilder.Entity("EventHub.Events.Event", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uuid");
+
+ b.Property("Capacity")
+ .HasColumnType("integer");
+
+ b.Property("City")
+ .HasMaxLength(32)
+ .HasColumnType("character varying(32)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(40)
+ .HasColumnType("character varying(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CountryId")
+ .HasColumnType("uuid");
+
+ b.Property("CountryName")
+ .HasColumnType("text");
+
+ b.Property("CreationTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("uuid")
+ .HasColumnName("CreatorId");
+
+ b.Property("DeleterId")
+ .HasColumnType("uuid")
+ .HasColumnName("DeleterId");
+
+ b.Property("DeletionTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("DeletionTime");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasMaxLength(2000)
+ .HasColumnType("character varying(2000)");
+
+ b.Property("EndTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("text")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("boolean")
+ .HasDefaultValue(false)
+ .HasColumnName("IsDeleted");
+
+ b.Property("IsEmailSentToMembers")
+ .HasColumnType("boolean");
+
+ b.Property("IsOnline")
+ .HasColumnType("boolean");
+
+ b.Property("IsRemindingEmailSent")
+ .HasColumnType("boolean");
+
+ b.Property("IsTimingChangeEmailSent")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("boolean")
+ .HasDefaultValue(true);
+
+ b.Property("Language")
+ .HasMaxLength(16)
+ .HasColumnType("character varying(16)");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("uuid")
+ .HasColumnName("LastModifierId");
+
+ b.Property("OnlineLink")
+ .HasMaxLength(2000)
+ .HasColumnType("character varying(2000)");
+
+ b.Property("OrganizationId")
+ .HasColumnType("uuid");
+
+ b.Property("StartTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("TimingChangeCount")
+ .HasColumnType("integer");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("character varying(128)");
+
+ b.Property("Url")
+ .IsRequired()
+ .HasMaxLength(69)
+ .HasColumnType("character varying(69)");
+
+ b.Property("UrlCode")
+ .IsRequired()
+ .HasMaxLength(8)
+ .HasColumnType("character varying(8)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CountryId");
+
+ b.HasIndex("IsEmailSentToMembers");
+
+ b.HasIndex("StartTime");
+
+ b.HasIndex("UrlCode");
+
+ b.HasIndex("IsRemindingEmailSent", "StartTime");
+
+ b.HasIndex("OrganizationId", "StartTime");
+
+ b.ToTable("EhEvents", (string)null);
+ });
+
+ modelBuilder.Entity("EventHub.Events.Registrations.EventRegistration", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uuid");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(40)
+ .HasColumnType("character varying(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("uuid")
+ .HasColumnName("CreatorId");
+
+ b.Property("EventId")
+ .HasColumnType("uuid");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("text")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.HasIndex("EventId", "UserId");
+
+ b.ToTable("EhEventRegistrations", (string)null);
+ });
+
+ modelBuilder.Entity("EventHub.Organizations.Memberships.OrganizationMembership", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uuid");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(40)
+ .HasColumnType("character varying(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("uuid")
+ .HasColumnName("CreatorId");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("text")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("OrganizationId")
+ .HasColumnType("uuid");
+
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.HasIndex("OrganizationId", "UserId");
+
+ b.ToTable("EhOrganizationMemberships", (string)null);
+ });
+
+ modelBuilder.Entity("EventHub.Organizations.Organization", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uuid");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(40)
+ .HasColumnType("character varying(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("uuid")
+ .HasColumnName("CreatorId");
+
+ b.Property("DeleterId")
+ .HasColumnType("uuid")
+ .HasColumnName("DeleterId");
+
+ b.Property("DeletionTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("DeletionTime");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasMaxLength(1000)
+ .HasColumnType("character varying(1000)");
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("character varying(128)");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("text")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("FacebookUsername")
+ .HasColumnType("text");
+
+ b.Property("GitHubUsername")
+ .HasColumnType("text");
+
+ b.Property("InstagramUsername")
+ .HasColumnType("text");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("boolean")
+ .HasDefaultValue(false)
+ .HasColumnName("IsDeleted");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("uuid")
+ .HasColumnName("LastModifierId");
+
+ b.Property("MediumUsername")
+ .HasColumnType("text");
+
+ b.Property("MemberCount")
+ .HasColumnType("integer");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(32)
+ .HasColumnType("character varying(32)");
+
+ b.Property("OwnerUserId")
+ .HasColumnType("uuid");
+
+ b.Property("TwitterUsername")
+ .HasColumnType("text");
+
+ b.Property("Website")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.HasIndex("DisplayName");
+
+ b.HasIndex("Name");
+
+ b.HasIndex("OwnerUserId");
+
+ b.ToTable("EhOrganizations", (string)null);
+ });
+
+ modelBuilder.Entity("Payment.PaymentRequests.PaymentRequest", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(40)
+ .HasColumnType("character varying(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("uuid")
+ .HasColumnName("CreatorId");
+
+ b.Property("Currency")
+ .HasColumnType("text");
+
+ b.Property("CustomerId")
+ .HasMaxLength(100)
+ .HasColumnType("character varying(100)");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("text")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("FailReason")
+ .HasColumnType("text");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("boolean")
+ .HasDefaultValue(false)
+ .HasColumnName("IsDeleted");
+
+ b.Property("Price")
+ .HasColumnType("numeric");
+
+ b.Property("ProductId")
+ .HasMaxLength(100)
+ .HasColumnType("character varying(100)");
+
+ b.Property("ProductName")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.Property("State")
+ .HasColumnType("smallint");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.HasIndex("State");
+
+ b.ToTable("PayPaymentRequests", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("ApplicationName")
+ .HasMaxLength(96)
+ .HasColumnType("character varying(96)")
+ .HasColumnName("ApplicationName");
+
+ b.Property("BrowserInfo")
+ .HasMaxLength(512)
+ .HasColumnType("character varying(512)")
+ .HasColumnName("BrowserInfo");
+
+ b.Property("ClientId")
+ .HasMaxLength(64)
+ .HasColumnType("character varying(64)")
+ .HasColumnName("ClientId");
+
+ b.Property("ClientIpAddress")
+ .HasMaxLength(64)
+ .HasColumnType("character varying(64)")
+ .HasColumnName("ClientIpAddress");
+
+ b.Property("ClientName")
+ .HasMaxLength(128)
+ .HasColumnType("character varying(128)")
+ .HasColumnName("ClientName");
+
+ b.Property("Comments")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)")
+ .HasColumnName("Comments");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(40)
+ .HasColumnType("character varying(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CorrelationId")
+ .HasMaxLength(64)
+ .HasColumnType("character varying(64)")
+ .HasColumnName("CorrelationId");
+
+ b.Property("Exceptions")
+ .HasColumnType("text");
+
+ b.Property("ExecutionDuration")
+ .HasColumnType("integer")
+ .HasColumnName("ExecutionDuration");
+
+ b.Property("ExecutionTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("text")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("HttpMethod")
+ .HasMaxLength(16)
+ .HasColumnType("character varying(16)")
+ .HasColumnName("HttpMethod");
+
+ b.Property("HttpStatusCode")
+ .HasColumnType("integer")
+ .HasColumnName("HttpStatusCode");
+
+ b.Property("ImpersonatorTenantId")
+ .HasColumnType("uuid")
+ .HasColumnName("ImpersonatorTenantId");
+
+ b.Property("ImpersonatorUserId")
+ .HasColumnType("uuid")
+ .HasColumnName("ImpersonatorUserId");
+
+ b.Property("TenantId")
+ .HasColumnType("uuid")
+ .HasColumnName("TenantId");
+
+ b.Property("TenantName")
+ .HasColumnType("text");
+
+ b.Property("Url")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)")
+ .HasColumnName("Url");
+
+ b.Property("UserId")
+ .HasColumnType("uuid")
+ .HasColumnName("UserId");
+
+ b.Property("UserName")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)")
+ .HasColumnName("UserName");
+
+ b.HasKey("Id");
+
+ b.HasIndex("TenantId", "ExecutionTime");
+
+ b.HasIndex("TenantId", "UserId", "ExecutionTime");
+
+ b.ToTable("AbpAuditLogs", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("AuditLogId")
+ .HasColumnType("uuid")
+ .HasColumnName("AuditLogId");
+
+ b.Property("ExecutionDuration")
+ .HasColumnType("integer")
+ .HasColumnName("ExecutionDuration");
+
+ b.Property("ExecutionTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("ExecutionTime");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("text")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("MethodName")
+ .HasMaxLength(128)
+ .HasColumnType("character varying(128)")
+ .HasColumnName("MethodName");
+
+ b.Property("Parameters")
+ .HasMaxLength(2000)
+ .HasColumnType("character varying(2000)")
+ .HasColumnName("Parameters");
+
+ b.Property("ServiceName")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)")
+ .HasColumnName("ServiceName");
+
+ b.Property("TenantId")
+ .HasColumnType("uuid")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AuditLogId");
+
+ b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime");
+
+ b.ToTable("AbpAuditLogActions", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("AuditLogId")
+ .HasColumnType("uuid")
+ .HasColumnName("AuditLogId");
+
+ b.Property("ChangeTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("ChangeTime");
+
+ b.Property("ChangeType")
+ .HasColumnType("smallint")
+ .HasColumnName("ChangeType");
+
+ b.Property("EntityId")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("character varying(128)")
+ .HasColumnName("EntityId");
+
+ b.Property("EntityTenantId")
+ .HasColumnType("uuid");
+
+ b.Property("EntityTypeFullName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("character varying(128)")
+ .HasColumnName("EntityTypeFullName");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("text")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("TenantId")
+ .HasColumnType("uuid")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AuditLogId");
+
+ b.HasIndex("TenantId", "EntityTypeFullName", "EntityId");
+
+ b.ToTable("AbpEntityChanges", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("EntityChangeId")
+ .HasColumnType("uuid");
+
+ b.Property("NewValue")
+ .HasMaxLength(512)
+ .HasColumnType("character varying(512)")
+ .HasColumnName("NewValue");
+
+ b.Property("OriginalValue")
+ .HasMaxLength(512)
+ .HasColumnType("character varying(512)")
+ .HasColumnName("OriginalValue");
+
+ b.Property("PropertyName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("character varying(128)")
+ .HasColumnName("PropertyName");
+
+ b.Property("PropertyTypeFullName")
+ .IsRequired()
+ .HasMaxLength(64)
+ .HasColumnType("character varying(64)")
+ .HasColumnName("PropertyTypeFullName");
+
+ b.Property("TenantId")
+ .HasColumnType("uuid")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("EntityChangeId");
+
+ b.ToTable("AbpEntityPropertyChanges", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(40)
+ .HasColumnType("character varying(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("CreationTime");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("text")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("IsAbandoned")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("boolean")
+ .HasDefaultValue(false);
+
+ b.Property("JobArgs")
+ .IsRequired()
+ .HasMaxLength(1048576)
+ .HasColumnType("character varying(1048576)");
+
+ b.Property("JobName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("character varying(128)");
+
+ b.Property("LastTryTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("NextTryTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Priority")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("smallint")
+ .HasDefaultValue((byte)15);
+
+ b.Property("TryCount")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("smallint")
+ .HasDefaultValue((short)0);
+
+ b.HasKey("Id");
+
+ b.HasIndex("IsAbandoned", "NextTryTime");
+
+ b.ToTable("AbpBackgroundJobs", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlob", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(40)
+ .HasColumnType("character varying(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("ContainerId")
+ .HasColumnType("uuid");
+
+ b.Property("Content")
+ .HasMaxLength(2147483647)
+ .HasColumnType("bytea");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("text")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("TenantId")
+ .HasColumnType("uuid")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ContainerId");
+
+ b.HasIndex("TenantId", "ContainerId", "Name");
+
+ b.ToTable("AbpBlobs", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.BlobStoring.Database.DatabaseBlobContainer", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(40)
+ .HasColumnType("character varying(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("text")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("character varying(128)");
+
+ b.Property("TenantId")
+ .HasColumnType("uuid")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("TenantId", "Name");
+
+ b.ToTable("AbpBlobContainers", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uuid");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(40)
+ .HasColumnType("character varying(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("Description")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("text")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("IsStatic")
+ .HasColumnType("boolean");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("Regex")
+ .HasMaxLength(512)
+ .HasColumnType("character varying(512)");
+
+ b.Property("RegexDescription")
+ .HasMaxLength(128)
+ .HasColumnType("character varying(128)");
+
+ b.Property("Required")
+ .HasColumnType("boolean");
+
+ b.Property("ValueType")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.ToTable("AbpClaimTypes", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uuid");
+
+ b.Property("SourceTenantId")
+ .HasColumnType("uuid");
+
+ b.Property("SourceUserId")
+ .HasColumnType("uuid");
+
+ b.Property("TargetTenantId")
+ .HasColumnType("uuid");
+
+ b.Property("TargetUserId")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId")
+ .IsUnique();
+
+ b.ToTable("AbpLinkUsers", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uuid");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(40)
+ .HasColumnType("character varying(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("text")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("IsDefault")
+ .HasColumnType("boolean")
+ .HasColumnName("IsDefault");
+
+ b.Property("IsPublic")
+ .HasColumnType("boolean")
+ .HasColumnName("IsPublic");
+
+ b.Property("IsStatic")
+ .HasColumnType("boolean")
+ .HasColumnName("IsStatic");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("NormalizedName")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("TenantId")
+ .HasColumnType("uuid")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedName");
+
+ b.ToTable("AbpRoles", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uuid");
+
+ b.Property("ClaimType")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("ClaimValue")
+ .HasMaxLength(1024)
+ .HasColumnType("character varying(1024)");
+
+ b.Property("RoleId")
+ .HasColumnType("uuid");
+
+ b.Property("TenantId")
+ .HasColumnType("uuid")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AbpRoleClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uuid");
+
+ b.Property("Action")
+ .HasMaxLength(96)
+ .HasColumnType("character varying(96)");
+
+ b.Property("ApplicationName")
+ .HasMaxLength(96)
+ .HasColumnType("character varying(96)");
+
+ b.Property("BrowserInfo")
+ .HasMaxLength(512)
+ .HasColumnType("character varying(512)");
+
+ b.Property("ClientId")
+ .HasMaxLength(64)
+ .HasColumnType("character varying(64)");
+
+ b.Property("ClientIpAddress")
+ .HasMaxLength(64)
+ .HasColumnType("character varying(64)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(40)
+ .HasColumnType("character varying(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CorrelationId")
+ .HasMaxLength(64)
+ .HasColumnType("character varying(64)");
+
+ b.Property("CreationTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("text")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("Identity")
+ .HasMaxLength(96)
+ .HasColumnType("character varying(96)");
+
+ b.Property("TenantId")
+ .HasColumnType("uuid")
+ .HasColumnName("TenantId");
+
+ b.Property("TenantName")
+ .HasMaxLength(64)
+ .HasColumnType("character varying(64)");
+
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.Property("UserName")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("TenantId", "Action");
+
+ b.HasIndex("TenantId", "ApplicationName");
+
+ b.HasIndex("TenantId", "Identity");
+
+ b.HasIndex("TenantId", "UserId");
+
+ b.ToTable("AbpSecurityLogs", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uuid");
+
+ b.Property("AccessFailedCount")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasDefaultValue(0)
+ .HasColumnName("AccessFailedCount");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(40)
+ .HasColumnType("character varying(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("uuid")
+ .HasColumnName("CreatorId");
+
+ b.Property("DeleterId")
+ .HasColumnType("uuid")
+ .HasColumnName("DeleterId");
+
+ b.Property("DeletionTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("DeletionTime");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)")
+ .HasColumnName("Email");
+
+ b.Property("EmailConfirmed")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("boolean")
+ .HasDefaultValue(false)
+ .HasColumnName("EmailConfirmed");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("text")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("IsActive")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("boolean")
+ .HasDefaultValue(false)
+ .HasColumnName("IsDeleted");
+
+ b.Property("IsExternal")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("boolean")
+ .HasDefaultValue(false)
+ .HasColumnName("IsExternal");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("uuid")
+ .HasColumnName("LastModifierId");
+
+ b.Property("LockoutEnabled")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("boolean")
+ .HasDefaultValue(false)
+ .HasColumnName("LockoutEnabled");
+
+ b.Property("LockoutEnd")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Name")
+ .HasMaxLength(64)
+ .HasColumnType("character varying(64)")
+ .HasColumnName("Name");
+
+ b.Property("NormalizedEmail")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)")
+ .HasColumnName("NormalizedEmail");
+
+ b.Property("NormalizedUserName")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)")
+ .HasColumnName("NormalizedUserName");
+
+ b.Property("PasswordHash")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)")
+ .HasColumnName("PasswordHash");
+
+ b.Property("PhoneNumber")
+ .HasMaxLength(16)
+ .HasColumnType("character varying(16)")
+ .HasColumnName("PhoneNumber");
+
+ b.Property("PhoneNumberConfirmed")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("boolean")
+ .HasDefaultValue(false)
+ .HasColumnName("PhoneNumberConfirmed");
+
+ b.Property("SecurityStamp")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)")
+ .HasColumnName("SecurityStamp");
+
+ b.Property("Surname")
+ .HasMaxLength(64)
+ .HasColumnType("character varying(64)")
+ .HasColumnName("Surname");
+
+ b.Property("TenantId")
+ .HasColumnType("uuid")
+ .HasColumnName("TenantId");
+
+ b.Property("TwoFactorEnabled")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("boolean")
+ .HasDefaultValue(false)
+ .HasColumnName("TwoFactorEnabled");
+
+ b.Property("UserName")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)")
+ .HasColumnName("UserName");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Email");
+
+ b.HasIndex("NormalizedEmail");
+
+ b.HasIndex("NormalizedUserName");
+
+ b.HasIndex("UserName");
+
+ b.ToTable("AbpUsers", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uuid");
+
+ b.Property("ClaimType")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("ClaimValue")
+ .HasMaxLength(1024)
+ .HasColumnType("character varying(1024)");
+
+ b.Property("TenantId")
+ .HasColumnType("uuid")
+ .HasColumnName("TenantId");
+
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AbpUserClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.Property("LoginProvider")
+ .HasMaxLength(64)
+ .HasColumnType("character varying(64)");
+
+ b.Property("ProviderDisplayName")
+ .HasMaxLength(128)
+ .HasColumnType("character varying(128)");
+
+ b.Property("ProviderKey")
+ .IsRequired()
+ .HasMaxLength(196)
+ .HasColumnType("character varying(196)");
+
+ b.Property("TenantId")
+ .HasColumnType("uuid")
+ .HasColumnName("TenantId");
+
+ b.HasKey("UserId", "LoginProvider");
+
+ b.HasIndex("LoginProvider", "ProviderKey");
+
+ b.ToTable("AbpUserLogins", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b =>
+ {
+ b.Property("OrganizationUnitId")
+ .HasColumnType("uuid");
+
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.Property("CreationTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("uuid")
+ .HasColumnName("CreatorId");
+
+ b.Property("TenantId")
+ .HasColumnType("uuid")
+ .HasColumnName("TenantId");
+
+ b.HasKey("OrganizationUnitId", "UserId");
+
+ b.HasIndex("UserId", "OrganizationUnitId");
+
+ b.ToTable("AbpUserOrganizationUnits", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.Property("RoleId")
+ .HasColumnType("uuid");
+
+ b.Property("TenantId")
+ .HasColumnType("uuid")
+ .HasColumnName("TenantId");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId", "UserId");
+
+ b.ToTable("AbpUserRoles", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.Property("LoginProvider")
+ .HasMaxLength(64)
+ .HasColumnType("character varying(64)");
+
+ b.Property("Name")
+ .HasMaxLength(128)
+ .HasColumnType("character varying(128)");
+
+ b.Property("TenantId")
+ .HasColumnType("uuid")
+ .HasColumnName("TenantId");
+
+ b.Property("Value")
+ .HasColumnType("text");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AbpUserTokens", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("uuid");
+
+ b.Property("Code")
+ .IsRequired()
+ .HasMaxLength(95)
+ .HasColumnType("character varying(95)")
+ .HasColumnName("Code");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasMaxLength(40)
+ .HasColumnType("character varying(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("uuid")
+ .HasColumnName("CreatorId");
+
+ b.Property("DeleterId")
+ .HasColumnType("uuid")
+ .HasColumnName("DeleterId");
+
+ b.Property("DeletionTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("DeletionTime");
+
+ b.Property