@orchesty/connector-fapi 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/package.json +4 -1
  2. package/package.json +4 -1
  3. package/CHANGELOG.md +0 -7
  4. package/coverage/clover.xml +0 -234
  5. package/coverage/coverage-final.json +0 -12
  6. package/coverage/lcov-report/base.css +0 -224
  7. package/coverage/lcov-report/block-navigation.js +0 -87
  8. package/coverage/lcov-report/favicon.png +0 -0
  9. package/coverage/lcov-report/index.html +0 -161
  10. package/coverage/lcov-report/prettify.css +0 -1
  11. package/coverage/lcov-report/prettify.js +0 -2
  12. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  13. package/coverage/lcov-report/sorter.js +0 -210
  14. package/coverage/lcov-report/src/Batch/AFapiListBatch.ts.html +0 -373
  15. package/coverage/lcov-report/src/Batch/FapiGetItemTemplateListBatch.ts.html +0 -295
  16. package/coverage/lcov-report/src/Batch/FapiGetLabelListBatch.ts.html +0 -154
  17. package/coverage/lcov-report/src/Batch/FapiGetProjectListBatch.ts.html +0 -211
  18. package/coverage/lcov-report/src/Batch/FapiGetShippingMethodListBatch.ts.html +0 -238
  19. package/coverage/lcov-report/src/Batch/FapiSubscribeWebhooksBatch.ts.html +0 -364
  20. package/coverage/lcov-report/src/Batch/FapiUnsubscribeWebhooksBatch.ts.html +0 -247
  21. package/coverage/lcov-report/src/Batch/index.html +0 -206
  22. package/coverage/lcov-report/src/Connector/FapiGetInvoiceConnector.ts.html +0 -652
  23. package/coverage/lcov-report/src/Connector/FapiPostInvoiceLabelConnector.ts.html +0 -229
  24. package/coverage/lcov-report/src/Connector/index.html +0 -131
  25. package/coverage/lcov-report/src/FapiApplication.ts.html +0 -394
  26. package/coverage/lcov-report/src/index.html +0 -116
  27. package/coverage/lcov-report/test/dataProvider.ts.html +0 -187
  28. package/coverage/lcov-report/test/index.html +0 -116
  29. package/coverage/lcov.info +0 -380
  30. package/jest.config.js +0 -13
  31. package/src/Batch/AFapiListBatch.ts +0 -96
  32. package/src/Batch/FapiGetItemTemplateListBatch.ts +0 -70
  33. package/src/Batch/FapiGetLabelListBatch.ts +0 -23
  34. package/src/Batch/FapiGetProjectListBatch.ts +0 -42
  35. package/src/Batch/FapiGetShippingMethodListBatch.ts +0 -51
  36. package/src/Batch/FapiSubscribeWebhooksBatch.ts +0 -93
  37. package/src/Batch/FapiUnsubscribeWebhooksBatch.ts +0 -54
  38. package/src/Batch/__tests__/Data/FapiGetItemTemplateListBatch/input.json +0 -7
  39. package/src/Batch/__tests__/Data/FapiGetItemTemplateListBatch/mock.json +0 -55
  40. package/src/Batch/__tests__/Data/FapiGetItemTemplateListBatch/output.json +0 -11
  41. package/src/Batch/__tests__/Data/FapiGetLabelListBatch/input.json +0 -7
  42. package/src/Batch/__tests__/Data/FapiGetLabelListBatch/mock.json +0 -14
  43. package/src/Batch/__tests__/Data/FapiGetLabelListBatch/output.json +0 -11
  44. package/src/Batch/__tests__/Data/FapiGetProjectListBatch/input.json +0 -7
  45. package/src/Batch/__tests__/Data/FapiGetProjectListBatch/mock.json +0 -26
  46. package/src/Batch/__tests__/Data/FapiGetProjectListBatch/output.json +0 -11
  47. package/src/Batch/__tests__/Data/FapiGetShippingMethodListBatch/input.json +0 -7
  48. package/src/Batch/__tests__/Data/FapiGetShippingMethodListBatch/mock.json +0 -31
  49. package/src/Batch/__tests__/Data/FapiGetShippingMethodListBatch/output.json +0 -11
  50. package/src/Batch/__tests__/Data/FapiSubscribeWebhooksBatch/input.json +0 -7
  51. package/src/Batch/__tests__/Data/FapiSubscribeWebhooksBatch/mock.json +0 -17
  52. package/src/Batch/__tests__/Data/FapiSubscribeWebhooksBatch/output.json +0 -6
  53. package/src/Batch/__tests__/Data/FapiUnsubscribeWebhooksBatch/1-mock.json +0 -5
  54. package/src/Batch/__tests__/Data/FapiUnsubscribeWebhooksBatch/input.json +0 -7
  55. package/src/Batch/__tests__/Data/FapiUnsubscribeWebhooksBatch/mock.json +0 -5
  56. package/src/Batch/__tests__/Data/FapiUnsubscribeWebhooksBatch/output.json +0 -9
  57. package/src/Batch/__tests__/Data/FapiUnsubscribeWebhooksBatch/output1.json +0 -7
  58. package/src/Batch/__tests__/FapiGetItemTemplateListBatch.ts +0 -17
  59. package/src/Batch/__tests__/FapiGetLabelListBatch.ts +0 -17
  60. package/src/Batch/__tests__/FapiGetProjectListBatch.ts +0 -17
  61. package/src/Batch/__tests__/FapiGetShippingMethodListBatch.ts +0 -17
  62. package/src/Batch/__tests__/FapiSubscribeWebhooksBatch.ts +0 -45
  63. package/src/Batch/__tests__/FapiUnsubscribeWebhooksBatch.ts +0 -57
  64. package/src/Connector/FapiGetInvoiceConnector.ts +0 -189
  65. package/src/Connector/FapiPostInvoiceLabelConnector.ts +0 -48
  66. package/src/Connector/__tests__/Data/FapiGetInvoiceConnector/input.json +0 -8
  67. package/src/Connector/__tests__/Data/FapiGetInvoiceConnector/mock.json +0 -223
  68. package/src/Connector/__tests__/Data/FapiGetInvoiceConnector/output.json +0 -224
  69. package/src/Connector/__tests__/Data/FapiPostInvoiceLabelConnector/input.json +0 -11
  70. package/src/Connector/__tests__/Data/FapiPostInvoiceLabelConnector/mock.json +0 -12
  71. package/src/Connector/__tests__/Data/FapiPostInvoiceLabelConnector/output.json +0 -13
  72. package/src/Connector/__tests__/FapiGetInvoiceConnector.ts +0 -17
  73. package/src/Connector/__tests__/FapiPostInvoiceLabelConnector.ts +0 -17
  74. package/src/FapiApplication.ts +0 -103
  75. package/test/dataProvider.ts +0 -34
  76. package/tsconfig.json +0 -8
  77. package/tsconfig.prod.json +0 -13
  78. package/tsconfig.prod.tsbuildinfo +0 -1
@@ -1,6 +0,0 @@
1
- {
2
- "headers": {
3
- "user": "TestUser"
4
- },
5
- "data": []
6
- }
@@ -1,5 +0,0 @@
1
- {
2
- "http": "DELETE https://api.fapi.cz/connections/webhookId",
3
- "code": 200,
4
- "body": {}
5
- }
@@ -1,7 +0,0 @@
1
- {
2
- "headers": {
3
- "user": "TestUser"
4
- },
5
- "data": {
6
- }
7
- }
@@ -1,5 +0,0 @@
1
- {
2
- "http": "DELETE https://api.fapi.cz/connections/webhookId",
3
- "code": 200,
4
- "body": {}
5
- }
@@ -1,9 +0,0 @@
1
- {
2
- "headers": {
3
- "user": "TestUser",
4
- "cursor": "1",
5
- "result-code": "1011",
6
- "result-message": "Message will be used as a iterator with cursor [1]. No follower will be called."
7
- },
8
- "data": []
9
- }
@@ -1,7 +0,0 @@
1
- {
2
- "headers": {
3
- "user": "TestUser",
4
- "cursor": "1"
5
- },
6
- "data": []
7
- }
@@ -1,17 +0,0 @@
1
- import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
2
- import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
3
- import init from '../../../test/dataProvider';
4
- import { NAME as FAPI_GET_ITEM_TEMPLATE_LIST_BATCH } from '../FapiGetItemTemplateListBatch';
5
-
6
- let tester: NodeTester;
7
-
8
- describe('Tests for FapiGetItemTemplateListBatch', () => {
9
- beforeEach(() => {
10
- tester = new NodeTester(container, __filename);
11
- init();
12
- });
13
-
14
- it('process - ok', async () => {
15
- await tester.testBatch(FAPI_GET_ITEM_TEMPLATE_LIST_BATCH);
16
- });
17
- });
@@ -1,17 +0,0 @@
1
- import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
2
- import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
3
- import init from '../../../test/dataProvider';
4
- import { NAME as FAPI_GET_LABEL_LIST_BATCH } from '../FapiGetLabelListBatch';
5
-
6
- let tester: NodeTester;
7
-
8
- describe('Tests for FapiGetLabelListBatch', () => {
9
- beforeEach(() => {
10
- tester = new NodeTester(container, __filename);
11
- init();
12
- });
13
-
14
- it('process - ok', async () => {
15
- await tester.testBatch(FAPI_GET_LABEL_LIST_BATCH);
16
- });
17
- });
@@ -1,17 +0,0 @@
1
- import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
2
- import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
3
- import init from '../../../test/dataProvider';
4
- import { NAME as FAPI_GET_PROJECT_LIST_BATCH } from '../FapiGetProjectListBatch';
5
-
6
- let tester: NodeTester;
7
-
8
- describe('Tests for FapiGetProjectListBatch', () => {
9
- beforeEach(() => {
10
- tester = new NodeTester(container, __filename);
11
- init();
12
- });
13
-
14
- it('process - ok', async () => {
15
- await tester.testBatch(FAPI_GET_PROJECT_LIST_BATCH);
16
- });
17
- });
@@ -1,17 +0,0 @@
1
- import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
2
- import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
3
- import init from '../../../test/dataProvider';
4
- import { NAME as FAPI_GET_SHIPPING_METHOD_LIST_BATCH } from '../FapiGetShippingMethodListBatch';
5
-
6
- let tester: NodeTester;
7
-
8
- describe('Tests for FapiGetShippingMethodListBatch', () => {
9
- beforeEach(() => {
10
- tester = new NodeTester(container, __filename);
11
- init();
12
- });
13
-
14
- it('process - ok', async () => {
15
- await tester.testBatch(FAPI_GET_SHIPPING_METHOD_LIST_BATCH);
16
- });
17
- });
@@ -1,45 +0,0 @@
1
- import { DEFAULT_USER } from '@orchesty/nodejs-connectors/test/DataProvider';
2
- import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
3
- import Webhook from '@orchesty/nodejs-sdk/dist/lib/Application/Database/Webhook';
4
- import { orchestyOptions } from '@orchesty/nodejs-sdk/dist/lib/Config/Config';
5
- import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
6
- import { mockOnce } from '@orchesty/nodejs-sdk/dist/test/MockServer';
7
- import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
8
- import init from '../../../test/dataProvider';
9
- import { NAME as FAPI_APPLICATION } from '../../FapiApplication';
10
- import { NAME as FAPI_SUBSCRIBE_WEBHOOKS_BATCH } from '../FapiSubscribeWebhooksBatch';
11
-
12
- let tester: NodeTester;
13
-
14
- describe('Tests for FapiSubscribeWebhooksBatch', () => {
15
- beforeEach(() => {
16
- tester = new NodeTester(container, __filename);
17
- init();
18
-
19
- const webhook = new Webhook()
20
- .setApplication(FAPI_APPLICATION)
21
- .setName('name')
22
- .setNode('node')
23
- .setToken('token')
24
- .setTopology('topology')
25
- .setUnsubscribeFailed(false)
26
- .setUser(DEFAULT_USER)
27
- .setWebhookId('webhookdId');
28
-
29
- mockOnce([
30
- {
31
- request: {
32
- method: HttpMethods.GET, url: new RegExp(`${orchestyOptions.workerApi}\\/document\\/Webhook.*`),
33
- },
34
- response: {
35
- code: 200,
36
- body: [{ ...webhook.toArray() }],
37
- },
38
- },
39
- ]);
40
- });
41
-
42
- it('process - ok', async () => {
43
- await tester.testBatch(FAPI_SUBSCRIBE_WEBHOOKS_BATCH);
44
- });
45
- });
@@ -1,57 +0,0 @@
1
- import { DEFAULT_USER } from '@orchesty/nodejs-connectors/test/DataProvider';
2
- import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
3
- import Webhook from '@orchesty/nodejs-sdk/dist/lib/Application/Database/Webhook';
4
- import { orchestyOptions } from '@orchesty/nodejs-sdk/dist/lib/Config/Config';
5
- import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
6
- import { mockOnce } from '@orchesty/nodejs-sdk/dist/test/MockServer';
7
- import NodeTester from '@orchesty/nodejs-sdk/dist/test/Testers/NodeTester';
8
- import init from '../../../test/dataProvider';
9
- import { NAME as FAPI_APPLICATION } from '../../FapiApplication';
10
- import { NAME as FAPI_UNSUBSCRIBE_WEBHOOKS_BATCH } from '../FapiUnsubscribeWebhooksBatch';
11
-
12
- let tester: NodeTester;
13
-
14
- describe('Tests for FapiUnsubscribeWebhooksBatch', () => {
15
- beforeEach(() => {
16
- tester = new NodeTester(container, __filename);
17
- init();
18
-
19
- const webhook = new Webhook()
20
- .setApplication(FAPI_APPLICATION)
21
- .setName('name')
22
- .setNode('node')
23
- .setToken('token')
24
- .setTopology('topology')
25
- .setUnsubscribeFailed(false)
26
- .setUser(DEFAULT_USER)
27
- .setWebhookId('webhookId');
28
-
29
- mockOnce([
30
- {
31
- request: {
32
- method: HttpMethods.GET, url: new RegExp(`${orchestyOptions.workerApi}\\/document\\/Webhook.*`),
33
- },
34
- response: {
35
- code: 200,
36
- body: [{ ...webhook.toArray() }],
37
- },
38
- },
39
- ]);
40
-
41
- mockOnce([
42
- {
43
- request: {
44
- method: HttpMethods.GET, url: new RegExp(`${orchestyOptions.workerApi}\\/document\\/Webhook.*`),
45
- },
46
- response: {
47
- code: 200,
48
- body: [],
49
- },
50
- },
51
- ]);
52
- });
53
-
54
- it('process - ok', async () => {
55
- await tester.testBatch(FAPI_UNSUBSCRIBE_WEBHOOKS_BATCH);
56
- });
57
- });
@@ -1,189 +0,0 @@
1
- import AConnector from '@orchesty/nodejs-sdk/dist/lib/Connector/AConnector';
2
- import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
3
- import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
4
- import { StatusCodes } from 'http-status-codes';
5
- import { getErrorInResponse, NAME as APPLICATION_NAME } from '../FapiApplication';
6
-
7
- export const NAME = `${APPLICATION_NAME}-get-invoice-connector`;
8
-
9
- export default class FapiGetInvoiceConnector extends AConnector {
10
-
11
- public getName(): string {
12
- return NAME;
13
- }
14
-
15
- public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IOutput>> {
16
- const { id } = dto.getJsonData();
17
-
18
- const requestDto = await this.getApplication().getRequestDto(
19
- dto,
20
- await this.getApplicationInstallFromProcess(dto),
21
- HttpMethods.GET,
22
- `invoices/${id}`,
23
- );
24
-
25
- const responseDto = await this.getSender().send<IOutput>(requestDto, {
26
- success: StatusCodes.OK,
27
- stopAndFail: StatusCodes.NOT_FOUND,
28
- }, undefined, undefined, getErrorInResponse);
29
-
30
- return dto.setNewJsonData(responseDto.getJsonBody());
31
- }
32
-
33
- }
34
-
35
- export interface IInput {
36
- id: number;
37
- }
38
-
39
- export interface IOutput {
40
- /* eslint-disable @typescript-eslint/naming-convention */
41
- id: number;
42
- number: string;
43
- created_on: string;
44
- last_modified_on: string;
45
- create_date: string;
46
- automatic_charge_date: string;
47
- payday_date: string;
48
- client: number;
49
- type: string;
50
- payment_type: string;
51
- currency: string;
52
- exchange_rate_czk: string;
53
- exchange_rate: string;
54
- language: string;
55
- paid: boolean;
56
- cancelled: boolean;
57
- cancellation_reason: string;
58
- reverse_charge: boolean;
59
- tax_exempt: boolean;
60
- round_function: string;
61
- round_precision: number;
62
- vat_recapitulation_algorithm: string;
63
- payment_confirmation_mode: string;
64
- preserve_vat_date_on_invoice: boolean;
65
- has_credit_note: boolean;
66
- create_invoice_automatically: boolean;
67
- create_payment_confirmation: boolean;
68
- create_simplified_invoice: boolean;
69
- path: string;
70
- recurring_gopay_payment_id: string;
71
- campaign_code: string;
72
- periodic_invoice: string;
73
- periodic_invoice_number: string;
74
- locked: boolean;
75
- proforma: boolean;
76
- payment_confirmation: boolean;
77
- simplified_invoice: boolean;
78
- credit_note: boolean;
79
- show_vat_info: boolean;
80
- shipping_method_id: number;
81
- shipping_metadata: {
82
- packatery_branch_name: string;
83
- packatery_branch_id: number;
84
- } | null;
85
- paid_on: string;
86
- variable_symbol: string;
87
- vat_date: string;
88
- supplier: {
89
- name: string;
90
- ic: string;
91
- dic: string;
92
- ic_dph: string;
93
- swift: string;
94
- iban: string;
95
- bank_account: string;
96
- address: {
97
- street: string;
98
- city: string;
99
- zip: string;
100
- country: string;
101
- };
102
- };
103
- customer: {
104
- name: string;
105
- first_name: string;
106
- last_name: string;
107
- email: string;
108
- phone: string;
109
- address: {
110
- street: string;
111
- city: string;
112
- zip: string;
113
- country: string;
114
- };
115
- shipping_address: {
116
- name: string;
117
- surname: string;
118
- street: string;
119
- city: string;
120
- zip: string;
121
- country: string;
122
- } | null;
123
- };
124
- form: number;
125
- items: {
126
- id: number;
127
- invoice: number;
128
- name: string;
129
- code: string;
130
- accounting_code: string;
131
- price: number;
132
- count: number;
133
- round_item: boolean;
134
- correction_item: boolean;
135
- type: string;
136
- moss: boolean;
137
- pohoda_accounting: string;
138
- pohoda_centre: string;
139
- pohoda_store: string;
140
- pohoda_stock_item: string;
141
- vat: number;
142
- including_vat: boolean;
143
- }[];
144
- custom_fields: {
145
- invoice_custom_fields_data_id: number;
146
- custom_field_id: number;
147
- value: string;
148
- name: string;
149
- type: string;
150
- }[];
151
- shipping_method: {
152
- id: number;
153
- user_id: number;
154
- name: string;
155
- type: string;
156
- subtype: string;
157
- address_prices: {
158
- address: {
159
- country_code: string;
160
- };
161
- prices: {
162
- currency_code: string;
163
- price: number;
164
- }[];
165
- }[];
166
- free_of_charges: string;
167
- meta_data: string;
168
- including_vat: number;
169
- description: string;
170
- disable_discount: number;
171
- deleted: number;
172
- };
173
- total: number;
174
- total_vat: number;
175
- total_czk: number;
176
- total_vat_czk: number;
177
- total_native: number;
178
- total_vat_native: number;
179
- user: number;
180
- form_url: string;
181
- session_id: string;
182
- labels: {
183
- id: number;
184
- name: string;
185
- color: string;
186
- }[];
187
- parent?: string;
188
- /* eslint-enable @typescript-eslint/naming-convention */
189
- }
@@ -1,48 +0,0 @@
1
- import AConnector from '@orchesty/nodejs-sdk/dist/lib/Connector/AConnector';
2
- import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
3
- import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
4
- import { StatusCodes } from 'http-status-codes';
5
- import { getErrorInResponse, NAME as APPLICATION_NAME } from '../FapiApplication';
6
-
7
- export const NAME = `${APPLICATION_NAME}-post-invoice-label-connector`;
8
-
9
- export default class FapiPostInvoiceLabelConnector extends AConnector {
10
-
11
- public getName(): string {
12
- return NAME;
13
- }
14
-
15
- public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IOutput>> {
16
- const { id, labels } = dto.getJsonData();
17
-
18
- const requestDto = await this.getApplication().getRequestDto(
19
- dto,
20
- await this.getApplicationInstallFromProcess(dto),
21
- HttpMethods.POST,
22
- `invoice-labels/${id}`,
23
- {
24
- labels,
25
- },
26
- );
27
-
28
- const responseDto = await this.getSender().send<IOutput>(requestDto, {
29
- success: StatusCodes.OK,
30
- stopAndFail: [StatusCodes.BAD_REQUEST, StatusCodes.NOT_FOUND],
31
- }, undefined, undefined, getErrorInResponse);
32
-
33
- return dto.setNewJsonData(responseDto.getJsonBody());
34
- }
35
-
36
- }
37
-
38
- export interface IInput {
39
- id: number;
40
- labels: string[];
41
- }
42
-
43
- export interface IOutput {
44
- status: string;
45
- message: string;
46
- invoice_id: number,
47
- labels: number[];
48
- }
@@ -1,8 +0,0 @@
1
- {
2
- "headers": {
3
- "user": "TestUser"
4
- },
5
- "data": {
6
- "id": 1
7
- }
8
- }