@nathapp/na-cli 1.0.0-rc.4 → 1.0.0-rc.40
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/.gitlab-ci.yml +135 -0
- package/Makefile +16 -9
- package/README.md +18 -2
- package/alias-script.sh +30 -0
- package/dist/index.js +106 -128
- package/dist/index.js.map +1 -1
- package/dist/templates/db-schema/.gitignore-rename +1 -0
- package/dist/templates/db-schema/.gitlab-ci.yml +139 -0
- package/dist/templates/db-schema/001_Schema.sql +1 -0
- package/dist/templates/db-schema/DEV_MODE.txt +1 -0
- package/dist/templates/db-schema/Dockerfile +3 -0
- package/dist/templates/db-schema/Email-Templates/Individual/README.md +1 -0
- package/dist/templates/db-schema/GET_VERSION.sql +47 -0
- package/dist/templates/db-schema/Makefile +885 -0
- package/dist/templates/db-schema/README.md +117 -0
- package/dist/templates/db-schema/SET_VERSION.sql +5 -0
- package/dist/templates/db-schema/docker-compose.yaml +47 -0
- package/dist/templates/db-schema/package.json +3 -0
- package/dist/templates/db-schema/push.sh +0 -0
- package/dist/templates/db-schema/samples/899_DB_Grant_User.sql +9 -0
- package/dist/templates/db-schema/samples/990_SAMPLE_Init_Data.sql +27 -0
- package/dist/templates/k8s-deployment/.gitignore-rename +1 -0
- package/dist/templates/k8s-deployment/.gitlab-ci.yml +128 -0
- package/dist/templates/k8s-deployment/.helmignore +23 -0
- package/dist/templates/k8s-deployment/Chart.yaml +23 -0
- package/dist/templates/k8s-deployment/Makefile +196 -0
- package/dist/templates/k8s-deployment/README.md +32 -0
- package/dist/templates/k8s-deployment/resources/charts/mysql/Chart.yaml +23 -0
- package/dist/templates/k8s-deployment/resources/charts/mysql/charts/mysql-install/Chart.yaml +23 -0
- package/dist/templates/k8s-deployment/resources/charts/mysql/charts/mysql-install/script/Makefile +12 -0
- package/dist/templates/k8s-deployment/resources/charts/mysql/charts/mysql-install/templates/_helpers.tpl +62 -0
- package/dist/templates/k8s-deployment/resources/charts/mysql/charts/mysql-install/templates/configmap.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/mysql/charts/mysql-install/templates/job.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/mysql/charts/mysql-install/templates/secret.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/mysql/charts/mysql-install/values.yaml +51 -0
- package/dist/templates/k8s-deployment/resources/charts/mysql/templates/_helpers.tpl +62 -0
- package/dist/templates/k8s-deployment/resources/charts/mysql/templates/configmap.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/mysql/templates/deployment.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/mysql/templates/ingress.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/mysql/templates/job.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/mysql/templates/pv.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/mysql/templates/pvc.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/mysql/templates/sc.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/mysql/templates/secret.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/mysql/templates/service.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/mysql/templates/statefulset.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/mysql/values.yaml +15 -0
- package/dist/templates/k8s-deployment/resources/charts/redis/Chart.yaml +23 -0
- package/dist/templates/k8s-deployment/resources/charts/redis/charts/redis-install/Chart.yaml +23 -0
- package/dist/templates/k8s-deployment/resources/charts/redis/charts/redis-install/script/Makefile +8 -0
- package/dist/templates/k8s-deployment/resources/charts/redis/charts/redis-install/templates/_helpers.tpl +62 -0
- package/dist/templates/k8s-deployment/resources/charts/redis/charts/redis-install/templates/configmap.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/redis/charts/redis-install/templates/job.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/redis/charts/redis-install/templates/secret.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/redis/charts/redis-install/values.yaml +42 -0
- package/dist/templates/k8s-deployment/resources/charts/redis/templates/_helpers.tpl +62 -0
- package/dist/templates/k8s-deployment/resources/charts/redis/templates/configmap.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/redis/templates/deployment.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/redis/templates/ingress.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/redis/templates/job.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/redis/templates/pv.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/redis/templates/pvc.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/redis/templates/sc.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/redis/templates/secret.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/redis/templates/service.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/redis/templates/statefulset.yaml +1 -0
- package/dist/templates/k8s-deployment/resources/charts/redis/values.yaml +12 -0
- package/dist/templates/k8s-deployment/services/charts/hooks/Chart.yaml +23 -0
- package/dist/templates/k8s-deployment/services/charts/hooks/charts/pre-delete-rsc/Chart.yaml +23 -0
- package/dist/templates/k8s-deployment/services/charts/hooks/charts/pre-delete-rsc/script/Makefile +49 -0
- package/dist/templates/k8s-deployment/services/charts/hooks/charts/pre-delete-rsc/script/_env.yaml +2 -0
- package/dist/templates/k8s-deployment/services/charts/hooks/charts/pre-delete-rsc/templates/_helpers.tpl +62 -0
- package/dist/templates/k8s-deployment/services/charts/hooks/charts/pre-delete-rsc/templates/configmap.yaml +1 -0
- package/dist/templates/k8s-deployment/services/charts/hooks/charts/pre-delete-rsc/templates/job.yaml +1 -0
- package/dist/templates/k8s-deployment/services/charts/hooks/charts/pre-delete-rsc/templates/secret.yaml +1 -0
- package/dist/templates/k8s-deployment/services/charts/hooks/charts/pre-delete-rsc/values.yaml +36 -0
- package/dist/templates/k8s-deployment/services/charts/sample-nginx/Chart.yaml +23 -0
- package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/_helpers.tpl +62 -0
- package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/cluster-role-binding.yaml +1 -0
- package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/configmap.yaml +1 -0
- package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/cronjob.yaml +1 -0
- package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/deployment.yaml +1 -0
- package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/ingress.yaml +1 -0
- package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/pv.yaml +1 -0
- package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/pvc.yaml +1 -0
- package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/sc.yaml +1 -0
- package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/secret.yaml +1 -0
- package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/service-account.yaml +1 -0
- package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/service.yaml +1 -0
- package/dist/templates/k8s-deployment/services/charts/sample-nginx/templates/statefulset.yaml +1 -0
- package/dist/templates/k8s-deployment/services/charts/sample-nginx/values.yaml +47 -0
- package/dist/templates/k8s-deployment/services/charts/tests/Chart.yaml +23 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/Chart.yaml +23 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/Makefile +9 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress/fixtures/index.json +1 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress/integration/login/login-spec.js +47 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress/integration/login/loginEmailWrong-spec.js +14 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress/integration/login/loginPasswordWrong-spec.js +14 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress/integration/profile/updatePassword-spec.js +15 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress/integration/profile/updateProfile-spec.js +25 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress/integration/test-script.spec.js +9 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress/plugins/index.js +22 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress/support/commands.js +258 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress/support/index.js +35 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress/support/misc.js +8 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/cypress.json +4 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/templates/_helpers.tpl +62 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/templates/configmap.yaml +1 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/templates/pod.yaml +1 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/templates/secret.yaml +1 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/values.yaml +70 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/.helmignore +2 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/Chart.yaml +23 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/script/Makefile +14 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/templates/_helpers.tpl +62 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/templates/configmap.yaml +1 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/templates/pod.yaml +1 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/templates/secret.yaml +1 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/_t-0100-readiness-liveness.ts +84 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/hub.ts +372 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-contact.ts +158 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-contract.ts +328 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-kyc.ts +304 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-onboard-app.ts +823 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-onboard-web.ts +493 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-profile.ts +277 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-whitelist.ts +133 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/resources/live.jpg +0 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/resources/mykad_front.jpg +0 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/resources/profile.jpg +0 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/t-0200-start.ts +172 -0
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/values.yaml +59 -0
- package/dist/templates/k8s-deployment/templates/_cluster-role-binding.tpl +20 -0
- package/dist/templates/k8s-deployment/templates/_configmap.tpl +37 -0
- package/dist/templates/k8s-deployment/templates/_cronjob.tpl +225 -0
- package/dist/templates/k8s-deployment/templates/_deployment.tpl +246 -0
- package/dist/templates/k8s-deployment/templates/_helpers.tpl +31 -0
- package/dist/templates/k8s-deployment/templates/_ingress.tpl +77 -0
- package/dist/templates/k8s-deployment/templates/_job.tpl +233 -0
- package/dist/templates/k8s-deployment/templates/_pod.tpl +214 -0
- package/dist/templates/k8s-deployment/templates/_pv.tpl +42 -0
- package/dist/templates/k8s-deployment/templates/_pvc.tpl +27 -0
- package/dist/templates/k8s-deployment/templates/_root.tpl +314 -0
- package/dist/templates/k8s-deployment/templates/_sc.tpl +19 -0
- package/dist/templates/k8s-deployment/templates/_secret.tpl +15 -0
- package/dist/templates/k8s-deployment/templates/_service-account.tpl +8 -0
- package/dist/templates/k8s-deployment/templates/_service.tpl +40 -0
- package/dist/templates/k8s-deployment/templates/_statefulset.tpl +244 -0
- package/dist/templates/k8s-deployment/templates/root-cm.yaml +10 -0
- package/dist/templates/k8s-deployment/templates/root-pull-secret.yaml +11 -0
- package/dist/templates/k8s-deployment/templates/root-secret.yaml +24 -0
- package/dist/templates/k8s-deployment/values.yaml +38 -0
- package/dist/templates/k8s-helm-chart/Chart.yaml +23 -0
- package/dist/templates/k8s-helm-chart/templates/_helpers.tpl +62 -0
- package/dist/templates/k8s-helm-chart/templates/cluster-role-binding.yaml +1 -0
- package/dist/templates/k8s-helm-chart/templates/configmap.yaml +1 -0
- package/dist/templates/k8s-helm-chart/templates/cronjob.yaml +1 -0
- package/dist/templates/k8s-helm-chart/templates/deployment.yaml +1 -0
- package/dist/templates/k8s-helm-chart/templates/ingress.yaml +1 -0
- package/dist/templates/k8s-helm-chart/templates/pv.yaml +1 -0
- package/dist/templates/k8s-helm-chart/templates/pvc.yaml +1 -0
- package/dist/templates/k8s-helm-chart/templates/sc.yaml +1 -0
- package/dist/templates/k8s-helm-chart/templates/secret.yaml +1 -0
- package/dist/templates/k8s-helm-chart/templates/service-account.yaml +1 -0
- package/dist/templates/k8s-helm-chart/templates/service.yaml +1 -0
- package/dist/templates/k8s-helm-chart/templates/statefulset.yaml +1 -0
- package/dist/templates/k8s-helm-chart/values.yaml +41 -0
- package/dist/templates/mxw-base-api-express/.dockerignore +2 -0
- package/dist/templates/mxw-base-api-express/.env +10 -0
- package/dist/templates/mxw-base-api-express/.gitignore-rename +3 -0
- package/dist/templates/mxw-base-api-express/.gitlab-ci.yml +174 -0
- package/dist/templates/mxw-base-api-express/.nvmrc +1 -0
- package/dist/templates/mxw-base-api-express/Dockerfile +14 -0
- package/dist/templates/mxw-base-api-express/Makefile +84 -0
- package/dist/templates/mxw-base-api-express/README.md +71 -0
- package/dist/templates/mxw-base-api-express/package.json +55 -0
- package/dist/templates/mxw-base-api-express/src/app-service.test.ts +94 -0
- package/dist/templates/mxw-base-api-express/src/app-service.ts +498 -0
- package/dist/templates/mxw-base-api-express/src/auth/auth-user.test.ts +215 -0
- package/dist/templates/mxw-base-api-express/src/auth/auth-user.ts +86 -0
- package/dist/templates/mxw-base-api-express/src/auth/auth.ts +81 -0
- package/dist/templates/mxw-base-api-express/src/core-service.ts +72 -0
- package/dist/templates/mxw-base-api-express/src/crud.ts +84 -0
- package/dist/templates/mxw-base-api-express/src/http-handler.ts +71 -0
- package/dist/templates/mxw-base-api-express/src/server.ts +54 -0
- package/dist/templates/mxw-base-api-express/src/test.ts +38 -0
- package/dist/templates/mxw-base-api-express/src/utils/api-utilities.ts +52 -0
- package/dist/templates/mxw-base-api-express/src/utils/file-utilities.ts +55 -0
- package/dist/templates/mxw-base-api-express/tsconfig.json +32 -0
- package/dist/templates/nestjs-api/.dockerignore +2 -0
- package/dist/templates/nestjs-api/.env +12 -0
- package/dist/templates/nestjs-api/.eslintrc.js +25 -0
- package/dist/templates/nestjs-api/.gitignore-rename +35 -0
- package/dist/templates/nestjs-api/.gitlab-ci.yml +174 -0
- package/dist/templates/nestjs-api/.nvmrc +1 -0
- package/dist/templates/nestjs-api/.prettierrc +4 -0
- package/dist/templates/nestjs-api/Dockerfile +19 -0
- package/dist/templates/nestjs-api/Makefile +84 -0
- package/dist/templates/nestjs-api/README.md +67 -0
- package/dist/templates/nestjs-api/nest-cli.json +8 -0
- package/dist/templates/nestjs-api/package.json +75 -0
- package/dist/templates/nestjs-api/src/app.controller.spec.ts +22 -0
- package/dist/templates/nestjs-api/src/app.controller.ts +27 -0
- package/dist/templates/nestjs-api/src/app.module.ts +10 -0
- package/dist/templates/nestjs-api/src/app.service.ts +12 -0
- package/dist/templates/nestjs-api/src/main.ts +31 -0
- package/dist/templates/nestjs-api/test/app.e2e-spec.ts +24 -0
- package/dist/templates/nestjs-api/test/jest-e2e.json +9 -0
- package/dist/templates/nestjs-api/tsconfig.build.json +4 -0
- package/dist/templates/nestjs-api/tsconfig.json +22 -0
- package/dist/templates/nestjs-library/.eslintrc.js +24 -0
- package/dist/templates/nestjs-library/.gitignore-rename +39 -0
- package/dist/templates/nestjs-library/.gitlab-ci.yml +135 -0
- package/dist/templates/nestjs-library/.npmignore-rename +30 -0
- package/dist/templates/nestjs-library/.prettierrc +6 -0
- package/dist/templates/nestjs-library/LICENSE +21 -0
- package/dist/templates/nestjs-library/Makefile +60 -0
- package/dist/templates/nestjs-library/README.md +3 -0
- package/dist/templates/nestjs-library/index.d.ts +1 -0
- package/dist/templates/nestjs-library/index.js +6 -0
- package/dist/templates/nestjs-library/index.ts +1 -0
- package/dist/templates/nestjs-library/lib/index.ts +2 -0
- package/dist/templates/nestjs-library/package.json +43 -0
- package/dist/templates/nestjs-library/tsconfig.build.json +4 -0
- package/dist/templates/nestjs-library/tsconfig.json +18 -0
- package/dist/templates/ts-library/.dockerignore +2 -0
- package/dist/templates/ts-library/.eslintrc.js +24 -0
- package/dist/templates/ts-library/.gitignore-rename +37 -0
- package/dist/templates/ts-library/.gitlab-ci.yml +135 -0
- package/dist/templates/ts-library/.npmignore-rename +30 -0
- package/dist/templates/ts-library/.prettierrc +6 -0
- package/dist/templates/ts-library/LICENSE +21 -0
- package/dist/templates/ts-library/Makefile +58 -0
- package/dist/templates/ts-library/README.md +1 -0
- package/dist/templates/ts-library/index.d.ts +1 -0
- package/dist/templates/ts-library/index.js +6 -0
- package/dist/templates/ts-library/index.ts +1 -0
- package/dist/templates/ts-library/lib/index.ts +1 -0
- package/dist/templates/ts-library/lib/samples/index.ts +5 -0
- package/dist/templates/ts-library/lib/samples/samples-function.ts +3 -0
- package/dist/templates/ts-library/package.json +34 -0
- package/dist/templates/ts-library/test/jest-e2e.json +9 -0
- package/dist/templates/ts-library/test/sample.e2e-spec.ts +10 -0
- package/dist/templates/ts-library/tsconfig.build.json +4 -0
- package/dist/templates/ts-library/tsconfig.json +18 -0
- package/dist/utils/env.js +146 -0
- package/dist/utils/env.js.map +1 -0
- package/dist/utils/template.js +362 -1
- package/dist/utils/template.js.map +1 -1
- package/package.json +9 -5
- package/src/index.ts +0 -182
- package/src/utils/template.ts +0 -9
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
import { describe, it } from 'mocha';
|
|
4
|
+
import chai, { expect } from 'chai';
|
|
5
|
+
import chaihttp from 'chai-http';
|
|
6
|
+
|
|
7
|
+
import HubService, { User, challengeIt, goodRet, badRet, serviceUrl, mxwV1ServiceUrl, uploadOSS } from "./hub";
|
|
8
|
+
import { throwError, errors, describeError } from 'mxw-libs-errors';
|
|
9
|
+
|
|
10
|
+
chai.use(chaihttp);
|
|
11
|
+
|
|
12
|
+
let indent = " ";
|
|
13
|
+
|
|
14
|
+
export function profile(user: User, challenge: boolean) {
|
|
15
|
+
describe('Suite: Individual Profile: ' + user.code + " (" + user.email + ")", function () {
|
|
16
|
+
if (challenge) {
|
|
17
|
+
it("Get profile - challenge without JWT", function () {
|
|
18
|
+
let url = serviceUrl("/user/api");
|
|
19
|
+
|
|
20
|
+
return chai.request(url).get("/profile")
|
|
21
|
+
.type("application/json")
|
|
22
|
+
.set("Authorization", "Bearer ")
|
|
23
|
+
.then((res) => {
|
|
24
|
+
badRet(res, "InvalidHeader");
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
it("Get profile", function () {
|
|
30
|
+
let url = serviceUrl("/user/api");
|
|
31
|
+
|
|
32
|
+
return chai.request(url).get("/profile")
|
|
33
|
+
.type("application/json")
|
|
34
|
+
.set("Authorization", "Bearer " + user.jwt)
|
|
35
|
+
.then((res) => {
|
|
36
|
+
goodRet(res);
|
|
37
|
+
expect(res.body).have.property("data").property("userId").is.a("number").eq(user.id);
|
|
38
|
+
expect(res.body).have.property("data").property("email").is.a("string").eq(user.email);
|
|
39
|
+
expect(res.body).have.property("data").property("walletAddress").is.a("string").eq(user.wallet.address);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
challengeIt("Update profile info", function (params) {
|
|
44
|
+
let url = serviceUrl("/user/api");
|
|
45
|
+
|
|
46
|
+
return chai.request(url).post("/set/profile")
|
|
47
|
+
.type("application/json")
|
|
48
|
+
.set("Authorization", "Bearer " + user.jwt)
|
|
49
|
+
.send(params)
|
|
50
|
+
.then((res) => {
|
|
51
|
+
badRet(res);
|
|
52
|
+
});
|
|
53
|
+
}, {
|
|
54
|
+
nickname: "",
|
|
55
|
+
dialCode: "",
|
|
56
|
+
mobileNo: "",
|
|
57
|
+
profileImg: "",
|
|
58
|
+
lang: "",
|
|
59
|
+
country: "",
|
|
60
|
+
public: "",
|
|
61
|
+
type: ""
|
|
62
|
+
}, challenge);
|
|
63
|
+
|
|
64
|
+
if (challenge) {
|
|
65
|
+
it("Update profile info - challenge without JWT", function () {
|
|
66
|
+
let url = serviceUrl("/user/api");
|
|
67
|
+
|
|
68
|
+
return chai.request(url).post("/set/profile")
|
|
69
|
+
.type("application/json")
|
|
70
|
+
.set("Authorization", "Bearer ")
|
|
71
|
+
.send({
|
|
72
|
+
nickname: user.code,
|
|
73
|
+
dialCode: null,
|
|
74
|
+
mobileNo: null,
|
|
75
|
+
lang: null,
|
|
76
|
+
country: null,
|
|
77
|
+
public: null,
|
|
78
|
+
type: null
|
|
79
|
+
})
|
|
80
|
+
.then((res) => {
|
|
81
|
+
badRet(res, "InvalidHeader");
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
it("Update profile info", function () {
|
|
87
|
+
let url = serviceUrl("/user/api");
|
|
88
|
+
|
|
89
|
+
return chai.request(url).post("/set/profile")
|
|
90
|
+
.type("application/json")
|
|
91
|
+
.set("Authorization", "Bearer " + user.jwt)
|
|
92
|
+
.send({
|
|
93
|
+
nickname: user.code,
|
|
94
|
+
dialCode: null,
|
|
95
|
+
mobileNo: null,
|
|
96
|
+
lang: null,
|
|
97
|
+
country: null,
|
|
98
|
+
public: null,
|
|
99
|
+
type: null
|
|
100
|
+
})
|
|
101
|
+
.then((res) => {
|
|
102
|
+
goodRet(res);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("Verify profile", function () {
|
|
107
|
+
let url = serviceUrl("/user/api");
|
|
108
|
+
|
|
109
|
+
return chai.request(url).get("/profile")
|
|
110
|
+
.type("application/json")
|
|
111
|
+
.set("Authorization", "Bearer " + user.jwt)
|
|
112
|
+
.then((res) => {
|
|
113
|
+
goodRet(res);
|
|
114
|
+
expect(res.body).have.property("data").property("userId").is.a("number").eq(user.id);
|
|
115
|
+
expect(res.body).have.property("data").property("email").is.a("string").eq(user.email);
|
|
116
|
+
expect(res.body).have.property("data").property("walletAddress").is.a("string").eq(user.wallet.address);
|
|
117
|
+
expect(res.body).have.property("data").property("nickname").is.a("string").eq(user.code);
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function mainProfile(user: User, challenge: boolean) {
|
|
124
|
+
describe('Suite: Individual Main Profile: ' + user.code + " (" + user.email + ")", function () {
|
|
125
|
+
let profileImgUrl: string;
|
|
126
|
+
|
|
127
|
+
if (challenge) {
|
|
128
|
+
it("Get profile - challenge without JWT", function () {
|
|
129
|
+
let url = mxwV1ServiceUrl("/provider/account/v1");
|
|
130
|
+
|
|
131
|
+
return chai.request(url).get("/getProfile")
|
|
132
|
+
.type("application/json")
|
|
133
|
+
.set("Authorization", "Bearer ")
|
|
134
|
+
.then((res) => {
|
|
135
|
+
badRet(res, "InvalidHeader");
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
it("Get profile", function () {
|
|
141
|
+
let url = mxwV1ServiceUrl("/provider/account/v1");
|
|
142
|
+
|
|
143
|
+
return chai.request(url).get("/getProfile")
|
|
144
|
+
.type("application/json")
|
|
145
|
+
.set("Authorization", "Bearer " + user.mxwJwt)
|
|
146
|
+
.then((res) => {
|
|
147
|
+
goodRet(res);
|
|
148
|
+
expect(res.body).have.property("data").property("userID").is.a("number").is.eq(user.id);
|
|
149
|
+
expect(res.body).have.property("data").property("email").is.a("string").is.eq(user.email);
|
|
150
|
+
expect(res.body).have.property("data").property("nickName").is.a("string");
|
|
151
|
+
expect(res.body).have.property("data").property("walletAddr").is.a("string").is.eq(user.wallet.address);
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
challengeIt("Update profile", function (params) {
|
|
156
|
+
let url = mxwV1ServiceUrl("/provider/account/v1");
|
|
157
|
+
|
|
158
|
+
return chai.request(url).post("/setProfile")
|
|
159
|
+
.type("application/json")
|
|
160
|
+
.set("Authorization", "Bearer " + user.mxwJwt)
|
|
161
|
+
.send(params)
|
|
162
|
+
.then((res) => {
|
|
163
|
+
badRet(res);
|
|
164
|
+
});
|
|
165
|
+
}, {
|
|
166
|
+
alias: null,
|
|
167
|
+
country: "",
|
|
168
|
+
dialCode: null,
|
|
169
|
+
email: "",
|
|
170
|
+
lang: "",
|
|
171
|
+
mobileNo: null,
|
|
172
|
+
nickName: "",
|
|
173
|
+
profileImg: "",
|
|
174
|
+
public: null,
|
|
175
|
+
referralCode: null
|
|
176
|
+
}, challenge);
|
|
177
|
+
|
|
178
|
+
it("Update profile", function () {
|
|
179
|
+
return chai.request(mxwV1ServiceUrl("/provider/account/v1")).post("/setProfile")
|
|
180
|
+
.type("application/json")
|
|
181
|
+
.set("Authorization", "Bearer " + user.mxwJwt)
|
|
182
|
+
.send({
|
|
183
|
+
alias: null,
|
|
184
|
+
country: user.profile.country,
|
|
185
|
+
dialCode: null,
|
|
186
|
+
email: user.email,
|
|
187
|
+
lang: user.profile.language,
|
|
188
|
+
mobileNo: null,
|
|
189
|
+
nickName: user.username,
|
|
190
|
+
profileImg: "Believe me this is a real image url",
|
|
191
|
+
public: 0,
|
|
192
|
+
referralCode: null
|
|
193
|
+
})
|
|
194
|
+
.then((res) => {
|
|
195
|
+
goodRet(res);
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it("Verify profile", function () {
|
|
200
|
+
let url = mxwV1ServiceUrl("/provider/account/v1");
|
|
201
|
+
|
|
202
|
+
return chai.request(url).get("/getProfile")
|
|
203
|
+
.type("application/json")
|
|
204
|
+
.set("Authorization", "Bearer " + user.mxwJwt)
|
|
205
|
+
.then((res) => {
|
|
206
|
+
goodRet(res);
|
|
207
|
+
expect(res.body).have.property("data").property("userID").is.a("number").is.eq(user.id);
|
|
208
|
+
expect(res.body).have.property("data").property("email").is.a("string").is.eq(user.email);
|
|
209
|
+
expect(res.body).have.property("data").property("nickName").is.a("string").is.eq(user.username);
|
|
210
|
+
expect(res.body).have.property("data").property("walletAddr").is.a("string").is.eq(user.wallet.address);
|
|
211
|
+
expect(res.body).have.property("data").property("country").is.a("string").is.eq(user.profile.country);
|
|
212
|
+
expect(res.body).have.property("data").property("lang").is.a("string").is.eq(user.profile.language);
|
|
213
|
+
expect(res.body).have.property("data").property("public").is.a("number");
|
|
214
|
+
|
|
215
|
+
if (res.body.data.profileImg) {
|
|
216
|
+
console.log("\x1b[33m%s", indent, "WARNING: This overwrite profile image bug is required to patch.", "\x1b[0m");
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
// console.log("\x1b[33m%s", indent, "WARNING: Special error handler is required to remove.", "\x1b[0m");
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
if (challenge) {
|
|
225
|
+
it("Upload profile image - challenge without actionType", function () {
|
|
226
|
+
let url = mxwV1ServiceUrl("/provider/account/v1");
|
|
227
|
+
let params = {
|
|
228
|
+
actionType: ""
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
return uploadOSS(user, url, "/profilePreupload", params, __dirname + "/resources/profile.jpg", "image/png").then((readUrl) => {
|
|
232
|
+
throwError("SHOULD_NOT_REACH_HERE");
|
|
233
|
+
}).catch(error => {
|
|
234
|
+
let { code, message } = describeError(error);
|
|
235
|
+
|
|
236
|
+
if ("InvalidResponse" == code) {
|
|
237
|
+
console.log("\x1b[33m%s", indent, "WARNING: This error is required to patch.", code + ":", message, "\x1b[0m");
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
console.log("\x1b[33m%s", indent, "WARNING: Special error handler is required to remove.", code, ":", message, "\x1b[0m");
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
it("Upload profile image", function () {
|
|
247
|
+
let url = mxwV1ServiceUrl("/provider/account/v1");
|
|
248
|
+
let params = {
|
|
249
|
+
actionType: "PROFILE"
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
return uploadOSS(user, url, "/profilePreupload", params, __dirname + "/resources/profile.jpg", "image/png").then((readUrl) => {
|
|
253
|
+
profileImgUrl = readUrl;
|
|
254
|
+
if (!HubService.Instance.silent) { console.log(indent, "Uploaded main profile image:", profileImgUrl) }
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
it("Verify profile image", function () {
|
|
259
|
+
let url = mxwV1ServiceUrl("/provider/account/v1");
|
|
260
|
+
|
|
261
|
+
return chai.request(url).get("/getProfile")
|
|
262
|
+
.type("application/json")
|
|
263
|
+
.set("Authorization", "Bearer " + user.mxwJwt)
|
|
264
|
+
.then((res) => {
|
|
265
|
+
goodRet(res);
|
|
266
|
+
expect(res.body).have.property("data").property("userID").is.a("number").is.eq(user.id);
|
|
267
|
+
expect(res.body).have.property("data").property("email").is.a("string").is.eq(user.email);
|
|
268
|
+
expect(res.body).have.property("data").property("nickName").is.a("string").is.eq(user.username);
|
|
269
|
+
expect(res.body).have.property("data").property("walletAddr").is.a("string").is.eq(user.wallet.address);
|
|
270
|
+
expect(res.body).have.property("data").property("profileImg").is.a("string").is.eq(profileImgUrl);
|
|
271
|
+
expect(res.body).have.property("data").property("country").is.a("string").is.eq(user.profile.country);
|
|
272
|
+
expect(res.body).have.property("data").property("lang").is.a("string").is.eq(user.profile.language);
|
|
273
|
+
expect(res.body).have.property("data").property("public").is.a("number");
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
import { describe, it } from 'mocha';
|
|
4
|
+
import chai, { expect } from 'chai';
|
|
5
|
+
import chaihttp from 'chai-http';
|
|
6
|
+
|
|
7
|
+
import HubService, { User, goodRet, mxwServiceUrl, mxwV1ServiceUrl } from "./hub";
|
|
8
|
+
import { toUtf8Bytes, sortObject } from 'mxw-libs-utils';
|
|
9
|
+
import { utils, Wallet, auth } from 'mxw-sdk-js';
|
|
10
|
+
import { JsonRpcProvider } from 'mxw-sdk-js/dist/providers';
|
|
11
|
+
import { KYC_FLOW_ID, KYC_TYPE_ID } from './individual-kyc';
|
|
12
|
+
|
|
13
|
+
chai.use(chaihttp);
|
|
14
|
+
|
|
15
|
+
let indent = " ";
|
|
16
|
+
|
|
17
|
+
export function whitelist(user: User, idType: KYC_TYPE_ID, wallet: Wallet, challenge: boolean) {
|
|
18
|
+
describe('Suite: Whitelist Wallet: ' + user.code + " (" + wallet.address + ")", function () {
|
|
19
|
+
it("Get KYC info", function () {
|
|
20
|
+
return chai.request(mxwServiceUrl("/provider/kyc/v2"))
|
|
21
|
+
.get("/getKycInfo")
|
|
22
|
+
.type("application/json")
|
|
23
|
+
.set("Authorization", "Bearer " + user.mxwJwt)
|
|
24
|
+
.query({
|
|
25
|
+
kycId: user.kyc.kycId
|
|
26
|
+
})
|
|
27
|
+
.then((res) => {
|
|
28
|
+
goodRet(res);
|
|
29
|
+
expect(res.body).have.property("data").property("kycStatus").is.a("number");
|
|
30
|
+
user.kyc.status = res.body.data.kycStatus;
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// it("Initialize Maxonrow user account", function () {
|
|
35
|
+
// let url = mxwServiceUrl("/user/api");
|
|
36
|
+
|
|
37
|
+
// return chai.request(url).post("/initUser")
|
|
38
|
+
// .type("application/json")
|
|
39
|
+
// .set("Authorization", "Bearer " + user.mxwJwt)
|
|
40
|
+
// .send({
|
|
41
|
+
// walletAddress: wallet.address
|
|
42
|
+
// }).then((res) => {
|
|
43
|
+
// console.log(res.body)
|
|
44
|
+
// goodRet(res);
|
|
45
|
+
// expect(res.body).have.property("data").have.property("walletId").is.a("number").greaterThan(0);
|
|
46
|
+
// });
|
|
47
|
+
// });
|
|
48
|
+
|
|
49
|
+
// it("Pre-check", function () {
|
|
50
|
+
// let url = mxwV1ServiceUrl("/provider/kyc-proxy/v1");
|
|
51
|
+
|
|
52
|
+
// return chai.request(url).post("/precheckEx")
|
|
53
|
+
// .type("application/json")
|
|
54
|
+
// .set("Authorization", "Bearer " + user.mxwJwt)
|
|
55
|
+
// .set("app-id", String(HubService.Instance.appId))
|
|
56
|
+
// .send({
|
|
57
|
+
// kycId: user.kyc.kycId,
|
|
58
|
+
// idType,
|
|
59
|
+
// country: user.profile.country,
|
|
60
|
+
// idNo: user.username
|
|
61
|
+
// })
|
|
62
|
+
// .then((res) => {
|
|
63
|
+
// console.log(res.body)
|
|
64
|
+
// goodRet(res);
|
|
65
|
+
// });
|
|
66
|
+
// });
|
|
67
|
+
|
|
68
|
+
it("Submit whitelist transaction", function () {
|
|
69
|
+
if (KYC_FLOW_ID.MANUAL == user.kyc.flow) {
|
|
70
|
+
expect(user.kyc.status).is.a("number").to.be.oneOf([10], "KYC is not submitted");
|
|
71
|
+
this.skip();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
expect(user.kyc.status).is.a("number").to.be.oneOf([1, 18], "KYC is not approved");
|
|
75
|
+
|
|
76
|
+
return signTransaction(wallet, user.profile.country, String(user.kyc.idType), 0, user.profile.dob, { nonce: "0" }).then((tx) => {
|
|
77
|
+
return chai.request(mxwServiceUrl("/wallet/api")).post("/whitelistWallet")
|
|
78
|
+
.type("application/json")
|
|
79
|
+
.set("Authorization", "Bearer " + user.mxwJwt)
|
|
80
|
+
.send(tx).then((res) => {
|
|
81
|
+
console.log(res.body)
|
|
82
|
+
goodRet(res);
|
|
83
|
+
expect(res.body).have.property("data").property("transactionHash").is.a("string").lengthOf.greaterThan(0);
|
|
84
|
+
|
|
85
|
+
if (res.body.data.ret) {
|
|
86
|
+
console.log("\x1b[33m%s", indent, "WARNING: The response is required to patch.", "\x1b[0m");
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
// console.log("\x1b[33m%s", indent, "WARNING: Special handler is required to remove.", "\x1b[0m");
|
|
90
|
+
}
|
|
91
|
+
return res.body.data.transactionHash;
|
|
92
|
+
}).then((txHash) => {
|
|
93
|
+
if (!HubService.Instance.silent) { console.log(indent, "Whitelisted:", wallet.address, "(" + txHash + ")") }
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function signTransaction(wallet: Wallet, country?: string, idType?: string, idExpiry?: number, dob?: number, overrides?: any) {
|
|
101
|
+
return auth.Kyc.create(wallet.connect(new JsonRpcProvider("https://"))).then((kyc) => {
|
|
102
|
+
let seed = utils.sha256(toUtf8Bytes(JSON.stringify(sortObject({
|
|
103
|
+
juridical: ["", ""].sort(),
|
|
104
|
+
seed: utils.getHash(utils.randomBytes(32))
|
|
105
|
+
}))));
|
|
106
|
+
|
|
107
|
+
let kycAddress = kyc.getKycAddress({
|
|
108
|
+
country,
|
|
109
|
+
idType,
|
|
110
|
+
id: wallet.address,
|
|
111
|
+
idExpiry,
|
|
112
|
+
dob,
|
|
113
|
+
seed
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
let nonce = (overrides && overrides.nonce) ? overrides.nonce : "0";
|
|
117
|
+
|
|
118
|
+
return kyc.sign(kycAddress, { nonce }).then((tx) => {
|
|
119
|
+
expect(tx).have.property("kyc").property("from").is.a("string").is.eq(wallet.address);
|
|
120
|
+
expect(tx).have.property("kyc").property("kycAddress").is.a("string").lengthOf.greaterThan(0);
|
|
121
|
+
expect(tx).have.property("kyc").property("nonce").is.a("string").is.eq(nonce);
|
|
122
|
+
expect(tx).have.property("pub_key").property("type").is.a("string").lengthOf.greaterThan(0);
|
|
123
|
+
expect(tx).have.property("pub_key").property("value").is.a("string").lengthOf.greaterThan(0);
|
|
124
|
+
expect(tx).have.property("signature").is.a("string").lengthOf.greaterThan(0);
|
|
125
|
+
|
|
126
|
+
return {
|
|
127
|
+
transaction: tx,
|
|
128
|
+
seed,
|
|
129
|
+
publicKey: wallet.publicKey
|
|
130
|
+
};
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/t-0200-start.ts
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
import { describe, it } from 'mocha';
|
|
4
|
+
import chai, { expect } from 'chai';
|
|
5
|
+
import chaihttp from 'chai-http';
|
|
6
|
+
|
|
7
|
+
import { hexlify } from 'mxw-libs-utils';
|
|
8
|
+
import { mxw, utils } from 'mxw-sdk-js';
|
|
9
|
+
|
|
10
|
+
import HubService, { User } from "./hub";
|
|
11
|
+
import { appOnboard, appReauth } from "./individual-onboard-app";
|
|
12
|
+
import { webOnboard, changePassword, webReauth } from "./individual-onboard-web";
|
|
13
|
+
import { profile, mainProfile } from "./individual-profile";
|
|
14
|
+
import { kycByType, KYC_FLOW_ID, KYC_TYPE_ID } from './individual-kyc';
|
|
15
|
+
import { whitelist } from './individual-whitelist';
|
|
16
|
+
import { createContract } from './individual-contract';
|
|
17
|
+
import { createContact } from './individual-contact';
|
|
18
|
+
|
|
19
|
+
chai.use(chaihttp);
|
|
20
|
+
|
|
21
|
+
let indent = " ";
|
|
22
|
+
|
|
23
|
+
describe('Suite: BDSS', function () {
|
|
24
|
+
it("Initialize", function () {
|
|
25
|
+
HubService.Instance.init(true);
|
|
26
|
+
if (!HubService.Instance.silent) { console.log(indent, "app id:", HubService.Instance.appId) }
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("Start", function () {
|
|
30
|
+
let infoList = [
|
|
31
|
+
{
|
|
32
|
+
code: "Ali",
|
|
33
|
+
username: "ali." + hexlify(utils.randomBytes(4)).substr(2),
|
|
34
|
+
password: utils.sha256(utils.toUtf8Bytes(hexlify(utils.randomBytes(5)).substr(2))),
|
|
35
|
+
domain: "hello-world.sh",
|
|
36
|
+
wallet: mxw.Wallet.createRandom(),
|
|
37
|
+
challenge: false,
|
|
38
|
+
firstRegisterOnWeb: false,
|
|
39
|
+
profile: {
|
|
40
|
+
language: "ms_MY",
|
|
41
|
+
gender: "M",
|
|
42
|
+
country: "MY",
|
|
43
|
+
dob: 20200101,
|
|
44
|
+
religion: "Islam",
|
|
45
|
+
address: {
|
|
46
|
+
value: "",
|
|
47
|
+
street: "1, Jalan " + hexlify(utils.randomBytes(1)).substr(2) + "/" + hexlify(utils.randomBytes(1)).substr(2) + ", Taman " + hexlify(utils.randomBytes(4)).substr(2),
|
|
48
|
+
postcode: "43000",
|
|
49
|
+
city: "Petaling Jaya",
|
|
50
|
+
state: "Selangor",
|
|
51
|
+
province: "",
|
|
52
|
+
country: "Malaysia"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
kyc: {
|
|
56
|
+
idType: KYC_TYPE_ID.NATIONAL_ID,
|
|
57
|
+
flow: KYC_FLOW_ID.AUTO,
|
|
58
|
+
ocrAlter: false
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
code: "AhKao",
|
|
63
|
+
username: "ahkao." + hexlify(utils.randomBytes(4)).substr(2),
|
|
64
|
+
password: hexlify(utils.randomBytes(5)).substr(2),
|
|
65
|
+
domain: "hello-world.sh",
|
|
66
|
+
wallet: mxw.Wallet.createRandom(),
|
|
67
|
+
challenge: false,
|
|
68
|
+
firstRegisterOnWeb: true,
|
|
69
|
+
profile: {
|
|
70
|
+
language: "en_MY",
|
|
71
|
+
gender: "M",
|
|
72
|
+
country: "MY",
|
|
73
|
+
dob: 20200102,
|
|
74
|
+
religion: "Non-Islam",
|
|
75
|
+
address: {
|
|
76
|
+
value: "",
|
|
77
|
+
street: "2, Jalan " + hexlify(utils.randomBytes(1)).substr(2) + "/" + hexlify(utils.randomBytes(1)).substr(2) + ", Taman " + hexlify(utils.randomBytes(4)).substr(2),
|
|
78
|
+
postcode: "57000",
|
|
79
|
+
city: "Kuala Lumpur",
|
|
80
|
+
state: "Kuala Lumpur",
|
|
81
|
+
province: "",
|
|
82
|
+
country: "Malaysia"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
kyc: {
|
|
86
|
+
idType: KYC_TYPE_ID.NATIONAL_ID,
|
|
87
|
+
flow: KYC_FLOW_ID.MANUAL,
|
|
88
|
+
ocrAlter: false
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
code: "Muthu",
|
|
93
|
+
username: "muthu." + hexlify(utils.randomBytes(4)).substr(2),
|
|
94
|
+
password: hexlify(utils.randomBytes(5)).substr(2),
|
|
95
|
+
domain: "hello-world.sh",
|
|
96
|
+
wallet: mxw.Wallet.createRandom(),
|
|
97
|
+
challenge: false,
|
|
98
|
+
firstRegisterOnWeb: false,
|
|
99
|
+
profile: {
|
|
100
|
+
language: "ms_MY",
|
|
101
|
+
gender: "M",
|
|
102
|
+
country: "MY",
|
|
103
|
+
dob: 20200103,
|
|
104
|
+
religion: "Non-Islam",
|
|
105
|
+
address: {
|
|
106
|
+
value: "",
|
|
107
|
+
street: "3, Jalan " + hexlify(utils.randomBytes(1)).substr(2) + "/" + hexlify(utils.randomBytes(1)).substr(2) + ", Taman " + hexlify(utils.randomBytes(4)).substr(2),
|
|
108
|
+
postcode: "57000",
|
|
109
|
+
city: "Kuala Lumpur",
|
|
110
|
+
state: "Kuala Lumpur",
|
|
111
|
+
province: "",
|
|
112
|
+
country: "Malaysia"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
kyc: {
|
|
116
|
+
idType: KYC_TYPE_ID.NATIONAL_ID,
|
|
117
|
+
flow: KYC_FLOW_ID.AUTO,
|
|
118
|
+
ocrAlter: true
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
];
|
|
122
|
+
|
|
123
|
+
for (let info of infoList) {
|
|
124
|
+
let user = new User(info.code);
|
|
125
|
+
|
|
126
|
+
user.username = info.username;
|
|
127
|
+
user.password = info.password;
|
|
128
|
+
user.domain = info.domain;
|
|
129
|
+
user.wallet = info.wallet;
|
|
130
|
+
user.loginWallet = mxw.Wallet.fromMnemonic(user.wallet.mnemonic, "m/44'/118'/0'/0/30000");
|
|
131
|
+
user.profile = info.profile;
|
|
132
|
+
user.profile.address.value = user.profile.address.street + " " + user.profile.address.city + " " +
|
|
133
|
+
user.profile.address.postcode + " " + user.profile.address.state + " " + user.profile.address.country
|
|
134
|
+
user.kyc = info.kyc;
|
|
135
|
+
|
|
136
|
+
HubService.Instance.users[user.code] = user;
|
|
137
|
+
|
|
138
|
+
if (info.firstRegisterOnWeb) {
|
|
139
|
+
webOnboard(user, info.challenge);
|
|
140
|
+
appOnboard(user, info.challenge);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
appOnboard(user, info.challenge);
|
|
144
|
+
webOnboard(user, info.challenge);
|
|
145
|
+
}
|
|
146
|
+
// changePassword(user, info.challenge);
|
|
147
|
+
// mainProfile(user, info.challenge);
|
|
148
|
+
// profile(user, info.challenge);
|
|
149
|
+
kycByType(user, info.kyc.idType, info.kyc.flow, info.challenge);
|
|
150
|
+
|
|
151
|
+
// webReauth(user, info.challenge);
|
|
152
|
+
// appReauth(user, info.challenge);
|
|
153
|
+
|
|
154
|
+
whitelist(user, info.kyc.idType, user.wallet, info.challenge);
|
|
155
|
+
// whitelist(user, info.kyc.idType, user.loginWallet, info.challenge);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
for (let i = 0; infoList.length > i; i++) {
|
|
159
|
+
let info = infoList[i];
|
|
160
|
+
let user = HubService.Instance.users[info.code];
|
|
161
|
+
let others: User[] = [];
|
|
162
|
+
|
|
163
|
+
for (let a = 0; infoList.length > a; a++) {
|
|
164
|
+
if (a == i) continue;
|
|
165
|
+
others.push(HubService.Instance.users[infoList[a].code]);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
createContact(user, user, false);
|
|
169
|
+
// createContract(user, user.wallet, others, false);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
enabled: false
|
|
2
|
+
kind: Pod
|
|
3
|
+
|
|
4
|
+
annotations:
|
|
5
|
+
"helm.sh/hook-weight": "10"
|
|
6
|
+
"helm.sh/hook": test-success
|
|
7
|
+
|
|
8
|
+
image:
|
|
9
|
+
repository: registry-intl.cn-hongkong.aliyuncs.com/d_mxw/cm-e2e-test-js
|
|
10
|
+
tag: "1.0.9"
|
|
11
|
+
pullPolicy: IfNotPresent
|
|
12
|
+
|
|
13
|
+
restartPolicy: Never
|
|
14
|
+
|
|
15
|
+
script:
|
|
16
|
+
- make --no-print-directory -f/apps/script/Makefile start
|
|
17
|
+
|
|
18
|
+
env:
|
|
19
|
+
RELEASE_NAME: "{{Release.Name}}"
|
|
20
|
+
CLUSTER_NAMESPACE: "{{CLUSTER_NAMESPACE}}"
|
|
21
|
+
CLUSTER_DOMAIN: "{{CLUSTER_DOMAIN}}"
|
|
22
|
+
CLUSTER_SERVICE_BASE_DOMAIN: "{{CLUSTER_NAMESPACE}}.svc.{{CLUSTER_DOMAIN}}"
|
|
23
|
+
EMAIL_SERVER_DOMAIN: ""
|
|
24
|
+
EMAIL_SERVER_URL: ""
|
|
25
|
+
SERVICE_BASE_INGRESS: ""
|
|
26
|
+
SERVICE_BASE_SCHEMA: "{{SERVICE_BASE_SCHEMA}}"
|
|
27
|
+
SERVICE_BASE_DOMAIN: "{{SERVICE_BASE_DOMAIN}}"
|
|
28
|
+
SERVICE_BASE_NAME: "{{SERVICE_BASE_NAME}}"
|
|
29
|
+
SERVICE_DOMAIN: "{{SERVICE_DOMAIN}}"
|
|
30
|
+
MXW_V1_SERVICE_BASE_SCHEMA: ""
|
|
31
|
+
MXW_V1_SERVICE_BASE_DOMAIN: ""
|
|
32
|
+
MXW_V1_SERVICE_BASE_NAME: ""
|
|
33
|
+
MXW_V1_SERVICE_DOMAIN: ""
|
|
34
|
+
MXW_SERVICE_BASE_SCHEMA: "{{MXW_SERVICE_BASE_SCHEMA}}"
|
|
35
|
+
MXW_SERVICE_BASE_DOMAIN: "{{MXW_SERVICE_BASE_DOMAIN}}"
|
|
36
|
+
MXW_SERVICE_BASE_NAME: "{{MXW_SERVICE_BASE_NAME}}"
|
|
37
|
+
MXW_SERVICE_DOMAIN: "{{MXW_SERVICE_DOMAIN}}"
|
|
38
|
+
|
|
39
|
+
configFiles:
|
|
40
|
+
- name: script
|
|
41
|
+
files:
|
|
42
|
+
- "script/*"
|
|
43
|
+
- name: tests
|
|
44
|
+
files:
|
|
45
|
+
- "tests/*"
|
|
46
|
+
|
|
47
|
+
volumeMounts:
|
|
48
|
+
- name: script-volume
|
|
49
|
+
mountPath: /apps/script
|
|
50
|
+
- name: tests-volume
|
|
51
|
+
mountPath: /apps/tests
|
|
52
|
+
|
|
53
|
+
volumes:
|
|
54
|
+
- name: script-volume
|
|
55
|
+
configMap:
|
|
56
|
+
name: "{{Release.Name}}-{{Chart.Name}}-script"
|
|
57
|
+
- name: tests-volume
|
|
58
|
+
configMap:
|
|
59
|
+
name: "{{Release.Name}}-{{Chart.Name}}-tests"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{{- define "root.cluster-role-binding" -}}
|
|
2
|
+
{{- if and .Values.enabled .Values.ClusterRoleBinding -}}
|
|
3
|
+
{{- if semverCompare ">=1.22-0" .Capabilities.KubeVersion.GitVersion -}}
|
|
4
|
+
apiVersion: rbac.authorization.k8s.io/v1
|
|
5
|
+
{{- else -}}
|
|
6
|
+
apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
7
|
+
{{- end }}
|
|
8
|
+
kind: ClusterRoleBinding
|
|
9
|
+
metadata:
|
|
10
|
+
name: {{ include (print $.Chart.Name ".fullname") . | quote }}
|
|
11
|
+
roleRef:
|
|
12
|
+
apiGroup: rbac.authorization.k8s.io
|
|
13
|
+
kind: ClusterRole
|
|
14
|
+
name: {{ .Values.ClusterRoleBinding.name | quote }}
|
|
15
|
+
subjects:
|
|
16
|
+
- kind: ServiceAccount
|
|
17
|
+
name: {{ include (print $.Chart.Name ".fullname") . | quote }}
|
|
18
|
+
namespace: {{ $.Release.Namespace | lower }}
|
|
19
|
+
{{- end }}
|
|
20
|
+
{{- end }}
|