Skip to content

Commit ada2e76

Browse files
feat(billing): align codebase with existing project structure
1 parent 7fab627 commit ada2e76

15 files changed

Lines changed: 1334 additions & 1451 deletions

package-lock.json

Lines changed: 966 additions & 903 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

services/subscription-service/src/controllers/billing-service.controller.ts

Lines changed: 33 additions & 275 deletions
Large diffs are not rendered by default.

services/subscription-service/src/controllers/billing-subscription.controller.ts

Lines changed: 87 additions & 273 deletions
Large diffs are not rendered by default.

services/subscription-service/src/models/dto/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,14 @@ export * from './charge-dto.model';
33
export * from './customer-dto.model';
44
export * from './invoice-dto.model';
55
export * from './payment-dto.model';
6+
export * from './price-dto.model';
7+
export * from './product-dto.model';
8+
export * from './subscription-create-dto.model';
9+
export * from './subscription-update-dto.model';
10+
export * from './subscription-result-dto.model';
11+
export * from './subscription-create-response-dto.model';
12+
export * from './success-dto.model';
13+
export * from './invoice-price-dto.model';
14+
export * from './invoice-pdf-dto.model';
15+
export * from './invoice-payment-details-dto.model';
16+
export * from './payment-intent-dto.model';
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import {model, Model, property} from '@loopback/repository';
2+
3+
@model({name: 'invoice_payment_details_dto'})
4+
export class InvoicePaymentDetailsDto extends Model {
5+
@property({type: 'string'})
6+
invoiceId: string;
7+
8+
@property({type: 'object'})
9+
paymentMethod: object;
10+
11+
@property({type: 'number'})
12+
paymentDate?: number;
13+
14+
@property({type: 'number'})
15+
amount?: number;
16+
17+
@property({type: 'string'})
18+
currency?: string;
19+
20+
@property({type: 'string'})
21+
status?: string;
22+
23+
constructor(data?: Partial<InvoicePaymentDetailsDto>) {
24+
super(data);
25+
}
26+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import {model, Model, property} from '@loopback/repository';
2+
3+
@model({name: 'invoice_pdf_dto'})
4+
export class InvoicePdfDto extends Model {
5+
@property({type: 'string'})
6+
invoiceId: string;
7+
8+
@property({type: 'string'})
9+
pdfUrl: string;
10+
11+
@property({type: 'string', format: 'date-time'})
12+
generatedAt: string;
13+
14+
@property({type: 'string', format: 'date-time', nullable: true})
15+
expiresAt?: string | null;
16+
17+
constructor(data?: Partial<InvoicePdfDto>) {
18+
super(data);
19+
}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import {model, Model, property} from '@loopback/repository';
2+
3+
@model({name: 'invoice_price_dto'})
4+
export class InvoicePriceDto extends Model {
5+
@property({type: 'string'})
6+
currency: string;
7+
8+
@property({type: 'number'})
9+
totalAmount: number;
10+
11+
@property({type: 'number'})
12+
taxAmount: number;
13+
14+
@property({type: 'number'})
15+
amountExcludingTax: number;
16+
17+
constructor(data?: Partial<InvoicePriceDto>) {
18+
super(data);
19+
}
20+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import {model, Model, property} from '@loopback/repository';
2+
3+
@model({name: 'payment_intent_dto'})
4+
export class PaymentIntentDto extends Model {
5+
@property({type: 'string'})
6+
id: string;
7+
8+
@property({type: 'number'})
9+
amount: number;
10+
11+
@property({type: 'string'})
12+
currency: string;
13+
14+
@property({type: 'string'})
15+
status: string;
16+
17+
@property({type: 'number'})
18+
created: number;
19+
20+
@property({type: 'string', nullable: true})
21+
customer?: string;
22+
23+
@property({type: 'object'})
24+
paymentMethod?: object;
25+
26+
@property({type: 'string', nullable: true})
27+
description?: string;
28+
29+
@property({type: 'object', additionalProperties: true})
30+
metadata?: object;
31+
32+
constructor(data?: Partial<PaymentIntentDto>) {
33+
super(data);
34+
}
35+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import {model, property} from '@loopback/repository';
2+
3+
@model({settings: {strict: false}})
4+
export class PriceDto {
5+
@property({type: 'string'})
6+
id?: string;
7+
8+
@property({type: 'string'})
9+
currency: string;
10+
11+
@property({type: 'number'})
12+
unitAmount: number;
13+
14+
@property({type: 'string'})
15+
product: string;
16+
17+
@property({type: 'boolean'})
18+
active?: boolean;
19+
20+
@property({type: 'object'})
21+
recurring?: {
22+
interval?: string;
23+
intervalCount?: number;
24+
};
25+
26+
@property({type: 'object'})
27+
metadata?: object;
28+
29+
constructor(data?: Partial<PriceDto>) {
30+
Object.assign(this, data);
31+
}
32+
}
33+
34+
export type PriceDtoWithRelations = PriceDto;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import {model, Model, property} from '@loopback/repository';
2+
3+
@model({name: 'product_dto'})
4+
export class ProductDto extends Model {
5+
@property({type: 'string', name: 'id'})
6+
id?: string;
7+
8+
@property({type: 'string', name: 'name'})
9+
name: string;
10+
11+
@property({type: 'string', name: 'description'})
12+
description?: string;
13+
14+
@property({type: 'object', name: 'metadata'})
15+
metadata?: object;
16+
17+
constructor(data?: Partial<ProductDto>) {
18+
super(data);
19+
}
20+
}

0 commit comments

Comments
 (0)