Learn More, Pay Less!
Limited Time Offer!

Activities of "ageiter"

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.

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);
        }

Thank you for your answer @enisn.

Stripe offers different ways to upgrade, depending on the configuration. We use Stripe's customer portal, which the customer then uses to upgrade. This is also perfectly notified via the webhooks to our app and the StripePaymentGateway also handles this correctly (new edition is set to tenant). This is not the problem.

The problem is when the customer is already logged in and comes back to the page where he can choose the different subscriptions (no upgrade via our official way with the Stripe customer portal).

Can you provide me with the code for the method CreateSubscriptionAsync? Then I can overwrite it myself.

I have noticed the following problem in connection with the payment.

The following scenario:

  • Customer already has a valid subscription with an end date > today
  • The tenant EditionEndDateUtc is a date in the future
  • Now he triggers a new PaymentRequest (e.g. because he wants to change the edition)
  • He cancels the payment (with the back button) and has therefore not made a payment

-> Result: His previously valid subscription has been deactivated, as the EditionEndDateUtc is automatically reset when the PaymentRequest is created.

How could the problem be solved? Why is the date changed in the tenant using the SubscriptionAppService.CreateSubscriptionAsync method, even if the payment has not yet been completed and there is already a valid date in it? What is the reason for this?

            var paymentRequest = await SubscriptionAppService.CreateSubscriptionAsync(editionId.Value, TenantId.Value);

            await RedirectToPaymentGateway(paymentRequest.Id);

How can I reproduce this exception in the template project?

Can you share a simple project or code and steps?

Unfortunately, I can't explain how you could reproduce this (as I don't know myself where these errors are coming from). But at the moment I don't have the time to look into it. However, it seems that it still works and the end user doesn't notice anything.

Can you check your question in Chrome dev-tool?

You can consider moving the js code to a function(PostPaymentGatewaySelectionForm), then Invoke this function in blazor.

await JSRuntime.InvokeVoidAsync("PostPaymentGatewaySelectionForm") 

Unfortunately, no success in this matter. That didn't help and I don't see anything relevant via the dev-tools either.

But generally I have exceptions of this kind again and again... but the end user doesn't notice anything.

hi

Yes, We have added { StripeConsts.ParameterNames.PaymentRequestId, paymentRequest.Id.ToString()} in the StartAsync method just like yours.

Ok, then it should work.

Now you just have to assign the date (otherwise the method is useless). And I would not update the PaymentRequest, but solve this via the event (as before).

        var paymentUpdatedEto = ObjectMapper.Map<PaymentRequest, SubscriptionUpdatedEto>(paymentRequest);

        paymentUpdatedEto.PeriodEndDate = ConvertToDateTime((int)stripeEvent.Data.RawObject.current_period_end);

        await EventBus.PublishAsync(paymentUpdatedEto);

Have you tested this?

It will only work if you have also adapted the StartAsync method (PaymentRequestId in the metadata of the subscription). This is because the RawObject is a subscription and not a session, as is the case with HandleCheckoutSessionCompletedAsync, for example.

In addition, the date is not assigned. And finally, you make an update to the PaymentRequest, although you have not changed anything.

It just irritates me because it always happens (every time) after the StartAsync. So when redirecting to the PaymentGateway. At a time when no WebHooks are being received.

Maybe it has something to do with the way I submit the request...

    private async Task RedirectToPaymentGateway(Guid paymentRequestId)
    {
        var tokens = Antiforgery.GetAndStoreTokens(HttpContextAccessor.HttpContext);
        var requestToken = tokens.RequestToken;

        var uri = $"/Payment/GatewaySelection?paymentRequestId={paymentRequestId}";
        
        await JSRuntime.InvokeVoidAsync("eval", $@"
            (function() {{
                var form = document.getElementById('PaymentGatewaySelectionForm');
                
                // Check if the antiforgery token is present in the form, if the token is not present, create a new hidden input field for the token
                var tokenInput = form.querySelector('input[name=__RequestVerificationToken]');
                if (!tokenInput) {{
                    tokenInput = document.createElement('input');
                    tokenInput.type = 'hidden';
                    tokenInput.name = '__RequestVerificationToken';
                    form.appendChild(tokenInput);
                }}
                
                // Set the value of the token
                tokenInput.value = '{requestToken}';

                // Update the form's action with the new URI and submit the form
                form.action = '{uri}';
                form.submit();
            }})();
        ");
    }

One last question about the payment process. You have probably also seen in my logs (which I sent you by e-mail) that the following error message always appears at the beginning of a payment request (after the StartAsync):

2025-01-16 19:55:43.645 +00:00 [INF] PalmaPaymentRequestAppService.StartAsync, Begin start payment request for payment gateway 'stripe'.   ThreadId='37'
2025-01-16 19:55:44.898 +00:00 [INF] PalmaPaymentRequestAppService.StartAsync, End start payment request for payment gateway 'stripe'.   ThreadId='38'
2025-01-16 19:55:45.102 +00:00 [WRN] The operation was canceled.
System.OperationCanceledException: The operation was canceled.
   at System.Threading.CancellationToken.ThrowOperationCanceledException()
   at Microsoft.Extensions.Caching.StackExchangeRedis.RedisCache.GetAsync(String key, CancellationToken token)
   at Volo.Abp.Caching.DistributedCache`2.GetAsync(TCacheKey key, Nullable`1 hideErrors, Boolean considerUow, CancellationToken token)
2025-01-16 19:55:45.173 +00:00 [ERR] Error when dispatching 'OnDisconnectedAsync' on hub.
System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at Volo.Abp.Threading.SemaphoreSlimExtensions.LockAsync(SemaphoreSlim semaphoreSlim, CancellationToken cancellationToken)
   at Volo.Abp.Caching.DistributedCache`2.GetOrAddAsync(TCacheKey key, Func`1 factory, Func`1 optionsFactory, Nullable`1 hideErrors, Boolean considerUow, CancellationToken token)
   at Volo.Abp.Identity.IdentityDynamicClaimsPrincipalContributorCache.GetAsync(Guid userId, Nullable`1 tenantId)
   at Volo.Abp.Identity.IdentityDynamicClaimsPrincipalContributor.ContributeAsync(AbpClaimsPrincipalContributorContext context)
   at Volo.Abp.Security.Claims.AbpClaimsPrincipalFactory.InternalCreateAsync(AbpClaimsPrincipalFactoryOptions options, ClaimsPrincipal existsClaimsPrincipal, Boolean isDynamic)
   at Volo.Abp.Security.Claims.AbpClaimsPrincipalFactory.CreateDynamicAsync(ClaimsPrincipal existsClaimsPrincipal)
   at Volo.Abp.AspNetCore.SignalR.Authentication.AbpAuthenticationHubFilter.HandleDynamicClaimsPrincipalAsync(ClaimsPrincipal claimsPrincipal, IServiceProvider serviceProvider, HubCallerContext hubCallerContext, Boolean skipCheckDynamicClaimsInterval)
   at Volo.Abp.AspNetCore.SignalR.Authentication.AbpAuthenticationHubFilter.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next)
   at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next)
   at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next)
   at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next)
   at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next)
   at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.OnDisconnectedAsync(HubConnectionContext connection, Exception exception)
   at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.OnDisconnectedAsync(HubConnectionContext connection, Exception exception)
   at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.HubOnDisconnectedAsync(HubConnectionContext connection, Exception exception)
2025-01-16 19:55:45.203 +00:00 [ERR] Failed disposing connection 3FgE5QW7nXvr8qTHdKaf_A.
System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at Volo.Abp.Threading.SemaphoreSlimExtensions.LockAsync(SemaphoreSlim semaphoreSlim, CancellationToken cancellationToken)
   at Volo.Abp.Caching.DistributedCache`2.GetOrAddAsync(TCacheKey key, Func`1 factory, Func`1 optionsFactory, Nullable`1 hideErrors, Boolean considerUow, CancellationToken token)
   at Volo.Abp.Identity.IdentityDynamicClaimsPrincipalContributorCache.GetAsync(Guid userId, Nullable`1 tenantId)
   at Volo.Abp.Identity.IdentityDynamicClaimsPrincipalContributor.ContributeAsync(AbpClaimsPrincipalContributorContext context)
   at Volo.Abp.Security.Claims.AbpClaimsPrincipalFactory.InternalCreateAsync(AbpClaimsPrincipalFactoryOptions options, ClaimsPrincipal existsClaimsPrincipal, Boolean isDynamic)
   at Volo.Abp.Security.Claims.AbpClaimsPrincipalFactory.CreateDynamicAsync(ClaimsPrincipal existsClaimsPrincipal)
   at Volo.Abp.AspNetCore.SignalR.Authentication.AbpAuthenticationHubFilter.HandleDynamicClaimsPrincipalAsync(ClaimsPrincipal claimsPrincipal, IServiceProvider serviceProvider, HubCallerContext hubCallerContext, Boolean skipCheckDynamicClaimsInterval)
   at Volo.Abp.AspNetCore.SignalR.Authentication.AbpAuthenticationHubFilter.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next)
   at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next)
   at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next)
   at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next)
   at Microsoft.AspNetCore.SignalR.Internal.HubFilterFactory.OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func`3 next)
   at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.OnDisconnectedAsync(HubConnectionContext connection, Exception exception)
   at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.OnDisconnectedAsync(HubConnectionContext connection, Exception exception)
   at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.HubOnDisconnectedAsync(HubConnectionContext connection, Exception exception)
   at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.RunHubAsync(HubConnectionContext connection)
   at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.OnConnectedAsync(ConnectionContext connection)
   at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.OnConnectedAsync(ConnectionContext connection)
   at Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionContext.ExecuteApplication(ConnectionDelegate connectionDelegate)
   at Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionContext.WaitOnTasks(Task applicationTask, Task transportTask, Boolean closeGracefully)
   at Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionContext.DisposeAsync(Boolean closeGracefully)
   at Microsoft.AspNetCore.Http.Connections.Internal.HttpConnectionManager.DisposeAndRemoveAsync(HttpConnectionContext connection, Boolean closeGracefully, HttpConnectionStopStatus status)

Why is this the case? How can I correct this?

Showing 1 to 10 of 237 entries
Made with ❤️ on ABP v9.2.0-preview. Updated on February 07, 2025, 05:40