From 2fb2175b8115f765c88958d74397ff84cbc08d12 Mon Sep 17 00:00:00 2001 From: Rinat Arsaev Date: Tue, 23 Oct 2018 12:31:54 +0300 Subject: [PATCH] FE-664: Add payment adjustment (#9) --- .gitignore | 3 +- Makefile | 22 +- README.md | 4 +- package-lock.json | 852 ++++++++++-------- package.json | 6 +- proxy.conf.json | 6 + src/app/app.component.css | 9 + src/app/app.component.html | 4 +- src/app/app.component.ts | 3 +- src/app/app.module.ts | 4 +- src/app/claim/claim.module.ts | 4 +- src/app/claim/claim.service.ts | 2 +- .../create-modification.component.ts | 5 +- .../add-terminal-decision.ts | 2 +- .../create-shop-terminal.ts | 3 +- .../create-terminal-object.ts | 2 +- .../create-terminal-params.ts | 0 src/app/claim/domain-typed-manager/index.ts | 2 + .../domain-typed-manager/utils.ts | 0 .../model/modification-unit-container.ts | 2 +- src/app/claim/model/persistent-container.ts | 2 +- .../party-modification-group-converter.ts | 2 +- src/app/claim/persistent-container.service.ts | 2 +- .../form-default-values/get-options.ts | 4 +- .../get-riet-template-options.ts | 2 +- .../get-tcs-template-options.ts | 2 +- .../get-vtb-template-options.ts | 2 +- .../terminal-object.component.ts | 2 +- .../terminal-object.service.ts | 2 +- .../claims-table/claims-table.component.html | 2 +- src/app/claims/claims.component.html | 4 +- src/app/damsel/domain/cash-flow-account.ts | 11 + src/app/damsel/domain/cash.ts | 6 + .../domain/external-cash-flow-account.ts | 4 + .../damsel/domain/final-cash-flow-account.ts | 6 + .../damsel/domain/final-cash-flow-posting.ts | 9 + src/app/damsel/domain/index.ts | 2 + .../invoice-payment-adjustment-status.ts | 5 + .../domain/invoice-payment-adjustment.ts | 12 + .../damsel/domain/invoice-payment-status.ts | 10 + .../domain/merchant-cash-flow-account.ts | 5 + src/app/damsel/domain/operation-failure.ts | 10 + .../domain/provider-cash-flow-account.ts | 3 + src/app/damsel/domain/sub-failure.ts | 4 + .../damsel/domain/system-cash-flow-account.ts | 3 + src/app/damsel/index.ts | 1 - .../contract-adjustment-modification-unit.ts | 6 - .../contract-adjustment-modification.ts | 5 - .../contract-adjustment-params.ts | 5 - .../contract-modification-unit.ts | 6 - .../contract-modification.ts | 19 - .../payment-processing/contract-params.ts | 15 - .../contract-termination.ts | 3 - .../contractor-modification-unit.ts | 7 - .../contractor-modification.ts | 5 - src/app/damsel/payment-processing/index.ts | 20 - .../payment-processing/party-modification.ts | 9 - .../payout-tool-modification-unit.ts | 7 - .../payout-tool-modification.ts | 7 - .../payment-processing/payout-tool-params.ts | 7 - .../payment-processing/proxy-modification.ts | 6 - .../schedule-modification.ts | 5 - .../payment-processing/shop-account-params.ts | 5 - .../shop-contract-modification.ts | 7 - .../shop-modification-unit.ts | 6 - .../payment-processing/shop-modification.ts | 23 - .../damsel/payment-processing/shop-params.ts | 13 - src/app/domain/dmt.service.ts | 47 - src/app/domain/domain-connector.ts | 8 - src/app/domain/domain-typed-manager/index.ts | 2 - src/app/domain/domain.module.ts | 12 - src/app/papi/model/card-line.ts | 8 + src/app/papi/model/cart.ts | 5 + src/app/papi/model/currency.ts | 3 + src/app/papi/model/index.ts | 2 + src/app/papi/model/invoice.ts | 15 + src/app/papi/model/party-modification-unit.ts | 2 +- src/app/papi/model/payment.ts | 20 + src/app/papi/model/price.ts | 6 + src/app/papi/papi.module.ts | 2 + src/app/papi/params/index.ts | 1 + src/app/papi/params/report-search-params.ts | 11 + src/app/papi/report.service.ts | 36 + .../business-schedule-ref.component.ts | 2 +- .../payment-institution-ref.component.ts | 2 +- .../party-modification-creation.component.ts | 2 +- .../schedule-ref/schedule-ref.component.ts | 2 +- .../action-item/action-item.component.html | 8 + .../action-item/action-item.component.ts | 27 + .../adjustment-operations/adjustment-event.ts | 28 + .../adjustment-operation.service.ts | 43 + .../adjustment-params.ts | 22 + .../batch-payment-adjustment.service.ts | 51 ++ .../cancel-adjustment.service.ts | 59 ++ .../capture-adjustment.service.ts | 59 ++ .../create-adjustment.service.ts | 69 ++ .../adjustment-operations/error-codes.ts | 23 + .../exec-result-group.ts | 6 + .../adjustment-operations/index.ts | 8 + .../payment-adjustment-creation-scope.ts | 6 + .../cancel-actions.component.html | 36 + .../cancel-actions.component.ts | 98 ++ .../capture-actions.component.html | 28 + .../capture-actions.component.ts | 78 ++ .../create-actions.component.html | 36 + .../create-actions.component.ts | 104 +++ .../create-and-capture.component.html | 31 + .../create-and-capture.component.ts | 96 ++ .../create-and-capture/executor.service.ts | 72 ++ .../payment-adjustment-routing.module.ts | 19 + .../payment-adjustment.component.html | 49 + .../payment-adjustment.component.ts | 70 ++ .../payment-adjustment.module.ts | 82 ++ .../payment-adjustment.service.ts | 52 ++ .../search-form/search-form-params.ts | 9 + .../search-form/search-form.component.html | 34 + .../search-form/search-form.component.ts | 33 + .../search-form/search-form.service.ts | 41 + .../table/table.component.css | 3 + .../table/table.component.html | 43 + .../table/table.component.ts | 59 ++ .../payouts-table.component.html | 2 +- src/app/payouts/payouts.component.html | 4 +- src/app/query-dsl/index.ts | 1 + src/app/query-dsl/model-params.ts | 7 + src/app/query-dsl/params.ts | 9 + src/app/query-dsl/payment.ts | 17 + src/app/query-dsl/query-dsl.ts | 9 + src/app/shared/papi-formatter.ts | 30 + src/app/shared/pipes/format-amount.pipe.ts | 4 +- src/app/shared/shared.module.ts | 3 + src/app/shared/thrift-int64.pipe.ts | 36 + src/app/shared/thrift-js-formatter.ts | 30 + src/app/shared/type-helpers/diff.ts | 1 + src/app/shared/type-helpers/index.ts | 2 + src/app/shared/type-helpers/omit.ts | 3 + .../converters}/index.ts | 1 + .../converters}/to-gen-commit.ts | 14 +- .../converters}/to-gen-domain-object.ts | 5 +- .../converters/to-gen-payment-adjustment.ts | 9 + .../converters}/to-gen-reference.ts | 6 +- .../converters}/to-gen-terminal-decision.ts | 18 +- .../converters}/to-gen-terminal-object.ts | 10 +- .../domain-typed-manager.ts | 16 +- src/app/thrift/domain.service.ts | 20 + src/app/thrift/merchant-statistics.service.ts | 19 + .../payment-processing-typed-manager.ts | 31 + src/app/thrift/payment-processing.service.ts | 22 + src/app/thrift/thrift-service.ts | 39 + src/app/thrift/thrift.module.ts | 19 + src/styles.css | 7 + 151 files changed, 2580 insertions(+), 722 deletions(-) rename src/app/{domain => claim}/domain-typed-manager/add-terminal-decision.ts (96%) rename src/app/{domain => claim}/domain-typed-manager/create-shop-terminal.ts (90%) rename src/app/{domain => claim}/domain-typed-manager/create-terminal-object.ts (91%) rename src/app/{domain => claim}/domain-typed-manager/create-terminal-params.ts (100%) create mode 100644 src/app/claim/domain-typed-manager/index.ts rename src/app/{domain => claim}/domain-typed-manager/utils.ts (100%) create mode 100644 src/app/damsel/domain/cash-flow-account.ts create mode 100644 src/app/damsel/domain/cash.ts create mode 100644 src/app/damsel/domain/external-cash-flow-account.ts create mode 100644 src/app/damsel/domain/final-cash-flow-account.ts create mode 100644 src/app/damsel/domain/final-cash-flow-posting.ts create mode 100644 src/app/damsel/domain/invoice-payment-adjustment-status.ts create mode 100644 src/app/damsel/domain/invoice-payment-adjustment.ts create mode 100644 src/app/damsel/domain/invoice-payment-status.ts create mode 100644 src/app/damsel/domain/merchant-cash-flow-account.ts create mode 100644 src/app/damsel/domain/operation-failure.ts create mode 100644 src/app/damsel/domain/provider-cash-flow-account.ts create mode 100644 src/app/damsel/domain/sub-failure.ts create mode 100644 src/app/damsel/domain/system-cash-flow-account.ts delete mode 100644 src/app/damsel/payment-processing/contract-adjustment-modification-unit.ts delete mode 100644 src/app/damsel/payment-processing/contract-adjustment-modification.ts delete mode 100644 src/app/damsel/payment-processing/contract-adjustment-params.ts delete mode 100644 src/app/damsel/payment-processing/contract-modification-unit.ts delete mode 100644 src/app/damsel/payment-processing/contract-modification.ts delete mode 100644 src/app/damsel/payment-processing/contract-params.ts delete mode 100644 src/app/damsel/payment-processing/contract-termination.ts delete mode 100644 src/app/damsel/payment-processing/contractor-modification-unit.ts delete mode 100644 src/app/damsel/payment-processing/contractor-modification.ts delete mode 100644 src/app/damsel/payment-processing/index.ts delete mode 100644 src/app/damsel/payment-processing/party-modification.ts delete mode 100644 src/app/damsel/payment-processing/payout-tool-modification-unit.ts delete mode 100644 src/app/damsel/payment-processing/payout-tool-modification.ts delete mode 100644 src/app/damsel/payment-processing/payout-tool-params.ts delete mode 100644 src/app/damsel/payment-processing/proxy-modification.ts delete mode 100644 src/app/damsel/payment-processing/schedule-modification.ts delete mode 100644 src/app/damsel/payment-processing/shop-account-params.ts delete mode 100644 src/app/damsel/payment-processing/shop-contract-modification.ts delete mode 100644 src/app/damsel/payment-processing/shop-modification-unit.ts delete mode 100644 src/app/damsel/payment-processing/shop-modification.ts delete mode 100644 src/app/damsel/payment-processing/shop-params.ts delete mode 100644 src/app/domain/dmt.service.ts delete mode 100644 src/app/domain/domain-connector.ts delete mode 100644 src/app/domain/domain-typed-manager/index.ts delete mode 100644 src/app/domain/domain.module.ts create mode 100644 src/app/papi/model/card-line.ts create mode 100644 src/app/papi/model/cart.ts create mode 100644 src/app/papi/model/currency.ts create mode 100644 src/app/papi/model/invoice.ts create mode 100644 src/app/papi/model/payment.ts create mode 100644 src/app/papi/model/price.ts create mode 100644 src/app/papi/params/report-search-params.ts create mode 100644 src/app/papi/report.service.ts create mode 100644 src/app/payment-adjustment/create-and-capture/action-item/action-item.component.html create mode 100644 src/app/payment-adjustment/create-and-capture/action-item/action-item.component.ts create mode 100644 src/app/payment-adjustment/create-and-capture/adjustment-operations/adjustment-event.ts create mode 100644 src/app/payment-adjustment/create-and-capture/adjustment-operations/adjustment-operation.service.ts create mode 100644 src/app/payment-adjustment/create-and-capture/adjustment-operations/adjustment-params.ts create mode 100644 src/app/payment-adjustment/create-and-capture/adjustment-operations/batch-payment-adjustment.service.ts create mode 100644 src/app/payment-adjustment/create-and-capture/adjustment-operations/cancel-adjustment.service.ts create mode 100644 src/app/payment-adjustment/create-and-capture/adjustment-operations/capture-adjustment.service.ts create mode 100644 src/app/payment-adjustment/create-and-capture/adjustment-operations/create-adjustment.service.ts create mode 100644 src/app/payment-adjustment/create-and-capture/adjustment-operations/error-codes.ts create mode 100644 src/app/payment-adjustment/create-and-capture/adjustment-operations/exec-result-group.ts create mode 100644 src/app/payment-adjustment/create-and-capture/adjustment-operations/index.ts create mode 100644 src/app/payment-adjustment/create-and-capture/adjustment-operations/payment-adjustment-creation-scope.ts create mode 100644 src/app/payment-adjustment/create-and-capture/cancel-actions/cancel-actions.component.html create mode 100644 src/app/payment-adjustment/create-and-capture/cancel-actions/cancel-actions.component.ts create mode 100644 src/app/payment-adjustment/create-and-capture/capture-actions/capture-actions.component.html create mode 100644 src/app/payment-adjustment/create-and-capture/capture-actions/capture-actions.component.ts create mode 100644 src/app/payment-adjustment/create-and-capture/create-actions/create-actions.component.html create mode 100644 src/app/payment-adjustment/create-and-capture/create-actions/create-actions.component.ts create mode 100644 src/app/payment-adjustment/create-and-capture/create-and-capture.component.html create mode 100644 src/app/payment-adjustment/create-and-capture/create-and-capture.component.ts create mode 100644 src/app/payment-adjustment/create-and-capture/executor.service.ts create mode 100644 src/app/payment-adjustment/payment-adjustment-routing.module.ts create mode 100644 src/app/payment-adjustment/payment-adjustment.component.html create mode 100644 src/app/payment-adjustment/payment-adjustment.component.ts create mode 100644 src/app/payment-adjustment/payment-adjustment.module.ts create mode 100644 src/app/payment-adjustment/payment-adjustment.service.ts create mode 100644 src/app/payment-adjustment/search-form/search-form-params.ts create mode 100644 src/app/payment-adjustment/search-form/search-form.component.html create mode 100644 src/app/payment-adjustment/search-form/search-form.component.ts create mode 100644 src/app/payment-adjustment/search-form/search-form.service.ts create mode 100644 src/app/payment-adjustment/table/table.component.css create mode 100644 src/app/payment-adjustment/table/table.component.html create mode 100644 src/app/payment-adjustment/table/table.component.ts create mode 100644 src/app/query-dsl/index.ts create mode 100644 src/app/query-dsl/model-params.ts create mode 100644 src/app/query-dsl/params.ts create mode 100644 src/app/query-dsl/payment.ts create mode 100644 src/app/query-dsl/query-dsl.ts create mode 100644 src/app/shared/papi-formatter.ts create mode 100644 src/app/shared/thrift-int64.pipe.ts create mode 100644 src/app/shared/thrift-js-formatter.ts create mode 100644 src/app/shared/type-helpers/diff.ts create mode 100644 src/app/shared/type-helpers/index.ts create mode 100644 src/app/shared/type-helpers/omit.ts rename src/app/{domain/domain-typed-manager/gen-conversion => thrift/converters}/index.ts (81%) rename src/app/{domain/domain-typed-manager/gen-conversion => thrift/converters}/to-gen-commit.ts (63%) rename src/app/{domain/domain-typed-manager/gen-conversion => thrift/converters}/to-gen-domain-object.ts (58%) create mode 100644 src/app/thrift/converters/to-gen-payment-adjustment.ts rename src/app/{domain/domain-typed-manager/gen-conversion => thrift/converters}/to-gen-reference.ts (80%) rename src/app/{domain/domain-typed-manager/gen-conversion => thrift/converters}/to-gen-terminal-decision.ts (75%) rename src/app/{domain/domain-typed-manager/gen-conversion => thrift/converters}/to-gen-terminal-object.ts (62%) rename src/app/{domain/domain-typed-manager => thrift}/domain-typed-manager.ts (87%) create mode 100644 src/app/thrift/domain.service.ts create mode 100644 src/app/thrift/merchant-statistics.service.ts create mode 100644 src/app/thrift/payment-processing-typed-manager.ts create mode 100644 src/app/thrift/payment-processing.service.ts create mode 100644 src/app/thrift/thrift-service.ts create mode 100644 src/app/thrift/thrift.module.ts diff --git a/.gitignore b/.gitignore index b6622348..8354c649 100644 --- a/.gitignore +++ b/.gitignore @@ -38,4 +38,5 @@ testem.log .DS_Store Thumbs.db /src/assets/gen-json/ -/src/app/domain/gen-nodejs/ +/src/app/thrift/gen-nodejs/ +/src/app/gen-damsel/ \ No newline at end of file diff --git a/Makefile b/Makefile index bd0d4f09..fbc51d4d 100644 --- a/Makefile +++ b/Makefile @@ -38,18 +38,28 @@ submodules: $(SUBTARGETS) init: npm install -build: lint src/gen-nodejs src/gen-json +build: lint compile-thrift npm run build clean: - rm -rf dist src/app/domain/gen-* src/assets/gen-* + rm -rf dist src/app/thrift/gen-* src/assets/gen-* src/app/gen-damsel -# utils -src/gen-nodejs: node_modules/damsel/proto/domain_config.thrift - thrift -r -gen js:node,runtime_package=woody_js/src/client/gen -o ./src/app/domain ./node_modules/damsel/proto/domain_config.thrift +compile-thrift: thrift-to-js/domain-config thrift-to-json/domain-config thrift-to-js/payment-processing thrift-to-js/merch-stat thrift-to-ts -src/gen-json: node_modules/damsel/proto/domain_config.thrift +thrift-to-js/domain-config: + thrift -r -gen js:node,runtime_package=woody_js/src/client/gen -o ./src/app/thrift ./node_modules/damsel/proto/domain_config.thrift + +thrift-to-json/domain-config: thrift -r -gen json -o ./src/assets ./node_modules/damsel/proto/domain_config.thrift +thrift-to-js/payment-processing: + thrift -r -gen js:node,runtime_package=woody_js/dist/thrift -o ./src/app/thrift ./node_modules/damsel/proto/payment_processing.thrift + +thrift-to-js/merch-stat: + thrift -r -gen js:node,runtime_package=woody_js/dist/thrift -o ./src/app/thrift ./node_modules/damsel/proto/merch_stat.thrift + +thrift-to-ts: + npm run thrift-ts + lint: npm run lint diff --git a/README.md b/README.md index e35559ed..21bb290d 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,4 @@ make wc_shell - thrift -r -gen js:node,runtime_package=woody_js/dist/thrift -o ./src/app/domain ./node_modules/damsel/proto/domain_config.thrift - - thrift -r -gen json -o ./src/assets ./node_modules/damsel/proto/domain_config.thrift + make compile-thrift \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 48c2ba32..115d9613 100644 --- a/package-lock.json +++ b/package-lock.json @@ -350,22 +350,6 @@ "tslib": "^1.7.1" } }, - "@angular/flex-layout": { - "version": "6.0.0-beta.17", - "resolved": "https://registry.npmjs.org/@angular/flex-layout/-/flex-layout-6.0.0-beta.17.tgz", - "integrity": "sha512-WrCWlE7NuvvxbeO8+S6aR5cvzX+1CVzpIy0izP8kMLWjAPZ0xjePHc2kJKJVapWMt7aniYZ1inl+GpsvkllycA==", - "requires": { - "tslib": "1.9.3" - } - }, - "@angular/flex-layout": { - "version": "6.0.0-beta.17", - "resolved": "https://registry.npmjs.org/@angular/flex-layout/-/flex-layout-6.0.0-beta.17.tgz", - "integrity": "sha512-WrCWlE7NuvvxbeO8+S6aR5cvzX+1CVzpIy0izP8kMLWjAPZ0xjePHc2kJKJVapWMt7aniYZ1inl+GpsvkllycA==", - "requires": { - "tslib": "1.9.3" - } - }, "@angular/forms": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/@angular/forms/-/forms-6.1.0.tgz", @@ -497,36 +481,6 @@ "@types/lodash": "*" } }, - "@types/lodash": { - "version": "4.14.116", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.116.tgz", - "integrity": "sha512-lRnAtKnxMXcYYXqOiotTmJd74uawNWuPnsnPrrO7HiFuE3npE2iQhfABatbYDyxTNqZNuXzcKGhw37R7RjBFLg==", - "dev": true - }, - "@types/lodash-es": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/@types/lodash-es/-/lodash-es-4.17.1.tgz", - "integrity": "sha512-3EDZjphPfdjnsWvY11ufYImFMPyQJwIH1eFYRgWQsjOctce06fmNgVf5sfvXBRiaS1o0X50bAln1lfWs8ZO3BA==", - "dev": true, - "requires": { - "@types/lodash": "4.14.116" - } - }, - "@types/lodash": { - "version": "4.14.116", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.116.tgz", - "integrity": "sha512-lRnAtKnxMXcYYXqOiotTmJd74uawNWuPnsnPrrO7HiFuE3npE2iQhfABatbYDyxTNqZNuXzcKGhw37R7RjBFLg==", - "dev": true - }, - "@types/lodash-es": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/@types/lodash-es/-/lodash-es-4.17.1.tgz", - "integrity": "sha512-3EDZjphPfdjnsWvY11ufYImFMPyQJwIH1eFYRgWQsjOctce06fmNgVf5sfvXBRiaS1o0X50bAln1lfWs8ZO3BA==", - "dev": true, - "requires": { - "@types/lodash": "4.14.116" - } - }, "@types/node": { "version": "8.9.5", "resolved": "https://registry.npmjs.org/@types/node/-/node-8.9.5.tgz", @@ -633,12 +587,17 @@ }, "dependencies": { "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", "requires": { - "ms": "2.0.0" + "ms": "^2.1.1" } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" } } }, @@ -1403,7 +1362,7 @@ }, "babel-loader": { "version": "7.1.4", - "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-7.1.4.tgz", + "resolved": "http://registry.npmjs.org/babel-loader/-/babel-loader-7.1.4.tgz", "integrity": "sha512-/hbyEvPzBJuGpk9o80R0ZyTej6heEOr59GoEUtn8qFKbnx4cJm9FWES6J/iv644sYgrtVw9JJQkjaLW/bqb5gw==", "requires": { "find-cache-dir": "^1.0.0", @@ -1429,12 +1388,12 @@ }, "babel-plugin-syntax-async-functions": { "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", + "resolved": "http://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=" }, "babel-plugin-syntax-exponentiation-operator": { "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", + "resolved": "http://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=" }, "babel-plugin-syntax-trailing-function-commas": { @@ -2027,15 +1986,6 @@ "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", "dev": true }, - "boom": { - "version": "2.10.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", - "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", - "dev": true, - "requires": { - "hoek": "2.x.x" - } - }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -2319,9 +2269,9 @@ } }, "chardet": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.5.0.tgz", - "integrity": "sha512-9ZTaoBaePSCFvNlNGrsyI8ZVACP2svUtq0DkM7t4K2ClAa96sqOIRjAzDTc8zXzFt1cZR46rRzLTiHFSJ+Qw0g==" + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==" }, "chokidar": { "version": "2.0.4", @@ -2798,16 +2748,6 @@ "which": "^1.2.9" } }, - "cryptiles": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", - "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", - "dev": true, - "optional": true, - "requires": { - "boom": "2.x.x" - } - }, "crypto-browserify": { "version": "3.12.0", "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", @@ -2912,8 +2852,8 @@ } }, "damsel": { - "version": "git+ssh://git@github.com/rbkmoney/damsel.git#1510cd7caa1e4338429a3a0783289d36e140472a", - "from": "damsel@git+ssh://git@github.com/rbkmoney/damsel.git#1510cd7caa1e4338429a3a0783289d36e140472a" + "version": "git+ssh://git@github.com/rbkmoney/damsel.git#78492cc9d2329ef68c2eeeb43d62f5230a33c630", + "from": "git+ssh://git@github.com/rbkmoney/damsel.git#78492cc9d2329ef68c2eeeb43d62f5230a33c630" }, "dashdash": { "version": "1.14.1", @@ -3647,6 +3587,7 @@ "version": "0.7.0", "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true, "requires": { "cross-spawn": "^5.0.1", "get-stream": "^3.0.0", @@ -3661,6 +3602,7 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, "requires": { "lru-cache": "^4.0.1", "shebang-command": "^1.2.0", @@ -3892,19 +3834,19 @@ } }, "external-editor": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.1.tgz", - "integrity": "sha512-e1neqvSt5pSwQcFnYc6yfGuJD2Q4336cdbHs5VeUO0zTkqPbrHMyw2q1r47fpfLWbvIG8H8A6YO3sck7upTV6Q==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.3.tgz", + "integrity": "sha512-bn71H9+qWoOQKyZDo25mOMVpSmXROAsTJVVVYzrrtol3d4y+AsKjf4Iwl2Q+IuT0kFSQ1qo166UuIwqYq7mGnA==", "requires": { - "chardet": "^0.5.0", - "iconv-lite": "^0.4.22", + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", "tmp": "^0.0.33" }, "dependencies": { "iconv-lite": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", - "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "requires": { "safer-buffer": ">= 2.1.2 < 3" } @@ -4240,21 +4182,25 @@ "dependencies": { "abbrev": { "version": "1.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "optional": true }, "ansi-regex": { "version": "2.1.1", - "bundled": true + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" }, "aproba": { "version": "1.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", "optional": true }, "are-we-there-yet": { "version": "1.1.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz", + "integrity": "sha1-u13KOCu5TwXhUZQ3PRb9O6HKEQ0=", "optional": true, "requires": { "delegates": "^1.0.0", @@ -4263,11 +4209,13 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, "brace-expansion": { "version": "1.1.11", - "bundled": true, + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -4275,29 +4223,35 @@ }, "chownr": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.0.1.tgz", + "integrity": "sha1-4qdQQqlVGQi+vSW4Uj1fl2nXkYE=", "optional": true }, "code-point-at": { "version": "1.1.0", - "bundled": true + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" }, "concat-map": { "version": "0.0.1", - "bundled": true + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" }, "core-util-is": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "optional": true }, "debug": { "version": "2.6.9", - "bundled": true, + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "optional": true, "requires": { "ms": "2.0.0" @@ -4305,22 +4259,26 @@ }, "deep-extend": { "version": "0.5.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.5.1.tgz", + "integrity": "sha512-N8vBdOa+DF7zkRrDCsaOXoCs/E2fJfx9B9MrKnnSiHNh4ws7eSys6YQE4KvT1cecKmOASYQBhbKjeuDD9lT81w==", "optional": true }, "delegates": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", "optional": true }, "detect-libc": { "version": "1.0.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", "optional": true }, "fs-minipass": { "version": "1.2.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.5.tgz", + "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", "optional": true, "requires": { "minipass": "^2.2.1" @@ -4328,12 +4286,14 @@ }, "fs.realpath": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "optional": true }, "gauge": { "version": "2.7.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", "optional": true, "requires": { "aproba": "^1.0.3", @@ -4348,7 +4308,8 @@ }, "glob": { "version": "7.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "optional": true, "requires": { "fs.realpath": "^1.0.0", @@ -4361,12 +4322,14 @@ }, "has-unicode": { "version": "2.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", "optional": true }, "iconv-lite": { "version": "0.4.21", - "bundled": true, + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.21.tgz", + "integrity": "sha512-En5V9za5mBt2oUA03WGD3TwDv0MKAruqsuxstbMUZaj9W9k/m1CV/9py3l0L5kw9Bln8fdHQmzHSYtvpvTLpKw==", "optional": true, "requires": { "safer-buffer": "^2.1.0" @@ -4374,7 +4337,8 @@ }, "ignore-walk": { "version": "3.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz", + "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", "optional": true, "requires": { "minimatch": "^3.0.4" @@ -4382,7 +4346,8 @@ }, "inflight": { "version": "1.0.6", - "bundled": true, + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "optional": true, "requires": { "once": "^1.3.0", @@ -4391,39 +4356,46 @@ }, "inherits": { "version": "2.0.3", - "bundled": true + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, "ini": { "version": "1.3.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "optional": true }, "is-fullwidth-code-point": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "requires": { "number-is-nan": "^1.0.0" } }, "isarray": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "optional": true }, "minimatch": { "version": "3.0.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" }, "minipass": { "version": "2.2.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.2.4.tgz", + "integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==", "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -4431,7 +4403,8 @@ }, "minizlib": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.1.0.tgz", + "integrity": "sha512-4T6Ur/GctZ27nHfpt9THOdRZNgyJ9FZchYO1ceg5S8Q3DNLCKYy44nCZzgCJgcvx2UM8czmqak5BCxJMrq37lA==", "optional": true, "requires": { "minipass": "^2.2.1" @@ -4439,19 +4412,22 @@ }, "mkdirp": { "version": "0.5.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "requires": { "minimist": "0.0.8" } }, "ms": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "optional": true }, "needle": { "version": "2.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/needle/-/needle-2.2.0.tgz", + "integrity": "sha512-eFagy6c+TYayorXw/qtAdSvaUpEbBsDwDyxYFgLZ0lTojfH7K+OdBqAF7TAFwDokJaGpubpSGG0wO3iC0XPi8w==", "optional": true, "requires": { "debug": "^2.1.2", @@ -4461,7 +4437,8 @@ }, "node-pre-gyp": { "version": "0.10.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.10.0.tgz", + "integrity": "sha512-G7kEonQLRbcA/mOoFoxvlMrw6Q6dPf92+t/l0DFSMuSlDoWaI9JWIyPwK0jyE1bph//CUEL65/Fz1m2vJbmjQQ==", "optional": true, "requires": { "detect-libc": "^1.0.2", @@ -4478,7 +4455,8 @@ }, "nopt": { "version": "4.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", + "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", "optional": true, "requires": { "abbrev": "1", @@ -4487,12 +4465,14 @@ }, "npm-bundled": { "version": "1.0.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.3.tgz", + "integrity": "sha512-ByQ3oJ/5ETLyglU2+8dBObvhfWXX8dtPZDMePCahptliFX2iIuhyEszyFk401PZUNQH20vvdW5MLjJxkwU80Ow==", "optional": true }, "npm-packlist": { "version": "1.1.10", - "bundled": true, + "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.1.10.tgz", + "integrity": "sha512-AQC0Dyhzn4EiYEfIUjCdMl0JJ61I2ER9ukf/sLxJUcZHfo+VyEfz2rMJgLZSS1v30OxPQe1cN0LZA1xbcaVfWA==", "optional": true, "requires": { "ignore-walk": "^3.0.1", @@ -4501,7 +4481,8 @@ }, "npmlog": { "version": "4.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", "optional": true, "requires": { "are-we-there-yet": "~1.1.2", @@ -4512,33 +4493,39 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" }, "object-assign": { "version": "4.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "optional": true }, "once": { "version": "1.4.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "requires": { "wrappy": "1" } }, "os-homedir": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "optional": true }, "os-tmpdir": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "optional": true }, "osenv": { "version": "0.1.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", "optional": true, "requires": { "os-homedir": "^1.0.0", @@ -4547,17 +4534,20 @@ }, "path-is-absolute": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "optional": true }, "process-nextick-args": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", "optional": true }, "rc": { "version": "1.2.7", - "bundled": true, + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.7.tgz", + "integrity": "sha512-LdLD8xD4zzLsAT5xyushXDNscEjB7+2ulnl8+r1pnESlYtlJtVSoCMBGr30eDRJ3+2Gq89jK9P9e4tCEH1+ywA==", "optional": true, "requires": { "deep-extend": "^0.5.1", @@ -4568,14 +4558,16 @@ "dependencies": { "minimist": { "version": "1.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "optional": true } } }, "readable-stream": { "version": "2.3.6", - "bundled": true, + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "optional": true, "requires": { "core-util-is": "~1.0.0", @@ -4589,7 +4581,8 @@ }, "rimraf": { "version": "2.6.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "optional": true, "requires": { "glob": "^7.0.5" @@ -4597,36 +4590,43 @@ }, "safe-buffer": { "version": "5.1.1", - "bundled": true + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" }, "safer-buffer": { "version": "2.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "optional": true }, "sax": { "version": "1.2.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", "optional": true }, "semver": { "version": "5.5.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", "optional": true }, "set-blocking": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "optional": true }, "signal-exit": { "version": "3.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "optional": true }, "string-width": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -4635,7 +4635,8 @@ }, "string_decoder": { "version": "1.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "optional": true, "requires": { "safe-buffer": "~5.1.0" @@ -4643,19 +4644,22 @@ }, "strip-ansi": { "version": "3.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "requires": { "ansi-regex": "^2.0.0" } }, "strip-json-comments": { "version": "2.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "optional": true }, "tar": { "version": "4.4.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.1.tgz", + "integrity": "sha512-O+v1r9yN4tOsvl90p5HAP4AEqbYhx4036AGMm075fH9F8Qwi3oJ+v4u50FkT/KkvywNGtwkk0zRI+8eYm1X/xg==", "optional": true, "requires": { "chownr": "^1.0.1", @@ -4669,12 +4673,14 @@ }, "util-deprecate": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "optional": true }, "wide-align": { "version": "1.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.2.tgz", + "integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==", "optional": true, "requires": { "string-width": "^1.0.2" @@ -4682,11 +4688,13 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "yallist": { "version": "3.0.2", - "bundled": true + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.2.tgz", + "integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=" } } }, @@ -5062,19 +5070,6 @@ "minimalistic-assert": "^1.0.1" } }, - "hawk": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", - "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", - "dev": true, - "optional": true, - "requires": { - "boom": "2.x.x", - "cryptiles": "2.x.x", - "hoek": "2.x.x", - "sntp": "1.x.x" - } - }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", @@ -5091,12 +5086,6 @@ "minimalistic-crypto-utils": "^1.0.1" } }, - "hoek": { - "version": "2.16.3", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", - "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", - "dev": true - }, "home-or-tmp": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", @@ -5414,9 +5403,9 @@ "dev": true }, "inquirer": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.1.0.tgz", - "integrity": "sha512-f9K2MMx/G/AVmJSaZg2a+GVLRRmTdlGLbwxsibNd6yNTxXujqxPypjCnxnC0y4+Wb/rNY5KyKuq06AO5jrE+7w==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.2.0.tgz", + "integrity": "sha512-QIEQG4YyQ2UYZGDC4srMZ7BjHOmNk1lR2JQj5UknBapklm6WHA+VVH7N+sUdX3A7NeCfGF8o4X1S3Ao7nAcIeg==", "requires": { "ansi-escapes": "^3.0.0", "chalk": "^2.0.0", @@ -5424,7 +5413,7 @@ "cli-width": "^2.0.0", "external-editor": "^3.0.0", "figures": "^2.0.0", - "lodash": "^4.3.0", + "lodash": "^4.17.10", "mute-stream": "0.0.7", "run-async": "^2.2.0", "rxjs": "^6.1.0", @@ -5487,7 +5476,8 @@ "invert-kv": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=" + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true }, "ip": { "version": "1.1.5", @@ -6103,16 +6093,6 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" }, - "json-stable-stringify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", - "dev": true, - "optional": true, - "requires": { - "jsonify": "~0.0.0" - } - }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -6130,13 +6110,6 @@ "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=" }, - "jsonify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", - "dev": true, - "optional": true - }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -6430,38 +6403,6 @@ } } }, - "keycloak-angular": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/keycloak-angular/-/keycloak-angular-3.0.2.tgz", - "integrity": "sha512-MYvedywigoUcoC9VKTWI1VVe0JYhWCOo2zeLs2NK0c2oEIgL4WDa1JLhdTMuW9FKWaPcgUf+aUoPaPD3kmn1ew==", - "requires": { - "keycloak-js": "3.4.3", - "tslib": "1.9.3" - }, - "dependencies": { - "keycloak-js": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/keycloak-js/-/keycloak-js-3.4.3.tgz", - "integrity": "sha1-n7sbp7JDMin1zIurvTCP8OlF2sc=" - } - } - }, - "keycloak-angular": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/keycloak-angular/-/keycloak-angular-3.0.2.tgz", - "integrity": "sha512-MYvedywigoUcoC9VKTWI1VVe0JYhWCOo2zeLs2NK0c2oEIgL4WDa1JLhdTMuW9FKWaPcgUf+aUoPaPD3kmn1ew==", - "requires": { - "keycloak-js": "3.4.3", - "tslib": "1.9.3" - }, - "dependencies": { - "keycloak-js": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/keycloak-js/-/keycloak-js-3.4.3.tgz", - "integrity": "sha1-n7sbp7JDMin1zIurvTCP8OlF2sc=" - } - } - }, "keycloak-js": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/keycloak-js/-/keycloak-js-3.4.0.tgz", @@ -6489,6 +6430,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true, "requires": { "invert-kv": "^1.0.0" } @@ -6618,16 +6560,6 @@ "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.10.tgz", "integrity": "sha512-iesFYPmxYYGTcmQK0sL8bX3TGHyM6b2qREaB4kamHfQyfPJP0xgoGxp19nsH16nsfquLdiyKyX3mQkfiSGV8Rg==" }, - "lodash-es": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.10.tgz", - "integrity": "sha512-iesFYPmxYYGTcmQK0sL8bX3TGHyM6b2qREaB4kamHfQyfPJP0xgoGxp19nsH16nsfquLdiyKyX3mQkfiSGV8Rg==" - }, - "lodash-es": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.10.tgz", - "integrity": "sha512-iesFYPmxYYGTcmQK0sL8bX3TGHyM6b2qREaB4kamHfQyfPJP0xgoGxp19nsH16nsfquLdiyKyX3mQkfiSGV8Rg==" - }, "lodash.assign": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", @@ -6789,6 +6721,14 @@ "resolved": "https://registry.npmjs.org/mamacro/-/mamacro-0.0.3.tgz", "integrity": "sha512-qMEwh+UujcQ+kbz3T6V+wAmO2U8veoq2w+3wY8MquqwVA3jChfwY+Tk52GZKDfACEPjuZ7r2oJLejwpt8jtwTA==" }, + "map-age-cleaner": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.2.tgz", + "integrity": "sha512-UN1dNocxQq44IhJyMI4TU8phc2m9BddacHRPRjKGLYaF0jqd3xLz0jS0skpAU9WgYyoR4gHtUpzytNBS385FWQ==", + "requires": { + "p-defer": "^1.0.0" + } + }, "map-cache": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", @@ -6833,6 +6773,7 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "dev": true, "requires": { "mimic-fn": "^1.0.0" } @@ -7141,9 +7082,9 @@ "dev": true }, "node-gyp": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.7.0.tgz", - "integrity": "sha512-qDQE/Ft9xXP6zphwx4sD0t+VhwV7yFaloMpfbL2QnnDZcyaiakWlLdtFGGQfTAwpFHdpbRhRxVhIHN1OKAjgbg==", + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.8.0.tgz", + "integrity": "sha512-3g8lYefrRRzvGeSowdJKAKyks8oUpLEd/DyPV4eMhVlhJ0aNaZqIrNUIPuEWWTAoPqyFkfGrM67MC69baqn6vA==", "dev": true, "optional": true, "requires": { @@ -7154,125 +7095,13 @@ "nopt": "2 || 3", "npmlog": "0 || 1 || 2 || 3 || 4", "osenv": "0", - "request": ">=2.9.0 <2.82.0", + "request": "^2.87.0", "rimraf": "2", "semver": "~5.3.0", "tar": "^2.0.0", "which": "1" }, "dependencies": { - "ajv": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", - "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", - "dev": true, - "optional": true, - "requires": { - "co": "^4.6.0", - "json-stable-stringify": "^1.0.1" - } - }, - "assert-plus": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", - "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", - "dev": true, - "optional": true - }, - "aws-sign2": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", - "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", - "dev": true, - "optional": true - }, - "form-data": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", - "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", - "dev": true, - "optional": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.5", - "mime-types": "^2.1.12" - } - }, - "har-schema": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", - "integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=", - "dev": true, - "optional": true - }, - "har-validator": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", - "integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=", - "dev": true, - "optional": true, - "requires": { - "ajv": "^4.9.1", - "har-schema": "^1.0.5" - } - }, - "http-signature": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", - "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", - "dev": true, - "optional": true, - "requires": { - "assert-plus": "^0.2.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "performance-now": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", - "integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=", - "dev": true, - "optional": true - }, - "qs": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", - "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=", - "dev": true, - "optional": true - }, - "request": { - "version": "2.81.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz", - "integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=", - "dev": true, - "optional": true, - "requires": { - "aws-sign2": "~0.6.0", - "aws4": "^1.2.1", - "caseless": "~0.12.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.0", - "forever-agent": "~0.6.1", - "form-data": "~2.1.1", - "har-validator": "~4.2.1", - "hawk": "~3.1.3", - "http-signature": "~1.1.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.7", - "oauth-sign": "~0.8.1", - "performance-now": "^0.2.0", - "qs": "~6.4.0", - "safe-buffer": "^5.0.1", - "stringstream": "~0.0.4", - "tough-cookie": "~2.3.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.0.0" - } - }, "semver": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", @@ -7734,11 +7563,21 @@ "os-tmpdir": "^1.0.0" } }, + "p-defer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", + "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=" + }, "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" }, + "p-is-promise": { + "version": "1.1.0", + "resolved": "http://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz", + "integrity": "sha1-nJRWmJ6fZYgBewQ01WCXZ1w9oF4=" + }, "p-limit": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", @@ -8082,6 +7921,11 @@ "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", "dev": true }, + "prettier": { + "version": "1.14.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.14.3.tgz", + "integrity": "sha512-qZDVnCrnpsRJJq5nSsiHCE3BYMED2OtsI+cmzIzF1QIfqm5ALf8tEJcO27zV1gKNKRPdhjO0dNWnrzssDQ1tFg==" + }, "pretty-error": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-2.1.1.tgz", @@ -9286,16 +9130,6 @@ } } }, - "sntp": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", - "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", - "dev": true, - "optional": true, - "requires": { - "hoek": "2.x.x" - } - }, "socket.io": { "version": "1.7.3", "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-1.7.3.tgz", @@ -9755,13 +9589,6 @@ "safe-buffer": "~5.1.0" } }, - "stringstream": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.6.tgz", - "integrity": "sha512-87GEBAkegbBcweToUrdzf3eLhWNg06FJTebl4BVJz/JgWy8CvEr9dRtX5qWphiynMSQlxxi+QqN0z5T32SLlhA==", - "dev": true, - "optional": true - }, "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", @@ -9896,6 +9723,221 @@ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "dev": true }, + "thrift-parser": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/thrift-parser/-/thrift-parser-0.4.2.tgz", + "integrity": "sha1-lHKac3nOA+AL6+Odocvze70zhjs=" + }, + "thrift-ts": { + "version": "git+ssh://git@github.com/rbkmoney/thrift-ts.git#6be548bef8b70c6cc0a66ce08ffaccb1263c982c", + "from": "git+ssh://git@github.com/rbkmoney/thrift-ts.git#6be548bef8b70c6cc0a66ce08ffaccb1263c982c", + "requires": { + "glob": "^7.1.3", + "lodash": "^4.17.11", + "prettier": "^1.14.3", + "thrift-parser": "^0.4.2", + "yargs": "^12.0.2" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=" + }, + "cliui": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", + "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" + } + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "decamelize": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-2.0.0.tgz", + "integrity": "sha512-Ikpp5scV3MSYxY39ymh45ZLEecsTdv/Xj2CaQfI8RLMuwi7XvjX9H/fhraiSuU+C5w5NTDu4ZU72xNiZnurBPg==", + "requires": { + "xregexp": "4.0.0" + } + }, + "execa": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.10.0.tgz", + "integrity": "sha512-7XOMnz8Ynx1gGo/3hyV9loYNPWM94jG3+3T3Y8tsfSstFmETmENCMU/A/zj8Lyaj1lkgEepKepvd6240tBRvlw==", + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "requires": { + "locate-path": "^3.0.0" + } + }, + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "invert-kv": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", + "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==" + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + }, + "lcid": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", + "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", + "requires": { + "invert-kv": "^2.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" + }, + "mem": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-4.0.0.tgz", + "integrity": "sha512-WQxG/5xYc3tMbYLXoXPm81ET2WDULiU5FxbuIoNbJqLOOI8zehXFdZuiUEgfdrU2mVB1pxBZUGlYORSrpuJreA==", + "requires": { + "map-age-cleaner": "^0.1.1", + "mimic-fn": "^1.0.0", + "p-is-promise": "^1.1.0" + } + }, + "os-locale": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.0.1.tgz", + "integrity": "sha512-7g5e7dmXPtzcP4bgsZ8ixDVqA7oWYuEz4lOSujeWyliPai4gfVDiFIcwBg3aGCPnmSGfzOKTK3ccPn0CKv3DBw==", + "requires": { + "execa": "^0.10.0", + "lcid": "^2.0.0", + "mem": "^4.0.0" + } + }, + "p-limit": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.0.0.tgz", + "integrity": "sha512-fl5s52lI5ahKCernzzIyAP0QAZbGIovtVHGwpcu1Jr/EpzLVDI2myISHwGqK7m8uQFugVWSrbxH7XnhGtvEc+A==", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz", + "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==" + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" + }, + "yargs": { + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.2.tgz", + "integrity": "sha512-e7SkEx6N6SIZ5c5H22RTZae61qtn3PYUE8JYbBFlK9sYmh3DMQ6E5ygtaG/2BW0JZi4WGgTR2IV5ChqlqrDGVQ==", + "requires": { + "cliui": "^4.0.0", + "decamelize": "^2.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^1.0.1", + "os-locale": "^3.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1 || ^4.0.0", + "yargs-parser": "^10.1.0" + } + }, + "yargs-parser": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", + "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", + "requires": { + "camelcase": "^4.1.0" + } + } + } + }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -10673,6 +10715,20 @@ "xregexp": "4.0.0" } }, + "execa": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.10.0.tgz", + "integrity": "sha512-7XOMnz8Ynx1gGo/3hyV9loYNPWM94jG3+3T3Y8tsfSstFmETmENCMU/A/zj8Lyaj1lkgEepKepvd6240tBRvlw==", + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, "find-up": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", @@ -10681,11 +10737,24 @@ "locate-path": "^3.0.0" } }, + "invert-kv": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", + "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==" + }, "is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" }, + "lcid": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", + "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", + "requires": { + "invert-kv": "^2.0.0" + } + }, "locate-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", @@ -10695,14 +10764,24 @@ "path-exists": "^3.0.0" } }, - "os-locale": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", - "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "mem": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-4.0.0.tgz", + "integrity": "sha512-WQxG/5xYc3tMbYLXoXPm81ET2WDULiU5FxbuIoNbJqLOOI8zehXFdZuiUEgfdrU2mVB1pxBZUGlYORSrpuJreA==", "requires": { - "execa": "^0.7.0", - "lcid": "^1.0.0", - "mem": "^1.1.0" + "map-age-cleaner": "^0.1.1", + "mimic-fn": "^1.0.0", + "p-is-promise": "^1.1.0" + } + }, + "os-locale": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.0.1.tgz", + "integrity": "sha512-7g5e7dmXPtzcP4bgsZ8ixDVqA7oWYuEz4lOSujeWyliPai4gfVDiFIcwBg3aGCPnmSGfzOKTK3ccPn0CKv3DBw==", + "requires": { + "execa": "^0.10.0", + "lcid": "^2.0.0", + "mem": "^4.0.0" } }, "p-limit": { @@ -10749,15 +10828,15 @@ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" }, "yargs": { - "version": "12.0.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.1.tgz", - "integrity": "sha512-B0vRAp1hRX4jgIOWFtjfNjd9OA9RWYZ6tqGA9/I/IrTMsxmKvtWy+ersM+jzpQqbC3YfLzeABPdeTgcJ9eu1qQ==", + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.2.tgz", + "integrity": "sha512-e7SkEx6N6SIZ5c5H22RTZae61qtn3PYUE8JYbBFlK9sYmh3DMQ6E5ygtaG/2BW0JZi4WGgTR2IV5ChqlqrDGVQ==", "requires": { "cliui": "^4.0.0", "decamelize": "^2.0.0", "find-up": "^3.0.0", "get-caller-file": "^1.0.1", - "os-locale": "^2.0.0", + "os-locale": "^3.0.0", "require-directory": "^2.1.1", "require-main-filename": "^1.0.1", "set-blocking": "^2.0.0", @@ -11088,7 +11167,7 @@ }, "woody_js": { "version": "git+ssh://git@github.com/rbkmoney/woody_js.git#dfe1ec26573de991f59952aa64b409280fec6c58", - "from": "woody_js@git+ssh://git@github.com/rbkmoney/woody_js.git#dfe1ec26573de991f59952aa64b409280fec6c58", + "from": "git+ssh://git@github.com/rbkmoney/woody_js.git#dfe1ec26573de991f59952aa64b409280fec6c58", "requires": { "babel-core": "6.26.3", "babel-loader": "7.1.4", @@ -11265,11 +11344,11 @@ } }, "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", "requires": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, "eslint-scope": { @@ -11286,6 +11365,11 @@ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=" }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + }, "q": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", @@ -11293,7 +11377,7 @@ }, "stream-http": { "version": "2.3.1", - "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.3.1.tgz", + "resolved": "http://registry.npmjs.org/stream-http/-/stream-http-2.3.1.tgz", "integrity": "sha1-fh3IcQLD4xsy5mDwTKMfI929HVI=", "requires": { "builtin-status-codes": "^2.0.0", diff --git a/package.json b/package.json index 852d4cca..100cf5d0 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "build": "ng build --prod", "test": "ng test", "lint": "ng lint", - "e2e": "ng e2e" + "e2e": "ng e2e", + "thrift-ts": "thrift-ts node_modules/damsel/proto -o src/app/gen-damsel -d false -c true" }, "private": true, "dependencies": { @@ -25,13 +26,14 @@ "@angular/router": "^6.1.0", "angular2-prettyjson": "3.0.1", "core-js": "^2.5.4", - "damsel": "git+ssh://git@github.com/rbkmoney/damsel.git#1510cd7caa1e4338429a3a0783289d36e140472a", + "damsel": "git+ssh://git@github.com/rbkmoney/damsel.git#78492cc9d2329ef68c2eeeb43d62f5230a33c630", "hammerjs": "^2.0.8", "keycloak-angular": "3.0.2", "keycloak-js": "3.4.0", "lodash-es": "^4.17.10", "moment": "^2.22.2", "rxjs": "^6.0.0", + "thrift-ts": "git+ssh://git@github.com/rbkmoney/thrift-ts.git#6be548bef8b70c6cc0a66ce08ffaccb1263c982c", "uuid": "^3.3.2", "woody_js": "git+ssh://git@github.com/rbkmoney/woody_js.git#dfe1ec26573de991f59952aa64b409280fec6c58", "zone.js": "~0.8.26" diff --git a/proxy.conf.json b/proxy.conf.json index 89af793e..0e7480e6 100644 --- a/proxy.conf.json +++ b/proxy.conf.json @@ -4,5 +4,11 @@ "secure": false, "logLevel": "debug", "changeOrigin": true + }, + "/stat": { + "target": "http://iddqd.rbk.test:8080", + "secure": false, + "logLevel": "debug", + "changeOrigin": true } } diff --git a/src/app/app.component.css b/src/app/app.component.css index 355b5625..36d45121 100644 --- a/src/app/app.component.css +++ b/src/app/app.component.css @@ -5,3 +5,12 @@ .active { background: #f5f5f5; } + +.toolbar { + position: fixed; + z-index: 2; +} + +.content { + margin-top: 64px; +} \ No newline at end of file diff --git a/src/app/app.component.html b/src/app/app.component.html index 7c9c75e9..08155d28 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,4 +1,4 @@ - + @@ -29,7 +29,7 @@ - + diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 2b9466af..796fcd8b 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -27,7 +27,8 @@ export class AppComponent implements OnInit { const menuItems = [ // {name: 'Domain config', route: '/domain', activateRole: 'dmt:checkout'}, {name: 'Payouts', route: '/payouts', activateRole: 'payout:read'}, - {name: 'Claims', route: '/claims', activateRole: 'claim:get'} + {name: 'Claims', route: '/claims', activateRole: 'claim:get'}, + {name: 'Payment adjustment', route: '/payment-adjustment', activateRole: 'adjustment:create'} ]; const roles = this.keycloakService.getUserRoles(); return menuItems.filter((item) => roles.includes(item.activateRole)); diff --git a/src/app/app.module.ts b/src/app/app.module.ts index e866f134..53333ac9 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -16,6 +16,7 @@ import { ClaimsModule } from './claims/claims.module'; import { AppRoutingModule } from './app-routing.module'; import { ClaimModule } from './claim/claim.module'; import { PayoutsModule } from './payouts/payouts.module'; +import { PaymentAdjustmentModule } from './payment-adjustment/payment-adjustment.module'; @NgModule({ declarations: [ @@ -34,7 +35,8 @@ import { PayoutsModule } from './payouts/payouts.module'; MatListModule, ClaimsModule, ClaimModule, - PayoutsModule + PayoutsModule, + PaymentAdjustmentModule ], providers: [], bootstrap: [AppComponent] diff --git a/src/app/claim/claim.module.ts b/src/app/claim/claim.module.ts index 5320fb9b..831abf91 100644 --- a/src/app/claim/claim.module.ts +++ b/src/app/claim/claim.module.ts @@ -23,7 +23,7 @@ import { import { FlexLayoutModule } from '@angular/flex-layout'; import { PapiModule } from '../papi/papi.module'; -import { DomainModule } from '../domain/domain.module'; +import { ThriftModule } from '../thrift/thrift.module'; import { ClaimRoutingModule } from './claim-routing.module'; import { ClaimComponent } from './claim.component'; import { ClaimInfoComponent } from './claim-info/claim-info.component'; @@ -46,7 +46,7 @@ import { PersistentContainerService } from './persistent-container.service'; @NgModule({ imports: [ PapiModule, - DomainModule, + ThriftModule, CommonModule, SharedModule, ReactiveFormsModule, diff --git a/src/app/claim/claim.service.ts b/src/app/claim/claim.service.ts index 7620f80a..8805c59f 100644 --- a/src/app/claim/claim.service.ts +++ b/src/app/claim/claim.service.ts @@ -6,7 +6,6 @@ import toNumber from 'lodash-es/toNumber'; import { ClaimService as ClaimPapi } from '../papi/claim.service'; import { ClaimInfo, PartyModificationUnit } from '../papi/model'; -import { PartyModification } from '../damsel'; import { ClaimInfoContainer, DomainModificationInfo, @@ -15,6 +14,7 @@ import { } from './model'; import { PersistentContainerService } from './persistent-container.service'; import { convert } from './party-modification-group-converter'; +import { PartyModification } from '../gen-damsel/payment_processing'; @Injectable() export class ClaimService { diff --git a/src/app/claim/create-modification/create-modification.component.ts b/src/app/claim/create-modification/create-modification.component.ts index df7ed940..1cbeb0e1 100644 --- a/src/app/claim/create-modification/create-modification.component.ts +++ b/src/app/claim/create-modification/create-modification.component.ts @@ -5,10 +5,11 @@ import { BehaviorSubject, Observable } from 'rxjs'; import { ActionType, ModificationAction } from '../modification-action'; import { DomainModificationInfo, ModificationGroupType } from '../model'; -import { PartyModification } from '../../damsel/payment-processing'; import { PartyTarget } from '../../party-modification-target'; import { ClaimService } from '../claim.service'; -import { CreateTerminalParams, DomainTypedManager } from '../../domain/domain-typed-manager'; +import { CreateTerminalParams } from '../domain-typed-manager'; +import { DomainTypedManager } from '../../thrift/domain-typed-manager'; +import { PartyModification } from '../../gen-damsel/payment_processing'; @Component({ templateUrl: 'create-modification.component.html' diff --git a/src/app/domain/domain-typed-manager/add-terminal-decision.ts b/src/app/claim/domain-typed-manager/add-terminal-decision.ts similarity index 96% rename from src/app/domain/domain-typed-manager/add-terminal-decision.ts rename to src/app/claim/domain-typed-manager/add-terminal-decision.ts index 19748b69..f15ec1d6 100644 --- a/src/app/domain/domain-typed-manager/add-terminal-decision.ts +++ b/src/app/claim/domain-typed-manager/add-terminal-decision.ts @@ -6,7 +6,7 @@ import { TerminalSelector, TerminalDecision } from '../../damsel'; -import { toGenTerminalDecision } from './gen-conversion'; +import { toGenTerminalDecision } from '../../thrift/converters'; const createDecision = (partyID: string, shopID: string, terminalID: number): TerminalDecision => ({ diff --git a/src/app/domain/domain-typed-manager/create-shop-terminal.ts b/src/app/claim/domain-typed-manager/create-shop-terminal.ts similarity index 90% rename from src/app/domain/domain-typed-manager/create-shop-terminal.ts rename to src/app/claim/domain-typed-manager/create-shop-terminal.ts index 79af8635..17d2bc26 100644 --- a/src/app/domain/domain-typed-manager/create-shop-terminal.ts +++ b/src/app/claim/domain-typed-manager/create-shop-terminal.ts @@ -1,8 +1,7 @@ -import { toGenDomainObject } from './gen-conversion'; import { addTerminalDecision } from './add-terminal-decision'; import { createTerminalObject } from './create-terminal-object'; import { CreateTerminalParams } from './create-terminal-params'; -import { toGenCommit } from './gen-conversion'; +import { toGenCommit, toGenDomainObject } from '../../thrift/converters'; import { ProviderObject, TerminalObject, Commit } from '../../damsel'; export const createShopTerminal = (terminalObjects: TerminalObject[], providerObject: ProviderObject, params: CreateTerminalParams): Commit => { diff --git a/src/app/domain/domain-typed-manager/create-terminal-object.ts b/src/app/claim/domain-typed-manager/create-terminal-object.ts similarity index 91% rename from src/app/domain/domain-typed-manager/create-terminal-object.ts rename to src/app/claim/domain-typed-manager/create-terminal-object.ts index b7ec8e8d..306f474a 100644 --- a/src/app/domain/domain-typed-manager/create-terminal-object.ts +++ b/src/app/claim/domain-typed-manager/create-terminal-object.ts @@ -1,7 +1,7 @@ import { CreateTerminalParams } from './create-terminal-params'; import { generateID, toMap } from './utils'; -import { toGenTerminalObject } from './gen-conversion'; import { TerminalObject } from '../../damsel/domain'; +import { toGenTerminalObject } from '../../thrift/converters'; const convert = (id: number, params: CreateTerminalParams): TerminalObject => ({ ref: { diff --git a/src/app/domain/domain-typed-manager/create-terminal-params.ts b/src/app/claim/domain-typed-manager/create-terminal-params.ts similarity index 100% rename from src/app/domain/domain-typed-manager/create-terminal-params.ts rename to src/app/claim/domain-typed-manager/create-terminal-params.ts diff --git a/src/app/claim/domain-typed-manager/index.ts b/src/app/claim/domain-typed-manager/index.ts new file mode 100644 index 00000000..ddeb57bb --- /dev/null +++ b/src/app/claim/domain-typed-manager/index.ts @@ -0,0 +1,2 @@ +export * from '../../thrift/domain-typed-manager'; +export * from './create-terminal-params'; diff --git a/src/app/domain/domain-typed-manager/utils.ts b/src/app/claim/domain-typed-manager/utils.ts similarity index 100% rename from src/app/domain/domain-typed-manager/utils.ts rename to src/app/claim/domain-typed-manager/utils.ts diff --git a/src/app/claim/model/modification-unit-container.ts b/src/app/claim/model/modification-unit-container.ts index 7c377abb..d4027c50 100644 --- a/src/app/claim/model/modification-unit-container.ts +++ b/src/app/claim/model/modification-unit-container.ts @@ -1,4 +1,4 @@ -import { ContractModificationUnit, ShopModificationUnit } from '../../damsel'; +import { ContractModificationUnit, ShopModificationUnit } from '../../gen-damsel/payment_processing'; export class ModificationUnitContainer { saved: boolean; diff --git a/src/app/claim/model/persistent-container.ts b/src/app/claim/model/persistent-container.ts index ab54a9fb..600db5d8 100644 --- a/src/app/claim/model/persistent-container.ts +++ b/src/app/claim/model/persistent-container.ts @@ -1,4 +1,4 @@ -import { PartyModification } from '../../damsel/payment-processing'; +import { PartyModification } from '../../gen-damsel/payment_processing'; export class PersistentContainer { modification: PartyModification; diff --git a/src/app/claim/party-modification-group-converter.ts b/src/app/claim/party-modification-group-converter.ts index 2ed1e453..9f65ce19 100644 --- a/src/app/claim/party-modification-group-converter.ts +++ b/src/app/claim/party-modification-group-converter.ts @@ -6,7 +6,7 @@ import { PartyModificationUnit, PersistentContainer } from './model'; -import { ContractModificationUnit, ShopModificationUnit } from '../damsel/payment-processing'; +import { ContractModificationUnit, ShopModificationUnit } from '../gen-damsel/payment_processing'; interface PersistentUnit { modificationUnit: ShopModificationUnit | ContractModificationUnit; diff --git a/src/app/claim/persistent-container.service.ts b/src/app/claim/persistent-container.service.ts index 7deeea1d..eb8b2ee1 100644 --- a/src/app/claim/persistent-container.service.ts +++ b/src/app/claim/persistent-container.service.ts @@ -3,7 +3,7 @@ import { Subject } from 'rxjs'; import remove from 'lodash-es/remove'; import { PersistentContainer } from './model'; -import { PartyModification } from '../damsel/payment-processing'; +import { PartyModification } from '../gen-damsel/payment_processing'; @Injectable() export class PersistentContainerService { diff --git a/src/app/claim/terminal-object/form-default-values/get-options.ts b/src/app/claim/terminal-object/form-default-values/get-options.ts index 530a2c7f..708e23da 100644 --- a/src/app/claim/terminal-object/form-default-values/get-options.ts +++ b/src/app/claim/terminal-object/form-default-values/get-options.ts @@ -2,8 +2,8 @@ import { getVtbTemplateOptions } from './get-vtb-template-options'; import { getTcsTemplateOptions } from './get-tcs-template-options'; import { getRietTemplateOptions } from './get-riet-template-options'; import { getSngbTemplateOptions } from './get-sngb-template-options'; -import { TerminalOption } from '../../../domain/domain-typed-manager/index'; -import { DomainModificationInfo } from '../../model/index'; +import { DomainModificationInfo } from '../../model'; +import { TerminalOption } from '../../domain-typed-manager'; export const getOptions = (option: string, params: DomainModificationInfo): TerminalOption[] => { const {shopUrl, partyId} = params; diff --git a/src/app/claim/terminal-object/form-default-values/get-riet-template-options.ts b/src/app/claim/terminal-object/form-default-values/get-riet-template-options.ts index a4e8d993..e5886cbb 100644 --- a/src/app/claim/terminal-object/form-default-values/get-riet-template-options.ts +++ b/src/app/claim/terminal-object/form-default-values/get-riet-template-options.ts @@ -1,4 +1,4 @@ -import { TerminalOption } from '../../../domain/domain-typed-manager'; +import { TerminalOption } from '../../domain-typed-manager'; export const getRietTemplateOptions = (): TerminalOption[] => ([ diff --git a/src/app/claim/terminal-object/form-default-values/get-tcs-template-options.ts b/src/app/claim/terminal-object/form-default-values/get-tcs-template-options.ts index 3b22fc53..345873fe 100644 --- a/src/app/claim/terminal-object/form-default-values/get-tcs-template-options.ts +++ b/src/app/claim/terminal-object/form-default-values/get-tcs-template-options.ts @@ -1,5 +1,5 @@ import { getHost } from './get-host'; -import { TerminalOption } from '../../../domain/domain-typed-manager'; +import { TerminalOption } from '../../domain-typed-manager'; export const getTcsTemplateOptions = (shopUrl: string): TerminalOption[] => ([ diff --git a/src/app/claim/terminal-object/form-default-values/get-vtb-template-options.ts b/src/app/claim/terminal-object/form-default-values/get-vtb-template-options.ts index b521d7e5..75beecf6 100644 --- a/src/app/claim/terminal-object/form-default-values/get-vtb-template-options.ts +++ b/src/app/claim/terminal-object/form-default-values/get-vtb-template-options.ts @@ -1,6 +1,6 @@ import last from 'lodash-es/last'; import { getHost } from './get-host'; -import { TerminalOption } from '../../../domain/domain-typed-manager'; +import { TerminalOption } from '../../domain-typed-manager'; const partyIDToSmid = (partyID: string) => last(partyID.split('-')); diff --git a/src/app/claim/terminal-object/terminal-object.component.ts b/src/app/claim/terminal-object/terminal-object.component.ts index 92bf5d59..211af48b 100644 --- a/src/app/claim/terminal-object/terminal-object.component.ts +++ b/src/app/claim/terminal-object/terminal-object.component.ts @@ -5,7 +5,7 @@ import { Observable } from 'rxjs'; import { DomainModificationInfo } from '../model'; import { TerminalObjectService } from './terminal-object.service'; import { ProviderObject } from '../../damsel/domain'; -import { CreateTerminalParams, DomainTypedManager } from '../../domain/domain-typed-manager'; +import { CreateTerminalParams, DomainTypedManager } from '../domain-typed-manager'; @Component({ selector: 'cc-terminal-object', diff --git a/src/app/claim/terminal-object/terminal-object.service.ts b/src/app/claim/terminal-object/terminal-object.service.ts index 971d2136..4d8489e1 100644 --- a/src/app/claim/terminal-object/terminal-object.service.ts +++ b/src/app/claim/terminal-object/terminal-object.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { TerminalOption } from '../../domain/domain-typed-manager'; +import { TerminalOption } from '../domain-typed-manager'; import { getOptions, prepareTerminalName } from './form-default-values'; import { DomainModificationInfo } from '../model'; diff --git a/src/app/claims/claims-table/claims-table.component.html b/src/app/claims/claims-table/claims-table.component.html index 8ecf04be..b1cdf112 100644 --- a/src/app/claims/claims-table/claims-table.component.html +++ b/src/app/claims/claims-table/claims-table.component.html @@ -1,4 +1,4 @@ - +
diff --git a/src/app/claims/claims.component.html b/src/app/claims/claims.component.html index 66adefd9..eb91614b 100644 --- a/src/app/claims/claims.component.html +++ b/src/app/claims/claims.component.html @@ -11,6 +11,8 @@ - +
+ +
diff --git a/src/app/damsel/domain/cash-flow-account.ts b/src/app/damsel/domain/cash-flow-account.ts new file mode 100644 index 00000000..e97790f2 --- /dev/null +++ b/src/app/damsel/domain/cash-flow-account.ts @@ -0,0 +1,11 @@ +import { MerchantCashFlowAccount } from './merchant-cash-flow-account'; +import { ProviderCashFlowAccount } from './provider-cash-flow-account'; +import { SystemCashFlowAccount } from './system-cash-flow-account'; +import { ExternalCashFlowAccount } from './external-cash-flow-account'; + +export interface CashFlowAccount { + merchant?: MerchantCashFlowAccount; + provider?: ProviderCashFlowAccount; + system?: SystemCashFlowAccount; + external?: ExternalCashFlowAccount; +} diff --git a/src/app/damsel/domain/cash.ts b/src/app/damsel/domain/cash.ts new file mode 100644 index 00000000..cb38c1e9 --- /dev/null +++ b/src/app/damsel/domain/cash.ts @@ -0,0 +1,6 @@ +import { CurrencyRef } from './currency-ref'; + +export interface Cash { + amount: number; + currency: CurrencyRef; +} diff --git a/src/app/damsel/domain/external-cash-flow-account.ts b/src/app/damsel/domain/external-cash-flow-account.ts new file mode 100644 index 00000000..e5309c26 --- /dev/null +++ b/src/app/damsel/domain/external-cash-flow-account.ts @@ -0,0 +1,4 @@ +export enum ExternalCashFlowAccount { + income, + outcome +} diff --git a/src/app/damsel/domain/final-cash-flow-account.ts b/src/app/damsel/domain/final-cash-flow-account.ts new file mode 100644 index 00000000..dbf9cb82 --- /dev/null +++ b/src/app/damsel/domain/final-cash-flow-account.ts @@ -0,0 +1,6 @@ +import { CashFlowAccount } from './cash-flow-account'; + +export interface FinalCashFlowAccount { + accountType: CashFlowAccount; + accountId: number; +} diff --git a/src/app/damsel/domain/final-cash-flow-posting.ts b/src/app/damsel/domain/final-cash-flow-posting.ts new file mode 100644 index 00000000..e2934aaa --- /dev/null +++ b/src/app/damsel/domain/final-cash-flow-posting.ts @@ -0,0 +1,9 @@ +import { Cash } from './cash'; +import { FinalCashFlowAccount } from './final-cash-flow-account'; + +export interface FinalCashFlowPosting { + source: FinalCashFlowAccount; + destination: FinalCashFlowAccount; + volume: Cash; + details?: string; +} diff --git a/src/app/damsel/domain/index.ts b/src/app/damsel/domain/index.ts index 6413215b..15d08f6b 100644 --- a/src/app/damsel/domain/index.ts +++ b/src/app/damsel/domain/index.ts @@ -74,3 +74,5 @@ export * from './provider-selector'; export * from './system-account-selector'; export * from './system-account-set-decision'; export * from './system-account-set-ref'; +export * from './invoice-payment-status'; +export * from './invoice-payment-adjustment'; diff --git a/src/app/damsel/domain/invoice-payment-adjustment-status.ts b/src/app/damsel/domain/invoice-payment-adjustment-status.ts new file mode 100644 index 00000000..418834f7 --- /dev/null +++ b/src/app/damsel/domain/invoice-payment-adjustment-status.ts @@ -0,0 +1,5 @@ +export interface InvoicePaymentAdjustmentStatus { + pending: {}; + captured: { at: string }; + cancelled: { at: string }; +} diff --git a/src/app/damsel/domain/invoice-payment-adjustment.ts b/src/app/damsel/domain/invoice-payment-adjustment.ts new file mode 100644 index 00000000..490a34b1 --- /dev/null +++ b/src/app/damsel/domain/invoice-payment-adjustment.ts @@ -0,0 +1,12 @@ +import { InvoicePaymentAdjustmentStatus } from './invoice-payment-adjustment-status'; +import { FinalCashFlowPosting } from './final-cash-flow-posting'; + +export interface InvoicePaymentAdjustment { + id: string; + status: InvoicePaymentAdjustmentStatus; + createdAt: string; + domainRevision: number; + reason: string; + newCashFlow: FinalCashFlowPosting[]; + oldCashFlowInverse: FinalCashFlowPosting[]; +} diff --git a/src/app/damsel/domain/invoice-payment-status.ts b/src/app/damsel/domain/invoice-payment-status.ts new file mode 100644 index 00000000..3df2f38e --- /dev/null +++ b/src/app/damsel/domain/invoice-payment-status.ts @@ -0,0 +1,10 @@ +import { OperationFailure } from './operation-failure'; + +export interface InvoicePaymentStatus { + pending?: {}; + processed: {}; + captured: { reason?: string; }; + cancelled: { reason?: string; }; + refunded: {}; + failed: { failure: OperationFailure; }; +} diff --git a/src/app/damsel/domain/merchant-cash-flow-account.ts b/src/app/damsel/domain/merchant-cash-flow-account.ts new file mode 100644 index 00000000..3663e5a7 --- /dev/null +++ b/src/app/damsel/domain/merchant-cash-flow-account.ts @@ -0,0 +1,5 @@ +export enum MerchantCashFlowAccount { + settlement, + guarantee, + payout +} diff --git a/src/app/damsel/domain/operation-failure.ts b/src/app/damsel/domain/operation-failure.ts new file mode 100644 index 00000000..be51d995 --- /dev/null +++ b/src/app/damsel/domain/operation-failure.ts @@ -0,0 +1,10 @@ +import { SubFailure } from './sub-failure'; + +export interface OperationFailure { + operation_timeout?: {}; + failure?: { + code: string; + reason?: string; + sub?: SubFailure; + }; +} diff --git a/src/app/damsel/domain/provider-cash-flow-account.ts b/src/app/damsel/domain/provider-cash-flow-account.ts new file mode 100644 index 00000000..4d3f6b8e --- /dev/null +++ b/src/app/damsel/domain/provider-cash-flow-account.ts @@ -0,0 +1,3 @@ +export enum ProviderCashFlowAccount { + settlement +} diff --git a/src/app/damsel/domain/sub-failure.ts b/src/app/damsel/domain/sub-failure.ts new file mode 100644 index 00000000..92d9bee9 --- /dev/null +++ b/src/app/damsel/domain/sub-failure.ts @@ -0,0 +1,4 @@ +export interface SubFailure { + code: string; + sub?: SubFailure; +} diff --git a/src/app/damsel/domain/system-cash-flow-account.ts b/src/app/damsel/domain/system-cash-flow-account.ts new file mode 100644 index 00000000..f75e08d4 --- /dev/null +++ b/src/app/damsel/domain/system-cash-flow-account.ts @@ -0,0 +1,3 @@ +export enum SystemCashFlowAccount { + settlement +} diff --git a/src/app/damsel/index.ts b/src/app/damsel/index.ts index b7cad446..83437c1b 100644 --- a/src/app/damsel/index.ts +++ b/src/app/damsel/index.ts @@ -1,3 +1,2 @@ -export * from './payment-processing'; export * from './domain'; export * from './domain-config'; diff --git a/src/app/damsel/payment-processing/contract-adjustment-modification-unit.ts b/src/app/damsel/payment-processing/contract-adjustment-modification-unit.ts deleted file mode 100644 index 2939c900..00000000 --- a/src/app/damsel/payment-processing/contract-adjustment-modification-unit.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { ContractAdjustmentModification } from './contract-adjustment-modification'; - -export class ContractAdjustmentModificationUnit { - adjustmentId?: string; - modification?: ContractAdjustmentModification; -} diff --git a/src/app/damsel/payment-processing/contract-adjustment-modification.ts b/src/app/damsel/payment-processing/contract-adjustment-modification.ts deleted file mode 100644 index 3f4cd646..00000000 --- a/src/app/damsel/payment-processing/contract-adjustment-modification.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { ContractAdjustmentParams } from './contract-adjustment-params'; - -export class ContractAdjustmentModification { - creation: ContractAdjustmentParams; -} diff --git a/src/app/damsel/payment-processing/contract-adjustment-params.ts b/src/app/damsel/payment-processing/contract-adjustment-params.ts deleted file mode 100644 index ec1892fc..00000000 --- a/src/app/damsel/payment-processing/contract-adjustment-params.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { ContractTemplateRef } from '../domain'; - -export class ContractAdjustmentParams { - template: ContractTemplateRef; -} diff --git a/src/app/damsel/payment-processing/contract-modification-unit.ts b/src/app/damsel/payment-processing/contract-modification-unit.ts deleted file mode 100644 index bdc297ca..00000000 --- a/src/app/damsel/payment-processing/contract-modification-unit.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { ContractModification } from './contract-modification'; - -export class ContractModificationUnit { - id: string; - modification: ContractModification; -} diff --git a/src/app/damsel/payment-processing/contract-modification.ts b/src/app/damsel/payment-processing/contract-modification.ts deleted file mode 100644 index ce057135..00000000 --- a/src/app/damsel/payment-processing/contract-modification.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { - ContractorID, - ReportPreferences, - LegalAgreement -} from '../domain'; -import { ContractParams } from './contract-params'; -import { ContractTermination } from './contract-termination'; -import { ContractAdjustmentModificationUnit } from './contract-adjustment-modification-unit'; -import { PayoutToolModificationUnit } from './payout-tool-modification-unit'; - -export class ContractModification { - creation?: ContractParams; - termination?: ContractTermination; - adjustmentModification?: ContractAdjustmentModificationUnit; - payoutToolModification?: PayoutToolModificationUnit; - legalAgreementBinding?: LegalAgreement; - reportPreferencesModification?: ReportPreferences; - contractorModification?: ContractorID; -} diff --git a/src/app/damsel/payment-processing/contract-params.ts b/src/app/damsel/payment-processing/contract-params.ts deleted file mode 100644 index b7d671e8..00000000 --- a/src/app/damsel/payment-processing/contract-params.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { - PaymentInstitutionRef, - ContractTemplateRef, - Contractor, - ContractorID -} from '../domain'; - -export class ContractParams { - contractorId: ContractorID; - template?: ContractTemplateRef; - paymentInstitution?: PaymentInstitutionRef; - - // depricated - contractor: Contractor; -} diff --git a/src/app/damsel/payment-processing/contract-termination.ts b/src/app/damsel/payment-processing/contract-termination.ts deleted file mode 100644 index fc873096..00000000 --- a/src/app/damsel/payment-processing/contract-termination.ts +++ /dev/null @@ -1,3 +0,0 @@ -export class ContractTermination { - reason: string; -} diff --git a/src/app/damsel/payment-processing/contractor-modification-unit.ts b/src/app/damsel/payment-processing/contractor-modification-unit.ts deleted file mode 100644 index 4d599ef3..00000000 --- a/src/app/damsel/payment-processing/contractor-modification-unit.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ContractorID } from '../domain'; -import { ContractorModification } from './contractor-modification'; - -export class ContractorModificationUnit { - id: ContractorID; - modification: ContractorModification; -} diff --git a/src/app/damsel/payment-processing/contractor-modification.ts b/src/app/damsel/payment-processing/contractor-modification.ts deleted file mode 100644 index 072bf0d2..00000000 --- a/src/app/damsel/payment-processing/contractor-modification.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Contractor } from '../domain'; - -export class ContractorModification { - creation: Contractor; -} diff --git a/src/app/damsel/payment-processing/index.ts b/src/app/damsel/payment-processing/index.ts deleted file mode 100644 index 7cf0a7f2..00000000 --- a/src/app/damsel/payment-processing/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -export * from './schedule-modification'; -export * from './contract-adjustment-modification'; -export * from './contract-adjustment-modification-unit'; -export * from './contract-adjustment-params'; -export * from './contract-modification'; -export * from './contract-modification-unit'; -export * from './contract-params'; -export * from './contract-termination'; -export * from './party-modification'; -export * from './payout-tool-modification'; -export * from './payout-tool-modification-unit'; -export * from './payout-tool-params'; -export * from './proxy-modification'; -export * from './shop-account-params'; -export * from './shop-contract-modification'; -export * from './shop-modification'; -export * from './shop-modification-unit'; -export * from './shop-params'; -export * from './contractor-modification'; -export * from './contract-adjustment-modification-unit'; diff --git a/src/app/damsel/payment-processing/party-modification.ts b/src/app/damsel/payment-processing/party-modification.ts deleted file mode 100644 index 512338d5..00000000 --- a/src/app/damsel/payment-processing/party-modification.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { ShopModificationUnit } from './shop-modification-unit'; -import { ContractModificationUnit } from './contract-modification-unit'; -import { ContractorModificationUnit } from './contractor-modification-unit'; - -export class PartyModification { - contractModification?: ContractModificationUnit; - shopModification?: ShopModificationUnit; - contractorModification?: ContractorModificationUnit; -} diff --git a/src/app/damsel/payment-processing/payout-tool-modification-unit.ts b/src/app/damsel/payment-processing/payout-tool-modification-unit.ts deleted file mode 100644 index c5538ebe..00000000 --- a/src/app/damsel/payment-processing/payout-tool-modification-unit.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { PayoutToolID } from '../domain/payout-tool-id'; -import { PayoutToolModification } from './payout-tool-modification'; - -export class PayoutToolModificationUnit { - payoutToolId: PayoutToolID; - modification: PayoutToolModification; -} diff --git a/src/app/damsel/payment-processing/payout-tool-modification.ts b/src/app/damsel/payment-processing/payout-tool-modification.ts deleted file mode 100644 index d18316a6..00000000 --- a/src/app/damsel/payment-processing/payout-tool-modification.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { PayoutToolParams } from './payout-tool-params'; -import { PayoutToolInfo } from '../domain'; - -export class PayoutToolModification { - creation?: PayoutToolParams; - infoModification?: PayoutToolInfo; -} diff --git a/src/app/damsel/payment-processing/payout-tool-params.ts b/src/app/damsel/payment-processing/payout-tool-params.ts deleted file mode 100644 index 8e0efe33..00000000 --- a/src/app/damsel/payment-processing/payout-tool-params.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { CurrencyRef } from '../domain/currency-ref'; -import { PayoutToolInfo } from '../domain/payout-tool-info'; - -export class PayoutToolParams { - currency: CurrencyRef; - toolInfo: PayoutToolInfo; -} diff --git a/src/app/damsel/payment-processing/proxy-modification.ts b/src/app/damsel/payment-processing/proxy-modification.ts deleted file mode 100644 index 1ad11043..00000000 --- a/src/app/damsel/payment-processing/proxy-modification.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { Proxy } from '../domain/proxy'; - -// deprecated -export class ProxyModification { - proxy: Proxy; -} diff --git a/src/app/damsel/payment-processing/schedule-modification.ts b/src/app/damsel/payment-processing/schedule-modification.ts deleted file mode 100644 index e2c1acdd..00000000 --- a/src/app/damsel/payment-processing/schedule-modification.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { BusinessScheduleRef } from '../domain'; - -export class ScheduleModification { - schedule?: BusinessScheduleRef; -} diff --git a/src/app/damsel/payment-processing/shop-account-params.ts b/src/app/damsel/payment-processing/shop-account-params.ts deleted file mode 100644 index dc2389d0..00000000 --- a/src/app/damsel/payment-processing/shop-account-params.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { CurrencyRef } from '../domain/currency-ref'; - -export class ShopAccountParams { - currency: CurrencyRef; -} diff --git a/src/app/damsel/payment-processing/shop-contract-modification.ts b/src/app/damsel/payment-processing/shop-contract-modification.ts deleted file mode 100644 index e901f310..00000000 --- a/src/app/damsel/payment-processing/shop-contract-modification.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ContractID } from '../domain/contract-id'; -import { PayoutToolID } from '../domain/payout-tool-id'; - -export class ShopContractModification { - contractId: ContractID; - payoutToolId: PayoutToolID; -} diff --git a/src/app/damsel/payment-processing/shop-modification-unit.ts b/src/app/damsel/payment-processing/shop-modification-unit.ts deleted file mode 100644 index ab8b0b07..00000000 --- a/src/app/damsel/payment-processing/shop-modification-unit.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { ShopModification } from './shop-modification'; - -export class ShopModificationUnit { - id: string; - modification: ShopModification; -} diff --git a/src/app/damsel/payment-processing/shop-modification.ts b/src/app/damsel/payment-processing/shop-modification.ts deleted file mode 100644 index 656b987c..00000000 --- a/src/app/damsel/payment-processing/shop-modification.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ShopParams } from './shop-params'; -import { CategoryRef } from '../domain/category-ref'; -import { ShopDetails } from '../domain/shop-details'; -import { PayoutToolID } from '../domain/payout-tool-id'; -import { ShopLocation } from '../domain/shop-location'; -import { ShopContractModification } from './shop-contract-modification'; -import { ProxyModification } from './proxy-modification'; -import { ShopAccountParams } from './shop-account-params'; -import { ScheduleModification } from './schedule-modification'; - -export class ShopModification { - creation?: ShopParams; - categoryModification?: CategoryRef; - detailsModification?: ShopDetails; - contractModification?: ShopContractModification; - payoutToolModification?: PayoutToolID; - locationModification?: ShopLocation; - shopAccountCreation?: ShopAccountParams; - payoutScheduleModification?: ScheduleModification; - - // deprecated - proxyModification?: ProxyModification; -} diff --git a/src/app/damsel/payment-processing/shop-params.ts b/src/app/damsel/payment-processing/shop-params.ts deleted file mode 100644 index d49abbf0..00000000 --- a/src/app/damsel/payment-processing/shop-params.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { CategoryRef } from '../domain/category-ref'; -import { ShopLocation } from '../domain/shop-location'; -import { ShopDetails } from '../domain/shop-details'; -import { ContractID } from '../domain/contract-id'; -import { PayoutToolID } from '../domain/payout-tool-id'; - -export class ShopParams { - category?: CategoryRef; - location: ShopLocation; - details: ShopDetails; - contractId: ContractID; - payoutToolId: PayoutToolID; -} diff --git a/src/app/domain/dmt.service.ts b/src/app/domain/dmt.service.ts deleted file mode 100644 index 34f9d01b..00000000 --- a/src/app/domain/dmt.service.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { Injectable, NgZone } from '@angular/core'; -import { Observable } from 'rxjs'; - -import { createHttpClient } from './domain-connector'; -import { DomainClient } from './domain-connector'; -import { - Snapshot, - Version, - Commit, - Reference -} from '../damsel'; - -import * as Repository from './gen-nodejs/Repository'; - -type Exception = any; - -@Injectable() -export class DmtService { - - private domainClient: DomainClient; - - constructor(private zone: NgZone) { - this.domainClient = createHttpClient(Repository); - } - - checkout(reference: Reference): Observable { - return Observable.create((observer) => { - this.domainClient.Checkout(reference, (ex: Exception, snapshot: Snapshot) => { - this.zone.run(() => { - ex ? observer.error(ex) : observer.next(snapshot); - observer.complete(); - }); - }); - }); - } - - commit(version: Version, commit: Commit): Observable { - return Observable.create((observer) => { - this.domainClient.Commit(version, commit, (ex: Exception, nextVersion: Version) => { - this.zone.run(() => { - ex ? observer.error(ex) : observer.next(nextVersion); - observer.complete(); - }); - }); - }); - } -} diff --git a/src/app/domain/domain-connector.ts b/src/app/domain/domain-connector.ts deleted file mode 100644 index d61b9e7e..00000000 --- a/src/app/domain/domain-connector.ts +++ /dev/null @@ -1,8 +0,0 @@ -import connectClient from 'woody_js/dist/connect-client'; - -export type DomainService = any; - -export type DomainClient = any; - -export const createHttpClient = (service: DomainService): DomainClient => - connectClient(location.hostname, location.port, '/v1/domain/repository', service); diff --git a/src/app/domain/domain-typed-manager/index.ts b/src/app/domain/domain-typed-manager/index.ts deleted file mode 100644 index b7e44c98..00000000 --- a/src/app/domain/domain-typed-manager/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './domain-typed-manager'; -export * from './create-terminal-params'; diff --git a/src/app/domain/domain.module.ts b/src/app/domain/domain.module.ts deleted file mode 100644 index 860a6f00..00000000 --- a/src/app/domain/domain.module.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { NgModule } from '@angular/core'; - -import { DomainTypedManager } from './domain-typed-manager'; -import { DmtService } from './dmt.service'; - -@NgModule({ - providers: [ - DmtService, - DomainTypedManager - ] -}) -export class DomainModule {} diff --git a/src/app/papi/model/card-line.ts b/src/app/papi/model/card-line.ts new file mode 100644 index 00000000..2137adf8 --- /dev/null +++ b/src/app/papi/model/card-line.ts @@ -0,0 +1,8 @@ +import { Price } from './price'; + +export class CartLine { + product: string; + quantity: number; + price: Price; + metadata: any[]; +} diff --git a/src/app/papi/model/cart.ts b/src/app/papi/model/cart.ts new file mode 100644 index 00000000..bcc50303 --- /dev/null +++ b/src/app/papi/model/cart.ts @@ -0,0 +1,5 @@ +import { CartLine } from './card-line'; + +export class Cart { + lines: CartLine[]; +} diff --git a/src/app/papi/model/currency.ts b/src/app/papi/model/currency.ts new file mode 100644 index 00000000..3d7ea506 --- /dev/null +++ b/src/app/papi/model/currency.ts @@ -0,0 +1,3 @@ +export class Currency { + symbolicCode: string; +} diff --git a/src/app/papi/model/index.ts b/src/app/papi/model/index.ts index 2e34d4d2..4cdf91ab 100644 --- a/src/app/papi/model/index.ts +++ b/src/app/papi/model/index.ts @@ -5,3 +5,5 @@ export * from './contract-template'; export * from './payout'; export * from './payouts-response'; export * from './payout-statuses'; +export * from './payment'; +export * from './invoice'; diff --git a/src/app/papi/model/invoice.ts b/src/app/papi/model/invoice.ts new file mode 100644 index 00000000..b5cc901d --- /dev/null +++ b/src/app/papi/model/invoice.ts @@ -0,0 +1,15 @@ +import { Cart } from './cart'; + +export class Invoice { + id: string; + ownerId: string; + shopId: string; + createdAt: string; + status: object; + product: string; + description: string; + due: string; + amount: number; + currencySymbolicCode: string; + cart: Cart; +} diff --git a/src/app/papi/model/party-modification-unit.ts b/src/app/papi/model/party-modification-unit.ts index 9ae29b0e..93148525 100644 --- a/src/app/papi/model/party-modification-unit.ts +++ b/src/app/papi/model/party-modification-unit.ts @@ -1,4 +1,4 @@ -import { PartyModification } from '../../damsel'; +import { PartyModification } from '../../gen-damsel/payment_processing'; export class PartyModificationUnit { modifications: PartyModification[]; diff --git a/src/app/papi/model/payment.ts b/src/app/papi/model/payment.ts new file mode 100644 index 00000000..062394cd --- /dev/null +++ b/src/app/papi/model/payment.ts @@ -0,0 +1,20 @@ +export class Payment { + id: string; + invoiceId: string; + ownerId: string; + shopId: string; + createdAt: string; + status: object; + amount: number; + fee: number; + providerFee: number; + externalFee: number; + currencySymbolicCode: string; + payer: object; + ipAddress: string; + fingerprint: string; + email: string; + sessionId: string; + locationInfo: object; + flow: object; +} diff --git a/src/app/papi/model/price.ts b/src/app/papi/model/price.ts new file mode 100644 index 00000000..038736ad --- /dev/null +++ b/src/app/papi/model/price.ts @@ -0,0 +1,6 @@ +import { Currency } from './currency'; + +export class Price { + amount: string; + currency: Currency; +} diff --git a/src/app/papi/papi.module.ts b/src/app/papi/papi.module.ts index 69d3949d..eb8a168b 100644 --- a/src/app/papi/papi.module.ts +++ b/src/app/papi/papi.module.ts @@ -5,6 +5,7 @@ import { ClaimService } from './claim.service'; import { CategoryService } from './category.service'; import { ContractService } from './contract.service'; import { PayoutsService } from './payouts.service'; +import { ReportService } from './report.service'; import { PartyService } from './party.service'; @NgModule({ @@ -14,6 +15,7 @@ import { PartyService } from './party.service'; CategoryService, ContractService, PayoutsService, + ReportService, PartyService ] }) diff --git a/src/app/papi/params/index.ts b/src/app/papi/params/index.ts index 77761971..c1c755fb 100644 --- a/src/app/papi/params/index.ts +++ b/src/app/papi/params/index.ts @@ -4,3 +4,4 @@ export * from './claim-deny-params'; export * from './payout-search-params'; export * from './payout-cancel-params'; export * from './payout-create-params'; +export * from './report-search-params'; diff --git a/src/app/papi/params/report-search-params.ts b/src/app/papi/params/report-search-params.ts new file mode 100644 index 00000000..90092810 --- /dev/null +++ b/src/app/papi/params/report-search-params.ts @@ -0,0 +1,11 @@ +export class ReportSearchParams { + fromTime: string; + toTime: string; + from: string; + size: string; + merchantId?: string; + invoiceId?: string; + status?: string; + categoryIds?: string[]; + paymentDomainRevision?: string; +} diff --git a/src/app/papi/report.service.ts b/src/app/papi/report.service.ts new file mode 100644 index 00000000..1b34de2f --- /dev/null +++ b/src/app/papi/report.service.ts @@ -0,0 +1,36 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; + +import { Invoice, Payment } from './model'; +import { ReportSearchParams } from './params'; +import { ConfigService } from '../core/config.service'; +import { decode } from '../shared/papi-formatter'; + +interface Params { + [param: string]: string | string[]; +} + +@Injectable() +export class ReportService { + + private papiEndpoint: string; + + constructor( + private http: HttpClient, + private configService: ConfigService + ) { + this.papiEndpoint = configService.config.papiEndpoint; + } + + getInvoices(params: ReportSearchParams): Observable { + return this.http.get<{invoices: any[]}>(`${this.papiEndpoint}/mst/invoices`, {params: params as ReportSearchParams & Params}) + .pipe(map((res) => decode(res.invoices))); + } + + getPayments(params: ReportSearchParams): Observable { + return this.http.get<{payments: any[]}>(`${this.papiEndpoint}/mst/payments`, {params: params as ReportSearchParams & Params}) + .pipe(map((res) => decode(res.payments))); + } +} diff --git a/src/app/party-modification-creation/contract/business-schedule-ref/business-schedule-ref.component.ts b/src/app/party-modification-creation/contract/business-schedule-ref/business-schedule-ref.component.ts index 5aab4e8c..b3b3aa85 100644 --- a/src/app/party-modification-creation/contract/business-schedule-ref/business-schedule-ref.component.ts +++ b/src/app/party-modification-creation/contract/business-schedule-ref/business-schedule-ref.component.ts @@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { Observable } from 'rxjs'; -import { DomainTypedManager } from '../../../domain/domain-typed-manager'; +import { DomainTypedManager } from '../../../claim/domain-typed-manager'; import { BusinessScheduleObject } from '../../../damsel/domain'; @Component({ diff --git a/src/app/party-modification-creation/contract/payment-institution/payment-institution-ref.component.ts b/src/app/party-modification-creation/contract/payment-institution/payment-institution-ref.component.ts index 5e9a7a61..01a9b6e5 100644 --- a/src/app/party-modification-creation/contract/payment-institution/payment-institution-ref.component.ts +++ b/src/app/party-modification-creation/contract/payment-institution/payment-institution-ref.component.ts @@ -4,7 +4,7 @@ import { map } from 'rxjs/operators'; import sortBy from 'lodash-es/sortBy'; import { Observable } from 'rxjs'; -import { DomainTypedManager } from '../../../domain/domain-typed-manager'; +import { DomainTypedManager } from '../../../claim/domain-typed-manager'; import { PaymentInstitutionObject } from '../../../damsel/domain'; @Component({ diff --git a/src/app/party-modification-creation/party-modification-creation.component.ts b/src/app/party-modification-creation/party-modification-creation.component.ts index 597557f8..7d879a62 100644 --- a/src/app/party-modification-creation/party-modification-creation.component.ts +++ b/src/app/party-modification-creation/party-modification-creation.component.ts @@ -9,11 +9,11 @@ import { } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { PartyModification } from '../damsel/payment-processing'; import { ContractModificationName, ShopModificationName } from '../claim/model'; import { toPartyModification } from './to-party-modification'; import { ActionType, ModificationAction } from '../claim/modification-action'; import { filterEmptyStringValues } from './filter-empty-string-value'; +import { PartyModification } from '../gen-damsel/payment_processing'; @Component({ selector: 'cc-party-modification-creation', diff --git a/src/app/party-modification-creation/shop/schedule-ref/schedule-ref.component.ts b/src/app/party-modification-creation/shop/schedule-ref/schedule-ref.component.ts index c632eab7..6d08c961 100644 --- a/src/app/party-modification-creation/shop/schedule-ref/schedule-ref.component.ts +++ b/src/app/party-modification-creation/shop/schedule-ref/schedule-ref.component.ts @@ -3,7 +3,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { Observable } from 'rxjs'; import { BusinessScheduleObject } from '../../../damsel/domain'; -import { DomainTypedManager } from '../../../domain/domain-typed-manager'; +import { DomainTypedManager } from '../../../claim/domain-typed-manager'; @Component({ selector: 'cc-schedule-ref', diff --git a/src/app/payment-adjustment/create-and-capture/action-item/action-item.component.html b/src/app/payment-adjustment/create-and-capture/action-item/action-item.component.html new file mode 100644 index 00000000..3e4e17e5 --- /dev/null +++ b/src/app/payment-adjustment/create-and-capture/action-item/action-item.component.html @@ -0,0 +1,8 @@ +
+ +
+ +
+
\ No newline at end of file diff --git a/src/app/payment-adjustment/create-and-capture/action-item/action-item.component.ts b/src/app/payment-adjustment/create-and-capture/action-item/action-item.component.ts new file mode 100644 index 00000000..1719757d --- /dev/null +++ b/src/app/payment-adjustment/create-and-capture/action-item/action-item.component.ts @@ -0,0 +1,27 @@ +import { Component, EventEmitter, Input, Output } from '@angular/core'; + +@Component({ + selector: 'cc-action-item', + templateUrl: 'action-item.component.html' +}) +export class ActionItemComponent { + + @Input() + description: string; + + @Input() + hasAction = false; + + @Input() + actionButtonLabel: string; + + @Input() + actionDisabled: boolean; + + @Output() + action: EventEmitter = new EventEmitter(); + + doAction() { + this.action.emit(); + } +} diff --git a/src/app/payment-adjustment/create-and-capture/adjustment-operations/adjustment-event.ts b/src/app/payment-adjustment/create-and-capture/adjustment-operations/adjustment-event.ts new file mode 100644 index 00000000..453dde84 --- /dev/null +++ b/src/app/payment-adjustment/create-and-capture/adjustment-operations/adjustment-event.ts @@ -0,0 +1,28 @@ +import { ExecResultType } from '../executor.service'; + +export enum EventType { + BatchOperationStarted = 'BatchOperationStarted', + BatchOperationFinished = 'BatchOperationFinished', + BatchOperationFailed = 'BatchOperationFailed', + PaymentAdjustmentsCreated = 'PaymentAdjustmentsCreated', + PaymentAdjustmentsCancelled = 'PaymentAdjustmentsCancelled', + PaymentAdjustmentsCaptured = 'PaymentAdjustmentsCaptured', + CreatePaymentAdjustmentFailed = 'CreatePaymentAdjustmentFailed', + CancelPaymentAdjustmentFailed = 'CancelPaymentAdjustmentFailed', + CapturePaymentAdjustmentFailed = 'CapturePaymentAdjustmentFailed' +} + +export type OperationType = ExecResultType; + +export interface AdjustmentOperationEvent { + type: EventType; + operationType?: OperationType; + payload?: T[]; +} + +export interface OperationFailedPayload { + code: C; + operationScope: S; +} + +export interface OperationError extends AdjustmentOperationEvent> {} diff --git a/src/app/payment-adjustment/create-and-capture/adjustment-operations/adjustment-operation.service.ts b/src/app/payment-adjustment/create-and-capture/adjustment-operations/adjustment-operation.service.ts new file mode 100644 index 00000000..72dd5e7e --- /dev/null +++ b/src/app/payment-adjustment/create-and-capture/adjustment-operations/adjustment-operation.service.ts @@ -0,0 +1,43 @@ +import { Injectable } from '@angular/core'; +import { Observable, Subject, throwError } from 'rxjs'; +import { catchError, map, tap } from 'rxjs/internal/operators'; +import groupBy from 'lodash-es/groupBy'; + +import { ExecutorService } from '../executor.service'; +import { PaymentProcessingTypedManager } from '../../../thrift/payment-processing-typed-manager'; +import { AdjustmentOperationEvent, EventType } from './adjustment-event'; +import { ExecResultGroup } from './exec-result-group'; + +@Injectable() +export abstract class AdjustmentOperationService { + + events$: Subject = new Subject(); + + progress$: Subject; + + constructor( + protected executorService: ExecutorService, + protected manager: PaymentProcessingTypedManager) { + this.progress$ = this.executorService.progress$; + } + + batch(params: any[]): Observable { + const execParams = this.toExecParams(params); + this.events$.next({type: EventType.BatchOperationStarted}); + return this.executorService.exec(execParams) + .pipe( + map((res) => groupBy(res, 'type')), + tap(this.handleExecResult.bind(this)), + tap(() => this.events$.next({type: EventType.BatchOperationFinished})), + map(() => null), + catchError((err) => { + this.events$.next({type: EventType.BatchOperationFailed}); + return throwError(err); + }) + ); + } + + protected abstract toExecParams(params: any[]): any[]; + + protected abstract handleExecResult(group: ExecResultGroup): void; +} diff --git a/src/app/payment-adjustment/create-and-capture/adjustment-operations/adjustment-params.ts b/src/app/payment-adjustment/create-and-capture/adjustment-operations/adjustment-params.ts new file mode 100644 index 00000000..951b2e84 --- /dev/null +++ b/src/app/payment-adjustment/create-and-capture/adjustment-operations/adjustment-params.ts @@ -0,0 +1,22 @@ +import { InvoicePaymentAdjustmentParams, UserInfo } from '../../../gen-damsel/payment_processing'; + +export interface PaymentAdjustmentCreationParams { + user: UserInfo; + invoiceId: string; + paymentId: string; + params: InvoicePaymentAdjustmentParams; +} + +export interface PaymentAdjustmentCancelParams { + user: UserInfo; + invoiceId: string; + paymentId: string; + adjustmentId: string; +} + +export interface PaymentAdjustmentCaptureParams { + user: UserInfo; + invoiceId: string; + paymentId: string; + adjustmentId: string; +} diff --git a/src/app/payment-adjustment/create-and-capture/adjustment-operations/batch-payment-adjustment.service.ts b/src/app/payment-adjustment/create-and-capture/adjustment-operations/batch-payment-adjustment.service.ts new file mode 100644 index 00000000..a9d21ab4 --- /dev/null +++ b/src/app/payment-adjustment/create-and-capture/adjustment-operations/batch-payment-adjustment.service.ts @@ -0,0 +1,51 @@ +import { Injectable } from '@angular/core'; +import { Observable, of, Subject } from 'rxjs'; +import { mergeAll } from 'rxjs/internal/operators'; + +import { CaptureAdjustmentService } from './capture-adjustment.service'; +import { CancelAdjustmentService } from './cancel-adjustment.service'; +import { CreateAdjustmentService } from './create-adjustment.service'; +import { AdjustmentOperationEvent } from './adjustment-event'; +import { + PaymentAdjustmentCancelParams, + PaymentAdjustmentCaptureParams, + PaymentAdjustmentCreationParams +} from './adjustment-params'; + +@Injectable() +export class BatchPaymentAdjustmentService { + + progress$: Subject = new Subject(); + + events$: Subject = new Subject(); + + constructor( + private createAdjustmentService: CreateAdjustmentService, + private cancelAdjustmentService: CancelAdjustmentService, + private captureAdjustmentService: CaptureAdjustmentService + ) { + of(this.createAdjustmentService.events$, this.cancelAdjustmentService.events$, this.captureAdjustmentService.events$) + .pipe(mergeAll()) + .subscribe((event) => { + this.events$.next(event); + }); + of(this.createAdjustmentService.progress$, this.cancelAdjustmentService.progress$, this.captureAdjustmentService.progress$) + .pipe(mergeAll()) + .subscribe((event) => { + this.progress$.next(event); + }); + + } + + create(params: PaymentAdjustmentCreationParams[]): Observable { + return this.createAdjustmentService.batch(params); + } + + cancel(params: PaymentAdjustmentCancelParams[]): Observable { + return this.cancelAdjustmentService.batch(params); + } + + capture(params: PaymentAdjustmentCaptureParams[]): Observable { + return this.captureAdjustmentService.batch(params); + } +} diff --git a/src/app/payment-adjustment/create-and-capture/adjustment-operations/cancel-adjustment.service.ts b/src/app/payment-adjustment/create-and-capture/adjustment-operations/cancel-adjustment.service.ts new file mode 100644 index 00000000..72e0e141 --- /dev/null +++ b/src/app/payment-adjustment/create-and-capture/adjustment-operations/cancel-adjustment.service.ts @@ -0,0 +1,59 @@ +import { AdjustmentOperationService } from './adjustment-operation.service'; +import { ExecErrorResult, ExecResultType } from '../executor.service'; +import { + AdjustmentOperationEvent, + EventType, + OperationError, + OperationFailedPayload +} from './adjustment-event'; +import { CancelPaymentAdjustmentErrorCodes } from './error-codes'; +import { ExecResultGroup } from './exec-result-group'; +import { PaymentAdjustmentCancelParams } from './adjustment-params'; + +export class CancelAdjustmentService extends AdjustmentOperationService { + + protected toExecParams(cancelParams: any[]): any[] { + return cancelParams.map((params) => ({ + fn: this.manager.cancelPaymentAdjustment, + context: this.manager, + params + })); + } + + protected handleExecResult(group: ExecResultGroup): void { + const {success, error} = group; + if (success) { + this.events$.next({ + type: EventType.PaymentAdjustmentsCancelled, + operationType: ExecResultType.success, + payload: success.map(({container: {params}}) => params) + } as AdjustmentOperationEvent); + } + if (error) { + this.events$.next({ + type: EventType.CancelPaymentAdjustmentFailed, + operationType: ExecResultType.error, + payload: this.toErrorPayload(error) + } as OperationError); + } + } + + private toErrorPayload(result: ExecErrorResult[]): OperationFailedPayload[] { + return result.map((error) => { + const {exception, container: {params}} = error; + const errorCodes = [ + 'InvalidUser', + 'InvoiceNotFound', + 'InvoicePaymentNotFound', + 'InvoicePaymentAdjustmentNotFound', + 'InvalidPaymentAdjustmentStatus' + ]; + return { + code: errorCodes.includes(exception.name) + ? exception.name + : 'InternalServer', + operationScope: params + }; + }); + } +} diff --git a/src/app/payment-adjustment/create-and-capture/adjustment-operations/capture-adjustment.service.ts b/src/app/payment-adjustment/create-and-capture/adjustment-operations/capture-adjustment.service.ts new file mode 100644 index 00000000..71c5a557 --- /dev/null +++ b/src/app/payment-adjustment/create-and-capture/adjustment-operations/capture-adjustment.service.ts @@ -0,0 +1,59 @@ +import { AdjustmentOperationService } from './adjustment-operation.service'; +import { ExecErrorResult, ExecResultType } from '../executor.service'; +import { + AdjustmentOperationEvent, + EventType, + OperationError, + OperationFailedPayload +} from './adjustment-event'; +import { CapturePaymentAdjustmentErrorCodes } from './error-codes'; +import { ExecResultGroup } from './exec-result-group'; +import { PaymentAdjustmentCaptureParams } from './adjustment-params'; + +export class CaptureAdjustmentService extends AdjustmentOperationService { + + protected toExecParams(captureParams: any[]): any[] { + return captureParams.map((params) => ({ + fn: this.manager.capturePaymentAdjustment, + context: this.manager, + params + })); + } + + protected handleExecResult(group: ExecResultGroup): void { + const {success, error} = group; + if (success) { + this.events$.next({ + type: EventType.PaymentAdjustmentsCaptured, + operationType: ExecResultType.success, + payload: success.map(({container: {params}}) => params) + } as AdjustmentOperationEvent); + } + if (error) { + this.events$.next({ + type: EventType.CapturePaymentAdjustmentFailed, + operationType: ExecResultType.error, + payload: this.toErrorPayload(error) + } as OperationError); + } + } + + private toErrorPayload(result: ExecErrorResult[]): OperationFailedPayload[] { + return result.map((error) => { + const {exception, container: {params}} = error; + const errorCodes = [ + 'InvalidUser', + 'InvoiceNotFound', + 'InvoicePaymentNotFound', + 'InvoicePaymentAdjustmentNotFound', + 'InvalidPaymentAdjustmentStatus' + ]; + return { + code: errorCodes.includes(exception.name) + ? exception.name + : 'InternalServer', + operationScope: params + }; + }); + } +} diff --git a/src/app/payment-adjustment/create-and-capture/adjustment-operations/create-adjustment.service.ts b/src/app/payment-adjustment/create-and-capture/adjustment-operations/create-adjustment.service.ts new file mode 100644 index 00000000..aedd1a06 --- /dev/null +++ b/src/app/payment-adjustment/create-and-capture/adjustment-operations/create-adjustment.service.ts @@ -0,0 +1,69 @@ +import { ExecErrorResult, ExecResultType, ExecSuccessResult } from '../executor.service'; +import { AdjustmentOperationService } from './adjustment-operation.service'; +import { + AdjustmentOperationEvent, + EventType, + OperationError, + OperationFailedPayload +} from './adjustment-event'; +import { CreatePaymentAdjustmentErrorCodes } from './error-codes'; +import { ExecResultGroup } from './exec-result-group'; +import { PaymentAdjustmentCreationScope } from './payment-adjustment-creation-scope'; + +export class CreateAdjustmentService extends AdjustmentOperationService { + + protected toExecParams(creationParams: any[]): any[] { + return creationParams.map((params) => ({ + fn: this.manager.createPaymentAdjustment, + context: this.manager, + params + })); + } + + protected handleExecResult(group: ExecResultGroup): void { + const {success, error} = group; + if (success) { + this.events$.next({ + type: EventType.PaymentAdjustmentsCreated, + operationType: ExecResultType.success, + payload: this.toSuccessPayload(success) + } as AdjustmentOperationEvent); + } + if (error) { + this.events$.next({ + type: EventType.CreatePaymentAdjustmentFailed, + operationType: ExecResultType.error, + payload: this.toErrorPayload(error) + } as OperationError); + } + } + + private toSuccessPayload(result: ExecSuccessResult[]): PaymentAdjustmentCreationScope[] { + return result.map(({data, container: {params}}) => ({ + adjustmentId: data && data.id, + creationParams: params + } as PaymentAdjustmentCreationScope)); + } + + private toErrorPayload(result: ExecErrorResult[]): OperationFailedPayload[] { + return result.map((error) => { + const {exception, container: {params}} = error; + const errorCodes = [ + 'InvoicePaymentAdjustmentPending', + 'InvalidPaymentStatus', + 'InvoicePaymentNotFound', + 'InvoiceNotFound', + 'InvalidUser' + ]; + return { + code: errorCodes.includes(exception.name) + ? exception.name + : 'InternalServer', + operationScope: { + creationParams: params, + adjustmentId: exception.id ? exception.id : null + } + }; + }); + } +} diff --git a/src/app/payment-adjustment/create-and-capture/adjustment-operations/error-codes.ts b/src/app/payment-adjustment/create-and-capture/adjustment-operations/error-codes.ts new file mode 100644 index 00000000..443010d7 --- /dev/null +++ b/src/app/payment-adjustment/create-and-capture/adjustment-operations/error-codes.ts @@ -0,0 +1,23 @@ +export enum CreatePaymentAdjustmentErrorCodes { + InvoicePaymentAdjustmentPending = 'InvoicePaymentAdjustmentPending', + InvalidPaymentStatus = 'InvalidPaymentStatus', + InvoicePaymentNotFound = 'InvoicePaymentNotFound', + InvoiceNotFound = 'InvoiceNotFound', + InvalidUser = 'InvalidUser' +} + +export enum CancelPaymentAdjustmentErrorCodes { + InvalidUser = 'InvalidUser', + InvoiceNotFound = 'InvoiceNotFound', + InvoicePaymentNotFound = 'InvoicePaymentNotFound', + InvoicePaymentAdjustmentNotFound = 'InvoicePaymentAdjustmentNotFound', + InvalidPaymentAdjustmentStatus = 'InvalidPaymentAdjustmentStatus' +} + +export enum CapturePaymentAdjustmentErrorCodes { + InvalidUser = 'InvalidUser', + InvoiceNotFound = 'InvoiceNotFound', + InvoicePaymentNotFound = 'InvoicePaymentNotFound', + InvoicePaymentAdjustmentNotFound = 'InvoicePaymentAdjustmentNotFound', + InvalidPaymentAdjustmentStatus = 'InvalidPaymentAdjustmentStatus' +} diff --git a/src/app/payment-adjustment/create-and-capture/adjustment-operations/exec-result-group.ts b/src/app/payment-adjustment/create-and-capture/adjustment-operations/exec-result-group.ts new file mode 100644 index 00000000..5a30e757 --- /dev/null +++ b/src/app/payment-adjustment/create-and-capture/adjustment-operations/exec-result-group.ts @@ -0,0 +1,6 @@ +import { ExecErrorResult, ExecSuccessResult } from '../executor.service'; + +export interface ExecResultGroup { + success?: ExecSuccessResult[]; + error?: ExecErrorResult[]; +} diff --git a/src/app/payment-adjustment/create-and-capture/adjustment-operations/index.ts b/src/app/payment-adjustment/create-and-capture/adjustment-operations/index.ts new file mode 100644 index 00000000..01aa79b9 --- /dev/null +++ b/src/app/payment-adjustment/create-and-capture/adjustment-operations/index.ts @@ -0,0 +1,8 @@ +export * from './adjustment-event'; +export * from './error-codes'; +export * from './adjustment-params'; +export * from './payment-adjustment-creation-scope'; +export * from './create-adjustment.service'; +export * from './cancel-adjustment.service'; +export * from './capture-adjustment.service'; +export * from './batch-payment-adjustment.service'; diff --git a/src/app/payment-adjustment/create-and-capture/adjustment-operations/payment-adjustment-creation-scope.ts b/src/app/payment-adjustment/create-and-capture/adjustment-operations/payment-adjustment-creation-scope.ts new file mode 100644 index 00000000..1b156878 --- /dev/null +++ b/src/app/payment-adjustment/create-and-capture/adjustment-operations/payment-adjustment-creation-scope.ts @@ -0,0 +1,6 @@ +import { PaymentAdjustmentCreationParams } from './adjustment-params'; + +export interface PaymentAdjustmentCreationScope { + adjustmentId?: string; + creationParams: PaymentAdjustmentCreationParams; +} diff --git a/src/app/payment-adjustment/create-and-capture/cancel-actions/cancel-actions.component.html b/src/app/payment-adjustment/create-and-capture/cancel-actions/cancel-actions.component.html new file mode 100644 index 00000000..d09cce48 --- /dev/null +++ b/src/app/payment-adjustment/create-and-capture/cancel-actions/cancel-actions.component.html @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + diff --git a/src/app/payment-adjustment/create-and-capture/cancel-actions/cancel-actions.component.ts b/src/app/payment-adjustment/create-and-capture/cancel-actions/cancel-actions.component.ts new file mode 100644 index 00000000..4aecc3dc --- /dev/null +++ b/src/app/payment-adjustment/create-and-capture/cancel-actions/cancel-actions.component.ts @@ -0,0 +1,98 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { MatSnackBar } from '@angular/material'; +import forEach from 'lodash-es/forEach'; +import groupBy from 'lodash-es/groupBy'; + +import { + AdjustmentOperationEvent, + BatchPaymentAdjustmentService, + CancelPaymentAdjustmentErrorCodes, + EventType, + OperationFailedPayload, + PaymentAdjustmentCancelParams, +} from '../adjustment-operations'; +import { InvoicePaymentAdjustmentParams } from '../../../gen-damsel/payment_processing'; + +type FailedPayload = OperationFailedPayload; + +@Component({ + selector: 'cc-cancel-actions', + templateUrl: 'cancel-actions.component.html' +}) +export class CancelActionsComponent implements OnInit { + + @Input() + adjustmentParams: InvoicePaymentAdjustmentParams; + + @Input() + isLoading = false; + + cancelResult: PaymentAdjustmentCancelParams[] = []; + failedInvalidStatus: FailedPayload[] = []; + failedAdjustmentNotFound: FailedPayload[] = []; + failedInvoiceNotFound: FailedPayload[] = []; + failedInvalidUser: FailedPayload[] = []; + failedInternal: FailedPayload[] = []; + failedInvoicePaymentNotFound: FailedPayload[] = []; + + constructor(private batchAdjustmentService: BatchPaymentAdjustmentService, + private snackBar: MatSnackBar) { + } + + ngOnInit() { + this.batchAdjustmentService.events$.subscribe((event) => { + switch (event.type) { + case EventType.PaymentAdjustmentsCancelled: + this.cancelResult = this.cancelResult.concat((event as AdjustmentOperationEvent).payload); + break; + case EventType.CancelPaymentAdjustmentFailed: + const infoGroup = groupBy(event.payload, 'code'); + const Codes = CancelPaymentAdjustmentErrorCodes; + forEach(infoGroup, (payloads, code) => { + switch (code) { + case Codes.InvalidPaymentAdjustmentStatus: + this.failedInvalidStatus = this.failedInvalidStatus.concat(payloads); + break; + case Codes.InvoicePaymentAdjustmentNotFound: + this.failedAdjustmentNotFound = this.failedAdjustmentNotFound.concat(payloads); + break; + case Codes.InvoiceNotFound: + this.failedInvoiceNotFound = this.failedInvoiceNotFound.concat(payloads); + break; + case Codes.InvalidUser: + this.failedInvalidUser = this.failedInvalidUser.concat(payloads); + break; + case Codes.InvoicePaymentNotFound: + this.failedInvoicePaymentNotFound = this.failedInvoicePaymentNotFound.concat(payloads); + break; + case 'InternalServer': + this.failedInternal = this.failedInternal.concat(payloads); + break; + } + }); + break; + } + }); + } + + recreate() { + const createParams = this.cancelResult.map(({user, invoiceId, paymentId}) => ({ + user, + invoiceId, + paymentId, + params: this.adjustmentParams + })); + this.cancelResult = []; + this.batchAdjustmentService.create(createParams).subscribe(null, () => { + this.snackBar.open('An error occurred while adjustments create'); + }); + } + + retry() { + const cancelParams = this.failedInternal.map(({operationScope}) => operationScope); + this.failedInternal = []; + this.batchAdjustmentService.cancel(cancelParams).subscribe(null, () => { + this.snackBar.open('An error occurred while adjustments cancel'); + }); + } +} diff --git a/src/app/payment-adjustment/create-and-capture/capture-actions/capture-actions.component.html b/src/app/payment-adjustment/create-and-capture/capture-actions/capture-actions.component.html new file mode 100644 index 00000000..6ec27655 --- /dev/null +++ b/src/app/payment-adjustment/create-and-capture/capture-actions/capture-actions.component.html @@ -0,0 +1,28 @@ + + + + + + + + + + + + diff --git a/src/app/payment-adjustment/create-and-capture/capture-actions/capture-actions.component.ts b/src/app/payment-adjustment/create-and-capture/capture-actions/capture-actions.component.ts new file mode 100644 index 00000000..1ea32972 --- /dev/null +++ b/src/app/payment-adjustment/create-and-capture/capture-actions/capture-actions.component.ts @@ -0,0 +1,78 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { MatSnackBar } from '@angular/material'; +import { + BatchPaymentAdjustmentService, + CancelPaymentAdjustmentErrorCodes, + EventType, + OperationFailedPayload, + PaymentAdjustmentCaptureParams +} from '../adjustment-operations'; +import forEach from 'lodash-es/forEach'; +import groupBy from 'lodash-es/groupBy'; + +type FailedPayload = OperationFailedPayload; + +@Component({ + selector: 'cc-capture-actions', + templateUrl: 'capture-actions.component.html' +}) +export class CaptureActionsComponent implements OnInit { + + @Input() + isLoading = false; + + failedInvalidUser: FailedPayload[] = []; + failedInvoiceNotFound: FailedPayload[] = []; + failedPaymentNotFound: FailedPayload[] = []; + failedAdjustmentNotFound: FailedPayload[] = []; + failedAdjustmentStatus: FailedPayload[] = []; + failedInternal: FailedPayload[] = []; + + constructor(private batchAdjustmentService: BatchPaymentAdjustmentService, + private snackBar: MatSnackBar) { + } + + ngOnInit() { + this.batchAdjustmentService.events$.subscribe((event) => { + switch (event.type) { + case EventType.PaymentAdjustmentsCaptured: + this.snackBar.open(`${event.payload.length} payment(s) successfully captured`, 'OK', {duration: 3000}); + break; + case EventType.CapturePaymentAdjustmentFailed: + const infoGroup = groupBy(event.payload, 'code'); + const Codes = CancelPaymentAdjustmentErrorCodes; + forEach(infoGroup, (payloads, code) => { + switch (code) { + case Codes.InvalidUser: + this.failedInvalidUser = this.failedInvalidUser.concat(payloads); + break; + case Codes.InvoiceNotFound: + this.failedInvoiceNotFound = this.failedInvoiceNotFound.concat(payloads); + break; + case Codes.InvoicePaymentNotFound: + this.failedPaymentNotFound = this.failedPaymentNotFound.concat(payloads); + break; + case Codes.InvoicePaymentAdjustmentNotFound: + this.failedAdjustmentNotFound = this.failedAdjustmentNotFound.concat(payloads); + break; + case Codes.InvalidPaymentAdjustmentStatus: + this.failedAdjustmentStatus = this.failedAdjustmentStatus.concat(payloads); + break; + case 'InternalServer': + this.failedInternal = this.failedInternal.concat(payloads); + break; + } + }); + break; + } + }); + } + + retry() { + const captureParams = this.failedInternal.map(({operationScope}) => operationScope); + this.failedInternal = []; + this.batchAdjustmentService.capture(captureParams).subscribe(null, () => { + this.snackBar.open('An error occurred while adjustments capture'); + }); + } +} diff --git a/src/app/payment-adjustment/create-and-capture/create-actions/create-actions.component.html b/src/app/payment-adjustment/create-and-capture/create-actions/create-actions.component.html new file mode 100644 index 00000000..fcd1b8ce --- /dev/null +++ b/src/app/payment-adjustment/create-and-capture/create-actions/create-actions.component.html @@ -0,0 +1,36 @@ + + + + + + + + + + + + diff --git a/src/app/payment-adjustment/create-and-capture/create-actions/create-actions.component.ts b/src/app/payment-adjustment/create-and-capture/create-actions/create-actions.component.ts new file mode 100644 index 00000000..89fafba0 --- /dev/null +++ b/src/app/payment-adjustment/create-and-capture/create-actions/create-actions.component.ts @@ -0,0 +1,104 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { MatSnackBar } from '@angular/material'; +import groupBy from 'lodash-es/groupBy'; +import forEach from 'lodash-es/forEach'; + +import { + EventType, + OperationFailedPayload, + AdjustmentOperationEvent, + BatchPaymentAdjustmentService, + PaymentAdjustmentCreationScope +} from '../adjustment-operations'; +import { CreatePaymentAdjustmentErrorCodes } from '../adjustment-operations'; + +type FailedPayload = OperationFailedPayload; + +@Component({ + selector: 'cc-create-actions', + templateUrl: 'create-actions.component.html' +}) +export class CreateActionsComponent implements OnInit { + + @Input() + isLoading = false; + + createResult: PaymentAdjustmentCreationScope[] = []; + failedPending: FailedPayload[] = []; + failedInternal: FailedPayload[] = []; + failedInvalidPaymentStatus: FailedPayload[] = []; + failedInvoiceNotFound: FailedPayload[] = []; + failedInvalidUser: FailedPayload[] = []; + + constructor(private batchAdjustmentService: BatchPaymentAdjustmentService, + private snackBar: MatSnackBar) { + } + + ngOnInit() { + this.batchAdjustmentService.events$.subscribe((event) => { + switch (event.type) { + case EventType.PaymentAdjustmentsCreated: + this.createResult = this.createResult.concat((event as AdjustmentOperationEvent).payload); + break; + case EventType.CreatePaymentAdjustmentFailed: + const infoGroup = groupBy(event.payload, 'code'); + const Codes = CreatePaymentAdjustmentErrorCodes; + forEach(infoGroup, (payloads, code) => { + switch (code) { + case Codes.InvoicePaymentAdjustmentPending: + this.failedPending = this.failedPending.concat(payloads); + break; + case Codes.InvalidPaymentStatus: + this.failedInvalidPaymentStatus = this.failedInvalidPaymentStatus.concat(payloads); + break; + case Codes.InvoiceNotFound: + this.failedInvoiceNotFound = this.failedInvoiceNotFound.concat(payloads); + break; + case Codes.InvalidUser: + this.failedInvalidUser = this.failedInvalidUser.concat(payloads); + break; + case 'InternalServer': + this.failedInternal = this.failedInternal.concat(payloads); + break; + } + }); + break; + } + }); + } + + capture() { + const captureParams = this.createResult.map(({adjustmentId, creationParams}) => ({ + user: creationParams.user, + invoiceId: creationParams.invoiceId, + paymentId: creationParams.paymentId, + adjustmentId + })); + this.createResult = []; + this.batchAdjustmentService.capture(captureParams).subscribe(() => { + }, () => { + this.snackBar.open('An error occurred while adjustments capture'); + }); + } + + cancelPending() { + const cancelParams = this.failedPending.map(({operationScope: {creationParams, adjustmentId}}) => ({ + user: creationParams.user, + invoiceId: creationParams.invoiceId, + paymentId: creationParams.paymentId, + adjustmentId + })); + this.failedPending = []; + this.batchAdjustmentService.cancel(cancelParams).subscribe(null, () => { + this.snackBar.open('An error occurred while adjustments cancel'); + }); + } + + retryFailedInternal() { + const createParams = this.failedInternal.map((item) => item.operationScope.creationParams); + this.failedInternal = []; + this.batchAdjustmentService.create(createParams).subscribe(null, () => { + this.snackBar.open('An error occurred while adjustments create'); + }); + } +} diff --git a/src/app/payment-adjustment/create-and-capture/create-and-capture.component.html b/src/app/payment-adjustment/create-and-capture/create-and-capture.component.html new file mode 100644 index 00000000..00ef46e2 --- /dev/null +++ b/src/app/payment-adjustment/create-and-capture/create-and-capture.component.html @@ -0,0 +1,31 @@ +

Payment adjustment{{payments.length === 1 ? '' : 's'}} for {{payments.length}} payment{{payments.length === 1 ? '' : 's'}}

+ +
+
+
+ + + + + + + +
+ +
+
+
+ + + +
+
+
+ +
+ +
+ +
\ No newline at end of file diff --git a/src/app/payment-adjustment/create-and-capture/create-and-capture.component.ts b/src/app/payment-adjustment/create-and-capture/create-and-capture.component.ts new file mode 100644 index 00000000..117a8ff1 --- /dev/null +++ b/src/app/payment-adjustment/create-and-capture/create-and-capture.component.ts @@ -0,0 +1,96 @@ +import { Component, Inject, OnInit } from '@angular/core'; +import { MAT_DIALOG_DATA, MatDialog, MatDialogRef, MatSnackBar } from '@angular/material'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { Subject } from 'rxjs'; +import { KeycloakService } from 'keycloak-angular'; + +import { InvoicePaymentAdjustmentParams, UserInfo } from '../../gen-damsel/payment_processing'; +import { StatPayment } from '../../gen-damsel/merch_stat'; +import { ExecutorService } from './executor.service'; +import { + CreateAdjustmentService, + CancelAdjustmentService, + CaptureAdjustmentService, + BatchPaymentAdjustmentService, + EventType +} from './adjustment-operations'; + +@Component({ + selector: 'cc-create-and-capture-payment-adjustment', + templateUrl: './create-and-capture.component.html', + providers: [ + ExecutorService, + BatchPaymentAdjustmentService, + CreateAdjustmentService, + CancelAdjustmentService, + CaptureAdjustmentService + ] +}) +export class CreateAndCaptureComponent implements OnInit { + + form: FormGroup; + + isLoading: boolean; + + payments: StatPayment[]; + + progress$: Subject; + + createStarted = false; + + adjustmentParams: InvoicePaymentAdjustmentParams; + + constructor(private dialogRef: MatDialogRef, + private dialog: MatDialog, + private batchAdjustmentService: BatchPaymentAdjustmentService, + @Inject(MAT_DIALOG_DATA) data: StatPayment[], + private snackBar: MatSnackBar, + private keycloakService: KeycloakService, + private fb: FormBuilder) { + this.payments = data; + } + + ngOnInit() { + this.form = this.fb.group({ + revision: ['', Validators.required], + reason: ['', Validators.required] + }); + this.progress$ = this.batchAdjustmentService.progress$; + this.batchAdjustmentService.events$.subscribe((event) => { + switch (event.type) { + case EventType.BatchOperationStarted: + this.isLoading = true; + break; + case EventType.BatchOperationFailed: + case EventType.BatchOperationFinished: + this.isLoading = false; + break; + } + }); + } + + create() { + const {value: {revision, reason}} = this.form; + this.adjustmentParams = {domainRevision: revision, reason}; + this.createStarted = true; + this.form.disable(); + const createParams = this.payments.map(({invoiceId, id}) => ({ + user: this.getUser(), + invoiceId, + paymentId: id, + params: this.adjustmentParams + })); + this.batchAdjustmentService.create(createParams).subscribe(null, () => { + this.form.enable(); + this.createStarted = false; + this.snackBar.open('An error occurred while adjustments creating'); + }); + } + + private getUser(): UserInfo { + return { + id: this.keycloakService.getUsername(), + type: {internalUser: {}} + }; + } +} diff --git a/src/app/payment-adjustment/create-and-capture/executor.service.ts b/src/app/payment-adjustment/create-and-capture/executor.service.ts new file mode 100644 index 00000000..85723a1d --- /dev/null +++ b/src/app/payment-adjustment/create-and-capture/executor.service.ts @@ -0,0 +1,72 @@ +import { Injectable } from '@angular/core'; +import { catchError, map, switchMap } from 'rxjs/operators'; +import { forkJoin, Observable, of, Subject } from 'rxjs'; +import flatten from 'lodash-es/flatten'; + +export enum ExecResultType { + success = 'success', + error = 'error' +} + +export interface ExecResult { + type: ExecResultType; + container: ExecContainer; +} + +export interface ExecContainer { + fn: (...args: any[]) => Observable; + context: any; + params: object; +} + +export interface ExecSuccessResult extends ExecResult { + data: any; +} + +export interface ExecErrorResult extends ExecResult { + exception: any; +} + +@Injectable() +export class ExecutorService { + + progress$: Subject = new Subject(); + + exec(containers: ExecContainer[], execCount = 4): Observable { + const containerQueue = containers.slice(); + this.updateProgress(containers.length, 0); + const executor = (results: ExecResult[] = []) => { + const container = containerQueue.pop(); + this.updateProgress(containers.length, containers.length - containerQueue.length - execCount); + if (container) { + const {fn, context, params} = container; + const args = Object.entries(params).map((e) => e.length > 0 ? e[1] : null); + return fn.apply(context, args).pipe( + catchError((exception) => of({ + type: ExecResultType.error, + container, + exception + })), + switchMap((nextRes: any) => { + if (nextRes && nextRes.type === ExecResultType.error) { + return executor([...results, nextRes]); + } + return executor([...results, { + type: ExecResultType.success, + container, + data: nextRes + } as ExecSuccessResult]); + }) + ); + } + return of(results); + }; + const execs = new Array(execCount).fill([]).map(executor); + return forkJoin(execs).pipe(map((res) => flatten(res))); + } + + private updateProgress(length: number, value: number) { + const result = Math.min(Math.max(Math.round(value / length * 100), 0), 100); + this.progress$.next(result); + } +} diff --git a/src/app/payment-adjustment/payment-adjustment-routing.module.ts b/src/app/payment-adjustment/payment-adjustment-routing.module.ts new file mode 100644 index 00000000..3a2d4e09 --- /dev/null +++ b/src/app/payment-adjustment/payment-adjustment-routing.module.ts @@ -0,0 +1,19 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { PaymentAdjustmentComponent } from './payment-adjustment.component'; + +const routes: Routes = [{ + path: 'payment-adjustment', + component: PaymentAdjustmentComponent +}]; + +@NgModule({ + imports: [ + RouterModule.forChild(routes) + ], + exports: [ + RouterModule + ] +}) +export class PaymentAdjustmentRoutingModule { } diff --git a/src/app/payment-adjustment/payment-adjustment.component.html b/src/app/payment-adjustment/payment-adjustment.component.html new file mode 100644 index 00000000..b036ed56 --- /dev/null +++ b/src/app/payment-adjustment/payment-adjustment.component.html @@ -0,0 +1,49 @@ +
+
+ + +
Search payments
+
+ Found: {{payments.length}} +
+
+ + + + + + + + + + +
+ + +
Payment adjustment actions
+
+ Selected: {{selectedPayments.length}} +
+
+ Not selected +
+
+ + + + + +
+
+ +
+
+
diff --git a/src/app/payment-adjustment/payment-adjustment.component.ts b/src/app/payment-adjustment/payment-adjustment.component.ts new file mode 100644 index 00000000..ffb58e06 --- /dev/null +++ b/src/app/payment-adjustment/payment-adjustment.component.ts @@ -0,0 +1,70 @@ +import { Component } from '@angular/core'; +import { MatDialog, MatSnackBar } from '@angular/material'; + +import { PaymentAdjustmentService } from './payment-adjustment.service'; +import { CreateAndCaptureComponent } from './create-and-capture/create-and-capture.component'; +import { StatPayment } from '../gen-damsel/merch_stat'; +import { SearchFormParams } from './search-form/search-form-params'; +import { filter } from 'rxjs/internal/operators'; + +@Component({ + selector: 'cc-payment-adjustment', + templateUrl: './payment-adjustment.component.html', + styleUrls: ['../shared/container.css'] +}) +export class PaymentAdjustmentComponent { + + isLoading = false; + + payments: StatPayment[] = []; + + selectedPayments: StatPayment[] = []; + + searchParams: SearchFormParams; + + formValid: boolean; + + constructor( + private dialogRef: MatDialog, + private paymentAdjustmentService: PaymentAdjustmentService, + private snackBar: MatSnackBar + ) { + } + + formValueChanges(params: SearchFormParams) { + this.searchParams = params; + } + + formStatusChanges(status: string) { + this.formValid = status === 'VALID'; + } + + createAndCapturePaymentAdjustment() { + const ref = this.dialogRef.open(CreateAndCaptureComponent, { + width: '800px', + disableClose: true, + data: this.selectedPayments + }); + ref.afterClosed() + .pipe(filter((captured) => captured)) + .subscribe(() => this.search()); + } + + changeSelected(e) { + this.selectedPayments = e; + } + + search() { + this.isLoading = true; + this.paymentAdjustmentService.fetchPayments(this.searchParams).subscribe((payments) => { + this.payments = payments || []; + }, (e) => { + this.payments = []; + this.snackBar.open(`${e.message || 'Error'}`, 'OK'); + console.error(e); + }, () => { + this.selectedPayments = []; + this.isLoading = false; + }); + } +} diff --git a/src/app/payment-adjustment/payment-adjustment.module.ts b/src/app/payment-adjustment/payment-adjustment.module.ts new file mode 100644 index 00000000..baddf087 --- /dev/null +++ b/src/app/payment-adjustment/payment-adjustment.module.ts @@ -0,0 +1,82 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { + MatButtonModule, + MatCardModule, + MatCheckboxModule, + MatDatepickerModule, + MatDialogModule, + MatFormFieldModule, + MatInputModule, + MatListModule, + MatPaginatorModule, + MatProgressBarModule, + MatSelectModule, + MatSnackBarModule, + MatStepperModule, + MatTableModule, + MatTooltipModule +} from '@angular/material'; +import { CdkTableModule } from '@angular/cdk/table'; +import { ReactiveFormsModule } from '@angular/forms'; +import { FlexLayoutModule } from '@angular/flex-layout'; + +import { PaymentAdjustmentRoutingModule } from './payment-adjustment-routing.module'; +import { PaymentAdjustmentComponent } from './payment-adjustment.component'; +import { CreateAndCaptureComponent } from './create-and-capture/create-and-capture.component'; +import { TableComponent } from './table/table.component'; +import { SearchFormComponent } from './search-form/search-form.component'; +import { PaymentAdjustmentService } from './payment-adjustment.service'; +import { PapiModule } from '../papi/papi.module'; +import { ThriftModule } from '../thrift/thrift.module'; +import { ActionItemComponent } from './create-and-capture/action-item/action-item.component'; +import { CreateActionsComponent } from './create-and-capture/create-actions/create-actions.component'; +import { CancelActionsComponent } from './create-and-capture/cancel-actions/cancel-actions.component'; +import { CaptureActionsComponent } from './create-and-capture/capture-actions/capture-actions.component'; +import { SharedModule } from '../shared/shared.module'; + +@NgModule({ + imports: [ + CommonModule, + SharedModule, + PaymentAdjustmentRoutingModule, + FlexLayoutModule, + ReactiveFormsModule, + CdkTableModule, + MatCardModule, + MatProgressBarModule, + MatButtonModule, + MatFormFieldModule, + MatDialogModule, + MatInputModule, + MatTableModule, + MatSnackBarModule, + MatDatepickerModule, + MatCheckboxModule, + MatTooltipModule, + MatPaginatorModule, + MatStepperModule, + MatListModule, + PapiModule, + ThriftModule, + MatSelectModule + ], + declarations: [ + PaymentAdjustmentComponent, + CreateAndCaptureComponent, + TableComponent, + SearchFormComponent, + ActionItemComponent, + CreateActionsComponent, + CancelActionsComponent, + CaptureActionsComponent + ], + entryComponents: [ + CreateAndCaptureComponent + ], + providers: [ + PaymentAdjustmentService + ] +}) +export class PaymentAdjustmentModule { +} diff --git a/src/app/payment-adjustment/payment-adjustment.service.ts b/src/app/payment-adjustment/payment-adjustment.service.ts new file mode 100644 index 00000000..4733aab2 --- /dev/null +++ b/src/app/payment-adjustment/payment-adjustment.service.ts @@ -0,0 +1,52 @@ +import { Injectable } from '@angular/core'; +import { Observable, of } from 'rxjs'; +import { map, mergeMap } from 'rxjs/operators'; + +import { ReportService } from '../papi/report.service'; +import { SearchFormParams } from './search-form/search-form-params'; +import { MerchantStatisticsService } from '../thrift/merchant-statistics.service'; +import { StatPayment, StatResponse } from '../gen-damsel/merch_stat'; +import { QueryDSL } from '../query-dsl'; + +@Injectable() +export class PaymentAdjustmentService { + + constructor(private reportService: ReportService, private merchantStatisticsService: MerchantStatisticsService) { + } + + fetchPayments(params: SearchFormParams): Observable { + return this.getAllPayments(params).pipe(map((payments) => this.getFilteredPayments(payments, params.invoicesIds))); + } + + private getFilteredPayments(payments: StatPayment[], invoicesIds?: string[]): StatPayment[] { + return invoicesIds && invoicesIds.length + ? payments.filter((payment) => invoicesIds.find((id) => id === payment.invoiceId)) + : payments; + } + + private getPayments(params: SearchFormParams, continuationToken?: string): Observable { + const {fromRevision, toRevision, partyId, fromTime, toTime, status} = params; + return this.merchantStatisticsService.getPayments({ + dsl: JSON.stringify({ + query: { + payments: { + ...(partyId ? {merchant_id: partyId} : {}), + from_time: fromTime, + to_time: toTime, + from_payment_domain_revision: fromRevision, + to_payment_domain_revision: toRevision, + ...(status ? {payment_status: status} : {}) + } + } + } as QueryDSL), + ...(continuationToken ? {continuationToken} : {}) + }); + } + + private getAllPayments(params: SearchFormParams, continuationToken?: string, payments: StatPayment[] = []): Observable { + return this.getPayments(params, continuationToken).pipe(mergeMap((response) => { + const mergedPayments = [...payments, ...response.data.payments]; + return response.continuationToken ? this.getAllPayments(params, response.continuationToken) : of(mergedPayments); + })); + } +} diff --git a/src/app/payment-adjustment/search-form/search-form-params.ts b/src/app/payment-adjustment/search-form/search-form-params.ts new file mode 100644 index 00000000..e519f815 --- /dev/null +++ b/src/app/payment-adjustment/search-form/search-form-params.ts @@ -0,0 +1,9 @@ +export interface SearchFormParams { + fromTime: string; + toTime: string; + partyId: string; + invoicesIds: string[]; + fromRevision: string; + toRevision: string; + status: string; +} diff --git a/src/app/payment-adjustment/search-form/search-form.component.html b/src/app/payment-adjustment/search-form/search-form.component.html new file mode 100644 index 00000000..f0ae30f4 --- /dev/null +++ b/src/app/payment-adjustment/search-form/search-form.component.html @@ -0,0 +1,34 @@ +
+
+ + + + + + + + + + + + + + + + +
+
+ + + + + + + + + any + {{status}} + + +
+ diff --git a/src/app/payment-adjustment/search-form/search-form.component.ts b/src/app/payment-adjustment/search-form/search-form.component.ts new file mode 100644 index 00000000..b3a52533 --- /dev/null +++ b/src/app/payment-adjustment/search-form/search-form.component.ts @@ -0,0 +1,33 @@ +import { Component, EventEmitter, OnInit, Output } from '@angular/core'; +import { FormGroup } from '@angular/forms'; + +import { SearchFormService } from './search-form.service'; +import { SearchFormParams } from './search-form-params'; + +@Component({ + selector: 'cc-payment-adjustment-search-form', + templateUrl: './search-form.component.html', + providers: [SearchFormService] +}) +export class SearchFormComponent implements OnInit { + + @Output() + valueChanges: EventEmitter = new EventEmitter(); + + @Output() + statusChanges: EventEmitter = new EventEmitter(); + + form: FormGroup; + + statuses: string[] = ['pending', 'processed', 'captured', 'cancelled', 'refunded', 'failed']; + + constructor(private searchFormService: SearchFormService) { + } + + ngOnInit() { + const {form, formValueToSearchParams} = this.searchFormService; + this.form = form; + this.form.valueChanges.subscribe((value) => this.valueChanges.emit(formValueToSearchParams(value))); + this.form.statusChanges.subscribe((status) => this.statusChanges.emit(status)); + } +} diff --git a/src/app/payment-adjustment/search-form/search-form.service.ts b/src/app/payment-adjustment/search-form/search-form.service.ts new file mode 100644 index 00000000..f001645a --- /dev/null +++ b/src/app/payment-adjustment/search-form/search-form.service.ts @@ -0,0 +1,41 @@ +import { Injectable } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import * as moment from 'moment'; + +import { SearchFormParams } from './search-form-params'; + +@Injectable() +export class SearchFormService { + + form: FormGroup; + + constructor(private fb: FormBuilder) { + this.form = this.prepareForm(); + } + + formValueToSearchParams(value: any): SearchFormParams { + const {fromTime, toTime, partyId, invoicesIds, fromRevision, toRevision, status} = value; + return { + fromTime: moment(fromTime).startOf('day').utc().format(), + toTime: moment(toTime).endOf('day').utc().format(), + partyId, + invoicesIds: invoicesIds ? invoicesIds.split(',').map((part) => part.trim()) : null, + fromRevision, + toRevision, + status + }; + } + + private prepareForm(): FormGroup { + const defaultDate = [moment().utc().format(), Validators.required]; + return this.fb.group({ + fromTime: defaultDate, + toTime: defaultDate, + partyId: '', + invoicesIds: '', + fromRevision: ['', Validators.required], + toRevision: ['', Validators.required], + status: 'captured' + }); + } +} diff --git a/src/app/payment-adjustment/table/table.component.css b/src/app/payment-adjustment/table/table.component.css new file mode 100644 index 00000000..ccd39949 --- /dev/null +++ b/src/app/payment-adjustment/table/table.component.css @@ -0,0 +1,3 @@ +table { + width: 100%; +} \ No newline at end of file diff --git a/src/app/payment-adjustment/table/table.component.html b/src/app/payment-adjustment/table/table.component.html new file mode 100644 index 00000000..328cfd44 --- /dev/null +++ b/src/app/payment-adjustment/table/table.component.html @@ -0,0 +1,43 @@ +
Party ID {{ claim.partyId }}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + Revision{{ payment.domainRevision | ccThriftInt64 }}Invoice ID{{ payment.invoiceId }}Payment ID{{ payment.id }}Party ID{{ payment.ownerId }}Shop ID{{ payment.shopId }}Created at{{ payment.createdAt | date: "dd.MM.yyyy HH:mm:ss" }}
+ \ No newline at end of file diff --git a/src/app/payment-adjustment/table/table.component.ts b/src/app/payment-adjustment/table/table.component.ts new file mode 100644 index 00000000..34750563 --- /dev/null +++ b/src/app/payment-adjustment/table/table.component.ts @@ -0,0 +1,59 @@ +import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core'; +import { SelectionModel } from '@angular/cdk/collections'; + +import { MatPaginator, MatTableDataSource } from '@angular/material'; +import { StatPayment } from '../../gen-damsel/merch_stat'; + +@Component({ + selector: 'cc-payment-adjustment-table', + templateUrl: './table.component.html', + styleUrls: ['./table.component.css'] +}) +export class TableComponent implements OnInit, OnChanges { + + @Input() + payments: StatPayment[]; + + dataSource: MatTableDataSource; + + @Output() + changeSelected: EventEmitter = new EventEmitter(); + + selection = new SelectionModel(true, []); + + @ViewChild(MatPaginator) + paginator: MatPaginator; + + cols = [ + 'select', + 'revision', + 'invoiceId', + 'id', + 'createdAt', + 'shopId', + 'ownerId' + ]; + + ngOnInit() { + this.selection.onChange.subscribe((e) => this.changeSelected.emit(e.source.selected)); + } + + ngOnChanges(changes: SimpleChanges) { + if (changes.payments) { + this.selection.clear(); + this.changeSelected.emit([]); + this.dataSource = new MatTableDataSource(this.payments); + this.dataSource.paginator = this.paginator; + } + } + + masterToggle() { + this.isAllSelected() ? + this.selection.clear() : + this.payments.forEach((row) => this.selection.select(row)); + } + + isAllSelected() { + return this.selection.selected.length === this.payments.length; + } +} diff --git a/src/app/payouts/payouts-table/payouts-table.component.html b/src/app/payouts/payouts-table/payouts-table.component.html index 67f0d65c..d4482b05 100644 --- a/src/app/payouts/payouts-table/payouts-table.component.html +++ b/src/app/payouts/payouts-table/payouts-table.component.html @@ -1,4 +1,4 @@ - +
- +
+ +
diff --git a/src/app/query-dsl/index.ts b/src/app/query-dsl/index.ts new file mode 100644 index 00000000..7fc28f34 --- /dev/null +++ b/src/app/query-dsl/index.ts @@ -0,0 +1 @@ +export * from './query-dsl'; diff --git a/src/app/query-dsl/model-params.ts b/src/app/query-dsl/model-params.ts new file mode 100644 index 00000000..7144cfc1 --- /dev/null +++ b/src/app/query-dsl/model-params.ts @@ -0,0 +1,7 @@ +export interface ModelParams { + /** + * @deprecated + */ + from?: string; + size?: string; +} diff --git a/src/app/query-dsl/params.ts b/src/app/query-dsl/params.ts new file mode 100644 index 00000000..43347de5 --- /dev/null +++ b/src/app/query-dsl/params.ts @@ -0,0 +1,9 @@ +export interface Params { + merchant_id?: string; + shop_id?: string; + from_time?: string; + to_time?: string; + split_interval?: string; + from_payment_domain_revision?: string; + to_payment_domain_revision?: string; +} diff --git a/src/app/query-dsl/payment.ts b/src/app/query-dsl/payment.ts new file mode 100644 index 00000000..44bc0d9b --- /dev/null +++ b/src/app/query-dsl/payment.ts @@ -0,0 +1,17 @@ +import { InvoicePaymentFlow, InvoicePaymentStatus, PaymentTool, TerminalPaymentProvider } from '../gen-damsel/merch_stat'; + +export interface Payment { + payment_id?: string; + invoice_id?: string; + payment_email?: string; + payment_flow ?: InvoicePaymentFlow; + payment_method?: PaymentTool; + payment_terminal_provider?: TerminalPaymentProvider; + payment_ip?: string; + payment_fingerprint?: string; + payment_pan_mask?: string; + payment_customer_id?: string; + payment_amount?: string; + payment_status?: InvoicePaymentStatus; + payment_domain_revision?: string; +} diff --git a/src/app/query-dsl/query-dsl.ts b/src/app/query-dsl/query-dsl.ts new file mode 100644 index 00000000..9e0d5054 --- /dev/null +++ b/src/app/query-dsl/query-dsl.ts @@ -0,0 +1,9 @@ +import { Payment } from './payment'; +import { Params } from './params'; +import { ModelParams } from './model-params'; + +export interface QueryDSL { + query: { + payments?: Payment & Params & ModelParams + }; +} diff --git a/src/app/shared/papi-formatter.ts b/src/app/shared/papi-formatter.ts new file mode 100644 index 00000000..25e2a4ae --- /dev/null +++ b/src/app/shared/papi-formatter.ts @@ -0,0 +1,30 @@ +import camelCase from 'lodash-es/camelCase'; +import snakeCase from 'lodash-es/snakeCase'; +import isArray from 'lodash-es/isArray'; +import isObject from 'lodash-es/isObject'; + +export function encode(model: any): any { + if (isArray(model)) { + return model.map(encode); + } else if (isObject(model)) { + const result = {}; + for (const key of Object.keys(model)) { + result[snakeCase(key)] = encode(model[key]); + } + return result; + } + return model; +} + +export function decode(model: any): any { + if (isArray(model)) { + return model.map(decode); + } else if (isObject(model)) { + const result = {}; + for (const key of Object.keys(model)) { + result[camelCase(key)] = decode(model[key]); + } + return result; + } + return model; +} diff --git a/src/app/shared/pipes/format-amount.pipe.ts b/src/app/shared/pipes/format-amount.pipe.ts index 6ae17fd5..6a429793 100644 --- a/src/app/shared/pipes/format-amount.pipe.ts +++ b/src/app/shared/pipes/format-amount.pipe.ts @@ -13,8 +13,8 @@ export class FormatAmountPipe implements PipeTransform { function format(value: any, decimalLength: number, wholeLength: number, delimiter: string, decimalDelimiter: string) { const exp = '\\d(?=(\\d{' + (wholeLength || 3) + '})+' + (decimalLength > 0 ? '\\D' : '$') + ')'; - // tslint:disable-next-line - let num = value.toFixed(Math.max(0, ~~decimalLength)); + // tslint:disable-next-line:no-bitwise + const num = value.toFixed(Math.max(0, ~~decimalLength)); return (decimalDelimiter ? num.replace('.', decimalDelimiter) : num) .replace(new RegExp(exp, 'g'), '$&' + (delimiter || ',')); } diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 84ad67f3..14b339ad 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -4,6 +4,7 @@ import { PrettyJsonModule } from 'angular2-prettyjson'; import { CurrencyPipe } from './pipes/currency.pipe'; import { FormatAmountPipe } from './pipes/format-amount.pipe'; import { ThriftEncodePipe } from './thrift-encode.pipe'; +import { ThriftInt64Pipe } from './thrift-int64.pipe'; import { ThriftJsonComponent } from './components/thrift-json.component'; @NgModule({ @@ -14,12 +15,14 @@ import { ThriftJsonComponent } from './components/thrift-json.component'; CurrencyPipe, FormatAmountPipe, ThriftEncodePipe, + ThriftInt64Pipe, ThriftJsonComponent ], exports: [ CurrencyPipe, FormatAmountPipe, ThriftEncodePipe, + ThriftInt64Pipe, ThriftJsonComponent ], }) diff --git a/src/app/shared/thrift-int64.pipe.ts b/src/app/shared/thrift-int64.pipe.ts new file mode 100644 index 00000000..26f8ce3e --- /dev/null +++ b/src/app/shared/thrift-int64.pipe.ts @@ -0,0 +1,36 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'ccThriftInt64' +}) +export class ThriftInt64Pipe implements PipeTransform { + + transform(value: any, ...args: any[]): any { + return this.toNumber(value.buffer, value.offset); + } + + private toNumber(buffer: object, offset: number, allowImprecise = false) { + const b = buffer, o = offset; + /* tslint:disable:no-bitwise */ + // Running sum of octets, doing a 2's complement + const negate = b[o] & 0x80; + let x = 0, carry = 1; + for (let i = 7, m = 1; i >= 0; i--, m *= 256) { + let v = b[o + i]; + // 2's complement for negative numbers + if (negate) { + v = (v ^ 0xff) + carry; + carry = v >> 8; + v = v & 0xff; + } + x += v * m; + } + /* tslint:enable:no-bitwise */ + // Return Infinity if we've lost integer precision + const MAX_INT = Math.pow(2, 53); + if (!allowImprecise && x >= MAX_INT) { + return negate ? -Infinity : Infinity; + } + return negate ? -x : x; + } +} diff --git a/src/app/shared/thrift-js-formatter.ts b/src/app/shared/thrift-js-formatter.ts new file mode 100644 index 00000000..25e2a4ae --- /dev/null +++ b/src/app/shared/thrift-js-formatter.ts @@ -0,0 +1,30 @@ +import camelCase from 'lodash-es/camelCase'; +import snakeCase from 'lodash-es/snakeCase'; +import isArray from 'lodash-es/isArray'; +import isObject from 'lodash-es/isObject'; + +export function encode(model: any): any { + if (isArray(model)) { + return model.map(encode); + } else if (isObject(model)) { + const result = {}; + for (const key of Object.keys(model)) { + result[snakeCase(key)] = encode(model[key]); + } + return result; + } + return model; +} + +export function decode(model: any): any { + if (isArray(model)) { + return model.map(decode); + } else if (isObject(model)) { + const result = {}; + for (const key of Object.keys(model)) { + result[camelCase(key)] = decode(model[key]); + } + return result; + } + return model; +} diff --git a/src/app/shared/type-helpers/diff.ts b/src/app/shared/type-helpers/diff.ts new file mode 100644 index 00000000..58d67e12 --- /dev/null +++ b/src/app/shared/type-helpers/diff.ts @@ -0,0 +1 @@ +export type Diff = ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T]; diff --git a/src/app/shared/type-helpers/index.ts b/src/app/shared/type-helpers/index.ts new file mode 100644 index 00000000..ff22f880 --- /dev/null +++ b/src/app/shared/type-helpers/index.ts @@ -0,0 +1,2 @@ +export * from './diff'; +export * from './omit'; diff --git a/src/app/shared/type-helpers/omit.ts b/src/app/shared/type-helpers/omit.ts new file mode 100644 index 00000000..29944ff1 --- /dev/null +++ b/src/app/shared/type-helpers/omit.ts @@ -0,0 +1,3 @@ +import { Diff } from './diff'; + +export type Omit = Pick>; diff --git a/src/app/domain/domain-typed-manager/gen-conversion/index.ts b/src/app/thrift/converters/index.ts similarity index 81% rename from src/app/domain/domain-typed-manager/gen-conversion/index.ts rename to src/app/thrift/converters/index.ts index 2c0e3180..862d0f30 100644 --- a/src/app/domain/domain-typed-manager/gen-conversion/index.ts +++ b/src/app/thrift/converters/index.ts @@ -1,3 +1,4 @@ +export * from './to-gen-payment-adjustment'; export * from './to-gen-terminal-object'; export * from './to-gen-terminal-decision'; export * from './to-gen-domain-object'; diff --git a/src/app/domain/domain-typed-manager/gen-conversion/to-gen-commit.ts b/src/app/thrift/converters/to-gen-commit.ts similarity index 63% rename from src/app/domain/domain-typed-manager/gen-conversion/to-gen-commit.ts rename to src/app/thrift/converters/to-gen-commit.ts index 77294ac5..6eb103ee 100644 --- a/src/app/domain/domain-typed-manager/gen-conversion/to-gen-commit.ts +++ b/src/app/thrift/converters/to-gen-commit.ts @@ -1,20 +1,20 @@ -import * as DomainConfigTypes from '../../gen-nodejs/domain_config_types'; -import { Commit, InsertOp, Operation, UpdateOp } from '../../../damsel'; +import * as DomainConfigTypes from '../gen-nodejs/domain_config_types'; +import { Commit, InsertOp, Operation, UpdateOp } from '../../damsel'; -const toGenInsertOp = (insertOp: InsertOp): InsertOp => { +const toGenInsertOp = (insertOp: InsertOp) => { const insertOpGen = new DomainConfigTypes.InsertOp(); insertOpGen.object = insertOp.object; return insertOpGen; }; -const toGenUpdateOp = (updateOp: UpdateOp): UpdateOp => { +const toGenUpdateOp = (updateOp: UpdateOp) => { const updateOpGen = new DomainConfigTypes.UpdateOp(); updateOpGen.old_object = updateOp.oldObject; updateOpGen.new_object = updateOp.newObject; return updateOpGen; }; -const toGenOperation = (operation: Operation): Operation => { +const toGenOperation = (operation: Operation) => { const operationGen = new DomainConfigTypes.Operation(); if (operation.insert) { operationGen.insert = toGenInsertOp(operation.insert); @@ -24,10 +24,10 @@ const toGenOperation = (operation: Operation): Operation => { return operationGen; }; -const toGenCommitOps = (operations: Operation[]): Operation[] => +const toGenCommitOps = (operations: Operation[]) => operations.map((operation) => toGenOperation(operation)); -export const toGenCommit = (commit: Commit): Commit => { +export const toGenCommit = (commit: Commit) => { const genCommit = new DomainConfigTypes.Commit(); genCommit.ops = toGenCommitOps(commit.ops); return genCommit; diff --git a/src/app/domain/domain-typed-manager/gen-conversion/to-gen-domain-object.ts b/src/app/thrift/converters/to-gen-domain-object.ts similarity index 58% rename from src/app/domain/domain-typed-manager/gen-conversion/to-gen-domain-object.ts rename to src/app/thrift/converters/to-gen-domain-object.ts index e82e4ded..1150f5ef 100644 --- a/src/app/domain/domain-typed-manager/gen-conversion/to-gen-domain-object.ts +++ b/src/app/thrift/converters/to-gen-domain-object.ts @@ -1,7 +1,6 @@ -import * as DomainTypes from '../../gen-nodejs/domain_types'; -import { DomainObject } from '../../../damsel/domain'; +import * as DomainTypes from '../gen-nodejs/domain_types'; -export const toGenDomainObject = (genObject: any, field: string): DomainObject => { +export const toGenDomainObject = (genObject: any, field: string) => { const domainObjectGen = new DomainTypes.DomainObject(); domainObjectGen[field] = genObject; return domainObjectGen; diff --git a/src/app/thrift/converters/to-gen-payment-adjustment.ts b/src/app/thrift/converters/to-gen-payment-adjustment.ts new file mode 100644 index 00000000..3542f114 --- /dev/null +++ b/src/app/thrift/converters/to-gen-payment-adjustment.ts @@ -0,0 +1,9 @@ +import { InvoicePaymentAdjustmentParams, UserInfo } from '../../gen-damsel/payment_processing'; +import * as PaymentProcessingTypes from '../gen-nodejs/payment_processing_types'; + +export const toGenPaymentProcessingUserInfo = (user: UserInfo) => { + return new PaymentProcessingTypes.UserInfo(user); +}; + +export const toGenInvoicePaymentAdjustmentParams = (params: InvoicePaymentAdjustmentParams) => + new PaymentProcessingTypes.InvoicePaymentAdjustmentParams(params); diff --git a/src/app/domain/domain-typed-manager/gen-conversion/to-gen-reference.ts b/src/app/thrift/converters/to-gen-reference.ts similarity index 80% rename from src/app/domain/domain-typed-manager/gen-conversion/to-gen-reference.ts rename to src/app/thrift/converters/to-gen-reference.ts index b0805fef..2fc1df63 100644 --- a/src/app/domain/domain-typed-manager/gen-conversion/to-gen-reference.ts +++ b/src/app/thrift/converters/to-gen-reference.ts @@ -1,5 +1,5 @@ -import { Reference, Version } from '../../../damsel'; -import * as DomainConfigTypes from '../../gen-nodejs/domain_config_types'; +import { Reference, Version } from '../../damsel'; +import * as DomainConfigTypes from '../gen-nodejs/domain_config_types'; const toGenHead = () => { const reference = new DomainConfigTypes.Reference(); @@ -13,7 +13,7 @@ const toGenVersion = (version: Version) => { return reference; }; -export const toGenReference = (reference: Reference = {head: {}}): any => { +export const toGenReference = (reference: Reference = {head: {}}) => { let result; if (reference.head) { result = toGenHead(); diff --git a/src/app/domain/domain-typed-manager/gen-conversion/to-gen-terminal-decision.ts b/src/app/thrift/converters/to-gen-terminal-decision.ts similarity index 75% rename from src/app/domain/domain-typed-manager/gen-conversion/to-gen-terminal-decision.ts rename to src/app/thrift/converters/to-gen-terminal-decision.ts index 4523c079..56a77a65 100644 --- a/src/app/domain/domain-typed-manager/gen-conversion/to-gen-terminal-decision.ts +++ b/src/app/thrift/converters/to-gen-terminal-decision.ts @@ -1,4 +1,4 @@ -import * as DomainTypes from '../../gen-nodejs/domain_types'; +import * as DomainTypes from '../gen-nodejs/domain_types'; import { TerminalDecision, Predicate, @@ -7,22 +7,22 @@ import { PartyConditionDefinition, TerminalSelector, TerminalRef -} from '../../../damsel'; +} from '../../damsel'; -const toPartyConditionDefinitionGen = (definition: PartyConditionDefinition): PartyConditionDefinition => { +const toPartyConditionDefinitionGen = (definition: PartyConditionDefinition) => { const definitionGen = new DomainTypes.PartyConditionDefinition(); definitionGen.shop_is = definition.shopIs; return definitionGen; }; -const toPartyConditionGen = (partyCondition: PartyCondition): PartyCondition => { +const toPartyConditionGen = (partyCondition: PartyCondition) => { const partyConditionGen = new DomainTypes.PartyCondition(); partyConditionGen.id = partyCondition.id; partyConditionGen.definition = toPartyConditionDefinitionGen(partyCondition.definition); return partyConditionGen; }; -const toConditionGen = (condition: Condition): Condition => { +const toConditionGen = (condition: Condition) => { const conditionDef = new DomainTypes.Condition(); if (condition.party) { conditionDef.party = toPartyConditionGen(condition.party); @@ -30,7 +30,7 @@ const toConditionGen = (condition: Condition): Condition => { return conditionDef; }; -const toPredicateGen = (predicate: Predicate): Predicate => { +const toPredicateGen = (predicate: Predicate) => { const predicateGen = new DomainTypes.Predicate(); if (predicate.condition) { predicateGen.condition = toConditionGen(predicate.condition); @@ -38,13 +38,13 @@ const toPredicateGen = (predicate: Predicate): Predicate => { return predicateGen; }; -const toTerminalRefGen = (ref: TerminalRef): TerminalRef => { +const toTerminalRefGen = (ref: TerminalRef) => { const terminalRefGen = new DomainTypes.TerminalRef(); terminalRefGen.id = ref.id; return terminalRefGen; }; -const toTerminalSelectorGen = (selector: TerminalSelector): TerminalSelector => { +const toTerminalSelectorGen = (selector: TerminalSelector) => { const selectorGen = new DomainTypes.TerminalSelector(); if (selector.value) { selectorGen.value = selector.value.map((ref) => toTerminalRefGen(ref)); @@ -53,7 +53,7 @@ const toTerminalSelectorGen = (selector: TerminalSelector): TerminalSelector => }; -export const toGenTerminalDecision = (terminalDecision: TerminalDecision): TerminalDecision => { +export const toGenTerminalDecision = (terminalDecision: TerminalDecision) => { const terminalDecisionGen = new DomainTypes.TerminalDecision(); terminalDecisionGen.if_ = toPredicateGen(terminalDecision.if_); terminalDecisionGen.then_ = toTerminalSelectorGen(terminalDecision.then_); diff --git a/src/app/domain/domain-typed-manager/gen-conversion/to-gen-terminal-object.ts b/src/app/thrift/converters/to-gen-terminal-object.ts similarity index 62% rename from src/app/domain/domain-typed-manager/gen-conversion/to-gen-terminal-object.ts rename to src/app/thrift/converters/to-gen-terminal-object.ts index 1d3bfd92..b0b2a791 100644 --- a/src/app/domain/domain-typed-manager/gen-conversion/to-gen-terminal-object.ts +++ b/src/app/thrift/converters/to-gen-terminal-object.ts @@ -1,13 +1,13 @@ -import * as DomainTypes from '../../gen-nodejs/domain_types'; -import { Terminal, TerminalObject, TerminalRef } from '../../../damsel/domain'; +import * as DomainTypes from '../gen-nodejs/domain_types'; +import { Terminal, TerminalObject, TerminalRef } from '../../damsel/domain'; -const toGenTerminalRef = (ref: TerminalRef): TerminalRef => { +const toGenTerminalRef = (ref: TerminalRef) => { const terminalRef = new DomainTypes.TerminalRef(); terminalRef.id = ref.id; return terminalRef; }; -const toGenTerminal = (data: Terminal): Terminal => { +const toGenTerminal = (data: Terminal) => { const terminal = new DomainTypes.Terminal(); terminal.name = data.name; terminal.description = data.description; @@ -16,7 +16,7 @@ const toGenTerminal = (data: Terminal): Terminal => { return terminal; }; -export const toGenTerminalObject = (terminal: TerminalObject): TerminalObject => { +export const toGenTerminalObject = (terminal: TerminalObject) => { const terminalObjectGen = new DomainTypes.TerminalObject(); terminalObjectGen.ref = toGenTerminalRef(terminal.ref); terminalObjectGen.data = toGenTerminal(terminal.data); diff --git a/src/app/domain/domain-typed-manager/domain-typed-manager.ts b/src/app/thrift/domain-typed-manager.ts similarity index 87% rename from src/app/domain/domain-typed-manager/domain-typed-manager.ts rename to src/app/thrift/domain-typed-manager.ts index f4d2c71c..d6a36e62 100644 --- a/src/app/domain/domain-typed-manager/domain-typed-manager.ts +++ b/src/app/thrift/domain-typed-manager.ts @@ -8,13 +8,13 @@ import { ProviderObject, TerminalObject, PaymentInstitutionObject -} from '../../damsel/domain'; -import { Version } from '../../damsel'; -import { DmtService } from '../dmt.service'; -import { CreateTerminalParams } from './create-terminal-params'; -import { findDomainObject, findDomainObjects } from './utils'; -import { createShopTerminal } from './create-shop-terminal'; -import { toGenReference } from './gen-conversion'; +} from '../damsel/domain'; +import { Version } from '../damsel'; +import { CreateTerminalParams } from '../claim/domain-typed-manager/create-terminal-params'; +import { findDomainObject, findDomainObjects } from '../claim/domain-typed-manager/utils'; +import { createShopTerminal } from '../claim/domain-typed-manager/create-shop-terminal'; +import { toGenReference } from './converters'; +import { DomainService } from './domain.service'; const findBusinessScheduleObjects = (domain: Domain): BusinessScheduleObject[] => findDomainObjects(domain, 'business_schedule'); @@ -45,7 +45,7 @@ export class DomainTypedManager { private domain: Observable; - constructor(private dmtService: DmtService) { + constructor(private dmtService: DomainService) { this.domain = this.dmtService .checkout(toGenReference()) .pipe(map((snapshot) => snapshot.domain)); diff --git a/src/app/thrift/domain.service.ts b/src/app/thrift/domain.service.ts new file mode 100644 index 00000000..14bab96a --- /dev/null +++ b/src/app/thrift/domain.service.ts @@ -0,0 +1,20 @@ +import { Injectable, NgZone } from '@angular/core'; +import { Observable } from 'rxjs'; + +import * as Repository from './gen-nodejs/Repository'; +import { ThriftService } from './thrift-service'; + +@Injectable() +export class DomainService extends ThriftService { + + constructor(zone: NgZone) { + super(zone, '/v1/domain/repository', Repository); + } + + checkout: (reference: any) => + Observable = this.toObservableAction(this.client.Checkout.bind(this.client)); + + commit: (version: any, commit: any) => + Observable = this.toObservableAction(this.client.Commit.bind(this.client)); + +} diff --git a/src/app/thrift/merchant-statistics.service.ts b/src/app/thrift/merchant-statistics.service.ts new file mode 100644 index 00000000..5e6e6285 --- /dev/null +++ b/src/app/thrift/merchant-statistics.service.ts @@ -0,0 +1,19 @@ +import { Injectable, NgZone } from '@angular/core'; +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; + +import * as MerchantStatistics from './gen-nodejs/MerchantStatistics'; +import { ThriftService } from './thrift-service'; +import { StatRequest, StatResponse } from '../gen-damsel/merch_stat'; +import { StatRequest as ThriftStatRequest } from './gen-nodejs/merch_stat_types'; +import { decode, encode } from '../shared/thrift-js-formatter'; + +@Injectable() +export class MerchantStatisticsService extends ThriftService { + constructor(zone: NgZone) { + super(zone, '/stat', MerchantStatistics); + } + + getPayments = (req: StatRequest): Observable => + this.toObservableAction(this.client.GetPayments.bind(this.client))(new ThriftStatRequest(encode(req))).pipe(map((res) => decode(res))) +} diff --git a/src/app/thrift/payment-processing-typed-manager.ts b/src/app/thrift/payment-processing-typed-manager.ts new file mode 100644 index 00000000..ac8536dc --- /dev/null +++ b/src/app/thrift/payment-processing-typed-manager.ts @@ -0,0 +1,31 @@ +import { Injectable } from '@angular/core'; +import { Observable } from 'rxjs'; + +import { toGenInvoicePaymentAdjustmentParams, toGenPaymentProcessingUserInfo } from './converters'; +import { PaymentProcessingService } from './payment-processing.service'; +import { InvoicePaymentAdjustment, InvoicePaymentAdjustmentParams, UserInfo } from '../gen-damsel/payment_processing'; +import { encode } from '../shared/thrift-js-formatter'; + +@Injectable() +export class PaymentProcessingTypedManager { + + constructor(private paymentProcessingService: PaymentProcessingService) { + } + + createPaymentAdjustment(user: UserInfo, id: string, paymentId: string, params: InvoicePaymentAdjustmentParams): Observable { + const genUser = toGenPaymentProcessingUserInfo(encode(user)); + const genParams = toGenInvoicePaymentAdjustmentParams(encode(params)); + return this.paymentProcessingService.createPaymentAdjustment(genUser, id, paymentId, genParams); + } + + capturePaymentAdjustment(user: UserInfo, id: string, paymentId: string, adjustmentId: string): Observable { + const genUser = toGenPaymentProcessingUserInfo(encode(user)); + return this.paymentProcessingService.capturePaymentAdjustment(genUser, id, paymentId, adjustmentId); + } + + cancelPaymentAdjustment(user: UserInfo, id: string, paymentId: string, adjustmentId: string): Observable { + const genUser = toGenPaymentProcessingUserInfo(encode(user)); + return this.paymentProcessingService.cancelPaymentAdjustment(genUser, id, paymentId, adjustmentId); + } + +} diff --git a/src/app/thrift/payment-processing.service.ts b/src/app/thrift/payment-processing.service.ts new file mode 100644 index 00000000..0ed6621c --- /dev/null +++ b/src/app/thrift/payment-processing.service.ts @@ -0,0 +1,22 @@ +import { Injectable, NgZone } from '@angular/core'; +import { Observable } from 'rxjs'; + +import * as Invoicing from './gen-nodejs/Invoicing'; +import { ThriftService } from './thrift-service'; + +@Injectable() +export class PaymentProcessingService extends ThriftService { + + constructor(zone: NgZone) { + super(zone, '/v1/processing/invoicing', Invoicing); + } + + createPaymentAdjustment: (user: any, id: string, paymentId: string, params: any) => Observable + = this.toObservableAction(this.client.CreatePaymentAdjustment.bind(this.client)); + + capturePaymentAdjustment: (user: any, id: string, paymentId: string, adjustmentId: string) => Observable + = this.toObservableAction(this.client.CapturePaymentAdjustment.bind(this.client)); + + cancelPaymentAdjustment: (user: any, id: string, paymentId: string, adjustmentId: string) => Observable + = this.toObservableAction(this.client.CancelPaymentAdjustment.bind(this.client)); +} diff --git a/src/app/thrift/thrift-service.ts b/src/app/thrift/thrift-service.ts new file mode 100644 index 00000000..3a6a2d72 --- /dev/null +++ b/src/app/thrift/thrift-service.ts @@ -0,0 +1,39 @@ +import { NgZone } from '@angular/core'; +import { Observable } from 'rxjs'; +import { timeout } from 'rxjs/operators'; +import connectClient from 'woody_js/dist/connect-client'; + +type Exception = { + name: N; + message: string; +} & T; + +export class ThriftService { + + protected client: any; + + constructor(private zone: NgZone, endpoint: string, thriftService: any) { + this.client = this.createThriftClient(endpoint, thriftService); + } + + protected toObservableAction Observable>(func: Function): T { + return ((...args) => Observable.create((observer) => { + this.zone.run(() => { + try { + func(...args, (ex: Exception, result) => { + ex ? observer.error(ex) : observer.next(result); + observer.complete(); + }); + } catch (e) { + observer.error(e); + observer.complete(); + } + }); + }).pipe(timeout(10000))) as any; + } + + private createThriftClient(endpoint: string, thriftService: any) { + const {hostname, port} = location; + return connectClient(hostname, port, endpoint, thriftService); + } +} diff --git a/src/app/thrift/thrift.module.ts b/src/app/thrift/thrift.module.ts new file mode 100644 index 00000000..36f69f17 --- /dev/null +++ b/src/app/thrift/thrift.module.ts @@ -0,0 +1,19 @@ +import { NgModule } from '@angular/core'; + +import { DomainService } from './domain.service'; +import { PaymentProcessingService } from './payment-processing.service'; +import { MerchantStatisticsService } from './merchant-statistics.service'; +import { DomainTypedManager } from './domain-typed-manager'; +import { PaymentProcessingTypedManager } from './payment-processing-typed-manager'; + +@NgModule({ + providers: [ + DomainService, + DomainTypedManager, + PaymentProcessingService, + PaymentProcessingTypedManager, + MerchantStatisticsService + ] +}) +export class ThriftModule { +} diff --git a/src/styles.css b/src/styles.css index 32c1ecd4..55e03f5d 100644 --- a/src/styles.css +++ b/src/styles.css @@ -2,4 +2,11 @@ body { margin: 0; + background: #FAFAFA; +} + +/* ban to moving the stepper header forward and backward */ +.mat-horizontal-stepper-header-without-events .mat-horizontal-stepper-header { + pointer-events: none; + user-select: none; } \ No newline at end of file