@pulsar.money/atlas-sdk 0.5.6 → 0.5.8
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/decorator/wallet-address.decorator.js +23 -15
- package/dist/decorator/wallet-address.decorator.js.map +1 -1
- package/dist/modules/profiles/profiles.types.d.ts +3 -0
- package/dist/modules/profiles/profiles.types.js.map +1 -1
- package/dist/modules/stripe/stripe.controller.d.ts +5 -2
- package/dist/modules/stripe/stripe.controller.js +26 -0
- package/dist/modules/stripe/stripe.controller.js.map +1 -1
- package/dist/modules/stripe/stripe.service.d.ts +5 -2
- package/dist/modules/stripe/stripe.service.js +9 -0
- package/dist/modules/stripe/stripe.service.js.map +1 -1
- package/dist/modules/stripe/stripe.types.d.ts +3 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -4,25 +4,33 @@ exports.WalletAddress = void 0;
|
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
const api_config_service_1 = require("../config/api-config.service");
|
|
6
6
|
exports.WalletAddress = (0, common_1.createParamDecorator)((_, ctx) => {
|
|
7
|
+
var _a, _b, _c, _d;
|
|
7
8
|
const request = ctx.switchToHttp().getRequest();
|
|
8
9
|
const serviceType = api_config_service_1.ApiConfigService.getServiceType();
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
try {
|
|
11
|
+
let address = undefined;
|
|
12
|
+
switch (serviceType) {
|
|
13
|
+
case "multiversx":
|
|
14
|
+
address = (_a = request.nativeAuth) === null || _a === void 0 ? void 0 : _a.address;
|
|
15
|
+
break;
|
|
16
|
+
case "starknet":
|
|
17
|
+
address = (_b = request.session) === null || _b === void 0 ? void 0 : _b.address;
|
|
18
|
+
break;
|
|
19
|
+
case "evm":
|
|
20
|
+
address = (_d = (_c = request.session) === null || _c === void 0 ? void 0 : _c.siwe) === null || _d === void 0 ? void 0 : _d.address;
|
|
21
|
+
break;
|
|
22
|
+
default:
|
|
23
|
+
throw new Error("Invalid service type");
|
|
24
|
+
}
|
|
25
|
+
if (!address) {
|
|
26
|
+
throw new common_1.UnauthorizedException("You are not authenticated");
|
|
27
|
+
}
|
|
28
|
+
return address;
|
|
22
29
|
}
|
|
23
|
-
|
|
30
|
+
catch (error) {
|
|
31
|
+
console.log(request);
|
|
32
|
+
console.error("error while getting wallet address for chain ", serviceType, error);
|
|
24
33
|
throw new common_1.UnauthorizedException("You are not authenticated");
|
|
25
34
|
}
|
|
26
|
-
return address;
|
|
27
35
|
});
|
|
28
36
|
//# sourceMappingURL=wallet-address.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet-address.decorator.js","sourceRoot":"","sources":["../../src/decorator/wallet-address.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAIwB;AACxB,qEAAgE;AAEnD,QAAA,aAAa,GAAG,IAAA,6BAAoB,EAC/C,CAAC,CAAU,EAAE,GAAqB,EAAE,EAAE
|
|
1
|
+
{"version":3,"file":"wallet-address.decorator.js","sourceRoot":"","sources":["../../src/decorator/wallet-address.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAIwB;AACxB,qEAAgE;AAEnD,QAAA,aAAa,GAAG,IAAA,6BAAoB,EAC/C,CAAC,CAAU,EAAE,GAAqB,EAAE,EAAE;;IACpC,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;IAChD,MAAM,WAAW,GAAG,qCAAgB,CAAC,cAAc,EAAE,CAAC;IAEtD,IAAI;QACF,IAAI,OAAO,GAAW,SAAS,CAAC;QAChC,QAAQ,WAAW,EAAE;YACnB,KAAK,YAAY;gBACf,OAAO,GAAG,MAAA,OAAO,CAAC,UAAU,0CAAE,OAAO,CAAC;gBACtC,MAAM;YACR,KAAK,UAAU;gBACb,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,0CAAE,OAAO,CAAC;gBACnC,MAAM;YACR,KAAK,KAAK;gBACR,OAAO,GAAG,MAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,IAAI,0CAAE,OAAO,CAAC;gBACzC,MAAM;YACR;gBACE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;SAC3C;QAED,IAAI,CAAC,OAAO,EAAE;YACZ,MAAM,IAAI,8BAAqB,CAAC,2BAA2B,CAAC,CAAC;SAC9D;QACD,OAAO,OAAO,CAAC;KAChB;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrB,OAAO,CAAC,KAAK,CACX,+CAA+C,EAC/C,WAAW,EACX,KAAK,CACN,CAAC;QACF,MAAM,IAAI,8BAAqB,CAAC,2BAA2B,CAAC,CAAC;KAC9D;AACH,CAAC,CACF,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Donation } from "../public-profiles";
|
|
2
|
+
import { Subscription } from "../stripe/stripe.types";
|
|
2
3
|
export interface LinkAddressInput {
|
|
3
4
|
email: string;
|
|
4
5
|
}
|
|
@@ -14,6 +15,8 @@ export interface UserProfile {
|
|
|
14
15
|
profileImage: string;
|
|
15
16
|
kycApplicant?: KycApplicant;
|
|
16
17
|
profile?: Profile;
|
|
18
|
+
subscription?: Subscription;
|
|
19
|
+
hasPremiumSubscription: boolean;
|
|
17
20
|
}
|
|
18
21
|
export interface UpdateUserProfileInput {
|
|
19
22
|
firstName?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiles.types.js","sourceRoot":"","sources":["../../../src/modules/profiles/profiles.types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"profiles.types.js","sourceRoot":"","sources":["../../../src/modules/profiles/profiles.types.ts"],"names":[],"mappings":";;;AAkDA,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,iCAAmB,CAAA;IACnB,mCAAqB,CAAA;IACrB,mCAAqB,CAAA;AACvB,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB;AAoED,IAAY,KAGX;AAHD,WAAY,KAAK;IACf,kCAAyB,CAAA;IACzB,8BAAqB,CAAA;AACvB,CAAC,EAHW,KAAK,qBAAL,KAAK,QAGhB"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { StripeService } from "./stripe.service";
|
|
2
|
-
import { CreateCheckoutSessionDto } from "./stripe.types";
|
|
2
|
+
import { CreateCheckoutSessionDto, CreatePortalSessionDto } from "./stripe.types";
|
|
3
3
|
export declare class StripeController {
|
|
4
4
|
private readonly stripeService;
|
|
5
5
|
constructor(stripeService: StripeService);
|
|
6
6
|
createCheckoutSession(address: string, input: CreateCheckoutSessionDto): Promise<{
|
|
7
|
-
|
|
7
|
+
checkoutUrl: string;
|
|
8
|
+
}>;
|
|
9
|
+
createBillingPortalSession(address: string, input: CreatePortalSessionDto): Promise<{
|
|
10
|
+
portalUrl: string;
|
|
8
11
|
}>;
|
|
9
12
|
}
|
|
@@ -24,6 +24,9 @@ let StripeController = class StripeController {
|
|
|
24
24
|
async createCheckoutSession(address, input) {
|
|
25
25
|
return await this.stripeService.createCheckoutSession(address, input);
|
|
26
26
|
}
|
|
27
|
+
async createBillingPortalSession(address, input) {
|
|
28
|
+
return await this.stripeService.createBillingPortalSession(address, input);
|
|
29
|
+
}
|
|
27
30
|
};
|
|
28
31
|
exports.StripeController = StripeController;
|
|
29
32
|
__decorate([
|
|
@@ -49,6 +52,29 @@ __decorate([
|
|
|
49
52
|
__metadata("design:paramtypes", [String, Object]),
|
|
50
53
|
__metadata("design:returntype", Promise)
|
|
51
54
|
], StripeController.prototype, "createCheckoutSession", null);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, common_1.Post)("portal"),
|
|
57
|
+
(0, swagger_1.ApiOperation)({ summary: "Create a Stripe billing portal session" }),
|
|
58
|
+
(0, swagger_1.ApiResponse)({
|
|
59
|
+
status: 200,
|
|
60
|
+
description: "Billing portal URL created successfully",
|
|
61
|
+
schema: {
|
|
62
|
+
properties: {
|
|
63
|
+
url: {
|
|
64
|
+
type: "string",
|
|
65
|
+
description: "Stripe billing portal URL",
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
}),
|
|
70
|
+
(0, swagger_1.ApiResponse)({ status: 400, description: "Bad request" }),
|
|
71
|
+
(0, swagger_1.ApiResponse)({ status: 404, description: "User not found" }),
|
|
72
|
+
__param(0, (0, wallet_address_decorator_1.WalletAddress)()),
|
|
73
|
+
__param(1, (0, common_1.Body)()),
|
|
74
|
+
__metadata("design:type", Function),
|
|
75
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
76
|
+
__metadata("design:returntype", Promise)
|
|
77
|
+
], StripeController.prototype, "createBillingPortalSession", null);
|
|
52
78
|
exports.StripeController = StripeController = __decorate([
|
|
53
79
|
(0, swagger_1.ApiTags)("Stripe"),
|
|
54
80
|
(0, common_1.Controller)("stripe"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stripe.controller.js","sourceRoot":"","sources":["../../../src/modules/stripe/stripe.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAwD;AACxD,6CAAqE;AACrE,qDAAiD;
|
|
1
|
+
{"version":3,"file":"stripe.controller.js","sourceRoot":"","sources":["../../../src/modules/stripe/stripe.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAwD;AACxD,6CAAqE;AACrE,qDAAiD;AAKjD,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,qBAAq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AAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC;IAEzD,WAAA,IAAA,wCAAa,GAAE,CAAA;IACf,WAAA,IAAA,aAAI,GAAE,CAAA;;;;kEAGR;2BA/CU,gBAAgB;IAF5B,IAAA,iBAAO,EAAC,QAAQ,CAAC;IACjB,IAAA,mBAAU,EAAC,QAAQ,CAAC;qCAEyB,8BAAa;GAD9C,gBAAgB,CAgD5B"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { Subscription, CreateCheckoutSessionDto } from "./stripe.types";
|
|
1
|
+
import { Subscription, CreateCheckoutSessionDto, CreatePortalSessionDto } from "./stripe.types";
|
|
2
2
|
export declare class StripeService {
|
|
3
3
|
private readonly axiosInstance;
|
|
4
4
|
constructor();
|
|
5
5
|
private createJwt;
|
|
6
6
|
private handleAxiosError;
|
|
7
7
|
createCheckoutSession(address: string, input: CreateCheckoutSessionDto): Promise<{
|
|
8
|
-
|
|
8
|
+
checkoutUrl: string;
|
|
9
|
+
}>;
|
|
10
|
+
createBillingPortalSession(address: string, input: CreatePortalSessionDto): Promise<{
|
|
11
|
+
portalUrl: string;
|
|
9
12
|
}>;
|
|
10
13
|
getSubscription(address: string): Promise<Subscription>;
|
|
11
14
|
cancelSubscription(address: string): Promise<void>;
|
|
@@ -45,6 +45,15 @@ let StripeService = class StripeService {
|
|
|
45
45
|
this.handleAxiosError(error);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
+
async createBillingPortalSession(address, input) {
|
|
49
|
+
try {
|
|
50
|
+
const response = await this.axiosInstance.post(`/stripe/portal/${address}`, input);
|
|
51
|
+
return response.data;
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
this.handleAxiosError(error);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
48
57
|
async getSubscription(address) {
|
|
49
58
|
var _a;
|
|
50
59
|
try {
|
|
@@ -1 +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;
|
|
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;AAQ5D,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,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE;SACxC,CAAC;QACF,OAAO,IAAA,mBAAI,EAAC,OAAO,EAAE,qCAAgB,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAC7D,CAAC;IAEO,gBAAgB,CAAC,KAAU;;QACjC,MAAM,YAAY,GAAG,CAAA,MAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,IAAI,0CAAE,KAAK,KAAI,mBAAmB,CAAC;QACxE,MAAM,IAAI,4BAAmB,CAAC,YAAY,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,qBAAqB,CACzB,OAAe,EACf,KAA+B;QAE/B,IAAI;Y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