Open Closed

Payment MOdule #7704


User avatar
0
corne created
  • ABP Framework version: v8.1.5
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

We are trying to implement the Payment (and SaaS) module.

Admin UI in Angular works 100%, but posting to /Payment/GatewaySelection?paymentRequestId= + paymentRequest.Id returns a 404 error.

The payment module was installed using ABP Suite.

I have checked that AbpPaymentApplicationModule is added to MyApplicationModule as a dependency and have added my stripe config to appsettings.json :

"Payment": { "Stripe": { "PublishableKey": "pk_", "SecretKey": "sk_", "PaymentMethodTypes": [ "card" ], "Currency": "USD" } }

  1. What I cannot figure out from the documentation at https://abp.io/docs/latest/modules/payment is where do I configure PaymentWebOptions?
  2. Where do I check what I am missing for /Payment/GatewaySelection to give a 404 response?

5 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share your code and steps? or can you share a template project with your code?

    Thanks

    liming.ma@volosoft.com

  • User Avatar
    0
    corne created

    Hi,

    We used ABP Suite to boilerplate the solution (Including the SaaS module) and implemented all our functions. I then added the Payment module using abp suite (all packages - nuget and npm on 8.1.5).

    Solution Outline:

    Nuget Packages per solution are:

    .Application

     <PackageReference Include="Volo.Abp.PermissionManagement.Application" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.FeatureManagement.Application" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.SettingManagement.Application" Version="8.1.5" />
     <PackageReference Include="Volo.Chat.Application" Version="8.1.5" />
     <PackageReference Include="Volo.Payment.Admin.Application" Version="8.1.5" />
     <PackageReference Include="Volo.Payment.Application" Version="8.1.5" />
     <PackageReference Include="Volo.Saas.Host.Application" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.AuditLogging.Application" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.Identity.Pro.Application" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.OpenIddict.Pro.Application" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.Account.Pro.Public.Application" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.Account.Pro.Admin.Application" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.LanguageManagement.Application" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.TextTemplateManagement.Application" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.Gdpr.Application" Version="8.1.5" />
    

    .Application.Contracts

     <PackageReference Include="Volo.Abp.PermissionManagement.Application.Contracts" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.FeatureManagement.Application.Contracts" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.SettingManagement.Application.Contracts" Version="8.1.5" />
     <PackageReference Include="Volo.Chat.Application.Contracts" Version="8.1.5" />
     <PackageReference Include="Volo.Payment.Admin.Application.Contracts" Version="8.1.5" />
     <PackageReference Include="Volo.Payment.Application.Contracts" Version="8.1.5" />
     <PackageReference Include="Volo.Saas.Host.Application.Contracts" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.AuditLogging.Application.Contracts" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.Identity.Pro.Application.Contracts" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.OpenIddict.Pro.Application.Contracts" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.Account.Pro.Public.Application.Contracts" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.Account.Pro.Admin.Application.Contracts" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.LanguageManagement.Application.Contracts" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.TextTemplateManagement.Application.Contracts" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.Gdpr.Application.Contracts" Version="8.1.5" />
    

    .DbMigrator

    <PackageReference Include="Volo.Abp.Autofac" Version="8.1.5" />
    

    .Domain

    =

    <PackageReference Include="Volo.Abp.Emailing" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.Caching" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.MailKit" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.PermissionManagement.Domain.Identity" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.OpenIddict.Pro.Domain" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.PermissionManagement.Domain.OpenIddict" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.BackgroundJobs.Domain" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.AuditLogging.Domain" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.FeatureManagement.Domain" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.SettingManagement.Domain" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.BlobStoring.Database.Domain" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.Identity.Pro.Domain" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.LanguageManagement.Domain" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.TextTemplating.Scriban" Version="8.1.5" />
    <PackageReference Include="Volo.Chat.Domain" Version="8.1.5" />
    <PackageReference Include="Volo.Payment.Domain" Version="8.1.5" />
    <PackageReference Include="Volo.Payment.Iyzico.Domain" Version="8.1.5" />
    <PackageReference Include="Volo.Payment.PayPal.Domain" Version="8.1.5" />
    <PackageReference Include="Volo.Payment.Payu.Domain" Version="8.1.5" />
    <PackageReference Include="Volo.Payment.Stripe.Domain" Version="8.1.5" />
    <PackageReference Include="Volo.Payment.TwoCheckout.Domain" Version="8.1.5" />
    <PackageReference Include="Volo.Saas.Domain" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.TextTemplateManagement.Domain" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.Commercial.SuiteTemplates" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.Gdpr.Domain" Version="8.1.5" />
    

    . Domain.Shared

     <PackageReference Include="Volo.Abp.OpenIddict.Pro.Domain.Shared" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.BackgroundJobs.Domain.Shared" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.AuditLogging.Domain.Shared" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.FeatureManagement.Domain.Shared" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.PermissionManagement.Domain.Shared" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.SettingManagement.Domain.Shared" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.BlobStoring.Database.Domain.Shared" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.Identity.Pro.Domain.Shared" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.LanguageManagement.Domain.Shared" Version="8.1.5" />
     <PackageReference Include="Volo.Chat.Domain.Shared" Version="8.1.5" />
     <PackageReference Include="Volo.Payment.Domain.Shared" Version="8.1.5" />
     <PackageReference Include="Volo.Saas.Domain.Shared" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.TextTemplateManagement.Domain.Shared" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.Gdpr.Domain.Shared" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.GlobalFeatures" Version="8.1.5" />
    

    .EntityFrameworkCore

    <PackageReference Include="Volo.Chat.EntityFrameworkCore" Version="8.1.5" />
    <PackageReference Include="Volo.Payment.EntityFrameworkCore" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.OpenIddict.Pro.EntityFrameworkCore" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.BackgroundJobs.EntityFrameworkCore" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.AuditLogging.EntityFrameworkCore" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.FeatureManagement.EntityFrameworkCore" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.BlobStoring.Database.EntityFrameworkCore" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.Identity.Pro.EntityFrameworkCore" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.LanguageManagement.EntityFrameworkCore" Version="8.1.5" />
    <PackageReference Include="Volo.Saas.EntityFrameworkCore" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.TextTemplateManagement.EntityFrameworkCore" Version="8.1.5" />
    <PackageReference Include="Volo.Abp.Gdpr.EntityFrameworkCore" Version="8.1.5" />
    

    .HttpApi

     <PackageReference Include="Volo.Abp.Imaging.AspNetCore" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.PermissionManagement.HttpApi" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.FeatureManagement.HttpApi" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.SettingManagement.HttpApi" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.AuditLogging.HttpApi" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.Identity.Pro.HttpApi" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.Account.Pro.Admin.HttpApi" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.OpenIddict.Pro.HttpApi" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.LanguageManagement.HttpApi" Version="8.1.5" />
     <PackageReference Include="Volo.Chat.HttpApi" Version="8.1.5" />
     <PackageReference Include="Volo.Payment.Admin.HttpApi" Version="8.1.5" />
     <PackageReference Include="Volo.Payment.HttpApi" Version="8.1.5" />
     <PackageReference Include="Volo.Saas.Host.HttpApi" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.TextTemplateManagement.HttpApi" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.Gdpr.HttpApi" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.Account.Pro.Public.HttpApi" Version="8.1.5" />
    

    .HttpApi.Client

     <PackageReference Include="Volo.Abp.PermissionManagement.HttpApi.Client" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.FeatureManagement.HttpApi.Client" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.SettingManagement.HttpApi.Client" Version="8.1.5" />
     <PackageReference Include="Volo.Chat.HttpApi.Client" Version="8.1.5" />
     <PackageReference Include="Volo.Payment.Admin.HttpApi.Client" Version="8.1.5" />
     <PackageReference Include="Volo.Payment.HttpApi.Client" Version="8.1.5" />
     <PackageReference Include="Volo.Saas.Host.HttpApi.Client" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.AuditLogging.HttpApi.Client" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.Identity.Pro.HttpApi.Client" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.Account.Pro.Admin.HttpApi.Client" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.Account.Pro.Public.HttpApi.Client" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.OpenIddict.Pro.HttpApi.Client" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.LanguageManagement.HttpApi.Client" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.TextTemplateManagement.HttpApi.Client" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.Gdpr.HttpApi.Client" Version="8.1.5" />
    

    .HttpApi.Host

     <PackageReference Include="Volo.Abp.AspNetCore.MultiTenancy" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.Autofac" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.DistributedLocking" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.Swashbuckle" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.Account.Pro.Public.Web.OpenIddict" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.Account.Pro.Public.Web.Impersonation" Version="8.1.5" />
     <PackageReference Include="Volo.Chat.SignalR" Version="8.1.5" />
     <PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX" Version="3.1.4" />
    

    Code extracts relating to Payment module, as per documentation:

    .Application

    GembaCIApplicationModule.cs

       ...
      [DependsOn(typeof(AbpPaymentApplicationModule))]
      [DependsOn(typeof(AbpPaymentAdminApplicationModule))]
      public class GembaCIApplicationModule : AbpModule
      ...
    

    and

    ...
    public override void ConfigureServices(ServiceConfigurationContext context)
    {
      ...
       Configure<AbpSaasPaymentOptions>(options =>
       {
         options.IsPaymentSupported = true;
       });
    
    
       Configure<StripeOptions>(context.Services.GetConfiguration().GetSection("Payment:Stripe"));
      ...
    }
    

    .Application.Contracts

    GembaCIApplicationContractsModule.cs

    ...
        [DependsOn(typeof(AbpPaymentApplicationContractsModule))]
        [DependsOn(typeof(AbpPaymentAdminApplicationContractsModule))]
        public class GembaCIApplicationContractsModule : AbpModule
        {
    ...
    

    .Domain

    GembaCIDomainModule.cs

    ...
        [DependsOn(typeof(AbpPaymentDomainModule))]
        [DependsOn(typeof(AbpPaymentPayuDomainModule))]
        [DependsOn(typeof(AbpPaymentTwoCheckoutDomainModule))]
        [DependsOn(typeof(AbpPaymentIyzicoDomainModule))]
        [DependsOn(typeof(AbpPaymentPayPalDomainModule))]
        [DependsOn(typeof(AbpPaymentStripeDomainModule))]
        public class GembaCIDomainModule : AbpModule
        {
    ...
    

    .Domain.Shared

    GembaCIDomainSharedModule.cs

    ...
        [DependsOn(typeof(AbpPaymentDomainSharedModule))]
        public class GembaCIDomainSharedModule : AbpModule
        {
    ...
    

    .EntityFrameworkCore

    GembaCIDbContext.cs

    ...
         protected override void OnModelCreating(ModelBuilder builder)
         {
         ...
            builder.ConfigurePayment();
         ...
         }
    ...
    

    GembaCIEntityFrameworkCoreModule.cs

    ...
        [DependsOn(typeof(AbpPaymentEntityFrameworkCoreModule))]
        public class GembaCIEntityFrameworkCoreModule : AbpModule
        {
    ...
    

    .HttpApi

    GembaCIHttpApiModule.cs

    ...
         [DependsOn(typeof(AbpPaymentHttpApiModule))]
         [DependsOn(typeof(AbpPaymentAdminHttpApiModule))]
         public class GembaCIHttpApiModule : AbpModule
         {
    ...
    

    .HttpApi.Client

    GembaCIHttpApiClientModule.cs

    ...
        [DependsOn(typeof(AbpPaymentHttpApiClientModule))]
        [DependsOn(typeof(AbpPaymentAdminHttpApiClientModule))]
        public class GembaCIHttpApiClientModule : AbpModule
        {
    ...
    

    .HttpApi.Host

    appsettings.json

    ...
        "Payment": {
            "Stripe": {
                "PublishableKey": "pk_",
                "SecretKey": "sk_",
                "PaymentMethodTypes": [ "card" ],
                "Currency": "USD"
            }
        }    
    ...
    

    .HttpApi.Host

    GembaCIHttpApiHostModule.cs

    ...
        [DependsOn(typeof(AbpPaymentApplicationModule))]
        [DependsOn(typeof(AbpPaymentHttpApiModule))]
        public class GembaCIHttpApiHostModule : AbpModule
        {    
    ...
    

    Test Subscription Page Code Behind:

    private IPaymentRequestAppService PaymentRequestAppService { get; }
    
        public SubscriptionModel(IPaymentRequestAppService paymentRequestAppService)
        {
            PaymentRequestAppService = paymentRequestAppService;
        }
    
        public virtual async Task<IActionResult> OnPostAsync()
        {
            var paymentRequest = await PaymentRequestAppService.CreateAsync(
                new PaymentRequestCreateDto()
                {
                    Products =
                    {
                        new PaymentRequestProductCreateDto
                        {
                            PaymentType = PaymentType.Subscription,
                            Name = "RCA+,
                            Code = "NCA_PLUS",
                            Count = 1,
                            PlanId = "eaa4f5e2-781b-43e4-a16a-d2f19acd9b20", 
                        }
                    }
                });
    
            return LocalRedirectPreserveMethod("/Payment/GatewaySelection?paymentRequestId=" + paymentRequest.Id);
        }
    
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Is it LocalRedirectPreserveMethod("/Payment/GatewaySelection?paymentRequestId=" + paymentRequest.Id); get 404 error?

    Can you share the logs of 404 error and a test project?

    Thanks

    liming.ma@volosoft.com

  • User Avatar
    0
    corne created

    Hi, yes, its the there where I get the 404:

    The relevant logs are:

    [21:11:31 INF] Executed page /SubscriptionTest in 6443.2351ms [21:11:31 INF] Executed endpoint '/SubscriptionTest' [21:11:31 DBG] Added 0 entity changes to the current audit log [21:11:31 DBG] Added 0 entity changes to the current audit log [21:11:31 DBG] Added 0 entity changes to the current audit log [21:11:31 DBG] Added 0 entity changes to the current audit log [21:11:31 INF] Request finished HTTP/2 POST https://localhost:44353/SubscriptionTest - 307 0 null 6533.3188ms [21:11:31 INF] Request starting HTTP/2 POST https://localhost:44353/Payment/GatewaySelection?paymentRequestId=2694b528-c9ce-05fa-518a-3a1483606310 - application/x-www-form-urlencoded 272 [21:11:31 INF] CORS policy execution successful. [21:11:31 DBG] The event OpenIddict.Validation.OpenIddictValidationEvents+ProcessRequestContext was successfully processed by OpenIddict.Validation.AspNetCore.OpenIddictValidationAspNetCoreHandlers+ResolveRequestUri. [21:11:31 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ResolveRequestUri. [21:11:31 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.OpenIddictServerHandlers+InferEndpointType. [21:11:31 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by Volo.Abp.Account.Web.Pages.Account.OpenIddictImpersonateInferEndpointType. [21:11:31 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateTransportSecurityRequirement. [21:11:31 DBG] The event OpenIddict.Server.OpenIddictServerEvents+ProcessRequestContext was successfully processed by OpenIddict.Server.AspNetCore.OpenIddictServerAspNetCoreHandlers+ValidateHostHeader. [21:11:31 DBG] Get dynamic claims cache for user: 2d9ba82e-7276-3613-77c1-3a14824bbf73 [21:11:31 DBG] Added 0 entity changes to the current audit log [21:11:31 DBG] Added 0 entity changes to the current audit log [21:11:31 DBG] Added 0 entity changes to the current audit log [21:11:31 INF] Request finished HTTP/2 POST https://localhost:44353/Payment/GatewaySelection?paymentRequestId=2694b528-c9ce-05fa-518a-3a1483606310 - 404 0 null 8.9468ms [21:11:31 INF] Request reached the end of the middleware pipeline without being handled by application code. Request path: POST https://localhost:44353/Payment/GatewaySelection, Response status code: 404 [21:11:32 DBG] Executing HealthCheck collector HostedService.

    I have created a repo for the test project on github (ABPTest) and added you as a collaborator.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    https://github.com/corne-du-plooy/ABPTest/commit/c7e2c8b55ab892f7b81e648858c8eb31bc9e151c

Made with ❤️ on ABP v9.0.0-preview Updated on September 20, 2024, 08:30