@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
|
@@ -15,7 +15,7 @@ const utils_2 = require("./utils");
|
|
|
15
15
|
*
|
|
16
16
|
* @param params - Payment creation parameters
|
|
17
17
|
* @param params.userId - The unique identifier of the user making the payment
|
|
18
|
-
* @param params.
|
|
18
|
+
* @param params.platform - The application namespace (e.g., 'app' or 'telegram')
|
|
19
19
|
* @param params.productName - The name of the product being purchased
|
|
20
20
|
* @param params.productPrice - The price of the product
|
|
21
21
|
* @param params.planId - The identifier of the subscription plan
|
|
@@ -25,12 +25,12 @@ const utils_2 = require("./utils");
|
|
|
25
25
|
* @returns Promise resolving to an object containing the payment URL and order reference, or null
|
|
26
26
|
* @throws Error with code 'CREATE_PAYMENT_API' if the API response is invalid or missing URL
|
|
27
27
|
*/
|
|
28
|
-
async function createPaymentAPI({ userId,
|
|
28
|
+
async function createPaymentAPI({ userId, platform, productName, productPrice, planId, dateNext, currency, regularCount = 3, regularMode = 'daily', language = 'UA', }) {
|
|
29
29
|
const orderDate = Date.now();
|
|
30
30
|
const formattedUtc = moment_1.default.utc().toISOString();
|
|
31
31
|
const orderReference = (0, utils_2.createOrderReference)({
|
|
32
32
|
userId,
|
|
33
|
-
|
|
33
|
+
platform,
|
|
34
34
|
planId,
|
|
35
35
|
utcDate: formattedUtc,
|
|
36
36
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/modules/payments/api.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/modules/payments/api.ts"],"names":[],"mappings":";;;;;AAsIS,4CAAgB;AAAE,wDAAsB;AAtIjD,oDAA4B;AAC5B,kEAAkH;AAClH,uCAA2D;AAC3D,mCAA+C;AAO/C;;;;;;;;;;;;;;;GAeG;AACH,KAAK,UAAU,gBAAgB,CAAC,EAC5B,MAAM,EACN,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,YAAY,GAAG,CAAC,EAChB,WAAW,GAAG,OAAO,EACrB,QAAQ,GAAG,IAAI,GAYlB;IACG,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,MAAM,YAAY,GAAG,gBAAM,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC;IAChD,MAAM,cAAc,GAAG,IAAA,4BAAoB,EAAC;QACxC,MAAM;QACN,QAAQ;QACR,MAAM;QACN,OAAO,EAAE,YAAY;KACxB,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAA,uCAAuB,EAAC;QAC5C,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,0BAAoC;QACjE,kBAAkB,EAAE,OAAO,CAAC,GAAG,CAAC,yBAAmC;QACnE,iBAAiB,EAAE,OAAO,CAAC,GAAG,CAAC,6BAAuC;QACtE,SAAS;QACT,cAAc;QACd,WAAW,EAAE,CAAC,WAAW,CAAC;QAC1B,YAAY,EAAE,CAAC,YAAY,CAAC;QAC5B,QAAQ,EAAE,QAAoB;QAC9B,QAAQ,EAAE,QAAoB;QAC9B,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,qBAA+B;QACvD,WAAW;QACX,YAAY;QACZ,QAAQ;KACX,CAAC,CAAsB,CAAC;IAEzB,IAAI,CAAC,IAAA,gBAAQ,EAAC,QAAQ,CAAC,IAAI,IAAA,0BAAkB,EAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1D,MAAM;YACF,IAAI,EAAE,oBAAoB;SAC7B,CAAC;IACN,CAAC;IAED,OAAO;QACH,GAAG,EAAE,QAAQ,CAAC,GAAG;QACjB,cAAc;KACjB,CAAC;AACN,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,KAAK,UAAU,sBAAsB,CAAC,EAClC,cAAc,EACd,MAAM,EACN,SAAS,EACT,OAAO,EACP,WAAW,EACX,QAAQ,GAQX;IACG,MAAM,QAAQ,GAAG,MAAM,IAAA,mCAAmB,EAAC;QACvC,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,0BAAoC;QACjE,gBAAgB,EAAE,OAAO,CAAC,GAAG,CAAC,2BAAqC;QACnE,cAAc;QACd,MAAM;QACN,SAAS;QACT,OAAO;QACP,WAAW;QACX,QAAQ,EAAE,QAAoB;KACjC,CAAC,CAAC;IAEH,IAAI,CAAC,IAAA,gBAAQ,EAAC,QAAQ,CAAC,EAAE,CAAC;QACtB,MAAM;YACF,IAAI,EAAE,2BAA2B;SACpC,CAAC;IACN,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC"}
|
|
@@ -1,82 +1,28 @@
|
|
|
1
|
-
import { FieldValue } from 'firebase-admin/firestore';
|
|
2
|
-
import { PaymentEntity, PaymentFieldPath } from './types';
|
|
3
|
-
import { AppNamespace } from '../app/types';
|
|
1
|
+
import { FieldValue, Firestore } from 'firebase-admin/firestore';
|
|
2
|
+
import { PaymentEntity, PaymentFieldPath, IPaymentRepository } from './types';
|
|
4
3
|
export type UpdateDBPaymentFields = [PaymentFieldPath, FieldValue | string | number | boolean | Date | [] | {}][];
|
|
5
|
-
|
|
6
|
-
* PaymentRepository class handles all database operations related to payments.
|
|
7
|
-
* Implements repository pattern for payment data access.
|
|
8
|
-
*/
|
|
9
|
-
export declare class PaymentRepository {
|
|
4
|
+
export declare class PaymentRepository implements IPaymentRepository {
|
|
10
5
|
private readonly db;
|
|
11
6
|
private readonly collectionName;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
constructor();
|
|
16
|
-
/**
|
|
17
|
-
* Retrieves a payment by its order reference.
|
|
18
|
-
* @param orderReference - The unique order reference identifier
|
|
19
|
-
* @returns Promise resolving to PaymentEntity or null if not found
|
|
20
|
-
*/
|
|
7
|
+
constructor({ db }?: {
|
|
8
|
+
db?: Firestore;
|
|
9
|
+
});
|
|
21
10
|
getByOrderReference(orderReference: string): Promise<PaymentEntity | null>;
|
|
22
|
-
/**
|
|
23
|
-
* Retrieves all payments for a specific user.
|
|
24
|
-
* @param params - Query parameters
|
|
25
|
-
* @param params.userId - The user's unique identifier
|
|
26
|
-
* @param params.appNamespace - The application namespace/platform
|
|
27
|
-
* @param params.status - Optional payment status filter
|
|
28
|
-
* @returns Promise resolving to array of PaymentEntity
|
|
29
|
-
*/
|
|
30
11
|
getByUserId(params: {
|
|
31
12
|
userId: string;
|
|
32
|
-
|
|
13
|
+
platform: string;
|
|
33
14
|
status?: PaymentEntity['status'];
|
|
34
15
|
}): Promise<PaymentEntity[]>;
|
|
35
|
-
/**
|
|
36
|
-
* Creates a new payment record in the database.
|
|
37
|
-
* @param paymentData - Payment data without ID (ID will be auto-generated)
|
|
38
|
-
* @returns Promise resolving to created PaymentEntity with ID
|
|
39
|
-
* @throws Error if payment creation fails
|
|
40
|
-
*/
|
|
41
16
|
create(paymentData: Omit<PaymentEntity, 'id'>): Promise<PaymentEntity>;
|
|
42
|
-
/**
|
|
43
|
-
* Updates specific fields of a payment identified by order reference.
|
|
44
|
-
* @param params - Update parameters
|
|
45
|
-
* @param params.orderReference - The order reference to identify the payment
|
|
46
|
-
* @param params.fields - Array of field paths and values to update
|
|
47
|
-
* @throws Error if payment not found or update fails
|
|
48
|
-
*/
|
|
49
17
|
updateFields(params: {
|
|
50
18
|
orderReference: string;
|
|
51
19
|
fields: UpdateDBPaymentFields;
|
|
52
20
|
}): Promise<void>;
|
|
53
|
-
/**
|
|
54
|
-
* Retrieves all pending payments that are older than specified hours.
|
|
55
|
-
* Used for cleaning up expired payment attempts.
|
|
56
|
-
* @param params - Query parameters
|
|
57
|
-
* @param params.hoursOld - Number of hours after which a pending payment is considered expired (default: 24)
|
|
58
|
-
* @returns Promise resolving to array of expired PaymentEntity
|
|
59
|
-
*/
|
|
60
21
|
getExpiredPendingPayments(params?: {
|
|
61
22
|
hoursOld?: number;
|
|
62
23
|
}): Promise<PaymentEntity[]>;
|
|
63
|
-
/**
|
|
64
|
-
* Maps a Firestore document to a PaymentEntity.
|
|
65
|
-
* @param doc - Firestore document snapshot
|
|
66
|
-
* @returns PaymentEntity with document ID
|
|
67
|
-
*/
|
|
68
24
|
private mapDocumentToEntity;
|
|
69
|
-
/**
|
|
70
|
-
* Builds an update object from field tuples.
|
|
71
|
-
* @param fields - Array of field paths and values
|
|
72
|
-
* @returns Object with field paths as keys and values to update
|
|
73
|
-
*/
|
|
74
25
|
private buildUpdateObject;
|
|
75
|
-
/**
|
|
76
|
-
* Calculates the cutoff time for expired payments.
|
|
77
|
-
* @param hoursOld - Number of hours to subtract from current time
|
|
78
|
-
* @returns Date object representing the cutoff time
|
|
79
|
-
*/
|
|
80
26
|
private calculateCutoffTime;
|
|
81
27
|
}
|
|
82
28
|
//# sourceMappingURL=repository.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../src/modules/payments/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../src/modules/payments/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAuC,MAAM,0BAA0B,CAAC;AACtG,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAG9E,MAAM,MAAM,qBAAqB,GAAG,CAAC,gBAAgB,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;AAElH,qBAAa,iBAAkB,YAAW,kBAAkB;IACxD,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAY;IAC/B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAc;gBAEjC,EAAE,EAAE,EAAE,GAAE;QAAE,EAAE,CAAC,EAAE,SAAS,CAAA;KAAO;IAI9B,mBAAmB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAe1E,WAAW,CAAC,MAAM,EAAE;QAC7B,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;KACpC,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAqBf,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IActE,YAAY,CAAC,MAAM,EAAE;QAAE,cAAc,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,qBAAqB,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB9F,yBAAyB,CAClC,MAAM,GAAE;QACJ,QAAQ,CAAC,EAAE,MAAM,CAAC;KAChB,GACP,OAAO,CAAC,aAAa,EAAE,CAAC;IAkB3B,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,mBAAmB;CAK9B"}
|
|
@@ -3,23 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PaymentRepository = void 0;
|
|
4
4
|
const firestore_1 = require("firebase-admin/firestore");
|
|
5
5
|
const const_1 = require("./const");
|
|
6
|
-
/**
|
|
7
|
-
* PaymentRepository class handles all database operations related to payments.
|
|
8
|
-
* Implements repository pattern for payment data access.
|
|
9
|
-
*/
|
|
10
6
|
class PaymentRepository {
|
|
11
|
-
|
|
12
|
-
* Creates an instance of PaymentRepository.
|
|
13
|
-
*/
|
|
14
|
-
constructor() {
|
|
7
|
+
constructor({ db } = {}) {
|
|
15
8
|
this.collectionName = 'payments';
|
|
16
|
-
this.db = (0, firestore_1.getFirestore)();
|
|
9
|
+
this.db = db || (0, firestore_1.getFirestore)();
|
|
17
10
|
}
|
|
18
|
-
/**
|
|
19
|
-
* Retrieves a payment by its order reference.
|
|
20
|
-
* @param orderReference - The unique order reference identifier
|
|
21
|
-
* @returns Promise resolving to PaymentEntity or null if not found
|
|
22
|
-
*/
|
|
23
11
|
async getByOrderReference(orderReference) {
|
|
24
12
|
const querySnapshot = await this.db
|
|
25
13
|
.collection(this.collectionName)
|
|
@@ -32,19 +20,11 @@ class PaymentRepository {
|
|
|
32
20
|
const doc = querySnapshot.docs[0];
|
|
33
21
|
return this.mapDocumentToEntity(doc);
|
|
34
22
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Retrieves all payments for a specific user.
|
|
37
|
-
* @param params - Query parameters
|
|
38
|
-
* @param params.userId - The user's unique identifier
|
|
39
|
-
* @param params.appNamespace - The application namespace/platform
|
|
40
|
-
* @param params.status - Optional payment status filter
|
|
41
|
-
* @returns Promise resolving to array of PaymentEntity
|
|
42
|
-
*/
|
|
43
23
|
async getByUserId(params) {
|
|
44
|
-
const { userId,
|
|
24
|
+
const { userId, platform, status } = params;
|
|
45
25
|
let query = this.db
|
|
46
26
|
.collection(this.collectionName)
|
|
47
|
-
.where('platform', '==',
|
|
27
|
+
.where('platform', '==', platform)
|
|
48
28
|
.where('userId', '==', userId);
|
|
49
29
|
if (status) {
|
|
50
30
|
query = query.where('status', '==', status);
|
|
@@ -55,12 +35,6 @@ class PaymentRepository {
|
|
|
55
35
|
}
|
|
56
36
|
return querySnapshot.docs.map((doc) => this.mapDocumentToEntity(doc));
|
|
57
37
|
}
|
|
58
|
-
/**
|
|
59
|
-
* Creates a new payment record in the database.
|
|
60
|
-
* @param paymentData - Payment data without ID (ID will be auto-generated)
|
|
61
|
-
* @returns Promise resolving to created PaymentEntity with ID
|
|
62
|
-
* @throws Error if payment creation fails
|
|
63
|
-
*/
|
|
64
38
|
async create(paymentData) {
|
|
65
39
|
const docRef = this.db.collection(this.collectionName).doc();
|
|
66
40
|
const paymentEntity = {
|
|
@@ -71,13 +45,6 @@ class PaymentRepository {
|
|
|
71
45
|
docRef.set(paymentEntity);
|
|
72
46
|
return paymentEntity;
|
|
73
47
|
}
|
|
74
|
-
/**
|
|
75
|
-
* Updates specific fields of a payment identified by order reference.
|
|
76
|
-
* @param params - Update parameters
|
|
77
|
-
* @param params.orderReference - The order reference to identify the payment
|
|
78
|
-
* @param params.fields - Array of field paths and values to update
|
|
79
|
-
* @throws Error if payment not found or update fails
|
|
80
|
-
*/
|
|
81
48
|
async updateFields(params) {
|
|
82
49
|
const { orderReference, fields } = params;
|
|
83
50
|
const updateObject = this.buildUpdateObject(fields);
|
|
@@ -91,13 +58,6 @@ class PaymentRepository {
|
|
|
91
58
|
}
|
|
92
59
|
await querySnapshot.docs[0].ref.update(updateObject);
|
|
93
60
|
}
|
|
94
|
-
/**
|
|
95
|
-
* Retrieves all pending payments that are older than specified hours.
|
|
96
|
-
* Used for cleaning up expired payment attempts.
|
|
97
|
-
* @param params - Query parameters
|
|
98
|
-
* @param params.hoursOld - Number of hours after which a pending payment is considered expired (default: 24)
|
|
99
|
-
* @returns Promise resolving to array of expired PaymentEntity
|
|
100
|
-
*/
|
|
101
61
|
async getExpiredPendingPayments(params = {}) {
|
|
102
62
|
const { hoursOld = 24 } = params;
|
|
103
63
|
const cutoffTime = this.calculateCutoffTime(hoursOld);
|
|
@@ -111,22 +71,12 @@ class PaymentRepository {
|
|
|
111
71
|
}
|
|
112
72
|
return querySnapshot.docs.map((doc) => this.mapDocumentToEntity(doc));
|
|
113
73
|
}
|
|
114
|
-
/**
|
|
115
|
-
* Maps a Firestore document to a PaymentEntity.
|
|
116
|
-
* @param doc - Firestore document snapshot
|
|
117
|
-
* @returns PaymentEntity with document ID
|
|
118
|
-
*/
|
|
119
74
|
mapDocumentToEntity(doc) {
|
|
120
75
|
return {
|
|
121
76
|
id: doc.id,
|
|
122
77
|
...doc.data(),
|
|
123
78
|
};
|
|
124
79
|
}
|
|
125
|
-
/**
|
|
126
|
-
* Builds an update object from field tuples.
|
|
127
|
-
* @param fields - Array of field paths and values
|
|
128
|
-
* @returns Object with field paths as keys and values to update
|
|
129
|
-
*/
|
|
130
80
|
buildUpdateObject(fields) {
|
|
131
81
|
const updateObject = {};
|
|
132
82
|
fields.forEach(([fieldPath, value]) => {
|
|
@@ -134,11 +84,6 @@ class PaymentRepository {
|
|
|
134
84
|
});
|
|
135
85
|
return updateObject;
|
|
136
86
|
}
|
|
137
|
-
/**
|
|
138
|
-
* Calculates the cutoff time for expired payments.
|
|
139
|
-
* @param hoursOld - Number of hours to subtract from current time
|
|
140
|
-
* @returns Date object representing the cutoff time
|
|
141
|
-
*/
|
|
142
87
|
calculateCutoffTime(hoursOld) {
|
|
143
88
|
const cutoffTime = new Date();
|
|
144
89
|
cutoffTime.setHours(cutoffTime.getHours() - hoursOld);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../../src/modules/payments/repository.ts"],"names":[],"mappings":";;;AAAA,wDAAsG;AAEtG,mCAAiD;
|
|
1
|
+
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../../src/modules/payments/repository.ts"],"names":[],"mappings":";;;AAAA,wDAAsG;AAEtG,mCAAiD;AAIjD,MAAa,iBAAiB;IAI1B,YAAY,EAAE,EAAE,KAAyB,EAAE;QAF1B,mBAAc,GAAG,UAAU,CAAC;QAGzC,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,IAAA,wBAAY,GAAE,CAAC;I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WAAW,EAAE,GAAG,EAAE,UAAU,CAAC,WAAW,EAAE,CAAC;aACjD,GAAG,EAAE,CAAC;QAEX,IAAI,aAAa,CAAC,KAAK,EAAE,CAAC;YACtB,OAAO,EAAE,CAAC;QACd,CAAC;QAED,OAAO,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1E,CAAC;IAEO,mBAAmB,CAAC,GAA0B;QAClD,OAAO;YACH,EAAE,EAAE,GAAG,CAAC,EAAE;YACV,GAAG,GAAG,CAAC,IAAI,EAAE;SACC,CAAC;IACvB,CAAC;IAEO,iBAAiB,CAAC,MAA6B;QACnD,MAAM,YAAY,GAAwB,EAAE,CAAC;QAE7C,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,EAAE;YAClC,YAAY,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;QACpC,CAAC,CAAC,CAAC;QAEH,OAAO,YAAY,CAAC;IACxB,CAAC;IAEO,mBAAmB,CAAC,QAAgB;QACxC,MAAM,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC;QAC9B,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,EAAE,GAAG,QAAQ,CAAC,CAAC;QACtD,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ;AA5HD,8CA4HC"}
|
|
@@ -1,89 +1,30 @@
|
|
|
1
1
|
import { Logger } from '../logger/types';
|
|
2
2
|
import { UpdateDBPaymentFields } from './repository';
|
|
3
|
-
import { PaymentEntity } from './types';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* PaymentService class handles business logic related to payments.
|
|
7
|
-
* Acts as an intermediary between controllers/handlers and the repository layer.
|
|
8
|
-
*/
|
|
9
|
-
export declare class PaymentService {
|
|
3
|
+
import { PaymentEntity, IPaymentRepository, IPaymentService } from './types';
|
|
4
|
+
export declare class PaymentService implements IPaymentService {
|
|
10
5
|
private readonly logger;
|
|
11
6
|
private readonly repository;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
constructor(logger: Logger);
|
|
17
|
-
/**
|
|
18
|
-
* Retrieves a payment by its order reference.
|
|
19
|
-
* @param orderReference - The unique order reference identifier
|
|
20
|
-
* @returns Promise resolving to PaymentEntity or null if not found
|
|
21
|
-
*/
|
|
7
|
+
constructor({ logger, repository }: {
|
|
8
|
+
logger: Logger;
|
|
9
|
+
repository?: IPaymentRepository;
|
|
10
|
+
});
|
|
22
11
|
getByOrderReference(orderReference: string): Promise<PaymentEntity | null>;
|
|
23
|
-
/**
|
|
24
|
-
* Retrieves all payments for a specific user.
|
|
25
|
-
* @param params - Query parameters
|
|
26
|
-
* @param params.userId - The user's unique identifier
|
|
27
|
-
* @param params.appNamespace - The application namespace/platform
|
|
28
|
-
* @param params.status - Optional payment status filter
|
|
29
|
-
* @returns Promise resolving to array of PaymentEntity
|
|
30
|
-
*/
|
|
31
12
|
getByUserId(params: {
|
|
32
13
|
userId: string;
|
|
33
|
-
|
|
14
|
+
platform: string;
|
|
34
15
|
status?: PaymentEntity['status'];
|
|
35
16
|
}): Promise<PaymentEntity[]>;
|
|
36
|
-
/**
|
|
37
|
-
* Creates a new payment record in the database.
|
|
38
|
-
* @param paymentData - Payment data without ID (ID will be auto-generated)
|
|
39
|
-
* @returns Promise resolving to created PaymentEntity with ID
|
|
40
|
-
* @throws Error if payment creation fails
|
|
41
|
-
*/
|
|
42
17
|
create(paymentData: Omit<PaymentEntity, 'id'>): Promise<PaymentEntity>;
|
|
43
|
-
/**
|
|
44
|
-
* Updates specific fields of a payment identified by order reference.
|
|
45
|
-
* @param params - Update parameters
|
|
46
|
-
* @param params.orderReference - The order reference to identify the payment
|
|
47
|
-
* @param params.fields - Array of field paths and values to update
|
|
48
|
-
* @throws Error if payment not found or update fails
|
|
49
|
-
*/
|
|
50
18
|
updateFields(params: {
|
|
51
19
|
orderReference: string;
|
|
52
20
|
fields: UpdateDBPaymentFields;
|
|
53
21
|
}): Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Retrieves all pending payments that are older than specified hours.
|
|
56
|
-
* Used for cleaning up expired payment attempts.
|
|
57
|
-
* @param params - Query parameters
|
|
58
|
-
* @param params.hoursOld - Number of hours after which a pending payment is considered expired (default: 24)
|
|
59
|
-
* @returns Promise resolving to array of expired PaymentEntity
|
|
60
|
-
*/
|
|
61
22
|
getExpiredPendingPayments(params?: {
|
|
62
23
|
hoursOld?: number;
|
|
63
24
|
}): Promise<PaymentEntity[]>;
|
|
64
|
-
/**
|
|
65
|
-
* Creates a payment intent for a user subscription.
|
|
66
|
-
* This method orchestrates the payment creation process by:
|
|
67
|
-
* 1. Creating a payment URL via Wayforpay API
|
|
68
|
-
* 2. Storing the payment record in the database
|
|
69
|
-
* 3. Returning the complete payment entity with the payment link
|
|
70
|
-
*
|
|
71
|
-
* @param params - Payment intent parameters
|
|
72
|
-
* @param params.userId - The unique identifier of the user
|
|
73
|
-
* @param params.appNamespace - The application namespace/platform
|
|
74
|
-
* @param params.planId - The subscription plan identifier
|
|
75
|
-
* @param params.productName - The name of the product/plan being purchased
|
|
76
|
-
* @param params.productPrice - The price of the product
|
|
77
|
-
* @param params.currency - The currency code ('UAH' or 'USD')
|
|
78
|
-
* @param params.regularCount - Optional number of regular payments (defaults to 3)
|
|
79
|
-
* @param params.regularMode - Optional payment frequency ('daily', 'weekly', 'monthly', 'yearly')
|
|
80
|
-
* @param params.language - Optional language code for the payment page (defaults to 'UA')
|
|
81
|
-
* @returns Promise resolving to the created PaymentEntity with payment link
|
|
82
|
-
* @throws Error if payment URL generation or database creation fails
|
|
83
|
-
*/
|
|
84
25
|
createPaymentIntent(params: {
|
|
85
26
|
userId: string;
|
|
86
|
-
|
|
27
|
+
platform: string;
|
|
87
28
|
planId: string;
|
|
88
29
|
productName: string;
|
|
89
30
|
productPrice: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/modules/payments/service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAqB,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/modules/payments/service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAqB,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG7E,qBAAa,cAAe,YAAW,eAAe;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAqB;gBAEpC,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,kBAAkB,CAAA;KAAE;IAK1E,mBAAmB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAe1E,WAAW,CAAC,MAAM,EAAE;QAC7B,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;KACpC,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAiBf,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;IAiBtE,YAAY,CAAC,MAAM,EAAE;QAAE,cAAc,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,qBAAqB,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB9F,yBAAyB,CAClC,MAAM,GAAE;QACJ,QAAQ,CAAC,EAAE,MAAM,CAAC;KAChB,GACP,OAAO,CAAC,aAAa,EAAE,CAAC;IAed,mBAAmB,CAAC,MAAM,EAAE;QACrC,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,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;CAuD7B"}
|
|
@@ -7,24 +7,11 @@ exports.PaymentService = void 0;
|
|
|
7
7
|
const moment_1 = __importDefault(require("moment"));
|
|
8
8
|
const repository_1 = require("./repository");
|
|
9
9
|
const api_1 = require("./api");
|
|
10
|
-
/**
|
|
11
|
-
* PaymentService class handles business logic related to payments.
|
|
12
|
-
* Acts as an intermediary between controllers/handlers and the repository layer.
|
|
13
|
-
*/
|
|
14
10
|
class PaymentService {
|
|
15
|
-
|
|
16
|
-
* Creates an instance of PaymentService.
|
|
17
|
-
* @param logger - Application logger instance for logging operations
|
|
18
|
-
*/
|
|
19
|
-
constructor(logger) {
|
|
11
|
+
constructor({ logger, repository }) {
|
|
20
12
|
this.logger = logger;
|
|
21
|
-
this.repository = new repository_1.PaymentRepository();
|
|
13
|
+
this.repository = repository || new repository_1.PaymentRepository();
|
|
22
14
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Retrieves a payment by its order reference.
|
|
25
|
-
* @param orderReference - The unique order reference identifier
|
|
26
|
-
* @returns Promise resolving to PaymentEntity or null if not found
|
|
27
|
-
*/
|
|
28
15
|
async getByOrderReference(orderReference) {
|
|
29
16
|
try {
|
|
30
17
|
return await this.repository.getByOrderReference(orderReference);
|
|
@@ -40,14 +27,6 @@ class PaymentService {
|
|
|
40
27
|
return null;
|
|
41
28
|
}
|
|
42
29
|
}
|
|
43
|
-
/**
|
|
44
|
-
* Retrieves all payments for a specific user.
|
|
45
|
-
* @param params - Query parameters
|
|
46
|
-
* @param params.userId - The user's unique identifier
|
|
47
|
-
* @param params.appNamespace - The application namespace/platform
|
|
48
|
-
* @param params.status - Optional payment status filter
|
|
49
|
-
* @returns Promise resolving to array of PaymentEntity
|
|
50
|
-
*/
|
|
51
30
|
async getByUserId(params) {
|
|
52
31
|
try {
|
|
53
32
|
return await this.repository.getByUserId(params);
|
|
@@ -57,7 +36,7 @@ class PaymentService {
|
|
|
57
36
|
message: 'Error in payment service getByUserId',
|
|
58
37
|
payload: {
|
|
59
38
|
userId: params.userId,
|
|
60
|
-
|
|
39
|
+
platform: params.platform,
|
|
61
40
|
status: params.status,
|
|
62
41
|
error: JSON.stringify(error),
|
|
63
42
|
},
|
|
@@ -65,12 +44,6 @@ class PaymentService {
|
|
|
65
44
|
return [];
|
|
66
45
|
}
|
|
67
46
|
}
|
|
68
|
-
/**
|
|
69
|
-
* Creates a new payment record in the database.
|
|
70
|
-
* @param paymentData - Payment data without ID (ID will be auto-generated)
|
|
71
|
-
* @returns Promise resolving to created PaymentEntity with ID
|
|
72
|
-
* @throws Error if payment creation fails
|
|
73
|
-
*/
|
|
74
47
|
async create(paymentData) {
|
|
75
48
|
try {
|
|
76
49
|
return await this.repository.create(paymentData);
|
|
@@ -87,13 +60,6 @@ class PaymentService {
|
|
|
87
60
|
throw error;
|
|
88
61
|
}
|
|
89
62
|
}
|
|
90
|
-
/**
|
|
91
|
-
* Updates specific fields of a payment identified by order reference.
|
|
92
|
-
* @param params - Update parameters
|
|
93
|
-
* @param params.orderReference - The order reference to identify the payment
|
|
94
|
-
* @param params.fields - Array of field paths and values to update
|
|
95
|
-
* @throws Error if payment not found or update fails
|
|
96
|
-
*/
|
|
97
63
|
async updateFields(params) {
|
|
98
64
|
try {
|
|
99
65
|
await this.repository.updateFields(params);
|
|
@@ -110,13 +76,6 @@ class PaymentService {
|
|
|
110
76
|
throw error;
|
|
111
77
|
}
|
|
112
78
|
}
|
|
113
|
-
/**
|
|
114
|
-
* Retrieves all pending payments that are older than specified hours.
|
|
115
|
-
* Used for cleaning up expired payment attempts.
|
|
116
|
-
* @param params - Query parameters
|
|
117
|
-
* @param params.hoursOld - Number of hours after which a pending payment is considered expired (default: 24)
|
|
118
|
-
* @returns Promise resolving to array of expired PaymentEntity
|
|
119
|
-
*/
|
|
120
79
|
async getExpiredPendingPayments(params = {}) {
|
|
121
80
|
try {
|
|
122
81
|
return await this.repository.getExpiredPendingPayments(params);
|
|
@@ -132,34 +91,14 @@ class PaymentService {
|
|
|
132
91
|
return [];
|
|
133
92
|
}
|
|
134
93
|
}
|
|
135
|
-
/**
|
|
136
|
-
* Creates a payment intent for a user subscription.
|
|
137
|
-
* This method orchestrates the payment creation process by:
|
|
138
|
-
* 1. Creating a payment URL via Wayforpay API
|
|
139
|
-
* 2. Storing the payment record in the database
|
|
140
|
-
* 3. Returning the complete payment entity with the payment link
|
|
141
|
-
*
|
|
142
|
-
* @param params - Payment intent parameters
|
|
143
|
-
* @param params.userId - The unique identifier of the user
|
|
144
|
-
* @param params.appNamespace - The application namespace/platform
|
|
145
|
-
* @param params.planId - The subscription plan identifier
|
|
146
|
-
* @param params.productName - The name of the product/plan being purchased
|
|
147
|
-
* @param params.productPrice - The price of the product
|
|
148
|
-
* @param params.currency - The currency code ('UAH' or 'USD')
|
|
149
|
-
* @param params.regularCount - Optional number of regular payments (defaults to 3)
|
|
150
|
-
* @param params.regularMode - Optional payment frequency ('daily', 'weekly', 'monthly', 'yearly')
|
|
151
|
-
* @param params.language - Optional language code for the payment page (defaults to 'UA')
|
|
152
|
-
* @returns Promise resolving to the created PaymentEntity with payment link
|
|
153
|
-
* @throws Error if payment URL generation or database creation fails
|
|
154
|
-
*/
|
|
155
94
|
async createPaymentIntent(params) {
|
|
156
|
-
const { userId,
|
|
95
|
+
const { userId, platform, planId, productName, productPrice, currency, regularCount, regularMode, language } = params;
|
|
157
96
|
try {
|
|
158
97
|
// Step 1: Create payment URL from Wayforpay API
|
|
159
98
|
// This also generates a unique order reference
|
|
160
99
|
const paymentResponse = await (0, api_1.createPaymentAPI)({
|
|
161
100
|
userId,
|
|
162
|
-
|
|
101
|
+
platform,
|
|
163
102
|
productName,
|
|
164
103
|
productPrice,
|
|
165
104
|
planId,
|
|
@@ -181,7 +120,7 @@ class PaymentService {
|
|
|
181
120
|
amount: productPrice,
|
|
182
121
|
currency,
|
|
183
122
|
createdAt: moment_1.default.utc().toISOString(),
|
|
184
|
-
platform:
|
|
123
|
+
platform: platform,
|
|
185
124
|
provider: 'wayforpay',
|
|
186
125
|
});
|
|
187
126
|
return paymentEntity;
|
|
@@ -191,7 +130,7 @@ class PaymentService {
|
|
|
191
130
|
message: 'Error in payment service createPaymentIntent',
|
|
192
131
|
payload: {
|
|
193
132
|
userId,
|
|
194
|
-
|
|
133
|
+
platform,
|
|
195
134
|
planId,
|
|
196
135
|
productName,
|
|
197
136
|
productPrice,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/modules/payments/service.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,6CAAwE;
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/modules/payments/service.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B,6CAAwE;AAExE,+BAAyC;AAEzC,MAAa,cAAc;IAIvB,YAAY,EAAE,MAAM,EAAE,UAAU,EAAuD;QACnF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,UAAU,IAAI,IAAI,8BAAiB,EAAE,CAAC;IAC5D,CAAC;IAEM,KAAK,CAAC,mBAAmB,CAAC,cAAsB;QACnD,IAAI,CA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