new payment api changes
This commit is contained in:
parent
393f6c9c20
commit
e28e820286
|
@ -78,6 +78,7 @@ import {
|
||||||
OrganizationUserDetailsResponse,
|
OrganizationUserDetailsResponse,
|
||||||
OrganizationUserUserDetailsResponse,
|
OrganizationUserUserDetailsResponse,
|
||||||
} from '../models/response/organizationUserResponse';
|
} from '../models/response/organizationUserResponse';
|
||||||
|
import { PaymentResponse } from '../models/response/paymentResponse';
|
||||||
import { PreloginResponse } from '../models/response/preloginResponse';
|
import { PreloginResponse } from '../models/response/preloginResponse';
|
||||||
import { ProfileResponse } from '../models/response/profileResponse';
|
import { ProfileResponse } from '../models/response/profileResponse';
|
||||||
import { SelectionReadOnlyResponse } from '../models/response/selectionReadOnlyResponse';
|
import { SelectionReadOnlyResponse } from '../models/response/selectionReadOnlyResponse';
|
||||||
|
@ -118,7 +119,7 @@ export abstract class ApiService {
|
||||||
getAccountRevisionDate: () => Promise<number>;
|
getAccountRevisionDate: () => Promise<number>;
|
||||||
postPasswordHint: (request: PasswordHintRequest) => Promise<any>;
|
postPasswordHint: (request: PasswordHintRequest) => Promise<any>;
|
||||||
postRegister: (request: RegisterRequest) => Promise<any>;
|
postRegister: (request: RegisterRequest) => Promise<any>;
|
||||||
postPremium: (data: FormData) => Promise<any>;
|
postPremium: (data: FormData) => Promise<PaymentResponse>;
|
||||||
postReinstatePremium: () => Promise<any>;
|
postReinstatePremium: () => Promise<any>;
|
||||||
postCancelPremium: () => Promise<any>;
|
postCancelPremium: () => Promise<any>;
|
||||||
postAccountStorage: (request: StorageRequest) => Promise<any>;
|
postAccountStorage: (request: StorageRequest) => Promise<any>;
|
||||||
|
@ -241,7 +242,7 @@ export abstract class ApiService {
|
||||||
postOrganizationLicenseUpdate: (id: string, data: FormData) => Promise<any>;
|
postOrganizationLicenseUpdate: (id: string, data: FormData) => Promise<any>;
|
||||||
postOrganizationApiKey: (id: string, request: PasswordVerificationRequest) => Promise<ApiKeyResponse>;
|
postOrganizationApiKey: (id: string, request: PasswordVerificationRequest) => Promise<ApiKeyResponse>;
|
||||||
postOrganizationRotateApiKey: (id: string, request: PasswordVerificationRequest) => Promise<ApiKeyResponse>;
|
postOrganizationRotateApiKey: (id: string, request: PasswordVerificationRequest) => Promise<ApiKeyResponse>;
|
||||||
postOrganizationUpgrade: (id: string, request: OrganizationUpgradeRequest) => Promise<any>;
|
postOrganizationUpgrade: (id: string, request: OrganizationUpgradeRequest) => Promise<PaymentResponse>;
|
||||||
postOrganizationSeat: (id: string, request: SeatRequest) => Promise<any>;
|
postOrganizationSeat: (id: string, request: SeatRequest) => Promise<any>;
|
||||||
postOrganizationStorage: (id: string, request: StorageRequest) => Promise<any>;
|
postOrganizationStorage: (id: string, request: StorageRequest) => Promise<any>;
|
||||||
postOrganizationPayment: (id: string, request: PaymentRequest) => Promise<any>;
|
postOrganizationPayment: (id: string, request: PaymentRequest) => Promise<any>;
|
||||||
|
@ -263,6 +264,7 @@ export abstract class ApiService {
|
||||||
getHibpBreach: (username: string) => Promise<BreachAccountResponse[]>;
|
getHibpBreach: (username: string) => Promise<BreachAccountResponse[]>;
|
||||||
|
|
||||||
postBitPayInvoice: (request: BitPayInvoiceRequest) => Promise<string>;
|
postBitPayInvoice: (request: BitPayInvoiceRequest) => Promise<string>;
|
||||||
|
postSetupPayment: () => Promise<string>;
|
||||||
|
|
||||||
getActiveBearerToken: () => Promise<string>;
|
getActiveBearerToken: () => Promise<string>;
|
||||||
fetch: (request: Request) => Promise<Response>;
|
fetch: (request: Request) => Promise<Response>;
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { BaseResponse } from './baseResponse';
|
||||||
|
import { ProfileResponse } from './profileResponse';
|
||||||
|
|
||||||
|
export class PaymentResponse extends BaseResponse {
|
||||||
|
userProfile: ProfileResponse;
|
||||||
|
paymentIntentClientSecret: string;
|
||||||
|
success: boolean;
|
||||||
|
|
||||||
|
constructor(response: any) {
|
||||||
|
super(response);
|
||||||
|
const userProfile = this.getResponseProperty('UserProfile');
|
||||||
|
if (userProfile != null) {
|
||||||
|
this.userProfile = new ProfileResponse(userProfile);
|
||||||
|
}
|
||||||
|
this.paymentIntentClientSecret = this.getResponseProperty('PaymentIntentClientSecret');
|
||||||
|
this.success = this.getResponseProperty('Success');
|
||||||
|
}
|
||||||
|
}
|
|
@ -85,6 +85,7 @@ import {
|
||||||
OrganizationUserDetailsResponse,
|
OrganizationUserDetailsResponse,
|
||||||
OrganizationUserUserDetailsResponse,
|
OrganizationUserUserDetailsResponse,
|
||||||
} from '../models/response/organizationUserResponse';
|
} from '../models/response/organizationUserResponse';
|
||||||
|
import { PaymentResponse } from '../models/response/paymentResponse';
|
||||||
import { PreloginResponse } from '../models/response/preloginResponse';
|
import { PreloginResponse } from '../models/response/preloginResponse';
|
||||||
import { ProfileResponse } from '../models/response/profileResponse';
|
import { ProfileResponse } from '../models/response/profileResponse';
|
||||||
import { SelectionReadOnlyResponse } from '../models/response/selectionReadOnlyResponse';
|
import { SelectionReadOnlyResponse } from '../models/response/selectionReadOnlyResponse';
|
||||||
|
@ -253,8 +254,9 @@ export class ApiService implements ApiServiceAbstraction {
|
||||||
return this.send('POST', '/accounts/register', request, false, false);
|
return this.send('POST', '/accounts/register', request, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
postPremium(data: FormData): Promise<any> {
|
async postPremium(data: FormData): Promise<PaymentResponse> {
|
||||||
return this.send('POST', '/accounts/premium', data, true, false);
|
const r = await this.send('POST', '/accounts/premium', data, true, true);
|
||||||
|
return new PaymentResponse(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
postReinstatePremium(): Promise<any> {
|
postReinstatePremium(): Promise<any> {
|
||||||
|
@ -780,8 +782,9 @@ export class ApiService implements ApiServiceAbstraction {
|
||||||
return new ApiKeyResponse(r);
|
return new ApiKeyResponse(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
postOrganizationUpgrade(id: string, request: OrganizationUpgradeRequest): Promise<any> {
|
async postOrganizationUpgrade(id: string, request: OrganizationUpgradeRequest): Promise<PaymentResponse> {
|
||||||
return this.send('POST', '/organizations/' + id + '/upgrade', request, true, false);
|
const r = await this.send('POST', '/organizations/' + id + '/upgrade', request, true, true);
|
||||||
|
return new PaymentResponse(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
postOrganizationSeat(id: string, request: SeatRequest): Promise<any> {
|
postOrganizationSeat(id: string, request: SeatRequest): Promise<any> {
|
||||||
|
@ -881,6 +884,11 @@ export class ApiService implements ApiServiceAbstraction {
|
||||||
return r as string;
|
return r as string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async postSetupPayment(): Promise<string> {
|
||||||
|
const r = await this.send('POST', '/setup-payment', null, true, true);
|
||||||
|
return r as string;
|
||||||
|
}
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
|
|
||||||
async getActiveBearerToken(): Promise<string> {
|
async getActiveBearerToken(): Promise<string> {
|
||||||
|
|
Loading…
Reference in New Issue