mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-04 08:00:41 +08:00

* feat: integrate billing api and wire up billing ui * feat: show billing to admin only if on plans other than basic plan * feat: show billing to admin only if on plans other than basic plan * feat: update notfound snapshot * chore: fix billing sidenav logic * chore: fix several bugs * chore: backend fix for billing * fix: window.open pop blocker issue and error ui (#3750) --------- Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com> Co-authored-by: Rajat Dabade <rajat@signoz.io>
32 lines
846 B
TypeScript
32 lines
846 B
TypeScript
import axios from 'api';
|
|
import { ErrorResponseHandler } from 'api/ErrorResponseHandler';
|
|
import { AxiosError } from 'axios';
|
|
import { ErrorResponse, SuccessResponse } from 'types/api';
|
|
import {
|
|
CheckoutRequestPayloadProps,
|
|
CheckoutSuccessPayloadProps,
|
|
} from 'types/api/billing/checkout';
|
|
|
|
const updateCreditCardApi = async (
|
|
props: CheckoutRequestPayloadProps,
|
|
): Promise<SuccessResponse<CheckoutSuccessPayloadProps> | ErrorResponse> => {
|
|
try {
|
|
const response = await axios.post('/checkout', {
|
|
licenseKey: props.licenseKey,
|
|
successURL: props.successURL,
|
|
cancelURL: props.cancelURL, // temp
|
|
});
|
|
|
|
return {
|
|
statusCode: 200,
|
|
error: null,
|
|
message: response.data.status,
|
|
payload: response.data.data,
|
|
};
|
|
} catch (error) {
|
|
return ErrorResponseHandler(error as AxiosError);
|
|
}
|
|
};
|
|
|
|
export default updateCreditCardApi;
|