@smartsoft001/trans-shell-nestjs 2.153.0 → 2.154.0
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/package.json +10 -9
- package/src/lib/controllers/paypal/paypal.controller.d.ts +2 -1
- package/src/lib/controllers/paypal/paypal.controller.js +7 -1
- package/src/lib/controllers/paypal/paypal.controller.js.map +1 -1
- package/src/lib/controllers/trans/trans.controller.d.ts +4 -3
- package/src/lib/controllers/trans/trans.controller.js +6 -4
- package/src/lib/controllers/trans/trans.controller.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smartsoft001/trans-shell-nestjs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.154.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"typings": "./src/index.d.ts",
|
|
@@ -23,14 +23,15 @@
|
|
|
23
23
|
"@nestjs/common": "^11.1.5",
|
|
24
24
|
"@nestjs/jwt": "^11.0.0",
|
|
25
25
|
"@nestjs/passport": "^11.0.5",
|
|
26
|
-
"@smartsoft001/crud-shell-nestjs": "2.
|
|
27
|
-
"@smartsoft001/nestjs": "2.
|
|
28
|
-
"@smartsoft001/paynow": "2.
|
|
29
|
-
"@smartsoft001/paypal": "2.
|
|
30
|
-
"@smartsoft001/payu": "2.
|
|
31
|
-
"@smartsoft001/revolut": "2.
|
|
32
|
-
"@smartsoft001/trans-domain": "2.
|
|
33
|
-
"@smartsoft001/trans-shell-app-services": "2.
|
|
26
|
+
"@smartsoft001/crud-shell-nestjs": "2.154.0",
|
|
27
|
+
"@smartsoft001/nestjs": "2.154.0",
|
|
28
|
+
"@smartsoft001/paynow": "2.154.0",
|
|
29
|
+
"@smartsoft001/paypal": "2.154.0",
|
|
30
|
+
"@smartsoft001/payu": "2.154.0",
|
|
31
|
+
"@smartsoft001/revolut": "2.154.0",
|
|
32
|
+
"@smartsoft001/trans-domain": "2.154.0",
|
|
33
|
+
"@smartsoft001/trans-shell-app-services": "2.154.0",
|
|
34
|
+
"express": "^5.2.1"
|
|
34
35
|
},
|
|
35
36
|
"types": "./src/index.d.ts"
|
|
36
37
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Response } from 'express';
|
|
1
2
|
import { PaypalConfig, PaypalService } from '@smartsoft001/paypal';
|
|
2
3
|
import { TransService } from '@smartsoft001/trans-shell-app-services';
|
|
3
4
|
export declare class PaypalController {
|
|
@@ -8,5 +9,5 @@ export declare class PaypalController {
|
|
|
8
9
|
refreshStatus(obj: {
|
|
9
10
|
item_number1: string;
|
|
10
11
|
}): Promise<string>;
|
|
11
|
-
confirm(id:
|
|
12
|
+
confirm(id: string, payerId: string, paymentId: string, res: Response): Promise<void>;
|
|
12
13
|
}
|
|
@@ -17,6 +17,9 @@ let PaypalController = class PaypalController {
|
|
|
17
17
|
async refreshStatus(obj) {
|
|
18
18
|
try {
|
|
19
19
|
const trans = await this.service.getById(obj.item_number1);
|
|
20
|
+
if (!trans) {
|
|
21
|
+
throw new common_1.NotFoundException('Transaction not found: ' + obj.item_number1);
|
|
22
|
+
}
|
|
20
23
|
await this.service.refresh(trans.externalId, obj);
|
|
21
24
|
return 'ok';
|
|
22
25
|
}
|
|
@@ -29,6 +32,9 @@ let PaypalController = class PaypalController {
|
|
|
29
32
|
async confirm(id, payerId, paymentId, res) {
|
|
30
33
|
try {
|
|
31
34
|
const trans = await this.service.getById(id);
|
|
35
|
+
if (!trans) {
|
|
36
|
+
throw new common_1.NotFoundException('Transaction not found: ' + id);
|
|
37
|
+
}
|
|
32
38
|
if (trans.externalId !== paymentId) {
|
|
33
39
|
throw new Error('Invalid externaId');
|
|
34
40
|
}
|
|
@@ -58,7 +64,7 @@ tslib_1.__decorate([
|
|
|
58
64
|
tslib_1.__param(2, (0, common_1.Query)('paymentId')),
|
|
59
65
|
tslib_1.__param(3, (0, common_1.Res)()),
|
|
60
66
|
tslib_1.__metadata("design:type", Function),
|
|
61
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
67
|
+
tslib_1.__metadata("design:paramtypes", [String, String, String, Object]),
|
|
62
68
|
tslib_1.__metadata("design:returntype", Promise)
|
|
63
69
|
], PaypalController.prototype, "confirm", null);
|
|
64
70
|
exports.PaypalController = PaypalController = tslib_1.__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paypal.controller.js","sourceRoot":"","sources":["../../../../../../../../../packages/trans/shell/nestjs/src/lib/controllers/paypal/paypal.controller.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"paypal.controller.js","sourceRoot":"","sources":["../../../../../../../../../packages/trans/shell/nestjs/src/lib/controllers/paypal/paypal.controller.ts"],"names":[],"mappings":";;;;AAAA,2CAYwB;AAGxB,iDAAmE;AACnE,qFAAsE;AAG/D,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAER;IACY;IACA;IAH/B,YACmB,OAAqB,EACT,MAAoB,EACpB,aAA4B;QAFxC,YAAO,GAAP,OAAO,CAAc;QACT,WAAM,GAAN,MAAM,CAAc;QACpB,kBAAa,GAAb,aAAa,CAAe;IACxD,CAAC;IAIE,AAAN,KAAK,CAAC,aAAa,CAAS,GAA6B;QACvD,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;YAE3D,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,MAAM,IAAI,0BAAiB,CACzB,yBAAyB,GAAG,GAAG,CAAC,YAAY,CAC7C,CAAC;YACJ,CAAC;YAED,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;YAClD,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,aA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B1B;AAGK;IADL,IAAA,YAAG,EAAC,aAAa,CAAC;IAEhB,mBAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;IACX,mBAAA,IAAA,cAAK,EAAC,SAAS,CAAC,CAAA;IAChB,mBAAA,IAAA,cAAK,EAAC,WAAW,CAAC,CAAA;IAClB,mBAAA,IAAA,YAAG,GAAE,CAAA;;;;+CA4BP;2BA7DU,gBAAgB;IAD5B,IAAA,mBAAU,EAAC,QAAQ,CAAC;IAIhB,mBAAA,IAAA,iBAAQ,GAAE,CAAA;IACV,mBAAA,IAAA,iBAAQ,GAAE,CAAA;6CAFe,uCAAY;QACD,qBAAY;QACL,sBAAa;GAJhD,gBAAgB,CA8D5B"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Request } from 'express';
|
|
2
|
+
import type { ITransCreate } from '@smartsoft001/trans-domain';
|
|
2
3
|
import { TransService } from '@smartsoft001/trans-shell-app-services';
|
|
3
4
|
export declare class TransController {
|
|
4
5
|
private readonly service;
|
|
5
6
|
constructor(service: TransService);
|
|
6
|
-
create<T>(obj: ITransCreate<T>, req:
|
|
7
|
+
create<T>(obj: ITransCreate<T>, req: Request): Promise<{
|
|
7
8
|
url: string;
|
|
8
9
|
orderId: string;
|
|
9
10
|
}>;
|
|
10
|
-
refresh<T>(orderId:
|
|
11
|
+
refresh<T>(orderId: string, obj: unknown): Promise<void>;
|
|
11
12
|
}
|
|
@@ -10,10 +10,12 @@ let TransController = class TransController {
|
|
|
10
10
|
this.service = service;
|
|
11
11
|
}
|
|
12
12
|
async create(obj, req) {
|
|
13
|
+
// `socket` is what the deprecated `connection` alias pointed at. The
|
|
14
|
+
// address is absent only once the socket is gone; an empty ip then goes to
|
|
15
|
+
// the payment provider, which rejects it, instead of a crash before that.
|
|
16
|
+
const remoteAddress = req.socket.remoteAddress ?? '';
|
|
13
17
|
obj.clientIp =
|
|
14
|
-
|
|
15
|
-
? '10.0.0.1'
|
|
16
|
-
: req.connection.remoteAddress;
|
|
18
|
+
remoteAddress.indexOf('::') === 0 ? '10.0.0.1' : remoteAddress;
|
|
17
19
|
const { redirectUrl, orderId } = await this.service.create(obj);
|
|
18
20
|
return {
|
|
19
21
|
url: redirectUrl,
|
|
@@ -38,7 +40,7 @@ tslib_1.__decorate([
|
|
|
38
40
|
tslib_1.__param(0, (0, common_1.Param)('id')),
|
|
39
41
|
tslib_1.__param(1, (0, common_1.Body)()),
|
|
40
42
|
tslib_1.__metadata("design:type", Function),
|
|
41
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
43
|
+
tslib_1.__metadata("design:paramtypes", [String, Object]),
|
|
42
44
|
tslib_1.__metadata("design:returntype", Promise)
|
|
43
45
|
], TransController.prototype, "refresh", null);
|
|
44
46
|
exports.TransController = TransController = tslib_1.__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trans.controller.js","sourceRoot":"","sources":["../../../../../../../../../packages/trans/shell/nestjs/src/lib/controllers/trans/trans.controller.ts"],"names":[],"mappings":";;;;AAAA,2CAAoE;
|
|
1
|
+
{"version":3,"file":"trans.controller.js","sourceRoot":"","sources":["../../../../../../../../../packages/trans/shell/nestjs/src/lib/controllers/trans/trans.controller.ts"],"names":[],"mappings":";;;;AAAA,2CAAoE;AAIpE,qFAAsE;AAG/D,IAAM,eAAe,GAArB,MAAM,eAAe;IACG;IAA7B,YAA6B,OAAqB;QAArB,YAAO,GAAP,OAAO,CAAc;IAAG,CAAC;IAGhD,AAAN,KAAK,CAAC,MAAM,CAAY,GAAoB,EAAS,GAAY;QAC/D,qEAAqE;QACrE,2EAA2E;QAC3E,0EAA0E;QAC1E,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,CAAC,aAAa,IAAI,EAAE,CAAC;QACrD,GAAG,CAAC,QAAQ;YACV,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC;QACjE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAChE,OAAO;YACL,GAAG,EAAE,WAAW;YAChB,OAAO;SACR,CAAC;IACJ,CAAC;IAGK,AAAN,KAAK,CAAC,OAAO,CACE,OAAe,EACpB,GAAY;QAEpB,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC1C,CAAC;CACF,CAAA;AAzBY,0CAAe;AAIpB;IADL,IAAA,aAAI,GAAE;IACU,mBAAA,IAAA,aAAI,GAAE,CAAA;IAAwB,mBAAA,IAAA,YAAG,GAAE,CAAA;;;;6CAYnD;AAGK;IADL,IAAA,aAAI,EAAC,aAAa,CAAC;IAEjB,mBAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;IACX,mBAAA,IAAA,aAAI,GAAE,CAAA;;;;8CAGR;0BAxBU,eAAe;IAD3B,IAAA,mBAAU,EAAC,EAAE,CAAC;6CAEyB,uCAAY;GADvC,eAAe,CAyB3B"}
|