For now, you can include AbpPaymentApplicationModule in your Web project as a workaround until we'll release an update for it
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
If you place a select something like this: https://github.com/abpframework/abp/blob/b1170998f78a676c8685cde587282ac558f3e181/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml#L57
you can initialize from js like this: https://github.com/abpframework/abp/blob/b1170998f78a676c8685cde587282ac558f3e181/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/create.js#L23-L33
It's a good example from the CmsKit Blog selection
You need to replace XXX.Application
and XXX.EntityFrameworkCore
packages with XXX.HttpApi.Client
package for each module in Blazor.Server.Host project
Also, you need to remove your Kuys.Module.EmployeeManagement.Application
and Kuys.Module.EmployeeManagement.EntityFrameworkCore
project references from your Blazor.Server.Host project and add Kuys.Module.EmployeeManagement.HttpApi.Client
project reference to it.
After those changes make sure your AuthServer and RemoteServices configurations are made properly.
You can create a tiered project with following command and compare configuration.
abp new MyTieredBlazorApp --tiered -u blazor-server
Ok, got it. You need a tiered solution for Blazor-Server right?
Yes, webhooks are handled in HttpApi package. You need to configure WebHookSecret
in StripeOptions for the project which includes that HttpApi package.
If you complete this step for configuring webhooks, it'll update the status of PaymentRequest entities according to webhook feeds.
I think problem occurs following check from source code of Payment Module:
public class StripePaymentGateway : IPaymentGateway, ITransientDependency
{
public bool IsValid(PaymentRequest paymentRequest, Dictionary<string, object> properties)
{
var sessionId = properties["SessionId"]?.ToString();
if (sessionId.IsNullOrWhiteSpace())
{
throw new Exception("Empty SessionId.");
}
var sessionService = new SessionService();
var session = sessionService.Get(sessionId);
if (!session.PaymentStatus.Equals("paid", StringComparison.InvariantCulture))
{
throw new Exception("Session not paid.");
}
return session.Metadata["PaymentRequestId"] == paymentRequest.Id.ToString();
}
}
Can you check if session.Metadata["PaymentRequestId"]
is set or not?
Hi @murat.yuceer
Firstly, can you share steps to reproduce that error you faced?
How can I say to suite, create module project but blazor server host should be work like web assembly(not unified)
Doesn't the following command with ABP CLI solve your problem at the moment?
abp new Module2376 -t module
And those projects below you should run for test.
You can remove all UI projects except Blazor & Blazor WebAssembly.
So at that exception:
"System.Collections.Generic.KeyNotFoundException: The given key 'PaymentRequestId' was not present in the dictionary."
Can you see a file path and line number? I need entire exception stacktrace right now because your usage looks it is right
Hi @marketbus
Actually, I do not really care about the other Gateways. I intend on only using Stripe. Can you provide an example of how this will be done to integrate it with ABP?
Otherwise, I will have to write out my own Stripe integration.
At a high level, It would seem that I would use IPaymentRequestAppService to create a PaymentRequest. Map the PaymentRequest to a Stripe LineItems Object. Create a session using the Session Service. Then pass that SessionId to IPaymentRequestAppService's CompleteAsync method.
One of the main reasons why I signed up for the Commercial version of ABP, is actually because of the payments module. I am a sole developer, it's not really worth it to upgrade to one of your higher plans that include the complete source code. The payment's module without proper Blazor support seems incomplete.
Main point of Payment module is supporting more than one provider at the same time and let use to choose payment method. It's all about abstraction and yes you have to create a PaymentRequest and then that PaymentRequest must be paid.
I'm sorry about if the module doesn't meet your requirements. We'll work on according your feedbacks, thanks.
I basically followed the method that I mentioned above, and everything works, however, when I try to complete the transaction by calling CompleteAsync on the PaymentRequestAppService it throws an exception
"System.Collections.Generic.KeyNotFoundException: The given key 'PaymentRequestId' was not present in the dictionary."
I am able to verify that the transaction has been completed in the stripe dashboard, however, I would like it to be updated on the admin page as well.
If you please share code blocks where IPaymentRequestAppService is used. So I can understand the exception and find a solution.