@orchesty/connector-authentica 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/LICENSE +190 -0
  3. package/coverage/clover.xml +413 -0
  4. package/coverage/coverage-final.json +19 -0
  5. package/coverage/lcov-report/base.css +224 -0
  6. package/coverage/lcov-report/block-navigation.js +87 -0
  7. package/coverage/lcov-report/favicon.png +0 -0
  8. package/coverage/lcov-report/index.html +161 -0
  9. package/coverage/lcov-report/prettify.css +1 -0
  10. package/coverage/lcov-report/prettify.js +2 -0
  11. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  12. package/coverage/lcov-report/sorter.js +210 -0
  13. package/coverage/lcov-report/src/AuthenticaApplication.ts.html +496 -0
  14. package/coverage/lcov-report/src/Batch/AuthenticaGetStock.ts.html +316 -0
  15. package/coverage/lcov-report/src/Batch/AuthenticaGetStockAvailable.ts.html +262 -0
  16. package/coverage/lcov-report/src/Batch/index.html +131 -0
  17. package/coverage/lcov-report/src/Connector/AuthenticaCreateOrder.ts.html +244 -0
  18. package/coverage/lcov-report/src/Connector/AuthenticaCreateProduct.ts.html +247 -0
  19. package/coverage/lcov-report/src/Connector/AuthenticaCreateReceipt.ts.html +244 -0
  20. package/coverage/lcov-report/src/Connector/AuthenticaGetCarriersConnector.ts.html +205 -0
  21. package/coverage/lcov-report/src/Connector/AuthenticaGetOrder.ts.html +259 -0
  22. package/coverage/lcov-report/src/Connector/AuthenticaGetOrderStatus.ts.html +199 -0
  23. package/coverage/lcov-report/src/Connector/AuthenticaGetReceipt.ts.html +259 -0
  24. package/coverage/lcov-report/src/Connector/AuthenticaGetShippingMethods.ts.html +208 -0
  25. package/coverage/lcov-report/src/Connector/AuthenticaPostLabel.ts.html +196 -0
  26. package/coverage/lcov-report/src/Connector/AuthenticaPutOrders.ts.html +334 -0
  27. package/coverage/lcov-report/src/Connector/AuthenticaPutProducts.ts.html +250 -0
  28. package/coverage/lcov-report/src/Connector/AuthenticaUpdateOrder.ts.html +256 -0
  29. package/coverage/lcov-report/src/Connector/AuthenticaUpdateProduct.ts.html +259 -0
  30. package/coverage/lcov-report/src/Connector/AuthenticaUpdateReceipt.ts.html +193 -0
  31. package/coverage/lcov-report/src/Connector/index.html +311 -0
  32. package/coverage/lcov-report/src/index.html +116 -0
  33. package/coverage/lcov-report/test/dataProvider.ts.html +325 -0
  34. package/coverage/lcov-report/test/index.html +116 -0
  35. package/coverage/lcov.info +676 -0
  36. package/dist/AuthenticaApplication.d.ts +29 -0
  37. package/dist/AuthenticaApplication.js +128 -0
  38. package/dist/Batch/AuthenticaGetStock.d.ts +20 -0
  39. package/dist/Batch/AuthenticaGetStock.js +45 -0
  40. package/dist/Batch/AuthenticaGetStockAvailable.d.ts +13 -0
  41. package/dist/Batch/AuthenticaGetStockAvailable.js +36 -0
  42. package/dist/Connector/AuthenticaCreateOrder.d.ts +12 -0
  43. package/dist/Connector/AuthenticaCreateOrder.js +37 -0
  44. package/dist/Connector/AuthenticaCreateProduct.d.ts +12 -0
  45. package/dist/Connector/AuthenticaCreateProduct.js +37 -0
  46. package/dist/Connector/AuthenticaCreateReceipt.d.ts +11 -0
  47. package/dist/Connector/AuthenticaCreateReceipt.js +37 -0
  48. package/dist/Connector/AuthenticaGetCarriersConnector.d.ts +15 -0
  49. package/dist/Connector/AuthenticaGetCarriersConnector.js +23 -0
  50. package/dist/Connector/AuthenticaGetOrder.d.ts +14 -0
  51. package/dist/Connector/AuthenticaGetOrder.js +38 -0
  52. package/dist/Connector/AuthenticaGetOrderStatus.d.ts +11 -0
  53. package/dist/Connector/AuthenticaGetOrderStatus.js +20 -0
  54. package/dist/Connector/AuthenticaGetReceipt.d.ts +13 -0
  55. package/dist/Connector/AuthenticaGetReceipt.js +38 -0
  56. package/dist/Connector/AuthenticaGetShippingMethods.d.ts +14 -0
  57. package/dist/Connector/AuthenticaGetShippingMethods.js +20 -0
  58. package/dist/Connector/AuthenticaPostLabel.d.ts +12 -0
  59. package/dist/Connector/AuthenticaPostLabel.js +22 -0
  60. package/dist/Connector/AuthenticaPutOrders.d.ts +52 -0
  61. package/dist/Connector/AuthenticaPutOrders.js +22 -0
  62. package/dist/Connector/AuthenticaPutProducts.d.ts +24 -0
  63. package/dist/Connector/AuthenticaPutProducts.js +22 -0
  64. package/dist/Connector/AuthenticaUpdateOrder.d.ts +12 -0
  65. package/dist/Connector/AuthenticaUpdateOrder.js +39 -0
  66. package/dist/Connector/AuthenticaUpdateProduct.d.ts +12 -0
  67. package/dist/Connector/AuthenticaUpdateProduct.js +39 -0
  68. package/dist/Connector/AuthenticaUpdateReceipt.d.ts +9 -0
  69. package/dist/Connector/AuthenticaUpdateReceipt.js +22 -0
  70. package/dist/package.json +24 -0
  71. package/dist/types/order.d.ts +39 -0
  72. package/dist/types/order.js +2 -0
  73. package/dist/types/product.d.ts +20 -0
  74. package/dist/types/product.js +2 -0
  75. package/dist/types/receipt.d.ts +29 -0
  76. package/dist/types/receipt.js +1 -0
  77. package/jest.config.js +13 -0
  78. package/package.json +24 -0
  79. package/src/AuthenticaApplication.ts +137 -0
  80. package/src/Batch/AuthenticaGetStock.ts +77 -0
  81. package/src/Batch/AuthenticaGetStockAvailable.ts +59 -0
  82. package/src/Batch/__tests__/AuthenticaGetStock.ts +26 -0
  83. package/src/Batch/__tests__/AuthenticaGetStockAvailable.ts +22 -0
  84. package/src/Batch/__tests__/Data/AuthenticaGetStock/input.json +6 -0
  85. package/src/Batch/__tests__/Data/AuthenticaGetStock/mock.json +23 -0
  86. package/src/Batch/__tests__/Data/AuthenticaGetStock/nok-input.json +6 -0
  87. package/src/Batch/__tests__/Data/AuthenticaGetStock/nok-mock.json +20 -0
  88. package/src/Batch/__tests__/Data/AuthenticaGetStock/nok-output.json +13 -0
  89. package/src/Batch/__tests__/Data/AuthenticaGetStock/output.json +11 -0
  90. package/src/Batch/__tests__/Data/AuthenticaGetStockAvailable/1-mock.json +20 -0
  91. package/src/Batch/__tests__/Data/AuthenticaGetStockAvailable/input.json +6 -0
  92. package/src/Batch/__tests__/Data/AuthenticaGetStockAvailable/mock.json +21 -0
  93. package/src/Batch/__tests__/Data/AuthenticaGetStockAvailable/output.json +14 -0
  94. package/src/Batch/__tests__/Data/AuthenticaGetStockAvailable/output1.json +12 -0
  95. package/src/Connector/AuthenticaCreateOrder.ts +53 -0
  96. package/src/Connector/AuthenticaCreateProduct.ts +54 -0
  97. package/src/Connector/AuthenticaCreateReceipt.ts +53 -0
  98. package/src/Connector/AuthenticaGetCarriersConnector.ts +40 -0
  99. package/src/Connector/AuthenticaGetOrder.ts +58 -0
  100. package/src/Connector/AuthenticaGetOrderStatus.ts +38 -0
  101. package/src/Connector/AuthenticaGetReceipt.ts +58 -0
  102. package/src/Connector/AuthenticaGetShippingMethods.ts +41 -0
  103. package/src/Connector/AuthenticaPostLabel.ts +37 -0
  104. package/src/Connector/AuthenticaPutOrders.ts +83 -0
  105. package/src/Connector/AuthenticaPutProducts.ts +55 -0
  106. package/src/Connector/AuthenticaUpdateOrder.ts +57 -0
  107. package/src/Connector/AuthenticaUpdateProduct.ts +58 -0
  108. package/src/Connector/AuthenticaUpdateReceipt.ts +36 -0
  109. package/src/Connector/__tests__/AuthenticaCreateOrder.ts +22 -0
  110. package/src/Connector/__tests__/AuthenticaCreateProduct.ts +22 -0
  111. package/src/Connector/__tests__/AuthenticaCreateReceipt.ts +22 -0
  112. package/src/Connector/__tests__/AuthenticaGetCarriers.ts +22 -0
  113. package/src/Connector/__tests__/AuthenticaGetOrder.ts +22 -0
  114. package/src/Connector/__tests__/AuthenticaGetOrderStatus.ts +36 -0
  115. package/src/Connector/__tests__/AuthenticaGetReceipt.ts +22 -0
  116. package/src/Connector/__tests__/AuthenticaGetShippingMethods.ts +22 -0
  117. package/src/Connector/__tests__/AuthenticaPostLabel.ts +36 -0
  118. package/src/Connector/__tests__/AuthenticaPutOrders.ts +36 -0
  119. package/src/Connector/__tests__/AuthenticaPutProducts.ts +36 -0
  120. package/src/Connector/__tests__/AuthenticaUpdateOrder.ts +22 -0
  121. package/src/Connector/__tests__/AuthenticaUpdateProduct.ts +22 -0
  122. package/src/Connector/__tests__/AuthenticaUpdateReceipt.ts +22 -0
  123. package/src/Connector/__tests__/Data/AuthenticaCreateOrder/input.json +67 -0
  124. package/src/Connector/__tests__/Data/AuthenticaCreateOrder/mock.json +70 -0
  125. package/src/Connector/__tests__/Data/AuthenticaCreateOrder/output.json +71 -0
  126. package/src/Connector/__tests__/Data/AuthenticaCreateProduct/input.json +28 -0
  127. package/src/Connector/__tests__/Data/AuthenticaCreateProduct/mock.json +28 -0
  128. package/src/Connector/__tests__/Data/AuthenticaCreateProduct/output.json +29 -0
  129. package/src/Connector/__tests__/Data/AuthenticaCreateReceipt/input.json +47 -0
  130. package/src/Connector/__tests__/Data/AuthenticaCreateReceipt/mock.json +51 -0
  131. package/src/Connector/__tests__/Data/AuthenticaCreateReceipt/output.json +52 -0
  132. package/src/Connector/__tests__/Data/AuthenticaGetCarriers/input.json +6 -0
  133. package/src/Connector/__tests__/Data/AuthenticaGetCarriers/mock.json +18 -0
  134. package/src/Connector/__tests__/Data/AuthenticaGetCarriers/output.json +19 -0
  135. package/src/Connector/__tests__/Data/AuthenticaGetOrder/input.json +8 -0
  136. package/src/Connector/__tests__/Data/AuthenticaGetOrder/mock.json +63 -0
  137. package/src/Connector/__tests__/Data/AuthenticaGetOrder/output.json +64 -0
  138. package/src/Connector/__tests__/Data/AuthenticaGetOrderStatus/input.json +6 -0
  139. package/src/Connector/__tests__/Data/AuthenticaGetOrderStatus/mock.json +12 -0
  140. package/src/Connector/__tests__/Data/AuthenticaGetOrderStatus/output.json +11 -0
  141. package/src/Connector/__tests__/Data/AuthenticaGetReceipt/input.json +8 -0
  142. package/src/Connector/__tests__/Data/AuthenticaGetReceipt/mock.json +54 -0
  143. package/src/Connector/__tests__/Data/AuthenticaGetReceipt/output.json +55 -0
  144. package/src/Connector/__tests__/Data/AuthenticaGetShippingMethods/input.json +6 -0
  145. package/src/Connector/__tests__/Data/AuthenticaGetShippingMethods/mock.json +404 -0
  146. package/src/Connector/__tests__/Data/AuthenticaGetShippingMethods/output.json +403 -0
  147. package/src/Connector/__tests__/Data/AuthenticaPostLabel/input.json +10 -0
  148. package/src/Connector/__tests__/Data/AuthenticaPostLabel/mock.json +5 -0
  149. package/src/Connector/__tests__/Data/AuthenticaPostLabel/output.json +10 -0
  150. package/src/Connector/__tests__/Data/AuthenticaPutOrders/input.json +43 -0
  151. package/src/Connector/__tests__/Data/AuthenticaPutOrders/mock.json +44 -0
  152. package/src/Connector/__tests__/Data/AuthenticaPutOrders/output.json +43 -0
  153. package/src/Connector/__tests__/Data/AuthenticaPutProducts/input.json +19 -0
  154. package/src/Connector/__tests__/Data/AuthenticaPutProducts/mock.json +20 -0
  155. package/src/Connector/__tests__/Data/AuthenticaPutProducts/output.json +19 -0
  156. package/src/Connector/__tests__/Data/AuthenticaUpdateOrder/input.json +68 -0
  157. package/src/Connector/__tests__/Data/AuthenticaUpdateOrder/mock.json +70 -0
  158. package/src/Connector/__tests__/Data/AuthenticaUpdateOrder/output.json +71 -0
  159. package/src/Connector/__tests__/Data/AuthenticaUpdateProduct/input.json +32 -0
  160. package/src/Connector/__tests__/Data/AuthenticaUpdateProduct/mock.json +28 -0
  161. package/src/Connector/__tests__/Data/AuthenticaUpdateProduct/output.json +31 -0
  162. package/src/Connector/__tests__/Data/AuthenticaUpdateReceipt/input.json +45 -0
  163. package/src/Connector/__tests__/Data/AuthenticaUpdateReceipt/mock.json +51 -0
  164. package/src/Connector/__tests__/Data/AuthenticaUpdateReceipt/output.json +52 -0
  165. package/src/__tests__/AuthenticaApplication.ts +41 -0
  166. package/src/types/order.ts +40 -0
  167. package/src/types/product.ts +21 -0
  168. package/src/types/receipt.ts +30 -0
  169. package/test/dataProvider.ts +80 -0
  170. package/tsconfig.json +8 -0
  171. package/tsconfig.prod.json +13 -0
  172. package/tsconfig.prod.tsbuildinfo +1 -0
@@ -0,0 +1,70 @@
1
+ {
2
+ "http": "PUT https://app.authentica.cz/api/shop/TestUser/order/3",
3
+ "code": 200,
4
+ "body": {
5
+ "id": 3,
6
+ "status": "received",
7
+ "externalId": "external-ccx",
8
+ "carrierId": 8,
9
+ "branchId": null,
10
+ "price": "153.00",
11
+ "priceCurrency": "CZK",
12
+ "cod": false,
13
+ "codValue": null,
14
+ "codValueCurrency": null,
15
+ "vs": null,
16
+ "companyName": "Webwings s.r.o.",
17
+ "firstName": null,
18
+ "lastName": null,
19
+ "addressLine1": "Marešova 14",
20
+ "addressLine2": "2nd floor",
21
+ "addressLine3": null,
22
+ "city": "Brno",
23
+ "zip": "602 00",
24
+ "country": "CZ",
25
+ "state": null,
26
+ "phone": "+420808875329",
27
+ "email": "developers@webwings.cz",
28
+ "processingDate": "2023-01-24",
29
+ "printDeliveryNote": true,
30
+ "orderNumber": null,
31
+ "orderTags": [
32
+ "tag1",
33
+ "tag2"
34
+ ],
35
+ "packagingInstructions": [
36
+ {
37
+ "message": "Apply fragile sticker",
38
+ "packagingInstructionType": "after"
39
+ }
40
+ ],
41
+ "items": [
42
+ {
43
+ "productId": 16,
44
+ "amount": 4
45
+ },
46
+ {
47
+ "productId": 4,
48
+ "amount": 3
49
+ },
50
+ {
51
+ "productId": 12,
52
+ "amount": 4
53
+ },
54
+ {
55
+ "productId": 3,
56
+ "amount": 4
57
+ },
58
+ {
59
+ "productId": 8,
60
+ "amount": 4
61
+ },
62
+ {
63
+ "productId": 7,
64
+ "amount": 4
65
+ }
66
+ ],
67
+ "trackingNumbers": [],
68
+ "trackingUrls": []
69
+ }
70
+ }
@@ -0,0 +1,71 @@
1
+ {
2
+ "headers": {
3
+ "user": "TestUser"
4
+ },
5
+ "data": {
6
+ "id": 3,
7
+ "status": "received",
8
+ "externalId": "external-ccx",
9
+ "carrierId": 8,
10
+ "branchId": null,
11
+ "price": "153.00",
12
+ "priceCurrency": "CZK",
13
+ "cod": false,
14
+ "codValue": null,
15
+ "codValueCurrency": null,
16
+ "vs": null,
17
+ "companyName": "Webwings s.r.o.",
18
+ "firstName": null,
19
+ "lastName": null,
20
+ "addressLine1": "Marešova 14",
21
+ "addressLine2": "2nd floor",
22
+ "addressLine3": null,
23
+ "city": "Brno",
24
+ "zip": "602 00",
25
+ "country": "CZ",
26
+ "state": null,
27
+ "phone": "+420808875329",
28
+ "email": "developers@webwings.cz",
29
+ "processingDate": "2023-01-24",
30
+ "printDeliveryNote": true,
31
+ "orderNumber": null,
32
+ "orderTags": [
33
+ "tag1",
34
+ "tag2"
35
+ ],
36
+ "packagingInstructions": [
37
+ {
38
+ "message": "Apply fragile sticker",
39
+ "packagingInstructionType": "after"
40
+ }
41
+ ],
42
+ "items": [
43
+ {
44
+ "productId": 16,
45
+ "amount": 4
46
+ },
47
+ {
48
+ "productId": 4,
49
+ "amount": 3
50
+ },
51
+ {
52
+ "productId": 12,
53
+ "amount": 4
54
+ },
55
+ {
56
+ "productId": 3,
57
+ "amount": 4
58
+ },
59
+ {
60
+ "productId": 8,
61
+ "amount": 4
62
+ },
63
+ {
64
+ "productId": 7,
65
+ "amount": 4
66
+ }
67
+ ],
68
+ "trackingNumbers": [],
69
+ "trackingUrls": []
70
+ }
71
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "headers": {
3
+ "user": "TestUser"
4
+ },
5
+ "data": {
6
+ "product": {
7
+ "id": 12,
8
+ "idd": 13,
9
+ "name": "Small iPhone",
10
+ "declarationName": "Small iPhone declaration",
11
+ "description": null,
12
+ "note": null,
13
+ "length": 2.53,
14
+ "width": 10.43,
15
+ "height": 7.82,
16
+ "weight": 13.52,
17
+ "hsCode": "1234",
18
+ "fdaCode": null,
19
+ "hasLot": false,
20
+ "hasImei": false,
21
+ "hasLotExpiration": false,
22
+ "inspectionMethod": null,
23
+ "countryOfOrigin": "CZ",
24
+ "skus": [
25
+ "sku-3079"
26
+ ],
27
+ "barcodes": [
28
+ "5103092117757"
29
+ ]
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "http": "PUT https://app.authentica.cz/api/shop/TestUser/product/12",
3
+ "code": 200,
4
+ "body": {
5
+ "id": 3,
6
+ "name": "Small iPhone",
7
+ "declarationName": "Small iPhone declaration",
8
+ "description": null,
9
+ "note": null,
10
+ "length": 2.53,
11
+ "width": 10.43,
12
+ "height": 7.82,
13
+ "weight": 13.52,
14
+ "hsCode": "1234",
15
+ "fdaCode": null,
16
+ "hasLot": false,
17
+ "hasImei": false,
18
+ "hasLotExpiration": false,
19
+ "inspectionMethod": null,
20
+ "countryOfOrigin": "CZ",
21
+ "skus": [
22
+ "sku-3079"
23
+ ],
24
+ "barcodes": [
25
+ "5103092117757"
26
+ ]
27
+ }
28
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "headers": {
3
+ "user": "TestUser"
4
+ },
5
+ "data": {
6
+ "product": {
7
+ "id": 3,
8
+ "name": "Small iPhone",
9
+ "declarationName": "Small iPhone declaration",
10
+ "description": null,
11
+ "note": null,
12
+ "length": 2.53,
13
+ "width": 10.43,
14
+ "height": 7.82,
15
+ "weight": 13.52,
16
+ "hsCode": "1234",
17
+ "fdaCode": null,
18
+ "hasLot": false,
19
+ "hasImei": false,
20
+ "hasLotExpiration": false,
21
+ "inspectionMethod": null,
22
+ "countryOfOrigin": "CZ",
23
+ "skus": [
24
+ "sku-3079"
25
+ ],
26
+ "barcodes": [
27
+ "5103092117757"
28
+ ]
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "headers": {
3
+ "user": "TestUser"
4
+ },
5
+ "data": {
6
+ "id": "1",
7
+ "externalId": "receipt-1",
8
+ "incomingDate": 1709178916,
9
+ "customerNote": null,
10
+ "customerType": "customer-type",
11
+ "supplier": {
12
+ "firstName": null,
13
+ "lastName": null,
14
+ "companyName": "Webwings s.r.o.",
15
+ "addressLine1": "Marešova 305/14",
16
+ "addressLine2": "2nd floor",
17
+ "addressLine3": null,
18
+ "city": "Brno",
19
+ "zip": "602 00",
20
+ "country": "CZ",
21
+ "state": null
22
+ },
23
+ "items": [
24
+ {
25
+ "productId": 1,
26
+ "expectedAmount": 5,
27
+ "expectedLot": null,
28
+ "expectedExpirationDate": null
29
+ },
30
+ {
31
+ "productId": 2,
32
+ "expectedAmount": 3,
33
+ "expectedLot": "LOT-1",
34
+ "expectedExpirationDate": null
35
+ },
36
+ {
37
+ "productId": 3,
38
+ "receivedAmount": 0,
39
+ "expectedAmount": 1,
40
+ "expectedLot": "LOT-1",
41
+ "expectedExpirationDate": 1719178916
42
+ }
43
+ ]
44
+ }
45
+ }
@@ -0,0 +1,51 @@
1
+ {
2
+ "http": "PUT https://app.authentica.cz/api/shop/TestUser/receipt/1",
3
+ "code": 200,
4
+ "body": {
5
+ "id": 1,
6
+ "status": "waiting_for_receipt",
7
+ "externalId": "receipt-1",
8
+ "incomingDate": 1709178916,
9
+ "customerNote": null,
10
+ "customerType": "customer-type",
11
+ "supplier": {
12
+ "firstName": null,
13
+ "lastName": null,
14
+ "companyName": "Webwings s.r.o.",
15
+ "addressLine1": "Marešova 305/14",
16
+ "addressLine2": "2nd floor",
17
+ "addressLine3": null,
18
+ "city": "Brno",
19
+ "zip": "602 00",
20
+ "country": "CZ",
21
+ "state": null
22
+ },
23
+ "items": [
24
+ {
25
+ "productId": 1,
26
+ "receivedAmount": 0,
27
+ "expectedAmount": 5,
28
+ "expectedLot": null,
29
+ "expectedExpirationDate": null
30
+ },
31
+ {
32
+ "productId": 2,
33
+ "receivedAmount": 0,
34
+ "expectedAmount": 3,
35
+ "expectedLot": "LOT-1",
36
+ "expectedExpirationDate": null
37
+ },
38
+ {
39
+ "productId": 3,
40
+ "receivedAmount": 0,
41
+ "expectedAmount": 1,
42
+ "expectedLot": "LOT-1",
43
+ "expectedExpirationDate": 1719178916
44
+ }
45
+ ],
46
+ "trackingNumbers": [
47
+ "123456789"
48
+ ],
49
+ "shipments": []
50
+ }
51
+ }
@@ -0,0 +1,52 @@
1
+ {
2
+ "headers": {
3
+ "user": "TestUser"
4
+ },
5
+ "data": {
6
+ "id": 1,
7
+ "status": "waiting_for_receipt",
8
+ "externalId": "receipt-1",
9
+ "incomingDate": 1709178916,
10
+ "customerNote": null,
11
+ "customerType": "customer-type",
12
+ "supplier": {
13
+ "firstName": null,
14
+ "lastName": null,
15
+ "companyName": "Webwings s.r.o.",
16
+ "addressLine1": "Marešova 305/14",
17
+ "addressLine2": "2nd floor",
18
+ "addressLine3": null,
19
+ "city": "Brno",
20
+ "zip": "602 00",
21
+ "country": "CZ",
22
+ "state": null
23
+ },
24
+ "items": [
25
+ {
26
+ "productId": 1,
27
+ "receivedAmount": 0,
28
+ "expectedAmount": 5,
29
+ "expectedLot": null,
30
+ "expectedExpirationDate": null
31
+ },
32
+ {
33
+ "productId": 2,
34
+ "receivedAmount": 0,
35
+ "expectedAmount": 3,
36
+ "expectedLot": "LOT-1",
37
+ "expectedExpirationDate": null
38
+ },
39
+ {
40
+ "productId": 3,
41
+ "receivedAmount": 0,
42
+ "expectedAmount": 1,
43
+ "expectedLot": "LOT-1",
44
+ "expectedExpirationDate": 1719178916
45
+ }
46
+ ],
47
+ "trackingNumbers": [
48
+ "123456789"
49
+ ],
50
+ "shipments": []
51
+ }
52
+ }
@@ -0,0 +1,41 @@
1
+ import { NAME } from '@orchesty/connector-git-hub/src/GitHubApplication';
2
+ import { container, redis } from '@orchesty/nodejs-connectors/test/TestAbstract';
3
+ import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
4
+ import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
5
+ import { initAuthenticaTest, mock } from '../../test/dataProvider';
6
+ import AuthenticaApplication, { NAME as Authentica } from '../AuthenticaApplication';
7
+
8
+ let app: AuthenticaApplication;
9
+
10
+ describe('Tests for AuthenticaApplication', () => {
11
+ beforeAll(async () => {
12
+ await initAuthenticaTest();
13
+ app = container.getApplication(Authentica) as AuthenticaApplication;
14
+ });
15
+
16
+ afterAll(async () => {
17
+ await redis.close();
18
+ });
19
+
20
+ it('should get name', () => {
21
+ expect(app.getName()).toEqual('authentica');
22
+ });
23
+
24
+ it('should get public name', () => {
25
+ expect(app.getPublicName()).toEqual('Authentica Fulfillment');
26
+ });
27
+
28
+ it('should get requestDto', async () => {
29
+ const requestDto = await app.getRequestDto(
30
+ ProcessDto.createForFormRequest(NAME, Authentica, crypto.randomUUID()),
31
+ mock(),
32
+ HttpMethods.GET,
33
+ 'applinth/orders',
34
+ { test: 'test' },
35
+ );
36
+
37
+ expect(requestDto.getUrl()).toEqual('https://app.authentica.cz/api/applinth/orders');
38
+ expect(requestDto.getMethod()).toEqual(HttpMethods.GET);
39
+ expect(requestDto.getBody()).toEqual(JSON.stringify({ test: 'test' }));
40
+ });
41
+ });
@@ -0,0 +1,40 @@
1
+ /* eslint-disable */
2
+ export interface AuthenticaOrder {
3
+ id: number;
4
+ status: string;
5
+ externalId: string;
6
+ carrierId: number;
7
+ branchId: unknown | null;
8
+ price: string;
9
+ priceCurrency: string;
10
+ cod: boolean;
11
+ codValue: unknown | null;
12
+ codValueCurrency: unknown | null;
13
+ vs: unknown | null;
14
+ companyName: string;
15
+ firstName: unknown | null;
16
+ lastName: unknown | null;
17
+ addressLine1: string;
18
+ addressLine2: string;
19
+ addressLine3: unknown | null;
20
+ city: string;
21
+ zip: string;
22
+ country: string;
23
+ state: unknown | null;
24
+ phone: string;
25
+ email: string;
26
+ processingDate: string;
27
+ printDeliveryNote: boolean;
28
+ orderNumber: unknown | null;
29
+ orderTags: string[];
30
+ packagingInstructions: {
31
+ message: string;
32
+ packagingInstructionType: string;
33
+ }[];
34
+ items: {
35
+ productId: number;
36
+ amount: number;
37
+ }[];
38
+ trackingNumbers: unknown[];
39
+ trackingUrls: string[];
40
+ }
@@ -0,0 +1,21 @@
1
+ /* eslint-disable */
2
+ export interface AuthenticaProduct {
3
+ id: number;
4
+ name: string;
5
+ declarationName: string;
6
+ description?: string;
7
+ note?: string;
8
+ length?: string;
9
+ width?: string;
10
+ height?: string;
11
+ weight?: string;
12
+ hsCode?: string;
13
+ fdaCode?: string;
14
+ inspectionMethod?: string;
15
+ countryOfOrigin?: string;
16
+ hasLot: boolean;
17
+ hasImei: boolean;
18
+ hasLotExpiration: boolean;
19
+ skus: string[];
20
+ barcodes: string[];
21
+ }
@@ -0,0 +1,30 @@
1
+ /* eslint-disable */
2
+ interface AuthenticaReceipt {
3
+ id: number;
4
+ status: string;
5
+ externalId: string;
6
+ incomingDate: number;
7
+ customerNote: string | null;
8
+ customerType: string | null;
9
+ supplier: {
10
+ firstName: string | null;
11
+ lastName: string | null;
12
+ companyName: string;
13
+ addressLine1: string;
14
+ addressLine2: string | null;
15
+ addressLine3: string | null;
16
+ city: string;
17
+ zip: string;
18
+ country: string;
19
+ state: string | null;
20
+ },
21
+ items: {
22
+ productId: number;
23
+ receivedAmount: number | null;
24
+ expectedAmount: number;
25
+ expectedLot: unknown | null;
26
+ expectedExpirationDate: unknown | null;
27
+ }[];
28
+ trackingNumbers: string[];
29
+ shipments: number[];
30
+ }
@@ -0,0 +1,80 @@
1
+ import { appInstall, DEFAULT_CLIENT_ID, DEFAULT_CLIENT_SECRET, DEFAULT_USER } from '@orchesty/nodejs-connectors/test/DataProvider';
2
+ import { cacheService, container } from '@orchesty/nodejs-connectors/test/TestAbstract';
3
+ import CoreFormsEnum from '@orchesty/nodejs-sdk/dist/lib/Application/Base/CoreFormsEnum';
4
+ import { ApplicationInstall } from '@orchesty/nodejs-sdk/dist/lib/Application/Database/ApplicationInstall';
5
+ import { CLIENT_ID, CLIENT_SECRET } from '@orchesty/nodejs-sdk/dist/lib/Authorization/Type/OAuth2/IOAuth2Application';
6
+ import Redis from '@orchesty/nodejs-sdk/dist/lib/Storage/Redis/Redis';
7
+ import AuthenticaApplication, {
8
+ NAME as AUTHENTICA,
9
+ } from '../src/AuthenticaApplication';
10
+ import AuthenticaGetStock from '../src/Batch/AuthenticaGetStock';
11
+ import AuthenticaGetStockAvailable from '../src/Batch/AuthenticaGetStockAvailable';
12
+ import AuthenticaCreateOrder from '../src/Connector/AuthenticaCreateOrder';
13
+ import AuthenticaCreateProduct from '../src/Connector/AuthenticaCreateProduct';
14
+ import AuthenticaCreateReceipt from '../src/Connector/AuthenticaCreateReceipt';
15
+ import { AuthenticaGetCarriers } from '../src/Connector/AuthenticaGetCarriersConnector';
16
+ import AuthenticaGetOrder from '../src/Connector/AuthenticaGetOrder';
17
+ import AuthenticaGetOrderStatus from '../src/Connector/AuthenticaGetOrderStatus';
18
+ import AuthenticaGetReceipt from '../src/Connector/AuthenticaGetReceipt';
19
+ import AuthenticaGetShippingMethods from '../src/Connector/AuthenticaGetShippingMethods';
20
+ import AuthenticaPostLabel from '../src/Connector/AuthenticaPostLabel';
21
+ import AuthenticaPutOrders from '../src/Connector/AuthenticaPutOrders';
22
+ import AuthenticaPostProducts from '../src/Connector/AuthenticaPutProducts';
23
+ import AuthenticaUpdateOrder from '../src/Connector/AuthenticaUpdateOrder';
24
+ import AuthenticaUpdateProduct from '../src/Connector/AuthenticaUpdateProduct';
25
+ import AuthenticaUpdateReceipt from '../src/Connector/AuthenticaUpdateReceipt';
26
+
27
+ export function mock(): ApplicationInstall {
28
+ return appInstall(
29
+ AUTHENTICA,
30
+ DEFAULT_USER,
31
+ {
32
+ [CoreFormsEnum.AUTHORIZATION_FORM]: {
33
+ [CLIENT_ID]: DEFAULT_CLIENT_ID,
34
+ [CLIENT_SECRET]: DEFAULT_CLIENT_SECRET,
35
+ },
36
+ },
37
+ );
38
+ }
39
+
40
+ export async function regiterApiKey(): Promise<void> {
41
+ const redis = container.get(Redis);
42
+ await redis.remove('authentica_cache_key');
43
+ await redis.set(
44
+ 'authentica_cache_key',
45
+ JSON.stringify({
46
+ expiration: 1759965308,
47
+
48
+ access_token: 'testAccessToken',
49
+ refresh_token: 'testRefreshToken',
50
+ refresh_token_expiration: 1759965308,
51
+
52
+ }),
53
+ 4,
54
+ );
55
+ }
56
+
57
+ export async function initAuthenticaTest(): Promise<void> {
58
+ mock();
59
+ await regiterApiKey();
60
+
61
+ const authenticaApplication = new AuthenticaApplication(cacheService);
62
+ container.setApplication(authenticaApplication);
63
+
64
+ container.setNode(new AuthenticaGetShippingMethods(), authenticaApplication);
65
+ container.setNode(new AuthenticaPutOrders(), authenticaApplication);
66
+ container.setNode(new AuthenticaPostProducts(), authenticaApplication);
67
+ container.setNode(new AuthenticaGetOrderStatus(), authenticaApplication);
68
+ container.setNode(new AuthenticaGetStock(), authenticaApplication);
69
+ container.setNode(new AuthenticaGetStockAvailable(), authenticaApplication);
70
+ container.setNode(new AuthenticaGetCarriers(), authenticaApplication);
71
+ container.setNode(new AuthenticaGetOrder(), authenticaApplication);
72
+ container.setNode(new AuthenticaGetReceipt(), authenticaApplication);
73
+ container.setNode(new AuthenticaCreateProduct(), authenticaApplication);
74
+ container.setNode(new AuthenticaUpdateProduct('product'), authenticaApplication);
75
+ container.setNode(new AuthenticaCreateOrder(), authenticaApplication);
76
+ container.setNode(new AuthenticaUpdateOrder(), authenticaApplication);
77
+ container.setNode(new AuthenticaCreateReceipt(), authenticaApplication);
78
+ container.setNode(new AuthenticaUpdateReceipt(), authenticaApplication);
79
+ container.setNode(new AuthenticaPostLabel(), authenticaApplication);
80
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist",
5
+ "composite": true
6
+ },
7
+ "include": ["src", "test", "../../test"]
8
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "rootDir": "./src",
5
+ },
6
+ "include": [
7
+ "src",
8
+ ],
9
+ "exclude": [
10
+ "node_modules",
11
+ "src/**/__tests__",
12
+ ]
13
+ }