@misterhomer1992/miit-bot-payment 1.0.6 → 1.0.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/README.md +1 -359
- package/dist/modules/cancellableAPI/utils.d.ts +1 -2
- package/dist/modules/cancellableAPI/utils.d.ts.map +1 -1
- package/dist/modules/cancellableAPI/utils.js.map +1 -1
- package/dist/modules/invoice/repository.d.ts +6 -26
- package/dist/modules/invoice/repository.d.ts.map +1 -1
- package/dist/modules/invoice/repository.js +2 -25
- package/dist/modules/invoice/repository.js.map +1 -1
- package/dist/modules/invoice/service.d.ts +6 -22
- package/dist/modules/invoice/service.d.ts.map +1 -1
- package/dist/modules/invoice/service.js +2 -21
- package/dist/modules/invoice/service.js.map +1 -1
- package/dist/modules/invoice/types.d.ts +30 -1
- package/dist/modules/invoice/types.d.ts.map +1 -1
- package/dist/modules/payments/api.d.ts +3 -4
- package/dist/modules/payments/api.d.ts.map +1 -1
- package/dist/modules/payments/api.js +3 -3
- package/dist/modules/payments/api.js.map +1 -1
- package/dist/modules/payments/repository.d.ts +7 -61
- package/dist/modules/payments/repository.d.ts.map +1 -1
- package/dist/modules/payments/repository.js +4 -59
- package/dist/modules/payments/repository.js.map +1 -1
- package/dist/modules/payments/service.d.ts +8 -67
- package/dist/modules/payments/service.d.ts.map +1 -1
- package/dist/modules/payments/service.js +7 -68
- package/dist/modules/payments/service.js.map +1 -1
- package/dist/modules/payments/types.d.ts +100 -3
- package/dist/modules/payments/types.d.ts.map +1 -1
- package/dist/modules/payments/utils.d.ts +3 -4
- package/dist/modules/payments/utils.d.ts.map +1 -1
- package/dist/modules/payments/utils.js +6 -6
- package/dist/modules/payments/utils.js.map +1 -1
- package/dist/modules/subscription/repository.d.ts +10 -85
- package/dist/modules/subscription/repository.d.ts.map +1 -1
- package/dist/modules/subscription/repository.js +17 -109
- package/dist/modules/subscription/repository.js.map +1 -1
- package/dist/modules/subscription/service.d.ts +13 -89
- package/dist/modules/subscription/service.d.ts.map +1 -1
- package/dist/modules/subscription/service.js +10 -83
- package/dist/modules/subscription/service.js.map +1 -1
- package/dist/modules/subscription/types.d.ts +127 -3
- package/dist/modules/subscription/types.d.ts.map +1 -1
- package/dist/modules/user/types.d.ts +67 -2
- package/dist/modules/user/types.d.ts.map +1 -1
- package/dist/modules/user/userRepository.d.ts +9 -48
- package/dist/modules/user/userRepository.d.ts.map +1 -1
- package/dist/modules/user/userRepository.js +8 -48
- package/dist/modules/user/userRepository.js.map +1 -1
- package/dist/modules/user/userService.d.ts +9 -38
- package/dist/modules/user/userService.d.ts.map +1 -1
- package/dist/modules/user/userService.js +5 -36
- package/dist/modules/user/userService.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { NestedPathsAccess } from '../../types/utilities';
|
|
2
|
-
import { AppNamespace } from '../app/types';
|
|
3
2
|
type PaymentEntity = {
|
|
4
3
|
/** Auto-generated unique ID (document ID) */
|
|
5
4
|
id?: string;
|
|
@@ -22,10 +21,108 @@ type PaymentEntity = {
|
|
|
22
21
|
/** Optional. The ID of the corresponding document in the invoices collection, added after the webhook is processed */
|
|
23
22
|
invoiceId?: string;
|
|
24
23
|
/** Platform/app namespace */
|
|
25
|
-
platform:
|
|
24
|
+
platform: string;
|
|
26
25
|
/** Payment provider */
|
|
27
26
|
provider: 'wayforpay';
|
|
28
27
|
};
|
|
29
28
|
type PaymentFieldPath = NestedPathsAccess<PaymentEntity>;
|
|
30
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Interface for payment repository operations.
|
|
31
|
+
* Defines the contract for data access layer.
|
|
32
|
+
*/
|
|
33
|
+
interface IPaymentRepository {
|
|
34
|
+
/**
|
|
35
|
+
* Retrieves a payment by its order reference.
|
|
36
|
+
*/
|
|
37
|
+
getByOrderReference(orderReference: string): Promise<PaymentEntity | null>;
|
|
38
|
+
/**
|
|
39
|
+
* Retrieves all payments for a specific user.
|
|
40
|
+
*/
|
|
41
|
+
getByUserId(params: {
|
|
42
|
+
userId: string;
|
|
43
|
+
platform: string;
|
|
44
|
+
status?: PaymentEntity['status'];
|
|
45
|
+
}): Promise<PaymentEntity[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Creates a new payment record in the database.
|
|
48
|
+
*/
|
|
49
|
+
create(paymentData: Omit<PaymentEntity, 'id'>): Promise<PaymentEntity>;
|
|
50
|
+
/**
|
|
51
|
+
* Updates specific fields of a payment identified by order reference.
|
|
52
|
+
* @param params - Update parameters
|
|
53
|
+
*/
|
|
54
|
+
updateFields(params: {
|
|
55
|
+
orderReference: string;
|
|
56
|
+
fields: any;
|
|
57
|
+
}): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Retrieves all pending payments that are older than specified hours.
|
|
60
|
+
* @param params - Query parameters
|
|
61
|
+
* @returns Promise resolving to array of expired PaymentEntity
|
|
62
|
+
*/
|
|
63
|
+
getExpiredPendingPayments(params?: {
|
|
64
|
+
hoursOld?: number;
|
|
65
|
+
}): Promise<PaymentEntity[]>;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Interface for payment service operations.
|
|
69
|
+
* Defines the contract for business logic layer.
|
|
70
|
+
*/
|
|
71
|
+
interface IPaymentService {
|
|
72
|
+
/**
|
|
73
|
+
* Retrieves a payment by its order reference.
|
|
74
|
+
* @param orderReference - The unique order reference identifier
|
|
75
|
+
* @returns Promise resolving to PaymentEntity or null if not found
|
|
76
|
+
*/
|
|
77
|
+
getByOrderReference(orderReference: string): Promise<PaymentEntity | null>;
|
|
78
|
+
/**
|
|
79
|
+
* Retrieves all payments for a specific user.
|
|
80
|
+
* @param params - Query parameters
|
|
81
|
+
* @returns Promise resolving to array of PaymentEntity
|
|
82
|
+
*/
|
|
83
|
+
getByUserId(params: {
|
|
84
|
+
userId: string;
|
|
85
|
+
platform: string;
|
|
86
|
+
status?: PaymentEntity['status'];
|
|
87
|
+
}): Promise<PaymentEntity[]>;
|
|
88
|
+
/**
|
|
89
|
+
* Creates a new payment record in the database.
|
|
90
|
+
* @param paymentData - Payment data without ID
|
|
91
|
+
* @returns Promise resolving to created PaymentEntity with ID
|
|
92
|
+
*/
|
|
93
|
+
create(paymentData: Omit<PaymentEntity, 'id'>): Promise<PaymentEntity>;
|
|
94
|
+
/**
|
|
95
|
+
* Updates specific fields of a payment.
|
|
96
|
+
* @param params - Update parameters
|
|
97
|
+
*/
|
|
98
|
+
updateFields(params: {
|
|
99
|
+
orderReference: string;
|
|
100
|
+
fields: any;
|
|
101
|
+
}): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Retrieves all pending payments that are older than specified hours.
|
|
104
|
+
* @param params - Query parameters
|
|
105
|
+
* @returns Promise resolving to array of expired PaymentEntity
|
|
106
|
+
*/
|
|
107
|
+
getExpiredPendingPayments(params?: {
|
|
108
|
+
hoursOld?: number;
|
|
109
|
+
}): Promise<PaymentEntity[]>;
|
|
110
|
+
/**
|
|
111
|
+
* Creates a payment intent for a user subscription.
|
|
112
|
+
* @param params - Payment intent parameters
|
|
113
|
+
* @returns Promise resolving to the created PaymentEntity with payment link
|
|
114
|
+
*/
|
|
115
|
+
createPaymentIntent(params: {
|
|
116
|
+
userId: string;
|
|
117
|
+
platform: string;
|
|
118
|
+
planId: string;
|
|
119
|
+
productName: string;
|
|
120
|
+
productPrice: number;
|
|
121
|
+
currency: 'UAH' | 'USD';
|
|
122
|
+
regularCount?: number;
|
|
123
|
+
regularMode?: 'daily' | 'weekly' | 'monthly' | 'yearly';
|
|
124
|
+
language?: string;
|
|
125
|
+
}): Promise<PaymentEntity>;
|
|
126
|
+
}
|
|
127
|
+
export type { PaymentEntity, PaymentFieldPath, IPaymentRepository, IPaymentService };
|
|
31
128
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/modules/payments/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB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M,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,QAAQ,EAAE,KAAK,GAAG,KAAK,CAAC;QACxB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,WAAW,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;QACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
declare function createOrderReference({ userId, appNamespace, planId, utcDate, }: {
|
|
1
|
+
declare function createOrderReference({ userId, platform, planId, utcDate, }: {
|
|
3
2
|
userId: string;
|
|
4
|
-
|
|
3
|
+
platform: string;
|
|
5
4
|
planId: string;
|
|
6
5
|
utcDate: string;
|
|
7
6
|
}): string;
|
|
8
7
|
export interface ParsedReferenceString {
|
|
9
8
|
appName: string;
|
|
10
|
-
|
|
9
|
+
platform: string;
|
|
11
10
|
serviceType: string;
|
|
12
11
|
userId: string;
|
|
13
12
|
planId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/modules/payments/utils.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/modules/payments/utils.ts"],"names":[],"mappings":"AAAA,iBAAS,oBAAoB,CAAC,EAC1B,MAAM,EACN,QAAQ,EACR,MAAM,EACN,OAAO,GACV,EAAE;IACC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACnB,GAAG,MAAM,CAET;AAED,MAAM,WAAW,qBAAqB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,iBAAS,mBAAmB,CAAC,eAAe,EAAE,MAAM,GAAG,qBAAqB,GAAG,IAAI,CA0BlF;AAED,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createOrderReference = createOrderReference;
|
|
4
4
|
exports.parseOrderReference = parseOrderReference;
|
|
5
|
-
function createOrderReference({ userId,
|
|
6
|
-
return `miia_${
|
|
5
|
+
function createOrderReference({ userId, platform, planId, utcDate, }) {
|
|
6
|
+
return `miia_${platform}_bot_${userId}_${planId}_v1_${utcDate}`;
|
|
7
7
|
}
|
|
8
8
|
function parseOrderReference(referenceString) {
|
|
9
|
-
// `miia_${
|
|
10
|
-
const [appName,
|
|
9
|
+
// `miia_${platform}_bot_${userId}_${planId}_v1_${formattedUtc}`;
|
|
10
|
+
const [appName, platform, serviceType, userId, planId, version, timestamp, chargeId] = referenceString.split('_');
|
|
11
11
|
if (typeof appName !== 'string' ||
|
|
12
|
-
typeof
|
|
12
|
+
typeof platform !== 'string' ||
|
|
13
13
|
typeof serviceType !== 'string' ||
|
|
14
14
|
typeof userId !== 'string' ||
|
|
15
15
|
typeof planId !== 'string' ||
|
|
@@ -19,7 +19,7 @@ function parseOrderReference(referenceString) {
|
|
|
19
19
|
}
|
|
20
20
|
return {
|
|
21
21
|
appName,
|
|
22
|
-
|
|
22
|
+
platform,
|
|
23
23
|
serviceType,
|
|
24
24
|
userId,
|
|
25
25
|
planId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/modules/payments/utils.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/modules/payments/utils.ts"],"names":[],"mappings":";;AAqDS,oDAAoB;AAAE,kDAAmB;AArDlD,SAAS,oBAAoB,CAAC,EAC1B,MAAM,EACN,QAAQ,EACR,MAAM,EACN,OAAO,GAMV;IACG,OAAO,QAAQ,QAAQ,QAAQ,MAAM,IAAI,MAAM,OAAO,OAAO,EAAE,CAAC;AACpE,CAAC;AAaD,SAAS,mBAAmB,CAAC,eAAuB;IAChD,iEAAiE;IACjE,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAElH,IACI,OAAO,OAAO,KAAK,QAAQ;QAC3B,OAAO,QAAQ,KAAK,QAAQ;QAC5B,OAAO,WAAW,KAAK,QAAQ;QAC/B,OAAO,MAAM,KAAK,QAAQ;QAC1B,OAAO,MAAM,KAAK,QAAQ;QAC1B,OAAO,OAAO,KAAK,QAAQ;QAC3B,OAAO,SAAS,KAAK,QAAQ,EAC/B,CAAC;QACC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO;QACH,OAAO;QACP,QAAQ;QACR,WAAW;QACX,MAAM;QACN,MAAM;QACN,OAAO;QACP,SAAS;QACT,QAAQ;KACX,CAAC;AACN,CAAC"}
|
|
@@ -1,114 +1,39 @@
|
|
|
1
|
-
import { FieldValue } from 'firebase-admin/firestore';
|
|
2
|
-
import { SubscriptionEntity, SubscriptionFieldPath } from './types';
|
|
3
|
-
import { AppNamespace } from '../app/types';
|
|
1
|
+
import { FieldValue, Firestore } from 'firebase-admin/firestore';
|
|
2
|
+
import { SubscriptionEntity, SubscriptionFieldPath, ISubscriptionRepository } from './types';
|
|
4
3
|
export type UpdateDBSubscriptionFields = [
|
|
5
4
|
SubscriptionFieldPath,
|
|
6
5
|
FieldValue | string | number | boolean | Date | [] | {}
|
|
7
6
|
][];
|
|
8
|
-
|
|
9
|
-
* SubscriptionRepository class handles all database operations related to subscriptions.
|
|
10
|
-
* Implements repository pattern for subscription data access.
|
|
11
|
-
*/
|
|
12
|
-
export declare class SubscriptionRepository {
|
|
7
|
+
export declare class SubscriptionRepository implements ISubscriptionRepository {
|
|
13
8
|
private readonly db;
|
|
14
9
|
private readonly collectionName;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
constructor();
|
|
19
|
-
/**
|
|
20
|
-
* Retrieves a subscription for a specific user.
|
|
21
|
-
* @param params - Query parameters
|
|
22
|
-
* @param params.userId - The user's unique identifier
|
|
23
|
-
* @param params.appNamespace - The application namespace/platform
|
|
24
|
-
* @param params.status - Optional status filter. Can be a single status or array of statuses. Defaults to 'active'
|
|
25
|
-
* @returns Promise resolving to SubscriptionEntity or null if not found
|
|
26
|
-
*/
|
|
10
|
+
constructor({ db }?: {
|
|
11
|
+
db?: Firestore;
|
|
12
|
+
});
|
|
27
13
|
findSubscription(params: {
|
|
28
14
|
userId: string;
|
|
29
|
-
|
|
15
|
+
platform: string;
|
|
30
16
|
status?: SubscriptionEntity['status'] | SubscriptionEntity['status'][];
|
|
31
17
|
}): Promise<SubscriptionEntity | null>;
|
|
32
|
-
/**
|
|
33
|
-
* Creates a new subscription record in the database.
|
|
34
|
-
* @param params - Subscription creation parameters
|
|
35
|
-
* @param params.userId - The user's unique identifier
|
|
36
|
-
* @param params.appNamespace - The application namespace/platform
|
|
37
|
-
* @param params.planId - The subscription plan identifier
|
|
38
|
-
* @param params.expiresAt - ISO timestamp when subscription expires
|
|
39
|
-
* @param params.startedAt - ISO timestamp when subscription started
|
|
40
|
-
* @returns Promise resolving to created SubscriptionEntity with ID
|
|
41
|
-
* @throws Error if subscription creation fails
|
|
42
|
-
*/
|
|
43
18
|
create(params: {
|
|
44
19
|
userId: string;
|
|
45
|
-
|
|
20
|
+
platform: string;
|
|
46
21
|
planId: string;
|
|
47
22
|
expiresAt: string;
|
|
48
23
|
startedAt: string;
|
|
49
24
|
}): Promise<SubscriptionEntity>;
|
|
50
|
-
/**
|
|
51
|
-
* Updates specific fields of a subscription identified by userId and appNamespace.
|
|
52
|
-
* @param params - Update parameters
|
|
53
|
-
* @param params.userId - The user's unique identifier
|
|
54
|
-
* @param params.appNamespace - The application namespace/platform
|
|
55
|
-
* @param params.fields - Array of field paths and values to update
|
|
56
|
-
* @throws Error if subscription not found or update fails
|
|
57
|
-
*/
|
|
58
25
|
updateFieldsByUserId(params: {
|
|
59
26
|
userId: string;
|
|
60
|
-
|
|
27
|
+
platform: string;
|
|
61
28
|
fields: UpdateDBSubscriptionFields;
|
|
62
29
|
}): Promise<void>;
|
|
63
|
-
/**
|
|
64
|
-
* Retrieves all active subscriptions that have expired.
|
|
65
|
-
* Used for batch processing to update subscription statuses.
|
|
66
|
-
* @returns Promise resolving to array of expired SubscriptionEntity
|
|
67
|
-
*/
|
|
68
30
|
getExpiredActiveSubscriptions(): Promise<SubscriptionEntity[]>;
|
|
69
|
-
/**
|
|
70
|
-
* Updates specific fields of a subscription identified by subscription ID.
|
|
71
|
-
* @param params - Update parameters
|
|
72
|
-
* @param params.subscriptionId - The subscription document ID
|
|
73
|
-
* @param params.fields - Array of field paths and values to update
|
|
74
|
-
* @throws Error if update fails
|
|
75
|
-
*/
|
|
76
31
|
updateFieldsById(params: {
|
|
77
32
|
subscriptionId: string;
|
|
78
33
|
fields: UpdateDBSubscriptionFields;
|
|
79
34
|
}): Promise<void>;
|
|
80
|
-
/**
|
|
81
|
-
* Maps a Firestore document to a SubscriptionEntity.
|
|
82
|
-
* @param doc - Firestore document snapshot
|
|
83
|
-
* @returns SubscriptionEntity with document ID
|
|
84
|
-
*/
|
|
85
35
|
private mapDocumentToEntity;
|
|
86
|
-
|
|
87
|
-
* Activates a subscription for a user using a transaction.
|
|
88
|
-
* Creates a new subscription if one doesn't exist, or updates the existing one.
|
|
89
|
-
* Also updates the user document to reflect active subscription status.
|
|
90
|
-
* @param params - Activation parameters
|
|
91
|
-
* @param params.userId - The user's unique identifier
|
|
92
|
-
* @param params.appNamespace - The application namespace/platform
|
|
93
|
-
* @param params.startedAt - ISO timestamp when subscription period starts
|
|
94
|
-
* @param params.expiresAt - ISO timestamp when subscription period ends
|
|
95
|
-
* @param params.planId - The subscription plan identifier
|
|
96
|
-
* @param params.provider - Payment provider (e.g., 'wayforpay')
|
|
97
|
-
* @throws Error if user not found or transaction fails
|
|
98
|
-
*/
|
|
99
|
-
activateSubscription(params: {
|
|
100
|
-
userId: string;
|
|
101
|
-
appNamespace: AppNamespace;
|
|
102
|
-
startedAt: string;
|
|
103
|
-
expiresAt: string;
|
|
104
|
-
planId: string;
|
|
105
|
-
provider: 'wayforpay';
|
|
106
|
-
}): Promise<void>;
|
|
107
|
-
/**
|
|
108
|
-
* Builds an update object from field tuples.
|
|
109
|
-
* @param fields - Array of field paths and values
|
|
110
|
-
* @returns Object with field paths as keys and values to update
|
|
111
|
-
*/
|
|
36
|
+
activateSubscription(params: Omit<SubscriptionEntity, 'id' | 'status'>): Promise<void>;
|
|
112
37
|
private buildUpdateObject;
|
|
113
38
|
}
|
|
114
39
|
//# sourceMappingURL=repository.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../src/modules/subscription/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../src/modules/subscription/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAuC,MAAM,0BAA0B,CAAC;AACtG,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAG7F,MAAM,MAAM,0BAA0B,GAAG;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,QAAQ,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IA2BnG,OAAO,CAAC,iBAAiB;CAS5B"}
|
|
@@ -3,31 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SubscriptionRepository = void 0;
|
|
4
4
|
const firestore_1 = require("firebase-admin/firestore");
|
|
5
5
|
const utils_1 = require("../../utils");
|
|
6
|
-
/**
|
|
7
|
-
* SubscriptionRepository class handles all database operations related to subscriptions.
|
|
8
|
-
* Implements repository pattern for subscription data access.
|
|
9
|
-
*/
|
|
10
6
|
class SubscriptionRepository {
|
|
11
|
-
|
|
12
|
-
* Creates an instance of SubscriptionRepository.
|
|
13
|
-
*/
|
|
14
|
-
constructor() {
|
|
7
|
+
constructor({ db } = {}) {
|
|
15
8
|
this.collectionName = 'subscriptions';
|
|
16
|
-
this.db = (0, firestore_1.getFirestore)();
|
|
9
|
+
this.db = db || (0, firestore_1.getFirestore)();
|
|
17
10
|
}
|
|
18
|
-
/**
|
|
19
|
-
* Retrieves a subscription for a specific user.
|
|
20
|
-
* @param params - Query parameters
|
|
21
|
-
* @param params.userId - The user's unique identifier
|
|
22
|
-
* @param params.appNamespace - The application namespace/platform
|
|
23
|
-
* @param params.status - Optional status filter. Can be a single status or array of statuses. Defaults to 'active'
|
|
24
|
-
* @returns Promise resolving to SubscriptionEntity or null if not found
|
|
25
|
-
*/
|
|
26
11
|
async findSubscription(params) {
|
|
27
|
-
const { userId,
|
|
12
|
+
const { userId, platform } = params;
|
|
28
13
|
let query = this.db
|
|
29
14
|
.collection(this.collectionName)
|
|
30
|
-
.where('platform', '==',
|
|
15
|
+
.where('platform', '==', platform)
|
|
31
16
|
.where('userId', '==', userId);
|
|
32
17
|
if (!(0, utils_1.isUndefined)(params.status)) {
|
|
33
18
|
// Handle status filter
|
|
@@ -47,24 +32,13 @@ class SubscriptionRepository {
|
|
|
47
32
|
const doc = querySnapshot.docs[0];
|
|
48
33
|
return this.mapDocumentToEntity(doc);
|
|
49
34
|
}
|
|
50
|
-
/**
|
|
51
|
-
* Creates a new subscription record in the database.
|
|
52
|
-
* @param params - Subscription creation parameters
|
|
53
|
-
* @param params.userId - The user's unique identifier
|
|
54
|
-
* @param params.appNamespace - The application namespace/platform
|
|
55
|
-
* @param params.planId - The subscription plan identifier
|
|
56
|
-
* @param params.expiresAt - ISO timestamp when subscription expires
|
|
57
|
-
* @param params.startedAt - ISO timestamp when subscription started
|
|
58
|
-
* @returns Promise resolving to created SubscriptionEntity with ID
|
|
59
|
-
* @throws Error if subscription creation fails
|
|
60
|
-
*/
|
|
61
35
|
async create(params) {
|
|
62
|
-
const { userId,
|
|
36
|
+
const { userId, platform, planId, expiresAt, startedAt } = params;
|
|
63
37
|
const docRef = this.db.collection(this.collectionName).doc();
|
|
64
38
|
const subscriptionEntity = {
|
|
65
39
|
id: docRef.id,
|
|
66
40
|
userId,
|
|
67
|
-
platform
|
|
41
|
+
platform,
|
|
68
42
|
planId,
|
|
69
43
|
expiresAt,
|
|
70
44
|
startedAt,
|
|
@@ -74,20 +48,12 @@ class SubscriptionRepository {
|
|
|
74
48
|
docRef.set(subscriptionEntity);
|
|
75
49
|
return subscriptionEntity;
|
|
76
50
|
}
|
|
77
|
-
/**
|
|
78
|
-
* Updates specific fields of a subscription identified by userId and appNamespace.
|
|
79
|
-
* @param params - Update parameters
|
|
80
|
-
* @param params.userId - The user's unique identifier
|
|
81
|
-
* @param params.appNamespace - The application namespace/platform
|
|
82
|
-
* @param params.fields - Array of field paths and values to update
|
|
83
|
-
* @throws Error if subscription not found or update fails
|
|
84
|
-
*/
|
|
85
51
|
async updateFieldsByUserId(params) {
|
|
86
|
-
const { userId,
|
|
52
|
+
const { userId, platform, fields } = params;
|
|
87
53
|
const updateObject = this.buildUpdateObject(fields);
|
|
88
54
|
const querySnapshot = await this.db
|
|
89
55
|
.collection(this.collectionName)
|
|
90
|
-
.where('platform', '==',
|
|
56
|
+
.where('platform', '==', platform)
|
|
91
57
|
.where('userId', '==', userId)
|
|
92
58
|
.limit(1)
|
|
93
59
|
.get();
|
|
@@ -96,11 +62,6 @@ class SubscriptionRepository {
|
|
|
96
62
|
}
|
|
97
63
|
await querySnapshot.docs[0].ref.update(updateObject);
|
|
98
64
|
}
|
|
99
|
-
/**
|
|
100
|
-
* Retrieves all active subscriptions that have expired.
|
|
101
|
-
* Used for batch processing to update subscription statuses.
|
|
102
|
-
* @returns Promise resolving to array of expired SubscriptionEntity
|
|
103
|
-
*/
|
|
104
65
|
async getExpiredActiveSubscriptions() {
|
|
105
66
|
const now = new Date().toISOString();
|
|
106
67
|
const querySnapshot = await this.db
|
|
@@ -113,80 +74,32 @@ class SubscriptionRepository {
|
|
|
113
74
|
}
|
|
114
75
|
return querySnapshot.docs.map((doc) => this.mapDocumentToEntity(doc));
|
|
115
76
|
}
|
|
116
|
-
/**
|
|
117
|
-
* Updates specific fields of a subscription identified by subscription ID.
|
|
118
|
-
* @param params - Update parameters
|
|
119
|
-
* @param params.subscriptionId - The subscription document ID
|
|
120
|
-
* @param params.fields - Array of field paths and values to update
|
|
121
|
-
* @throws Error if update fails
|
|
122
|
-
*/
|
|
123
77
|
async updateFieldsById(params) {
|
|
124
78
|
const { subscriptionId, fields } = params;
|
|
125
79
|
const updateObject = this.buildUpdateObject(fields);
|
|
126
80
|
await this.db.collection(this.collectionName).doc(subscriptionId).update(updateObject);
|
|
127
81
|
}
|
|
128
|
-
/**
|
|
129
|
-
* Maps a Firestore document to a SubscriptionEntity.
|
|
130
|
-
* @param doc - Firestore document snapshot
|
|
131
|
-
* @returns SubscriptionEntity with document ID
|
|
132
|
-
*/
|
|
133
82
|
mapDocumentToEntity(doc) {
|
|
134
83
|
return {
|
|
135
84
|
id: doc.id,
|
|
136
85
|
...doc.data(),
|
|
137
86
|
};
|
|
138
87
|
}
|
|
139
|
-
/**
|
|
140
|
-
* Activates a subscription for a user using a transaction.
|
|
141
|
-
* Creates a new subscription if one doesn't exist, or updates the existing one.
|
|
142
|
-
* Also updates the user document to reflect active subscription status.
|
|
143
|
-
* @param params - Activation parameters
|
|
144
|
-
* @param params.userId - The user's unique identifier
|
|
145
|
-
* @param params.appNamespace - The application namespace/platform
|
|
146
|
-
* @param params.startedAt - ISO timestamp when subscription period starts
|
|
147
|
-
* @param params.expiresAt - ISO timestamp when subscription period ends
|
|
148
|
-
* @param params.planId - The subscription plan identifier
|
|
149
|
-
* @param params.provider - Payment provider (e.g., 'wayforpay')
|
|
150
|
-
* @throws Error if user not found or transaction fails
|
|
151
|
-
*/
|
|
152
88
|
async activateSubscription(params) {
|
|
153
|
-
const { userId,
|
|
89
|
+
const { userId, platform } = params;
|
|
154
90
|
return await this.db.runTransaction(async (tx) => {
|
|
155
91
|
// Get user document
|
|
156
|
-
const userSnapshot = await tx.get(this.db.collection(`platform/${
|
|
157
|
-
// Get subscription document
|
|
158
|
-
const subscriptionSnapshot = await tx.get(this.db
|
|
159
|
-
.collection(this.collectionName)
|
|
160
|
-
.where('userId', '==', userId)
|
|
161
|
-
.where('platform', '==', appNamespace)
|
|
162
|
-
.limit(1));
|
|
92
|
+
const userSnapshot = await tx.get(this.db.collection(`platform/${platform}/users`).doc(userId));
|
|
163
93
|
if (!userSnapshot.exists) {
|
|
164
94
|
throw new Error(`User not found: ${userId}`);
|
|
165
95
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
provider,
|
|
174
|
-
startedAt,
|
|
175
|
-
userId,
|
|
176
|
-
};
|
|
177
|
-
const docRef = this.db.collection(this.collectionName).doc();
|
|
178
|
-
await tx.create(docRef, {
|
|
179
|
-
id: docRef.id,
|
|
180
|
-
...subscriptionEntity,
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
else {
|
|
184
|
-
// Update existing subscription
|
|
185
|
-
await tx.update(subscriptionSnapshot.docs[0].ref, {
|
|
186
|
-
expiresAt,
|
|
187
|
-
status: 'active',
|
|
188
|
-
});
|
|
189
|
-
}
|
|
96
|
+
const docRef = this.db.collection(this.collectionName).doc();
|
|
97
|
+
const newSubscription = {
|
|
98
|
+
...params,
|
|
99
|
+
id: docRef.id,
|
|
100
|
+
status: 'active',
|
|
101
|
+
};
|
|
102
|
+
await tx.create(docRef, newSubscription);
|
|
190
103
|
// Update user document
|
|
191
104
|
await tx.update(userSnapshot.ref, {
|
|
192
105
|
'subscription.isActive': true,
|
|
@@ -194,11 +107,6 @@ class SubscriptionRepository {
|
|
|
194
107
|
});
|
|
195
108
|
});
|
|
196
109
|
}
|
|
197
|
-
/**
|
|
198
|
-
* Builds an update object from field tuples.
|
|
199
|
-
* @param fields - Array of field paths and values
|
|
200
|
-
* @returns Object with field paths as keys and values to update
|
|
201
|
-
*/
|
|
202
110
|
buildUpdateObject(fields) {
|
|
203
111
|
const updateObject = {};
|
|
204
112
|
fields.forEach(([fieldPath, value]) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../../src/modules/subscription/repository.ts"],"names":[],"mappings":";;;AAAA,wDAAsG;
|
|
1
|
+
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../../src/modules/subscription/repository.ts"],"names":[],"mappings":";;;AAAA,wDAAsG;AAEtG,uCAA0C;AAO1C,MAAa,sBAAsB;IAI/B,YAAY,EAAE,EAAE,KAAyB,EAAE;QAF1B,mBAAc,GAAG,eAAe,CAAC;QAG9C,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,IAAA,wBAAY,GAAE,CAAC;IACnC,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,MAI7B;QACG,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;QAEpC,IAAI,KAAK,GAAG,IAAI,CAAC,EAAE;aACd,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC;aAC/B,KAAK,CAAC,UAAU,EAAE,IAAI,EAAE,QAAQ,CAAC;aACjC,KAAK,CAAC,QAA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