1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-27 12:36:14 +01:00

post bitpay invoice api

This commit is contained in:
Kyle Spearrin 2019-02-21 22:45:56 -05:00
parent 2b931963cd
commit 3362334d2c
3 changed files with 20 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import { EnvironmentUrls } from '../models/domain/environmentUrls';
import { BitPayInvoiceRequest } from '../models/request/bitPayInvoiceRequest';
import { CipherBulkDeleteRequest } from '../models/request/cipherBulkDeleteRequest';
import { CipherBulkMoveRequest } from '../models/request/cipherBulkMoveRequest';
import { CipherBulkShareRequest } from '../models/request/cipherBulkShareRequest';
@ -253,6 +254,8 @@ export abstract class ApiService {
getHibpBreach: (username: string) => Promise<BreachAccountResponse[]>;
postBitPayInvoice: (request: BitPayInvoiceRequest) => Promise<string>;
getActiveBearerToken: () => Promise<string>;
fetch: (request: Request) => Promise<Response>;
}

View File

@ -0,0 +1,9 @@
export class BitPayInvoiceRequest {
userId: string;
organizationId: string;
credit: boolean;
amount: number;
returnUrl: string;
name: string;
email: string;
}

View File

@ -6,6 +6,7 @@ import { TokenService } from '../abstractions/token.service';
import { EnvironmentUrls } from '../models/domain/environmentUrls';
import { BitPayInvoiceRequest } from '../models/request/bitPayInvoiceRequest';
import { CipherBulkDeleteRequest } from '../models/request/cipherBulkDeleteRequest';
import { CipherBulkMoveRequest } from '../models/request/cipherBulkMoveRequest';
import { CipherBulkShareRequest } from '../models/request/cipherBulkShareRequest';
@ -837,6 +838,13 @@ export class ApiService implements ApiServiceAbstraction {
return r.map((a: any) => new BreachAccountResponse(a));
}
// Misc
async postBitPayInvoice(request: BitPayInvoiceRequest): Promise<string> {
const r = await this.send('POST', '/bitpay-invoice', request, true, true);
return r as string;
}
// Helpers
async getActiveBearerToken(): Promise<string> {