diff --git a/src/front/Api/Auth/IdNot/index.ts b/src/front/Api/Auth/IdNot/index.ts index b358b6c8..e073cae8 100644 --- a/src/front/Api/Auth/IdNot/index.ts +++ b/src/front/Api/Auth/IdNot/index.ts @@ -19,7 +19,7 @@ export default class Auth extends BaseApiService { try { return await fetch(url); } catch (err) { - console.log(err); + console.error(err); this.onError(err); return Promise.reject(err); } @@ -27,25 +27,28 @@ export default class Auth extends BaseApiService { public async loginWithIdNot() { const variables = FrontendVariables.getInstance(); - const url = new URL(`${variables.IDNOT_BASE_URL + variables.IDNOT_AUTHORIZE_ENDPOINT}?client_id=${variables.IDNOT_CLIENT_ID}&redirect_uri=${variables.FRONT_APP_HOST}/authorized-client&scope=openid,profile&response_type=code`); + const url = new URL( + `${variables.IDNOT_BASE_URL + variables.IDNOT_AUTHORIZE_ENDPOINT}?client_id=${variables.IDNOT_CLIENT_ID}&redirect_uri=${ + variables.FRONT_APP_HOST + }/authorized-client&scope=openid,profile&response_type=code`, + ); try { return await this.getRequest(url); - } catch (err) { - this.onError(err); - return Promise.reject(err); - } - } - - public async getIdnotJwt(autorizationCode: string | string[]): Promise<{accessToken: string, refreshToken: string}> { - const variables = FrontendVariables.getInstance(); - const baseBackUrl = variables.BACK_API_PROTOCOL + variables.BACK_API_HOST; - const url = new URL(`${baseBackUrl}/api/v1/idnot/user/${autorizationCode}`); - try { - return await this.postRequest<{accessToken: string, refreshToken: string}>(url); } catch (err) { this.onError(err); return Promise.reject(err); } } - + + public async getIdnotJwt(autorizationCode: string | string[]): Promise<{ accessToken: string; refreshToken: string }> { + const variables = FrontendVariables.getInstance(); + const baseBackUrl = variables.BACK_API_PROTOCOL + variables.BACK_API_HOST; + const url = new URL(`${baseBackUrl}/api/v1/idnot/user/${autorizationCode}`); + try { + return await this.postRequest<{ accessToken: string; refreshToken: string }>(url); + } catch (err) { + this.onError(err); + return Promise.reject(err); + } + } } diff --git a/src/front/Api/LeCoffreApi/Admin/Stripe/Stripe.ts b/src/front/Api/LeCoffreApi/Admin/Stripe/Stripe.ts index 365bc894..0a087c37 100644 --- a/src/front/Api/LeCoffreApi/Admin/Stripe/Stripe.ts +++ b/src/front/Api/LeCoffreApi/Admin/Stripe/Stripe.ts @@ -14,6 +14,11 @@ export type IGetClientPortalSessionResponse = { url: string; }; +export interface IGetCustomerBySubscriptionIdParams { + email: string; + name: string; +} + export default class Stripe extends BaseAdmin { private static instance: Stripe; private readonly baseURl = this.namespaceUrl.concat("/stripe"); @@ -53,4 +58,14 @@ export default class Stripe extends BaseAdmin { return Promise.reject(err); } } + + public async getCustomerBySubscriptionId(subscriptionId: string) { + const url = new URL(this.baseURl.concat(`/${subscriptionId}/customer`)); + try { + return await this.getRequest(url); + } catch (err) { + this.onError(err); + return Promise.reject(err); + } + } } diff --git a/src/front/Components/DesignSystem/CheckBox/classes.module.scss b/src/front/Components/DesignSystem/CheckBox/classes.module.scss index aa5931a3..42530455 100644 --- a/src/front/Components/DesignSystem/CheckBox/classes.module.scss +++ b/src/front/Components/DesignSystem/CheckBox/classes.module.scss @@ -4,6 +4,9 @@ cursor: pointer; display: flex; align-items: center; + &.disabled { + cursor: not-allowed; + } input[type="checkbox"] { appearance: none; @@ -15,6 +18,10 @@ margin-right: 16px; display: grid; place-content: center; + + &:disabled { + cursor: not-allowed; + } } input[type="checkbox"]::before { diff --git a/src/front/Components/DesignSystem/CheckBox/index.tsx b/src/front/Components/DesignSystem/CheckBox/index.tsx index 4935ca95..3e7b30d6 100644 --- a/src/front/Components/DesignSystem/CheckBox/index.tsx +++ b/src/front/Components/DesignSystem/CheckBox/index.tsx @@ -4,6 +4,7 @@ import { IOption } from "../Form/SelectField"; import Tooltip from "../ToolTip"; import Typography, { ITypo, ITypoColor } from "../Typography"; import classes from "./classes.module.scss"; +import classNames from "classnames"; type IProps = { name?: string; @@ -11,6 +12,7 @@ type IProps = { toolTip?: string; onChange?: (e: React.ChangeEvent) => void; checked: boolean; + disabled?: boolean; }; type IState = { @@ -21,6 +23,7 @@ export default class CheckBox extends React.Component { static defaultProps = { toolTip: "", checked: false, + disabled: false, }; constructor(props: IProps) { @@ -35,13 +38,14 @@ export default class CheckBox extends React.Component { public override render(): JSX.Element { return ( -