mirror of
https://github.com/bitwarden/browser
synced 2025-12-10 05:13:29 +00:00
* Split billing history calls to separately call for invoices and transactions. Added paging button * Added missing button types
74 lines
2.4 KiB
TypeScript
74 lines
2.4 KiB
TypeScript
import { BaseResponse } from "../../../models/response/base.response";
|
|
import { PaymentMethodType, TransactionType } from "../../enums";
|
|
|
|
export class BillingResponse extends BaseResponse {
|
|
balance: number;
|
|
paymentSource: BillingSourceResponse;
|
|
|
|
constructor(response: any) {
|
|
super(response);
|
|
this.balance = this.getResponseProperty("Balance");
|
|
const paymentSource = this.getResponseProperty("PaymentSource");
|
|
this.paymentSource = paymentSource == null ? null : new BillingSourceResponse(paymentSource);
|
|
}
|
|
}
|
|
|
|
export class BillingSourceResponse extends BaseResponse {
|
|
type: PaymentMethodType;
|
|
cardBrand: string;
|
|
description: string;
|
|
needsVerification: boolean;
|
|
|
|
constructor(response: any) {
|
|
super(response);
|
|
this.type = this.getResponseProperty("Type");
|
|
this.cardBrand = this.getResponseProperty("CardBrand");
|
|
this.description = this.getResponseProperty("Description");
|
|
this.needsVerification = this.getResponseProperty("NeedsVerification");
|
|
}
|
|
}
|
|
|
|
export class BillingInvoiceResponse extends BaseResponse {
|
|
id: string;
|
|
url: string;
|
|
pdfUrl: string;
|
|
number: string;
|
|
paid: boolean;
|
|
date: string;
|
|
amount: number;
|
|
|
|
constructor(response: any) {
|
|
super(response);
|
|
this.id = this.getResponseProperty("Id");
|
|
this.url = this.getResponseProperty("Url");
|
|
this.pdfUrl = this.getResponseProperty("PdfUrl");
|
|
this.number = this.getResponseProperty("Number");
|
|
this.paid = this.getResponseProperty("Paid");
|
|
this.date = this.getResponseProperty("Date");
|
|
this.amount = this.getResponseProperty("Amount");
|
|
}
|
|
}
|
|
|
|
export class BillingTransactionResponse extends BaseResponse {
|
|
createdDate: string;
|
|
amount: number;
|
|
refunded: boolean;
|
|
partiallyRefunded: boolean;
|
|
refundedAmount: number;
|
|
type: TransactionType;
|
|
paymentMethodType: PaymentMethodType;
|
|
details: string;
|
|
|
|
constructor(response: any) {
|
|
super(response);
|
|
this.createdDate = this.getResponseProperty("CreatedDate");
|
|
this.amount = this.getResponseProperty("Amount");
|
|
this.refunded = this.getResponseProperty("Refunded");
|
|
this.partiallyRefunded = this.getResponseProperty("PartiallyRefunded");
|
|
this.refundedAmount = this.getResponseProperty("RefundedAmount");
|
|
this.type = this.getResponseProperty("Type");
|
|
this.paymentMethodType = this.getResponseProperty("PaymentMethodType");
|
|
this.details = this.getResponseProperty("Details");
|
|
}
|
|
}
|