Activities of "christophe.baille"

I tried this but nothing changed. I still need to logout and login to see changes.

I added the class they said on my blazor server project, then call it after app.UseAuthorization();

  • ABP Framework version: v5.0.0
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no

In my solution, I want to manage my tenants features based on Editions. To do so, I created some Editions which have features, then I assign editions to Tenants. All seems OK, until I update edition information on tenant table:

EditionEndDateUtc: When I change the EditionEndDateUtc on a tenant from future to past, I can see when login as host/admin user, then go to Tenant/Saas and features, they get disabled. If I change this date from past to future, they become enable, which is good. The update is done right away, no need to close the application, logout or anything.

Now I want to check features for my tenant user to let him use them or not,

from the menu contributor to show or not the menu: var currentFeature = context.ServiceProvider.GetRequiredService<IFeatureChecker>();

fron my applicationservice to let the user make the action or not: await _featureChecker.IsEnabledAsync("AIGeneratorFeatures." + item)

My problem is, in both cases, that the EditionEndDateUtc change will be effective only after the user logout and login again.

Is it a normal behave? For now I am checking EditionEndDateUtc of the tenant but it is not so great, any other possibility to do?

I then notice something a bit strange, the tenant has possibility to change edition, I then check from host/tenant and see features changed based on the edition. However, I met the issue that 2 tenants with the same edition do not have the same features, one of them have no features available anymore, then whatever I put another feature or anything, it remains empty... One here, "payno" do not have any features, but "daypayno" has. whatever I change the Edition for "payno", he is still without feature. Is there any other datas than EditionId and EditionEnd that could affect this?

I finally did implements using Stripe elements only and not using ABP modules

Yes, I use forceLoad: true

NavManager.NavigateTo("/GatewaySelection?paymentRequestId=" + paymentRequest.Id, forceLoad: true);

I usually run my application in incognito browser (Edge) and got this issue. I then tried to open a different browser (Firefox) in incognito to reach the url https://localhost:44307/GatewaySelection?paymentRequestId=22fdbffb-3f68-d619-d008-3a01cd5921be and still got the same issue 404 not found

Thanks for your reply.

I am not sure to understand, you said that I should override SubscriptionService which is on Saas module, at this point nothing is send to Stripe platform right? SubscriptionService seems only have the method CreateSubscriptionAsync which create an object PaymentRequestWithDetailsDto, then add a line on PayPaymentRequests table. Does this method interact to payment module about connecting to Stripe as well at this level? If I edit this service to save a TrialEnd on PayPaymentRequests table (On ExtraProperties for example), will it be enough?

Should I not override some code on payment module too?

From what I did test, this code on Stripe:

var options = new SubscriptionCreateOptions { Customer = "cus_4fdAW5ftNQow1a", Items = items, TrialEnd = DateTimeOffset.FromUnixTimeSeconds(1610403705).UtcDateTime, };

Is done at some point when I call this:

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

Because when calling /Payment/GatewaySelection... , I reach the Stripe view to get the customer information (name, email, card details, etc...). So only after submit this view, I am able to create the customer on Stripe, then create the subscription for this customer and related to the payment request created by SubscriptionService.

Let me know if I misunderstood please, my actual license do not let me access to any source code of modules Saas and payment.

NOTE: I Changed the title of the ticket as now the solution use Blazor Server instead Blazor WebAssembly

As I did not find much help or documentation about webassembly, I decided to replace Blazor Webassembly project by Blazor Server.

By doing this I do not have the issue 2- Let the user change his payment information as I can now use SessionCreateOptions on my razor page, I can then redirect to the billing page using navigationManager.NavigateTo

However, I still get my issue about 1- Let the user create a subscribtion, I did follow this post but still reach 404 not found

https://support.abp.io/QA/Questions/2251/Payments-Module-UI---Blazor-Server

I added both Volo.Payment.Web and Volo.Payment.Stripe.Web into Blazor project, but when I add this on my button action

var paymentRequest = await _subscriptionAppService.CreateSubscriptionAsync(EditionId, CurrentUser.TenantId.Value); NavManager.NavigateTo("/GatewaySelection?paymentRequestId=" + paymentRequest.Id, forceLoad: true);

I keep reaching Error 404 Page Not found.

But when I check the browser "Network" tab, it said the request is OK (200)

On the ticket I did mention previously, I see this:

Blazor Server works hybrid. it includes MVC endpoints too. If you redirect to /GatewaySelection?paymentRequestId=THE_ID_OF_PAYMENTREQUEST after creating a PaymentRequest, an MVC page will handle and a page will be shown for payment provider selection.

But it seems it does not happen on my case... Any help please?

  • ABP Framework version: v5.0.0
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no

Stripe payment module integration is working well in our application:

The user open the Mvc application and reach a page with a list of available plans, after choosing one, a new form asking information about the tenant appears. Once the user click save, we create the tenant, create a "Payment request" and redirect the user to Stripe about providing payment information and create subscribtion on Stripe:

Until here, all is working well.

In the solution, Mvc is use only for registration. If the user want to use other features of the solution, he needs to go to the Blazor application.

From Blazor Webassembly application, we want to let the user do 2 things from Stripe:

1- Let the user create a subscribtion

In case the user stop the process of registration from the Stripe page, he will be able to connect to Abp but will not have any subscribtion on his tenant.

So from the index page, I added a button which will create a "Payment request" then redirect him to Stripe:

I tried 2 different way but both fail

1- This method send GET request (which is not good):

I then got an error 400 Bad Request from the console with no much information. This method is not good anyway as we should send POST

2- This method send POST request:

I tried to send the webassembly to a controller

and use LocalRedirectPreserveMethod

I still got an error 400, on this way it send a POST request. The error seems that my request header is empty, which is not the case when I run LocalRedirectPreserveMethod from the MVC view (both Mvc view and the controller here are in the same project "host")

2- Let the user change his payment information

On my blazor UI, I want the user to be able to change his payment information on Stripe. To do this, I had his customer Id on the database and I try to redirect him to the Stripe platform (https://billing.stripe.com)

About doing this, I have no choice than send the user to a controller, so I can not use the method NavManager.NavigateTo

The reason to go through a controller is that I can not create a Stripe Billing portal session from Blazor Webassembly (I can not add the nuggets needed on Blazor project as it is Microsoft.NET.Sdk.BlazorWebAssembly based)

var options = new SessionCreateOptions { Customer = "cus_L012USkjMonYe6", ReturnUrl = "https://example.com/account", }; var service = new SessionService(); var session = service.Create(options);

I create my object on the controller, but when I try to use Return redirect(session.Url) I get a Cors error, even if I add https://billing.stripe.com on the appsettings CorsOrigins part.

I got this error in the browser

Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

So I was looking on how to add a header on redirect, but from what I found, it is not possible to define a Cors Header for the redirect method, so I can not use it.

Is there any package or method that I miss to redirect my "Blazor actions" to Stripe through Volo.Abp packages? If not, how I should proceed to redirect?

Thanks for your help

  • ABP Framework version: v5.0.0
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no

Our actual solution let the user subscribe to a plan while we create the tenant, once the tenant is created on ABP, we create a new subscription

_subscriptionAppService.CreateSubscriptionAsync(editionId, tenantId);

then redirect to the Stripe payment page

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

I had a look on Stripe documentation on how to add a trial period (https://stripe.com/docs/billing/subscriptions/trials) and it is mentionned to add a TrialEnd on SubscriptionCreate options:

var options = new SubscriptionCreateOptions { Customer = "cus_4fdAW5ftNQow1a", Items = items, TrialEnd = DateTimeOffset.FromUnixTimeSeconds(1610403705).UtcDateTime, };

From what I understand, ABP create this subscription with the code I mentionned before

_subscriptionAppService.CreateSubscriptionAsync(editionId, tenantId);

then use this result Id to send to the gateway

My problem here is that this method do not allow to provide a TrialEnd, and all entities related to subscription (Edition, Plan) do not have this property.

The payment request which subscriptionAppService generate do not have anything about it neither, so I guess it is not implemented?

So I would like to know if it is possible to define the TrialEnd period using ABP module? Or any other way to work around about making trial subscription?

Thanks

I added forceLoad: true on my class ViewDetails.razor.cs, so now it redirect to the url

https://localhost:44307/GatewaySelection?paymentRequestId=42912c2c-8956-2bd2-e0b4-3a015ec78851

which doesn't exist as I need to add both references Volo.Payment.Web and Volo.Payment.Stripe.Web on my Blazor project as you said. I then got a new error about

There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'browser-wasm'. C:\Program Files\dotnet\sdk\6.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets

After adding this references, I got an error, after some research on internet, I tried to replace

<PackageReference Include="Volo.Abp.Autofac.WebAssembly" Version="5.0.0" /> by <PackageReference Include="Volo.Abp.Autofac.Web" Version="5.0.0" />

and add

<UseBlazorWebAssembly>true</UseBlazorWebAssembly>

I can then run the application but Blazor application do not show anymore... I keep looking further as I migrate from ABP 4 to 5, I might have other things missing...

I understand that I should not ask more support on here as it is not my ticket, but I will ask, as Marketbus asked, if it is possible to have a sample solution to see on how it is implemented. I am far to be an expert on Blazor so it is pretty hard to implement this feature with only the MVC doc...

Thanks

After a payment request was created, you need to redirect to/Payment/GatewaySelection?paymentRequestId=THE_ID_OF_PAYMENTREQUEST endpoint. If that endpoint doesn't exist in your application make sure your project has Volo.Payment.HttpApi and Volo.Payment.Web dependencies.

--> Could you share the code on how you redirect to /GatewaySelection?paymentRequestId=THE_ID_OF_PAYMENTREQUEST on Blazor please? I made it work on Mvc host app, but I am new to Blazor and do not find out on which way I should do it... I tried httpClient.PostAsJsonAsync and navManager.NavigateTo but no luck so far.

Sorry to interrupt you and thanks in advance for your help :)

Showing 81 to 90 of 188 entries
Made with ❤️ on ABP v9.0.0-preview Updated on September 20, 2024, 08:30