Starts in:
1 DAY
6 HRS
16 MIN
33 SEC
Starts in:
1 D
6 H
16 M
33 S
Open Closed

Error when trying to create a PaymentRequest #2295


User avatar
0
Spospisil created
  • ABP Framework version: v4.4.4
  • UI type: MVC
  • DB provider: EF Core
  • **Tiered (MVC)

I am trying to create a subscription payment in my web (mvc) project from a test page and have references set ABPPaymentWebModule and AbpPaymentStripeWebModule but when I execute the 'CreateAsync' method on the PaymentRequestAppService I get the below error.

Can you tell me what the problem is?

public class IndexModel : PageModel
{
    private readonly IPaymentRequestAppService _paymentRequestAppService;
    protected ICurrentTenant CurrentTenant { get; }

    public IndexModel(IPaymentRequestAppService paymentrequestservice,
        ICurrentTenant currentTenant
        )
    {
        CurrentTenant = currentTenant;
        _paymentRequestAppService = paymentrequestservice;
    }

    public async Task<IActionResult> OnPostAsync()
    {
        var organizationId = Guid.NewGuid().ToString();

        var paymentRequestDto = new PaymentRequestCreateDto
        {
            ExtraProperties =
            {
                { "OrganizationId", organizationId },
                {
                    StripeConsts.GatewayName,
                    new StripePaymentRequestExtraParameterConfiguration
                    {
                        Currency = "USD",
                        Locale = "it",
                        PaymentMethodTypes = new List<string>()
                        {
                            "alipay",
                            "sofort"
                        },
                        AdditionalCallbackParameters = "s=1"
                    }
                }
            }
        };

        paymentRequestDto.Products.Add(new PaymentRequestProductCreateDto
        {
            Code = "001",
            Count = 1,
            Name = "Personal License",
            UnitPrice = 999,
            TotalPrice = 1 * 999
        });

        var paymentRequest = await _paymentRequestAppService.CreateAsync(paymentRequestDto);

        return LocalRedirectPreserveMethod("/Payment/GatewaySelection?paymentRequestId=" + paymentRequest.Id);

    }
    

2021-12-17 16:13:05.848 -05:00 [ERR] An unhandled exception has occurred while executing the request. Volo.Abp.AbpException: Could not found remote action for method: System.Threading.Tasks.Task1[Volo.Payment.Requests.PaymentRequestWithDetailsDto] CreateAsync(Volo.Payment.Requests.PaymentRequestCreateDto) on the URL: https://localhost:44300/ at Volo.Abp.Http.Client.DynamicProxying.ApiDescriptionFinder.FindActionAsync(HttpClient client, String baseUrl, Type serviceType, MethodInfo method) in C:\Src\StructureWeb\ABP\framework\src\Volo.Abp.Http.Client\Volo\Abp\Http\Client\DynamicProxying\ApiDescriptionFinder.cs:line 81 at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.MakeRequestAsync(IAbpMethodInvocation invocation) in C:\Src\StructureWeb\ABP\framework\src\Volo.Abp.Http.Client\Volo\Abp\Http\Client\DynamicProxying\DynamicHttpProxyInterceptor.cs:line 145 at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.MakeRequestAndGetResultAsync[T](IAbpMethodInvocation invocation) in C:\Src\StructureWeb\ABP\framework\src\Volo.Abp.Http.Client\Volo\Abp\Http\Client\DynamicProxying\DynamicHttpProxyInterceptor.cs:line 108 at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.GetResultAsync(Task task, Type resultType) in C:\Src\StructureWeb\ABP\framework\src\Volo.Abp.Http.Client\Volo\Abp\Http\Client\DynamicProxying\DynamicHttpProxyInterceptor.cs:line 99 at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.InterceptAsync(IAbpMethodInvocation invocation) in C:\Src\StructureWeb\ABP\framework\src\Volo.Abp.Http.Client\Volo\Abp\Http\Client\DynamicProxying\DynamicHttpProxyInterceptor.cs:line 90 at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) in C:\Src\StructureWeb\ABP\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAsyncAbpInterceptorAdapter.cs:line 29 at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() in C:\Src\StructureWeb\ABP\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAbpMethodInvocationAdapterWithReturnValue.cs:line 24 at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) in C:\Src\StructureWeb\ABP\framework\src\Volo.Abp.Validation\Volo\Abp\Validation\ValidationInterceptor.cs:line 19 at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) in C:\Src\StructureWeb\ABP\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAsyncAbpInterceptorAdapter.cs:line 29 at CFData.StructureWeb.Web.Pages.Jobs.IndexModel.OnPostAsync() in C:\Src\StructureWeb\aspnet-core\src\StructureWeb.Web\Pages\Jobs\Index.cshtml.cs:line 62 at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.GenericTaskHandlerMethod.Convert[T](Object taskAsObject) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.GenericTaskHandlerMethod.Execute(Object receiver, Object[] arguments) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync() at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync() at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Rethrow(PageHandlerExecutedContext context) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeInnerFilterAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeNextResourceFilter() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker) at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) at Volo.Abp.AspNetCore.Serilog.AbpSerilogMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) in C:\Src\StructureWeb\ABP\framework\src\Volo.Abp.AspNetCore.Serilog\Volo\Abp\AspNetCore\Serilog\AbpSerilogMiddleware.cs:line 65 at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext() --- End of stack trace from previous location --- at Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) in C:\Src\StructureWeb\ABP\framework\src\Volo.Abp.AspNetCore\Volo\Abp\AspNetCore\Auditing\AbpAuditingMiddleware.cs:line 52 at Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) in C:\Src\StructureWeb\ABP\framework\src\Volo.Abp.AspNetCore\Volo\Abp\AspNetCore\Auditing\AbpAuditingMiddleware.cs:line 81 at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext() --- End of stack trace from previous location --- at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) in C:\Src\StructureWeb\ABP\framework\src\Volo.Abp.AspNetCore.MultiTenancy\Volo\Abp\AspNetCore\MultiTenancy\MultiTenancyMiddleware.cs:line 75 at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) in C:\Src\StructureWeb\ABP\framework\src\Volo.Abp.AspNetCore\Microsoft\AspNetCore\RequestLocalization\AbpRequestLocalizationMiddleware.cs:line 51 at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context) 2021-12-17 16:13:05.898 -05:00 [INF] Request finished HTTP/2 POST https://localhost:44302/Jobs application/x-www-form-urlencoded 225 - 500 - text/html;+charset=utf-8 11508.6571ms


9 Answer(s)
  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Firstly, it seems you're using a tiered application right? Is your solution tiered?

    As I can see, you're using MVC UI with dynamic proxies at both js & csharp; So make sure your HttpApi.Host and Web projects include Volo.Payment.HttpApi dependency.

  • User Avatar
    0
    Spospisil created

    Yes, it's an MVC Tiered solution, however your suggestion did not resolve the issue. Can you please explain how the payment application service can be called directly from the web projects code?

    What I find a little odd is in you Volo.Payment.Application source you have 3 App Services defined for the Payment Module as shown below. However in the Volo.Payment.HttpAPI source there is a Gateway and Plan controller that essentially call the application services as shown above but you don't have a 'PaymentRequestController' in the HttpAPI project as shown below.

    Why is that?

  • User Avatar
    0
    Spospisil created

    I need a resolution to this asap.

  • User Avatar
    0
    Spospisil created

    No answer from support. Will submit another ticket

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Yes, it's an MVC Tiered solution, however your suggestion did not resolve the issue. Can you please explain how the payment application service can be called directly from the web projects code?

    What I find a little odd is in you Volo.Payment.Application source you have 3 App Services defined for the Payment Module as shown below. However in the Volo.Payment.HttpAPI source there is a Gateway and Plan controller that essentially call the application services as shown above but you don't have a 'PaymentRequestController' in the HttpAPI project as shown below.

    Why is that?

    Hi @Spospisil Payment operations are done by directly Web project for some security reasons. But in that case, you're right. It seems PaymentRequestController is missing. If we provide endpoints for that AppService, there will be a security problem. Because all complete or endpoints that perform update operations on PaymentReuqest will be accessible publicly. We'll

    work on this in the next version.


    Also your credit is refunded

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    For now, you can include AbpPaymentApplicationModule in your Web project as a workaround until we'll release an update for it

  • User Avatar
    0
    Spospisil created

    Yes, it's an MVC Tiered solution, however your suggestion did not resolve the issue. Can you please explain how the payment application service can be called directly from the web projects code?

    What I find a little odd is in you Volo.Payment.Application source you have 3 App Services defined for the Payment Module as shown below.

    However in the Volo.Payment.HttpAPI source there is a Gateway and Plan controller that essentially call the application services as shown above but you don't have a 'PaymentRequestController' in the HttpAPI project as shown below.

    Why is that?

    Hi @Spospisil Payment operations are done by directly Web project for some security reasons. But in that case, you're right. It seems PaymentRequestController is missing. If we provide endpoints for that AppService, there will be a security problem. Because all complete or endpoints that perform update operations on PaymentReuqest will be accessible publicly. We'll

    work on this in the next version.


    Also your credit is refunded

    I'm a little confused by your response given that the ABP documentation actually shows this PaymentRequestAppService being called directly from a MVC/Razor page thus implying that it's intent was to be a publicly accessible endpoint.

    Why would a action being called for the PaymentRequest app service be a security risk when it's sole purpose is to update/insert into a local database presumably behind a firewall, etc?

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    We'll work on those endpoints in the next milestone. It'll be compatible with distributed systems and tiered solutions.

    You can review how we do in eShopOnAbp. All logic will work on HttpApi instead of Web layer

  • User Avatar
    0
    Spospisil created

    Hi,

    One of the main reasons we purchased the commercial license was so we could easily integrate black box functions such as the Payment module with minimal coding to integrate into our solution.

    Based on the responses here it leaves the impression that at this point the Payment Module is not something that fits that model as the module itself should contain all logic to not only persist the payment requests to the DB but also handle the all the UI to process a payment as the documentation outlines (https://docs.abp.io/en/commercial/latest/modules/payment).

    Since I'm am following the code samples provided in the payment module documentation which appears to not be appropriate for a tiered/MVC solution and your suggested fix to my issue appears to implement persisting the payment request data myself vs having the Payment Module handle it (like it's advertised it should) as well as the subsequent ui involved in creating either a one time payment or recurring payment, I would like to get an idea of when the Payment Module will be a production ready module that can be integrated just like the other commercial modules we have purchased.

    I will need a timeline so I can set expectations with my employer.

    Thanks.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06