@hed-hog/billing 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/billing-gateway-registry.d.ts +8 -0
- package/dist/adapters/billing-gateway-registry.d.ts.map +1 -0
- package/dist/adapters/billing-gateway-registry.js +33 -0
- package/dist/adapters/billing-gateway-registry.js.map +1 -0
- package/dist/adapters/mercadopago.adapter.d.ts +44 -0
- package/dist/adapters/mercadopago.adapter.d.ts.map +1 -0
- package/dist/adapters/mercadopago.adapter.js +68 -0
- package/dist/adapters/mercadopago.adapter.js.map +1 -0
- package/dist/adapters/pagarme.adapter.d.ts +44 -0
- package/dist/adapters/pagarme.adapter.d.ts.map +1 -0
- package/dist/adapters/pagarme.adapter.js +68 -0
- package/dist/adapters/pagarme.adapter.js.map +1 -0
- package/dist/adapters/payment-gateway.adapter.d.ts +15 -0
- package/dist/adapters/payment-gateway.adapter.d.ts.map +1 -0
- package/dist/adapters/payment-gateway.adapter.js +3 -0
- package/dist/adapters/payment-gateway.adapter.js.map +1 -0
- package/dist/adapters/stripe.adapter.d.ts +44 -0
- package/dist/adapters/stripe.adapter.d.ts.map +1 -0
- package/dist/adapters/stripe.adapter.js +69 -0
- package/dist/adapters/stripe.adapter.js.map +1 -0
- package/dist/billing-contracts.controller.d.ts +22 -0
- package/dist/billing-contracts.controller.d.ts.map +1 -0
- package/dist/billing-contracts.controller.js +84 -0
- package/dist/billing-contracts.controller.js.map +1 -0
- package/dist/billing-coupons.controller.d.ts +22 -0
- package/dist/billing-coupons.controller.d.ts.map +1 -0
- package/dist/billing-coupons.controller.js +84 -0
- package/dist/billing-coupons.controller.js.map +1 -0
- package/dist/billing-dashboard.controller.d.ts +13 -0
- package/dist/billing-dashboard.controller.d.ts.map +1 -0
- package/dist/billing-dashboard.controller.js +36 -0
- package/dist/billing-dashboard.controller.js.map +1 -0
- package/dist/billing-entitlements.controller.d.ts +19 -0
- package/dist/billing-entitlements.controller.d.ts.map +1 -0
- package/dist/billing-entitlements.controller.js +62 -0
- package/dist/billing-entitlements.controller.js.map +1 -0
- package/dist/billing-gateways.controller.d.ts +8 -0
- package/dist/billing-gateways.controller.d.ts.map +1 -0
- package/dist/billing-gateways.controller.js +50 -0
- package/dist/billing-gateways.controller.js.map +1 -0
- package/dist/billing-invoices.controller.d.ts +18 -0
- package/dist/billing-invoices.controller.d.ts.map +1 -0
- package/dist/billing-invoices.controller.js +61 -0
- package/dist/billing-invoices.controller.js.map +1 -0
- package/dist/billing-offers.controller.d.ts +22 -0
- package/dist/billing-offers.controller.d.ts.map +1 -0
- package/dist/billing-offers.controller.js +84 -0
- package/dist/billing-offers.controller.js.map +1 -0
- package/dist/billing-orders.controller.d.ts +19 -0
- package/dist/billing-orders.controller.d.ts.map +1 -0
- package/dist/billing-orders.controller.js +62 -0
- package/dist/billing-orders.controller.js.map +1 -0
- package/dist/billing-payments.controller.d.ts +17 -0
- package/dist/billing-payments.controller.d.ts.map +1 -0
- package/dist/billing-payments.controller.js +51 -0
- package/dist/billing-payments.controller.js.map +1 -0
- package/dist/billing-prices.controller.d.ts +22 -0
- package/dist/billing-prices.controller.d.ts.map +1 -0
- package/dist/billing-prices.controller.js +84 -0
- package/dist/billing-prices.controller.js.map +1 -0
- package/dist/billing-products.controller.d.ts +22 -0
- package/dist/billing-products.controller.d.ts.map +1 -0
- package/dist/billing-products.controller.js +84 -0
- package/dist/billing-products.controller.js.map +1 -0
- package/dist/billing-refunds.controller.d.ts +16 -0
- package/dist/billing-refunds.controller.d.ts.map +1 -0
- package/dist/billing-refunds.controller.js +41 -0
- package/dist/billing-refunds.controller.js.map +1 -0
- package/dist/billing-subscriptions.controller.d.ts +22 -0
- package/dist/billing-subscriptions.controller.d.ts.map +1 -0
- package/dist/billing-subscriptions.controller.js +92 -0
- package/dist/billing-subscriptions.controller.js.map +1 -0
- package/dist/billing-webhooks.controller.d.ts +16 -0
- package/dist/billing-webhooks.controller.d.ts.map +1 -0
- package/dist/billing-webhooks.controller.js +41 -0
- package/dist/billing-webhooks.controller.js.map +1 -0
- package/dist/billing.module.d.ts +3 -0
- package/dist/billing.module.d.ts.map +1 -0
- package/dist/billing.module.js +61 -0
- package/dist/billing.module.js.map +1 -0
- package/dist/billing.service.d.ts +169 -0
- package/dist/billing.service.d.ts.map +1 -0
- package/dist/billing.service.js +290 -0
- package/dist/billing.service.js.map +1 -0
- package/dist/dto/create-contract.dto.d.ts +11 -0
- package/dist/dto/create-contract.dto.d.ts.map +1 -0
- package/dist/dto/create-contract.dto.js +52 -0
- package/dist/dto/create-contract.dto.js.map +1 -0
- package/dist/dto/create-coupon.dto.d.ts +12 -0
- package/dist/dto/create-coupon.dto.d.ts.map +1 -0
- package/dist/dto/create-coupon.dto.js +60 -0
- package/dist/dto/create-coupon.dto.js.map +1 -0
- package/dist/dto/create-entitlement.dto.d.ts +12 -0
- package/dist/dto/create-entitlement.dto.d.ts.map +1 -0
- package/dist/dto/create-entitlement.dto.js +54 -0
- package/dist/dto/create-entitlement.dto.js.map +1 -0
- package/dist/dto/create-offer.dto.d.ts +7 -0
- package/dist/dto/create-offer.dto.d.ts.map +1 -0
- package/dist/dto/create-offer.dto.js +35 -0
- package/dist/dto/create-offer.dto.js.map +1 -0
- package/dist/dto/create-order.dto.d.ts +12 -0
- package/dist/dto/create-order.dto.d.ts.map +1 -0
- package/dist/dto/create-order.dto.js +65 -0
- package/dist/dto/create-order.dto.js.map +1 -0
- package/dist/dto/create-price.dto.d.ts +15 -0
- package/dist/dto/create-price.dto.d.ts.map +1 -0
- package/dist/dto/create-price.dto.js +76 -0
- package/dist/dto/create-price.dto.js.map +1 -0
- package/dist/dto/create-product.dto.d.ts +9 -0
- package/dist/dto/create-product.dto.d.ts.map +1 -0
- package/dist/dto/create-product.dto.js +45 -0
- package/dist/dto/create-product.dto.js.map +1 -0
- package/dist/dto/create-subscription.dto.d.ts +14 -0
- package/dist/dto/create-subscription.dto.d.ts.map +1 -0
- package/dist/dto/create-subscription.dto.js +67 -0
- package/dist/dto/create-subscription.dto.js.map +1 -0
- package/dist/dto/update-contract.dto.d.ts +6 -0
- package/dist/dto/update-contract.dto.d.ts.map +1 -0
- package/dist/dto/update-contract.dto.js +9 -0
- package/dist/dto/update-contract.dto.js.map +1 -0
- package/dist/dto/update-coupon.dto.d.ts +6 -0
- package/dist/dto/update-coupon.dto.d.ts.map +1 -0
- package/dist/dto/update-coupon.dto.js +9 -0
- package/dist/dto/update-coupon.dto.js.map +1 -0
- package/dist/dto/update-offer.dto.d.ts +6 -0
- package/dist/dto/update-offer.dto.d.ts.map +1 -0
- package/dist/dto/update-offer.dto.js +9 -0
- package/dist/dto/update-offer.dto.js.map +1 -0
- package/dist/dto/update-order.dto.d.ts +6 -0
- package/dist/dto/update-order.dto.d.ts.map +1 -0
- package/dist/dto/update-order.dto.js +9 -0
- package/dist/dto/update-order.dto.js.map +1 -0
- package/dist/dto/update-price.dto.d.ts +6 -0
- package/dist/dto/update-price.dto.d.ts.map +1 -0
- package/dist/dto/update-price.dto.js +9 -0
- package/dist/dto/update-price.dto.js.map +1 -0
- package/dist/dto/update-product.dto.d.ts +6 -0
- package/dist/dto/update-product.dto.d.ts.map +1 -0
- package/dist/dto/update-product.dto.js +9 -0
- package/dist/dto/update-product.dto.js.map +1 -0
- package/dist/dto/update-subscription.dto.d.ts +6 -0
- package/dist/dto/update-subscription.dto.d.ts.map +1 -0
- package/dist/dto/update-subscription.dto.js +9 -0
- package/dist/dto/update-subscription.dto.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -0
- package/hedhog/data/menu.yaml +284 -0
- package/hedhog/data/role.yaml +7 -0
- package/hedhog/data/route.yaml +422 -0
- package/hedhog/frontend/app/_lib/billing-mocks.ts.ejs +270 -0
- package/hedhog/frontend/app/contracts/page.tsx.ejs +562 -0
- package/hedhog/frontend/app/coupons/page.tsx.ejs +669 -0
- package/hedhog/frontend/app/entitlements/page.tsx.ejs +526 -0
- package/hedhog/frontend/app/gateways/page.tsx.ejs +308 -0
- package/hedhog/frontend/app/invoices/page.tsx.ejs +179 -0
- package/hedhog/frontend/app/offers/page.tsx.ejs +483 -0
- package/hedhog/frontend/app/orders/page.tsx.ejs +424 -0
- package/hedhog/frontend/app/page.tsx.ejs +186 -0
- package/hedhog/frontend/app/payments/page.tsx.ejs +187 -0
- package/hedhog/frontend/app/prices/page.tsx.ejs +704 -0
- package/hedhog/frontend/app/products/page.tsx.ejs +568 -0
- package/hedhog/frontend/app/refunds/page.tsx.ejs +174 -0
- package/hedhog/frontend/app/reports/page.tsx.ejs +177 -0
- package/hedhog/frontend/app/subscriptions/page.tsx.ejs +283 -0
- package/hedhog/frontend/app/webhooks/page.tsx.ejs +172 -0
- package/hedhog/frontend/messages/en.json +551 -0
- package/hedhog/frontend/messages/pt.json +563 -0
- package/hedhog/table/billing_contract.yaml +37 -0
- package/hedhog/table/billing_contract_seat.yaml +28 -0
- package/hedhog/table/billing_coupon.yaml +42 -0
- package/hedhog/table/billing_entitlement.yaml +41 -0
- package/hedhog/table/billing_entitlement_event.yaml +20 -0
- package/hedhog/table/billing_invoice.yaml +60 -0
- package/hedhog/table/billing_invoice_item.yaml +25 -0
- package/hedhog/table/billing_offer.yaml +22 -0
- package/hedhog/table/billing_offer_price.yaml +23 -0
- package/hedhog/table/billing_order.yaml +50 -0
- package/hedhog/table/billing_order_item.yaml +35 -0
- package/hedhog/table/billing_payment.yaml +66 -0
- package/hedhog/table/billing_payment_method.yaml +49 -0
- package/hedhog/table/billing_payment_provider.yaml +21 -0
- package/hedhog/table/billing_price.yaml +53 -0
- package/hedhog/table/billing_product.yaml +31 -0
- package/hedhog/table/billing_product_item.yaml +24 -0
- package/hedhog/table/billing_provider_event.yaml +31 -0
- package/hedhog/table/billing_refund.yaml +41 -0
- package/hedhog/table/billing_seat_allocation.yaml +42 -0
- package/hedhog/table/billing_subscription.yaml +66 -0
- package/hedhog/table/billing_subscription_event.yaml +20 -0
- package/hedhog/table/billing_subscription_item.yaml +29 -0
- package/package.json +37 -0
- package/src/adapters/billing-gateway-registry.ts +23 -0
- package/src/adapters/mercadopago.adapter.ts +66 -0
- package/src/adapters/pagarme.adapter.ts +66 -0
- package/src/adapters/payment-gateway.adapter.ts +14 -0
- package/src/adapters/stripe.adapter.ts +67 -0
- package/src/billing-contracts.controller.ts +46 -0
- package/src/billing-coupons.controller.ts +46 -0
- package/src/billing-dashboard.controller.ts +14 -0
- package/src/billing-entitlements.controller.ts +34 -0
- package/src/billing-gateways.controller.ts +19 -0
- package/src/billing-invoices.controller.ts +32 -0
- package/src/billing-offers.controller.ts +46 -0
- package/src/billing-orders.controller.ts +33 -0
- package/src/billing-payments.controller.ts +20 -0
- package/src/billing-prices.controller.ts +46 -0
- package/src/billing-products.controller.ts +46 -0
- package/src/billing-refunds.controller.ts +15 -0
- package/src/billing-subscriptions.controller.ts +49 -0
- package/src/billing-webhooks.controller.ts +15 -0
- package/src/billing.module.ts +48 -0
- package/src/billing.service.ts +391 -0
- package/src/dto/create-contract.dto.ts +30 -0
- package/src/dto/create-coupon.dto.ts +37 -0
- package/src/dto/create-entitlement.dto.ts +31 -0
- package/src/dto/create-offer.dto.ts +17 -0
- package/src/dto/create-order.dto.ts +42 -0
- package/src/dto/create-price.dto.ts +50 -0
- package/src/dto/create-product.dto.ts +25 -0
- package/src/dto/create-subscription.dto.ts +42 -0
- package/src/dto/update-contract.dto.ts +4 -0
- package/src/dto/update-coupon.dto.ts +4 -0
- package/src/dto/update-offer.dto.ts +4 -0
- package/src/dto/update-order.dto.ts +4 -0
- package/src/dto/update-price.dto.ts +4 -0
- package/src/dto/update-product.dto.ts +4 -0
- package/src/dto/update-subscription.dto.ts +4 -0
- package/src/index.ts +32 -0
- package/src/language/en.json +8 -0
- package/src/language/pt.json +8 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: contact_id
|
|
4
|
+
type: fk
|
|
5
|
+
isNullable: true
|
|
6
|
+
references:
|
|
7
|
+
table: person
|
|
8
|
+
column: id
|
|
9
|
+
onDelete: SET NULL
|
|
10
|
+
onUpdate: CASCADE
|
|
11
|
+
- name: product_id
|
|
12
|
+
type: fk
|
|
13
|
+
isNullable: true
|
|
14
|
+
references:
|
|
15
|
+
table: billing_product
|
|
16
|
+
column: id
|
|
17
|
+
onDelete: SET NULL
|
|
18
|
+
onUpdate: CASCADE
|
|
19
|
+
- name: price_id
|
|
20
|
+
type: fk
|
|
21
|
+
isNullable: true
|
|
22
|
+
references:
|
|
23
|
+
table: billing_price
|
|
24
|
+
column: id
|
|
25
|
+
onDelete: SET NULL
|
|
26
|
+
onUpdate: CASCADE
|
|
27
|
+
- name: gateway
|
|
28
|
+
type: varchar
|
|
29
|
+
length: 64
|
|
30
|
+
isNullable: true
|
|
31
|
+
- name: gateway_subscription_id
|
|
32
|
+
type: varchar
|
|
33
|
+
length: 255
|
|
34
|
+
isNullable: true
|
|
35
|
+
- name: status
|
|
36
|
+
type: enum
|
|
37
|
+
values: [trialing, active, past_due, canceled, paused, unpaid]
|
|
38
|
+
default: active
|
|
39
|
+
- name: started_at
|
|
40
|
+
type: datetime
|
|
41
|
+
isNullable: true
|
|
42
|
+
- name: trial_ends_at
|
|
43
|
+
type: datetime
|
|
44
|
+
isNullable: true
|
|
45
|
+
- name: current_period_start
|
|
46
|
+
type: datetime
|
|
47
|
+
isNullable: true
|
|
48
|
+
- name: current_period_end
|
|
49
|
+
type: datetime
|
|
50
|
+
isNullable: true
|
|
51
|
+
- name: cancel_at_period_end
|
|
52
|
+
type: boolean
|
|
53
|
+
default: false
|
|
54
|
+
- name: canceled_at
|
|
55
|
+
type: datetime
|
|
56
|
+
isNullable: true
|
|
57
|
+
- type: created_at
|
|
58
|
+
- type: updated_at
|
|
59
|
+
|
|
60
|
+
indices:
|
|
61
|
+
- columns: [contact_id]
|
|
62
|
+
- columns: [product_id]
|
|
63
|
+
- columns: [price_id]
|
|
64
|
+
- columns: [gateway]
|
|
65
|
+
- columns: [gateway_subscription_id]
|
|
66
|
+
- columns: [status]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: subscription_id
|
|
4
|
+
type: fk
|
|
5
|
+
references:
|
|
6
|
+
table: billing_subscription
|
|
7
|
+
column: id
|
|
8
|
+
onDelete: CASCADE
|
|
9
|
+
onUpdate: CASCADE
|
|
10
|
+
- name: event_type
|
|
11
|
+
type: varchar
|
|
12
|
+
length: 120
|
|
13
|
+
- name: payload
|
|
14
|
+
type: text
|
|
15
|
+
isNullable: true
|
|
16
|
+
- type: created_at
|
|
17
|
+
|
|
18
|
+
indices:
|
|
19
|
+
- columns: [subscription_id]
|
|
20
|
+
- columns: [event_type]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: subscription_id
|
|
4
|
+
type: fk
|
|
5
|
+
references:
|
|
6
|
+
table: billing_subscription
|
|
7
|
+
column: id
|
|
8
|
+
onDelete: CASCADE
|
|
9
|
+
onUpdate: CASCADE
|
|
10
|
+
- name: price_id
|
|
11
|
+
type: fk
|
|
12
|
+
references:
|
|
13
|
+
table: billing_price
|
|
14
|
+
column: id
|
|
15
|
+
onDelete: RESTRICT
|
|
16
|
+
onUpdate: CASCADE
|
|
17
|
+
- name: quantity
|
|
18
|
+
type: int
|
|
19
|
+
default: 1
|
|
20
|
+
- name: is_active
|
|
21
|
+
type: boolean
|
|
22
|
+
default: true
|
|
23
|
+
- type: created_at
|
|
24
|
+
- type: updated_at
|
|
25
|
+
|
|
26
|
+
indices:
|
|
27
|
+
- columns: [subscription_id]
|
|
28
|
+
- columns: [price_id]
|
|
29
|
+
- columns: [is_active]
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hed-hog/billing",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@nestjs/common": "*",
|
|
8
|
+
"@nestjs/config": "^4.0.2",
|
|
9
|
+
"@nestjs/core": "^11",
|
|
10
|
+
"@nestjs/jwt": "^11",
|
|
11
|
+
"@nestjs/mapped-types": "*",
|
|
12
|
+
"@hed-hog/api": "0.0.4",
|
|
13
|
+
"@hed-hog/api-locale": "0.0.13",
|
|
14
|
+
"@hed-hog/api-pagination": "0.0.6",
|
|
15
|
+
"@hed-hog/api-types": "0.0.1",
|
|
16
|
+
"@hed-hog/api-prisma": "0.0.5"
|
|
17
|
+
},
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"require": "./dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./package.json": "./package.json"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"src",
|
|
28
|
+
"hedhog"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
|
|
32
|
+
"prebuild": "pnpm exec ts-node ../../scripts/build-dependencies.ts libraries/billing",
|
|
33
|
+
"build": "tsc --project tsconfig.production.json",
|
|
34
|
+
"patch": "pnpm exec ts-node ../../scripts/patch.ts libraries/billing",
|
|
35
|
+
"prod": "pnpm run patch && pnpm run build && pnpm publish --access public --no-git-checks"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { PaymentGatewayAdapter } from './payment-gateway.adapter';
|
|
3
|
+
|
|
4
|
+
@Injectable()
|
|
5
|
+
export class BillingGatewayRegistry {
|
|
6
|
+
private readonly registry = new Map<string, PaymentGatewayAdapter>();
|
|
7
|
+
|
|
8
|
+
register(slug: string, adapter: PaymentGatewayAdapter): void {
|
|
9
|
+
this.registry.set(slug, adapter);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
getAdapter(slug: string): PaymentGatewayAdapter {
|
|
13
|
+
const adapter = this.registry.get(slug);
|
|
14
|
+
if (!adapter) {
|
|
15
|
+
throw new Error(`No payment gateway adapter registered for slug: ${slug}`);
|
|
16
|
+
}
|
|
17
|
+
return adapter;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
listAdapters(): string[] {
|
|
21
|
+
return Array.from(this.registry.keys());
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Injectable, Logger } from '@nestjs/common';
|
|
2
|
+
import { PaymentGatewayAdapter } from './payment-gateway.adapter';
|
|
3
|
+
|
|
4
|
+
@Injectable()
|
|
5
|
+
export class MercadoPagoAdapter implements PaymentGatewayAdapter {
|
|
6
|
+
private readonly logger = new Logger(MercadoPagoAdapter.name);
|
|
7
|
+
|
|
8
|
+
async createCustomer(data: Record<string, unknown>) {
|
|
9
|
+
this.logger.log('MercadoPago: createCustomer', data);
|
|
10
|
+
return { id: `cust_mp_${Date.now()}`, ...data };
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async createCheckoutSession(data: Record<string, unknown>) {
|
|
14
|
+
this.logger.log('MercadoPago: createCheckoutSession', data);
|
|
15
|
+
return { id: `pref_mp_${Date.now()}`, init_point: 'https://www.mercadopago.com.br/checkout/v1/redirect?pref_id=stub' };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async createSubscription(data: Record<string, unknown>) {
|
|
19
|
+
this.logger.log('MercadoPago: createSubscription', data);
|
|
20
|
+
return { id: `sub_mp_${Date.now()}`, status: 'authorized', ...data };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async cancelSubscription(externalId: string) {
|
|
24
|
+
this.logger.log('MercadoPago: cancelSubscription', externalId);
|
|
25
|
+
return { id: externalId, status: 'cancelled' };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async pauseSubscription(externalId: string) {
|
|
29
|
+
this.logger.log('MercadoPago: pauseSubscription', externalId);
|
|
30
|
+
return { id: externalId, status: 'paused' };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async resumeSubscription(externalId: string) {
|
|
34
|
+
this.logger.log('MercadoPago: resumeSubscription', externalId);
|
|
35
|
+
return { id: externalId, status: 'authorized' };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async createInvoice(data: Record<string, unknown>) {
|
|
39
|
+
this.logger.log('MercadoPago: createInvoice', data);
|
|
40
|
+
return { id: `inv_mp_${Date.now()}`, status: 'pending', ...data };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async chargeInvoice(externalInvoiceId: string) {
|
|
44
|
+
this.logger.log('MercadoPago: chargeInvoice', externalInvoiceId);
|
|
45
|
+
return { id: externalInvoiceId, status: 'approved' };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async refundPayment(externalTransactionId: string, amountCents?: number) {
|
|
49
|
+
this.logger.log('MercadoPago: refundPayment', { externalTransactionId, amountCents });
|
|
50
|
+
return { id: `ref_mp_${Date.now()}`, status: 'approved', amount: amountCents };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async parseWebhook(rawBody: string, _signature: string) {
|
|
54
|
+
return JSON.parse(rawBody);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async getPaymentStatus(externalId: string) {
|
|
58
|
+
this.logger.log('MercadoPago: getPaymentStatus', externalId);
|
|
59
|
+
return 'approved';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async getSubscriptionStatus(externalId: string) {
|
|
63
|
+
this.logger.log('MercadoPago: getSubscriptionStatus', externalId);
|
|
64
|
+
return 'authorized';
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Injectable, Logger } from '@nestjs/common';
|
|
2
|
+
import { PaymentGatewayAdapter } from './payment-gateway.adapter';
|
|
3
|
+
|
|
4
|
+
@Injectable()
|
|
5
|
+
export class PagarmeAdapter implements PaymentGatewayAdapter {
|
|
6
|
+
private readonly logger = new Logger(PagarmeAdapter.name);
|
|
7
|
+
|
|
8
|
+
async createCustomer(data: Record<string, unknown>) {
|
|
9
|
+
this.logger.log('Pagarme: createCustomer', data);
|
|
10
|
+
return { id: `cus_pagar_${Date.now()}`, ...data };
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async createCheckoutSession(data: Record<string, unknown>) {
|
|
14
|
+
this.logger.log('Pagarme: createCheckoutSession', data);
|
|
15
|
+
return { id: `order_pagar_${Date.now()}`, payment_url: 'https://api.pagar.me/stub' };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async createSubscription(data: Record<string, unknown>) {
|
|
19
|
+
this.logger.log('Pagarme: createSubscription', data);
|
|
20
|
+
return { id: `sub_pagar_${Date.now()}`, status: 'active', ...data };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async cancelSubscription(externalId: string) {
|
|
24
|
+
this.logger.log('Pagarme: cancelSubscription', externalId);
|
|
25
|
+
return { id: externalId, status: 'canceled' };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async pauseSubscription(externalId: string) {
|
|
29
|
+
this.logger.log('Pagarme: pauseSubscription', externalId);
|
|
30
|
+
return { id: externalId, status: 'paused' };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async resumeSubscription(externalId: string) {
|
|
34
|
+
this.logger.log('Pagarme: resumeSubscription', externalId);
|
|
35
|
+
return { id: externalId, status: 'active' };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async createInvoice(data: Record<string, unknown>) {
|
|
39
|
+
this.logger.log('Pagarme: createInvoice', data);
|
|
40
|
+
return { id: `inv_pagar_${Date.now()}`, status: 'pending', ...data };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async chargeInvoice(externalInvoiceId: string) {
|
|
44
|
+
this.logger.log('Pagarme: chargeInvoice', externalInvoiceId);
|
|
45
|
+
return { id: externalInvoiceId, status: 'paid' };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async refundPayment(externalTransactionId: string, amountCents?: number) {
|
|
49
|
+
this.logger.log('Pagarme: refundPayment', { externalTransactionId, amountCents });
|
|
50
|
+
return { id: `ref_pagar_${Date.now()}`, status: 'refunded', amount: amountCents };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async parseWebhook(rawBody: string, _signature: string) {
|
|
54
|
+
return JSON.parse(rawBody);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async getPaymentStatus(externalId: string) {
|
|
58
|
+
this.logger.log('Pagarme: getPaymentStatus', externalId);
|
|
59
|
+
return 'paid';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async getSubscriptionStatus(externalId: string) {
|
|
63
|
+
this.logger.log('Pagarme: getSubscriptionStatus', externalId);
|
|
64
|
+
return 'active';
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface PaymentGatewayAdapter {
|
|
2
|
+
createCustomer(data: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
3
|
+
createCheckoutSession(data: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
4
|
+
createSubscription(data: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
5
|
+
cancelSubscription(externalId: string): Promise<Record<string, unknown>>;
|
|
6
|
+
pauseSubscription(externalId: string): Promise<Record<string, unknown>>;
|
|
7
|
+
resumeSubscription(externalId: string): Promise<Record<string, unknown>>;
|
|
8
|
+
createInvoice(data: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
9
|
+
chargeInvoice(externalInvoiceId: string): Promise<Record<string, unknown>>;
|
|
10
|
+
refundPayment(externalTransactionId: string, amountCents?: number): Promise<Record<string, unknown>>;
|
|
11
|
+
parseWebhook(rawBody: string, signature: string): Promise<Record<string, unknown>>;
|
|
12
|
+
getPaymentStatus(externalId: string): Promise<string>;
|
|
13
|
+
getSubscriptionStatus(externalId: string): Promise<string>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Injectable, Logger } from '@nestjs/common';
|
|
2
|
+
import { PaymentGatewayAdapter } from './payment-gateway.adapter';
|
|
3
|
+
|
|
4
|
+
@Injectable()
|
|
5
|
+
export class StripeAdapter implements PaymentGatewayAdapter {
|
|
6
|
+
private readonly logger = new Logger(StripeAdapter.name);
|
|
7
|
+
|
|
8
|
+
async createCustomer(data: Record<string, unknown>) {
|
|
9
|
+
this.logger.log('Stripe: createCustomer', data);
|
|
10
|
+
return { id: `cus_stub_${Date.now()}`, ...data };
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async createCheckoutSession(data: Record<string, unknown>) {
|
|
14
|
+
this.logger.log('Stripe: createCheckoutSession', data);
|
|
15
|
+
return { id: `cs_stub_${Date.now()}`, url: 'https://checkout.stripe.com/stub' };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async createSubscription(data: Record<string, unknown>) {
|
|
19
|
+
this.logger.log('Stripe: createSubscription', data);
|
|
20
|
+
return { id: `sub_stub_${Date.now()}`, status: 'active', ...data };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async cancelSubscription(externalId: string) {
|
|
24
|
+
this.logger.log('Stripe: cancelSubscription', externalId);
|
|
25
|
+
return { id: externalId, status: 'canceled' };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async pauseSubscription(externalId: string) {
|
|
29
|
+
this.logger.log('Stripe: pauseSubscription', externalId);
|
|
30
|
+
return { id: externalId, status: 'paused' };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async resumeSubscription(externalId: string) {
|
|
34
|
+
this.logger.log('Stripe: resumeSubscription', externalId);
|
|
35
|
+
return { id: externalId, status: 'active' };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async createInvoice(data: Record<string, unknown>) {
|
|
39
|
+
this.logger.log('Stripe: createInvoice', data);
|
|
40
|
+
return { id: `in_stub_${Date.now()}`, status: 'draft', ...data };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async chargeInvoice(externalInvoiceId: string) {
|
|
44
|
+
this.logger.log('Stripe: chargeInvoice', externalInvoiceId);
|
|
45
|
+
return { id: externalInvoiceId, status: 'paid' };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async refundPayment(externalTransactionId: string, amountCents?: number) {
|
|
49
|
+
this.logger.log('Stripe: refundPayment', { externalTransactionId, amountCents });
|
|
50
|
+
return { id: `re_stub_${Date.now()}`, status: 'succeeded', amount: amountCents };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async parseWebhook(rawBody: string, signature: string) {
|
|
54
|
+
this.logger.log('Stripe: parseWebhook signature', signature);
|
|
55
|
+
return JSON.parse(rawBody);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async getPaymentStatus(externalId: string) {
|
|
59
|
+
this.logger.log('Stripe: getPaymentStatus', externalId);
|
|
60
|
+
return 'paid';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async getSubscriptionStatus(externalId: string) {
|
|
64
|
+
this.logger.log('Stripe: getSubscriptionStatus', externalId);
|
|
65
|
+
return 'active';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Role } from '@hed-hog/api';
|
|
2
|
+
import { Pagination, PaginationDTO } from '@hed-hog/api-pagination';
|
|
3
|
+
import {
|
|
4
|
+
Body,
|
|
5
|
+
Controller,
|
|
6
|
+
Delete,
|
|
7
|
+
Get,
|
|
8
|
+
Param,
|
|
9
|
+
ParseIntPipe,
|
|
10
|
+
Patch,
|
|
11
|
+
Post,
|
|
12
|
+
} from '@nestjs/common';
|
|
13
|
+
import { BillingService } from './billing.service';
|
|
14
|
+
import { CreateContractDto } from './dto/create-contract.dto';
|
|
15
|
+
import { UpdateContractDto } from './dto/update-contract.dto';
|
|
16
|
+
|
|
17
|
+
@Role()
|
|
18
|
+
@Controller('billing')
|
|
19
|
+
export class BillingContractsController {
|
|
20
|
+
constructor(private readonly billingService: BillingService) {}
|
|
21
|
+
|
|
22
|
+
@Get('contracts')
|
|
23
|
+
list(@Pagination() paginationParams: PaginationDTO) {
|
|
24
|
+
return this.billingService.listContracts(paginationParams);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@Get('contracts/:id')
|
|
28
|
+
get(@Param('id', ParseIntPipe) id: number) {
|
|
29
|
+
return this.billingService.getContract(id);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@Post('contracts')
|
|
33
|
+
create(@Body() dto: CreateContractDto) {
|
|
34
|
+
return this.billingService.createContract(dto);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@Patch('contracts/:id')
|
|
38
|
+
update(@Param('id', ParseIntPipe) id: number, @Body() dto: UpdateContractDto) {
|
|
39
|
+
return this.billingService.updateContract(id, dto);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@Delete('contracts/:id')
|
|
43
|
+
remove(@Param('id', ParseIntPipe) id: number) {
|
|
44
|
+
return this.billingService.deleteContract(id);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Role } from '@hed-hog/api';
|
|
2
|
+
import { Pagination, PaginationDTO } from '@hed-hog/api-pagination';
|
|
3
|
+
import {
|
|
4
|
+
Body,
|
|
5
|
+
Controller,
|
|
6
|
+
Delete,
|
|
7
|
+
Get,
|
|
8
|
+
Param,
|
|
9
|
+
ParseIntPipe,
|
|
10
|
+
Patch,
|
|
11
|
+
Post,
|
|
12
|
+
} from '@nestjs/common';
|
|
13
|
+
import { BillingService } from './billing.service';
|
|
14
|
+
import { CreateCouponDto } from './dto/create-coupon.dto';
|
|
15
|
+
import { UpdateCouponDto } from './dto/update-coupon.dto';
|
|
16
|
+
|
|
17
|
+
@Role()
|
|
18
|
+
@Controller('billing')
|
|
19
|
+
export class BillingCouponsController {
|
|
20
|
+
constructor(private readonly billingService: BillingService) {}
|
|
21
|
+
|
|
22
|
+
@Get('coupons')
|
|
23
|
+
list(@Pagination() paginationParams: PaginationDTO) {
|
|
24
|
+
return this.billingService.listCoupons(paginationParams);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@Get('coupons/:id')
|
|
28
|
+
get(@Param('id', ParseIntPipe) id: number) {
|
|
29
|
+
return this.billingService.getCoupon(id);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@Post('coupons')
|
|
33
|
+
create(@Body() dto: CreateCouponDto) {
|
|
34
|
+
return this.billingService.createCoupon(dto);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@Patch('coupons/:id')
|
|
38
|
+
update(@Param('id', ParseIntPipe) id: number, @Body() dto: UpdateCouponDto) {
|
|
39
|
+
return this.billingService.updateCoupon(id, dto);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@Delete('coupons/:id')
|
|
43
|
+
remove(@Param('id', ParseIntPipe) id: number) {
|
|
44
|
+
return this.billingService.deleteCoupon(id);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Role } from '@hed-hog/api';
|
|
2
|
+
import { Controller, Get } from '@nestjs/common';
|
|
3
|
+
import { BillingService } from './billing.service';
|
|
4
|
+
|
|
5
|
+
@Role()
|
|
6
|
+
@Controller('billing')
|
|
7
|
+
export class BillingDashboardController {
|
|
8
|
+
constructor(private readonly billingService: BillingService) {}
|
|
9
|
+
|
|
10
|
+
@Get('dashboard')
|
|
11
|
+
getData() {
|
|
12
|
+
return this.billingService.getDashboardData();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Role } from '@hed-hog/api';
|
|
2
|
+
import { Pagination, PaginationDTO } from '@hed-hog/api-pagination';
|
|
3
|
+
import {
|
|
4
|
+
Body,
|
|
5
|
+
Controller,
|
|
6
|
+
Delete,
|
|
7
|
+
Get,
|
|
8
|
+
Param,
|
|
9
|
+
ParseIntPipe,
|
|
10
|
+
Post,
|
|
11
|
+
} from '@nestjs/common';
|
|
12
|
+
import { BillingService } from './billing.service';
|
|
13
|
+
import { CreateEntitlementDto } from './dto/create-entitlement.dto';
|
|
14
|
+
|
|
15
|
+
@Role()
|
|
16
|
+
@Controller('billing')
|
|
17
|
+
export class BillingEntitlementsController {
|
|
18
|
+
constructor(private readonly billingService: BillingService) {}
|
|
19
|
+
|
|
20
|
+
@Get('entitlements')
|
|
21
|
+
list(@Pagination() paginationParams: PaginationDTO) {
|
|
22
|
+
return this.billingService.listEntitlements(paginationParams);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@Post('entitlements')
|
|
26
|
+
create(@Body() dto: CreateEntitlementDto) {
|
|
27
|
+
return this.billingService.createEntitlement(dto);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@Delete('entitlements/:id')
|
|
31
|
+
remove(@Param('id', ParseIntPipe) id: number) {
|
|
32
|
+
return this.billingService.deleteEntitlement(id);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Role } from '@hed-hog/api';
|
|
2
|
+
import { Body, Controller, Get, Param, Patch } from '@nestjs/common';
|
|
3
|
+
import { BillingService } from './billing.service';
|
|
4
|
+
|
|
5
|
+
@Role()
|
|
6
|
+
@Controller('billing')
|
|
7
|
+
export class BillingGatewaysController {
|
|
8
|
+
constructor(private readonly billingService: BillingService) {}
|
|
9
|
+
|
|
10
|
+
@Get('gateways')
|
|
11
|
+
list() {
|
|
12
|
+
return this.billingService.listGateways();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@Patch('gateways/:slug')
|
|
16
|
+
update(@Param('slug') slug: string, @Body() data: Record<string, unknown>) {
|
|
17
|
+
return this.billingService.updateGateway(slug, data);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Role } from '@hed-hog/api';
|
|
2
|
+
import { Pagination, PaginationDTO } from '@hed-hog/api-pagination';
|
|
3
|
+
import {
|
|
4
|
+
Body,
|
|
5
|
+
Controller,
|
|
6
|
+
Get,
|
|
7
|
+
Param,
|
|
8
|
+
ParseIntPipe,
|
|
9
|
+
Post,
|
|
10
|
+
} from '@nestjs/common';
|
|
11
|
+
import { BillingService } from './billing.service';
|
|
12
|
+
|
|
13
|
+
@Role()
|
|
14
|
+
@Controller('billing')
|
|
15
|
+
export class BillingInvoicesController {
|
|
16
|
+
constructor(private readonly billingService: BillingService) {}
|
|
17
|
+
|
|
18
|
+
@Get('invoices')
|
|
19
|
+
list(@Pagination() paginationParams: PaginationDTO) {
|
|
20
|
+
return this.billingService.listInvoices(paginationParams);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@Get('invoices/:id')
|
|
24
|
+
get(@Param('id', ParseIntPipe) id: number) {
|
|
25
|
+
return this.billingService.getInvoice(id);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@Post('invoices')
|
|
29
|
+
create(@Body() data: Record<string, unknown>) {
|
|
30
|
+
return this.billingService.createInvoice(data);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Role } from '@hed-hog/api';
|
|
2
|
+
import { Pagination, PaginationDTO } from '@hed-hog/api-pagination';
|
|
3
|
+
import {
|
|
4
|
+
Body,
|
|
5
|
+
Controller,
|
|
6
|
+
Delete,
|
|
7
|
+
Get,
|
|
8
|
+
Param,
|
|
9
|
+
ParseIntPipe,
|
|
10
|
+
Patch,
|
|
11
|
+
Post,
|
|
12
|
+
} from '@nestjs/common';
|
|
13
|
+
import { BillingService } from './billing.service';
|
|
14
|
+
import { CreateOfferDto } from './dto/create-offer.dto';
|
|
15
|
+
import { UpdateOfferDto } from './dto/update-offer.dto';
|
|
16
|
+
|
|
17
|
+
@Role()
|
|
18
|
+
@Controller('billing')
|
|
19
|
+
export class BillingOffersController {
|
|
20
|
+
constructor(private readonly billingService: BillingService) {}
|
|
21
|
+
|
|
22
|
+
@Get('offers')
|
|
23
|
+
list(@Pagination() paginationParams: PaginationDTO) {
|
|
24
|
+
return this.billingService.listOffers(paginationParams);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@Get('offers/:id')
|
|
28
|
+
get(@Param('id', ParseIntPipe) id: number) {
|
|
29
|
+
return this.billingService.getOffer(id);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@Post('offers')
|
|
33
|
+
create(@Body() dto: CreateOfferDto) {
|
|
34
|
+
return this.billingService.createOffer(dto);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@Patch('offers/:id')
|
|
38
|
+
update(@Param('id', ParseIntPipe) id: number, @Body() dto: UpdateOfferDto) {
|
|
39
|
+
return this.billingService.updateOffer(id, dto);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@Delete('offers/:id')
|
|
43
|
+
remove(@Param('id', ParseIntPipe) id: number) {
|
|
44
|
+
return this.billingService.deleteOffer(id);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Role } from '@hed-hog/api';
|
|
2
|
+
import { Pagination, PaginationDTO } from '@hed-hog/api-pagination';
|
|
3
|
+
import {
|
|
4
|
+
Body,
|
|
5
|
+
Controller,
|
|
6
|
+
Get,
|
|
7
|
+
Param,
|
|
8
|
+
ParseIntPipe,
|
|
9
|
+
Post,
|
|
10
|
+
} from '@nestjs/common';
|
|
11
|
+
import { BillingService } from './billing.service';
|
|
12
|
+
import { CreateOrderDto } from './dto/create-order.dto';
|
|
13
|
+
|
|
14
|
+
@Role()
|
|
15
|
+
@Controller('billing')
|
|
16
|
+
export class BillingOrdersController {
|
|
17
|
+
constructor(private readonly billingService: BillingService) {}
|
|
18
|
+
|
|
19
|
+
@Get('orders')
|
|
20
|
+
list(@Pagination() paginationParams: PaginationDTO) {
|
|
21
|
+
return this.billingService.listOrders(paginationParams);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@Get('orders/:id')
|
|
25
|
+
get(@Param('id', ParseIntPipe) id: number) {
|
|
26
|
+
return this.billingService.getOrder(id);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@Post('orders')
|
|
30
|
+
create(@Body() dto: CreateOrderDto) {
|
|
31
|
+
return this.billingService.createOrder(dto);
|
|
32
|
+
}
|
|
33
|
+
}
|