@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,8 @@
|
|
|
1
|
+
import { PaymentGatewayAdapter } from './payment-gateway.adapter';
|
|
2
|
+
export declare class BillingGatewayRegistry {
|
|
3
|
+
private readonly registry;
|
|
4
|
+
register(slug: string, adapter: PaymentGatewayAdapter): void;
|
|
5
|
+
getAdapter(slug: string): PaymentGatewayAdapter;
|
|
6
|
+
listAdapters(): string[];
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=billing-gateway-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-gateway-registry.d.ts","sourceRoot":"","sources":["../../src/adapters/billing-gateway-registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,qBACa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA4C;IAErE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,qBAAqB,GAAG,IAAI;IAI5D,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB;IAQ/C,YAAY,IAAI,MAAM,EAAE;CAGzB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.BillingGatewayRegistry = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
let BillingGatewayRegistry = class BillingGatewayRegistry {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.registry = new Map();
|
|
14
|
+
}
|
|
15
|
+
register(slug, adapter) {
|
|
16
|
+
this.registry.set(slug, adapter);
|
|
17
|
+
}
|
|
18
|
+
getAdapter(slug) {
|
|
19
|
+
const adapter = this.registry.get(slug);
|
|
20
|
+
if (!adapter) {
|
|
21
|
+
throw new Error(`No payment gateway adapter registered for slug: ${slug}`);
|
|
22
|
+
}
|
|
23
|
+
return adapter;
|
|
24
|
+
}
|
|
25
|
+
listAdapters() {
|
|
26
|
+
return Array.from(this.registry.keys());
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
exports.BillingGatewayRegistry = BillingGatewayRegistry;
|
|
30
|
+
exports.BillingGatewayRegistry = BillingGatewayRegistry = __decorate([
|
|
31
|
+
(0, common_1.Injectable)()
|
|
32
|
+
], BillingGatewayRegistry);
|
|
33
|
+
//# sourceMappingURL=billing-gateway-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-gateway-registry.js","sourceRoot":"","sources":["../../src/adapters/billing-gateway-registry.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAIrC,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAA5B;QACY,aAAQ,GAAG,IAAI,GAAG,EAAiC,CAAC;IAiBvE,CAAC;IAfC,QAAQ,CAAC,IAAY,EAAE,OAA8B;QACnD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,UAAU,CAAC,IAAY;QACrB,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,mDAAmD,IAAI,EAAE,CAAC,CAAC;QAC7E,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,YAAY;QACV,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1C,CAAC;CACF,CAAA;AAlBY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;GACA,sBAAsB,CAkBlC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { PaymentGatewayAdapter } from './payment-gateway.adapter';
|
|
2
|
+
export declare class MercadoPagoAdapter implements PaymentGatewayAdapter {
|
|
3
|
+
private readonly logger;
|
|
4
|
+
createCustomer(data: Record<string, unknown>): Promise<{
|
|
5
|
+
id: string;
|
|
6
|
+
}>;
|
|
7
|
+
createCheckoutSession(data: Record<string, unknown>): Promise<{
|
|
8
|
+
id: string;
|
|
9
|
+
init_point: string;
|
|
10
|
+
}>;
|
|
11
|
+
createSubscription(data: Record<string, unknown>): Promise<{
|
|
12
|
+
id: string;
|
|
13
|
+
status: string;
|
|
14
|
+
}>;
|
|
15
|
+
cancelSubscription(externalId: string): Promise<{
|
|
16
|
+
id: string;
|
|
17
|
+
status: string;
|
|
18
|
+
}>;
|
|
19
|
+
pauseSubscription(externalId: string): Promise<{
|
|
20
|
+
id: string;
|
|
21
|
+
status: string;
|
|
22
|
+
}>;
|
|
23
|
+
resumeSubscription(externalId: string): Promise<{
|
|
24
|
+
id: string;
|
|
25
|
+
status: string;
|
|
26
|
+
}>;
|
|
27
|
+
createInvoice(data: Record<string, unknown>): Promise<{
|
|
28
|
+
id: string;
|
|
29
|
+
status: string;
|
|
30
|
+
}>;
|
|
31
|
+
chargeInvoice(externalInvoiceId: string): Promise<{
|
|
32
|
+
id: string;
|
|
33
|
+
status: string;
|
|
34
|
+
}>;
|
|
35
|
+
refundPayment(externalTransactionId: string, amountCents?: number): Promise<{
|
|
36
|
+
id: string;
|
|
37
|
+
status: string;
|
|
38
|
+
amount: number;
|
|
39
|
+
}>;
|
|
40
|
+
parseWebhook(rawBody: string, _signature: string): Promise<any>;
|
|
41
|
+
getPaymentStatus(externalId: string): Promise<string>;
|
|
42
|
+
getSubscriptionStatus(externalId: string): Promise<string>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=mercadopago.adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mercadopago.adapter.d.ts","sourceRoot":"","sources":["../../src/adapters/mercadopago.adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,qBACa,kBAAmB,YAAW,qBAAqB;IAC9D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuC;IAExD,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;IAK5C,qBAAqB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;IAKnD,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;IAKhD,kBAAkB,CAAC,UAAU,EAAE,MAAM;;;;IAKrC,iBAAiB,CAAC,UAAU,EAAE,MAAM;;;;IAKpC,kBAAkB,CAAC,UAAU,EAAE,MAAM;;;;IAKrC,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;IAK3C,aAAa,CAAC,iBAAiB,EAAE,MAAM;;;;IAKvC,aAAa,CAAC,qBAAqB,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM;;;;;IAKjE,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAIhD,gBAAgB,CAAC,UAAU,EAAE,MAAM;IAKnC,qBAAqB,CAAC,UAAU,EAAE,MAAM;CAI/C"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var MercadoPagoAdapter_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.MercadoPagoAdapter = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
let MercadoPagoAdapter = MercadoPagoAdapter_1 = class MercadoPagoAdapter {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.logger = new common_1.Logger(MercadoPagoAdapter_1.name);
|
|
15
|
+
}
|
|
16
|
+
async createCustomer(data) {
|
|
17
|
+
this.logger.log('MercadoPago: createCustomer', data);
|
|
18
|
+
return Object.assign({ id: `cust_mp_${Date.now()}` }, data);
|
|
19
|
+
}
|
|
20
|
+
async createCheckoutSession(data) {
|
|
21
|
+
this.logger.log('MercadoPago: createCheckoutSession', data);
|
|
22
|
+
return { id: `pref_mp_${Date.now()}`, init_point: 'https://www.mercadopago.com.br/checkout/v1/redirect?pref_id=stub' };
|
|
23
|
+
}
|
|
24
|
+
async createSubscription(data) {
|
|
25
|
+
this.logger.log('MercadoPago: createSubscription', data);
|
|
26
|
+
return Object.assign({ id: `sub_mp_${Date.now()}`, status: 'authorized' }, data);
|
|
27
|
+
}
|
|
28
|
+
async cancelSubscription(externalId) {
|
|
29
|
+
this.logger.log('MercadoPago: cancelSubscription', externalId);
|
|
30
|
+
return { id: externalId, status: 'cancelled' };
|
|
31
|
+
}
|
|
32
|
+
async pauseSubscription(externalId) {
|
|
33
|
+
this.logger.log('MercadoPago: pauseSubscription', externalId);
|
|
34
|
+
return { id: externalId, status: 'paused' };
|
|
35
|
+
}
|
|
36
|
+
async resumeSubscription(externalId) {
|
|
37
|
+
this.logger.log('MercadoPago: resumeSubscription', externalId);
|
|
38
|
+
return { id: externalId, status: 'authorized' };
|
|
39
|
+
}
|
|
40
|
+
async createInvoice(data) {
|
|
41
|
+
this.logger.log('MercadoPago: createInvoice', data);
|
|
42
|
+
return Object.assign({ id: `inv_mp_${Date.now()}`, status: 'pending' }, data);
|
|
43
|
+
}
|
|
44
|
+
async chargeInvoice(externalInvoiceId) {
|
|
45
|
+
this.logger.log('MercadoPago: chargeInvoice', externalInvoiceId);
|
|
46
|
+
return { id: externalInvoiceId, status: 'approved' };
|
|
47
|
+
}
|
|
48
|
+
async refundPayment(externalTransactionId, amountCents) {
|
|
49
|
+
this.logger.log('MercadoPago: refundPayment', { externalTransactionId, amountCents });
|
|
50
|
+
return { id: `ref_mp_${Date.now()}`, status: 'approved', amount: amountCents };
|
|
51
|
+
}
|
|
52
|
+
async parseWebhook(rawBody, _signature) {
|
|
53
|
+
return JSON.parse(rawBody);
|
|
54
|
+
}
|
|
55
|
+
async getPaymentStatus(externalId) {
|
|
56
|
+
this.logger.log('MercadoPago: getPaymentStatus', externalId);
|
|
57
|
+
return 'approved';
|
|
58
|
+
}
|
|
59
|
+
async getSubscriptionStatus(externalId) {
|
|
60
|
+
this.logger.log('MercadoPago: getSubscriptionStatus', externalId);
|
|
61
|
+
return 'authorized';
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
exports.MercadoPagoAdapter = MercadoPagoAdapter;
|
|
65
|
+
exports.MercadoPagoAdapter = MercadoPagoAdapter = MercadoPagoAdapter_1 = __decorate([
|
|
66
|
+
(0, common_1.Injectable)()
|
|
67
|
+
], MercadoPagoAdapter);
|
|
68
|
+
//# sourceMappingURL=mercadopago.adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mercadopago.adapter.js","sourceRoot":"","sources":["../../src/adapters/mercadopago.adapter.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAoD;AAI7C,IAAM,kBAAkB,0BAAxB,MAAM,kBAAkB;IAAxB;QACY,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ACtB,CAAC;CACF,CAAA;AA7DY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,mBAAU,GAAE;GACA,kBAAkB,CA6D9B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { PaymentGatewayAdapter } from './payment-gateway.adapter';
|
|
2
|
+
export declare class PagarmeAdapter implements PaymentGatewayAdapter {
|
|
3
|
+
private readonly logger;
|
|
4
|
+
createCustomer(data: Record<string, unknown>): Promise<{
|
|
5
|
+
id: string;
|
|
6
|
+
}>;
|
|
7
|
+
createCheckoutSession(data: Record<string, unknown>): Promise<{
|
|
8
|
+
id: string;
|
|
9
|
+
payment_url: string;
|
|
10
|
+
}>;
|
|
11
|
+
createSubscription(data: Record<string, unknown>): Promise<{
|
|
12
|
+
id: string;
|
|
13
|
+
status: string;
|
|
14
|
+
}>;
|
|
15
|
+
cancelSubscription(externalId: string): Promise<{
|
|
16
|
+
id: string;
|
|
17
|
+
status: string;
|
|
18
|
+
}>;
|
|
19
|
+
pauseSubscription(externalId: string): Promise<{
|
|
20
|
+
id: string;
|
|
21
|
+
status: string;
|
|
22
|
+
}>;
|
|
23
|
+
resumeSubscription(externalId: string): Promise<{
|
|
24
|
+
id: string;
|
|
25
|
+
status: string;
|
|
26
|
+
}>;
|
|
27
|
+
createInvoice(data: Record<string, unknown>): Promise<{
|
|
28
|
+
id: string;
|
|
29
|
+
status: string;
|
|
30
|
+
}>;
|
|
31
|
+
chargeInvoice(externalInvoiceId: string): Promise<{
|
|
32
|
+
id: string;
|
|
33
|
+
status: string;
|
|
34
|
+
}>;
|
|
35
|
+
refundPayment(externalTransactionId: string, amountCents?: number): Promise<{
|
|
36
|
+
id: string;
|
|
37
|
+
status: string;
|
|
38
|
+
amount: number;
|
|
39
|
+
}>;
|
|
40
|
+
parseWebhook(rawBody: string, _signature: string): Promise<any>;
|
|
41
|
+
getPaymentStatus(externalId: string): Promise<string>;
|
|
42
|
+
getSubscriptionStatus(externalId: string): Promise<string>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=pagarme.adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagarme.adapter.d.ts","sourceRoot":"","sources":["../../src/adapters/pagarme.adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,qBACa,cAAe,YAAW,qBAAqB;IAC1D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmC;IAEpD,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;IAK5C,qBAAqB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;IAKnD,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;IAKhD,kBAAkB,CAAC,UAAU,EAAE,MAAM;;;;IAKrC,iBAAiB,CAAC,UAAU,EAAE,MAAM;;;;IAKpC,kBAAkB,CAAC,UAAU,EAAE,MAAM;;;;IAKrC,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;IAK3C,aAAa,CAAC,iBAAiB,EAAE,MAAM;;;;IAKvC,aAAa,CAAC,qBAAqB,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM;;;;;IAKjE,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAIhD,gBAAgB,CAAC,UAAU,EAAE,MAAM;IAKnC,qBAAqB,CAAC,UAAU,EAAE,MAAM;CAI/C"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var PagarmeAdapter_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.PagarmeAdapter = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
let PagarmeAdapter = PagarmeAdapter_1 = class PagarmeAdapter {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.logger = new common_1.Logger(PagarmeAdapter_1.name);
|
|
15
|
+
}
|
|
16
|
+
async createCustomer(data) {
|
|
17
|
+
this.logger.log('Pagarme: createCustomer', data);
|
|
18
|
+
return Object.assign({ id: `cus_pagar_${Date.now()}` }, data);
|
|
19
|
+
}
|
|
20
|
+
async createCheckoutSession(data) {
|
|
21
|
+
this.logger.log('Pagarme: createCheckoutSession', data);
|
|
22
|
+
return { id: `order_pagar_${Date.now()}`, payment_url: 'https://api.pagar.me/stub' };
|
|
23
|
+
}
|
|
24
|
+
async createSubscription(data) {
|
|
25
|
+
this.logger.log('Pagarme: createSubscription', data);
|
|
26
|
+
return Object.assign({ id: `sub_pagar_${Date.now()}`, status: 'active' }, data);
|
|
27
|
+
}
|
|
28
|
+
async cancelSubscription(externalId) {
|
|
29
|
+
this.logger.log('Pagarme: cancelSubscription', externalId);
|
|
30
|
+
return { id: externalId, status: 'canceled' };
|
|
31
|
+
}
|
|
32
|
+
async pauseSubscription(externalId) {
|
|
33
|
+
this.logger.log('Pagarme: pauseSubscription', externalId);
|
|
34
|
+
return { id: externalId, status: 'paused' };
|
|
35
|
+
}
|
|
36
|
+
async resumeSubscription(externalId) {
|
|
37
|
+
this.logger.log('Pagarme: resumeSubscription', externalId);
|
|
38
|
+
return { id: externalId, status: 'active' };
|
|
39
|
+
}
|
|
40
|
+
async createInvoice(data) {
|
|
41
|
+
this.logger.log('Pagarme: createInvoice', data);
|
|
42
|
+
return Object.assign({ id: `inv_pagar_${Date.now()}`, status: 'pending' }, data);
|
|
43
|
+
}
|
|
44
|
+
async chargeInvoice(externalInvoiceId) {
|
|
45
|
+
this.logger.log('Pagarme: chargeInvoice', externalInvoiceId);
|
|
46
|
+
return { id: externalInvoiceId, status: 'paid' };
|
|
47
|
+
}
|
|
48
|
+
async refundPayment(externalTransactionId, amountCents) {
|
|
49
|
+
this.logger.log('Pagarme: refundPayment', { externalTransactionId, amountCents });
|
|
50
|
+
return { id: `ref_pagar_${Date.now()}`, status: 'refunded', amount: amountCents };
|
|
51
|
+
}
|
|
52
|
+
async parseWebhook(rawBody, _signature) {
|
|
53
|
+
return JSON.parse(rawBody);
|
|
54
|
+
}
|
|
55
|
+
async getPaymentStatus(externalId) {
|
|
56
|
+
this.logger.log('Pagarme: getPaymentStatus', externalId);
|
|
57
|
+
return 'paid';
|
|
58
|
+
}
|
|
59
|
+
async getSubscriptionStatus(externalId) {
|
|
60
|
+
this.logger.log('Pagarme: getSubscriptionStatus', externalId);
|
|
61
|
+
return 'active';
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
exports.PagarmeAdapter = PagarmeAdapter;
|
|
65
|
+
exports.PagarmeAdapter = PagarmeAdapter = PagarmeAdapter_1 = __decorate([
|
|
66
|
+
(0, common_1.Injectable)()
|
|
67
|
+
], PagarmeAdapter);
|
|
68
|
+
//# sourceMappingURL=pagarme.adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagarme.adapter.js","sourceRoot":"","sources":["../../src/adapters/pagarme.adapter.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAoD;AAI7C,IAAM,cAAc,sBAApB,MAAM,cAAc;IAApB;QACY,WAAM,GAAG,IAAI,eAAM,CAAC,gBAAc,CAAC,IAAI,CAAC,CAAC;IA4D5D,CAAC;IA1DC,KAAK,CAAC,cAAc,CAAC,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@ -0,0 +1,15 @@
|
|
|
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
|
+
}
|
|
15
|
+
//# sourceMappingURL=payment-gateway.adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-gateway.adapter.d.ts","sourceRoot":"","sources":["../../src/adapters/payment-gateway.adapter.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAChF,qBAAqB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACvF,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACpF,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACzE,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACxE,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACzE,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC/E,aAAa,CAAC,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC3E,aAAa,CAAC,qBAAqB,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACrG,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnF,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACtD,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC5D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-gateway.adapter.js","sourceRoot":"","sources":["../../src/adapters/payment-gateway.adapter.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { PaymentGatewayAdapter } from './payment-gateway.adapter';
|
|
2
|
+
export declare class StripeAdapter implements PaymentGatewayAdapter {
|
|
3
|
+
private readonly logger;
|
|
4
|
+
createCustomer(data: Record<string, unknown>): Promise<{
|
|
5
|
+
id: string;
|
|
6
|
+
}>;
|
|
7
|
+
createCheckoutSession(data: Record<string, unknown>): Promise<{
|
|
8
|
+
id: string;
|
|
9
|
+
url: string;
|
|
10
|
+
}>;
|
|
11
|
+
createSubscription(data: Record<string, unknown>): Promise<{
|
|
12
|
+
id: string;
|
|
13
|
+
status: string;
|
|
14
|
+
}>;
|
|
15
|
+
cancelSubscription(externalId: string): Promise<{
|
|
16
|
+
id: string;
|
|
17
|
+
status: string;
|
|
18
|
+
}>;
|
|
19
|
+
pauseSubscription(externalId: string): Promise<{
|
|
20
|
+
id: string;
|
|
21
|
+
status: string;
|
|
22
|
+
}>;
|
|
23
|
+
resumeSubscription(externalId: string): Promise<{
|
|
24
|
+
id: string;
|
|
25
|
+
status: string;
|
|
26
|
+
}>;
|
|
27
|
+
createInvoice(data: Record<string, unknown>): Promise<{
|
|
28
|
+
id: string;
|
|
29
|
+
status: string;
|
|
30
|
+
}>;
|
|
31
|
+
chargeInvoice(externalInvoiceId: string): Promise<{
|
|
32
|
+
id: string;
|
|
33
|
+
status: string;
|
|
34
|
+
}>;
|
|
35
|
+
refundPayment(externalTransactionId: string, amountCents?: number): Promise<{
|
|
36
|
+
id: string;
|
|
37
|
+
status: string;
|
|
38
|
+
amount: number;
|
|
39
|
+
}>;
|
|
40
|
+
parseWebhook(rawBody: string, signature: string): Promise<any>;
|
|
41
|
+
getPaymentStatus(externalId: string): Promise<string>;
|
|
42
|
+
getSubscriptionStatus(externalId: string): Promise<string>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=stripe.adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripe.adapter.d.ts","sourceRoot":"","sources":["../../src/adapters/stripe.adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,qBACa,aAAc,YAAW,qBAAqB;IACzD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkC;IAEnD,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;IAK5C,qBAAqB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;IAKnD,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;IAKhD,kBAAkB,CAAC,UAAU,EAAE,MAAM;;;;IAKrC,iBAAiB,CAAC,UAAU,EAAE,MAAM;;;;IAKpC,kBAAkB,CAAC,UAAU,EAAE,MAAM;;;;IAKrC,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;IAK3C,aAAa,CAAC,iBAAiB,EAAE,MAAM;;;;IAKvC,aAAa,CAAC,qBAAqB,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM;;;;;IAKjE,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAK/C,gBAAgB,CAAC,UAAU,EAAE,MAAM;IAKnC,qBAAqB,CAAC,UAAU,EAAE,MAAM;CAI/C"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var StripeAdapter_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.StripeAdapter = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
let StripeAdapter = StripeAdapter_1 = class StripeAdapter {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.logger = new common_1.Logger(StripeAdapter_1.name);
|
|
15
|
+
}
|
|
16
|
+
async createCustomer(data) {
|
|
17
|
+
this.logger.log('Stripe: createCustomer', data);
|
|
18
|
+
return Object.assign({ id: `cus_stub_${Date.now()}` }, data);
|
|
19
|
+
}
|
|
20
|
+
async createCheckoutSession(data) {
|
|
21
|
+
this.logger.log('Stripe: createCheckoutSession', data);
|
|
22
|
+
return { id: `cs_stub_${Date.now()}`, url: 'https://checkout.stripe.com/stub' };
|
|
23
|
+
}
|
|
24
|
+
async createSubscription(data) {
|
|
25
|
+
this.logger.log('Stripe: createSubscription', data);
|
|
26
|
+
return Object.assign({ id: `sub_stub_${Date.now()}`, status: 'active' }, data);
|
|
27
|
+
}
|
|
28
|
+
async cancelSubscription(externalId) {
|
|
29
|
+
this.logger.log('Stripe: cancelSubscription', externalId);
|
|
30
|
+
return { id: externalId, status: 'canceled' };
|
|
31
|
+
}
|
|
32
|
+
async pauseSubscription(externalId) {
|
|
33
|
+
this.logger.log('Stripe: pauseSubscription', externalId);
|
|
34
|
+
return { id: externalId, status: 'paused' };
|
|
35
|
+
}
|
|
36
|
+
async resumeSubscription(externalId) {
|
|
37
|
+
this.logger.log('Stripe: resumeSubscription', externalId);
|
|
38
|
+
return { id: externalId, status: 'active' };
|
|
39
|
+
}
|
|
40
|
+
async createInvoice(data) {
|
|
41
|
+
this.logger.log('Stripe: createInvoice', data);
|
|
42
|
+
return Object.assign({ id: `in_stub_${Date.now()}`, status: 'draft' }, data);
|
|
43
|
+
}
|
|
44
|
+
async chargeInvoice(externalInvoiceId) {
|
|
45
|
+
this.logger.log('Stripe: chargeInvoice', externalInvoiceId);
|
|
46
|
+
return { id: externalInvoiceId, status: 'paid' };
|
|
47
|
+
}
|
|
48
|
+
async refundPayment(externalTransactionId, amountCents) {
|
|
49
|
+
this.logger.log('Stripe: refundPayment', { externalTransactionId, amountCents });
|
|
50
|
+
return { id: `re_stub_${Date.now()}`, status: 'succeeded', amount: amountCents };
|
|
51
|
+
}
|
|
52
|
+
async parseWebhook(rawBody, signature) {
|
|
53
|
+
this.logger.log('Stripe: parseWebhook signature', signature);
|
|
54
|
+
return JSON.parse(rawBody);
|
|
55
|
+
}
|
|
56
|
+
async getPaymentStatus(externalId) {
|
|
57
|
+
this.logger.log('Stripe: getPaymentStatus', externalId);
|
|
58
|
+
return 'paid';
|
|
59
|
+
}
|
|
60
|
+
async getSubscriptionStatus(externalId) {
|
|
61
|
+
this.logger.log('Stripe: getSubscriptionStatus', externalId);
|
|
62
|
+
return 'active';
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
exports.StripeAdapter = StripeAdapter;
|
|
66
|
+
exports.StripeAdapter = StripeAdapter = StripeAdapter_1 = __decorate([
|
|
67
|
+
(0, common_1.Injectable)()
|
|
68
|
+
], StripeAdapter);
|
|
69
|
+
//# sourceMappingURL=stripe.adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripe.adapter.js","sourceRoot":"","sources":["../../src/adapters/stripe.adapter.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAoD;AAI7C,IAAM,aAAa,qBAAnB,MAAM,aAAa;IAAnB;QACY,WAAM,GAAG,IAAI,eAAM,CAAC,eAAa,CAAC,IAAI,CAAC,CAAC;IA6D3D,CAAC;IA3DC,KAAK,CAAC,cAAc,CAAC,IAA6B;QAChD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,wBAAwB,EAAE,IAAI,CAAC,CAAC;QAChD,uBAAS,EAAE,EAAE,YAAY,IAAI,CAAC,GAAG,EAAE,EAAE,IAAK,IAAI,EAAG;IACnD,CAAC;IAED,KAAK,CAAC,qBAAqB,CAAC,IAA6B;QACvD,I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nE,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,iBAAyB;QAC3C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,uBAAuB,EAAE,iBAAiB,CAAC,CAAC;QAC5D,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IACnD,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,qBAA6B,EAAE,WAAoB;QACrE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,uBAAuB,EAAE,EAAE,qBAAqB,EAAE,WAAW,EAAE,CAAC,CAAC;QACjF,OAAO,EAAE,EAAE,EAAE,WAAW,IAAI,CAAC,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IACnF,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAAe,EAAE,SAAiB;QACnD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,gCAAgC,EAAE,SAAS,CAAC,CAAC;QAC7D,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,UAAkB;QACvC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,0BAA0B,EAAE,UAAU,CAAC,CAAC;QACxD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,qBAAqB,CAAC,UAAkB;QAC5C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,+BAA+B,EAAE,UAAU,CAAC,CAAC;QAC7D,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAA;AA9DY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;GACA,aAAa,CA8DzB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PaginationDTO } from '@hed-hog/api-pagination';
|
|
2
|
+
import { BillingService } from './billing.service';
|
|
3
|
+
import { CreateContractDto } from './dto/create-contract.dto';
|
|
4
|
+
import { UpdateContractDto } from './dto/update-contract.dto';
|
|
5
|
+
export declare class BillingContractsController {
|
|
6
|
+
private readonly billingService;
|
|
7
|
+
constructor(billingService: BillingService);
|
|
8
|
+
list(paginationParams: PaginationDTO): Promise<{
|
|
9
|
+
total: any;
|
|
10
|
+
lastPage: number;
|
|
11
|
+
page: number;
|
|
12
|
+
pageSize: number;
|
|
13
|
+
prev: number;
|
|
14
|
+
next: number;
|
|
15
|
+
data: any[];
|
|
16
|
+
}>;
|
|
17
|
+
get(id: number): Promise<any>;
|
|
18
|
+
create(dto: CreateContractDto): Promise<any>;
|
|
19
|
+
update(id: number, dto: UpdateContractDto): Promise<any>;
|
|
20
|
+
remove(id: number): Promise<any>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=billing-contracts.controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-contracts.controller.d.ts","sourceRoot":"","sources":["../src/billing-contracts.controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAWpE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,qBAEa,0BAA0B;IACzB,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAAd,cAAc,EAAE,cAAc;IAG3D,IAAI,CAAe,gBAAgB,EAAE,aAAa;;;;;;;;;IAKlD,GAAG,CAA4B,EAAE,EAAE,MAAM;IAKzC,MAAM,CAAS,GAAG,EAAE,iBAAiB;IAKrC,MAAM,CAA4B,EAAE,EAAE,MAAM,EAAU,GAAG,EAAE,iBAAiB;IAK5E,MAAM,CAA4B,EAAE,EAAE,MAAM;CAG7C"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.BillingContractsController = void 0;
|
|
16
|
+
const api_1 = require("@hed-hog/api");
|
|
17
|
+
const api_pagination_1 = require("@hed-hog/api-pagination");
|
|
18
|
+
const common_1 = require("@nestjs/common");
|
|
19
|
+
const billing_service_1 = require("./billing.service");
|
|
20
|
+
const create_contract_dto_1 = require("./dto/create-contract.dto");
|
|
21
|
+
const update_contract_dto_1 = require("./dto/update-contract.dto");
|
|
22
|
+
let BillingContractsController = class BillingContractsController {
|
|
23
|
+
constructor(billingService) {
|
|
24
|
+
this.billingService = billingService;
|
|
25
|
+
}
|
|
26
|
+
list(paginationParams) {
|
|
27
|
+
return this.billingService.listContracts(paginationParams);
|
|
28
|
+
}
|
|
29
|
+
get(id) {
|
|
30
|
+
return this.billingService.getContract(id);
|
|
31
|
+
}
|
|
32
|
+
create(dto) {
|
|
33
|
+
return this.billingService.createContract(dto);
|
|
34
|
+
}
|
|
35
|
+
update(id, dto) {
|
|
36
|
+
return this.billingService.updateContract(id, dto);
|
|
37
|
+
}
|
|
38
|
+
remove(id) {
|
|
39
|
+
return this.billingService.deleteContract(id);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
exports.BillingContractsController = BillingContractsController;
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, common_1.Get)('contracts'),
|
|
45
|
+
__param(0, (0, api_pagination_1.Pagination)()),
|
|
46
|
+
__metadata("design:type", Function),
|
|
47
|
+
__metadata("design:paramtypes", [api_pagination_1.PaginationDTO]),
|
|
48
|
+
__metadata("design:returntype", void 0)
|
|
49
|
+
], BillingContractsController.prototype, "list", null);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, common_1.Get)('contracts/:id'),
|
|
52
|
+
__param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
|
|
53
|
+
__metadata("design:type", Function),
|
|
54
|
+
__metadata("design:paramtypes", [Number]),
|
|
55
|
+
__metadata("design:returntype", void 0)
|
|
56
|
+
], BillingContractsController.prototype, "get", null);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, common_1.Post)('contracts'),
|
|
59
|
+
__param(0, (0, common_1.Body)()),
|
|
60
|
+
__metadata("design:type", Function),
|
|
61
|
+
__metadata("design:paramtypes", [create_contract_dto_1.CreateContractDto]),
|
|
62
|
+
__metadata("design:returntype", void 0)
|
|
63
|
+
], BillingContractsController.prototype, "create", null);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, common_1.Patch)('contracts/:id'),
|
|
66
|
+
__param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
|
|
67
|
+
__param(1, (0, common_1.Body)()),
|
|
68
|
+
__metadata("design:type", Function),
|
|
69
|
+
__metadata("design:paramtypes", [Number, update_contract_dto_1.UpdateContractDto]),
|
|
70
|
+
__metadata("design:returntype", void 0)
|
|
71
|
+
], BillingContractsController.prototype, "update", null);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, common_1.Delete)('contracts/:id'),
|
|
74
|
+
__param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
|
|
75
|
+
__metadata("design:type", Function),
|
|
76
|
+
__metadata("design:paramtypes", [Number]),
|
|
77
|
+
__metadata("design:returntype", void 0)
|
|
78
|
+
], BillingContractsController.prototype, "remove", null);
|
|
79
|
+
exports.BillingContractsController = BillingContractsController = __decorate([
|
|
80
|
+
(0, api_1.Role)(),
|
|
81
|
+
(0, common_1.Controller)('billing'),
|
|
82
|
+
__metadata("design:paramtypes", [billing_service_1.BillingService])
|
|
83
|
+
], BillingContractsController);
|
|
84
|
+
//# sourceMappingURL=billing-contracts.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-contracts.controller.js","sourceRoot":"","sources":["../src/billing-contracts.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAAoC;AACpC,4DAAoE;AACpE,2CASwB;AACxB,uDAAmD;AACnD,mEAA8D;AAC9D,mEAA8D;AAIvD,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IACrC,YAA6B,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;IAAG,CAAC;IAG/D,IAAI,CAAe,gBAA+B;QAChD,OAAO,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC7D,CAAC;IAGD,GAAG,CAA4B,EAAU;QACvC,OAAO,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAC7C,CAAC;IAGD,MAAM,CAAS,GAAsB;QACnC,OAAO,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IACjD,CAAC;IAGD,MAAM,CAA4B,EAAU,EAAU,GAAsB;QAC1E,OAAO,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IACrD,CAAC;IAGD,MAAM,CAA4B,EAAU;QAC1C,OAAO,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IAChD,CAAC;CACF,CAAA;AA3BY,gEAA0B;AAIrC;IADC,IAAA,YAAG,EAAC,WAAW,CAAC;IACX,WAAA,IAAA,2BAAU,GAAE,CAAA;;qCAAmB,8BAAa;;sDAEjD;AAGD;IADC,IAAA,YAAG,EAAC,eAAe,CAAC;IAChB,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,qBAAY,CAAC,CAAA;;;;qDAE7B;AAGD;IADC,IAAA,aAAI,EAAC,WAAW,CAAC;IACV,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAM,uCAAiB;;wDAEpC;AAGD;IADC,IAAA,cAAK,EAAC,eAAe,CAAC;IACf,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,qBAAY,CAAC,CAAA;IAAc,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAAM,uCAAiB;;wDAE3E;AAGD;IADC,IAAA,eAAM,EAAC,eAAe,CAAC;IAChB,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,qBAAY,CAAC,CAAA;;;;wDAEhC;qCA1BU,0BAA0B;IAFtC,IAAA,UAAI,GAAE;IACN,IAAA,mBAAU,EAAC,SAAS,CAAC;qCAEyB,gCAAc;GADhD,0BAA0B,CA2BtC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PaginationDTO } from '@hed-hog/api-pagination';
|
|
2
|
+
import { BillingService } from './billing.service';
|
|
3
|
+
import { CreateCouponDto } from './dto/create-coupon.dto';
|
|
4
|
+
import { UpdateCouponDto } from './dto/update-coupon.dto';
|
|
5
|
+
export declare class BillingCouponsController {
|
|
6
|
+
private readonly billingService;
|
|
7
|
+
constructor(billingService: BillingService);
|
|
8
|
+
list(paginationParams: PaginationDTO): Promise<{
|
|
9
|
+
total: any;
|
|
10
|
+
lastPage: number;
|
|
11
|
+
page: number;
|
|
12
|
+
pageSize: number;
|
|
13
|
+
prev: number;
|
|
14
|
+
next: number;
|
|
15
|
+
data: any[];
|
|
16
|
+
}>;
|
|
17
|
+
get(id: number): Promise<any>;
|
|
18
|
+
create(dto: CreateCouponDto): Promise<any>;
|
|
19
|
+
update(id: number, dto: UpdateCouponDto): Promise<any>;
|
|
20
|
+
remove(id: number): Promise<any>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=billing-coupons.controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-coupons.controller.d.ts","sourceRoot":"","sources":["../src/billing-coupons.controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAWpE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,qBAEa,wBAAwB;IACvB,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAAd,cAAc,EAAE,cAAc;IAG3D,IAAI,CAAe,gBAAgB,EAAE,aAAa;;;;;;;;;IAKlD,GAAG,CAA4B,EAAE,EAAE,MAAM;IAKzC,MAAM,CAAS,GAAG,EAAE,eAAe;IAKnC,MAAM,CAA4B,EAAE,EAAE,MAAM,EAAU,GAAG,EAAE,eAAe;IAK1E,MAAM,CAA4B,EAAE,EAAE,MAAM;CAG7C"}
|