mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 05:43:41 +00:00
Split invoice history table into two tables for paid and open (#11459)
This commit is contained in:
@@ -4,9 +4,6 @@ import {
|
||||
} from "@bitwarden/common/billing/models/response/billing.response";
|
||||
|
||||
export class AccountBillingApiServiceAbstraction {
|
||||
getBillingInvoices: (id: string, startAfter?: string) => Promise<BillingInvoiceResponse[]>;
|
||||
getBillingTransactions: (
|
||||
id: string,
|
||||
startAfter?: string,
|
||||
) => Promise<BillingTransactionResponse[]>;
|
||||
getBillingInvoices: (status?: string, startAfter?: string) => Promise<BillingInvoiceResponse[]>;
|
||||
getBillingTransactions: (startAfter?: string) => Promise<BillingTransactionResponse[]>;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,12 @@ import {
|
||||
} from "@bitwarden/common/billing/models/response/billing.response";
|
||||
|
||||
export class OrganizationBillingApiServiceAbstraction {
|
||||
getBillingInvoices: (id: string, startAfter?: string) => Promise<BillingInvoiceResponse[]>;
|
||||
getBillingInvoices: (
|
||||
id: string,
|
||||
status?: string,
|
||||
startAfter?: string,
|
||||
) => Promise<BillingInvoiceResponse[]>;
|
||||
|
||||
getBillingTransactions: (
|
||||
id: string,
|
||||
startAfter?: string,
|
||||
|
||||
@@ -8,11 +8,25 @@ import {
|
||||
export class AccountBillingApiService implements AccountBillingApiServiceAbstraction {
|
||||
constructor(private apiService: ApiService) {}
|
||||
|
||||
async getBillingInvoices(startAfter?: string): Promise<BillingInvoiceResponse[]> {
|
||||
const queryParams = startAfter ? `?startAfter=${startAfter}` : "";
|
||||
async getBillingInvoices(
|
||||
status?: string,
|
||||
startAfter?: string,
|
||||
): Promise<BillingInvoiceResponse[]> {
|
||||
const params = new URLSearchParams();
|
||||
|
||||
if (status) {
|
||||
params.append("status", status);
|
||||
}
|
||||
|
||||
if (startAfter) {
|
||||
params.append("startAfter", startAfter);
|
||||
}
|
||||
|
||||
const queryString = `?${params.toString()}`;
|
||||
|
||||
const r = await this.apiService.send(
|
||||
"GET",
|
||||
`/accounts/billing/invoices${queryParams}`,
|
||||
`/accounts/billing/invoices${queryString}`,
|
||||
null,
|
||||
true,
|
||||
true,
|
||||
|
||||
@@ -8,11 +8,26 @@ import {
|
||||
export class OrganizationBillingApiService implements OrganizationBillingApiServiceAbstraction {
|
||||
constructor(private apiService: ApiService) {}
|
||||
|
||||
async getBillingInvoices(id: string, startAfter?: string): Promise<BillingInvoiceResponse[]> {
|
||||
const queryParams = startAfter ? `?startAfter=${startAfter}` : "";
|
||||
async getBillingInvoices(
|
||||
id: string,
|
||||
status?: string,
|
||||
startAfter?: string,
|
||||
): Promise<BillingInvoiceResponse[]> {
|
||||
const params = new URLSearchParams();
|
||||
|
||||
if (status) {
|
||||
params.append("status", status);
|
||||
}
|
||||
|
||||
if (startAfter) {
|
||||
params.append("startAfter", startAfter);
|
||||
}
|
||||
|
||||
const queryString = `?${params.toString()}`;
|
||||
|
||||
const r = await this.apiService.send(
|
||||
"GET",
|
||||
`/organizations/${id}/billing/invoices${queryParams}`,
|
||||
`/organizations/${id}/billing/invoices${queryString}`,
|
||||
null,
|
||||
true,
|
||||
true,
|
||||
|
||||
Reference in New Issue
Block a user