Portail de facturation : le bouton manquait, et l'écran n'affichait rien du tout hors essai — if (isTrialActive) enveloppait le seul bouton, donc un client payant arrivait sur un écran sans action. Désormais Checkout pendant l'essai, portail après ; les deux ne coexistent jamais. Le 409 a son propre message : les instances venues de Mongo n'ont pas de StripeCustomerId, « réessayez plus tard » les ferait attendre quelque chose qui n'arrivera jamais. Diviseur de questions : guide_ia_screen lit aiTokensPerQuestion du serveur au lieu du /1000 codé en dur, par appel http direct — le motif déjà établi dans cet écran pour knowledge et insights. Si l'appel échoue, la ligne « ~N questions » disparaît plutôt que d'afficher un repli : sur une jauge qui sert à décider d'un achat, pas de chiffre vaut mieux qu'un chiffre faux, ce que le /1000 faisait depuis le début à un facteur 10 près. manager_api_new étendu à la main, générateur non relancé. 4 clés i18n FR/EN/NL. flutter analyze lib sans erreur, flutter build web OK. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
85 lines
2.9 KiB
Dart
85 lines
2.9 KiB
Dart
//
|
|
// Manually added (not generated) — mirrors OnboardingController.CreateCheckoutSession
|
|
// and CreateBillingPortalSession.
|
|
// Do not run the OpenAPI generator on this file, it would be overwritten.
|
|
//
|
|
// @dart=2.18
|
|
|
|
part of openapi.api;
|
|
|
|
class OnboardingApi {
|
|
OnboardingApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient;
|
|
|
|
final ApiClient apiClient;
|
|
|
|
/// Performs an HTTP 'POST /api/onboarding/checkout-session' operation and returns the [Response].
|
|
Future<Response> onboardingCreateCheckoutSessionWithHttpInfo() async {
|
|
// ignore: prefer_const_declarations
|
|
final path = r'/api/onboarding/checkout-session';
|
|
|
|
final queryParams = <QueryParam>[];
|
|
final headerParams = <String, String>{};
|
|
final formParams = <String, String>{};
|
|
|
|
const contentTypes = <String>['application/json'];
|
|
|
|
return apiClient.invokeAPI(
|
|
path,
|
|
'POST',
|
|
queryParams,
|
|
null,
|
|
headerParams,
|
|
formParams,
|
|
contentTypes.isEmpty ? null : contentTypes.first,
|
|
);
|
|
}
|
|
|
|
/// Returns the Stripe Checkout Session URL to redirect the user to.
|
|
Future<String> onboardingCreateCheckoutSession() async {
|
|
final response = await onboardingCreateCheckoutSessionWithHttpInfo();
|
|
if (response.statusCode >= HttpStatus.badRequest) {
|
|
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
|
}
|
|
final body = await _decodeBodyBytes(response);
|
|
final decoded = jsonDecode(body) as Map<String, dynamic>;
|
|
return decoded['url'] as String;
|
|
}
|
|
|
|
/// Performs an HTTP 'POST /api/onboarding/billing-portal' operation and returns the [Response].
|
|
Future<Response> onboardingCreateBillingPortalSessionWithHttpInfo() async {
|
|
// ignore: prefer_const_declarations
|
|
final path = r'/api/onboarding/billing-portal';
|
|
|
|
final queryParams = <QueryParam>[];
|
|
final headerParams = <String, String>{};
|
|
final formParams = <String, String>{};
|
|
|
|
const contentTypes = <String>['application/json'];
|
|
|
|
return apiClient.invokeAPI(
|
|
path,
|
|
'POST',
|
|
queryParams,
|
|
null,
|
|
headerParams,
|
|
formParams,
|
|
contentTypes.isEmpty ? null : contentTypes.first,
|
|
);
|
|
}
|
|
|
|
/// Returns the Stripe Billing Portal URL to redirect the user to.
|
|
///
|
|
/// Throws an [ApiException] with status 409 when the instance has no Stripe customer —
|
|
/// the case of every instance that came from the Mongo migration rather than from
|
|
/// self-service sign-up. The caller must tell those two apart.
|
|
Future<String> onboardingCreateBillingPortalSession() async {
|
|
final response = await onboardingCreateBillingPortalSessionWithHttpInfo();
|
|
if (response.statusCode >= HttpStatus.badRequest) {
|
|
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
|
}
|
|
final body = await _decodeBodyBytes(response);
|
|
final decoded = jsonDecode(body) as Map<String, dynamic>;
|
|
return decoded['url'] as String;
|
|
}
|
|
}
|