mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-15 01:11:47 +01:00
billing invoices and transactions
This commit is contained in:
parent
98addd8ab5
commit
647b254a71
7
src/enums/transactionType.ts
Normal file
7
src/enums/transactionType.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
export enum TransactionType {
|
||||||
|
Charge = 0,
|
||||||
|
Credit = 1,
|
||||||
|
PromotionalCredit = 2,
|
||||||
|
ReferralCredit = 3,
|
||||||
|
Refund = 4,
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
import { PaymentMethodType } from '../../enums/paymentMethodType';
|
import { PaymentMethodType } from '../../enums/paymentMethodType';
|
||||||
|
import { TransactionType } from '../../enums/transactionType';
|
||||||
|
|
||||||
export class BillingResponse {
|
export class BillingResponse {
|
||||||
storageName: string;
|
storageName: string;
|
||||||
@ -6,8 +7,10 @@ export class BillingResponse {
|
|||||||
maxStorageGb: number;
|
maxStorageGb: number;
|
||||||
paymentSource: BillingSourceResponse;
|
paymentSource: BillingSourceResponse;
|
||||||
subscription: BillingSubscriptionResponse;
|
subscription: BillingSubscriptionResponse;
|
||||||
upcomingInvoice: BillingInvoiceResponse;
|
upcomingInvoice: BillingInvoiceInfoResponse;
|
||||||
charges: BillingChargeResponse[] = [];
|
charges: BillingChargeResponse[] = [];
|
||||||
|
invoices: BillingInvoiceResponse[] = [];
|
||||||
|
transactions: BillingTransactionResponse[] = [];
|
||||||
license: any;
|
license: any;
|
||||||
expiration: string;
|
expiration: string;
|
||||||
|
|
||||||
@ -19,10 +22,16 @@ export class BillingResponse {
|
|||||||
this.subscription = response.Subscription == null ?
|
this.subscription = response.Subscription == null ?
|
||||||
null : new BillingSubscriptionResponse(response.Subscription);
|
null : new BillingSubscriptionResponse(response.Subscription);
|
||||||
this.upcomingInvoice = response.UpcomingInvoice == null ?
|
this.upcomingInvoice = response.UpcomingInvoice == null ?
|
||||||
null : new BillingInvoiceResponse(response.UpcomingInvoice);
|
null : new BillingInvoiceInfoResponse(response.UpcomingInvoice);
|
||||||
if (response.Charges != null) {
|
if (response.Charges != null) {
|
||||||
this.charges = response.Charges.map((c: any) => new BillingChargeResponse(c));
|
this.charges = response.Charges.map((c: any) => new BillingChargeResponse(c));
|
||||||
}
|
}
|
||||||
|
if (response.Transactions != null) {
|
||||||
|
this.transactions = response.Transactions.map((t: any) => new BillingTransactionResponse(t));
|
||||||
|
}
|
||||||
|
if (response.Invoices != null) {
|
||||||
|
this.invoices = response.Invoices.map((i: any) => new BillingInvoiceResponse(i));
|
||||||
|
}
|
||||||
this.license = response.License;
|
this.license = response.License;
|
||||||
this.expiration = response.Expiration;
|
this.expiration = response.Expiration;
|
||||||
}
|
}
|
||||||
@ -82,7 +91,7 @@ export class BillingSubscriptionItemResponse {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BillingInvoiceResponse {
|
export class BillingInvoiceInfoResponse {
|
||||||
date: string;
|
date: string;
|
||||||
amount: number;
|
amount: number;
|
||||||
|
|
||||||
@ -115,3 +124,40 @@ export class BillingChargeResponse {
|
|||||||
this.invoiceId = response.InvoiceId;
|
this.invoiceId = response.InvoiceId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class BillingInvoiceResponse extends BillingInvoiceInfoResponse {
|
||||||
|
url: string;
|
||||||
|
pdfUrl: string;
|
||||||
|
number: string;
|
||||||
|
paid: boolean;
|
||||||
|
|
||||||
|
constructor(response: any) {
|
||||||
|
super(response);
|
||||||
|
this.url = response.Url;
|
||||||
|
this.pdfUrl = response.PdfUrl;
|
||||||
|
this.number = response.Number;
|
||||||
|
this.paid = response.Paid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class BillingTransactionResponse {
|
||||||
|
createdDate: string;
|
||||||
|
amount: number;
|
||||||
|
refunded: boolean;
|
||||||
|
partiallyRefunded: boolean;
|
||||||
|
refundedAmount: number;
|
||||||
|
type: TransactionType;
|
||||||
|
paymentMethodType: PaymentMethodType;
|
||||||
|
details: string;
|
||||||
|
|
||||||
|
constructor(response: any) {
|
||||||
|
this.createdDate = response.CreatedDate;
|
||||||
|
this.amount = response.Amount;
|
||||||
|
this.refunded = response.Refunded;
|
||||||
|
this.partiallyRefunded = response.PartiallyRefunded;
|
||||||
|
this.refundedAmount = response.RefundedAmount;
|
||||||
|
this.type = response.Type;
|
||||||
|
this.paymentMethodType = response.PaymentMethodType;
|
||||||
|
this.details = response.Details;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
import {
|
import {
|
||||||
BillingChargeResponse,
|
BillingChargeResponse,
|
||||||
|
BillingInvoiceInfoResponse,
|
||||||
BillingInvoiceResponse,
|
BillingInvoiceResponse,
|
||||||
BillingSourceResponse,
|
BillingSourceResponse,
|
||||||
BillingSubscriptionResponse,
|
BillingSubscriptionResponse,
|
||||||
|
BillingTransactionResponse,
|
||||||
} from './billingResponse';
|
} from './billingResponse';
|
||||||
import { OrganizationResponse } from './organizationResponse';
|
import { OrganizationResponse } from './organizationResponse';
|
||||||
|
|
||||||
@ -11,8 +13,10 @@ export class OrganizationBillingResponse extends OrganizationResponse {
|
|||||||
storageGb: number;
|
storageGb: number;
|
||||||
paymentSource: BillingSourceResponse;
|
paymentSource: BillingSourceResponse;
|
||||||
subscription: BillingSubscriptionResponse;
|
subscription: BillingSubscriptionResponse;
|
||||||
upcomingInvoice: BillingInvoiceResponse;
|
upcomingInvoice: BillingInvoiceInfoResponse;
|
||||||
charges: BillingChargeResponse[] = [];
|
charges: BillingChargeResponse[] = [];
|
||||||
|
invoices: BillingInvoiceResponse[] = [];
|
||||||
|
transactions: BillingTransactionResponse[] = [];
|
||||||
expiration: string;
|
expiration: string;
|
||||||
|
|
||||||
constructor(response: any) {
|
constructor(response: any) {
|
||||||
@ -23,10 +27,16 @@ export class OrganizationBillingResponse extends OrganizationResponse {
|
|||||||
this.subscription = response.Subscription == null ?
|
this.subscription = response.Subscription == null ?
|
||||||
null : new BillingSubscriptionResponse(response.Subscription);
|
null : new BillingSubscriptionResponse(response.Subscription);
|
||||||
this.upcomingInvoice = response.UpcomingInvoice == null ?
|
this.upcomingInvoice = response.UpcomingInvoice == null ?
|
||||||
null : new BillingInvoiceResponse(response.UpcomingInvoice);
|
null : new BillingInvoiceInfoResponse(response.UpcomingInvoice);
|
||||||
if (response.Charges != null) {
|
if (response.Charges != null) {
|
||||||
this.charges = response.Charges.map((c: any) => new BillingChargeResponse(c));
|
this.charges = response.Charges.map((c: any) => new BillingChargeResponse(c));
|
||||||
}
|
}
|
||||||
|
if (response.Transactions != null) {
|
||||||
|
this.transactions = response.Transactions.map((t: any) => new BillingTransactionResponse(t));
|
||||||
|
}
|
||||||
|
if (response.Invoices != null) {
|
||||||
|
this.invoices = response.Invoices.map((i: any) => new BillingInvoiceResponse(i));
|
||||||
|
}
|
||||||
this.expiration = response.Expiration;
|
this.expiration = response.Expiration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user