diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/.gitattributes b/modules/EasyAbp.EShop.Payments.WeChatPay/.gitattributes new file mode 100644 index 00000000..c941e526 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/.gitattributes @@ -0,0 +1 @@ +**/wwwroot/libs/** linguist-vendored diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/.gitignore b/modules/EasyAbp.EShop.Payments.WeChatPay/.gitignore new file mode 100644 index 00000000..619e138d --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/.gitignore @@ -0,0 +1,258 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# WeChatPay +host/EasyAbp.EShop.Payments.WeChatPay.IdentityServer/Logs/logs.txt +host/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Host/Logs/logs.txt +host/EasyAbp.EShop.Payments.WeChatPay.Web.Host/Logs/logs.txt +host/EasyAbp.EShop.Payments.WeChatPay.Web.Unified/Logs/logs.txt diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/EasyAbp.EShop.Payments.WeChatPay.sln b/modules/EasyAbp.EShop.Payments.WeChatPay/EasyAbp.EShop.Payments.WeChatPay.sln new file mode 100644 index 00000000..2abcba6b --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/EasyAbp.EShop.Payments.WeChatPay.sln @@ -0,0 +1,167 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.WeChatPay.Domain.Shared", "src\EasyAbp.EShop.Payments.WeChatPay.Domain.Shared\EasyAbp.EShop.Payments.WeChatPay.Domain.Shared.csproj", "{D64C1577-4929-4B60-939E-96DE1534891A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.WeChatPay.Domain", "src\EasyAbp.EShop.Payments.WeChatPay.Domain\EasyAbp.EShop.Payments.WeChatPay.Domain.csproj", "{F2840BC7-0188-4606-9126-DADD0F5ABF7A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.WeChatPay.Application.Contracts", "src\EasyAbp.EShop.Payments.WeChatPay.Application.Contracts\EasyAbp.EShop.Payments.WeChatPay.Application.Contracts.csproj", "{BD65D04F-08D5-40C1-8C24-77CA0BACB877}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.WeChatPay.Application", "src\EasyAbp.EShop.Payments.WeChatPay.Application\EasyAbp.EShop.Payments.WeChatPay.Application.csproj", "{78040F9E-3501-4A40-82DF-00A597710F35}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{649A3FFA-182F-4E56-9717-E6A9A2BEC545}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "host", "host", "{E400416D-2895-4512-9D17-90681EEC7E0A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore", "src\EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore\EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore.csproj", "{0CE86223-D31D-4315-A1F5-87BA3EE1B844}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.WeChatPay.MongoDB", "src\EasyAbp.EShop.Payments.WeChatPay.MongoDB\EasyAbp.EShop.Payments.WeChatPay.MongoDB.csproj", "{F1C58097-4C08-4D88-8976-6B3389391481}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.WeChatPay.HttpApi", "src\EasyAbp.EShop.Payments.WeChatPay.HttpApi\EasyAbp.EShop.Payments.WeChatPay.HttpApi.csproj", "{077AA5F8-8B61-420C-A6B5-0150A66FDB34}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client", "src\EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client\EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.csproj", "{36E2735F-CEAB-44C8-A6D1-2CDAFF399751}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.WeChatPay.TestBase", "test\EasyAbp.EShop.Payments.WeChatPay.TestBase\EasyAbp.EShop.Payments.WeChatPay.TestBase.csproj", "{C5BB573D-3030-4BCB-88B7-F6A85C32766C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore.Tests", "test\EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore.Tests\EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore.Tests.csproj", "{527F645C-C1FC-406E-8479-81386C8ECF13}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.WeChatPay.MongoDB.Tests", "test\EasyAbp.EShop.Payments.WeChatPay.MongoDB.Tests\EasyAbp.EShop.Payments.WeChatPay.MongoDB.Tests.csproj", "{D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.WeChatPay.Domain.Tests", "test\EasyAbp.EShop.Payments.WeChatPay.Domain.Tests\EasyAbp.EShop.Payments.WeChatPay.Domain.Tests.csproj", "{E60895E5-79C4-447D-88B7-85CB5BA336A4}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.WeChatPay.Application.Tests", "test\EasyAbp.EShop.Payments.WeChatPay.Application.Tests\EasyAbp.EShop.Payments.WeChatPay.Application.Tests.csproj", "{90CB5DC4-C040-45C7-8900-9688B26405BC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.WeChatPay.HttpApi.Host", "host\EasyAbp.EShop.Payments.WeChatPay.HttpApi.Host\EasyAbp.EShop.Payments.WeChatPay.HttpApi.Host.csproj", "{37B135B0-DAFE-4616-B25C-1BDF32FC44A2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.WeChatPay.Web", "src\EasyAbp.EShop.Payments.WeChatPay.Web\EasyAbp.EShop.Payments.WeChatPay.Web.csproj", "{3B7B6317-1B85-4164-8E11-75574F80AE17}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp", "test\EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp\EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp.csproj", "{1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.WeChatPay.Web.Host", "host\EasyAbp.EShop.Payments.WeChatPay.Web.Host\EasyAbp.EShop.Payments.WeChatPay.Web.Host.csproj", "{73513786-B6C6-4A21-89C5-0FBDD0A46107}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.WeChatPay.IdentityServer", "host\EasyAbp.EShop.Payments.WeChatPay.IdentityServer\EasyAbp.EShop.Payments.WeChatPay.IdentityServer.csproj", "{690203F4-3CD5-4569-88D9-EE831EEA5F5F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.WeChatPay.Host.Shared", "host\EasyAbp.EShop.Payments.WeChatPay.Host.Shared\EasyAbp.EShop.Payments.WeChatPay.Host.Shared.csproj", "{F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.WeChatPay.Web.Unified", "host\EasyAbp.EShop.Payments.WeChatPay.Web.Unified\EasyAbp.EShop.Payments.WeChatPay.Web.Unified.csproj", "{3D872C41-E226-45C8-89C1-9D3DBD7C73F2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D64C1577-4929-4B60-939E-96DE1534891A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D64C1577-4929-4B60-939E-96DE1534891A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D64C1577-4929-4B60-939E-96DE1534891A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D64C1577-4929-4B60-939E-96DE1534891A}.Release|Any CPU.Build.0 = Release|Any CPU + {F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Release|Any CPU.Build.0 = Release|Any CPU + {BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Release|Any CPU.Build.0 = Release|Any CPU + {78040F9E-3501-4A40-82DF-00A597710F35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {78040F9E-3501-4A40-82DF-00A597710F35}.Debug|Any CPU.Build.0 = Debug|Any CPU + {78040F9E-3501-4A40-82DF-00A597710F35}.Release|Any CPU.ActiveCfg = Release|Any CPU + {78040F9E-3501-4A40-82DF-00A597710F35}.Release|Any CPU.Build.0 = Release|Any CPU + {0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Release|Any CPU.Build.0 = Release|Any CPU + {F1C58097-4C08-4D88-8976-6B3389391481}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F1C58097-4C08-4D88-8976-6B3389391481}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F1C58097-4C08-4D88-8976-6B3389391481}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F1C58097-4C08-4D88-8976-6B3389391481}.Release|Any CPU.Build.0 = Release|Any CPU + {077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Debug|Any CPU.Build.0 = Debug|Any CPU + {077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Release|Any CPU.ActiveCfg = Release|Any CPU + {077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Release|Any CPU.Build.0 = Release|Any CPU + {36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Debug|Any CPU.Build.0 = Debug|Any CPU + {36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Release|Any CPU.ActiveCfg = Release|Any CPU + {36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Release|Any CPU.Build.0 = Release|Any CPU + {C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Release|Any CPU.Build.0 = Release|Any CPU + {527F645C-C1FC-406E-8479-81386C8ECF13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {527F645C-C1FC-406E-8479-81386C8ECF13}.Debug|Any CPU.Build.0 = Debug|Any CPU + {527F645C-C1FC-406E-8479-81386C8ECF13}.Release|Any CPU.ActiveCfg = Release|Any CPU + {527F645C-C1FC-406E-8479-81386C8ECF13}.Release|Any CPU.Build.0 = Release|Any CPU + {D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}.Release|Any CPU.Build.0 = Release|Any CPU + {E60895E5-79C4-447D-88B7-85CB5BA336A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E60895E5-79C4-447D-88B7-85CB5BA336A4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E60895E5-79C4-447D-88B7-85CB5BA336A4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E60895E5-79C4-447D-88B7-85CB5BA336A4}.Release|Any CPU.Build.0 = Release|Any CPU + {90CB5DC4-C040-45C7-8900-9688B26405BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {90CB5DC4-C040-45C7-8900-9688B26405BC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {90CB5DC4-C040-45C7-8900-9688B26405BC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {90CB5DC4-C040-45C7-8900-9688B26405BC}.Release|Any CPU.Build.0 = Release|Any CPU + {37B135B0-DAFE-4616-B25C-1BDF32FC44A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {37B135B0-DAFE-4616-B25C-1BDF32FC44A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {37B135B0-DAFE-4616-B25C-1BDF32FC44A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {37B135B0-DAFE-4616-B25C-1BDF32FC44A2}.Release|Any CPU.Build.0 = Release|Any CPU + {3B7B6317-1B85-4164-8E11-75574F80AE17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {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 + {1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Release|Any CPU.Build.0 = Release|Any CPU + {73513786-B6C6-4A21-89C5-0FBDD0A46107}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {73513786-B6C6-4A21-89C5-0FBDD0A46107}.Debug|Any CPU.Build.0 = Debug|Any CPU + {73513786-B6C6-4A21-89C5-0FBDD0A46107}.Release|Any CPU.ActiveCfg = Release|Any CPU + {73513786-B6C6-4A21-89C5-0FBDD0A46107}.Release|Any CPU.Build.0 = Release|Any CPU + {690203F4-3CD5-4569-88D9-EE831EEA5F5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {690203F4-3CD5-4569-88D9-EE831EEA5F5F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {690203F4-3CD5-4569-88D9-EE831EEA5F5F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {690203F4-3CD5-4569-88D9-EE831EEA5F5F}.Release|Any CPU.Build.0 = Release|Any CPU + {F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}.Release|Any CPU.Build.0 = Release|Any CPU + {3D872C41-E226-45C8-89C1-9D3DBD7C73F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3D872C41-E226-45C8-89C1-9D3DBD7C73F2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3D872C41-E226-45C8-89C1-9D3DBD7C73F2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3D872C41-E226-45C8-89C1-9D3DBD7C73F2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {D64C1577-4929-4B60-939E-96DE1534891A} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {F2840BC7-0188-4606-9126-DADD0F5ABF7A} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {BD65D04F-08D5-40C1-8C24-77CA0BACB877} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {78040F9E-3501-4A40-82DF-00A597710F35} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {0CE86223-D31D-4315-A1F5-87BA3EE1B844} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {F1C58097-4C08-4D88-8976-6B3389391481} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {077AA5F8-8B61-420C-A6B5-0150A66FDB34} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {36E2735F-CEAB-44C8-A6D1-2CDAFF399751} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {C5BB573D-3030-4BCB-88B7-F6A85C32766C} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {527F645C-C1FC-406E-8479-81386C8ECF13} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {E60895E5-79C4-447D-88B7-85CB5BA336A4} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {90CB5DC4-C040-45C7-8900-9688B26405BC} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {37B135B0-DAFE-4616-B25C-1BDF32FC44A2} = {E400416D-2895-4512-9D17-90681EEC7E0A} + {3B7B6317-1B85-4164-8E11-75574F80AE17} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {73513786-B6C6-4A21-89C5-0FBDD0A46107} = {E400416D-2895-4512-9D17-90681EEC7E0A} + {690203F4-3CD5-4569-88D9-EE831EEA5F5F} = {E400416D-2895-4512-9D17-90681EEC7E0A} + {F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB} = {E400416D-2895-4512-9D17-90681EEC7E0A} + {3D872C41-E226-45C8-89C1-9D3DBD7C73F2} = {E400416D-2895-4512-9D17-90681EEC7E0A} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4324B3B4-B60B-4E3C-91D8-59576B4E26DD} + EndGlobalSection +EndGlobal diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/EasyAbp.EShop.Payments.WeChatPay.sln.DotSettings b/modules/EasyAbp.EShop.Payments.WeChatPay/EasyAbp.EShop.Payments.WeChatPay.sln.DotSettings new file mode 100644 index 00000000..cb0b2c91 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/EasyAbp.EShop.Payments.WeChatPay.sln.DotSettings @@ -0,0 +1,23 @@ + + True + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + Required + Required + Required + Required + False + True + False + False + True + False + False + SQL + \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/common.props b/modules/EasyAbp.EShop.Payments.WeChatPay/common.props new file mode 100644 index 00000000..4adb69f0 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/common.props @@ -0,0 +1,12 @@ + + + latest + 0.1.0 + $(NoWarn);CS1591 + + + + + + + \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/docker-compose.migrations.yml b/modules/EasyAbp.EShop.Payments.WeChatPay/docker-compose.migrations.yml new file mode 100644 index 00000000..326317a9 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/docker-compose.migrations.yml @@ -0,0 +1,13 @@ +version: '3.4' + +services: + migrations: + build: + context: ../../ + dockerfile: templates/service/database/Dockerfile + depends_on: + - sqlserver + environment: + - IdentityServer_DB=WeChatPay_Identity + - WeChatPay_DB=WeChatPay_ModuleDb + - SA_PASSWORD=yourStrong(!)Password diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/docker-compose.override.yml b/modules/EasyAbp.EShop.Payments.WeChatPay/docker-compose.override.yml new file mode 100644 index 00000000..85e84d52 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/docker-compose.override.yml @@ -0,0 +1,29 @@ +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=WeChatPay_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - ConnectionStrings__SqlServerCache=Server=sqlserver;Database=WeChatPay_Cache;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + ports: + - "51600:80" + + we-chat-pay: + environment: + - ASPNETCORE_URLS=http://0.0.0.0:80 + - ConnectionStrings__Default=Server=sqlserver;Database=WeChatPay_ModuleDb;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - ConnectionStrings__AbpSettingManagement=Server=sqlserver;Database=WeChatPay_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - ConnectionStrings__AbpPermissionManagement=Server=sqlserver;Database=WeChatPay_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - ConnectionStrings__AbpAuditLogging=Server=sqlserver;Database=WeChatPay_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - ConnectionStrings__SqlServerCache=Server=sqlserver;Database=WeChatPay_Cache;Trusted_Connection=True;MultipleActiveResultSets=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/EasyAbp.EShop.Payments.WeChatPay/docker-compose.yml b/modules/EasyAbp.EShop.Payments.WeChatPay/docker-compose.yml new file mode 100644 index 00000000..f6fdf4db --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/docker-compose.yml @@ -0,0 +1,25 @@ +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 + + we-chat-pay: + build: + context: ../../ + dockerfile: templates/service/host/EasyAbp.EShop.Payments.WeChatPay.Host/Dockerfile + depends_on: + - sqlserver + - identity-server + +volumes: + dbdata: \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application.Contracts/Authorization/WeChatPayPermissionDefinitionProvider.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application.Contracts/Authorization/WeChatPayPermissionDefinitionProvider.cs new file mode 100644 index 00000000..e6d1f5bf --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application.Contracts/Authorization/WeChatPayPermissionDefinitionProvider.cs @@ -0,0 +1,19 @@ +using EasyAbp.EShop.Payments.WeChatPay.Localization; +using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Localization; + +namespace EasyAbp.EShop.Payments.WeChatPay.Authorization +{ + public class WeChatPayPermissionDefinitionProvider : PermissionDefinitionProvider + { + public override void Define(IPermissionDefinitionContext context) + { + //var moduleGroup = context.AddGroup(WeChatPayPermissions.GroupName, L("Permission:WeChatPay")); + } + + private static LocalizableString L(string name) + { + return LocalizableString.Create(name); + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application.Contracts/Authorization/WeChatPayPermissions.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application.Contracts/Authorization/WeChatPayPermissions.cs new file mode 100644 index 00000000..31009273 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application.Contracts/Authorization/WeChatPayPermissions.cs @@ -0,0 +1,14 @@ +using Volo.Abp.Reflection; + +namespace EasyAbp.EShop.Payments.WeChatPay.Authorization +{ + public class WeChatPayPermissions + { + public const string GroupName = "EasyAbp.EShop.Payments.WeChatPay"; + + public static string[] GetAll() + { + return ReflectionHelper.GetPublicConstantsRecursively(typeof(WeChatPayPermissions)); + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application.Contracts/EShopPaymentWeChatPayApplicationContractsModule.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application.Contracts/EShopPaymentWeChatPayApplicationContractsModule.cs new file mode 100644 index 00000000..83446955 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application.Contracts/EShopPaymentWeChatPayApplicationContractsModule.cs @@ -0,0 +1,23 @@ +using Volo.Abp.Application; +using Volo.Abp.Modularity; +using Volo.Abp.VirtualFileSystem; +using Volo.Abp.Authorization; + +namespace EasyAbp.EShop.Payments.WeChatPay +{ + [DependsOn( + typeof(EShopPaymentsWeChatPayDomainSharedModule), + typeof(AbpDddApplicationContractsModule), + typeof(AbpAuthorizationModule) + )] + public class EShopPaymentsWeChatPayApplicationContractsModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.FileSets.AddEmbedded("EasyAbp.EShop.Payments.WeChatPay"); + }); + } + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application.Contracts/EasyAbp.EShop.Payments.WeChatPay.Application.Contracts.csproj b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application.Contracts/EasyAbp.EShop.Payments.WeChatPay.Application.Contracts.csproj new file mode 100644 index 00000000..60ed63e6 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application.Contracts/EasyAbp.EShop.Payments.WeChatPay.Application.Contracts.csproj @@ -0,0 +1,16 @@ + + + + + + netstandard2.0 + EasyAbp.EShop.Payments.WeChatPay + + + + + + + + + diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application/EShopPaymentWeChatPayApplicationModule.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application/EShopPaymentWeChatPayApplicationModule.cs new file mode 100644 index 00000000..367d645f --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application/EShopPaymentWeChatPayApplicationModule.cs @@ -0,0 +1,25 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.AutoMapper; +using Volo.Abp.Modularity; +using Volo.Abp.Application; + +namespace EasyAbp.EShop.Payments.WeChatPay +{ + [DependsOn( + typeof(EShopPaymentsWeChatPayDomainModule), + typeof(EShopPaymentsWeChatPayApplicationContractsModule), + typeof(AbpDddApplicationModule), + typeof(AbpAutoMapperModule) + )] + public class EShopPaymentsWeChatPayApplicationModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddAutoMapperObjectMapper(); + Configure(options => + { + options.AddMaps(validate: true); + }); + } + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application/EasyAbp.EShop.Payments.WeChatPay.Application.csproj b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application/EasyAbp.EShop.Payments.WeChatPay.Application.csproj new file mode 100644 index 00000000..dd3d76e4 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application/EasyAbp.EShop.Payments.WeChatPay.Application.csproj @@ -0,0 +1,17 @@ + + + + + + netstandard2.0 + EasyAbp.EShop.Payments.WeChatPay + + + + + + + + + + diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application/WeChatPayAppService.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application/WeChatPayAppService.cs new file mode 100644 index 00000000..78ed2d1a --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application/WeChatPayAppService.cs @@ -0,0 +1,14 @@ +using EasyAbp.EShop.Payments.WeChatPay.Localization; +using Volo.Abp.Application.Services; + +namespace EasyAbp.EShop.Payments.WeChatPay +{ + public abstract class WeChatPayAppService : ApplicationService + { + protected WeChatPayAppService() + { + LocalizationResource = typeof(WeChatPayResource); + ObjectMapperContext = typeof(EShopPaymentsWeChatPayApplicationModule); + } + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application/WeChatPayApplicationAutoMapperProfile.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application/WeChatPayApplicationAutoMapperProfile.cs new file mode 100644 index 00000000..3c482e57 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Application/WeChatPayApplicationAutoMapperProfile.cs @@ -0,0 +1,14 @@ +using AutoMapper; + +namespace EasyAbp.EShop.Payments.WeChatPay +{ + public class WeChatPayApplicationAutoMapperProfile : Profile + { + public WeChatPayApplicationAutoMapperProfile() + { + /* You can configure your AutoMapper mapping configuration here. + * Alternatively, you can split your mapping configurations + * into multiple profile classes for a better organization. */ + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/EShopPaymentWeChatPayDomainSharedModule.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/EShopPaymentWeChatPayDomainSharedModule.cs new file mode 100644 index 00000000..422d760f --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/EShopPaymentWeChatPayDomainSharedModule.cs @@ -0,0 +1,37 @@ +using Volo.Abp.Modularity; +using Volo.Abp.Localization; +using EasyAbp.EShop.Payments.WeChatPay.Localization; +using Volo.Abp.Localization.ExceptionHandling; +using Volo.Abp.Validation; +using Volo.Abp.Validation.Localization; +using Volo.Abp.VirtualFileSystem; + +namespace EasyAbp.EShop.Payments.WeChatPay +{ + [DependsOn( + typeof(AbpValidationModule) + )] + public class EShopPaymentsWeChatPayDomainSharedModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.FileSets.AddEmbedded("EasyAbp.EShop.Payments.WeChatPay"); + }); + + Configure(options => + { + options.Resources + .Add("en") + .AddBaseTypes(typeof(AbpValidationResource)) + .AddVirtualJson("/Localization/WeChatPay"); + }); + + Configure(options => + { + options.MapCodeNamespace("WeChatPay", typeof(WeChatPayResource)); + }); + } + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared.csproj b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared.csproj new file mode 100644 index 00000000..32770acd --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared.csproj @@ -0,0 +1,19 @@ + + + + + + netstandard2.0 + EasyAbp.EShop.Payments.WeChatPay + + + + + + + + + + + + diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/cs.json b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/cs.json new file mode 100644 index 00000000..6a060a54 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/cs.json @@ -0,0 +1,6 @@ +{ + "culture": "cs", + "texts": { + + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/en.json b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/en.json new file mode 100644 index 00000000..171d9a12 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/en.json @@ -0,0 +1,6 @@ +{ + "culture": "en", + "texts": { + "ManageYourProfile": "Manage your profile" + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/pl.json b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/pl.json new file mode 100644 index 00000000..2ea227cb --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/pl.json @@ -0,0 +1,6 @@ +{ + "culture": "pl", + "texts": { + + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/pt-BR.json b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/pt-BR.json new file mode 100644 index 00000000..6d746df0 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/pt-BR.json @@ -0,0 +1,6 @@ +{ + "culture": "pt-BR", + "texts": { + + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/sl.json b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/sl.json new file mode 100644 index 00000000..687d4257 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/sl.json @@ -0,0 +1,6 @@ +{ + "culture": "sl", + "texts": { + "ManageYourProfile": "Upravljajte svojim profilom" + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/tr.json b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/tr.json new file mode 100644 index 00000000..2b481933 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/tr.json @@ -0,0 +1,6 @@ +{ + "culture": "tr", + "texts": { + "ManageYourProfile": "Profil ynetimi" + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/vi.json b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/vi.json new file mode 100644 index 00000000..d8eb5f3c --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/vi.json @@ -0,0 +1,6 @@ +{ + "culture": "vi", + "texts": { + + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/zh-Hans.json b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/zh-Hans.json new file mode 100644 index 00000000..99586f01 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/zh-Hans.json @@ -0,0 +1,6 @@ +{ + "culture": "zh-Hans", + "texts": { + "ManageYourProfile": "管理个人资料" + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/zh-Hant.json b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/zh-Hant.json new file mode 100644 index 00000000..ceea0555 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPay/zh-Hant.json @@ -0,0 +1,6 @@ +{ + "culture": "zh-Hant", + "texts": { + "ManageYourProfile": "管理個人資料" + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPayResource.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPayResource.cs new file mode 100644 index 00000000..9cf2b8f3 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/Localization/WeChatPayResource.cs @@ -0,0 +1,10 @@ +using Volo.Abp.Localization; + +namespace EasyAbp.EShop.Payments.WeChatPay.Localization +{ + [LocalizationResourceName("EasyAbpEShopPaymentsWeChatPay")] + public class WeChatPayResource + { + + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/WeChatPayErrorCodes.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/WeChatPayErrorCodes.cs new file mode 100644 index 00000000..093f4442 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain.Shared/WeChatPayErrorCodes.cs @@ -0,0 +1,7 @@ +namespace EasyAbp.EShop.Payments.WeChatPay +{ + public static class WeChatPayErrorCodes + { + //Add your business exception error codes here... + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain/EShopPaymentWeChatPayDomainModule.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain/EShopPaymentWeChatPayDomainModule.cs new file mode 100644 index 00000000..42a22459 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain/EShopPaymentWeChatPayDomainModule.cs @@ -0,0 +1,12 @@ +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Payments.WeChatPay +{ + [DependsOn( + typeof(EShopPaymentsWeChatPayDomainSharedModule) + )] + public class EShopPaymentsWeChatPayDomainModule : AbpModule + { + + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain/EasyAbp.EShop.Payments.WeChatPay.Domain.csproj b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain/EasyAbp.EShop.Payments.WeChatPay.Domain.csproj new file mode 100644 index 00000000..e82af427 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain/EasyAbp.EShop.Payments.WeChatPay.Domain.csproj @@ -0,0 +1,16 @@ + + + + + + netstandard2.0 + EasyAbp.EShop.Payments.WeChatPay + + + + + + + + + diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain/Settings/WeChatPaySettingDefinitionProvider.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain/Settings/WeChatPaySettingDefinitionProvider.cs new file mode 100644 index 00000000..c275d2d7 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain/Settings/WeChatPaySettingDefinitionProvider.cs @@ -0,0 +1,14 @@ +using Volo.Abp.Settings; + +namespace EasyAbp.EShop.Payments.WeChatPay.Settings +{ + public class WeChatPaySettingDefinitionProvider : SettingDefinitionProvider + { + public override void Define(ISettingDefinitionContext context) + { + /* Define module settings here. + * Use names from WeChatPaySettings class. + */ + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain/Settings/WeChatPaySettings.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain/Settings/WeChatPaySettings.cs new file mode 100644 index 00000000..4129ceae --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain/Settings/WeChatPaySettings.cs @@ -0,0 +1,11 @@ +namespace EasyAbp.EShop.Payments.WeChatPay.Settings +{ + public static class WeChatPaySettings + { + public const string GroupName = "EasyAbp.EShop.Payments.WeChatPay"; + + /* Add constants for setting names. Example: + * public const string MySettingName = GroupName + ".MySettingName"; + */ + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain/WeChatPayDbProperties.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain/WeChatPayDbProperties.cs new file mode 100644 index 00000000..33dc263a --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Domain/WeChatPayDbProperties.cs @@ -0,0 +1,11 @@ +namespace EasyAbp.EShop.Payments.WeChatPay +{ + public static class WeChatPayDbProperties + { + public static string DbTablePrefix { get; set; } = "WeChatPay"; + + public static string DbSchema { get; set; } = null; + + public const string ConnectionStringName = "WeChatPay"; + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore.csproj b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore.csproj new file mode 100644 index 00000000..3357c8d2 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore.csproj @@ -0,0 +1,15 @@ + + + + + + netstandard2.0 + EasyAbp.EShop.Payments.WeChatPay + + + + + + + + diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore/EntityFrameworkCore/EShopPaymentWeChatPayEntityFrameworkCoreModule.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore/EntityFrameworkCore/EShopPaymentWeChatPayEntityFrameworkCoreModule.cs new file mode 100644 index 00000000..16f1560e --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore/EntityFrameworkCore/EShopPaymentWeChatPayEntityFrameworkCoreModule.cs @@ -0,0 +1,23 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore +{ + [DependsOn( + typeof(EShopPaymentsWeChatPayDomainModule), + typeof(AbpEntityFrameworkCoreModule) + )] + public class EShopPaymentsWeChatPayEntityFrameworkCoreModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddAbpDbContext(options => + { + /* Add custom repositories here. Example: + * options.AddRepository(); + */ + }); + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore/EntityFrameworkCore/IWeChatPayDbContext.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore/EntityFrameworkCore/IWeChatPayDbContext.cs new file mode 100644 index 00000000..45fb3313 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore/EntityFrameworkCore/IWeChatPayDbContext.cs @@ -0,0 +1,13 @@ +using Volo.Abp.Data; +using Volo.Abp.EntityFrameworkCore; + +namespace EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore +{ + [ConnectionStringName(WeChatPayDbProperties.ConnectionStringName)] + public interface IWeChatPayDbContext : IEfCoreDbContext + { + /* Add DbSet for each Aggregate Root here. Example: + * DbSet Questions { get; } + */ + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore/EntityFrameworkCore/WeChatPayDbContext.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore/EntityFrameworkCore/WeChatPayDbContext.cs new file mode 100644 index 00000000..2b78b7fd --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore/EntityFrameworkCore/WeChatPayDbContext.cs @@ -0,0 +1,27 @@ +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Data; +using Volo.Abp.EntityFrameworkCore; + +namespace EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore +{ + [ConnectionStringName(WeChatPayDbProperties.ConnectionStringName)] + public class WeChatPayDbContext : AbpDbContext, IWeChatPayDbContext + { + /* Add DbSet for each Aggregate Root here. Example: + * public DbSet Questions { get; set; } + */ + + public WeChatPayDbContext(DbContextOptions options) + : base(options) + { + + } + + protected override void OnModelCreating(ModelBuilder builder) + { + base.OnModelCreating(builder); + + builder.ConfigureWeChatPay(); + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore/EntityFrameworkCore/WeChatPayDbContextModelCreatingExtensions.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore/EntityFrameworkCore/WeChatPayDbContextModelCreatingExtensions.cs new file mode 100644 index 00000000..5fd4f3ec --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore/EntityFrameworkCore/WeChatPayDbContextModelCreatingExtensions.cs @@ -0,0 +1,43 @@ +using System; +using Microsoft.EntityFrameworkCore; +using Volo.Abp; + +namespace EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore +{ + public static class WeChatPayDbContextModelCreatingExtensions + { + public static void ConfigureWeChatPay( + this ModelBuilder builder, + Action optionsAction = null) + { + Check.NotNull(builder, nameof(builder)); + + var options = new WeChatPayModelBuilderConfigurationOptions( + WeChatPayDbProperties.DbTablePrefix, + WeChatPayDbProperties.DbSchema + ); + + optionsAction?.Invoke(options); + + /* Configure all entities here. Example: + + builder.Entity(b => + { + //Configure table & schema name + b.ToTable(options.TablePrefix + "Questions", options.Schema); + + b.ConfigureByConvention(); + + //Properties + b.Property(q => q.Title).IsRequired().HasMaxLength(QuestionConsts.MaxTitleLength); + + //Relations + b.HasMany(question => question.Tags).WithOne().HasForeignKey(qt => qt.QuestionId); + + //Indexes + b.HasIndex(q => q.CreationTime); + }); + */ + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore/EntityFrameworkCore/WeChatPayModelBuilderConfigurationOptions.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore/EntityFrameworkCore/WeChatPayModelBuilderConfigurationOptions.cs new file mode 100644 index 00000000..624a0945 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore/EntityFrameworkCore/WeChatPayModelBuilderConfigurationOptions.cs @@ -0,0 +1,18 @@ +using JetBrains.Annotations; +using Volo.Abp.EntityFrameworkCore.Modeling; + +namespace EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore +{ + public class WeChatPayModelBuilderConfigurationOptions : AbpModelBuilderConfigurationOptions + { + public WeChatPayModelBuilderConfigurationOptions( + [NotNull] string tablePrefix = "", + [CanBeNull] string schema = null) + : base( + tablePrefix, + schema) + { + + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client/EShopPaymentWeChatPayHttpApiClientModule.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client/EShopPaymentWeChatPayHttpApiClientModule.cs new file mode 100644 index 00000000..e18e334a --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client/EShopPaymentWeChatPayHttpApiClientModule.cs @@ -0,0 +1,22 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Http.Client; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Payments.WeChatPay +{ + [DependsOn( + typeof(EShopPaymentsWeChatPayApplicationContractsModule), + typeof(AbpHttpClientModule))] + public class EShopPaymentsWeChatPayHttpApiClientModule : AbpModule + { + public const string RemoteServiceName = "WeChatPay"; + + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddHttpClientProxies( + typeof(EShopPaymentsWeChatPayApplicationContractsModule).Assembly, + RemoteServiceName + ); + } + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.csproj b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.csproj new file mode 100644 index 00000000..19609dce --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.csproj @@ -0,0 +1,15 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Payments.WeChatPay + + + + + + + + diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.HttpApi/EShopPaymentWeChatPayHttpApiModule.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.HttpApi/EShopPaymentWeChatPayHttpApiModule.cs new file mode 100644 index 00000000..bb312ac4 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.HttpApi/EShopPaymentWeChatPayHttpApiModule.cs @@ -0,0 +1,33 @@ +using Localization.Resources.AbpUi; +using EasyAbp.EShop.Payments.WeChatPay.Localization; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.Localization; +using Volo.Abp.Modularity; +using Microsoft.Extensions.DependencyInjection; + +namespace EasyAbp.EShop.Payments.WeChatPay +{ + [DependsOn( + typeof(EShopPaymentsWeChatPayApplicationContractsModule), + typeof(AbpAspNetCoreMvcModule))] + public class EShopPaymentsWeChatPayHttpApiModule : AbpModule + { + public override void PreConfigureServices(ServiceConfigurationContext context) + { + PreConfigure(mvcBuilder => + { + mvcBuilder.AddApplicationPartIfNotExists(typeof(EShopPaymentsWeChatPayHttpApiModule).Assembly); + }); + } + + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.Resources + .Get() + .AddBaseTypes(typeof(AbpUiResource)); + }); + } + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.HttpApi/EasyAbp.EShop.Payments.WeChatPay.HttpApi.csproj b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.HttpApi/EasyAbp.EShop.Payments.WeChatPay.HttpApi.csproj new file mode 100644 index 00000000..b9338fd5 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.HttpApi/EasyAbp.EShop.Payments.WeChatPay.HttpApi.csproj @@ -0,0 +1,15 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Payments.WeChatPay + + + + + + + + diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.HttpApi/WeChatPayController.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.HttpApi/WeChatPayController.cs new file mode 100644 index 00000000..d80ed40a --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.HttpApi/WeChatPayController.cs @@ -0,0 +1,13 @@ +using EasyAbp.EShop.Payments.WeChatPay.Localization; +using Volo.Abp.AspNetCore.Mvc; + +namespace EasyAbp.EShop.Payments.WeChatPay +{ + public abstract class WeChatPayController : AbpController + { + protected WeChatPayController() + { + LocalizationResource = typeof(WeChatPayResource); + } + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.MongoDB/EasyAbp.EShop.Payments.WeChatPay.MongoDB.csproj b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.MongoDB/EasyAbp.EShop.Payments.WeChatPay.MongoDB.csproj new file mode 100644 index 00000000..5a162176 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.MongoDB/EasyAbp.EShop.Payments.WeChatPay.MongoDB.csproj @@ -0,0 +1,15 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Payments.WeChatPay + + + + + + + + diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.MongoDB/MongoDB/EShopPaymentWeChatPayMongoDbModule.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.MongoDB/MongoDB/EShopPaymentWeChatPayMongoDbModule.cs new file mode 100644 index 00000000..fb623076 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.MongoDB/MongoDB/EShopPaymentWeChatPayMongoDbModule.cs @@ -0,0 +1,23 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Modularity; +using Volo.Abp.MongoDB; + +namespace EasyAbp.EShop.Payments.WeChatPay.MongoDB +{ + [DependsOn( + typeof(EShopPaymentsWeChatPayDomainModule), + typeof(AbpMongoDbModule) + )] + public class EShopPaymentsWeChatPayMongoDbModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddMongoDbContext(options => + { + /* Add custom repositories here. Example: + * options.AddRepository(); + */ + }); + } + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.MongoDB/MongoDB/IWeChatPayMongoDbContext.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.MongoDB/MongoDB/IWeChatPayMongoDbContext.cs new file mode 100644 index 00000000..904a0388 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.MongoDB/MongoDB/IWeChatPayMongoDbContext.cs @@ -0,0 +1,13 @@ +using Volo.Abp.Data; +using Volo.Abp.MongoDB; + +namespace EasyAbp.EShop.Payments.WeChatPay.MongoDB +{ + [ConnectionStringName(WeChatPayDbProperties.ConnectionStringName)] + public interface IWeChatPayMongoDbContext : IAbpMongoDbContext + { + /* Define mongo collections here. Example: + * IMongoCollection Questions { get; } + */ + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.MongoDB/MongoDB/WeChatPayMongoDbContext.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.MongoDB/MongoDB/WeChatPayMongoDbContext.cs new file mode 100644 index 00000000..ee66ed20 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.MongoDB/MongoDB/WeChatPayMongoDbContext.cs @@ -0,0 +1,20 @@ +using Volo.Abp.Data; +using Volo.Abp.MongoDB; + +namespace EasyAbp.EShop.Payments.WeChatPay.MongoDB +{ + [ConnectionStringName(WeChatPayDbProperties.ConnectionStringName)] + public class WeChatPayMongoDbContext : AbpMongoDbContext, IWeChatPayMongoDbContext + { + /* Add mongo collections here. Example: + * public IMongoCollection Questions => Collection(); + */ + + protected override void CreateModel(IMongoModelBuilder modelBuilder) + { + base.CreateModel(modelBuilder); + + modelBuilder.ConfigureWeChatPay(); + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.MongoDB/MongoDB/WeChatPayMongoDbContextExtensions.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.MongoDB/MongoDB/WeChatPayMongoDbContextExtensions.cs new file mode 100644 index 00000000..9babd904 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.MongoDB/MongoDB/WeChatPayMongoDbContextExtensions.cs @@ -0,0 +1,22 @@ +using System; +using Volo.Abp; +using Volo.Abp.MongoDB; + +namespace EasyAbp.EShop.Payments.WeChatPay.MongoDB +{ + public static class WeChatPayMongoDbContextExtensions + { + public static void ConfigureWeChatPay( + this IMongoModelBuilder builder, + Action optionsAction = null) + { + Check.NotNull(builder, nameof(builder)); + + var options = new WeChatPayMongoModelBuilderConfigurationOptions( + WeChatPayDbProperties.DbTablePrefix + ); + + optionsAction?.Invoke(options); + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.MongoDB/MongoDB/WeChatPayMongoModelBuilderConfigurationOptions.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.MongoDB/MongoDB/WeChatPayMongoModelBuilderConfigurationOptions.cs new file mode 100644 index 00000000..17de92f4 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.MongoDB/MongoDB/WeChatPayMongoModelBuilderConfigurationOptions.cs @@ -0,0 +1,14 @@ +using JetBrains.Annotations; +using Volo.Abp.MongoDB; + +namespace EasyAbp.EShop.Payments.WeChatPay.MongoDB +{ + public class WeChatPayMongoModelBuilderConfigurationOptions : AbpMongoModelBuilderConfigurationOptions + { + public WeChatPayMongoModelBuilderConfigurationOptions( + [NotNull] string collectionPrefix = "") + : base(collectionPrefix) + { + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/EShopPaymentWeChatPayWebModule.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/EShopPaymentWeChatPayWebModule.cs new file mode 100644 index 00000000..d4250e73 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/EShopPaymentWeChatPayWebModule.cs @@ -0,0 +1,57 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.Extensions.DependencyInjection; +using EasyAbp.EShop.Payments.WeChatPay.Localization; +using Volo.Abp.AspNetCore.Mvc.Localization; +using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; +using Volo.Abp.AutoMapper; +using Volo.Abp.Modularity; +using Volo.Abp.UI.Navigation; +using Volo.Abp.VirtualFileSystem; + +namespace EasyAbp.EShop.Payments.WeChatPay.Web +{ + [DependsOn( + typeof(EShopPaymentsWeChatPayHttpApiModule), + typeof(AbpAspNetCoreMvcUiThemeSharedModule), + typeof(AbpAutoMapperModule) + )] + public class EShopPaymentsWeChatPayWebModule : AbpModule + { + public override void PreConfigureServices(ServiceConfigurationContext context) + { + context.Services.PreConfigure(options => + { + options.AddAssemblyResource(typeof(WeChatPayResource), typeof(EShopPaymentsWeChatPayWebModule).Assembly); + }); + + PreConfigure(mvcBuilder => + { + mvcBuilder.AddApplicationPartIfNotExists(typeof(EShopPaymentsWeChatPayWebModule).Assembly); + }); + } + + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.MenuContributors.Add(new WeChatPayMenuContributor()); + }); + + Configure(options => + { + options.FileSets.AddEmbedded("EasyAbp.EShop.Payments.WeChatPay.Web"); + }); + + context.Services.AddAutoMapperObjectMapper(); + Configure(options => + { + options.AddMaps(validate: true); + }); + + Configure(options => + { + //Configure authorization. + }); + } + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/EasyAbp.EShop.Payments.WeChatPay.Web.csproj b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/EasyAbp.EShop.Payments.WeChatPay.Web.csproj new file mode 100644 index 00000000..569266dc --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/EasyAbp.EShop.Payments.WeChatPay.Web.csproj @@ -0,0 +1,42 @@ + + + + + + netcoreapp3.1 + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + true + Library + EasyAbp.EShop.Payments.WeChatPay.Web + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/Pages/WeChatPay/Index.cshtml b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/Pages/WeChatPay/Index.cshtml new file mode 100644 index 00000000..44ae09cc --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/Pages/WeChatPay/Index.cshtml @@ -0,0 +1,7 @@ +@page +@inherits EasyAbp.EShop.Payments.WeChatPay.Web.Pages.WeChatPayPage +@model EasyAbp.EShop.Payments.WeChatPay.Web.Pages.WeChatPay.IndexModel +@{ +} +

WeChatPay

+

A sample page for the WeChatPay module.

\ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/Pages/WeChatPay/Index.cshtml.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/Pages/WeChatPay/Index.cshtml.cs new file mode 100644 index 00000000..82611240 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/Pages/WeChatPay/Index.cshtml.cs @@ -0,0 +1,9 @@ +namespace EasyAbp.EShop.Payments.WeChatPay.Web.Pages.WeChatPay +{ + public class IndexModel : WeChatPayPageModel + { + public void OnGet() + { + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/Pages/WeChatPay/_ViewImports.cshtml b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/Pages/WeChatPay/_ViewImports.cshtml new file mode 100644 index 00000000..c1da1f5f --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/Pages/WeChatPay/_ViewImports.cshtml @@ -0,0 +1,4 @@ +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI +@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap +@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/Pages/WeChatPayPage.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/Pages/WeChatPayPage.cs new file mode 100644 index 00000000..1536b51a --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/Pages/WeChatPayPage.cs @@ -0,0 +1,16 @@ +using Microsoft.AspNetCore.Mvc.Localization; +using Microsoft.AspNetCore.Mvc.Razor.Internal; +using EasyAbp.EShop.Payments.WeChatPay.Localization; +using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; + +namespace EasyAbp.EShop.Payments.WeChatPay.Web.Pages +{ + /* Inherit your UI Pages from this class. To do that, add this line to your Pages (.cshtml files under the Page folder): + * @inherits EasyAbp.EShop.Payments.WeChatPay.Web.Pages.WeChatPayPage + */ + public abstract class WeChatPayPage : AbpPage + { + [RazorInject] + public IHtmlLocalizer L { get; set; } + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/Pages/WeChatPayPageModel.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/Pages/WeChatPayPageModel.cs new file mode 100644 index 00000000..c85d76c6 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/Pages/WeChatPayPageModel.cs @@ -0,0 +1,16 @@ +using EasyAbp.EShop.Payments.WeChatPay.Localization; +using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; + +namespace EasyAbp.EShop.Payments.WeChatPay.Web.Pages +{ + /* Inherit your PageModel classes from this class. + */ + public abstract class WeChatPayPageModel : AbpPageModel + { + protected WeChatPayPageModel() + { + LocalizationResourceType = typeof(WeChatPayResource); + ObjectMapperContext = typeof(EShopPaymentsWeChatPayWebModule); + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/Properties/launchSettings.json b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/Properties/launchSettings.json new file mode 100644 index 00000000..87e1d66f --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:56993/", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "EasyAbp.EShop.Payments.WeChatPay.Web": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "http://localhost:56994/" + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/WeChatPayMenuContributor.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/WeChatPayMenuContributor.cs new file mode 100644 index 00000000..ac17b1bf --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/WeChatPayMenuContributor.cs @@ -0,0 +1,23 @@ +using System.Threading.Tasks; +using Volo.Abp.UI.Navigation; + +namespace EasyAbp.EShop.Payments.WeChatPay.Web +{ + public class WeChatPayMenuContributor : IMenuContributor + { + public async Task ConfigureMenuAsync(MenuConfigurationContext context) + { + if (context.Menu.Name == StandardMenus.Main) + { + await ConfigureMainMenu(context); + } + } + + private Task ConfigureMainMenu(MenuConfigurationContext context) + { + //Add main menu items. + + return Task.CompletedTask; + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/WeChatPayWebAutoMapperProfile.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/WeChatPayWebAutoMapperProfile.cs new file mode 100644 index 00000000..d3e5e1d1 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/src/EasyAbp.EShop.Payments.WeChatPay.Web/WeChatPayWebAutoMapperProfile.cs @@ -0,0 +1,14 @@ +using AutoMapper; + +namespace EasyAbp.EShop.Payments.WeChatPay.Web +{ + public class WeChatPayWebAutoMapperProfile : Profile + { + public WeChatPayWebAutoMapperProfile() + { + /* You can configure your AutoMapper mapping configuration here. + * Alternatively, you can split your mapping configurations + * into multiple profile classes for a better organization. */ + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.Application.Tests/EShopPaymentWeChatPayApplicationTestModule.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.Application.Tests/EShopPaymentWeChatPayApplicationTestModule.cs new file mode 100644 index 00000000..ba3e4fcc --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.Application.Tests/EShopPaymentWeChatPayApplicationTestModule.cs @@ -0,0 +1,13 @@ +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Payments.WeChatPay +{ + [DependsOn( + typeof(EShopPaymentsWeChatPayApplicationModule), + typeof(EShopPaymentsWeChatPayDomainTestModule) + )] + public class EShopPaymentsWeChatPayApplicationTestModule : AbpModule + { + + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.Application.Tests/EasyAbp.EShop.Payments.WeChatPay.Application.Tests.csproj b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.Application.Tests/EasyAbp.EShop.Payments.WeChatPay.Application.Tests.csproj new file mode 100644 index 00000000..8e58e0f1 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.Application.Tests/EasyAbp.EShop.Payments.WeChatPay.Application.Tests.csproj @@ -0,0 +1,16 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Payments.WeChatPay + + + + + + + + + diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.Application.Tests/WeChatPayApplicationTestBase.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.Application.Tests/WeChatPayApplicationTestBase.cs new file mode 100644 index 00000000..2992e84a --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.Application.Tests/WeChatPayApplicationTestBase.cs @@ -0,0 +1,10 @@ +namespace EasyAbp.EShop.Payments.WeChatPay +{ + /* Inherit from this class for your application layer tests. + * See SampleAppService_Tests for example. + */ + public abstract class WeChatPayApplicationTestBase : WeChatPayTestBase + { + + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.Domain.Tests/EShopPaymentWeChatPayDomainTestModule.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.Domain.Tests/EShopPaymentWeChatPayDomainTestModule.cs new file mode 100644 index 00000000..e63a887a --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.Domain.Tests/EShopPaymentWeChatPayDomainTestModule.cs @@ -0,0 +1,17 @@ +using EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Payments.WeChatPay +{ + /* Domain tests are configured to use the EF Core provider. + * You can switch to MongoDB, however your domain tests should be + * database independent anyway. + */ + [DependsOn( + typeof(EShopPaymentsWeChatPayEntityFrameworkCoreTestModule) + )] + public class EShopPaymentsWeChatPayDomainTestModule : AbpModule + { + + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.Domain.Tests/EasyAbp.EShop.Payments.WeChatPay.Domain.Tests.csproj b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.Domain.Tests/EasyAbp.EShop.Payments.WeChatPay.Domain.Tests.csproj new file mode 100644 index 00000000..f874be01 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.Domain.Tests/EasyAbp.EShop.Payments.WeChatPay.Domain.Tests.csproj @@ -0,0 +1,15 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Payments.WeChatPay + + + + + + + + diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.Domain.Tests/WeChatPayDomainTestBase.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.Domain.Tests/WeChatPayDomainTestBase.cs new file mode 100644 index 00000000..e49781d4 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.Domain.Tests/WeChatPayDomainTestBase.cs @@ -0,0 +1,10 @@ +namespace EasyAbp.EShop.Payments.WeChatPay +{ + /* Inherit from this class for your domain layer tests. + * See SampleManager_Tests for example. + */ + public abstract class WeChatPayDomainTestBase : WeChatPayTestBase + { + + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore.Tests/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore.Tests.csproj b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore.Tests/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore.Tests.csproj new file mode 100644 index 00000000..6784bdd1 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore.Tests/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore.Tests.csproj @@ -0,0 +1,19 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Payments.WeChatPay + + + + + + + + + + + + diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore.Tests/EntityFrameworkCore/EShopPaymentWeChatPayEntityFrameworkCoreTestModule.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore.Tests/EntityFrameworkCore/EShopPaymentWeChatPayEntityFrameworkCoreTestModule.cs new file mode 100644 index 00000000..2697eb0e --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore.Tests/EntityFrameworkCore/EShopPaymentWeChatPayEntityFrameworkCoreTestModule.cs @@ -0,0 +1,41 @@ +using Microsoft.Data.Sqlite; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage; +using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore +{ + [DependsOn( + typeof(EShopPaymentsWeChatPayTestBaseModule), + typeof(EShopPaymentsWeChatPayEntityFrameworkCoreModule) + )] + public class EShopPaymentsWeChatPayEntityFrameworkCoreTestModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + var sqliteConnection = CreateDatabaseAndGetConnection(); + + Configure(options => + { + options.Configure(abpDbContextConfigurationContext => + { + abpDbContextConfigurationContext.DbContextOptions.UseSqlite(sqliteConnection); + }); + }); + } + + private static SqliteConnection CreateDatabaseAndGetConnection() + { + var connection = new SqliteConnection("Data Source=:memory:"); + connection.Open(); + + new WeChatPayDbContext( + new DbContextOptionsBuilder().UseSqlite(connection).Options + ).GetService().CreateTables(); + + return connection; + } + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore.Tests/EntityFrameworkCore/WeChatPayEntityFrameworkCoreTestBase.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore.Tests/EntityFrameworkCore/WeChatPayEntityFrameworkCoreTestBase.cs new file mode 100644 index 00000000..558ad596 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore.Tests/EntityFrameworkCore/WeChatPayEntityFrameworkCoreTestBase.cs @@ -0,0 +1,10 @@ +namespace EasyAbp.EShop.Payments.WeChatPay.EntityFrameworkCore +{ + /* This class can be used as a base class for EF Core integration tests, + * while SampleRepository_Tests uses a different approach. + */ + public abstract class WeChatPayEntityFrameworkCoreTestBase : WeChatPayTestBase + { + + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs new file mode 100644 index 00000000..091eaa6c --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs @@ -0,0 +1,146 @@ +using System; +using System.Net.Http; +using System.Threading.Tasks; +using IdentityModel.Client; +using Microsoft.Extensions.Configuration; +using Volo.Abp.DependencyInjection; +using Volo.Abp.IdentityModel; + +namespace EasyAbp.EShop.Payments.WeChatPay +{ + public class ClientDemoService : ITransientDependency + { + private readonly IIdentityModelAuthenticationService _authenticationService; + private readonly IConfiguration _configuration; + + public ClientDemoService( + IIdentityModelAuthenticationService authenticationService, + IConfiguration configuration) + { + _authenticationService = authenticationService; + _configuration = configuration; + } + + public async Task RunAsync() + { + await TestWithDynamicProxiesAsync(); + await TestWithHttpClientAndIdentityModelAuthenticationServiceAsync(); + await TestAllManuallyAsync(); + } + + /* Shows how to perform an HTTP request to the API using ABP's dynamic c# proxy + * feature. It is just simple as calling a local service method. + * Authorization and HTTP request details are handled by the ABP framework. + */ + private async Task TestWithDynamicProxiesAsync() + { + Console.WriteLine(); + Console.WriteLine($"***** {nameof(TestWithDynamicProxiesAsync)} *****"); + } + + /* Shows how to use HttpClient to perform a request to the HTTP API. + * It uses ABP's IIdentityModelAuthenticationService to simplify obtaining access tokens. + */ + private async Task TestWithHttpClientAndIdentityModelAuthenticationServiceAsync() + { + Console.WriteLine(); + Console.WriteLine($"***** {nameof(TestWithHttpClientAndIdentityModelAuthenticationServiceAsync)} *****"); + + //Get access token using ABP's IIdentityModelAuthenticationService + + var accessToken = await _authenticationService.GetAccessTokenAsync( + new IdentityClientConfiguration( + _configuration["IdentityClients:Default:Authority"], + _configuration["IdentityClients:Default:Scope"], + _configuration["IdentityClients:Default:ClientId"], + _configuration["IdentityClients:Default:ClientSecret"], + _configuration["IdentityClients:Default:GrantType"], + _configuration["IdentityClients:Default:UserName"], + _configuration["IdentityClients:Default:UserPassword"] + ) + ); + + //Perform the actual HTTP request + + using (var httpClient = new HttpClient()) + { + httpClient.SetBearerToken(accessToken); + + var url = _configuration["RemoteServices:WeChatPay:BaseUrl"] + + "api/WeChatPay/sample/authorized"; + + var responseMessage = await httpClient.GetAsync(url); + if (responseMessage.IsSuccessStatusCode) + { + var responseString = await responseMessage.Content.ReadAsStringAsync(); + Console.WriteLine("Result: " + responseString); + } + else + { + throw new Exception("Remote server returns error code: " + responseMessage.StatusCode); + } + } + } + + /* Shows how to use HttpClient to perform a request to the HTTP API. + * It obtains access token using IdentityServer's API. See its documentation: + * https://identityserver4.readthedocs.io/en/latest/quickstarts/2_resource_owner_passwords.html + */ + private async Task TestAllManuallyAsync() + { + Console.WriteLine(); + Console.WriteLine($"***** {nameof(TestAllManuallyAsync)} *****"); + + //Obtain access token from the IDS4 server + + // discover endpoints from metadata + var client = new HttpClient(); + var disco = await client.GetDiscoveryDocumentAsync(_configuration["IdentityClients:Default:Authority"]); + if (disco.IsError) + { + Console.WriteLine(disco.Error); + return; + } + + // request token + var tokenResponse = await client.RequestPasswordTokenAsync(new PasswordTokenRequest + { + Address = disco.TokenEndpoint, + ClientId = _configuration["IdentityClients:Default:ClientId"], + ClientSecret = _configuration["IdentityClients:Default:ClientSecret"], + UserName = _configuration["IdentityClients:Default:UserName"], + Password = _configuration["IdentityClients:Default:UserPassword"], + Scope = _configuration["IdentityClients:Default:Scope"] + }); + + if (tokenResponse.IsError) + { + Console.WriteLine(tokenResponse.Error); + return; + } + + Console.WriteLine(tokenResponse.Json); + + //Perform the actual HTTP request + + using (var httpClient = new HttpClient()) + { + httpClient.SetBearerToken(tokenResponse.AccessToken); + + var url = _configuration["RemoteServices:WeChatPay:BaseUrl"] + + "api/WeChatPay/sample/authorized"; + + var responseMessage = await httpClient.GetAsync(url); + if (responseMessage.IsSuccessStatusCode) + { + var responseString = await responseMessage.Content.ReadAsStringAsync(); + Console.WriteLine("Result: " + responseString); + } + else + { + throw new Exception("Remote server returns error code: " + responseMessage.StatusCode); + } + } + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs new file mode 100644 index 00000000..581ee226 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs @@ -0,0 +1,26 @@ +using Microsoft.Extensions.Hosting; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; + +namespace EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp +{ + public class ConsoleTestAppHostedService : IHostedService + { + public async Task StartAsync(CancellationToken cancellationToken) + { + using (var application = AbpApplicationFactory.Create()) + { + application.Initialize(); + + var demo = application.ServiceProvider.GetRequiredService(); + await demo.RunAsync(); + + application.Shutdown(); + } + } + + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp/EShopPaymentWeChatPayConsoleApiClientModule.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp/EShopPaymentWeChatPayConsoleApiClientModule.cs new file mode 100644 index 00000000..69c90824 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp/EShopPaymentWeChatPayConsoleApiClientModule.cs @@ -0,0 +1,14 @@ +using Volo.Abp.Http.Client.IdentityModel; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Payments.WeChatPay +{ + [DependsOn( + typeof(EShopPaymentsWeChatPayHttpApiClientModule), + typeof(AbpHttpClientIdentityModelModule) + )] + public class EShopPaymentsWeChatPayConsoleApiClientModule : AbpModule + { + + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp.csproj b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp.csproj new file mode 100644 index 00000000..1c65d306 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp.csproj @@ -0,0 +1,26 @@ + + + + Exe + netcoreapp3.1 + EasyAbp.EShop.Payments.WeChatPay + + + + + + + + + + + PreserveNewest + Always + + + + + + + + diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp/Program.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp/Program.cs new file mode 100644 index 00000000..10b7dd84 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp/Program.cs @@ -0,0 +1,21 @@ +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +namespace EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp +{ + class Program + { + static async Task Main(string[] args) + { + await CreateHostBuilder(args).RunConsoleAsync(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureServices((hostContext, services) => + { + services.AddHostedService(); + }); + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp/appsettings.json b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp/appsettings.json new file mode 100644 index 00000000..088131bb --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.HttpApi.Client.ConsoleTestApp/appsettings.json @@ -0,0 +1,21 @@ +{ + "RemoteServices": { + "Default": { + "BaseUrl": "https://localhost:44343/" + }, + "WeChatPay": { + "BaseUrl": "https://localhost:44399/" + } + }, + "IdentityClients": { + "Default": { + "GrantType": "password", + "ClientId": "WeChatPay_ConsoleTestApp", + "ClientSecret": "1q2w3e*", + "UserName": "admin", + "UserPassword": "1q2w3E*", + "Authority": "https://localhost:44343/", + "Scope": "WeChatPay" + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.MongoDB.Tests/EasyAbp.EShop.Payments.WeChatPay.MongoDB.Tests.csproj b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.MongoDB.Tests/EasyAbp.EShop.Payments.WeChatPay.MongoDB.Tests.csproj new file mode 100644 index 00000000..466df425 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.MongoDB.Tests/EasyAbp.EShop.Payments.WeChatPay.MongoDB.Tests.csproj @@ -0,0 +1,17 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Payments.WeChatPay + + + + + + + + + + diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.MongoDB.Tests/MongoDB/EShopPaymentWeChatPayMongoDbTestModule.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.MongoDB.Tests/MongoDB/EShopPaymentWeChatPayMongoDbTestModule.cs new file mode 100644 index 00000000..0fc509e6 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.MongoDB.Tests/MongoDB/EShopPaymentWeChatPayMongoDbTestModule.cs @@ -0,0 +1,29 @@ +using System; +using Mongo2Go; +using Volo.Abp; +using Volo.Abp.Data; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Payments.WeChatPay.MongoDB +{ + [DependsOn( + typeof(EShopPaymentsWeChatPayTestBaseModule), + typeof(EShopPaymentsWeChatPayMongoDbModule) + )] + public class EShopPaymentsWeChatPayMongoDbTestModule : AbpModule + { + private static readonly MongoDbRunner MongoDbRunner = MongoDbRunner.Start(); + + public override void ConfigureServices(ServiceConfigurationContext context) + { + var connectionString = MongoDbRunner.ConnectionString.EnsureEndsWith('/') + + "Db_" + + Guid.NewGuid().ToString("N"); + + Configure(options => + { + options.ConnectionStrings.Default = connectionString; + }); + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.MongoDB.Tests/MongoDB/WeChatPayMongoDbTestBase.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.MongoDB.Tests/MongoDB/WeChatPayMongoDbTestBase.cs new file mode 100644 index 00000000..67027e42 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.MongoDB.Tests/MongoDB/WeChatPayMongoDbTestBase.cs @@ -0,0 +1,10 @@ +namespace EasyAbp.EShop.Payments.WeChatPay.MongoDB +{ + /* This class can be used as a base class for MongoDB integration tests, + * while SampleRepository_Tests uses a different approach. + */ + public abstract class WeChatPayMongoDbTestBase : WeChatPayTestBase + { + + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.TestBase/EShopPaymentWeChatPayTestBaseModule.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.TestBase/EShopPaymentWeChatPayTestBaseModule.cs new file mode 100644 index 00000000..0d1e278f --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.TestBase/EShopPaymentWeChatPayTestBaseModule.cs @@ -0,0 +1,42 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; +using Volo.Abp.Authorization; +using Volo.Abp.Autofac; +using Volo.Abp.Data; +using Volo.Abp.Modularity; +using Volo.Abp.Threading; + +namespace EasyAbp.EShop.Payments.WeChatPay +{ + [DependsOn( + typeof(AbpAutofacModule), + typeof(AbpTestBaseModule), + typeof(AbpAuthorizationModule), + typeof(EShopPaymentsWeChatPayDomainModule) + )] + public class EShopPaymentsWeChatPayTestBaseModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddAlwaysAllowAuthorization(); + } + + public override void OnApplicationInitialization(ApplicationInitializationContext context) + { + SeedTestData(context); + } + + private static void SeedTestData(ApplicationInitializationContext context) + { + AsyncHelper.RunSync(async () => + { + using (var scope = context.ServiceProvider.CreateScope()) + { + await scope.ServiceProvider + .GetRequiredService() + .SeedAsync(); + } + }); + } + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.TestBase/EasyAbp.EShop.Payments.WeChatPay.TestBase.csproj b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.TestBase/EasyAbp.EShop.Payments.WeChatPay.TestBase.csproj new file mode 100644 index 00000000..1bfb28c9 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.TestBase/EasyAbp.EShop.Payments.WeChatPay.TestBase.csproj @@ -0,0 +1,23 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Payments.WeChatPay + + + + + + + + + + + + + + + + diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.TestBase/Security/FakeCurrentPrincipalAccessor.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.TestBase/Security/FakeCurrentPrincipalAccessor.cs new file mode 100644 index 00000000..38d27785 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.TestBase/Security/FakeCurrentPrincipalAccessor.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using System.Security.Claims; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Security.Claims; + +namespace EasyAbp.EShop.Payments.WeChatPay.Security +{ + [Dependency(ReplaceServices = true)] + public class FakeCurrentPrincipalAccessor : ICurrentPrincipalAccessor, ISingletonDependency + { + public ClaimsPrincipal Principal => GetPrincipal(); + private ClaimsPrincipal _principal; + + private ClaimsPrincipal GetPrincipal() + { + if (_principal == null) + { + lock (this) + { + if (_principal == null) + { + _principal = new ClaimsPrincipal( + new ClaimsIdentity( + new List + { + new Claim(AbpClaimTypes.UserId,"2e701e62-0953-4dd3-910b-dc6cc93ccb0d"), + new Claim(AbpClaimTypes.UserName,"admin"), + new Claim(AbpClaimTypes.Email,"admin@abp.io") + } + ) + ); + } + } + } + + return _principal; + } + } +} diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.TestBase/WeChatPayDataSeedContributor.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.TestBase/WeChatPayDataSeedContributor.cs new file mode 100644 index 00000000..30b27a31 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.TestBase/WeChatPayDataSeedContributor.cs @@ -0,0 +1,27 @@ +using System.Threading.Tasks; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Guids; + +namespace EasyAbp.EShop.Payments.WeChatPay +{ + public class WeChatPayDataSeedContributor : IDataSeedContributor, ITransientDependency + { + private readonly IGuidGenerator _guidGenerator; + + public WeChatPayDataSeedContributor( + IGuidGenerator guidGenerator) + { + _guidGenerator = guidGenerator; + } + + public Task SeedAsync(DataSeedContext context) + { + /* Instead of returning the Task.CompletedTask, you can insert your test data + * at this point! + */ + + return Task.CompletedTask; + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.TestBase/WeChatPayTestBase.cs b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.TestBase/WeChatPayTestBase.cs new file mode 100644 index 00000000..5f663a72 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments.WeChatPay/test/EasyAbp.EShop.Payments.WeChatPay.TestBase/WeChatPayTestBase.cs @@ -0,0 +1,60 @@ +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; +using Volo.Abp.Modularity; +using Volo.Abp.Uow; +using Volo.Abp.Testing; + +namespace EasyAbp.EShop.Payments.WeChatPay +{ + /* All test classes are derived from this class, directly or indirectly. */ + public abstract class WeChatPayTestBase : AbpIntegratedTest + where TStartupModule : IAbpModule + { + protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options) + { + options.UseAutofac(); + } + + protected virtual Task WithUnitOfWorkAsync(Func func) + { + return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); + } + + protected virtual async Task WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, Func action) + { + using (var scope = ServiceProvider.CreateScope()) + { + var uowManager = scope.ServiceProvider.GetRequiredService(); + + using (var uow = uowManager.Begin(options)) + { + await action(); + + await uow.CompleteAsync(); + } + } + } + + protected virtual Task WithUnitOfWorkAsync(Func> func) + { + return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); + } + + protected virtual async Task WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, Func> func) + { + using (var scope = ServiceProvider.CreateScope()) + { + var uowManager = scope.ServiceProvider.GetRequiredService(); + + using (var uow = uowManager.Begin(options)) + { + var result = await func(); + await uow.CompleteAsync(); + return result; + } + } + } + } +} diff --git a/modules/EasyAbp.EShop.Payments/.gitattributes b/modules/EasyAbp.EShop.Payments/.gitattributes new file mode 100644 index 00000000..c941e526 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/.gitattributes @@ -0,0 +1 @@ +**/wwwroot/libs/** linguist-vendored diff --git a/modules/EasyAbp.EShop.Payments/.gitignore b/modules/EasyAbp.EShop.Payments/.gitignore new file mode 100644 index 00000000..0191f22c --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/.gitignore @@ -0,0 +1,258 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# Payments +host/EasyAbp.EShop.Payments.IdentityServer/Logs/logs.txt +host/EasyAbp.EShop.Payments.HttpApi.Host/Logs/logs.txt +host/EasyAbp.EShop.Payments.Web.Host/Logs/logs.txt +host/EasyAbp.EShop.Payments.Web.Unified/Logs/logs.txt diff --git a/modules/EasyAbp.EShop.Payments/EasyAbp.EShop.Payments.sln b/modules/EasyAbp.EShop.Payments/EasyAbp.EShop.Payments.sln new file mode 100644 index 00000000..77a8d746 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/EasyAbp.EShop.Payments.sln @@ -0,0 +1,167 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29001.49 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.Domain.Shared", "src\EasyAbp.EShop.Payments.Domain.Shared\EasyAbp.EShop.Payments.Domain.Shared.csproj", "{D64C1577-4929-4B60-939E-96DE1534891A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.Domain", "src\EasyAbp.EShop.Payments.Domain\EasyAbp.EShop.Payments.Domain.csproj", "{F2840BC7-0188-4606-9126-DADD0F5ABF7A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.Application.Contracts", "src\EasyAbp.EShop.Payments.Application.Contracts\EasyAbp.EShop.Payments.Application.Contracts.csproj", "{BD65D04F-08D5-40C1-8C24-77CA0BACB877}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.Application", "src\EasyAbp.EShop.Payments.Application\EasyAbp.EShop.Payments.Application.csproj", "{78040F9E-3501-4A40-82DF-00A597710F35}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{649A3FFA-182F-4E56-9717-E6A9A2BEC545}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "host", "host", "{E400416D-2895-4512-9D17-90681EEC7E0A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.EntityFrameworkCore", "src\EasyAbp.EShop.Payments.EntityFrameworkCore\EasyAbp.EShop.Payments.EntityFrameworkCore.csproj", "{0CE86223-D31D-4315-A1F5-87BA3EE1B844}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.MongoDB", "src\EasyAbp.EShop.Payments.MongoDB\EasyAbp.EShop.Payments.MongoDB.csproj", "{F1C58097-4C08-4D88-8976-6B3389391481}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.HttpApi", "src\EasyAbp.EShop.Payments.HttpApi\EasyAbp.EShop.Payments.HttpApi.csproj", "{077AA5F8-8B61-420C-A6B5-0150A66FDB34}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.HttpApi.Client", "src\EasyAbp.EShop.Payments.HttpApi.Client\EasyAbp.EShop.Payments.HttpApi.Client.csproj", "{36E2735F-CEAB-44C8-A6D1-2CDAFF399751}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.TestBase", "test\EasyAbp.EShop.Payments.TestBase\EasyAbp.EShop.Payments.TestBase.csproj", "{C5BB573D-3030-4BCB-88B7-F6A85C32766C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.EntityFrameworkCore.Tests", "test\EasyAbp.EShop.Payments.EntityFrameworkCore.Tests\EasyAbp.EShop.Payments.EntityFrameworkCore.Tests.csproj", "{527F645C-C1FC-406E-8479-81386C8ECF13}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.MongoDB.Tests", "test\EasyAbp.EShop.Payments.MongoDB.Tests\EasyAbp.EShop.Payments.MongoDB.Tests.csproj", "{D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.Domain.Tests", "test\EasyAbp.EShop.Payments.Domain.Tests\EasyAbp.EShop.Payments.Domain.Tests.csproj", "{E60895E5-79C4-447D-88B7-85CB5BA336A4}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.Application.Tests", "test\EasyAbp.EShop.Payments.Application.Tests\EasyAbp.EShop.Payments.Application.Tests.csproj", "{90CB5DC4-C040-45C7-8900-9688B26405BC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.HttpApi.Host", "host\EasyAbp.EShop.Payments.HttpApi.Host\EasyAbp.EShop.Payments.HttpApi.Host.csproj", "{37B135B0-DAFE-4616-B25C-1BDF32FC44A2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.Web", "src\EasyAbp.EShop.Payments.Web\EasyAbp.EShop.Payments.Web.csproj", "{3B7B6317-1B85-4164-8E11-75574F80AE17}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp", "test\EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp\EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp.csproj", "{1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.Web.Host", "host\EasyAbp.EShop.Payments.Web.Host\EasyAbp.EShop.Payments.Web.Host.csproj", "{73513786-B6C6-4A21-89C5-0FBDD0A46107}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.IdentityServer", "host\EasyAbp.EShop.Payments.IdentityServer\EasyAbp.EShop.Payments.IdentityServer.csproj", "{690203F4-3CD5-4569-88D9-EE831EEA5F5F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.Host.Shared", "host\EasyAbp.EShop.Payments.Host.Shared\EasyAbp.EShop.Payments.Host.Shared.csproj", "{F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EasyAbp.EShop.Payments.Web.Unified", "host\EasyAbp.EShop.Payments.Web.Unified\EasyAbp.EShop.Payments.Web.Unified.csproj", "{3D872C41-E226-45C8-89C1-9D3DBD7C73F2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D64C1577-4929-4B60-939E-96DE1534891A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D64C1577-4929-4B60-939E-96DE1534891A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D64C1577-4929-4B60-939E-96DE1534891A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D64C1577-4929-4B60-939E-96DE1534891A}.Release|Any CPU.Build.0 = Release|Any CPU + {F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F2840BC7-0188-4606-9126-DADD0F5ABF7A}.Release|Any CPU.Build.0 = Release|Any CPU + {BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BD65D04F-08D5-40C1-8C24-77CA0BACB877}.Release|Any CPU.Build.0 = Release|Any CPU + {78040F9E-3501-4A40-82DF-00A597710F35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {78040F9E-3501-4A40-82DF-00A597710F35}.Debug|Any CPU.Build.0 = Debug|Any CPU + {78040F9E-3501-4A40-82DF-00A597710F35}.Release|Any CPU.ActiveCfg = Release|Any CPU + {78040F9E-3501-4A40-82DF-00A597710F35}.Release|Any CPU.Build.0 = Release|Any CPU + {0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0CE86223-D31D-4315-A1F5-87BA3EE1B844}.Release|Any CPU.Build.0 = Release|Any CPU + {F1C58097-4C08-4D88-8976-6B3389391481}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F1C58097-4C08-4D88-8976-6B3389391481}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F1C58097-4C08-4D88-8976-6B3389391481}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F1C58097-4C08-4D88-8976-6B3389391481}.Release|Any CPU.Build.0 = Release|Any CPU + {077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Debug|Any CPU.Build.0 = Debug|Any CPU + {077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Release|Any CPU.ActiveCfg = Release|Any CPU + {077AA5F8-8B61-420C-A6B5-0150A66FDB34}.Release|Any CPU.Build.0 = Release|Any CPU + {36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Debug|Any CPU.Build.0 = Debug|Any CPU + {36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Release|Any CPU.ActiveCfg = Release|Any CPU + {36E2735F-CEAB-44C8-A6D1-2CDAFF399751}.Release|Any CPU.Build.0 = Release|Any CPU + {C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C5BB573D-3030-4BCB-88B7-F6A85C32766C}.Release|Any CPU.Build.0 = Release|Any CPU + {527F645C-C1FC-406E-8479-81386C8ECF13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {527F645C-C1FC-406E-8479-81386C8ECF13}.Debug|Any CPU.Build.0 = Debug|Any CPU + {527F645C-C1FC-406E-8479-81386C8ECF13}.Release|Any CPU.ActiveCfg = Release|Any CPU + {527F645C-C1FC-406E-8479-81386C8ECF13}.Release|Any CPU.Build.0 = Release|Any CPU + {D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6}.Release|Any CPU.Build.0 = Release|Any CPU + {E60895E5-79C4-447D-88B7-85CB5BA336A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E60895E5-79C4-447D-88B7-85CB5BA336A4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E60895E5-79C4-447D-88B7-85CB5BA336A4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E60895E5-79C4-447D-88B7-85CB5BA336A4}.Release|Any CPU.Build.0 = Release|Any CPU + {90CB5DC4-C040-45C7-8900-9688B26405BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {90CB5DC4-C040-45C7-8900-9688B26405BC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {90CB5DC4-C040-45C7-8900-9688B26405BC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {90CB5DC4-C040-45C7-8900-9688B26405BC}.Release|Any CPU.Build.0 = Release|Any CPU + {37B135B0-DAFE-4616-B25C-1BDF32FC44A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {37B135B0-DAFE-4616-B25C-1BDF32FC44A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {37B135B0-DAFE-4616-B25C-1BDF32FC44A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {37B135B0-DAFE-4616-B25C-1BDF32FC44A2}.Release|Any CPU.Build.0 = Release|Any CPU + {3B7B6317-1B85-4164-8E11-75574F80AE17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {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 + {1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8}.Release|Any CPU.Build.0 = Release|Any CPU + {73513786-B6C6-4A21-89C5-0FBDD0A46107}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {73513786-B6C6-4A21-89C5-0FBDD0A46107}.Debug|Any CPU.Build.0 = Debug|Any CPU + {73513786-B6C6-4A21-89C5-0FBDD0A46107}.Release|Any CPU.ActiveCfg = Release|Any CPU + {73513786-B6C6-4A21-89C5-0FBDD0A46107}.Release|Any CPU.Build.0 = Release|Any CPU + {690203F4-3CD5-4569-88D9-EE831EEA5F5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {690203F4-3CD5-4569-88D9-EE831EEA5F5F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {690203F4-3CD5-4569-88D9-EE831EEA5F5F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {690203F4-3CD5-4569-88D9-EE831EEA5F5F}.Release|Any CPU.Build.0 = Release|Any CPU + {F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB}.Release|Any CPU.Build.0 = Release|Any CPU + {3D872C41-E226-45C8-89C1-9D3DBD7C73F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3D872C41-E226-45C8-89C1-9D3DBD7C73F2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3D872C41-E226-45C8-89C1-9D3DBD7C73F2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3D872C41-E226-45C8-89C1-9D3DBD7C73F2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {D64C1577-4929-4B60-939E-96DE1534891A} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {F2840BC7-0188-4606-9126-DADD0F5ABF7A} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {BD65D04F-08D5-40C1-8C24-77CA0BACB877} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {78040F9E-3501-4A40-82DF-00A597710F35} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {0CE86223-D31D-4315-A1F5-87BA3EE1B844} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {F1C58097-4C08-4D88-8976-6B3389391481} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {077AA5F8-8B61-420C-A6B5-0150A66FDB34} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {36E2735F-CEAB-44C8-A6D1-2CDAFF399751} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {C5BB573D-3030-4BCB-88B7-F6A85C32766C} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {527F645C-C1FC-406E-8479-81386C8ECF13} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {D0AD9179-125C-40B2-A8EE-CD4C1EE24BB6} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {E60895E5-79C4-447D-88B7-85CB5BA336A4} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {90CB5DC4-C040-45C7-8900-9688B26405BC} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {37B135B0-DAFE-4616-B25C-1BDF32FC44A2} = {E400416D-2895-4512-9D17-90681EEC7E0A} + {3B7B6317-1B85-4164-8E11-75574F80AE17} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545} + {1EDCD6D4-DF3A-4E3B-ABB6-C0D0B373EAB8} = {CCD2960C-23CC-4AB4-B84D-60C7AAA52F4D} + {73513786-B6C6-4A21-89C5-0FBDD0A46107} = {E400416D-2895-4512-9D17-90681EEC7E0A} + {690203F4-3CD5-4569-88D9-EE831EEA5F5F} = {E400416D-2895-4512-9D17-90681EEC7E0A} + {F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB} = {E400416D-2895-4512-9D17-90681EEC7E0A} + {3D872C41-E226-45C8-89C1-9D3DBD7C73F2} = {E400416D-2895-4512-9D17-90681EEC7E0A} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4324B3B4-B60B-4E3C-91D8-59576B4E26DD} + EndGlobalSection +EndGlobal diff --git a/modules/EasyAbp.EShop.Payments/EasyAbp.EShop.Payments.sln.DotSettings b/modules/EasyAbp.EShop.Payments/EasyAbp.EShop.Payments.sln.DotSettings new file mode 100644 index 00000000..cb0b2c91 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/EasyAbp.EShop.Payments.sln.DotSettings @@ -0,0 +1,23 @@ + + True + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + Required + Required + Required + Required + False + True + False + False + True + False + False + SQL + \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments/common.props b/modules/EasyAbp.EShop.Payments/common.props new file mode 100644 index 00000000..e601a915 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/common.props @@ -0,0 +1,28 @@ + + + latest + 0.1.0 + $(NoWarn);CS1591 + true + EasyAbp Team + An abp application module group that provides basic e-shop service. + https://github.com/EasyAbp/EShop + https://github.com/EasyAbp/EShop + abp module easyabp EShop shopping shop ordering product payment store mall + EasyAbp + Apache-2.0 + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers + + + + \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments/docker-compose.migrations.yml b/modules/EasyAbp.EShop.Payments/docker-compose.migrations.yml new file mode 100644 index 00000000..b9c2d01c --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/docker-compose.migrations.yml @@ -0,0 +1,13 @@ +version: '3.4' + +services: + migrations: + build: + context: ../../ + dockerfile: templates/service/database/Dockerfile + depends_on: + - sqlserver + environment: + - IdentityServer_DB=Payments_Identity + - Payments_DB=Payments_ModuleDb + - SA_PASSWORD=yourStrong(!)Password diff --git a/modules/EasyAbp.EShop.Payments/docker-compose.override.yml b/modules/EasyAbp.EShop.Payments/docker-compose.override.yml new file mode 100644 index 00000000..f46a2dc7 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/docker-compose.override.yml @@ -0,0 +1,29 @@ +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=Payments_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - ConnectionStrings__SqlServerCache=Server=sqlserver;Database=Payments_Cache;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + ports: + - "51600:80" + + payments: + environment: + - ASPNETCORE_URLS=http://0.0.0.0:80 + - ConnectionStrings__Default=Server=sqlserver;Database=Payments_ModuleDb;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - ConnectionStrings__AbpSettingManagement=Server=sqlserver;Database=Payments_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - ConnectionStrings__AbpPermissionManagement=Server=sqlserver;Database=Payments_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - ConnectionStrings__AbpAuditLogging=Server=sqlserver;Database=Payments_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false + - ConnectionStrings__SqlServerCache=Server=sqlserver;Database=Payments_Cache;Trusted_Connection=True;MultipleActiveResultSets=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/EasyAbp.EShop.Payments/docker-compose.yml b/modules/EasyAbp.EShop.Payments/docker-compose.yml new file mode 100644 index 00000000..bb89e4ec --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/docker-compose.yml @@ -0,0 +1,25 @@ +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 + + payments: + build: + context: ../../ + dockerfile: templates/service/host/EasyAbp.EShop.Payments.Host/Dockerfile + depends_on: + - sqlserver + - identity-server + +volumes: + dbdata: \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Application.Tests/EShopPaymentApplicationTestModule.cs b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Application.Tests/EShopPaymentApplicationTestModule.cs new file mode 100644 index 00000000..da75d641 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Application.Tests/EShopPaymentApplicationTestModule.cs @@ -0,0 +1,13 @@ +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Payments +{ + [DependsOn( + typeof(EShopPaymentsApplicationModule), + typeof(EShopPaymentsDomainTestModule) + )] + public class EShopPaymentsApplicationTestModule : AbpModule + { + + } +} diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Application.Tests/EasyAbp.EShop.Payments.Application.Tests.csproj b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Application.Tests/EasyAbp.EShop.Payments.Application.Tests.csproj new file mode 100644 index 00000000..e71779ef --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Application.Tests/EasyAbp.EShop.Payments.Application.Tests.csproj @@ -0,0 +1,16 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Payments + + + + + + + + + diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Application.Tests/FodyWeavers.xml b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Application.Tests/FodyWeavers.xml new file mode 100644 index 00000000..be0de3a9 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Application.Tests/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Application.Tests/FodyWeavers.xsd b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Application.Tests/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Application.Tests/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/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Application.Tests/PaymentsApplicationTestBase.cs b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Application.Tests/PaymentsApplicationTestBase.cs new file mode 100644 index 00000000..3fe06d40 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Application.Tests/PaymentsApplicationTestBase.cs @@ -0,0 +1,10 @@ +namespace EasyAbp.EShop.Payments +{ + /* Inherit from this class for your application layer tests. + * See SampleAppService_Tests for example. + */ + public abstract class PaymentsApplicationTestBase : PaymentsTestBase + { + + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Domain.Tests/EShopPaymentDomainTestModule.cs b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Domain.Tests/EShopPaymentDomainTestModule.cs new file mode 100644 index 00000000..9d8a0a49 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Domain.Tests/EShopPaymentDomainTestModule.cs @@ -0,0 +1,17 @@ +using EasyAbp.EShop.Payments.EntityFrameworkCore; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Payments +{ + /* Domain tests are configured to use the EF Core provider. + * You can switch to MongoDB, however your domain tests should be + * database independent anyway. + */ + [DependsOn( + typeof(EShopPaymentsEntityFrameworkCoreTestModule) + )] + public class EShopPaymentsDomainTestModule : AbpModule + { + + } +} diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Domain.Tests/EasyAbp.EShop.Payments.Domain.Tests.csproj b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Domain.Tests/EasyAbp.EShop.Payments.Domain.Tests.csproj new file mode 100644 index 00000000..44478460 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Domain.Tests/EasyAbp.EShop.Payments.Domain.Tests.csproj @@ -0,0 +1,15 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Payments + + + + + + + + diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Domain.Tests/FodyWeavers.xml b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Domain.Tests/FodyWeavers.xml new file mode 100644 index 00000000..be0de3a9 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Domain.Tests/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Domain.Tests/FodyWeavers.xsd b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Domain.Tests/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Domain.Tests/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/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Domain.Tests/PaymentsDomainTestBase.cs b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Domain.Tests/PaymentsDomainTestBase.cs new file mode 100644 index 00000000..8a63f7aa --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.Domain.Tests/PaymentsDomainTestBase.cs @@ -0,0 +1,10 @@ +namespace EasyAbp.EShop.Payments +{ + /* Inherit from this class for your domain layer tests. + * See SampleManager_Tests for example. + */ + public abstract class PaymentsDomainTestBase : PaymentsTestBase + { + + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.EntityFrameworkCore.Tests/EasyAbp.EShop.Payments.EntityFrameworkCore.Tests.csproj b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.EntityFrameworkCore.Tests/EasyAbp.EShop.Payments.EntityFrameworkCore.Tests.csproj new file mode 100644 index 00000000..91b447be --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.EntityFrameworkCore.Tests/EasyAbp.EShop.Payments.EntityFrameworkCore.Tests.csproj @@ -0,0 +1,19 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Payments + + + + + + + + + + + + diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.EntityFrameworkCore.Tests/EntityFrameworkCore/EShopPaymentEntityFrameworkCoreTestModule.cs b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.EntityFrameworkCore.Tests/EntityFrameworkCore/EShopPaymentEntityFrameworkCoreTestModule.cs new file mode 100644 index 00000000..9cbabbba --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.EntityFrameworkCore.Tests/EntityFrameworkCore/EShopPaymentEntityFrameworkCoreTestModule.cs @@ -0,0 +1,41 @@ +using Microsoft.Data.Sqlite; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage; +using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Payments.EntityFrameworkCore +{ + [DependsOn( + typeof(EShopPaymentsTestBaseModule), + typeof(EShopPaymentsEntityFrameworkCoreModule) + )] + public class EShopPaymentsEntityFrameworkCoreTestModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + var sqliteConnection = CreateDatabaseAndGetConnection(); + + Configure(options => + { + options.Configure(abpDbContextConfigurationContext => + { + abpDbContextConfigurationContext.DbContextOptions.UseSqlite(sqliteConnection); + }); + }); + } + + private static SqliteConnection CreateDatabaseAndGetConnection() + { + var connection = new SqliteConnection("Data Source=:memory:"); + connection.Open(); + + new PaymentsDbContext( + new DbContextOptionsBuilder().UseSqlite(connection).Options + ).GetService().CreateTables(); + + return connection; + } + } +} diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.EntityFrameworkCore.Tests/EntityFrameworkCore/PaymentsEntityFrameworkCoreTestBase.cs b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.EntityFrameworkCore.Tests/EntityFrameworkCore/PaymentsEntityFrameworkCoreTestBase.cs new file mode 100644 index 00000000..81929e24 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.EntityFrameworkCore.Tests/EntityFrameworkCore/PaymentsEntityFrameworkCoreTestBase.cs @@ -0,0 +1,10 @@ +namespace EasyAbp.EShop.Payments.EntityFrameworkCore +{ + /* This class can be used as a base class for EF Core integration tests, + * while SampleRepository_Tests uses a different approach. + */ + public abstract class PaymentsEntityFrameworkCoreTestBase : PaymentsTestBase + { + + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.EntityFrameworkCore.Tests/FodyWeavers.xml b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.EntityFrameworkCore.Tests/FodyWeavers.xml new file mode 100644 index 00000000..be0de3a9 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.EntityFrameworkCore.Tests/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.EntityFrameworkCore.Tests/FodyWeavers.xsd b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.EntityFrameworkCore.Tests/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.EntityFrameworkCore.Tests/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/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs new file mode 100644 index 00000000..538e8351 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs @@ -0,0 +1,146 @@ +using System; +using System.Net.Http; +using System.Threading.Tasks; +using IdentityModel.Client; +using Microsoft.Extensions.Configuration; +using Volo.Abp.DependencyInjection; +using Volo.Abp.IdentityModel; + +namespace EasyAbp.EShop.Payments +{ + public class ClientDemoService : ITransientDependency + { + private readonly IIdentityModelAuthenticationService _authenticationService; + private readonly IConfiguration _configuration; + + public ClientDemoService( + IIdentityModelAuthenticationService authenticationService, + IConfiguration configuration) + { + _authenticationService = authenticationService; + _configuration = configuration; + } + + public async Task RunAsync() + { + await TestWithDynamicProxiesAsync(); + await TestWithHttpClientAndIdentityModelAuthenticationServiceAsync(); + await TestAllManuallyAsync(); + } + + /* Shows how to perform an HTTP request to the API using ABP's dynamic c# proxy + * feature. It is just simple as calling a local service method. + * Authorization and HTTP request details are handled by the ABP framework. + */ + private async Task TestWithDynamicProxiesAsync() + { + Console.WriteLine(); + Console.WriteLine($"***** {nameof(TestWithDynamicProxiesAsync)} *****"); + } + + /* Shows how to use HttpClient to perform a request to the HTTP API. + * It uses ABP's IIdentityModelAuthenticationService to simplify obtaining access tokens. + */ + private async Task TestWithHttpClientAndIdentityModelAuthenticationServiceAsync() + { + Console.WriteLine(); + Console.WriteLine($"***** {nameof(TestWithHttpClientAndIdentityModelAuthenticationServiceAsync)} *****"); + + //Get access token using ABP's IIdentityModelAuthenticationService + + var accessToken = await _authenticationService.GetAccessTokenAsync( + new IdentityClientConfiguration( + _configuration["IdentityClients:Default:Authority"], + _configuration["IdentityClients:Default:Scope"], + _configuration["IdentityClients:Default:ClientId"], + _configuration["IdentityClients:Default:ClientSecret"], + _configuration["IdentityClients:Default:GrantType"], + _configuration["IdentityClients:Default:UserName"], + _configuration["IdentityClients:Default:UserPassword"] + ) + ); + + //Perform the actual HTTP request + + using (var httpClient = new HttpClient()) + { + httpClient.SetBearerToken(accessToken); + + var url = _configuration["RemoteServices:Payments:BaseUrl"] + + "api/Payments/sample/authorized"; + + var responseMessage = await httpClient.GetAsync(url); + if (responseMessage.IsSuccessStatusCode) + { + var responseString = await responseMessage.Content.ReadAsStringAsync(); + Console.WriteLine("Result: " + responseString); + } + else + { + throw new Exception("Remote server returns error code: " + responseMessage.StatusCode); + } + } + } + + /* Shows how to use HttpClient to perform a request to the HTTP API. + * It obtains access token using IdentityServer's API. See its documentation: + * https://identityserver4.readthedocs.io/en/latest/quickstarts/2_resource_owner_passwords.html + */ + private async Task TestAllManuallyAsync() + { + Console.WriteLine(); + Console.WriteLine($"***** {nameof(TestAllManuallyAsync)} *****"); + + //Obtain access token from the IDS4 server + + // discover endpoints from metadata + var client = new HttpClient(); + var disco = await client.GetDiscoveryDocumentAsync(_configuration["IdentityClients:Default:Authority"]); + if (disco.IsError) + { + Console.WriteLine(disco.Error); + return; + } + + // request token + var tokenResponse = await client.RequestPasswordTokenAsync(new PasswordTokenRequest + { + Address = disco.TokenEndpoint, + ClientId = _configuration["IdentityClients:Default:ClientId"], + ClientSecret = _configuration["IdentityClients:Default:ClientSecret"], + UserName = _configuration["IdentityClients:Default:UserName"], + Password = _configuration["IdentityClients:Default:UserPassword"], + Scope = _configuration["IdentityClients:Default:Scope"] + }); + + if (tokenResponse.IsError) + { + Console.WriteLine(tokenResponse.Error); + return; + } + + Console.WriteLine(tokenResponse.Json); + + //Perform the actual HTTP request + + using (var httpClient = new HttpClient()) + { + httpClient.SetBearerToken(tokenResponse.AccessToken); + + var url = _configuration["RemoteServices:Payments:BaseUrl"] + + "api/Payments/sample/authorized"; + + var responseMessage = await httpClient.GetAsync(url); + if (responseMessage.IsSuccessStatusCode) + { + var responseString = await responseMessage.Content.ReadAsStringAsync(); + Console.WriteLine("Result: " + responseString); + } + else + { + throw new Exception("Remote server returns error code: " + responseMessage.StatusCode); + } + } + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs new file mode 100644 index 00000000..012a1d14 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs @@ -0,0 +1,26 @@ +using Microsoft.Extensions.Hosting; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; + +namespace EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp +{ + public class ConsoleTestAppHostedService : IHostedService + { + public async Task StartAsync(CancellationToken cancellationToken) + { + using (var application = AbpApplicationFactory.Create()) + { + application.Initialize(); + + var demo = application.ServiceProvider.GetRequiredService(); + await demo.RunAsync(); + + application.Shutdown(); + } + } + + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; + } +} diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/EShopPaymentConsoleApiClientModule.cs b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/EShopPaymentConsoleApiClientModule.cs new file mode 100644 index 00000000..22ab4d5f --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/EShopPaymentConsoleApiClientModule.cs @@ -0,0 +1,14 @@ +using Volo.Abp.Http.Client.IdentityModel; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Payments +{ + [DependsOn( + typeof(EShopPaymentsHttpApiClientModule), + typeof(AbpHttpClientIdentityModelModule) + )] + public class EShopPaymentsConsoleApiClientModule : AbpModule + { + + } +} diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp.csproj b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp.csproj new file mode 100644 index 00000000..3fca47fa --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp.csproj @@ -0,0 +1,26 @@ + + + + Exe + netcoreapp3.1 + EasyAbp.EShop.Payments + + + + + + + + + + + PreserveNewest + Always + + + + + + + + diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/Program.cs b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/Program.cs new file mode 100644 index 00000000..bb6cfe10 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/Program.cs @@ -0,0 +1,21 @@ +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +namespace EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp +{ + class Program + { + static async Task Main(string[] args) + { + await CreateHostBuilder(args).RunConsoleAsync(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureServices((hostContext, services) => + { + services.AddHostedService(); + }); + } +} diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/appsettings.json b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/appsettings.json new file mode 100644 index 00000000..9d6ca32a --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.HttpApi.Client.ConsoleTestApp/appsettings.json @@ -0,0 +1,21 @@ +{ + "RemoteServices": { + "Default": { + "BaseUrl": "https://localhost:44376/" + }, + "Payments": { + "BaseUrl": "https://localhost:44344/" + } + }, + "IdentityClients": { + "Default": { + "GrantType": "password", + "ClientId": "Payments_ConsoleTestApp", + "ClientSecret": "1q2w3e*", + "UserName": "admin", + "UserPassword": "1q2w3E*", + "Authority": "https://localhost:44376/", + "Scope": "Payments" + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.MongoDB.Tests/EasyAbp.EShop.Payments.MongoDB.Tests.csproj b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.MongoDB.Tests/EasyAbp.EShop.Payments.MongoDB.Tests.csproj new file mode 100644 index 00000000..952bb09b --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.MongoDB.Tests/EasyAbp.EShop.Payments.MongoDB.Tests.csproj @@ -0,0 +1,17 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Payments + + + + + + + + + + diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.MongoDB.Tests/FodyWeavers.xml b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.MongoDB.Tests/FodyWeavers.xml new file mode 100644 index 00000000..be0de3a9 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.MongoDB.Tests/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.MongoDB.Tests/FodyWeavers.xsd b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.MongoDB.Tests/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.MongoDB.Tests/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/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.MongoDB.Tests/MongoDB/EShopPaymentMongoDbTestModule.cs b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.MongoDB.Tests/MongoDB/EShopPaymentMongoDbTestModule.cs new file mode 100644 index 00000000..08fb9465 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.MongoDB.Tests/MongoDB/EShopPaymentMongoDbTestModule.cs @@ -0,0 +1,29 @@ +using System; +using Mongo2Go; +using Volo.Abp; +using Volo.Abp.Data; +using Volo.Abp.Modularity; + +namespace EasyAbp.EShop.Payments.MongoDB +{ + [DependsOn( + typeof(EShopPaymentsTestBaseModule), + typeof(EShopPaymentsMongoDbModule) + )] + public class EShopPaymentsMongoDbTestModule : AbpModule + { + private static readonly MongoDbRunner MongoDbRunner = MongoDbRunner.Start(); + + public override void ConfigureServices(ServiceConfigurationContext context) + { + var connectionString = MongoDbRunner.ConnectionString.EnsureEndsWith('/') + + "Db_" + + Guid.NewGuid().ToString("N"); + + Configure(options => + { + options.ConnectionStrings.Default = connectionString; + }); + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.MongoDB.Tests/MongoDB/PaymentsMongoDbTestBase.cs b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.MongoDB.Tests/MongoDB/PaymentsMongoDbTestBase.cs new file mode 100644 index 00000000..41e61d24 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.MongoDB.Tests/MongoDB/PaymentsMongoDbTestBase.cs @@ -0,0 +1,10 @@ +namespace EasyAbp.EShop.Payments.MongoDB +{ + /* This class can be used as a base class for MongoDB integration tests, + * while SampleRepository_Tests uses a different approach. + */ + public abstract class PaymentsMongoDbTestBase : PaymentsTestBase + { + + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/EShopPaymentTestBaseModule.cs b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/EShopPaymentTestBaseModule.cs new file mode 100644 index 00000000..36c9dc66 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/EShopPaymentTestBaseModule.cs @@ -0,0 +1,42 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; +using Volo.Abp.Authorization; +using Volo.Abp.Autofac; +using Volo.Abp.Data; +using Volo.Abp.Modularity; +using Volo.Abp.Threading; + +namespace EasyAbp.EShop.Payments +{ + [DependsOn( + typeof(AbpAutofacModule), + typeof(AbpTestBaseModule), + typeof(AbpAuthorizationModule), + typeof(EShopPaymentsDomainModule) + )] + public class EShopPaymentsTestBaseModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddAlwaysAllowAuthorization(); + } + + public override void OnApplicationInitialization(ApplicationInitializationContext context) + { + SeedTestData(context); + } + + private static void SeedTestData(ApplicationInitializationContext context) + { + AsyncHelper.RunSync(async () => + { + using (var scope = context.ServiceProvider.CreateScope()) + { + await scope.ServiceProvider + .GetRequiredService() + .SeedAsync(); + } + }); + } + } +} diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/EasyAbp.EShop.Payments.TestBase.csproj b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/EasyAbp.EShop.Payments.TestBase.csproj new file mode 100644 index 00000000..798e61db --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/EasyAbp.EShop.Payments.TestBase.csproj @@ -0,0 +1,23 @@ + + + + + + netcoreapp3.1 + EasyAbp.EShop.Payments + + + + + + + + + + + + + + + + diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/FodyWeavers.xml b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/FodyWeavers.xml new file mode 100644 index 00000000..be0de3a9 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/FodyWeavers.xsd b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/FodyWeavers.xsd new file mode 100644 index 00000000..3f3946e2 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/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/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/PaymentsDataSeedContributor.cs b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/PaymentsDataSeedContributor.cs new file mode 100644 index 00000000..5c322573 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/PaymentsDataSeedContributor.cs @@ -0,0 +1,27 @@ +using System.Threading.Tasks; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Guids; + +namespace EasyAbp.EShop.Payments +{ + public class PaymentsDataSeedContributor : IDataSeedContributor, ITransientDependency + { + private readonly IGuidGenerator _guidGenerator; + + public PaymentsDataSeedContributor( + IGuidGenerator guidGenerator) + { + _guidGenerator = guidGenerator; + } + + public Task SeedAsync(DataSeedContext context) + { + /* Instead of returning the Task.CompletedTask, you can insert your test data + * at this point! + */ + + return Task.CompletedTask; + } + } +} \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/PaymentsTestBase.cs b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/PaymentsTestBase.cs new file mode 100644 index 00000000..24a48aa4 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/PaymentsTestBase.cs @@ -0,0 +1,60 @@ +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; +using Volo.Abp.Modularity; +using Volo.Abp.Uow; +using Volo.Abp.Testing; + +namespace EasyAbp.EShop.Payments +{ + /* All test classes are derived from this class, directly or indirectly. */ + public abstract class PaymentsTestBase : AbpIntegratedTest + where TStartupModule : IAbpModule + { + protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options) + { + options.UseAutofac(); + } + + protected virtual Task WithUnitOfWorkAsync(Func func) + { + return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); + } + + protected virtual async Task WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, Func action) + { + using (var scope = ServiceProvider.CreateScope()) + { + var uowManager = scope.ServiceProvider.GetRequiredService(); + + using (var uow = uowManager.Begin(options)) + { + await action(); + + await uow.CompleteAsync(); + } + } + } + + protected virtual Task WithUnitOfWorkAsync(Func> func) + { + return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); + } + + protected virtual async Task WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, Func> func) + { + using (var scope = ServiceProvider.CreateScope()) + { + var uowManager = scope.ServiceProvider.GetRequiredService(); + + using (var uow = uowManager.Begin(options)) + { + var result = await func(); + await uow.CompleteAsync(); + return result; + } + } + } + } +} diff --git a/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/Security/FakeCurrentPrincipalAccessor.cs b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/Security/FakeCurrentPrincipalAccessor.cs new file mode 100644 index 00000000..155021f0 --- /dev/null +++ b/modules/EasyAbp.EShop.Payments/test/EasyAbp.EShop.Payments.TestBase/Security/FakeCurrentPrincipalAccessor.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using System.Security.Claims; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Security.Claims; + +namespace EasyAbp.EShop.Payments.Security +{ + [Dependency(ReplaceServices = true)] + public class FakeCurrentPrincipalAccessor : ICurrentPrincipalAccessor, ISingletonDependency + { + public ClaimsPrincipal Principal => GetPrincipal(); + private ClaimsPrincipal _principal; + + private ClaimsPrincipal GetPrincipal() + { + if (_principal == null) + { + lock (this) + { + if (_principal == null) + { + _principal = new ClaimsPrincipal( + new ClaimsIdentity( + new List + { + new Claim(AbpClaimTypes.UserId,"2e701e62-0953-4dd3-910b-dc6cc93ccb0d"), + new Claim(AbpClaimTypes.UserName,"admin"), + new Claim(AbpClaimTypes.Email,"admin@abp.io") + } + ) + ); + } + } + } + + return _principal; + } + } +}