Add prettier (#238)

This commit is contained in:
Rinat Arsaev 2019-01-30 16:31:56 +03:00 committed by GitHub
parent 5edaae6cc4
commit 0db853e7cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
284 changed files with 11486 additions and 1960 deletions

5
.prettierignore Normal file
View File

@ -0,0 +1,5 @@
package.json
package-lock.json
node_modules
dist
build_utils

8
.prettierrc Normal file
View File

@ -0,0 +1,8 @@
{
"printWidth": 100,
"singleQuote": true,
"useTabs": false,
"tabWidth": 4,
"semi": true,
"bracketSpacing": true
}

View File

@ -35,7 +35,7 @@ submodules: $(SUBTARGETS)
init:
npm install
build:
build: check
npm run build
clean:
@ -46,3 +46,6 @@ clean:
test: .state
docker run --rm $(SERVICE_IMAGE_NAME):$(shell cat .state) nginx -T -c /etc/nginx/nginx.conf
check:
npm run check

View File

@ -1,9 +1,11 @@
# Koffing
# Koffing
[![Build Status](http://ci.rbkmoney.com/buildStatus/icon?job=rbkmoney_private/koffing/master)](http://ci.rbkmoney.com/job/rbkmoney_private/view/Frontend/job/koffing/job/master/)
Личный кабинет мерчанта
## Настройка
Конфигурация приложения происходит в файле [appConfig.json](/config/runtime/appConfig.json)
Конфигурация keycloak происходит в файле [authConfig.json](/config/runtime/authConfig.json)
@ -13,11 +15,11 @@
Например в случае с nginx, json файлы нужно положить в `/usr/share/nginx/html`
## Установка и запуск
Для загрузки зависимостей выполнить: `npm i `
Для загрузки зависимостей выполнить: `npm i`
Далее будут доступны следующие опции:
`npm start` - запуск приложения на локальном сервере. По умолчанию будет доступен на порту ```8000```. Порт задается в [package.json](/package.json)
`npm build` - сборка prod версии статики.
`npm start` - запуск приложения на локальном сервере. По умолчанию будет доступен на порту `8000`. Порт задается в [package.json](/package.json)
`npm build` - сборка prod версии статики.

View File

@ -7,4 +7,4 @@ function root(args) {
return path.join.apply(path, [_root].concat(args));
}
exports.root = root;
exports.root = root;

View File

@ -1,12 +1,10 @@
const webpackConfig = require('./webpack.test');
module.exports = function (config) {
module.exports = function(config) {
config.set({
basePath: __dirname,
frameworks: ['jasmine'],
files: [
{pattern: 'karma-test-shim.js', watched: false}
],
files: [{ pattern: 'karma-test-shim.js', watched: false }],
preprocessors: {
'karma-test-shim.js': ['webpack', 'sourcemap']
},

View File

@ -1,7 +1,7 @@
{
"capiEndpoint": "http://api.rbk.test:8080",
"checkoutEndpoint": "http://checkout.rbk.test:8080",
"suggestionsToken": "27a1864e226f61f145ca150b5b64a378af1da650",
"supportEmail": "support@rbkmoney.com",
"shortenUrlEndpoint": "http://short.rbk.test:8080"
"capiEndpoint": "http://api.rbk.test:8080",
"checkoutEndpoint": "http://checkout.rbk.test:8080",
"suggestionsToken": "27a1864e226f61f145ca150b5b64a378af1da650",
"supportEmail": "support@rbkmoney.com",
"shortenUrlEndpoint": "http://short.rbk.test:8080"
}

View File

@ -1,7 +1,7 @@
{
"realm" : "external",
"auth-server-url" : "http://auth.rbk.test:8080/auth/",
"ssl-required" : "external",
"resource" : "koffing",
"public-client" : true
"realm": "external",
"auth-server-url": "http://auth.rbk.test:8080/auth/",
"ssl-required": "external",
"resource": "koffing",
"public-client": true
}

View File

@ -1,261 +1,261 @@
{
"loginWarnings": [
"69071027-66e8-4897-a106-0bf3711b0a80",
"c2794e21-fb66-41db-86df-8da991aa001e",
"4a6a2cfc-17a7-4c0e-8b13-8231ed6f89b0",
"01aca27a-bf14-4fdc-80df-7f066cdd7636",
"273e9ef4-6324-4eaf-a412-24d0c9068614",
"128a3d41-43cb-4195-9b13-f4ed542ad205",
"bafbeb71-648f-4c15-9fa0-663a641f45cb",
"2622f218-e36b-4448-8987-bd3dd7c5deb3",
"21099f87-4080-453c-bfa9-88cdf92c9228",
"5b5a36ba-ad48-4ef1-81ce-f6ae9a4121f9",
"db20681f-aa27-4b6e-b0d7-efa1e4352b13",
"fc689f7a-c46c-46d6-bf79-efdd31251bf8",
"69d91e75-f4c2-433d-8bf2-e5b6aa04e26d",
"ef1550b5-012d-4198-b3ba-113e7d844e91",
"6ea4e0b3-4f62-4b0d-ba83-354964652fbd",
"a9dfaba2-d87d-4ed1-8fea-e65b91a528a0",
"80829277-0d0d-4732-8d7c-212e18a58589",
"7988343c-77c0-49de-a67d-03e281774aab",
"ac610616-500f-498f-8409-8c4fae890c4c",
"3e2b4db8-1488-4db1-9d9d-b374e34f68d5",
"4d9aca37-9d69-442b-b8bd-1a6f31c5d71a",
"dee8a0c8-e306-4329-b29e-7ee2194a25f5",
"6c95016f-ec31-4fb9-bfc2-c40d26542aec",
"88606782-3521-4966-a9a3-7ead19d81198",
"b567b751-ba40-43c0-ad44-f7d92f64c863",
"86dd1a90-6f17-4a6e-8d2e-aa1908a3ceaf",
"0002bc47-1c7b-4f90-a6a0-6b262adc0a67",
"817648d3-8ac5-4768-bb44-0b84014ef3dd",
"4d666487-2f17-4678-9f42-9543ba4ae126",
"5805d09b-fa4b-4a35-ac20-4a901c031a95",
"6f390f39-15a8-43a3-a3a1-dcf9a90790de",
"0eb49b4f-1b70-4e3c-9f54-bd556ae02626",
"864cd785-7785-4f05-a2ba-6e173f57a51d",
"01fb5a4e-8abc-490d-969c-a396586207fc",
"e4242110-d822-4d2c-8c25-1efb6f5b0839",
"2e3ea859-66dc-4beb-b48c-87b72f029e0f",
"057176df-79ce-4458-8147-09f0005d75d6",
"48962f3d-2e94-4112-8f65-2900145d1b8a",
"84e7518e-f69e-4094-b675-e1a19847794b",
"f033e4cf-86b5-4793-bd72-b7de99cad558",
"d21f99fd-3fe4-495d-8fb3-df0ac5530683",
"7e5d3f09-c0ac-4ffd-918d-1fc5a4e8f08b",
"0e667c58-f4c3-41f0-9392-507c5fff52f9",
"00d4a059-8ce0-4faa-a28f-3fb28405c9d7",
"045d275b-db07-443e-9444-8d39a17796c6",
"d6217d2e-0e5b-485a-b95a-4f97e23fd516",
"7332e5e8-8fae-4268-a921-aeac03913646",
"215f0e04-c1cf-45c6-af04-a9c8b5c3e087",
"95bf4975-a258-4d54-9002-ece6e8956277",
"15c6d7d3-268b-448f-8944-bff56fe3e6f5",
"6b0d9bcc-f41c-4314-a5b5-10f93008a2e8",
"e3c28eef-1798-4736-b994-89aa14fb1bf1",
"95969ad7-2aa9-4630-8b41-63e6ec28299e",
"8fcc7a9e-c170-4c49-98cc-52be9abeb69a",
"e17e5fc3-4105-4dd6-8773-2c41e6b7c48c",
"5072b97a-fd23-48b1-ad15-348373a35ff8",
"954e527d-5393-4158-b3d5-e2f4d97e6805",
"d08d0383-8497-481b-9d10-9d9fec488f54",
"c14baaeb-3ede-48eb-9742-66a0272caf43",
"0a1c0a0c-ec95-4254-b06d-892ed554ddcb",
"88aa6c9e-ecb2-42e7-82cc-8b0651980b7c",
"033bf0bf-31c4-4001-be4e-25f9caa46f43",
"fd03bae6-9602-4657-b2e9-7fe30a2baf43",
"88e6c19c-2630-4a6d-9f97-ef7d4f550824",
"bce934f7-7108-4b06-86f1-52711f3ce11d",
"2ed323d5-d329-4f58-a5ea-a5a9c9574442",
"e2b6f55d-1299-4d21-a83b-90a9a0516eda",
"e2b6f55d-1299-4d21-a83b-90a9a0516eda",
"12b4d06b-1edb-43c3-8601-e99c966df203",
"cc17523a-9b75-4e51-a764-48c9e2fef1c3",
"cd8a2e50-e5fb-4946-9574-6ea20917f9cc",
"b493af14-6de0-451f-adde-f96cf8fbbcbf",
"c0e5eff1-52dd-492a-a626-4011de168123",
"5f8e9f5b-adfb-4dcf-b793-6a4616d1350e",
"f41c1fe6-5b9a-40e8-bd22-3d4faafc9dc4",
"72d3ebf6-3aae-410b-941e-f45e5ad97f30",
"b361e10c-7a39-42ce-9fca-f343be6fbb9b",
"5602708e-6061-4a38-b714-ad5a849743ca",
"0e9d2913-81d7-4c94-877d-e6e40bf47453",
"42720bd0-8e25-4ded-a72d-0aae3c87914b",
"ba197b57-d06d-4697-9adb-cfbdeb2767b3",
"411378c8-142e-46dd-9c72-637319b5110e",
"7598e6b6-3d30-4b11-b55b-02eb6238b6b1",
"c9f6780d-bc58-43d6-884b-04a3f3907d33",
"1e7fe70d-d4e0-49c6-be03-7ea246674eb2",
"6dd4adef-ee39-4b1b-b8be-7f99ceb0b3f0",
"1e401677-1c27-4fab-9b11-3e042f7717be",
"2a82f5b3-ae5a-4af8-8db6-81c242b7c673",
"b0634425-5e67-4e70-b6e4-dff33155ff2e",
"7e5e4463-1eaa-4a97-b1af-973e0ed8e3bd",
"9522d342-4ee8-4d14-a03f-31ce8e77e12b",
"9021a06e-a07c-4a20-830e-c6177b7ab5f8",
"f9a4ad7f-54a8-468f-a3fe-40bdb5c31f2f",
"c6270192-4c88-47c3-bccf-dd6338b952f4",
"48eb399f-3b27-48ea-b601-721d024de005",
"3490f835-df95-4a04-aec4-c9831d65b46e",
"7765baac-6a3a-4059-9e77-beed10915834",
"078d0cf7-5553-4337-be3d-98ac9c94a7a9",
"2afa946a-b261-4ac0-b8d4-799594fe0288",
"9a009529-434b-4416-b050-188982276376",
"7e38debf-a5fc-4bb5-b1fc-e508b4c89bda",
"8987d720-dbd4-4f54-8fe7-e73099f538b7",
"643f03cb-0933-4923-a417-d9890fd424a7",
"656e4dd5-3f1f-47d1-8374-4c5ce08ad7ac",
"d4d96457-b366-4f45-bd10-53d540d7ec45",
"145715da-8b49-4099-ba43-27aab8092df5",
"cc0e3285-511c-4127-b09b-a34184430f6e",
"2e31da0e-a3e4-47b9-8804-22714fc03e99",
"2b60e055-85a9-41e2-a119-5f32e618ff6c",
"344bd517-0dda-4007-8809-ba669b0ebe6e",
"b0cdad8e-06bd-43e1-8444-b809711c592a",
"6e5250d7-d0b9-46f5-919a-6f29c1e7a3ec",
"bf68686f-85b8-485f-9ea5-306b5e90c809",
"22715f3f-8c32-4475-b1f1-3a81248c785f",
"adf6b35d-9d0d-43a6-9e08-64486ea25347",
"4a54477a-359c-4e4b-a96f-02b24617d92f",
"01fd3fcf-798c-48c7-9375-0b824cb500aa",
"9e8d7a6c-c214-4fb0-b881-ba8c998dd294",
"eaa49d8a-675b-4f72-b6d5-78642e2bff61",
"dc97a945-592f-4e8e-82dc-33d2176acd9c",
"851ddbe3-dad8-4ea9-8ef6-02a8461433df",
"dd43f3c7-7d17-4ccb-8ba8-c803f8a447dd",
"fcaf2550-cf31-4dc6-9def-780e5aa9fce5",
"594c33e6-e090-406c-96e9-6571d258ad95",
"3471dc17-dbed-4090-918f-a9787460c3a2",
"333dff08-5f69-4be6-85ae-3126b57e08a2",
"48f7c250-c8ff-4c2e-be3f-c042e2f1c004",
"4e27883f-a706-4a4f-9f72-b16fce41b2bf",
"8570080f-16c9-48df-96dd-c7a8b915a01e",
"ac48ec0d-83d7-4bb7-bb66-b0cf6c1d982a",
"12646075-b92f-4c6e-a455-fca2e222ab77",
"a1af22ec-c7e7-4f6d-9e15-8ed0dced009f",
"883f1e8c-a3b7-4558-9c43-9a26aa288cf4",
"8eab6c08-e8e7-4bec-ab9a-dee28e4ca8c9",
"c35dfa2b-47bd-4820-b027-baf9e42bdc93",
"cc39afe1-b6d2-45c9-83e4-132d8ffb6a11",
"0d02f79b-0c54-4f36-b185-7f61fe44288c",
"649e1740-8fed-40b9-9f06-e38d63602b75",
"8293d316-2ae4-45df-b28a-ef9d2d2662d1",
"b1c5799e-3905-4810-89d5-b765729342a7",
"2cc8cba6-2aea-4a98-ae0a-ec3ae0880de6",
"9a9b139f-5846-491e-a332-6045691f160a",
"2d1f1b7a-8d19-4470-87f7-25c7cdaf0ec0",
"47e0f074-4342-4480-9dd5-3701525edac7",
"61ac4f9f-a391-4964-80d3-5e0d8dab1ee1",
"408cd244-0132-4975-bcce-3e612b3d5104",
"f56feb5c-6ba6-4d2f-8800-f7c26f0e18d9",
"b4032a17-426d-49d6-8c22-c20fd05e914a",
"8b94d1a8-9e5a-4a81-b3d9-92f3725ee6f8",
"02f02b0b-1454-4f11-bf05-1bacecbfd64f",
"b2da98a8-410d-493b-9103-c2e15c5a37c0",
"f25fd1c4-a231-4e94-834a-85bec7cc846e",
"332cc9f6-acd8-42da-9c2d-ecbb63ea9cf7",
"32cc08ff-7038-4b4d-8588-928cffeef19a",
"67ea5525-ef67-4088-a7b1-55a2616b9be2",
"3ec56ddf-ce3f-403b-9821-c83129c41643",
"61ab9faa-87da-4b6b-b8fe-50607b2b4a0e",
"28031f6e-9b33-4411-9379-712635c5135f",
"1cb506e6-82c6-4113-8847-cb06eaf65b4e",
"dfe7e4c5-0b4e-4844-8541-8214616cdcd5",
"355a7b35-9b0b-43e7-8ae1-93f37e77b76c",
"937aaa33-9369-4014-b889-93a7ba550e28",
"bd62aaee-0c06-4ccc-83ce-098a89bce628",
"88d31d97-56a0-42c7-87ca-125357b66fe9",
"c5ae2bed-3097-45fb-ae73-687e05e3b0c0",
"5ba0be87-79d0-4172-9230-0a5320a79dda",
"3b77148c-312d-4c51-9f88-0e0cec5f2c8b",
"7a7fd7ad-6f43-4478-9cf0-2b40ffaca0e3",
"b931db4c-6129-44d9-aaa5-50a877404125",
"e854c4a3-85bf-4f53-8cbb-b84c0d4b025c",
"ac77407e-33dd-49b2-8f11-3b759170a322",
"0c63b607-5d0f-44e0-ad63-bf35e3bd5747",
"2fddfbee-50f5-49d1-8ca1-d9feb81eb862",
"9a7e89d5-524b-4aae-8191-5c413cc3dfa2",
"258de043-affd-41f0-b3a4-870eb9e4faab",
"f6d5efc9-604a-46d4-b7a2-307eb7750529",
"d733ca17-2b81-414c-8524-94b57a1abc2e",
"1db54cce-0b2b-4433-b298-19ebc93afd39",
"9dc9d23a-093e-444c-a264-ab6a4462e62f",
"75bfd48a-64d4-46b2-b8e4-eab39c90f81e",
"44302aa1-b0b5-4591-a6af-6473901df3e8",
"b5017efc-c9ab-46d4-911e-e1b91d9ae700",
"4f2845b1-d516-4464-b2b5-111c55b40ac2",
"8d915a71-a386-49d9-926b-a119d6c25c1f",
"f5c7c340-d6a4-4066-a8b8-a3e987127357",
"8241636e-2816-40c8-b319-cfca37861447",
"2f848217-1c38-4d4a-b494-83820cb4095d",
"04d0c638-91e0-41d6-a256-2f5121a8c8cc",
"b53ad982-b0db-45de-aeca-3dc99bcc9375",
"bd00ce65-816b-4f64-908a-9b0f65223ef3",
"b797fd6f-acf7-42e0-8ce6-8a9ceff37505",
"47d50ec5-dbdc-4dc7-bb8e-335928a2610e",
"83c748a4-bf1f-4fc0-81ad-a9765ac10aa2",
"3708153e-e62b-4697-b26a-18e85329d92f",
"ae4e8c30-c63b-4718-bf50-6e733b3add2d",
"51764bfb-c60e-4c62-8c7b-4042a205e511",
"3aba98c5-5b3c-4ca4-8101-2251b79ae9fd",
"f26cf281-7b0b-4d6f-bade-7f9afb52fa8f",
"b8642ed3-41b6-4773-903d-386f4886d448",
"58cad283-072e-4daf-b1c8-89e607ce6d25",
"d365ff65-bf5f-4165-863f-021ca2d2c093",
"0f4a433a-7496-4878-ac0a-c4692e68b47b",
"333dff08-5f69-4be6-85ae-3126b57e08a2",
"f86d9fea-b198-4c0e-97ee-7f1aaa081c83",
"80037a30-d261-460b-bef8-12d50760e0c4",
"c6c6bbdd-eca9-41cc-a9b8-fe7334107188",
"d4033daf-f5ae-4499-ba29-0b430e4b4490",
"583a1705-38fc-4ecc-87a9-a882b4c9ffd9",
"471a4cae-df4e-4890-ae5b-80c8daf01ebd",
"4edf45a3-b85b-4d99-a917-4880946bc32c",
"411a2cce-32f3-4913-b3e2-7caada0716be",
"8663c8be-4c59-43e1-b462-abf5abd3ce23",
"af96b325-a302-4c7f-9a92-18ced08e9cc9",
"f261c5eb-c22f-4d01-80b6-080b2903d0ba",
"cdb62e39-1f50-47b1-b9eb-951ab760b874",
"f35dd7dc-14cc-4a1c-b2e6-243d62ba0714",
"89c9eb30-c5ec-43fd-86c0-3a4ff5c6e9fb",
"441f4110-73f8-4aa1-9316-c67991d26277",
"8845bb52-f864-4de4-a35b-8cc53cf84bc9",
"a38c1382-f8a8-465e-a725-febfeed2a018",
"d1b8541e-ecaa-404f-ae5a-c1500abf7936",
"f92e249b-16fd-4bc1-a0da-3a0f59084364",
"d21dfa0c-1104-4caf-8005-ef4c2550ed77",
"bac6d96b-acfe-4346-9ff9-205133d1a575",
"ac3da383-c815-42ef-b42d-c67af8f81885",
"147a9462-c41f-4271-afe5-2f13ec9fe37e",
"1d664a7c-8857-47cc-994d-9d9926dc18e2",
"05e20631-0b94-4639-b5d4-b203e20ebe13",
"d09451e5-6a2d-4c50-97b9-0ef98bfb375d",
"2c664266-dc16-49f2-8f92-c7bdd264b015",
"b1e60bbc-ae57-46da-897d-0c43e79673e3",
"ab08b2d3-9626-4c5c-abfa-2578cbdd8e85",
"3b93f056-3a01-4710-9e2a-f0bacfef5ca9",
"ccffc8d3-378e-411d-b3df-4f522dde9251",
"47b19b15-d37c-45ba-ad17-2d386dd9f253",
"4bef1061-fc9d-409e-894f-52f1016dbc1e",
"d167cb56-893a-4477-ab2a-a52292975a97",
"fbe54634-1c59-44c0-b6f1-1b03db616c60",
"f99cba99-1d91-47ef-8054-308e052dd3e4",
"2b6f0ab7-2844-47f0-bf3d-8abfff5a7b78",
"6954b4d1-f39f-4cc1-8843-eae834e6f849",
"2961e30d-f5e8-42f2-84ae-3cecc70a6720",
"4a6a2cfc-17a7-4c0e-8b13-8231ed6f89b0",
"a1329129-91ac-489b-9b03-58fbaab998df",
"5284db72-8394-40d6-9eed-2eac8f722e11",
"f3e2c425-f4a4-4ffe-b14d-b9bedefad861",
"a1e0e355-fdfd-43bc-a418-89961d6dc980",
"4c9e37d3-c4f7-47e7-960f-f23039bb553c",
"6871a77a-1995-4f74-9ecd-2a836ac69637",
"4bbb9c76-738d-4bdc-aeff-ef306eb63e46",
"933f3cf4-1233-4f5e-bd58-32446be61b9a",
"eb08d400-1eb4-4ada-8ddc-c3ff4c9a5453",
"e5492958-4d7b-4812-81b7-332baf5cf87f",
"56a929bb-aeb5-43ff-a2bb-179820f7f1b7",
"e59a059f-541a-4220-a167-8f7bf0bddbbe",
"08f633f9-4334-4e09-856c-8dbd04cab9b1",
"857becb8-4555-4494-8aa2-b26a3841d6dd"
]
}
"loginWarnings": [
"69071027-66e8-4897-a106-0bf3711b0a80",
"c2794e21-fb66-41db-86df-8da991aa001e",
"4a6a2cfc-17a7-4c0e-8b13-8231ed6f89b0",
"01aca27a-bf14-4fdc-80df-7f066cdd7636",
"273e9ef4-6324-4eaf-a412-24d0c9068614",
"128a3d41-43cb-4195-9b13-f4ed542ad205",
"bafbeb71-648f-4c15-9fa0-663a641f45cb",
"2622f218-e36b-4448-8987-bd3dd7c5deb3",
"21099f87-4080-453c-bfa9-88cdf92c9228",
"5b5a36ba-ad48-4ef1-81ce-f6ae9a4121f9",
"db20681f-aa27-4b6e-b0d7-efa1e4352b13",
"fc689f7a-c46c-46d6-bf79-efdd31251bf8",
"69d91e75-f4c2-433d-8bf2-e5b6aa04e26d",
"ef1550b5-012d-4198-b3ba-113e7d844e91",
"6ea4e0b3-4f62-4b0d-ba83-354964652fbd",
"a9dfaba2-d87d-4ed1-8fea-e65b91a528a0",
"80829277-0d0d-4732-8d7c-212e18a58589",
"7988343c-77c0-49de-a67d-03e281774aab",
"ac610616-500f-498f-8409-8c4fae890c4c",
"3e2b4db8-1488-4db1-9d9d-b374e34f68d5",
"4d9aca37-9d69-442b-b8bd-1a6f31c5d71a",
"dee8a0c8-e306-4329-b29e-7ee2194a25f5",
"6c95016f-ec31-4fb9-bfc2-c40d26542aec",
"88606782-3521-4966-a9a3-7ead19d81198",
"b567b751-ba40-43c0-ad44-f7d92f64c863",
"86dd1a90-6f17-4a6e-8d2e-aa1908a3ceaf",
"0002bc47-1c7b-4f90-a6a0-6b262adc0a67",
"817648d3-8ac5-4768-bb44-0b84014ef3dd",
"4d666487-2f17-4678-9f42-9543ba4ae126",
"5805d09b-fa4b-4a35-ac20-4a901c031a95",
"6f390f39-15a8-43a3-a3a1-dcf9a90790de",
"0eb49b4f-1b70-4e3c-9f54-bd556ae02626",
"864cd785-7785-4f05-a2ba-6e173f57a51d",
"01fb5a4e-8abc-490d-969c-a396586207fc",
"e4242110-d822-4d2c-8c25-1efb6f5b0839",
"2e3ea859-66dc-4beb-b48c-87b72f029e0f",
"057176df-79ce-4458-8147-09f0005d75d6",
"48962f3d-2e94-4112-8f65-2900145d1b8a",
"84e7518e-f69e-4094-b675-e1a19847794b",
"f033e4cf-86b5-4793-bd72-b7de99cad558",
"d21f99fd-3fe4-495d-8fb3-df0ac5530683",
"7e5d3f09-c0ac-4ffd-918d-1fc5a4e8f08b",
"0e667c58-f4c3-41f0-9392-507c5fff52f9",
"00d4a059-8ce0-4faa-a28f-3fb28405c9d7",
"045d275b-db07-443e-9444-8d39a17796c6",
"d6217d2e-0e5b-485a-b95a-4f97e23fd516",
"7332e5e8-8fae-4268-a921-aeac03913646",
"215f0e04-c1cf-45c6-af04-a9c8b5c3e087",
"95bf4975-a258-4d54-9002-ece6e8956277",
"15c6d7d3-268b-448f-8944-bff56fe3e6f5",
"6b0d9bcc-f41c-4314-a5b5-10f93008a2e8",
"e3c28eef-1798-4736-b994-89aa14fb1bf1",
"95969ad7-2aa9-4630-8b41-63e6ec28299e",
"8fcc7a9e-c170-4c49-98cc-52be9abeb69a",
"e17e5fc3-4105-4dd6-8773-2c41e6b7c48c",
"5072b97a-fd23-48b1-ad15-348373a35ff8",
"954e527d-5393-4158-b3d5-e2f4d97e6805",
"d08d0383-8497-481b-9d10-9d9fec488f54",
"c14baaeb-3ede-48eb-9742-66a0272caf43",
"0a1c0a0c-ec95-4254-b06d-892ed554ddcb",
"88aa6c9e-ecb2-42e7-82cc-8b0651980b7c",
"033bf0bf-31c4-4001-be4e-25f9caa46f43",
"fd03bae6-9602-4657-b2e9-7fe30a2baf43",
"88e6c19c-2630-4a6d-9f97-ef7d4f550824",
"bce934f7-7108-4b06-86f1-52711f3ce11d",
"2ed323d5-d329-4f58-a5ea-a5a9c9574442",
"e2b6f55d-1299-4d21-a83b-90a9a0516eda",
"e2b6f55d-1299-4d21-a83b-90a9a0516eda",
"12b4d06b-1edb-43c3-8601-e99c966df203",
"cc17523a-9b75-4e51-a764-48c9e2fef1c3",
"cd8a2e50-e5fb-4946-9574-6ea20917f9cc",
"b493af14-6de0-451f-adde-f96cf8fbbcbf",
"c0e5eff1-52dd-492a-a626-4011de168123",
"5f8e9f5b-adfb-4dcf-b793-6a4616d1350e",
"f41c1fe6-5b9a-40e8-bd22-3d4faafc9dc4",
"72d3ebf6-3aae-410b-941e-f45e5ad97f30",
"b361e10c-7a39-42ce-9fca-f343be6fbb9b",
"5602708e-6061-4a38-b714-ad5a849743ca",
"0e9d2913-81d7-4c94-877d-e6e40bf47453",
"42720bd0-8e25-4ded-a72d-0aae3c87914b",
"ba197b57-d06d-4697-9adb-cfbdeb2767b3",
"411378c8-142e-46dd-9c72-637319b5110e",
"7598e6b6-3d30-4b11-b55b-02eb6238b6b1",
"c9f6780d-bc58-43d6-884b-04a3f3907d33",
"1e7fe70d-d4e0-49c6-be03-7ea246674eb2",
"6dd4adef-ee39-4b1b-b8be-7f99ceb0b3f0",
"1e401677-1c27-4fab-9b11-3e042f7717be",
"2a82f5b3-ae5a-4af8-8db6-81c242b7c673",
"b0634425-5e67-4e70-b6e4-dff33155ff2e",
"7e5e4463-1eaa-4a97-b1af-973e0ed8e3bd",
"9522d342-4ee8-4d14-a03f-31ce8e77e12b",
"9021a06e-a07c-4a20-830e-c6177b7ab5f8",
"f9a4ad7f-54a8-468f-a3fe-40bdb5c31f2f",
"c6270192-4c88-47c3-bccf-dd6338b952f4",
"48eb399f-3b27-48ea-b601-721d024de005",
"3490f835-df95-4a04-aec4-c9831d65b46e",
"7765baac-6a3a-4059-9e77-beed10915834",
"078d0cf7-5553-4337-be3d-98ac9c94a7a9",
"2afa946a-b261-4ac0-b8d4-799594fe0288",
"9a009529-434b-4416-b050-188982276376",
"7e38debf-a5fc-4bb5-b1fc-e508b4c89bda",
"8987d720-dbd4-4f54-8fe7-e73099f538b7",
"643f03cb-0933-4923-a417-d9890fd424a7",
"656e4dd5-3f1f-47d1-8374-4c5ce08ad7ac",
"d4d96457-b366-4f45-bd10-53d540d7ec45",
"145715da-8b49-4099-ba43-27aab8092df5",
"cc0e3285-511c-4127-b09b-a34184430f6e",
"2e31da0e-a3e4-47b9-8804-22714fc03e99",
"2b60e055-85a9-41e2-a119-5f32e618ff6c",
"344bd517-0dda-4007-8809-ba669b0ebe6e",
"b0cdad8e-06bd-43e1-8444-b809711c592a",
"6e5250d7-d0b9-46f5-919a-6f29c1e7a3ec",
"bf68686f-85b8-485f-9ea5-306b5e90c809",
"22715f3f-8c32-4475-b1f1-3a81248c785f",
"adf6b35d-9d0d-43a6-9e08-64486ea25347",
"4a54477a-359c-4e4b-a96f-02b24617d92f",
"01fd3fcf-798c-48c7-9375-0b824cb500aa",
"9e8d7a6c-c214-4fb0-b881-ba8c998dd294",
"eaa49d8a-675b-4f72-b6d5-78642e2bff61",
"dc97a945-592f-4e8e-82dc-33d2176acd9c",
"851ddbe3-dad8-4ea9-8ef6-02a8461433df",
"dd43f3c7-7d17-4ccb-8ba8-c803f8a447dd",
"fcaf2550-cf31-4dc6-9def-780e5aa9fce5",
"594c33e6-e090-406c-96e9-6571d258ad95",
"3471dc17-dbed-4090-918f-a9787460c3a2",
"333dff08-5f69-4be6-85ae-3126b57e08a2",
"48f7c250-c8ff-4c2e-be3f-c042e2f1c004",
"4e27883f-a706-4a4f-9f72-b16fce41b2bf",
"8570080f-16c9-48df-96dd-c7a8b915a01e",
"ac48ec0d-83d7-4bb7-bb66-b0cf6c1d982a",
"12646075-b92f-4c6e-a455-fca2e222ab77",
"a1af22ec-c7e7-4f6d-9e15-8ed0dced009f",
"883f1e8c-a3b7-4558-9c43-9a26aa288cf4",
"8eab6c08-e8e7-4bec-ab9a-dee28e4ca8c9",
"c35dfa2b-47bd-4820-b027-baf9e42bdc93",
"cc39afe1-b6d2-45c9-83e4-132d8ffb6a11",
"0d02f79b-0c54-4f36-b185-7f61fe44288c",
"649e1740-8fed-40b9-9f06-e38d63602b75",
"8293d316-2ae4-45df-b28a-ef9d2d2662d1",
"b1c5799e-3905-4810-89d5-b765729342a7",
"2cc8cba6-2aea-4a98-ae0a-ec3ae0880de6",
"9a9b139f-5846-491e-a332-6045691f160a",
"2d1f1b7a-8d19-4470-87f7-25c7cdaf0ec0",
"47e0f074-4342-4480-9dd5-3701525edac7",
"61ac4f9f-a391-4964-80d3-5e0d8dab1ee1",
"408cd244-0132-4975-bcce-3e612b3d5104",
"f56feb5c-6ba6-4d2f-8800-f7c26f0e18d9",
"b4032a17-426d-49d6-8c22-c20fd05e914a",
"8b94d1a8-9e5a-4a81-b3d9-92f3725ee6f8",
"02f02b0b-1454-4f11-bf05-1bacecbfd64f",
"b2da98a8-410d-493b-9103-c2e15c5a37c0",
"f25fd1c4-a231-4e94-834a-85bec7cc846e",
"332cc9f6-acd8-42da-9c2d-ecbb63ea9cf7",
"32cc08ff-7038-4b4d-8588-928cffeef19a",
"67ea5525-ef67-4088-a7b1-55a2616b9be2",
"3ec56ddf-ce3f-403b-9821-c83129c41643",
"61ab9faa-87da-4b6b-b8fe-50607b2b4a0e",
"28031f6e-9b33-4411-9379-712635c5135f",
"1cb506e6-82c6-4113-8847-cb06eaf65b4e",
"dfe7e4c5-0b4e-4844-8541-8214616cdcd5",
"355a7b35-9b0b-43e7-8ae1-93f37e77b76c",
"937aaa33-9369-4014-b889-93a7ba550e28",
"bd62aaee-0c06-4ccc-83ce-098a89bce628",
"88d31d97-56a0-42c7-87ca-125357b66fe9",
"c5ae2bed-3097-45fb-ae73-687e05e3b0c0",
"5ba0be87-79d0-4172-9230-0a5320a79dda",
"3b77148c-312d-4c51-9f88-0e0cec5f2c8b",
"7a7fd7ad-6f43-4478-9cf0-2b40ffaca0e3",
"b931db4c-6129-44d9-aaa5-50a877404125",
"e854c4a3-85bf-4f53-8cbb-b84c0d4b025c",
"ac77407e-33dd-49b2-8f11-3b759170a322",
"0c63b607-5d0f-44e0-ad63-bf35e3bd5747",
"2fddfbee-50f5-49d1-8ca1-d9feb81eb862",
"9a7e89d5-524b-4aae-8191-5c413cc3dfa2",
"258de043-affd-41f0-b3a4-870eb9e4faab",
"f6d5efc9-604a-46d4-b7a2-307eb7750529",
"d733ca17-2b81-414c-8524-94b57a1abc2e",
"1db54cce-0b2b-4433-b298-19ebc93afd39",
"9dc9d23a-093e-444c-a264-ab6a4462e62f",
"75bfd48a-64d4-46b2-b8e4-eab39c90f81e",
"44302aa1-b0b5-4591-a6af-6473901df3e8",
"b5017efc-c9ab-46d4-911e-e1b91d9ae700",
"4f2845b1-d516-4464-b2b5-111c55b40ac2",
"8d915a71-a386-49d9-926b-a119d6c25c1f",
"f5c7c340-d6a4-4066-a8b8-a3e987127357",
"8241636e-2816-40c8-b319-cfca37861447",
"2f848217-1c38-4d4a-b494-83820cb4095d",
"04d0c638-91e0-41d6-a256-2f5121a8c8cc",
"b53ad982-b0db-45de-aeca-3dc99bcc9375",
"bd00ce65-816b-4f64-908a-9b0f65223ef3",
"b797fd6f-acf7-42e0-8ce6-8a9ceff37505",
"47d50ec5-dbdc-4dc7-bb8e-335928a2610e",
"83c748a4-bf1f-4fc0-81ad-a9765ac10aa2",
"3708153e-e62b-4697-b26a-18e85329d92f",
"ae4e8c30-c63b-4718-bf50-6e733b3add2d",
"51764bfb-c60e-4c62-8c7b-4042a205e511",
"3aba98c5-5b3c-4ca4-8101-2251b79ae9fd",
"f26cf281-7b0b-4d6f-bade-7f9afb52fa8f",
"b8642ed3-41b6-4773-903d-386f4886d448",
"58cad283-072e-4daf-b1c8-89e607ce6d25",
"d365ff65-bf5f-4165-863f-021ca2d2c093",
"0f4a433a-7496-4878-ac0a-c4692e68b47b",
"333dff08-5f69-4be6-85ae-3126b57e08a2",
"f86d9fea-b198-4c0e-97ee-7f1aaa081c83",
"80037a30-d261-460b-bef8-12d50760e0c4",
"c6c6bbdd-eca9-41cc-a9b8-fe7334107188",
"d4033daf-f5ae-4499-ba29-0b430e4b4490",
"583a1705-38fc-4ecc-87a9-a882b4c9ffd9",
"471a4cae-df4e-4890-ae5b-80c8daf01ebd",
"4edf45a3-b85b-4d99-a917-4880946bc32c",
"411a2cce-32f3-4913-b3e2-7caada0716be",
"8663c8be-4c59-43e1-b462-abf5abd3ce23",
"af96b325-a302-4c7f-9a92-18ced08e9cc9",
"f261c5eb-c22f-4d01-80b6-080b2903d0ba",
"cdb62e39-1f50-47b1-b9eb-951ab760b874",
"f35dd7dc-14cc-4a1c-b2e6-243d62ba0714",
"89c9eb30-c5ec-43fd-86c0-3a4ff5c6e9fb",
"441f4110-73f8-4aa1-9316-c67991d26277",
"8845bb52-f864-4de4-a35b-8cc53cf84bc9",
"a38c1382-f8a8-465e-a725-febfeed2a018",
"d1b8541e-ecaa-404f-ae5a-c1500abf7936",
"f92e249b-16fd-4bc1-a0da-3a0f59084364",
"d21dfa0c-1104-4caf-8005-ef4c2550ed77",
"bac6d96b-acfe-4346-9ff9-205133d1a575",
"ac3da383-c815-42ef-b42d-c67af8f81885",
"147a9462-c41f-4271-afe5-2f13ec9fe37e",
"1d664a7c-8857-47cc-994d-9d9926dc18e2",
"05e20631-0b94-4639-b5d4-b203e20ebe13",
"d09451e5-6a2d-4c50-97b9-0ef98bfb375d",
"2c664266-dc16-49f2-8f92-c7bdd264b015",
"b1e60bbc-ae57-46da-897d-0c43e79673e3",
"ab08b2d3-9626-4c5c-abfa-2578cbdd8e85",
"3b93f056-3a01-4710-9e2a-f0bacfef5ca9",
"ccffc8d3-378e-411d-b3df-4f522dde9251",
"47b19b15-d37c-45ba-ad17-2d386dd9f253",
"4bef1061-fc9d-409e-894f-52f1016dbc1e",
"d167cb56-893a-4477-ab2a-a52292975a97",
"fbe54634-1c59-44c0-b6f1-1b03db616c60",
"f99cba99-1d91-47ef-8054-308e052dd3e4",
"2b6f0ab7-2844-47f0-bf3d-8abfff5a7b78",
"6954b4d1-f39f-4cc1-8843-eae834e6f849",
"2961e30d-f5e8-42f2-84ae-3cecc70a6720",
"4a6a2cfc-17a7-4c0e-8b13-8231ed6f89b0",
"a1329129-91ac-489b-9b03-58fbaab998df",
"5284db72-8394-40d6-9eed-2eac8f722e11",
"f3e2c425-f4a4-4ffe-b14d-b9bedefad861",
"a1e0e355-fdfd-43bc-a418-89961d6dc980",
"4c9e37d3-c4f7-47e7-960f-f23039bb553c",
"6871a77a-1995-4f74-9ecd-2a836ac69637",
"4bbb9c76-738d-4bdc-aeff-ef306eb63e46",
"933f3cf4-1233-4f5e-bd58-32446be61b9a",
"eb08d400-1eb4-4ada-8ddc-c3ff4c9a5453",
"e5492958-4d7b-4812-81b7-332baf5cf87f",
"56a929bb-aeb5-43ff-a2bb-179820f7f1b7",
"e59a059f-541a-4220-a167-8f7bf0bddbbe",
"08f633f9-4334-4e09-856c-8dbd04cab9b1",
"857becb8-4555-4494-8aa2-b26a3841d6dd"
]
}

View File

@ -8,28 +8,25 @@ const path = require('path');
module.exports = {
entry: {
'polyfills': './src/polyfills.ts',
'vendor': './src/vendor.ts',
'vendorjs': [
polyfills: './src/polyfills.ts',
vendor: './src/vendor.ts',
vendorjs: [
'./node_modules/jquery/dist/jquery.js',
'./node_modules/bootstrap/dist/js/bootstrap.js',
'./node_modules/keycloak-js/dist/keycloak.js',
'./node_modules/suggestions-jquery/dist/js/jquery.suggestions.js',
'./node_modules/xlsx-style/dist/xlsx.core.min.js'
],
'app': './src/main.ts'
app: './src/main.ts'
},
resolve: {
modules: [
path.join(__dirname, 'src'),
'node_modules'
],
modules: [path.join(__dirname, 'src'), 'node_modules'],
alias: {
'Keycloak': 'keycloak-js/dist/keycloak.js',
'jquery': 'jquery/dist/jquery',
'suggestions': 'suggestions-jquery/dist/js/jquery.suggestions.js',
'koffing': __dirname + '/../src/app'
Keycloak: 'keycloak-js/dist/keycloak.js',
jquery: 'jquery/dist/jquery',
suggestions: 'suggestions-jquery/dist/js/jquery.suggestions.js',
koffing: __dirname + '/../src/app'
},
extensions: ['.ts', '.js']
},
@ -55,12 +52,18 @@ module.exports = {
{
test: /\.css$/,
exclude: helpers.root('src', 'app'),
use: ExtractTextPlugin.extract({fallback: 'style-loader', use: 'css-loader?sourceMap'})
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader?sourceMap'
})
},
{
test: /\.less$/,
exclude: helpers.root('src', 'app'),
use: ExtractTextPlugin.extract({fallback: 'style-loader', use: ['css-loader?sourceMap', 'less-loader']})
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader?sourceMap', 'less-loader']
})
},
{
test: /\.less$/,
@ -107,8 +110,10 @@ module.exports = {
filename: 'index.html',
template: 'src/index.pug'
}),
new CopyWebpackPlugin([{
from: 'config/runtime'
}])
new CopyWebpackPlugin([
{
from: 'config/runtime'
}
])
]
};
};

View File

@ -13,12 +13,10 @@ module.exports = webpackMerge(commonConfig, {
chunkFilename: '[id].chunk.js'
},
plugins: [
new ExtractTextPlugin('[name].css')
],
plugins: [new ExtractTextPlugin('[name].css')],
devServer: {
historyApiFallback: true,
stats: 'minimal'
}
});
});

View File

@ -4,7 +4,7 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin');
const commonConfig = require('./webpack.common.js');
const helpers = require('./helpers');
const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
const ENV = (process.env.NODE_ENV = process.env.ENV = 'production');
module.exports = webpackMerge(commonConfig, {
output: {
@ -27,7 +27,7 @@ module.exports = webpackMerge(commonConfig, {
new ExtractTextPlugin('[name].[hash].css'),
new webpack.DefinePlugin({
'process.env': {
'ENV': JSON.stringify(ENV)
ENV: JSON.stringify(ENV)
}
}),
new webpack.LoaderOptionsPlugin({

View File

@ -6,12 +6,9 @@ module.exports = {
devtool: 'inline-source-map',
resolve: {
modules: [
path.join(__dirname, 'src'),
'node_modules'
],
modules: [path.join(__dirname, 'src'), 'node_modules'],
alias: {
'koffing': __dirname + '/../src/app'
koffing: __dirname + '/../src/app'
},
extensions: ['.ts', '.js']
},
@ -31,4 +28,4 @@ module.exports = {
path.resolve(__dirname, '../src')
)
]
};
};

View File

@ -1,13 +1,13 @@
{
"consul": "{{ .CONSUL_ADDR }}",
"services": [
{
"name": "{{ .SERVICE_NAME }}",
"port": 8080,
"health": "/usr/bin/curl --silent --show-error --output /dev/null localhost:8080",
"poll": 1,
"ttl": 2,
"interfaces": ["inet6", "inet"]
}
]
}
"consul": "{{ .CONSUL_ADDR }}",
"services": [
{
"name": "{{ .SERVICE_NAME }}",
"port": 8080,
"health": "/usr/bin/curl --silent --show-error --output /dev/null localhost:8080",
"poll": 1,
"ttl": 2,
"interfaces": ["inet6", "inet"]
}
]
}

9190
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,9 @@
"scripts": {
"start": "webpack-dev-server --config config/webpack.dev.js --inline --progress --port 8000",
"build": "rimraf dist && webpack --config config/webpack.prod.js --progress --profile --bail",
"test": "karma start config/karma.conf.js"
"test": "karma start config/karma.conf.js",
"prettier": "prettier \"**/*.{html,js,ts,css,md,json,prettierrc,svg}\" --write",
"check": "prettier \"**/*.{html,js,ts,css,md,json,prettierrc,svg}\" --list-different"
},
"licenses": [],
"dependencies": {
@ -67,12 +69,14 @@
"less": "~2.7.2",
"less-loader": "~4.0.4",
"null-loader": "~0.1.1",
"prettier": "~1.16.2",
"pug-html-loader": "~1.1.5",
"raw-loader": "~0.5.1",
"rimraf": "~2.6.1",
"script-loader": "~0.7.0",
"style-loader": "~0.18.2",
"tslint": "~5.8.0",
"tslint-config-prettier": "^1.17.0",
"tslint-loader": "~3.5.3",
"typescript": "~2.5",
"url-loader": "~0.5.9",

View File

@ -17,8 +17,6 @@ import { AccountComponent } from './account.component';
}
])
],
exports: [
RouterModule
]
exports: [RouterModule]
})
export class AccountRoutingModule {}

View File

@ -11,14 +11,10 @@ import { AuthService } from 'koffing/auth/auth.service';
styleUrls: ['./account.component.less']
})
export class AccountComponent implements OnInit {
public accountFrameUrl: SafeResourceUrl;
public accountRouterLinks: object[];
constructor(
private sanitizer: DomSanitizer,
private route: ActivatedRoute
) {}
constructor(private sanitizer: DomSanitizer, private route: ActivatedRoute) {}
public ngOnInit() {
this.initAccountRouterLinks();
@ -28,8 +24,11 @@ export class AccountComponent implements OnInit {
}
private getAccountFrameUrl(params: Params): SafeResourceUrl {
const accountPath = (params['path'] === 'edit') ? '' : params['path'];
const url = `${trimEnd(AuthService.getAccountInfo().authUrl, '/')}/realms/external/account/${accountPath}`;
const accountPath = params['path'] === 'edit' ? '' : params['path'];
const url = `${trimEnd(
AuthService.getAccountInfo().authUrl,
'/'
)}/realms/external/account/${accountPath}`;
return this.sanitizer.bypassSecurityTrustResourceUrl(url);
}
@ -58,7 +57,7 @@ export class AccountComponent implements OnInit {
{
routePath: 'log',
label: 'Логи'
},
}
];
}
}

View File

@ -6,13 +6,7 @@ import { AccountRoutingModule } from './account-routing.module';
import { CommonModule } from 'koffing/common/common.module';
@NgModule({
imports: [
CommonModule,
AccountRoutingModule,
BrowserModule
],
declarations: [
AccountComponent
]
imports: [CommonModule, AccountRoutingModule, BrowserModule],
declarations: [AccountComponent]
})
export class AccountModule { }
export class AccountModule {}

View File

@ -11,8 +11,6 @@ import { AnalyticsComponent } from './analytics.component';
}
])
],
exports: [
RouterModule
]
exports: [RouterModule]
})
export class AnalyticsRoutingModule { }
export class AnalyticsRoutingModule {}

View File

@ -16,10 +16,14 @@ import { AnalyticsService } from 'koffing/analytics/analytics.service';
providers: [AnalyticsService]
})
export class AnalyticsComponent implements OnInit {
public shopID: string;
public fromTime: Date = moment().subtract(1, 'day').startOf('day').toDate();
public toTime: Date = moment().endOf('day').toDate();
public fromTime: Date = moment()
.subtract(1, 'day')
.startOf('day')
.toDate();
public toTime: Date = moment()
.endOf('day')
.toDate();
public profit: number = 0;
public panelData: Subject<PanelData> = new Subject();
@ -32,11 +36,12 @@ export class AnalyticsComponent implements OnInit {
public loadStatistic: Subject<null> = new Subject();
private requestCount = 5;
constructor(private route: ActivatedRoute,
private accountsService: AccountsService,
private shopService: ShopService,
private analyticsService: AnalyticsService) {
}
constructor(
private route: ActivatedRoute,
private accountsService: AccountsService,
private shopService: ShopService,
private analyticsService: AnalyticsService
) {}
public ngOnInit() {
this.route.parent.params.subscribe((params: Params) => {
@ -62,21 +67,23 @@ export class AnalyticsComponent implements OnInit {
}
private loadPaymentMethod(shopID: string, fromTime: Date, toTime: Date) {
this.analyticsService.getPaymentMethodChartData(shopID, fromTime, toTime).subscribe((data) => {
this.paymentMethodChartData.next(data);
this.loadStatistic.next();
});
this.analyticsService
.getPaymentMethodChartData(shopID, fromTime, toTime)
.subscribe(data => {
this.paymentMethodChartData.next(data);
this.loadStatistic.next();
});
}
private loadRate(shopID: string, from: Date, to: Date) {
this.analyticsService.getUniqueCount(shopID, from, to).subscribe((count) => {
this.panelData.next({uniqueCount: count});
this.analyticsService.getUniqueCount(shopID, from, to).subscribe(count => {
this.panelData.next({ uniqueCount: count });
this.loadStatistic.next();
});
}
private loadConversionStat(shopID: string, from: Date, to: Date) {
this.analyticsService.getPaymentConversionData(shopID, from, to).subscribe((data) => {
this.analyticsService.getPaymentConversionData(shopID, from, to).subscribe(data => {
this.panelData.next({
successfulCount: data.paymentCount.successfulCount,
unfinishedCount: data.paymentCount.unfinishedCount
@ -87,14 +94,14 @@ export class AnalyticsComponent implements OnInit {
}
private loadGeoChartData(shopID: string, from: Date, to: Date) {
this.analyticsService.getPaymentGeoChartData(shopID, from, to).subscribe((data) => {
this.analyticsService.getPaymentGeoChartData(shopID, from, to).subscribe(data => {
this.geoChartData.next(data);
this.loadStatistic.next();
});
}
private loadRevenueStat(shopID: string, from: Date, to: Date) {
this.analyticsService.getPaymentRevenueData(shopID, from, to).subscribe((data) => {
this.analyticsService.getPaymentRevenueData(shopID, from, to).subscribe(data => {
this.profit = data.profit;
this.revenueChartData.next(data.revenueChartData);
this.loadStatistic.next();
@ -102,9 +109,9 @@ export class AnalyticsComponent implements OnInit {
}
private loadAccounts(shopID: string) {
this.shopService.getShopByID(shopID).subscribe((shop) => {
this.accountsService.getAccountByID(shop.account.settlementID).subscribe((account) => {
this.panelData.next({settlementBalance: account.ownAmount});
this.shopService.getShopByID(shopID).subscribe(shop => {
this.accountsService.getAccountByID(shop.account.settlementID).subscribe(account => {
this.panelData.next({ settlementBalance: account.ownAmount });
this.loadStatistic.next();
});
});

View File

@ -12,13 +12,7 @@ import { CommonModule } from 'koffing/common/common.module';
import { BackendModule } from 'koffing/backend/backend.module';
@NgModule({
imports: [
AnalyticsRoutingModule,
BrowserModule,
FormsModule,
CommonModule,
BackendModule
],
imports: [AnalyticsRoutingModule, BrowserModule, FormsModule, CommonModule, BackendModule],
declarations: [
AnalyticsComponent,
BaseChartDirective,
@ -27,4 +21,4 @@ import { BackendModule } from 'koffing/backend/backend.module';
StatisticPanelComponent
]
})
export class AnalyticsModule { }
export class AnalyticsModule {}

View File

@ -11,47 +11,76 @@ import { PaymentRevenueData } from './stats-data/payment-revenue-data';
@Injectable()
export class AnalyticsService {
constructor(
private analyticsService: AnalyticsBackendService,
private locationService: LocationService
) {}
constructor(private analyticsService: AnalyticsBackendService,
private locationService: LocationService) {
}
public getPaymentMethodChartData(shopID: string, from: Date, to: Date): Observable<DoughnutChartData> {
return this.analyticsService.getPaymentMethodStats(shopID, from, to)
.map((paymentMethodStats) => StatsDataConverter.toPaymentMethodChartData(paymentMethodStats));
public getPaymentMethodChartData(
shopID: string,
from: Date,
to: Date
): Observable<DoughnutChartData> {
return this.analyticsService
.getPaymentMethodStats(shopID, from, to)
.map(paymentMethodStats =>
StatsDataConverter.toPaymentMethodChartData(paymentMethodStats)
);
}
public getUniqueCount(shopID: string, from: Date, to: Date): Observable<number> {
return this.analyticsService.getPaymentRateStats(shopID, from, to)
.map((paymentRateStat) => paymentRateStat ? paymentRateStat.uniqueCount : 0);
return this.analyticsService
.getPaymentRateStats(shopID, from, to)
.map(paymentRateStat => (paymentRateStat ? paymentRateStat.uniqueCount : 0));
}
public getPaymentConversionData(shopID: string, from: Date, to: Date): Observable<PaymentConversionData> {
return this.analyticsService.getPaymentConversionStats(shopID, from, to).map((paymentConversionStat) => {
const paymentCount = StatsDataConverter.toPaymentCountInfo(paymentConversionStat);
const conversionChartData = StatsDataConverter.toConversionChartData(from, paymentConversionStat);
return {paymentCount, conversionChartData};
});
public getPaymentConversionData(
shopID: string,
from: Date,
to: Date
): Observable<PaymentConversionData> {
return this.analyticsService
.getPaymentConversionStats(shopID, from, to)
.map(paymentConversionStat => {
const paymentCount = StatsDataConverter.toPaymentCountInfo(paymentConversionStat);
const conversionChartData = StatsDataConverter.toConversionChartData(
from,
paymentConversionStat
);
return { paymentCount, conversionChartData };
});
}
public getPaymentGeoChartData(shopID: string, from: Date, to: Date): Observable<DoughnutChartData> {
public getPaymentGeoChartData(
shopID: string,
from: Date,
to: Date
): Observable<DoughnutChartData> {
return Observable.create((observer: Observer<DoughnutChartData>) => {
this.analyticsService.getPaymentGeoStats(shopID, from, to).subscribe((paymentGeoStat) => {
this.analyticsService.getPaymentGeoStats(shopID, from, to).subscribe(paymentGeoStat => {
const data = StatsDataConverter.toGeoChartData(paymentGeoStat);
this.locationService.getLocationsNames(data.labels)
.subscribe((locationNames) => {
data.labels = locationNames.map(locationName => locationName.name);
observer.next(data);
});
this.locationService.getLocationsNames(data.labels).subscribe(locationNames => {
data.labels = locationNames.map(locationName => locationName.name);
observer.next(data);
});
});
});
}
public getPaymentRevenueData(shopID: string, from: Date, to: Date): Observable<PaymentRevenueData> {
return this.analyticsService.getPaymentRevenueStats(shopID, from, to).map((paymentRevenueStat) => {
const profit = StatsDataConverter.toTotalProfit(paymentRevenueStat);
const revenueChartData = StatsDataConverter.toRevenueChartData(from, paymentRevenueStat);
return {profit, revenueChartData};
});
public getPaymentRevenueData(
shopID: string,
from: Date,
to: Date
): Observable<PaymentRevenueData> {
return this.analyticsService
.getPaymentRevenueStats(shopID, from, to)
.map(paymentRevenueStat => {
const profit = StatsDataConverter.toTotalProfit(paymentRevenueStat);
const revenueChartData = StatsDataConverter.toRevenueChartData(
from,
paymentRevenueStat
);
return { profit, revenueChartData };
});
}
}

View File

@ -8,7 +8,6 @@ import { DoughnutChartData } from 'koffing/analytics/stats-data/doughnut-chart-d
templateUrl: './doughnut-chart.component.pug'
})
export class DoughnutChartComponent implements OnInit {
@Input()
public chartData: Observable<DoughnutChartData>;
@ -24,26 +23,28 @@ export class DoughnutChartComponent implements OnInit {
}
};
public chartColors = [{
backgroundColor : [
'#ddf0e1',
'#cee9f6',
'#fddadb',
'#ebdaff',
'#f5ecdd',
'#f6d4dc',
'#fdc478',
'#aec4e8',
'#c0f1f0',
'#949fb1',
'#bba8dc',
'#d4cfcd',
'#ffb6b6',
'#f2fdeb',
'#f8f8f8',
'#ccfaf6'
]
}];
public chartColors = [
{
backgroundColor: [
'#ddf0e1',
'#cee9f6',
'#fddadb',
'#ebdaff',
'#f5ecdd',
'#f6d4dc',
'#fdc478',
'#aec4e8',
'#c0f1f0',
'#949fb1',
'#bba8dc',
'#d4cfcd',
'#ffb6b6',
'#f2fdeb',
'#f8f8f8',
'#ccfaf6'
]
}
];
public ngOnInit() {
this.chartData.subscribe((chartData: DoughnutChartData) => {

View File

@ -8,7 +8,6 @@ import { LineChartData } from 'koffing/analytics/stats-data/line-chart-data';
templateUrl: './line-chart.component.pug'
})
export class LineChartComponent implements OnInit {
@Input()
public chartData: Observable<LineChartData>;
@ -23,28 +22,34 @@ export class LineChartComponent implements OnInit {
}
},
scales: {
yAxes: [{
stacked: true
}],
xAxes: [{
ticks: {
fontSize: 11
yAxes: [
{
stacked: true
}
}]
],
xAxes: [
{
ticks: {
fontSize: 11
}
}
]
},
legend: {
display: false
}
};
public chartColors = [{
backgroundColor: 'rgba(148,159,177,0.2)',
borderColor: '#73879C',
pointBackgroundColor: '#73879C',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#79909c',
pointHoverBorderColor: '#fff',
}];
public chartColors = [
{
backgroundColor: 'rgba(148,159,177,0.2)',
borderColor: '#73879C',
pointBackgroundColor: '#73879C',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#79909c',
pointHoverBorderColor: '#fff'
}
];
public ngOnInit() {
this.chartData.subscribe((chartData: LineChartData) => {

View File

@ -9,7 +9,6 @@ import { PanelData } from 'koffing/analytics/statistic-panel/panel-data';
templateUrl: './statistic-panel.component.pug'
})
export class StatisticPanelComponent implements OnInit {
@Input()
public data: Observable<PanelData>;

View File

@ -11,11 +11,12 @@ import { Dataset } from './dataset';
import { DoughnutChartData } from './doughnut-chart-data';
export class StatsDataConverter {
public static toPaymentMethodChartData(stat: PaymentMethodStat[]): DoughnutChartData {
const group = groupBy(stat, 'paymentSystem');
const paymentSystems = keys(group);
const data = paymentSystems.map((system) => group[system].reduce((acc, item) => acc + item.totalCount, 0));
const data = paymentSystems.map(system =>
group[system].reduce((acc, item) => acc + item.totalCount, 0)
);
const labels = paymentSystems.map(system => {
let result = system;
if (system === 'visa') {
@ -27,32 +28,46 @@ export class StatsDataConverter {
}
return result;
});
return {data, labels};
return { data, labels };
}
public static toGeoChartData(stat: PaymentGeoStat[]): DoughnutChartData {
const group = groupBy(stat, 'geoID');
const labels = keys(group);
const data = labels.map(geoID => group[geoID].reduce((acc, item) => acc + item.profit, 0) / 100);
return {data, labels};
const data = labels.map(
geoID => group[geoID].reduce((acc, item) => acc + item.profit, 0) / 100
);
return { data, labels };
}
public static toRevenueChartData(from: Date, stat: PaymentRevenueStat[]): LineChartData {
const labels = stat.map((item) => moment(from).add(item.offset, 's').format('DD.MM HH:mm'));
const datasets: Dataset[] = [{
label: 'Оборот',
data: stat.map((item) => round(item.profit / 100, 2))
}];
return {labels, datasets};
const labels = stat.map(item =>
moment(from)
.add(item.offset, 's')
.format('DD.MM HH:mm')
);
const datasets: Dataset[] = [
{
label: 'Оборот',
data: stat.map(item => round(item.profit / 100, 2))
}
];
return { labels, datasets };
}
public static toConversionChartData(from: Date, stat: PaymentConversionStat[]): LineChartData {
const labels = stat.map((item) => moment(from).add(item.offset, 's').format('DD.MM HH:mm'));
const datasets: Dataset[] = [{
label: 'Конверсия',
data: stat.map((item) => round(item.conversion * 100, 0))
}];
return {labels, datasets};
const labels = stat.map(item =>
moment(from)
.add(item.offset, 's')
.format('DD.MM HH:mm')
);
const datasets: Dataset[] = [
{
label: 'Конверсия',
data: stat.map(item => round(item.conversion * 100, 0))
}
];
return { labels, datasets };
}
public static toTotalProfit(stat: PaymentRevenueStat[]): number {
@ -60,11 +75,14 @@ export class StatsDataConverter {
}
public static toPaymentCountInfo(stat: PaymentConversionStat[]): PaymentCount {
return stat.reduce((acc, item) => {
return {
successfulCount: acc.successfulCount + item.successfulCount,
unfinishedCount: acc.unfinishedCount + (item.totalCount - item.successfulCount)
};
}, {successfulCount: 0, unfinishedCount: 0});
return stat.reduce(
(acc, item) => {
return {
successfulCount: acc.successfulCount + item.successfulCount,
unfinishedCount: acc.unfinishedCount + (item.totalCount - item.successfulCount)
};
},
{ successfulCount: 0, unfinishedCount: 0 }
);
}
}

View File

@ -8,10 +8,7 @@ import { ContainerComponent } from './root/components/container/container.compon
import { RootModule } from './root/root.module';
@NgModule({
imports: [
HttpModule,
RootModule
],
imports: [HttpModule, RootModule],
providers: [
{
provide: KoffingHttp,
@ -31,4 +28,4 @@ import { RootModule } from './root/root.module';
],
bootstrap: [ContainerComponent]
})
export class AppModule { }
export class AppModule {}

View File

@ -3,16 +3,17 @@ import { AuthInfo } from './auth-info';
declare const Keycloak: any;
export class AuthService {
public static authInstance: any;
public static init(): Promise<any> {
const auth: any = new Keycloak('authConfig.json');
return new Promise((resolve, reject) => {
auth.init({onLoad: 'login-required'}).success(() => {
this.authInstance = auth;
resolve();
}).error(() => reject());
auth.init({ onLoad: 'login-required' })
.success(() => {
this.authInstance = auth;
resolve();
})
.error(() => reject());
});
}

View File

@ -7,13 +7,11 @@ import { Account } from './model';
@Injectable()
export class AccountsService {
constructor(
private http: KoffingHttp,
private config: ConfigService
) { }
constructor(private http: KoffingHttp, private config: ConfigService) {}
public getAccountByID(accountID: number): Observable<Account> {
return this.http.get(`${this.config.capiUrl}/processing/accounts/${accountID}`).map(res => res.json());
return this.http
.get(`${this.config.capiUrl}/processing/accounts/${accountID}`)
.map(res => res.json());
}
}

View File

@ -16,57 +16,84 @@ import {
@Injectable()
export class AnalyticsService {
constructor(private http: KoffingHttp, private config: ConfigService) {}
constructor(private http: KoffingHttp,
private config: ConfigService) {
}
public getPaymentMethodStats(shopID: string, from: Date, to: Date, splitUnit?: string, splitSize?: number, paymentMethod?: string): Observable<PaymentMethodStat[]> {
public getPaymentMethodStats(
shopID: string,
from: Date,
to: Date,
splitUnit?: string,
splitSize?: number,
paymentMethod?: string
): Observable<PaymentMethodStat[]> {
const search = new URLSearchParams();
search.set('fromTime', this.toUTC(from));
search.set('toTime', this.toUTC(to));
search.set('splitUnit', splitUnit || 'minute');
search.set('splitSize', this.getSplitSize(splitSize));
search.set('paymentMethod', paymentMethod || 'bankCard');
return this.http.get(`${this.getEndpoint(shopID, 'customers')}/payment_method`, {search})
.map((res) => res.json());
return this.http
.get(`${this.getEndpoint(shopID, 'customers')}/payment_method`, { search })
.map(res => res.json());
}
public getPaymentRateStats(shopID: string, from: Date, to: Date): Observable<PaymentRateStat> {
const search = new URLSearchParams();
search.set('fromTime', this.toUTC(from));
search.set('toTime', this.toUTC(to));
return this.http.get(`${this.getEndpoint(shopID, 'customers')}/rate`, {search})
.map((res) => res.json());
return this.http
.get(`${this.getEndpoint(shopID, 'customers')}/rate`, { search })
.map(res => res.json());
}
public getPaymentConversionStats(shopID: string, from: Date, to: Date, splitUnit?: string, splitSize?: number): Observable<PaymentConversionStat[]> {
public getPaymentConversionStats(
shopID: string,
from: Date,
to: Date,
splitUnit?: string,
splitSize?: number
): Observable<PaymentConversionStat[]> {
const search = new URLSearchParams();
search.set('fromTime', this.toUTC(from));
search.set('toTime', this.toUTC(to));
search.set('splitUnit', splitUnit || 'minute');
search.set('splitSize', this.getSplitSize(splitSize));
return this.http.get(`${this.getEndpoint(shopID, 'payments')}/conversion`, {search})
.map((res) => res.json());
return this.http
.get(`${this.getEndpoint(shopID, 'payments')}/conversion`, { search })
.map(res => res.json());
}
public getPaymentGeoStats(shopID: string, from: Date, to: Date, splitUnit?: string, splitSize?: number): Observable<PaymentGeoStat[]> {
public getPaymentGeoStats(
shopID: string,
from: Date,
to: Date,
splitUnit?: string,
splitSize?: number
): Observable<PaymentGeoStat[]> {
const search = new URLSearchParams();
search.set('fromTime', this.toUTC(from));
search.set('toTime', this.toUTC(to));
search.set('splitUnit', splitUnit || 'day');
search.set('splitSize', this.getSplitSize(splitSize));
return this.http.get(`${this.getEndpoint(shopID, 'payments')}/geo`, {search})
.map((res) => res.json());
return this.http
.get(`${this.getEndpoint(shopID, 'payments')}/geo`, { search })
.map(res => res.json());
}
public getPaymentRevenueStats(shopID: string, from: Date, to: Date, splitUnit?: string, splitSize?: number): Observable<PaymentRevenueStat[]> {
public getPaymentRevenueStats(
shopID: string,
from: Date,
to: Date,
splitUnit?: string,
splitSize?: number
): Observable<PaymentRevenueStat[]> {
const search = new URLSearchParams();
search.set('fromTime', this.toUTC(from));
search.set('toTime', this.toUTC(to));
search.set('splitUnit', splitUnit || 'minute');
search.set('splitSize', this.getSplitSize(splitSize));
return this.http.get(`${this.getEndpoint(shopID, 'payments')}/revenue`, {search})
return this.http
.get(`${this.getEndpoint(shopID, 'payments')}/revenue`, { search })
.map(res => res.json());
}
@ -75,7 +102,9 @@ export class AnalyticsService {
}
private toUTC(date: Date): string {
return moment(date).utc().format();
return moment(date)
.utc()
.format();
}
private getSplitSize(splitSize: number) {

View File

@ -37,4 +37,4 @@ import { DownloadService } from './download.service';
DownloadService
]
})
export class BackendModule { }
export class BackendModule {}

View File

@ -7,19 +7,15 @@ import { Category } from './model';
@Injectable()
export class CategoryService {
private endpoint = `${this.config.capiUrl}/processing/categories`;
constructor(
private http: KoffingHttp,
private config: ConfigService
) { }
constructor(private http: KoffingHttp, private config: ConfigService) {}
public getCategories(): Observable<Category[]> {
return this.http.get(this.endpoint).map((res) => res.json());
return this.http.get(this.endpoint).map(res => res.json());
}
public getCategoryByID(categoryID: number): Observable<Category> {
return this.http.get(`${this.endpoint}/${categoryID}`).map((res) => res.json());
return this.http.get(`${this.endpoint}/${categoryID}`).map(res => res.json());
}
}

View File

@ -8,38 +8,47 @@ import { Claim, PartyModification } from './model';
@Injectable()
export class ClaimService {
private endpoint = `${this.config.capiUrl}/processing/claims`;
constructor(private http: KoffingHttp,
private config: ConfigService) {
}
constructor(private http: KoffingHttp, private config: ConfigService) {}
public getClaims(claimStatus?: string): Observable<Claim[]> {
const search = new URLSearchParams();
if (claimStatus) {
search.set('claimStatus', claimStatus);
}
return this.http.get(this.endpoint, {search}).map((res) => res.json());
return this.http.get(this.endpoint, { search }).map(res => res.json());
}
public createClaim(claimChangeset: PartyModification[]): Observable<Claim> {
return this.http.post(this.endpoint, claimChangeset).map((res) => res.json());
return this.http.post(this.endpoint, claimChangeset).map(res => res.json());
}
public getClaimByID(claimID: number): Observable<Claim> {
return this.http.get(`${this.endpoint}/${claimID}`).map((res) => res.json());
return this.http.get(`${this.endpoint}/${claimID}`).map(res => res.json());
}
public revokeClaimByID(claimID: number, claimRevision: number, reason: string): Observable<void> {
public revokeClaimByID(
claimID: number,
claimRevision: number,
reason: string
): Observable<void> {
const search = new URLSearchParams();
search.set('claimRevision', String(claimRevision));
return this.http.put(`${this.endpoint}/${claimID}/revoke`, {reason}, {search}).map((res) => res.json());
return this.http
.put(`${this.endpoint}/${claimID}/revoke`, { reason }, { search })
.map(res => res.json());
}
public updateClaimByID(claimID: number, claimRevision: number, claimChangeset: PartyModification[]): Observable<void> {
public updateClaimByID(
claimID: number,
claimRevision: number,
claimChangeset: PartyModification[]
): Observable<void> {
const search = new URLSearchParams();
search.set('claimRevision', String(claimRevision));
return this.http.post(`${this.endpoint}/${claimID}/update`, claimChangeset, {search}).map((res) => res.json());
return this.http
.post(`${this.endpoint}/${claimID}/update`, claimChangeset, { search })
.map(res => res.json());
}
}

View File

@ -3,7 +3,6 @@ import { Injectable } from '@angular/core';
@Injectable()
export class ConfigService {
public capiUrl: string;
public wapiUrl: string;
public checkoutUrl: string;
@ -11,11 +10,13 @@ export class ConfigService {
public supportEmail: string;
public shortenUrlEndpoint: string;
constructor(private http: Http) { }
constructor(private http: Http) {}
public load() {
return new Promise(resolve => {
this.http.get(`appConfig.json?timestamp=${new Date().getTime()}`).map(res => res.json())
this.http
.get(`appConfig.json?timestamp=${new Date().getTime()}`)
.map(res => res.json())
.subscribe(data => {
this.capiUrl = `${data.capiEndpoint}/v2`;
this.wapiUrl = `${data.capiEndpoint}/wallet/v0`;

View File

@ -7,19 +7,15 @@ import { Contract } from './model';
@Injectable()
export class ContractService {
private endpoint: string = `${this.config.capiUrl}/processing/contracts`;
constructor(
private http: KoffingHttp,
private config: ConfigService
) { }
constructor(private http: KoffingHttp, private config: ConfigService) {}
public getContracts(): Observable<Contract[]> {
return this.http.get(this.endpoint).map((res) => res.json());
return this.http.get(this.endpoint).map(res => res.json());
}
public getContractByID(contractID: string): Observable<Contract> {
return this.http.get(`${this.endpoint}/${contractID}`).map((res) => res.json());
return this.http.get(`${this.endpoint}/${contractID}`).map(res => res.json());
}
}

View File

@ -7,15 +7,11 @@ import { Customer } from './model';
@Injectable()
export class CustomerService {
private endpoint: string = `${this.config.capiUrl}/processing/customers`;
constructor(
private http: KoffingHttp,
private config: ConfigService
) { }
constructor(private http: KoffingHttp, private config: ConfigService) {}
public getCustomerById(customerID: string): Observable<Customer> {
return this.http.get(`${this.endpoint}/${customerID}`).map((res) => res.json());
return this.http.get(`${this.endpoint}/${customerID}`).map(res => res.json());
}
}

View File

@ -7,14 +7,19 @@ import { ReportLink } from 'koffing/backend/model';
@Injectable()
export class DownloadService {
constructor(private http: KoffingHttp, private config: ConfigService) {}
constructor(
private http: KoffingHttp,
private config: ConfigService
) { }
public downloadReport(shopID: string, reportID: number, fileID: string): Observable<ReportLink> {
return this.http.get(`${this.config.capiUrl}/shops/${shopID}/reports/${reportID}/files/${fileID}/download`)
.map((response) => response.json());
public downloadReport(
shopID: string,
reportID: number,
fileID: string
): Observable<ReportLink> {
return this.http
.get(
`${
this.config.capiUrl
}/shops/${shopID}/reports/${reportID}/files/${fileID}/download`
)
.map(response => response.json());
}
}

View File

@ -8,20 +8,22 @@ import { Event } from './model';
@Injectable()
export class EventService {
private endpoint: string = `${this.config.capiUrl}/processing/invoices`;
constructor(
private http: KoffingHttp,
private config: ConfigService
) { }
constructor(private http: KoffingHttp, private config: ConfigService) {}
public getInvoiceEvents(invoiceID: string, limit: number, eventID?: number): Observable<Event[]> {
public getInvoiceEvents(
invoiceID: string,
limit: number,
eventID?: number
): Observable<Event[]> {
const search = new URLSearchParams();
search.set('limit', String(limit));
if (eventID) {
search.set('eventID', String(eventID));
}
return this.http.get(`${this.endpoint}/${invoiceID}/events`, {search}).map((res) => res.json());
return this.http
.get(`${this.endpoint}/${invoiceID}/events`, { search })
.map(res => res.json());
}
}

View File

@ -1,6 +1,6 @@
export function applyMixins(derivedCtor: any, baseCtors: any[]) {
baseCtors.forEach((baseCtor) => {
Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {
baseCtors.forEach(baseCtor => {
Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
derivedCtor.prototype[name] = baseCtor.prototype[name];
});
});

View File

@ -8,31 +8,42 @@ import { InvoiceTemplate, InvoiceTemplateAndToken, PaymentMethod } from './model
@Injectable()
export class InvoiceTemplateService {
private invoiceTemplatesUrl: string = `${this.config.capiUrl}/processing/invoice-templates`;
constructor(
private http: KoffingHttp,
private config: ConfigService
) {}
constructor(private http: KoffingHttp, private config: ConfigService) {}
public getInvoiceTemplateByID(invoiceTemplateID: string): Observable<InvoiceTemplate> {
return this.http.get(`${this.invoiceTemplatesUrl}/${invoiceTemplateID}`).map(res => res.json());
return this.http
.get(`${this.invoiceTemplatesUrl}/${invoiceTemplateID}`)
.map(res => res.json());
}
public createInvoiceTemplate(params: InvoiceTemplateParams): Observable<InvoiceTemplateAndToken> {
public createInvoiceTemplate(
params: InvoiceTemplateParams
): Observable<InvoiceTemplateAndToken> {
return this.http.post(this.invoiceTemplatesUrl, params).map(res => res.json());
}
public updateInvoiceTemplate(invoiceTemplateID: string, params: InvoiceTemplateParams): Observable<InvoiceTemplate> {
return this.http.put(`${this.invoiceTemplatesUrl}/${invoiceTemplateID}`, params).map(res => res.json());
public updateInvoiceTemplate(
invoiceTemplateID: string,
params: InvoiceTemplateParams
): Observable<InvoiceTemplate> {
return this.http
.put(`${this.invoiceTemplatesUrl}/${invoiceTemplateID}`, params)
.map(res => res.json());
}
public deleteInvoiceTemplate(invoiceTemplateID: string): Observable<any> {
return this.http.delete(`${this.invoiceTemplatesUrl}/${invoiceTemplateID}`).map(res => res.json());
return this.http
.delete(`${this.invoiceTemplatesUrl}/${invoiceTemplateID}`)
.map(res => res.json());
}
public getInvoiceTemplatePaymentMethods(invoiceTemplateID: string): Observable<PaymentMethod[]> {
return this.http.get(`${this.invoiceTemplatesUrl}/${invoiceTemplateID}/payment-methods`).map(res => res.json());
public getInvoiceTemplatePaymentMethods(
invoiceTemplateID: string
): Observable<PaymentMethod[]> {
return this.http
.get(`${this.invoiceTemplatesUrl}/${invoiceTemplateID}/payment-methods`)
.map(res => res.json());
}
}

View File

@ -10,46 +10,51 @@ import { PaymentRefund } from 'koffing/backend/model';
@Injectable()
export class InvoiceService {
private endpoint = `${this.config.capiUrl}/processing/invoices`;
constructor(
private http: KoffingHttp,
private config: ConfigService
) {}
constructor(private http: KoffingHttp, private config: ConfigService) {}
public createInvoice(params: InvoiceParams): Observable<InvoiceAndToken> {
return this.http.post(this.endpoint, params)
.map(res => res.json());
return this.http.post(this.endpoint, params).map(res => res.json());
}
public createInvoiceAccessToken(invoiceID: string): Observable<InvoiceAccessToken> {
return this.http.post(`${this.endpoint}/${invoiceID}/access-tokens`, {})
.map((res) => res.json());
return this.http
.post(`${this.endpoint}/${invoiceID}/access-tokens`, {})
.map(res => res.json());
}
public capturePayment(invoiceID: string, paymentID: string, reason: string): Observable<void> {
return this.http.post(`${this.endpoint}/${invoiceID}/payments/${paymentID}/capture`, {reason})
.map((res) => null);
return this.http
.post(`${this.endpoint}/${invoiceID}/payments/${paymentID}/capture`, { reason })
.map(res => null);
}
public cancelPayment(invoiceID: string, paymentID: string, reason: string): Observable<void> {
return this.http.post(`${this.endpoint}/${invoiceID}/payments/${paymentID}/cancel`, {reason})
.map((res) => null);
return this.http
.post(`${this.endpoint}/${invoiceID}/payments/${paymentID}/cancel`, { reason })
.map(res => null);
}
public refundPayment(invoiceID: string, paymentID: string, params: RefundParams): Observable<PaymentRefund> {
return this.http.post(`${this.endpoint}/${invoiceID}/payments/${paymentID}/refunds`, {...params})
.map((res) => res.json());
public refundPayment(
invoiceID: string,
paymentID: string,
params: RefundParams
): Observable<PaymentRefund> {
return this.http
.post(`${this.endpoint}/${invoiceID}/payments/${paymentID}/refunds`, { ...params })
.map(res => res.json());
}
public getRefunds(invoiceID: string, paymentID: string): Observable<PaymentRefund[]> {
return this.http.get(`${this.endpoint}/${invoiceID}/payments/${paymentID}/refunds`)
return this.http
.get(`${this.endpoint}/${invoiceID}/payments/${paymentID}/refunds`)
.map(res => res.json());
}
public getInvoicePaymentMethods(invoiceID: string): Observable<PaymentMethod[]> {
return this.http.get(`${this.endpoint}/${invoiceID}/payment-methods`)
return this.http
.get(`${this.endpoint}/${invoiceID}/payment-methods`)
.map(res => res.json());
}
}

View File

@ -1,11 +1,18 @@
import { Http, ConnectionBackend, RequestOptions, Request, RequestOptionsArgs, Response, Headers } from '@angular/http';
import {
Http,
ConnectionBackend,
RequestOptions,
Request,
RequestOptionsArgs,
Response,
Headers
} from '@angular/http';
import { Observable, Observer } from 'rxjs';
import { HttpErrorBroadcaster } from 'koffing/broadcaster';
import { AuthService } from 'koffing/auth/auth.service';
export class KoffingHttp extends Http {
constructor(
connectionBackend: ConnectionBackend,
defaultOptions: RequestOptions,
@ -57,30 +64,37 @@ export class KoffingHttp extends Http {
const tokenUpdateObservable: Observable<any> = Observable.create((observer: any) => {
if (!options) {
const headers = new Headers();
options = new RequestOptions({headers});
options = new RequestOptions({ headers });
}
this.setHeaders(options);
observer.next();
observer.complete();
});
const requestObservable: Observable<Response> = Observable.create((observer: Observer<any>) => {
let result: any;
if (body) {
result = f.apply(this, [url, body, options]);
} else {
result = f.apply(this, [url, options]);
const requestObservable: Observable<Response> = Observable.create(
(observer: Observer<any>) => {
let result: any;
if (body) {
result = f.apply(this, [url, body, options]);
} else {
result = f.apply(this, [url, options]);
}
result.subscribe(
(response: any) => {
observer.next(response);
observer.complete();
},
(error: any) => {
this.httpErrorBroadcaster.fire(error.status);
observer.error(error);
}
);
}
result.subscribe((response: any) => {
observer.next(response);
observer.complete();
}, (error: any) => {
this.httpErrorBroadcaster.fire(error.status);
observer.error(error);
});
});
return <Observable<Response>> Observable
.merge(tokenObservable, tokenUpdateObservable, requestObservable, 1)
.filter((response) => response instanceof Response);
);
return <Observable<Response>>(
Observable.merge(tokenObservable, tokenUpdateObservable, requestObservable, 1).filter(
response => response instanceof Response
)
);
}
private getToken(): Promise<string> {
@ -107,7 +121,9 @@ export class KoffingHttp extends Http {
private guid(): string {
function s4() {
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
return `${s4()}${s4()}-${s4()}-${s4()}`;
}

View File

@ -10,11 +10,7 @@ import { LocationName } from './model';
@Injectable()
export class LocationService {
constructor(
private http: KoffingHttp,
private config: ConfigService
) { }
constructor(private http: KoffingHttp, private config: ConfigService) {}
public getLocationsNames(geoIDs: string[], language?: string): Observable<LocationName[]> {
if (isNil(geoIDs) || geoIDs.length === 0) {
@ -26,6 +22,8 @@ export class LocationService {
const search = new URLSearchParams();
search.set('geoIDs', geoIDs.join(','));
search.set('language', language || 'ru');
return this.http.get(`${this.config.capiUrl}/reference/geo/location/names`, {search}).map((res) => res.json());
return this.http
.get(`${this.config.capiUrl}/reference/geo/location/names`, { search })
.map(res => res.json());
}
}

View File

@ -1,7 +1,6 @@
import { Claim } from './claim';
export class ClaimAccepted extends Claim {
public acceptedAt: string;
constructor() {

View File

@ -1,7 +1,6 @@
import { Claim } from './claim';
export class ClaimDenied extends Claim {
public reason: string;
constructor() {

View File

@ -1,7 +1,6 @@
import { Claim } from './claim';
export class ClaimPending extends Claim {
constructor() {
super();
this.status = 'ClaimPending';

View File

@ -1,7 +1,6 @@
import { Claim } from './claim';
export class ClaimRevoked extends Claim {
constructor() {
super();
this.status = 'ClaimRevoked';

View File

@ -1,7 +1,6 @@
import { ContractModification } from './contract-modification';
export class ContractAdjustmentCreation extends ContractModification {
public adjustmentID: string;
constructor() {

View File

@ -2,7 +2,6 @@ import { ContractModification } from './contract-modification';
import { Contractor } from '../../../contract/contractor/contractor';
export class ContractCreation extends ContractModification {
public contractor: Contractor;
public paymentInstitutionID: number;

View File

@ -2,7 +2,6 @@ import { ContractModification } from './contract-modification';
import { LegalAgreement } from '../../../contract/legal-agreement';
export class ContractLegalAgreementBinding extends ContractModification {
public legalAgreement: LegalAgreement;
constructor() {

View File

@ -1,7 +1,6 @@
import { PartyModification } from '../party-modification';
export abstract class ContractModification extends PartyModification {
public contractID: string;
public contractModificationType: string;

View File

@ -2,12 +2,16 @@ import { ContractModification } from './contract-modification';
import { PayoutToolDetails } from '../../../payout-tool/payout-tool-details/payout-tool-details';
export class ContractPayoutToolCreation extends ContractModification {
public payoutToolID: string;
public currency: string;
public details: PayoutToolDetails;
constructor(currency: string, contractID: string, payoutToolID: string, details: PayoutToolDetails) {
constructor(
currency: string,
contractID: string,
payoutToolID: string,
details: PayoutToolDetails
) {
super();
this.currency = currency;
this.contractModificationType = 'ContractPayoutToolCreation';

View File

@ -1,12 +1,10 @@
import { ContractModification } from './contract-modification';
export class ContractTermination extends ContractModification {
public reason: string;
constructor() {
super();
this.contractModificationType = 'ContractTermination';
}
}

View File

@ -1,7 +1,6 @@
import { ShopModification } from './shop-modification';
export class ShopAccountCreation extends ShopModification {
public currency: string;
constructor() {

View File

@ -1,7 +1,6 @@
import { ShopModification } from './shop-modification';
export class ShopCategoryChange extends ShopModification {
public categoryID: number;
constructor() {

View File

@ -1,10 +1,9 @@
import { ShopModification } from './shop-modification';
export class ShopContractBinding extends ShopModification {
public contractID: string;
public payoutToolID: string;
constructor(shopID: string, contractID: string, payoutToolID: string) {
super();
this.shopModificationType = 'ShopContractBinding';

View File

@ -3,18 +3,17 @@ import { ShopLocation } from '../../../shop/shop-location/shop-location';
import { ShopDetails } from '../../../shop/shop-details';
export class ShopCreation extends ShopModification {
public location: ShopLocation;
public details: ShopDetails;
public contractID: string;
public payoutToolID: string;
constructor(options: {
shopID: string,
location: ShopLocation,
details: ShopDetails,
contractID: string,
payoutToolID: string
shopID: string;
location: ShopLocation;
details: ShopDetails;
contractID: string;
payoutToolID: string;
}) {
super();
this.shopModificationType = 'ShopCreation';

View File

@ -2,7 +2,6 @@ import { ShopModification } from './shop-modification';
import { ShopDetails } from './../../../shop/shop-details';
export class ShopDetailsChange extends ShopModification {
public details: ShopDetails;
constructor() {

View File

@ -2,7 +2,6 @@ import { ShopModification } from './shop-modification';
import { ShopLocation } from 'koffing/backend/model/shop/shop-location/shop-location';
export class ShopLocationChange extends ShopModification {
public location: ShopLocation;
constructor() {

View File

@ -1,7 +1,6 @@
import { PartyModification } from '../party-modification';
export abstract class ShopModification extends PartyModification {
public shopID: string;
public shopModificationType: string;

View File

@ -10,11 +10,11 @@ export class InternationalLegalEntity extends LegalEntity {
public bankAccount: BankAccount;
constructor(options: {
legalName: string,
registeredOffice: string,
tradingName?: string,
principalPlaceOfBusiness?: string
bankAccount: BankAccount
legalName: string;
registeredOffice: string;
tradingName?: string;
principalPlaceOfBusiness?: string;
bankAccount: BankAccount;
}) {
super();
this.entityType = LegalEntityTypeEnum.InternationalLegalEntity;

View File

@ -1,8 +1,7 @@
import { Contractor } from './contractor';
import {LegalEntityTypeEnum} from './legal-entity-type-enum';
import { LegalEntityTypeEnum } from './legal-entity-type-enum';
export abstract class LegalEntity extends Contractor {
public entityType: LegalEntityTypeEnum;
constructor() {

View File

@ -1,7 +1,6 @@
import { Contractor } from './contractor';
export class RegisteredUser extends Contractor {
public email: string;
constructor() {

View File

@ -3,7 +3,6 @@ import { BankAccount } from 'koffing/backend';
import { LegalEntityTypeEnum } from './legal-entity-type-enum';
export class RussianLegalEntity extends LegalEntity {
public registeredName: string;
public registeredNumber: string;
public inn: string;
@ -15,15 +14,15 @@ export class RussianLegalEntity extends LegalEntity {
public bankAccount: BankAccount;
constructor(options: {
registeredName: string,
registeredNumber: string,
inn: string,
actualAddress: string,
postAddress: string,
representativePosition: string,
representativeFullName: string,
representativeDocument: string,
bankAccount: BankAccount
registeredName: string;
registeredNumber: string;
inn: string;
actualAddress: string;
postAddress: string;
representativePosition: string;
representativeFullName: string;
representativeDocument: string;
bankAccount: BankAccount;
}) {
super();
this.entityType = LegalEntityTypeEnum.RussianLegalEntity;

View File

@ -3,7 +3,7 @@ import { Invoice } from '../invoice';
export class InvoiceCreated extends InvoiceChange {
public invoice: Invoice;
constructor() {
super();
this.changeType = 'InvoiceCreated';

View File

@ -3,7 +3,7 @@ import { Payment } from '../payment/payment';
export class PaymentStarted extends InvoiceChange {
public payment: Payment;
constructor() {
super();
this.changeType = 'PaymentStarted';

View File

@ -1,7 +1,6 @@
import { InvoiceLineTaxMode } from './invoice-line-tax-mode';
export class InvoiceLineTaxVAT extends InvoiceLineTaxMode {
public rate: string;
constructor(rate: string) {

View File

@ -1,7 +1,6 @@
import { InvoiceLineTaxMode } from './invoice-line-tax-mode';
export class InvoiceLine {
public product: string;
public quantity: number;
public price: number;

View File

@ -1,7 +1,6 @@
import { InvoiceTemplateLineCost } from './invoice-template-line-cost';
export class InvoiceTemplateLineCostFixed extends InvoiceTemplateLineCost {
public amount: number;
public currency: string;

View File

@ -2,7 +2,6 @@ import { InvoiceTemplateLineCost } from './invoice-template-line-cost';
import { CostAmountRange } from './cost-amount-range';
export class InvoiceTemplateLineCostRange extends InvoiceTemplateLineCost {
public range: CostAmountRange;
public currency: string;

View File

@ -2,7 +2,6 @@ import { InvoiceTemplateDetails } from './invoice-template-details';
import { InvoiceLine } from '../invoice-cart/invoice-line';
export class InvoiceTemplateMultiLine extends InvoiceTemplateDetails {
public cart: InvoiceLine[];
public currency: string;

View File

@ -3,7 +3,6 @@ import { InvoiceTemplateLineCost } from './invoice-template-line-cost';
import { InvoiceLineTaxMode } from '../invoice-cart/invoice-line-tax-mode';
export class InvoiceTemplateSingleLine extends InvoiceTemplateDetails {
public product: string;
public price: InvoiceTemplateLineCost;
public taxMode?: InvoiceLineTaxMode;

View File

@ -1,7 +1,6 @@
import { Payer } from './payer';
export class CustomerPayer extends Payer {
public customerID: string;
constructor() {

View File

@ -4,7 +4,6 @@ import { ClientInfo } from '../client-info';
import { ContactInfo } from '../contact-info';
export class PaymentResourcePayer extends Payer {
public paymentToolToken: string;
public paymentSession: string;
public paymentToolDetails: PaymentToolDetails;

View File

@ -1,7 +1,6 @@
import { PaymentMethod } from './payment-method';
export class PaymentMethodBankCard extends PaymentMethod {
public paymentSystems: string[];
public tokenProviders: string[];

View File

@ -1,9 +1,8 @@
import { PaymentMethod } from './payment-method';
export class PaymentMethodTerminal extends PaymentMethod {
public providers: string[];
constructor() {
super();
this.method = 'PaymentTerminal';

View File

@ -1,7 +1,6 @@
import { PaymentMethod } from './payment-method';
export class PaymentMethodWallets extends PaymentMethod {
public providers: string[];
constructor() {

View File

@ -1,7 +1,6 @@
import { PaymentToolDetails } from './payment-tool-details';
export class PaymentToolDetailsBankCard extends PaymentToolDetails {
public cardNumberMask: string;
public bin: string;
public lastDigits: string;

View File

@ -1,7 +1,6 @@
import { PaymentToolDetails } from './payment-tool-details';
export class PaymentToolDetailsPaymentTerminal extends PaymentToolDetails {
public provider: string;
constructor() {

View File

@ -1,7 +1,6 @@
import { PaymentFlow } from 'koffing/backend/model/payment/payment-flow';
export class PaymentFlowHold extends PaymentFlow {
public onHoldExpiration: string;
public heldUntil: string;

View File

@ -1,7 +1,6 @@
import { PaymentFlow } from 'koffing/backend/model/payment/payment-flow';
export class PaymentFlowInstant extends PaymentFlow {
constructor() {
super();
this.type = 'PaymentFlowInstant';

View File

@ -3,7 +3,6 @@ import { BankAccount } from 'koffing/backend/model/bank-account';
import { PayoutToolDetails } from './payout-tool-details';
export class PayoutToolDetailsBankAccount implements BankAccount, PayoutToolDetails {
public detailsType: string;
public account: string;
public bankName: string;

View File

@ -1,3 +1,3 @@
export class Residence {
public type: string;
}
}

View File

@ -1,7 +1,6 @@
import { ShopLocation } from './shop-location';
export class ShopLocationUrl extends ShopLocation {
public url: string;
constructor(url: string) {

View File

@ -7,14 +7,10 @@ import { PaymentInstitution } from 'koffing/backend';
@Injectable()
export class PaymentInstitutionService {
constructor(
private http: KoffingHttp,
private config: ConfigService
) { }
constructor(private http: KoffingHttp, private config: ConfigService) {}
public getPaymentInstitutions(): Observable<PaymentInstitution[]> {
return this.http.get(this.getEndpoint()).map((res) => res.json());
return this.http.get(this.getEndpoint()).map(res => res.json());
}
private getEndpoint(): string {

View File

@ -8,22 +8,22 @@ import { CreatePayoutParams } from './requests/create-payout-request';
@Injectable()
export class PayoutToolService {
constructor(
private http: KoffingHttp,
private config: ConfigService
) { }
constructor(private http: KoffingHttp, private config: ConfigService) {}
public getPayoutTools(contractID: string): Observable<PayoutTool[]> {
return this.http.get(this.getEndpoint(contractID)).map((res) => res.json());
return this.http.get(this.getEndpoint(contractID)).map(res => res.json());
}
public getPayoutToolByID(contractID: string, payoutToolID: string): Observable<PayoutTool> {
return this.http.get(`${this.getEndpoint(contractID)}/${payoutToolID}`).map((res) => res.json());
return this.http
.get(`${this.getEndpoint(contractID)}/${payoutToolID}`)
.map(res => res.json());
}
public createPayout(body: CreatePayoutParams): Observable<Payout> {
return this.http.post(`${this.config.capiUrl}/processing/payouts`, body).map((res) => res.json());
return this.http
.post(`${this.config.capiUrl}/processing/payouts`, body)
.map(res => res.json());
}
private getEndpoint(contractID: string): string {

View File

@ -10,33 +10,38 @@ import { Report } from './model';
@Injectable()
export class ReportsService {
constructor(
private http: KoffingHttp,
private config: ConfigService
) {
}
constructor(private http: KoffingHttp, private config: ConfigService) {}
public createReport(shopID: string, reportParams: CreateReportParams): Observable<Report> {
return this.http.post(`${this.config.capiUrl}/shops/${shopID}/reports`, this.toCreateParams(reportParams))
.map((res) => res.json());
return this.http
.post(
`${this.config.capiUrl}/shops/${shopID}/reports`,
this.toCreateParams(reportParams)
)
.map(res => res.json());
}
private toCreateParams(params: object): object {
return reduce(params, (acc, value, key) => {
if (value) {
if (isDate(value)) {
return {...acc, [key]: this.toUTC(value)};
return reduce(
params,
(acc, value, key) => {
if (value) {
if (isDate(value)) {
return { ...acc, [key]: this.toUTC(value) };
} else {
return { ...acc, [key]: value };
}
} else {
return {...acc, [key]: value};
return acc;
}
} else {
return acc;
}
}, {});
},
{}
);
}
private toUTC(date: Date): string {
return moment(date).utc().format();
return moment(date)
.utc()
.format();
}
}

View File

@ -1,5 +1,4 @@
export class SearchReportParams {
public fromTime: Date;
public toTime: Date;

View File

@ -28,57 +28,73 @@ import {
@Injectable()
export class SearchService {
constructor(private http: KoffingHttp, private config: ConfigService) {}
constructor(
private http: KoffingHttp,
private config: ConfigService
) { }
public searchInvoices(shopID: string, invoiceParams: SearchInvoicesParams): Observable<InvoiceSearchResult> {
public searchInvoices(
shopID: string,
invoiceParams: SearchInvoicesParams
): Observable<InvoiceSearchResult> {
const search = this.toSearchParams(invoiceParams);
return this.http.get(`${this.getCapiEndpoint(shopID)}/invoices`, {search})
.map((res) => res.json());
return this.http
.get(`${this.getCapiEndpoint(shopID)}/invoices`, { search })
.map(res => res.json());
}
public searchPayments(shopID: string, paymentsParams: SearchPaymentsParams): Observable<PaymentSearchResult> {
public searchPayments(
shopID: string,
paymentsParams: SearchPaymentsParams
): Observable<PaymentSearchResult> {
const search = this.toSearchParams(paymentsParams);
return this.http.get(`${this.getCapiEndpoint(shopID)}/payments`, {search})
.map((res) => res.json());
return this.http
.get(`${this.getCapiEndpoint(shopID)}/payments`, { search })
.map(res => res.json());
}
public searchRefunds(shopID: string, refundsParams: SearchRefundsParams): Observable<RefundsSearchResult> {
public searchRefunds(
shopID: string,
refundsParams: SearchRefundsParams
): Observable<RefundsSearchResult> {
const search = this.toSearchParams(refundsParams);
return this.http.get(`${this.getCapiEndpoint(shopID)}/refunds`, {search})
.map((res) => res.json());
return this.http
.get(`${this.getCapiEndpoint(shopID)}/refunds`, { search })
.map(res => res.json());
}
public searchPayouts(shopID: string, payoutsParams: SearchPayoutsParams): Observable<PayoutSearchResult> {
public searchPayouts(
shopID: string,
payoutsParams: SearchPayoutsParams
): Observable<PayoutSearchResult> {
const search = this.toSearchParams(payoutsParams);
return this.http.get(`${this.getCapiEndpoint(shopID)}/payouts`, {search})
.map((res) => res.json());
return this.http
.get(`${this.getCapiEndpoint(shopID)}/payouts`, { search })
.map(res => res.json());
}
public getReports(shopID: string, reportParams: SearchReportParams): Observable<Report[]> {
const search = this.toSearchParams(reportParams);
return this.http.get(`${this.config.capiUrl}/shops/${shopID}/reports`, {search})
.map((res) => res.json());
return this.http
.get(`${this.config.capiUrl}/shops/${shopID}/reports`, { search })
.map(res => res.json());
}
public searchWalletWithdrawals(withdrawalsParams: SearchWalletWithdrawals): Observable<WithdrawalSearchResult> {
public searchWalletWithdrawals(
withdrawalsParams: SearchWalletWithdrawals
): Observable<WithdrawalSearchResult> {
const search = this.toSearchParams(withdrawalsParams);
return this.http.get(`${this.config.wapiUrl}/withdrawals`, {search})
.map((res) => res.json());
return this.http
.get(`${this.config.wapiUrl}/withdrawals`, { search })
.map(res => res.json());
}
public searchWalletWithdrawal(withdrawalID: string): Observable<Withdrawal> {
return this.http.get(`${this.config.wapiUrl}/withdrawals/${withdrawalID}`)
.map((res) => res.json());
return this.http
.get(`${this.config.wapiUrl}/withdrawals/${withdrawalID}`)
.map(res => res.json());
}
public searchWallets(walletsParams: SearchWalletsParams): Observable<WalletsSearchResult> {
const search = this.toSearchParams(walletsParams);
return this.http.get(`${this.config.wapiUrl}/wallets`, {search})
.map((res) => res.json());
return this.http.get(`${this.config.wapiUrl}/wallets`, { search }).map(res => res.json());
}
private getCapiEndpoint(shopID: string): string {
@ -102,6 +118,8 @@ export class SearchService {
}
private toUTC(date: Date): string {
return moment(date).utc().format();
return moment(date)
.utc()
.format();
}
}

View File

@ -7,27 +7,23 @@ import { Shop } from './model';
@Injectable()
export class ShopService {
private endpoint: string = `${this.config.capiUrl}/processing/shops`;
constructor(
private http: KoffingHttp,
private config: ConfigService
) { }
constructor(private http: KoffingHttp, private config: ConfigService) {}
public getShops(): Observable<Shop[]> {
return this.http.get(this.endpoint).map((res) => res.json());
return this.http.get(this.endpoint).map(res => res.json());
}
public getShopByID(shopID: string): Observable<Shop> {
return this.http.get(`${this.endpoint}/${shopID}`).map((res) => res.json());
return this.http.get(`${this.endpoint}/${shopID}`).map(res => res.json());
}
public activateShop(shopID: string): Observable<void> {
return this.http.put(`${this.endpoint}/${shopID}/activate`, {}).map((res) => res.json());
return this.http.put(`${this.endpoint}/${shopID}/activate`, {}).map(res => res.json());
}
public suspendShop(shopID: string): Observable<void> {
return this.http.put(`${this.endpoint}/${shopID}/suspend`, {}).map((res) => res.json());
return this.http.put(`${this.endpoint}/${shopID}/suspend`, {}).map(res => res.json());
}
}

View File

@ -7,13 +7,11 @@ import { KoffingHttp } from './koffing-http.service';
@Injectable()
export class UrlShortenerService {
constructor(private http: KoffingHttp,
private config: ConfigService) {
}
constructor(private http: KoffingHttp, private config: ConfigService) {}
public shorten(sourceUrl: string, expiresAt: string): Observable<UrlShortenerResult> {
return this.http.post(`${this.config.shortenUrlEndpoint}/v1/shortened-urls`, {sourceUrl, expiresAt})
return this.http
.post(`${this.config.shortenUrlEndpoint}/v1/shortened-urls`, { sourceUrl, expiresAt })
.map(res => res.json());
}
}

View File

@ -7,16 +7,11 @@ import { WalletAccount } from 'koffing/backend/model';
@Injectable()
export class WalletService {
private endpoint = `${this.config.wapiUrl}/wallets`;
constructor(
private http: KoffingHttp,
private config: ConfigService
) {}
constructor(private http: KoffingHttp, private config: ConfigService) {}
public getWalletAccount(walletID: string): Observable<WalletAccount> {
return this.http.get(`${this.endpoint}/${walletID}/account`)
.map(res => res.json());
return this.http.get(`${this.endpoint}/${walletID}/account`).map(res => res.json());
}
}

View File

@ -4,7 +4,6 @@ import { Subject } from 'rxjs';
@Injectable()
export class WarningsService {
public loginWarnings: Subject<string[]> = new Subject();
private isLoaded = false;
@ -16,7 +15,9 @@ export class WarningsService {
}
private init() {
this.http.get(`warningConfig.json?timestamp=${ new Date().getTime() }`).map(res => res.json())
this.http
.get(`warningConfig.json?timestamp=${new Date().getTime()}`)
.map(res => res.json())
.subscribe(data => {
this.loginWarnings.next(data.loginWarnings);
this.isLoaded = true;

View File

@ -8,13 +8,9 @@ import { WebhookParams } from './requests';
@Injectable()
export class WebhooksService {
private endpoint = `${this.config.capiUrl}/processing/webhooks`;
constructor(
private http: KoffingHttp,
private config: ConfigService
) { }
constructor(private http: KoffingHttp, private config: ConfigService) {}
public createWebhook(params: WebhookParams): Observable<Webhook> {
return this.http.post(this.endpoint, params).map(res => res.json());

View File

@ -16,4 +16,4 @@ import { BreadcrumbBroadcaster } from './services/breadcrumb.broadcaster';
BreadcrumbBroadcaster
]
})
export class BroadcasterModule { }
export class BroadcasterModule {}

View File

@ -5,7 +5,6 @@ import { BreadcrumbConfig } from './breadcrumb-config';
@Injectable()
export class BreadcrumbBroadcaster {
constructor(private broadcaster: Broadcaster) {}
public fire(config: BreadcrumbConfig[]) {

View File

@ -4,7 +4,6 @@ import 'rxjs/add/operator/filter';
import 'rxjs/add/operator/map';
export class Broadcaster {
private eventBus: Subject<any>;
constructor() {
@ -12,12 +11,13 @@ export class Broadcaster {
}
public broadcast(key: any, data?: any) {
this.eventBus.next({key, data});
this.eventBus.next({ key, data });
}
public on<T>(key: any): Observable<T> {
return this.eventBus.asObservable()
return this.eventBus
.asObservable()
.filter(event => event.key === key)
.map((event: any) => <T> event.data);
.map((event: any) => <T>event.data);
}
}

View File

@ -4,7 +4,6 @@ import { Broadcaster } from './broadcaster.service';
@Injectable()
export class ClaimReceiveBroadcaster {
constructor(private broadcaster: Broadcaster) {}
public fire() {

View File

@ -4,7 +4,6 @@ import { Broadcaster } from './broadcaster.service';
@Injectable()
export class ClaimRevokeBroadcaster {
constructor(private broadcaster: Broadcaster) {}
public fire() {

Some files were not shown because too many files have changed in this diff Show More