Complete buy flow

This commit is contained in:
2023-01-12 21:36:31 +00:00
parent bcdf035063
commit 192877c5d2
7 changed files with 170 additions and 27 deletions

View File

@ -25,7 +25,11 @@ export type HandleAvailability = {
export type HandleQuote = {
price: number,
data: any
data: HandleData
}
export type HandleData = {
type: string | "premium" | "short"
}
export type HandleRegisterResponse = {
@ -35,6 +39,12 @@ export type HandleRegisterResponse = {
token: string
}
export type CheckRegisterResponse = {
available: boolean,
paid: boolean,
password: string
}
export class ServiceProvider {
readonly url: URL | string
@ -54,7 +64,7 @@ export class ServiceProvider {
return await this._GetJson("/registration/register", "PUT", { name: handle, domain, pk: pubkey });
}
async CheckRegistration(token: string): Promise<any> {
async CheckRegistration(token: string): Promise<CheckRegisterResponse | ServiceError> {
return await this._GetJson("/registration/register/check", "POST", undefined, {
authorization: token
});