@cheqd/studio 3.3.0-develop.4 → 3.3.0-develop.5
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/controllers/admin/webhook.d.ts +9 -0
- package/dist/controllers/admin/webhook.d.ts.map +1 -1
- package/dist/controllers/admin/webhook.js +223 -46
- package/dist/controllers/admin/webhook.js.map +1 -1
- package/dist/controllers/api/account.d.ts +2 -2
- package/dist/controllers/api/account.d.ts.map +1 -1
- package/dist/controllers/api/account.js +10 -7
- package/dist/controllers/api/account.js.map +1 -1
- package/dist/database/entities/customer.entity.d.ts +2 -2
- package/dist/database/entities/customer.entity.d.ts.map +1 -1
- package/dist/database/entities/customer.entity.js +3 -2
- package/dist/database/entities/customer.entity.js.map +1 -1
- package/dist/database/migrations/AlterCustomerTableUniqueEmail.d.ts +6 -0
- package/dist/database/migrations/AlterCustomerTableUniqueEmail.d.ts.map +1 -0
- package/dist/database/migrations/AlterCustomerTableUniqueEmail.js +29 -0
- package/dist/database/migrations/AlterCustomerTableUniqueEmail.js.map +1 -0
- package/dist/database/migrations/MigrateData.js +1 -1
- package/dist/database/migrations/MigrateData.js.map +1 -1
- package/dist/database/types/types.d.ts.map +1 -1
- package/dist/database/types/types.js +3 -0
- package/dist/database/types/types.js.map +1 -1
- package/dist/services/admin/stripe.d.ts +1 -2
- package/dist/services/admin/stripe.d.ts.map +1 -1
- package/dist/services/admin/stripe.js +10 -15
- package/dist/services/admin/stripe.js.map +1 -1
- package/dist/services/api/customer.d.ts +1 -4
- package/dist/services/api/customer.d.ts.map +1 -1
- package/dist/services/api/customer.js +2 -5
- package/dist/services/api/customer.js.map +1 -1
- package/dist/services/track/helpers.d.ts +11 -0
- package/dist/services/track/helpers.d.ts.map +1 -1
- package/dist/services/track/helpers.js +14 -11
- package/dist/services/track/helpers.js.map +1 -1
- package/dist/services/track/tracker.d.ts.map +1 -1
- package/dist/services/track/tracker.js +0 -2
- package/dist/services/track/tracker.js.map +1 -1
- package/dist/static/swagger-api.json +6 -0
- package/dist/types/swagger-api-types.d.ts +4 -0
- package/dist/types/swagger-api-types.d.ts.map +1 -1
- package/dist/types/swagger-api-types.js +4 -0
- package/dist/types/swagger-api-types.js.map +1 -1
- package/package.json +1 -1
- package/dist/services/track/admin/subscription-submitter.d.ts +0 -17
- package/dist/services/track/admin/subscription-submitter.d.ts.map +0 -1
- package/dist/services/track/admin/subscription-submitter.js +0 -208
- package/dist/services/track/admin/subscription-submitter.js.map +0 -1
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import Stripe from 'stripe';
|
|
2
|
-
import { OperationNameEnum } from '../../../types/constants.js';
|
|
3
|
-
import { SubscriptionService } from '../../admin/subscription.js';
|
|
4
|
-
import { CustomerService } from '../../api/customer.js';
|
|
5
|
-
import { EventTracker } from '../tracker.js';
|
|
6
|
-
import { LogToHelper } from '../../../middleware/auth/logto-helper.js';
|
|
7
|
-
import { StatusCodes } from 'http-status-codes';
|
|
8
|
-
import { UserService } from '../../api/user.js';
|
|
9
|
-
export class SubscriptionSubmitter {
|
|
10
|
-
emitter;
|
|
11
|
-
stripe;
|
|
12
|
-
constructor(emitter) {
|
|
13
|
-
this.emitter = emitter;
|
|
14
|
-
this.stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
|
|
15
|
-
}
|
|
16
|
-
notify(notifyMessage) {
|
|
17
|
-
this.emitter.emit('notify', notifyMessage);
|
|
18
|
-
}
|
|
19
|
-
async update(operation) {
|
|
20
|
-
switch (operation.operation) {
|
|
21
|
-
case OperationNameEnum.SUBSCRIPTION_CREATE:
|
|
22
|
-
await this.submitSubscriptionCreate(operation);
|
|
23
|
-
break;
|
|
24
|
-
case OperationNameEnum.SUBSCRIPTION_UPDATE:
|
|
25
|
-
await this.submitSubscriptionUpdate(operation);
|
|
26
|
-
break;
|
|
27
|
-
case OperationNameEnum.SUBSCRIPTION_CANCEL:
|
|
28
|
-
await this.submitSubscriptionCancel(operation);
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
async handleCustomerRoleAssignment(operation, logToHelper, userLogtoId, productName) {
|
|
33
|
-
const roleAssignmentResponse = await logToHelper.assignCustomerPlanRoles(userLogtoId, productName.toLowerCase());
|
|
34
|
-
if (roleAssignmentResponse.status !== 201) {
|
|
35
|
-
this.notify({
|
|
36
|
-
message: EventTracker.compileBasicNotification(`Failed to assign roles to user for planType ${productName}: ${roleAssignmentResponse.error}`, operation.operation),
|
|
37
|
-
severity: 'error',
|
|
38
|
-
});
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
this.notify({
|
|
42
|
-
message: EventTracker.compileBasicNotification(`${productName} plan assigned to user with logtoId ${userLogtoId}`, operation.operation),
|
|
43
|
-
severity: 'info',
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
async handleCustomerRoleRemoval(operation, logto, userLogtoId) {
|
|
47
|
-
const responses = await Promise.allSettled([
|
|
48
|
-
logto.removeLogtoRoleFromUser(userLogtoId, process.env.LOGTO_TESTNET_ROLE_ID.trim()),
|
|
49
|
-
logto.removeLogtoRoleFromUser(userLogtoId, process.env.LOGTO_MAINNET_ROLE_ID.trim()),
|
|
50
|
-
]);
|
|
51
|
-
const allRolesRemoved = responses.every((r) => r.status === 'fulfilled' && r.value.status === StatusCodes.OK);
|
|
52
|
-
if (allRolesRemoved) {
|
|
53
|
-
this.notify({
|
|
54
|
-
message: EventTracker.compileBasicNotification(`Roles have been removed successfully for user with id: ${userLogtoId}`, operation.operation),
|
|
55
|
-
severity: 'info',
|
|
56
|
-
});
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
for (const resp of responses) {
|
|
60
|
-
if (resp.status === 'rejected' || resp.value.status !== StatusCodes.OK) {
|
|
61
|
-
const errMsg = resp.status === 'rejected' ? resp.reason.message : resp.value.error;
|
|
62
|
-
this.notify({
|
|
63
|
-
message: EventTracker.compileBasicNotification(`Role removal error: ${errMsg}`, operation.operation),
|
|
64
|
-
severity: 'error',
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
async syncLogtoRoles(operation, customerId, productName) {
|
|
70
|
-
const logToHelper = new LogToHelper();
|
|
71
|
-
const setupResp = await logToHelper.setup();
|
|
72
|
-
if (setupResp.status !== StatusCodes.OK) {
|
|
73
|
-
this.notify({
|
|
74
|
-
message: EventTracker.compileBasicNotification(`Logto client initialisation failed: ${setupResp.error}`, operation.operation),
|
|
75
|
-
severity: 'error',
|
|
76
|
-
});
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
const user = await UserService.instance.userRepository.findOne({ where: { customer: { customerId } } });
|
|
80
|
-
if (user) {
|
|
81
|
-
switch (operation.operation) {
|
|
82
|
-
case OperationNameEnum.SUBSCRIPTION_CREATE:
|
|
83
|
-
case OperationNameEnum.SUBSCRIPTION_UPDATE:
|
|
84
|
-
this.handleCustomerRoleAssignment(operation, logToHelper, user.logToId, productName);
|
|
85
|
-
return;
|
|
86
|
-
case OperationNameEnum.SUBSCRIPTION_CANCEL:
|
|
87
|
-
this.handleCustomerRoleRemoval(operation, logToHelper, user.logToId);
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
this.notify({
|
|
92
|
-
message: EventTracker.compileBasicNotification(`Role assignment failed: No user found with customerId: ${customerId}`, operation.operation),
|
|
93
|
-
severity: 'error',
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
async submitSubscriptionCreate(operation) {
|
|
97
|
-
const data = operation.data;
|
|
98
|
-
let customer = operation.options?.customer;
|
|
99
|
-
try {
|
|
100
|
-
const [product, stripeCustomer] = await Promise.all([
|
|
101
|
-
this.stripe.products.retrieve(data.productId),
|
|
102
|
-
this.stripe.customers.retrieve(data.paymentProviderId),
|
|
103
|
-
]);
|
|
104
|
-
if (!customer) {
|
|
105
|
-
const whereClause = [{ paymentProviderId: data.paymentProviderId }];
|
|
106
|
-
// we add an additional "OR" check in case that a customer was created locally with email and no paymentProviderId
|
|
107
|
-
if (!stripeCustomer.deleted && stripeCustomer.email) {
|
|
108
|
-
whereClause.push({ email: stripeCustomer.email });
|
|
109
|
-
}
|
|
110
|
-
const customers = await CustomerService.instance.customerRepository.find({
|
|
111
|
-
where: whereClause,
|
|
112
|
-
});
|
|
113
|
-
if (customers.length === 0) {
|
|
114
|
-
this.notify({
|
|
115
|
-
message: EventTracker.compileBasicNotification(`Customer not found for Cheqd Studio, creating new customer record with paymentProviderId: ${data.paymentProviderId}`, operation.operation),
|
|
116
|
-
severity: 'info',
|
|
117
|
-
});
|
|
118
|
-
if (!stripeCustomer.deleted && stripeCustomer.email) {
|
|
119
|
-
const customerName = stripeCustomer.name ?? stripeCustomer.email;
|
|
120
|
-
const customer = await CustomerService.instance.create(customerName, stripeCustomer.email, undefined, data.paymentProviderId);
|
|
121
|
-
customers.push(customer);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
if (customers.length !== 1) {
|
|
125
|
-
this.notify({
|
|
126
|
-
message: EventTracker.compileBasicNotification(`Only one Stripe account should be associated with CaaS customer. Stripe accountId: ${data.paymentProviderId}.`, operation.operation),
|
|
127
|
-
severity: 'error',
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
customer = customers[0];
|
|
131
|
-
}
|
|
132
|
-
const subscription = await SubscriptionService.instance.create(data.subscriptionId, customer, data.status, data.currentPeriodStart, data.currentPeriodEnd, data.trialStart, data.trialEnd);
|
|
133
|
-
if (!subscription) {
|
|
134
|
-
this.notify({
|
|
135
|
-
message: EventTracker.compileBasicNotification(`Failed to create a new subscription with id: ${data.subscriptionId}.`, operation.operation),
|
|
136
|
-
severity: 'error',
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
await this.syncLogtoRoles(operation, customer.customerId, product.name);
|
|
140
|
-
this.notify({
|
|
141
|
-
message: EventTracker.compileBasicNotification(`Subscription created with id: ${data.subscriptionId}.`, operation.operation),
|
|
142
|
-
severity: 'info',
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
catch (error) {
|
|
146
|
-
this.notify({
|
|
147
|
-
message: EventTracker.compileBasicNotification(`Failed to create a new subscription with id: ${data.subscriptionId} because of error: ${error?.message || error}`, operation.operation),
|
|
148
|
-
severity: 'error',
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
async submitSubscriptionUpdate(operation) {
|
|
153
|
-
const data = operation.data;
|
|
154
|
-
try {
|
|
155
|
-
const subscription = await SubscriptionService.instance.update(data.subscriptionId, data.status, data.currentPeriodStart, data.currentPeriodEnd, data.trialStart, data.trialEnd);
|
|
156
|
-
if (!subscription) {
|
|
157
|
-
this.notify({
|
|
158
|
-
message: EventTracker.compileBasicNotification(`Failed to update subscription with id: ${data.subscriptionId}.`, operation.operation),
|
|
159
|
-
severity: 'error',
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
const [customer, product] = await Promise.all([
|
|
163
|
-
CustomerService.instance.findbyPaymentProviderId(data.paymentProviderId),
|
|
164
|
-
this.stripe.products.retrieve(data.productId),
|
|
165
|
-
]);
|
|
166
|
-
if (customer) {
|
|
167
|
-
await this.syncLogtoRoles(operation, customer.customerId, product.name);
|
|
168
|
-
}
|
|
169
|
-
this.notify({
|
|
170
|
-
message: EventTracker.compileBasicNotification(`Subscription updated with id: ${data.subscriptionId}.`, operation.operation),
|
|
171
|
-
severity: 'info',
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
catch (error) {
|
|
175
|
-
this.notify({
|
|
176
|
-
message: EventTracker.compileBasicNotification(`Failed to update subscription with id: ${data.subscriptionId} because of error: ${error?.message || error}`, operation.operation),
|
|
177
|
-
severity: 'error',
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
async submitSubscriptionCancel(operation) {
|
|
182
|
-
const data = operation.data;
|
|
183
|
-
try {
|
|
184
|
-
const subscription = await SubscriptionService.instance.update(data.subscriptionId, data.status);
|
|
185
|
-
if (!subscription) {
|
|
186
|
-
this.notify({
|
|
187
|
-
message: EventTracker.compileBasicNotification(`Failed to cancel subscription with id: ${data.subscriptionId}.`, operation.operation),
|
|
188
|
-
severity: 'error',
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
const customer = await CustomerService.instance.findbyPaymentProviderId(data.paymentProviderId);
|
|
192
|
-
if (customer) {
|
|
193
|
-
this.syncLogtoRoles(operation, customer.customerId, '');
|
|
194
|
-
}
|
|
195
|
-
this.notify({
|
|
196
|
-
message: EventTracker.compileBasicNotification(`Subscription canceled with id: ${data.subscriptionId}.`, operation.operation),
|
|
197
|
-
severity: 'info',
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
catch (error) {
|
|
201
|
-
this.notify({
|
|
202
|
-
message: EventTracker.compileBasicNotification(`Failed to cancel subscription with id: ${data.subscriptionId} because of error: ${error?.message || error}`, operation.operation),
|
|
203
|
-
severity: 'error',
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
//# sourceMappingURL=subscription-submitter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscription-submitter.js","sourceRoot":"","sources":["../../../../src/services/track/admin/subscription-submitter.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,OAAO,qBAAqB;IACz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