@smartsoft001/trans-shell-nestjs 2.75.0 → 2.80.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartsoft001/trans-shell-nestjs",
3
- "version": "2.75.0",
3
+ "version": "2.80.0",
4
4
  "description": "This library was generated with [Nx](https://nx.dev).",
5
5
  "repository": {
6
6
  "type": "git",
@@ -2,15 +2,8 @@ import { PaynowController } from './paynow/paynow.controller';
2
2
  import { PaypalController } from './paypal/paypal.controller';
3
3
  import { PayUController } from './payu/payu.controller';
4
4
  import { TransController } from './trans/trans.controller';
5
-
6
5
  export * from './trans/trans.controller';
7
6
  export * from './payu/payu.controller';
8
7
  export * from './paypal/paypal.controller';
9
8
  export * from './paynow/paynow.controller';
10
-
11
- export const CONTROLLERS = [
12
- TransController,
13
- PayUController,
14
- PaypalController,
15
- PaynowController,
16
- ];
9
+ export declare const CONTROLLERS: (typeof PaynowController | typeof PaypalController | typeof PayUController | typeof TransController)[];
@@ -0,0 +1,8 @@
1
+ import { TransService } from '@smartsoft001/trans-shell-app-services';
2
+ export declare class PaynowController {
3
+ private readonly service;
4
+ constructor(service: TransService);
5
+ refreshStatus(obj: {
6
+ paymentId: string;
7
+ }): Promise<string>;
8
+ }
@@ -0,0 +1,12 @@
1
+ import { PaypalConfig, PaypalService } from '@smartsoft001/paypal';
2
+ import { TransService } from '@smartsoft001/trans-shell-app-services';
3
+ export declare class PaypalController {
4
+ private readonly service;
5
+ private readonly config;
6
+ private readonly paypalService;
7
+ constructor(service: TransService, config: PaypalConfig, paypalService: PaypalService);
8
+ refreshStatus(obj: {
9
+ item_number1: string;
10
+ }): Promise<string>;
11
+ confirm(id: any, payerId: any, paymentId: any, res: any): Promise<any>;
12
+ }
@@ -0,0 +1,10 @@
1
+ import { TransService } from '@smartsoft001/trans-shell-app-services';
2
+ export declare class PayUController {
3
+ private readonly service;
4
+ constructor(service: TransService);
5
+ refreshStatus(obj: {
6
+ order: {
7
+ orderId: string;
8
+ };
9
+ }): Promise<string>;
10
+ }
@@ -0,0 +1,11 @@
1
+ import { ITransCreate } from '@smartsoft001/trans-domain';
2
+ import { TransService } from '@smartsoft001/trans-shell-app-services';
3
+ export declare class TransController {
4
+ private readonly service;
5
+ constructor(service: TransService);
6
+ create<T>(obj: ITransCreate<T>, req: any): Promise<{
7
+ url: string;
8
+ orderId: string;
9
+ }>;
10
+ refresh<T>(orderId: any, obj: any): Promise<void>;
11
+ }
@@ -0,0 +1,43 @@
1
+ import { DynamicModule } from '@nestjs/common';
2
+ import { SharedConfig } from '@smartsoft001/nestjs';
3
+ import { PaynowConfig } from '@smartsoft001/paynow';
4
+ import { PaypalConfig } from '@smartsoft001/paypal';
5
+ import { PayuConfig } from '@smartsoft001/payu';
6
+ import { RevolutConfig } from '@smartsoft001/revolut';
7
+ import { TransConfig } from '@smartsoft001/trans-domain';
8
+ export declare class TransShellNestjsModule {
9
+ static forRoot(config: SharedConfig & TransConfig & {
10
+ payuConfig?: PayuConfig;
11
+ paypalConfig?: PaypalConfig;
12
+ revolutConfig?: RevolutConfig;
13
+ paynowConfig?: PaynowConfig;
14
+ } & {
15
+ db: {
16
+ host: string;
17
+ port: number;
18
+ database: string;
19
+ username?: string;
20
+ password?: string;
21
+ collection?: string;
22
+ type?: any;
23
+ };
24
+ }): DynamicModule;
25
+ }
26
+ export declare class TransShellNestjsCoreModule {
27
+ static forRoot(config: SharedConfig & TransConfig & {
28
+ payuConfig?: PayuConfig;
29
+ paypalConfig?: PaypalConfig;
30
+ revolutConfig?: RevolutConfig;
31
+ paynowConfig?: PaynowConfig;
32
+ } & {
33
+ db: {
34
+ host: string;
35
+ port: number;
36
+ database: string;
37
+ username?: string;
38
+ password?: string;
39
+ collection?: string;
40
+ type?: any;
41
+ };
42
+ }): DynamicModule;
43
+ }
package/.eslintrc.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "extends": "../../../../.eslintrc.json",
3
- "rules": {},
4
- "ignorePatterns": ["!**/*"],
5
- "overrides": [
6
- {
7
- "files": ["*.json"],
8
- "parser": "jsonc-eslint-parser"
9
- }
10
- ]
11
- }
package/jest.config.ts DELETED
@@ -1,27 +0,0 @@
1
- /* eslint-disable */
2
- export default {
3
- globals: {},
4
- transform: {
5
- '^.+\\.[tj]sx?$': [
6
- 'ts-jest',
7
- {
8
- tsConfig: '<rootDir>/tsconfig.spec.json',
9
- },
10
- ],
11
- },
12
- moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
13
- coverageDirectory: '../../../../coverage/packages/trans/shell/nestjs',
14
- displayName: 'trans-shell-nestjs',
15
- testEnvironment: 'node',
16
- preset: '../../../../jest.preset.js',
17
- /* TODO: Update to latest Jest snapshotFormat
18
- * By default Nx has kept the older style of Jest Snapshot formats
19
- * to prevent breaking of any existing tests with snapshots.
20
- * It's recommend you update to the latest format.
21
- * You can do this by removing snapshotFormat property
22
- * and running tests with --update-snapshot flag.
23
- * Example: From within the project directory, run "nx test --update-snapshot"
24
- * More info: https://jestjs.io/docs/upgrading-to-jest29#snapshot-format
25
- */
26
- snapshotFormat: { escapeString: true, printBasicPrototype: true },
27
- };
package/project.json DELETED
@@ -1,39 +0,0 @@
1
- {
2
- "name": "trans-shell-nestjs",
3
- "$schema": "../../../../node_modules/nx/schemas/project-schema.json",
4
- "sourceRoot": "packages/trans/shell/nestjs/src",
5
- "projectType": "library",
6
- "tags": ["scope:trans", "type:shell"],
7
- "generators": {},
8
- "targets": {
9
- "lint": {
10
- "executor": "@nx/eslint:lint",
11
- "outputs": ["{options.outputFile}"],
12
- "options": {
13
- "lintFilePatterns": [
14
- "packages/trans/shell/nestjs/**/*.{ts,tsx,js,jsx}",
15
- "packages/trans/shell/nestjs/package.json"
16
- ]
17
- }
18
- },
19
- "test": {
20
- "executor": "@nx/jest:jest",
21
- "options": {
22
- "jestConfig": "packages/trans/shell/nestjs/jest.config.ts",
23
- "passWithNoTests": true
24
- },
25
- "outputs": ["{workspaceRoot}/coverage/packages/trans/shell/nestjs"]
26
- },
27
- "build": {
28
- "executor": "@nx/esbuild:esbuild",
29
- "options": {
30
- "outputPath": "dist/packages/trans/shell/nestjs",
31
- "tsConfig": "packages/trans/shell/nestjs/tsconfig.lib.json",
32
- "packageJson": "packages/trans/shell/nestjs/package.json",
33
- "main": "packages/trans/shell/nestjs/src/index.ts",
34
- "assets": ["packages/trans/shell/nestjs/*.md"]
35
- },
36
- "outputs": ["{options.outputPath}"]
37
- }
38
- }
39
- }
@@ -1,20 +0,0 @@
1
- import { Body, Controller, HttpCode, Post } from '@nestjs/common';
2
-
3
- import { TransService } from '@smartsoft001/trans-shell-app-services';
4
-
5
- @Controller('paynow')
6
- export class PaynowController {
7
- constructor(private readonly service: TransService) {}
8
-
9
- @Post()
10
- @HttpCode(200)
11
- async refreshStatus(@Body() obj: { paymentId: string }): Promise<string> {
12
- try {
13
- await this.service.refresh(obj.paymentId, obj);
14
- return 'ok';
15
- } catch (e) {
16
- console.error(e);
17
- throw e;
18
- }
19
- }
20
- }
@@ -1,69 +0,0 @@
1
- import {
2
- Body,
3
- Controller,
4
- HttpCode,
5
- Post,
6
- Get,
7
- Param,
8
- Query,
9
- Res,
10
- HttpStatus,
11
- Optional,
12
- } from '@nestjs/common';
13
-
14
- import { PaypalConfig, PaypalService } from '@smartsoft001/paypal';
15
- import { TransService } from '@smartsoft001/trans-shell-app-services';
16
-
17
- @Controller('paypal')
18
- export class PaypalController {
19
- constructor(
20
- private readonly service: TransService,
21
- @Optional() private readonly config: PaypalConfig,
22
- @Optional() private readonly paypalService: PaypalService,
23
- ) {}
24
-
25
- @Post()
26
- @HttpCode(200)
27
- async refreshStatus(@Body() obj: { item_number1: string }): Promise<string> {
28
- try {
29
- const trans = await this.service.getById(obj.item_number1);
30
- await this.service.refresh(trans.externalId, obj);
31
- return 'ok';
32
- } catch (e) {
33
- console.error('ERROR ---> ', obj);
34
- console.error(e);
35
- throw e;
36
- }
37
- }
38
-
39
- @Get(':id/confirm')
40
- async confirm(
41
- @Param('id') id,
42
- @Query('PayerID') payerId,
43
- @Query('paymentId') paymentId,
44
- @Res() res,
45
- ) {
46
- try {
47
- const trans = await this.service.getById(id);
48
-
49
- if (trans.externalId !== paymentId) {
50
- throw new Error('Invalid externaId');
51
- }
52
-
53
- const payment = await this.paypalService.confirm(
54
- payerId,
55
- paymentId,
56
- trans.amount / 100,
57
- trans.data,
58
- );
59
-
60
- await this.service.refresh(paymentId, payment);
61
-
62
- return res.redirect(HttpStatus.MOVED_PERMANENTLY, this.config.returnUrl);
63
- } catch (e) {
64
- console.log(e);
65
-
66
- return res.redirect(HttpStatus.MOVED_PERMANENTLY, this.config.cancelUrl);
67
- }
68
- }
69
- }
@@ -1,22 +0,0 @@
1
- import { Body, Controller, HttpCode, Post } from '@nestjs/common';
2
-
3
- import { TransService } from '@smartsoft001/trans-shell-app-services';
4
-
5
- @Controller('payu')
6
- export class PayUController {
7
- constructor(private readonly service: TransService) {}
8
-
9
- @Post()
10
- @HttpCode(200)
11
- async refreshStatus(
12
- @Body() obj: { order: { orderId: string } },
13
- ): Promise<string> {
14
- try {
15
- await this.service.refresh(obj.order.orderId, obj);
16
- return 'ok';
17
- } catch (e) {
18
- console.error(e);
19
- throw e;
20
- }
21
- }
22
- }
@@ -1,27 +0,0 @@
1
- import { Body, Controller, Param, Post, Req } from '@nestjs/common';
2
-
3
- import { ITransCreate } from '@smartsoft001/trans-domain';
4
- import { TransService } from '@smartsoft001/trans-shell-app-services';
5
-
6
- @Controller('')
7
- export class TransController {
8
- constructor(private readonly service: TransService) {}
9
-
10
- @Post()
11
- async create<T>(@Body() obj: ITransCreate<T>, @Req() req) {
12
- obj.clientIp =
13
- req.connection.remoteAddress.indexOf('::') === 0
14
- ? '10.0.0.1'
15
- : req.connection.remoteAddress;
16
- const { redirectUrl, orderId } = await this.service.create(obj);
17
- return {
18
- url: redirectUrl,
19
- orderId,
20
- };
21
- }
22
-
23
- @Post(':id/refresh')
24
- async refresh<T>(@Param('id') orderId, @Body() obj): Promise<void> {
25
- await this.service.refresh(orderId, {});
26
- }
27
- }
@@ -1,171 +0,0 @@
1
- import { HttpModule } from '@nestjs/axios';
2
- import { DynamicModule, Module } from '@nestjs/common';
3
- import { JwtModule } from '@nestjs/jwt';
4
- import { PassportModule } from '@nestjs/passport';
5
-
6
- import { CrudShellNestjsModule } from '@smartsoft001/crud-shell-nestjs';
7
- import { SharedConfig } from '@smartsoft001/nestjs';
8
- import { PaynowConfig, PaynowService } from '@smartsoft001/paynow';
9
- import { PaypalConfig, PaypalService } from '@smartsoft001/paypal';
10
- import { PayuConfig, PayuService } from '@smartsoft001/payu';
11
- import { RevolutConfig, RevolutService } from '@smartsoft001/revolut';
12
- import { DOMAIN_SERVICES, TransConfig } from '@smartsoft001/trans-domain';
13
- import { SERVICES } from '@smartsoft001/trans-shell-app-services';
14
-
15
- import { CONTROLLERS } from './controllers';
16
-
17
- @Module({
18
- imports: [HttpModule],
19
- })
20
- export class TransShellNestjsModule {
21
- static forRoot(
22
- config: SharedConfig &
23
- TransConfig & {
24
- payuConfig?: PayuConfig;
25
- paypalConfig?: PaypalConfig;
26
- revolutConfig?: RevolutConfig;
27
- paynowConfig?: PaynowConfig;
28
- } & {
29
- db: {
30
- host: string;
31
- port: number;
32
- database: string;
33
- username?: string;
34
- password?: string;
35
- collection?: string;
36
- type?: any;
37
- };
38
- },
39
- ): DynamicModule {
40
- return {
41
- module: TransShellNestjsModule,
42
- controllers: CONTROLLERS,
43
- providers: [
44
- ...SERVICES,
45
- ...DOMAIN_SERVICES,
46
- { provide: TransConfig, useValue: config },
47
- ...(config.payuConfig
48
- ? [{ provide: PayuConfig, useValue: config.payuConfig }, PayuService]
49
- : []),
50
- ...(config.paypalConfig
51
- ? [
52
- { provide: PaypalConfig, useValue: config.paypalConfig },
53
- PaypalService,
54
- ]
55
- : []),
56
- ...(config.revolutConfig
57
- ? [
58
- { provide: RevolutConfig, useValue: config.revolutConfig },
59
- RevolutService,
60
- ]
61
- : []),
62
- ...(config.paynowConfig
63
- ? [
64
- { provide: PaynowConfig, useValue: config.paynowConfig },
65
- PaynowService,
66
- ]
67
- : []),
68
- ],
69
- imports: [
70
- CrudShellNestjsModule.forRoot({
71
- ...config,
72
- db: {
73
- ...config.db,
74
- collection: 'trans',
75
- },
76
- restApi: false,
77
- socket: false,
78
- }),
79
- PassportModule.register({ defaultStrategy: 'jwt', session: false }),
80
- JwtModule.register({
81
- secret: config.tokenConfig.secretOrPrivateKey,
82
- signOptions: {
83
- expiresIn: config.tokenConfig.expiredIn,
84
- },
85
- }),
86
- ],
87
- exports: [
88
- ...SERVICES,
89
- TransConfig,
90
- ...(config.payuConfig ? [PayuConfig, PayuService] : []),
91
- ...(config.paypalConfig ? [PaypalConfig, PaypalService] : []),
92
- ...(config.revolutConfig ? [RevolutConfig, RevolutService] : []),
93
- ],
94
- };
95
- }
96
- }
97
-
98
- @Module({
99
- imports: [HttpModule],
100
- })
101
- export class TransShellNestjsCoreModule {
102
- static forRoot(
103
- config: SharedConfig &
104
- TransConfig & {
105
- payuConfig?: PayuConfig;
106
- paypalConfig?: PaypalConfig;
107
- revolutConfig?: RevolutConfig;
108
- paynowConfig?: PaynowConfig;
109
- } & {
110
- db: {
111
- host: string;
112
- port: number;
113
- database: string;
114
- username?: string;
115
- password?: string;
116
- collection?: string;
117
- type?: any;
118
- };
119
- },
120
- ): DynamicModule {
121
- return {
122
- module: TransShellNestjsCoreModule,
123
- providers: [
124
- ...SERVICES,
125
- ...DOMAIN_SERVICES,
126
- { provide: TransConfig, useValue: config },
127
- ...(config.payuConfig
128
- ? [{ provide: PayuConfig, useValue: config.payuConfig }, PayuService]
129
- : []),
130
- ...(config.paypalConfig
131
- ? [
132
- { provide: PaypalConfig, useValue: config.paypalConfig },
133
- PaypalService,
134
- ]
135
- : []),
136
- ...(config.paynowConfig
137
- ? [
138
- { provide: PaynowConfig, useValue: config.paynowConfig },
139
- PaynowService,
140
- ]
141
- : []),
142
- ],
143
- imports: [
144
- CrudShellNestjsModule.forRoot({
145
- ...config,
146
- db: {
147
- ...config.db,
148
- collection: 'trans',
149
- },
150
- restApi: false,
151
- socket: false,
152
- }),
153
- PassportModule.register({ defaultStrategy: 'jwt', session: false }),
154
- JwtModule.register({
155
- secret: config.tokenConfig.secretOrPrivateKey,
156
- signOptions: {
157
- expiresIn: config.tokenConfig.expiredIn,
158
- },
159
- }),
160
- ],
161
- exports: [
162
- ...SERVICES,
163
- TransConfig,
164
- ...(config.payuConfig ? [PayuConfig, PayuService] : []),
165
- ...(config.paypalConfig ? [PaypalConfig, PaypalService] : []),
166
- ...(config.revolutConfig ? [RevolutConfig, RevolutService] : []),
167
- ...(config.paynowConfig ? [PaynowConfig, PaynowService] : []),
168
- ],
169
- };
170
- }
171
- }
package/tsconfig.json DELETED
@@ -1,13 +0,0 @@
1
- {
2
- "extends": "../../../../tsconfig.base.json",
3
- "files": [],
4
- "include": [],
5
- "references": [
6
- {
7
- "path": "./tsconfig.lib.json"
8
- },
9
- {
10
- "path": "./tsconfig.spec.json"
11
- }
12
- ]
13
- }
package/tsconfig.lib.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "module": "commonjs",
5
- "outDir": "../../../../dist/out-tsc",
6
- "declaration": true,
7
- "types": ["node"]
8
- },
9
- "exclude": ["**/*.spec.ts", "**/*.test.ts", "jest.config.ts"],
10
- "include": ["**/*.ts"]
11
- }
@@ -1,20 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "../../../../dist/out-tsc",
5
- "module": "commonjs",
6
- "types": ["jest", "node"]
7
- },
8
- "include": [
9
- "**/*.spec.ts",
10
- "**/*.test.ts",
11
- "**/*.spec.tsx",
12
- "**/*.test.tsx",
13
- "**/*.spec.js",
14
- "**/*.test.js",
15
- "**/*.spec.jsx",
16
- "**/*.test.jsx",
17
- "**/*.d.ts",
18
- "jest.config.ts"
19
- ]
20
- }
File without changes
File without changes