Open Closed

Concurrency exception when I use PaymentModule with own PaymentRequestGateway #8608


User avatar
0
ageiter created
  • ABP Framework version: v8.2.2
  • UI Type: Blazor Server
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no

We use the PaymentModule for payment processing via Stripe. Because we want to store various additional information (e.g. about the invoice) in the payment request, we have derived from the StripePaymentGateway and overwritten the CompleteAsync & HandleWebhookAsync methods, for example.

Now we always have concurrency exceptions because the PaymentModule in the PaymentRequestAppService probably also updates the PaymentRequest at the same time.

We have secured our methods with a semaphore so that the processing of our webhook events is synchronized and they cannot access the PaymentRequest at the same time. I have the code from your StripePaymentRequestGateway and we have overwritten all the corresponding methods there, so no relevant code is executed there.

But what happens in your PaymentRequestAppService is still a black box for us.

  1. could you provide me with the code? Preferably from the whole PaymentModule, if that is not possible, then at least from the PaymentRequestAppService.

  2. how should the problem be solved from your point of view? If you send events to the distributed event bus in the app service, then I won't be able to synchronize this with my own event processing, will I?

Thanks, Adrian


53 Answer(s)
  • User Avatar
    0
    ageiter created

    Thanks, I have now made the following change:

            // Initialize edition end date if it is not set or has expired
            if (!tenant.EditionEndDateUtc.HasValue || tenant.EditionEndDateUtc.Value < DateTime.UtcNow)
            {
                tenant.EditionEndDateUtc = DateTime.UtcNow;
                await TenantRepository.UpdateAsync(tenant);
            }
    
  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Thanks for your feedback, I'll ask and learn why this was done like that previously, and we'll update it as you mentioned if possible in the module.

            // Initialize edition end date if it is not set or has expired 
            if (!tenant.EditionEndDateUtc.HasValue || tenant.EditionEndDateUtc.Value < DateTime.UtcNow) 
            { 
                tenant.EditionEndDateUtc = DateTime.UtcNow; 
                await TenantRepository.UpdateAsync(tenant); 
            } 
    
  • User Avatar
    0
    ageiter created

    Thanks for your feedback, I'll ask and learn why this was done like that previously, and we'll update it as you mentioned if possible in the module.

    Great! Thanks.

Learn More, Pay Less
33% OFF
All Trainings!
Get Your Deal
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.0.0-preview. Updated on September 15, 2025, 14:41