@pulsar.money/atlas-sdk 0.5.4 → 0.5.6
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/modules/index.d.ts +1 -0
- package/dist/modules/index.js +1 -0
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/profiles/dto/update-profile.dto.js +1 -8
- package/dist/modules/profiles/dto/update-profile.dto.js.map +1 -1
- package/dist/modules/stripe/index.d.ts +3 -0
- package/dist/modules/stripe/index.js +22 -0
- package/dist/modules/stripe/index.js.map +1 -0
- package/dist/modules/stripe/stripe.controller.d.ts +9 -0
- package/dist/modules/stripe/stripe.controller.js +57 -0
- package/dist/modules/stripe/stripe.controller.js.map +1 -0
- package/dist/modules/stripe/stripe.service.d.ts +13 -0
- package/dist/modules/stripe/stripe.service.js +91 -0
- package/dist/modules/stripe/stripe.service.js.map +1 -0
- package/dist/modules/stripe/stripe.types.d.ts +22 -0
- package/dist/modules/stripe/stripe.types.js +11 -0
- package/dist/modules/stripe/stripe.types.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/modules/index.d.ts
CHANGED
package/dist/modules/index.js
CHANGED
|
@@ -19,4 +19,5 @@ __exportStar(require("./payments"), exports);
|
|
|
19
19
|
__exportStar(require("./public-profiles"), exports);
|
|
20
20
|
__exportStar(require("./messages"), exports);
|
|
21
21
|
__exportStar(require("./moonpay"), exports);
|
|
22
|
+
__exportStar(require("./stripe"), exports);
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,6CAA2B;AAC3B,oDAAkC;AAClC,6CAA2B;AAC3B,4CAA0B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,6CAA2B;AAC3B,oDAAkC;AAClC,6CAA2B;AAC3B,4CAA0B;AAC1B,2CAAyB"}
|
|
@@ -28,7 +28,7 @@ __decorate([
|
|
|
28
28
|
(0, swagger_1.ApiProperty)({ required: false }),
|
|
29
29
|
(0, class_validator_1.IsOptional)(),
|
|
30
30
|
(0, class_validator_1.IsBoolean)(),
|
|
31
|
-
(0, class_transformer_1.Transform)(({ value }) => value ===
|
|
31
|
+
(0, class_transformer_1.Transform)(({ value }) => value === "true"),
|
|
32
32
|
__metadata("design:type", Boolean)
|
|
33
33
|
], UpdateProfileDto.prototype, "publicProfile", void 0);
|
|
34
34
|
__decorate([
|
|
@@ -54,43 +54,36 @@ __decorate([
|
|
|
54
54
|
__decorate([
|
|
55
55
|
(0, swagger_1.ApiProperty)({ required: false }),
|
|
56
56
|
(0, class_validator_1.IsOptional)(),
|
|
57
|
-
(0, class_validator_1.IsUrl)(),
|
|
58
57
|
__metadata("design:type", String)
|
|
59
58
|
], UpdateProfileDto.prototype, "instagram", void 0);
|
|
60
59
|
__decorate([
|
|
61
60
|
(0, swagger_1.ApiProperty)({ required: false }),
|
|
62
61
|
(0, class_validator_1.IsOptional)(),
|
|
63
|
-
(0, class_validator_1.IsUrl)(),
|
|
64
62
|
__metadata("design:type", String)
|
|
65
63
|
], UpdateProfileDto.prototype, "twitter", void 0);
|
|
66
64
|
__decorate([
|
|
67
65
|
(0, swagger_1.ApiProperty)({ required: false }),
|
|
68
66
|
(0, class_validator_1.IsOptional)(),
|
|
69
|
-
(0, class_validator_1.IsUrl)(),
|
|
70
67
|
__metadata("design:type", String)
|
|
71
68
|
], UpdateProfileDto.prototype, "discord", void 0);
|
|
72
69
|
__decorate([
|
|
73
70
|
(0, swagger_1.ApiProperty)({ required: false }),
|
|
74
71
|
(0, class_validator_1.IsOptional)(),
|
|
75
|
-
(0, class_validator_1.IsUrl)(),
|
|
76
72
|
__metadata("design:type", String)
|
|
77
73
|
], UpdateProfileDto.prototype, "linkedin", void 0);
|
|
78
74
|
__decorate([
|
|
79
75
|
(0, swagger_1.ApiProperty)({ required: false }),
|
|
80
76
|
(0, class_validator_1.IsOptional)(),
|
|
81
|
-
(0, class_validator_1.IsUrl)(),
|
|
82
77
|
__metadata("design:type", String)
|
|
83
78
|
], UpdateProfileDto.prototype, "website", void 0);
|
|
84
79
|
__decorate([
|
|
85
80
|
(0, swagger_1.ApiProperty)({ required: false }),
|
|
86
81
|
(0, class_validator_1.IsOptional)(),
|
|
87
|
-
(0, class_validator_1.IsUrl)(),
|
|
88
82
|
__metadata("design:type", String)
|
|
89
83
|
], UpdateProfileDto.prototype, "docs", void 0);
|
|
90
84
|
__decorate([
|
|
91
85
|
(0, swagger_1.ApiProperty)({ required: false }),
|
|
92
86
|
(0, class_validator_1.IsOptional)(),
|
|
93
|
-
(0, class_validator_1.IsUrl)(),
|
|
94
87
|
__metadata("design:type", String)
|
|
95
88
|
], UpdateProfileDto.prototype, "telegram", void 0);
|
|
96
89
|
//# sourceMappingURL=update-profile.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-profile.dto.js","sourceRoot":"","sources":["../../../../src/modules/profiles/dto/update-profile.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAC9C,qDAQyB;AACzB,yDAA8C;AAE9C,MAAa,gBAAgB;
|
|
1
|
+
{"version":3,"file":"update-profile.dto.js","sourceRoot":"","sources":["../../../../src/modules/profiles/dto/update-profile.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAC9C,qDAQyB;AACzB,yDAA8C;AAE9C,MAAa,gBAAgB;CA0D5B;AA1DD,4CA0DC;AApDC;IALC,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAChC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,CAAC,CAAC;IACZ,IAA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C,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAChC,IAAA,4BAAU,GAAE;;8CACC;AAId;IAFC,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAChC,IAAA,4BAAU,GAAE;;kDACK"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.StripeController = void 0;
|
|
18
|
+
__exportStar(require("./stripe.service"), exports);
|
|
19
|
+
var stripe_controller_1 = require("./stripe.controller");
|
|
20
|
+
Object.defineProperty(exports, "StripeController", { enumerable: true, get: function () { return stripe_controller_1.StripeController; } });
|
|
21
|
+
__exportStar(require("./stripe.types"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/stripe/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,yDAAuD;AAA9C,qHAAA,gBAAgB,OAAA;AACzB,iDAA+B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StripeService } from "./stripe.service";
|
|
2
|
+
import { CreateCheckoutSessionDto } from "./stripe.types";
|
|
3
|
+
export declare class StripeController {
|
|
4
|
+
private readonly stripeService;
|
|
5
|
+
constructor(stripeService: StripeService);
|
|
6
|
+
createCheckoutSession(address: string, input: CreateCheckoutSessionDto): Promise<{
|
|
7
|
+
url: string;
|
|
8
|
+
}>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
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.StripeController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
18
|
+
const stripe_service_1 = require("./stripe.service");
|
|
19
|
+
const wallet_address_decorator_1 = require("../../decorator/wallet-address.decorator");
|
|
20
|
+
let StripeController = class StripeController {
|
|
21
|
+
constructor(stripeService) {
|
|
22
|
+
this.stripeService = stripeService;
|
|
23
|
+
}
|
|
24
|
+
async createCheckoutSession(address, input) {
|
|
25
|
+
return await this.stripeService.createCheckoutSession(address, input);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.StripeController = StripeController;
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, common_1.Post)("checkout"),
|
|
31
|
+
(0, swagger_1.ApiOperation)({ summary: "Create a Stripe checkout session" }),
|
|
32
|
+
(0, swagger_1.ApiResponse)({
|
|
33
|
+
status: 200,
|
|
34
|
+
description: "Checkout URL created successfully",
|
|
35
|
+
schema: {
|
|
36
|
+
properties: {
|
|
37
|
+
url: {
|
|
38
|
+
type: "string",
|
|
39
|
+
description: "Stripe checkout URL",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
44
|
+
(0, swagger_1.ApiResponse)({ status: 400, description: "Bad request" }),
|
|
45
|
+
(0, swagger_1.ApiResponse)({ status: 404, description: "User not found" }),
|
|
46
|
+
__param(0, (0, wallet_address_decorator_1.WalletAddress)()),
|
|
47
|
+
__param(1, (0, common_1.Body)()),
|
|
48
|
+
__metadata("design:type", Function),
|
|
49
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
50
|
+
__metadata("design:returntype", Promise)
|
|
51
|
+
], StripeController.prototype, "createCheckoutSession", null);
|
|
52
|
+
exports.StripeController = StripeController = __decorate([
|
|
53
|
+
(0, swagger_1.ApiTags)("Stripe"),
|
|
54
|
+
(0, common_1.Controller)("stripe"),
|
|
55
|
+
__metadata("design:paramtypes", [stripe_service_1.StripeService])
|
|
56
|
+
], StripeController);
|
|
57
|
+
//# sourceMappingURL=stripe.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripe.controller.js","sourceRoot":"","sources":["../../../src/modules/stripe/stripe.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAwD;AACxD,6CAAqE;AACrE,qDAAiD;AAEjD,uFAAyE;AAIlE,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAC3B,YAA6B,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAAG,CAAC;IAkBvD,AAAN,KAAK,CAAC,qBAAqB,CACR,OAAe,EACxB,KAA+B;QAEvC,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACxE,CAAC;CACF,CAAA;AAzBY,4CAAgB;AAmBrB;IAhBL,IAAA,aAAI,EAAC,UAAU,CAAC;IAChB,IAAA,sBAAY,EAAC,EAAE,OAAO,EAAE,kCAAkC,EAAE,CAAC;IAC7D,IAAA,qBAAW,EAAC;QACX,MAAM,EAAE,GAAG;QACX,WAAW,EAAE,mCAAmC;QAChD,MAAM,EAAE;YACN,UAAU,EAAE;gBACV,GAAG,EAAE;oBACH,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,qBAAqB;iBACnC;aACF;SACF;KACF,CAAC;IACD,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC;IACxD,IAAA,qBAAW,EAAC,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC;IAEzD,WAAA,IAAA,wCAAa,GAAE,CAAA;IACf,WAAA,IAAA,aAAI,GAAE,CAAA;;;;6DAGR;2BAxBU,gBAAgB;IAF5B,IAAA,iBAAO,EAAC,QAAQ,CAAC;IACjB,IAAA,mBAAU,EAAC,QAAQ,CAAC;qCAEyB,8BAAa;GAD9C,gBAAgB,CAyB5B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Subscription, CreateCheckoutSessionDto } from "./stripe.types";
|
|
2
|
+
export declare class StripeService {
|
|
3
|
+
private readonly axiosInstance;
|
|
4
|
+
constructor();
|
|
5
|
+
private createJwt;
|
|
6
|
+
private handleAxiosError;
|
|
7
|
+
createCheckoutSession(address: string, input: CreateCheckoutSessionDto): Promise<{
|
|
8
|
+
url: string;
|
|
9
|
+
}>;
|
|
10
|
+
getSubscription(address: string): Promise<Subscription>;
|
|
11
|
+
cancelSubscription(address: string): Promise<void>;
|
|
12
|
+
reactivateSubscription(address: string): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.StripeService = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const axios_1 = require("axios");
|
|
15
|
+
const jsonwebtoken_1 = require("jsonwebtoken");
|
|
16
|
+
const api_config_service_1 = require("../../config/api-config.service");
|
|
17
|
+
let StripeService = class StripeService {
|
|
18
|
+
constructor() {
|
|
19
|
+
this.axiosInstance = axios_1.default.create({
|
|
20
|
+
baseURL: api_config_service_1.ApiConfigService.getAtlasBaseUrl(),
|
|
21
|
+
});
|
|
22
|
+
this.axiosInstance.interceptors.request.use((config) => {
|
|
23
|
+
const token = this.createJwt();
|
|
24
|
+
config.headers["Authorization"] = `Bearer ${token}`;
|
|
25
|
+
return config;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
createJwt() {
|
|
29
|
+
const payload = {
|
|
30
|
+
exp: Math.floor(Date.now() / 1000) + 60,
|
|
31
|
+
};
|
|
32
|
+
return (0, jsonwebtoken_1.sign)(payload, api_config_service_1.ApiConfigService.getAtlasJwtSecret());
|
|
33
|
+
}
|
|
34
|
+
handleAxiosError(error) {
|
|
35
|
+
var _a, _b;
|
|
36
|
+
const errorMessage = ((_b = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) || "An error occurred";
|
|
37
|
+
throw new common_1.BadRequestException(errorMessage);
|
|
38
|
+
}
|
|
39
|
+
async createCheckoutSession(address, input) {
|
|
40
|
+
try {
|
|
41
|
+
const response = await this.axiosInstance.post(`/stripe/checkout/${address}`, input);
|
|
42
|
+
return response.data;
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
this.handleAxiosError(error);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async getSubscription(address) {
|
|
49
|
+
var _a;
|
|
50
|
+
try {
|
|
51
|
+
const response = await this.axiosInstance.get(`/stripe/subscription/${address}`);
|
|
52
|
+
return response.data;
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
|
|
56
|
+
throw new common_1.NotFoundException("Subscription not found");
|
|
57
|
+
}
|
|
58
|
+
this.handleAxiosError(error);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async cancelSubscription(address) {
|
|
62
|
+
var _a;
|
|
63
|
+
try {
|
|
64
|
+
await this.axiosInstance.post(`/stripe/subscription/${address}/cancel`);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
|
|
68
|
+
throw new common_1.NotFoundException("Subscription not found");
|
|
69
|
+
}
|
|
70
|
+
this.handleAxiosError(error);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async reactivateSubscription(address) {
|
|
74
|
+
var _a;
|
|
75
|
+
try {
|
|
76
|
+
await this.axiosInstance.post(`/stripe/subscription/${address}/reactivate`);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
|
|
80
|
+
throw new common_1.NotFoundException("Subscription not found");
|
|
81
|
+
}
|
|
82
|
+
this.handleAxiosError(error);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
exports.StripeService = StripeService;
|
|
87
|
+
exports.StripeService = StripeService = __decorate([
|
|
88
|
+
(0, common_1.Injectable)(),
|
|
89
|
+
__metadata("design:paramtypes", [])
|
|
90
|
+
], StripeService);
|
|
91
|
+
//# sourceMappingURL=stripe.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripe.service.js","sourceRoot":"","sources":["../../../src/modules/stripe/stripe.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAIwB;AACxB,iCAA6C;AAC7C,+CAAoC;AACpC,wEAAmE;AAI5D,IAAM,aAAa,GAAnB,MAAM,aAAa;IAGxB;QACE,IAAI,CAAC,aAAa,GAAG,eAAK,CAAC,MAAM,CAAC;YAChC,OAAO,EAAE,qCAAgB,CAAC,eAAe,EAAE;SAC5C,CAAC,CAAC;QAEH,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;YACrD,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;YAC/B,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,KAAK,EAAE,CAAC;YACpD,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,SAAS;QACf,MAAM,OAAO,GAAG;YACd,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EA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AI,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE;gBAClC,MAAM,IAAI,0BAAiB,CAAC,wBAAwB,CAAC,CAAC;aACvD;YACD,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;SAC9B;IACH,CAAC;IAED,KAAK,CAAC,sBAAsB,CAAC,OAAe;;QAC1C,IAAI;YACF,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAC3B,wBAAwB,OAAO,aAAa,CAC7C,CAAC;SACH;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE;gBAClC,MAAM,IAAI,0BAAiB,CAAC,wBAAwB,CAAC,CAAC;aACvD;YACD,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;SAC9B;IACH,CAAC;CACF,CAAA;AA/EY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;;GACA,aAAa,CA+EzB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare enum SubscriptionStatus {
|
|
2
|
+
ACTIVE = "active",
|
|
3
|
+
INACTIVE = "inactive",
|
|
4
|
+
PAST_DUE = "past_due",
|
|
5
|
+
CANCELED = "canceled"
|
|
6
|
+
}
|
|
7
|
+
export interface Subscription {
|
|
8
|
+
id: string;
|
|
9
|
+
userId: number;
|
|
10
|
+
stripeCustomerId: string;
|
|
11
|
+
stripeSubscriptionId: string;
|
|
12
|
+
status: SubscriptionStatus;
|
|
13
|
+
currentPeriodStart: Date;
|
|
14
|
+
currentPeriodEnd: Date;
|
|
15
|
+
cancelAtPeriodEnd: boolean;
|
|
16
|
+
createdAt: Date;
|
|
17
|
+
updatedAt: Date;
|
|
18
|
+
canceledAt?: Date;
|
|
19
|
+
}
|
|
20
|
+
export interface CreateCheckoutSessionDto {
|
|
21
|
+
domain: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SubscriptionStatus = void 0;
|
|
4
|
+
var SubscriptionStatus;
|
|
5
|
+
(function (SubscriptionStatus) {
|
|
6
|
+
SubscriptionStatus["ACTIVE"] = "active";
|
|
7
|
+
SubscriptionStatus["INACTIVE"] = "inactive";
|
|
8
|
+
SubscriptionStatus["PAST_DUE"] = "past_due";
|
|
9
|
+
SubscriptionStatus["CANCELED"] = "canceled";
|
|
10
|
+
})(SubscriptionStatus || (exports.SubscriptionStatus = SubscriptionStatus = {}));
|
|
11
|
+
//# sourceMappingURL=stripe.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripe.types.js","sourceRoot":"","sources":["../../../src/modules/stripe/stripe.types.ts"],"names":[],"mappings":";;;AAAA,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,uCAAiB,CAAA;IACjB,2CAAqB,CAAA;IACrB,2CAAqB,CAAA;IACrB,2CAAqB,CAAA;AACvB,CAAC,EALW,kBAAkB,kCAAlB,kBAAkB,QAK7B"}
|