@accounter/server 0.0.8-alpha-20251102085833-d574838ec8d962ba6be12f1ca15d9bee3e2b860d → 0.0.8-alpha-20251102160658-6d41b0a7bb225382246645badf39a28bcd8102e1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -5
- package/dist/green-invoice-graphql/src/mesh-artifacts/index.d.ts +1455 -1202
- package/dist/green-invoice-graphql/src/mesh-artifacts/index.js +602 -415
- package/dist/green-invoice-graphql/src/mesh-artifacts/index.js.map +1 -1
- package/dist/green-invoice-graphql/src/mesh-artifacts/sources/GreenInvoice/schemaWithAnnotations.js +12447 -10635
- package/dist/green-invoice-graphql/src/mesh-artifacts/sources/GreenInvoice/schemaWithAnnotations.js.map +1 -1
- package/dist/green-invoice-graphql/src/mesh-artifacts/sources/GreenInvoice/types.d.ts +780 -643
- package/dist/green-invoice-graphql/src/mesh-artifacts/sources/GreenInvoiceNew/schemaWithAnnotations.js +8 -8
- package/dist/green-invoice-graphql/src/mesh-artifacts/sources/GreenInvoiceNew/schemaWithAnnotations.js.map +1 -1
- package/dist/green-invoice-graphql/src/mesh-artifacts/sources/GreenInvoiceNew/types.d.ts +8 -8
- package/dist/server/src/modules/app-providers/green-invoice-client.d.ts +28 -24
- package/dist/server/src/modules/app-providers/green-invoice-client.js +67 -1
- package/dist/server/src/modules/app-providers/green-invoice-client.js.map +1 -1
- package/dist/server/src/modules/countries/types.d.ts +251 -0
- package/dist/server/src/modules/countries/types.js +252 -0
- package/dist/server/src/modules/countries/types.js.map +1 -1
- package/dist/server/src/modules/financial-entities/resolvers/businesses.resolver.js +6 -2
- package/dist/server/src/modules/financial-entities/resolvers/businesses.resolver.js.map +1 -1
- package/dist/server/src/modules/financial-entities/resolvers/clients.resolvers.js +5 -0
- package/dist/server/src/modules/financial-entities/resolvers/clients.resolvers.js.map +1 -1
- package/dist/server/src/modules/green-invoice/helpers/contract-to-draft.helper.js +1 -1
- package/dist/server/src/modules/green-invoice/helpers/contract-to-draft.helper.js.map +1 -1
- package/dist/server/src/modules/green-invoice/helpers/green-invoice-clients.helper.d.ts +5 -0
- package/dist/server/src/modules/green-invoice/helpers/green-invoice-clients.helper.js +192 -0
- package/dist/server/src/modules/green-invoice/helpers/green-invoice-clients.helper.js.map +1 -0
- package/dist/server/src/modules/green-invoice/helpers/green-invoice.helper.d.ts +26 -23
- package/dist/server/src/modules/green-invoice/helpers/green-invoice.helper.js +1018 -4
- package/dist/server/src/modules/green-invoice/helpers/green-invoice.helper.js.map +1 -1
- package/dist/server/src/modules/green-invoice/helpers/issue-document.helper.d.ts +4 -5
- package/dist/server/src/modules/green-invoice/helpers/issue-document.helper.js +0 -29
- package/dist/server/src/modules/green-invoice/helpers/issue-document.helper.js.map +1 -1
- package/dist/server/src/modules/green-invoice/resolvers/green-invoice.resolvers.js +2 -1
- package/dist/server/src/modules/green-invoice/resolvers/green-invoice.resolvers.js.map +1 -1
- package/package.json +3 -3
- package/src/modules/app-providers/green-invoice-client.ts +82 -1
- package/src/modules/countries/types.ts +252 -0
- package/src/modules/financial-entities/resolvers/businesses.resolver.ts +10 -2
- package/src/modules/financial-entities/resolvers/clients.resolvers.ts +11 -0
- package/src/modules/green-invoice/helpers/contract-to-draft.helper.ts +1 -1
- package/src/modules/green-invoice/helpers/green-invoice-clients.helper.ts +239 -0
- package/src/modules/green-invoice/helpers/green-invoice.helper.ts +1066 -43
- package/src/modules/green-invoice/helpers/issue-document.helper.ts +3 -41
- package/src/modules/green-invoice/resolvers/green-invoice.resolvers.ts +6 -6
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import { GraphQLError } from 'graphql';
|
|
2
2
|
import { Injector } from 'graphql-modules';
|
|
3
3
|
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
4
|
+
_DOLLAR_defs_addDocumentRequest_Input,
|
|
5
|
+
_DOLLAR_defs_Document,
|
|
6
|
+
_DOLLAR_defs_DocumentInputNew_Input,
|
|
7
|
+
_DOLLAR_defs_DocumentLang,
|
|
8
|
+
_DOLLAR_defs_DocumentLinkedDocument,
|
|
9
|
+
_DOLLAR_defs_ExpenseDocumentType,
|
|
10
|
+
_DOLLAR_defs_VatType,
|
|
11
|
+
_DOLLAR_defs_Currency as GreenInvoiceCurrency,
|
|
12
|
+
_DOLLAR_defs_DocumentType as GreenInvoiceDocumentType,
|
|
13
|
+
query_getDocument_payment_items_appType,
|
|
14
|
+
query_getDocument_payment_items_cardType,
|
|
15
|
+
query_getDocument_payment_items_dealType,
|
|
16
|
+
query_getDocument_payment_items_subType,
|
|
17
|
+
query_getDocument_payment_items_type,
|
|
18
|
+
queryInput_previewDocument_input_discount_type,
|
|
19
|
+
queryInput_previewDocument_input_linkType,
|
|
20
20
|
} from '@accounter/green-invoice-graphql';
|
|
21
21
|
import { CloudinaryProvider } from '@modules/app-providers/cloudinary.js';
|
|
22
22
|
import { GreenInvoiceClientProvider } from '@modules/app-providers/green-invoice-client.js';
|
|
23
23
|
import { ChargesProvider } from '@modules/charges/providers/charges.provider.js';
|
|
24
|
+
import { CountryCode } from '@modules/countries/types';
|
|
24
25
|
import { DocumentsProvider } from '@modules/documents/providers/documents.provider.js';
|
|
25
26
|
import { IssuedDocumentsProvider } from '@modules/documents/providers/issued-documents.provider.js';
|
|
26
27
|
import type { document_status, IInsertDocumentsParams } from '@modules/documents/types';
|
|
@@ -28,6 +29,7 @@ import { ClientsProvider } from '@modules/financial-entities/providers/clients.p
|
|
|
28
29
|
import {
|
|
29
30
|
Currency,
|
|
30
31
|
DocumentType,
|
|
32
|
+
GreenInvoiceCountry,
|
|
31
33
|
GreenInvoicePaymentType,
|
|
32
34
|
NewDocumentInfo,
|
|
33
35
|
NewDocumentInput,
|
|
@@ -43,7 +45,7 @@ import {
|
|
|
43
45
|
import { formatCurrency, hashStringToInt } from '@shared/helpers';
|
|
44
46
|
|
|
45
47
|
export function normalizeDocumentType(
|
|
46
|
-
rawType?: GreenInvoiceDocumentType |
|
|
48
|
+
rawType?: GreenInvoiceDocumentType | _DOLLAR_defs_ExpenseDocumentType | number | null,
|
|
47
49
|
): DocumentType {
|
|
48
50
|
if (!rawType) {
|
|
49
51
|
return DocumentType.Unprocessed;
|
|
@@ -144,7 +146,9 @@ export function getGreenInvoiceDocumentNameFromType(
|
|
|
144
146
|
}
|
|
145
147
|
}
|
|
146
148
|
|
|
147
|
-
export function getGreenInvoiceDocumentLanguage(
|
|
149
|
+
export function getGreenInvoiceDocumentLanguage(
|
|
150
|
+
lang: GreenInvoiceDocumentLang,
|
|
151
|
+
): _DOLLAR_defs_DocumentLang {
|
|
148
152
|
switch (lang) {
|
|
149
153
|
case 'HEBREW':
|
|
150
154
|
return 'he';
|
|
@@ -155,7 +159,9 @@ export function getGreenInvoiceDocumentLanguage(lang: GreenInvoiceDocumentLang):
|
|
|
155
159
|
}
|
|
156
160
|
}
|
|
157
161
|
|
|
158
|
-
export function getLanguageFromGreenInvoiceDocument(
|
|
162
|
+
export function getLanguageFromGreenInvoiceDocument(
|
|
163
|
+
lang: _DOLLAR_defs_DocumentLang,
|
|
164
|
+
): GreenInvoiceDocumentLang {
|
|
159
165
|
switch (lang) {
|
|
160
166
|
case 'he':
|
|
161
167
|
return 'HEBREW';
|
|
@@ -166,7 +172,7 @@ export function getLanguageFromGreenInvoiceDocument(lang: DocumentLang): GreenIn
|
|
|
166
172
|
}
|
|
167
173
|
}
|
|
168
174
|
|
|
169
|
-
export function getGreenInvoiceDocumentVatType(vatType: GreenInvoiceVatType):
|
|
175
|
+
export function getGreenInvoiceDocumentVatType(vatType: GreenInvoiceVatType): _DOLLAR_defs_VatType {
|
|
170
176
|
switch (vatType) {
|
|
171
177
|
case 'DEFAULT':
|
|
172
178
|
return '_0';
|
|
@@ -179,7 +185,9 @@ export function getGreenInvoiceDocumentVatType(vatType: GreenInvoiceVatType): Va
|
|
|
179
185
|
}
|
|
180
186
|
}
|
|
181
187
|
|
|
182
|
-
export function getVatTypeFromGreenInvoiceDocument(
|
|
188
|
+
export function getVatTypeFromGreenInvoiceDocument(
|
|
189
|
+
vatType: _DOLLAR_defs_VatType,
|
|
190
|
+
): GreenInvoiceVatType {
|
|
183
191
|
switch (vatType) {
|
|
184
192
|
case '_0':
|
|
185
193
|
return 'DEFAULT';
|
|
@@ -194,7 +202,7 @@ export function getVatTypeFromGreenInvoiceDocument(vatType: VatType): GreenInvoi
|
|
|
194
202
|
|
|
195
203
|
export function getGreenInvoiceDocumentDiscountType(
|
|
196
204
|
discountType: GreenInvoiceDiscountType,
|
|
197
|
-
):
|
|
205
|
+
): queryInput_previewDocument_input_discount_type {
|
|
198
206
|
switch (discountType) {
|
|
199
207
|
case 'PERCENTAGE':
|
|
200
208
|
return 'percentage';
|
|
@@ -207,7 +215,7 @@ export function getGreenInvoiceDocumentDiscountType(
|
|
|
207
215
|
|
|
208
216
|
export function getGreenInvoiceDocumentPaymentType(
|
|
209
217
|
type: GreenInvoicePaymentType,
|
|
210
|
-
):
|
|
218
|
+
): query_getDocument_payment_items_type {
|
|
211
219
|
switch (type) {
|
|
212
220
|
case 'TAX_DEDUCTION':
|
|
213
221
|
return 'NEGATIVE_1';
|
|
@@ -233,7 +241,7 @@ export function getGreenInvoiceDocumentPaymentType(
|
|
|
233
241
|
}
|
|
234
242
|
|
|
235
243
|
export function getTypeFromGreenInvoiceDocumentPayment(
|
|
236
|
-
type:
|
|
244
|
+
type: query_getDocument_payment_items_type,
|
|
237
245
|
): GreenInvoicePaymentType {
|
|
238
246
|
switch (type) {
|
|
239
247
|
case 'NEGATIVE_1':
|
|
@@ -261,7 +269,7 @@ export function getTypeFromGreenInvoiceDocumentPayment(
|
|
|
261
269
|
|
|
262
270
|
export function getGreenInvoiceDocumentPaymentSubType(
|
|
263
271
|
subType: GreenInvoicePaymentSubType,
|
|
264
|
-
):
|
|
272
|
+
): query_getDocument_payment_items_subType {
|
|
265
273
|
switch (subType) {
|
|
266
274
|
case 'BITCOIN':
|
|
267
275
|
return '_1';
|
|
@@ -285,7 +293,7 @@ export function getGreenInvoiceDocumentPaymentSubType(
|
|
|
285
293
|
}
|
|
286
294
|
|
|
287
295
|
export function getSubTypeFromGreenInvoiceDocumentPayment(
|
|
288
|
-
subType:
|
|
296
|
+
subType: query_getDocument_payment_items_subType,
|
|
289
297
|
): GreenInvoicePaymentSubType {
|
|
290
298
|
switch (subType) {
|
|
291
299
|
case '_1':
|
|
@@ -311,7 +319,7 @@ export function getSubTypeFromGreenInvoiceDocumentPayment(
|
|
|
311
319
|
|
|
312
320
|
export function getGreenInvoiceDocumentPaymentAppType(
|
|
313
321
|
appType: GreenInvoicePaymentAppType,
|
|
314
|
-
):
|
|
322
|
+
): query_getDocument_payment_items_appType {
|
|
315
323
|
switch (appType) {
|
|
316
324
|
case 'APPLE_PAY':
|
|
317
325
|
return '_6';
|
|
@@ -331,7 +339,7 @@ export function getGreenInvoiceDocumentPaymentAppType(
|
|
|
331
339
|
}
|
|
332
340
|
|
|
333
341
|
export function getPaymentAppTypeFromGreenInvoiceDocument(
|
|
334
|
-
appType:
|
|
342
|
+
appType: query_getDocument_payment_items_appType,
|
|
335
343
|
): GreenInvoicePaymentAppType {
|
|
336
344
|
switch (appType) {
|
|
337
345
|
case '_6':
|
|
@@ -353,7 +361,7 @@ export function getPaymentAppTypeFromGreenInvoiceDocument(
|
|
|
353
361
|
|
|
354
362
|
export function getGreenInvoiceDocumentPaymentCardType(
|
|
355
363
|
cardType: GreenInvoicePaymentCardType,
|
|
356
|
-
):
|
|
364
|
+
): query_getDocument_payment_items_cardType {
|
|
357
365
|
switch (cardType) {
|
|
358
366
|
case 'AMERICAN_EXPRESS':
|
|
359
367
|
return '_4';
|
|
@@ -373,7 +381,7 @@ export function getGreenInvoiceDocumentPaymentCardType(
|
|
|
373
381
|
}
|
|
374
382
|
|
|
375
383
|
export function getCardTypeFromGreenInvoiceDocumentPayment(
|
|
376
|
-
cardType:
|
|
384
|
+
cardType: query_getDocument_payment_items_cardType,
|
|
377
385
|
): GreenInvoicePaymentCardType {
|
|
378
386
|
switch (cardType) {
|
|
379
387
|
case '_4':
|
|
@@ -395,7 +403,7 @@ export function getCardTypeFromGreenInvoiceDocumentPayment(
|
|
|
395
403
|
|
|
396
404
|
export function getGreenInvoiceDocumentPaymentDealType(
|
|
397
405
|
dealType: GreenInvoicePaymentDealType,
|
|
398
|
-
):
|
|
406
|
+
): query_getDocument_payment_items_dealType {
|
|
399
407
|
switch (dealType) {
|
|
400
408
|
case 'CREDIT':
|
|
401
409
|
return '_3';
|
|
@@ -415,7 +423,7 @@ export function getGreenInvoiceDocumentPaymentDealType(
|
|
|
415
423
|
}
|
|
416
424
|
|
|
417
425
|
export function getDealTypeFromGreenInvoiceDocumentPayment(
|
|
418
|
-
dealType:
|
|
426
|
+
dealType: query_getDocument_payment_items_dealType,
|
|
419
427
|
): GreenInvoicePaymentDealType {
|
|
420
428
|
switch (dealType) {
|
|
421
429
|
case '_3':
|
|
@@ -437,7 +445,7 @@ export function getDealTypeFromGreenInvoiceDocumentPayment(
|
|
|
437
445
|
|
|
438
446
|
export function getGreenInvoiceDocumentLinkType(
|
|
439
447
|
linkType: GreenInvoiceLinkType,
|
|
440
|
-
):
|
|
448
|
+
): queryInput_previewDocument_input_linkType {
|
|
441
449
|
switch (linkType) {
|
|
442
450
|
case 'CANCEL':
|
|
443
451
|
return 'CANCEL';
|
|
@@ -475,6 +483,1018 @@ export function convertCurrencyToGreenInvoice(currency: Currency): GreenInvoiceC
|
|
|
475
483
|
}
|
|
476
484
|
}
|
|
477
485
|
|
|
486
|
+
export function greenInvoiceCountryToCountryCode(country: GreenInvoiceCountry): CountryCode {
|
|
487
|
+
switch (country) {
|
|
488
|
+
case 'AD':
|
|
489
|
+
return CountryCode.AND;
|
|
490
|
+
case 'AE':
|
|
491
|
+
return CountryCode.ARE;
|
|
492
|
+
case 'AF':
|
|
493
|
+
return CountryCode.AFG;
|
|
494
|
+
case 'AG':
|
|
495
|
+
return CountryCode.ATG;
|
|
496
|
+
case 'AI':
|
|
497
|
+
return CountryCode.AIA;
|
|
498
|
+
case 'AL':
|
|
499
|
+
return CountryCode.ALB;
|
|
500
|
+
case 'AM':
|
|
501
|
+
return CountryCode.ARM;
|
|
502
|
+
case 'AO':
|
|
503
|
+
return CountryCode.AGO;
|
|
504
|
+
case 'AQ':
|
|
505
|
+
return CountryCode.ATA;
|
|
506
|
+
case 'AR':
|
|
507
|
+
return CountryCode.ARG;
|
|
508
|
+
case 'AS':
|
|
509
|
+
return CountryCode.ASM;
|
|
510
|
+
case 'AT':
|
|
511
|
+
return CountryCode.AUT;
|
|
512
|
+
case 'AU':
|
|
513
|
+
return CountryCode.AUS;
|
|
514
|
+
case 'AW':
|
|
515
|
+
return CountryCode.ABW;
|
|
516
|
+
case 'AX':
|
|
517
|
+
return CountryCode.ALA;
|
|
518
|
+
case 'AZ':
|
|
519
|
+
return CountryCode.AZE;
|
|
520
|
+
case 'BA':
|
|
521
|
+
return CountryCode.BIH;
|
|
522
|
+
case 'BB':
|
|
523
|
+
return CountryCode.BRB;
|
|
524
|
+
case 'BD':
|
|
525
|
+
return CountryCode.BGD;
|
|
526
|
+
case 'BE':
|
|
527
|
+
return CountryCode.BEL;
|
|
528
|
+
case 'BF':
|
|
529
|
+
return CountryCode.BFA;
|
|
530
|
+
case 'BG':
|
|
531
|
+
return CountryCode.BGR;
|
|
532
|
+
case 'BH':
|
|
533
|
+
return CountryCode.BHR;
|
|
534
|
+
case 'BI':
|
|
535
|
+
return CountryCode.BDI;
|
|
536
|
+
case 'BJ':
|
|
537
|
+
return CountryCode.BEN;
|
|
538
|
+
case 'BL':
|
|
539
|
+
return CountryCode.BLM;
|
|
540
|
+
case 'BM':
|
|
541
|
+
return CountryCode.BMU;
|
|
542
|
+
case 'BN':
|
|
543
|
+
return CountryCode.BRN;
|
|
544
|
+
case 'BO':
|
|
545
|
+
return CountryCode.BOL;
|
|
546
|
+
case 'BQ':
|
|
547
|
+
return CountryCode.BES;
|
|
548
|
+
case 'BR':
|
|
549
|
+
return CountryCode.BRA;
|
|
550
|
+
case 'BS':
|
|
551
|
+
return CountryCode.BHS;
|
|
552
|
+
case 'BT':
|
|
553
|
+
return CountryCode.BTN;
|
|
554
|
+
case 'BV':
|
|
555
|
+
return CountryCode.BVT;
|
|
556
|
+
case 'BW':
|
|
557
|
+
return CountryCode.BWA;
|
|
558
|
+
case 'BY':
|
|
559
|
+
return CountryCode.BLR;
|
|
560
|
+
case 'BZ':
|
|
561
|
+
return CountryCode.BLZ;
|
|
562
|
+
case 'CA':
|
|
563
|
+
return CountryCode.CAN;
|
|
564
|
+
case 'CC':
|
|
565
|
+
return CountryCode.CCK;
|
|
566
|
+
case 'CD':
|
|
567
|
+
return CountryCode.COD;
|
|
568
|
+
case 'CF':
|
|
569
|
+
return CountryCode.CAF;
|
|
570
|
+
case 'CG':
|
|
571
|
+
return CountryCode.COG;
|
|
572
|
+
case 'CH':
|
|
573
|
+
return CountryCode.CHE;
|
|
574
|
+
case 'CI':
|
|
575
|
+
return CountryCode.CIV;
|
|
576
|
+
case 'CK':
|
|
577
|
+
return CountryCode.COK;
|
|
578
|
+
case 'CL':
|
|
579
|
+
return CountryCode.CHL;
|
|
580
|
+
case 'CM':
|
|
581
|
+
return CountryCode.CMR;
|
|
582
|
+
case 'CN':
|
|
583
|
+
return CountryCode.CHN;
|
|
584
|
+
case 'CO':
|
|
585
|
+
return CountryCode.COL;
|
|
586
|
+
case 'CR':
|
|
587
|
+
return CountryCode.CRI;
|
|
588
|
+
case 'CU':
|
|
589
|
+
return CountryCode.CUB;
|
|
590
|
+
case 'CV':
|
|
591
|
+
return CountryCode.CPV;
|
|
592
|
+
case 'CW':
|
|
593
|
+
return CountryCode.CUW;
|
|
594
|
+
case 'CX':
|
|
595
|
+
return CountryCode.CXR;
|
|
596
|
+
case 'CY':
|
|
597
|
+
return CountryCode.CYP;
|
|
598
|
+
case 'CZ':
|
|
599
|
+
return CountryCode.CZE;
|
|
600
|
+
case 'DE':
|
|
601
|
+
return CountryCode.DEU;
|
|
602
|
+
case 'DJ':
|
|
603
|
+
return CountryCode.DJI;
|
|
604
|
+
case 'DK':
|
|
605
|
+
return CountryCode.DNK;
|
|
606
|
+
case 'DM':
|
|
607
|
+
return CountryCode.DMA;
|
|
608
|
+
case 'DO':
|
|
609
|
+
return CountryCode.DOM;
|
|
610
|
+
case 'DZ':
|
|
611
|
+
return CountryCode.DZA;
|
|
612
|
+
case 'EC':
|
|
613
|
+
return CountryCode.ECU;
|
|
614
|
+
case 'EE':
|
|
615
|
+
return CountryCode.EST;
|
|
616
|
+
case 'EG':
|
|
617
|
+
return CountryCode.EGY;
|
|
618
|
+
case 'EH':
|
|
619
|
+
return CountryCode.ESH;
|
|
620
|
+
case 'ER':
|
|
621
|
+
return CountryCode.ERI;
|
|
622
|
+
case 'ES':
|
|
623
|
+
return CountryCode.ESP;
|
|
624
|
+
case 'ET':
|
|
625
|
+
return CountryCode.ETH;
|
|
626
|
+
case 'FI':
|
|
627
|
+
return CountryCode.FIN;
|
|
628
|
+
case 'FJ':
|
|
629
|
+
return CountryCode.FJI;
|
|
630
|
+
case 'FK':
|
|
631
|
+
return CountryCode.FLK;
|
|
632
|
+
case 'FM':
|
|
633
|
+
return CountryCode.FSM;
|
|
634
|
+
case 'FO':
|
|
635
|
+
return CountryCode.FRO;
|
|
636
|
+
case 'FR':
|
|
637
|
+
return CountryCode.FRA;
|
|
638
|
+
case 'GA':
|
|
639
|
+
return CountryCode.GAB;
|
|
640
|
+
case 'GB':
|
|
641
|
+
return CountryCode.GBR;
|
|
642
|
+
case 'GD':
|
|
643
|
+
return CountryCode.GRD;
|
|
644
|
+
case 'GE':
|
|
645
|
+
return CountryCode.GEO;
|
|
646
|
+
case 'GF':
|
|
647
|
+
return CountryCode.GUF;
|
|
648
|
+
case 'GG':
|
|
649
|
+
return CountryCode.GGY;
|
|
650
|
+
case 'GH':
|
|
651
|
+
return CountryCode.GHA;
|
|
652
|
+
case 'GI':
|
|
653
|
+
return CountryCode.GIB;
|
|
654
|
+
case 'GL':
|
|
655
|
+
return CountryCode.GRL;
|
|
656
|
+
case 'GM':
|
|
657
|
+
return CountryCode.GMB;
|
|
658
|
+
case 'GN':
|
|
659
|
+
return CountryCode.GIN;
|
|
660
|
+
case 'GP':
|
|
661
|
+
return CountryCode.GLP;
|
|
662
|
+
case 'GQ':
|
|
663
|
+
return CountryCode.GNQ;
|
|
664
|
+
case 'GR':
|
|
665
|
+
return CountryCode.GRC;
|
|
666
|
+
case 'GS':
|
|
667
|
+
return CountryCode.SGS;
|
|
668
|
+
case 'GT':
|
|
669
|
+
return CountryCode.GTM;
|
|
670
|
+
case 'GU':
|
|
671
|
+
return CountryCode.GUM;
|
|
672
|
+
case 'GW':
|
|
673
|
+
return CountryCode.GNB;
|
|
674
|
+
case 'GY':
|
|
675
|
+
return CountryCode.GUY;
|
|
676
|
+
case 'HK':
|
|
677
|
+
return CountryCode.HKG;
|
|
678
|
+
case 'HM':
|
|
679
|
+
return CountryCode.HMD;
|
|
680
|
+
case 'HN':
|
|
681
|
+
return CountryCode.HND;
|
|
682
|
+
case 'HR':
|
|
683
|
+
return CountryCode.HRV;
|
|
684
|
+
case 'HT':
|
|
685
|
+
return CountryCode.HTI;
|
|
686
|
+
case 'HU':
|
|
687
|
+
return CountryCode.HUN;
|
|
688
|
+
case 'ID':
|
|
689
|
+
return CountryCode.IDN;
|
|
690
|
+
case 'IE':
|
|
691
|
+
return CountryCode.IRL;
|
|
692
|
+
case 'IL':
|
|
693
|
+
return CountryCode.ISR;
|
|
694
|
+
case 'IM':
|
|
695
|
+
return CountryCode.IMN;
|
|
696
|
+
case 'IN':
|
|
697
|
+
return CountryCode.IND;
|
|
698
|
+
case 'IO':
|
|
699
|
+
return CountryCode.IOT;
|
|
700
|
+
case 'IQ':
|
|
701
|
+
return CountryCode.IRQ;
|
|
702
|
+
case 'IR':
|
|
703
|
+
return CountryCode.IRN;
|
|
704
|
+
case 'IS':
|
|
705
|
+
return CountryCode.ISL;
|
|
706
|
+
case 'IT':
|
|
707
|
+
return CountryCode.ITA;
|
|
708
|
+
case 'JE':
|
|
709
|
+
return CountryCode.JEY;
|
|
710
|
+
case 'JM':
|
|
711
|
+
return CountryCode.JAM;
|
|
712
|
+
case 'JO':
|
|
713
|
+
return CountryCode.JOR;
|
|
714
|
+
case 'JP':
|
|
715
|
+
return CountryCode.JPN;
|
|
716
|
+
case 'KE':
|
|
717
|
+
return CountryCode.KEN;
|
|
718
|
+
case 'KG':
|
|
719
|
+
return CountryCode.KGZ;
|
|
720
|
+
case 'KH':
|
|
721
|
+
return CountryCode.KHM;
|
|
722
|
+
case 'KI':
|
|
723
|
+
return CountryCode.KIR;
|
|
724
|
+
case 'KM':
|
|
725
|
+
return CountryCode.COM;
|
|
726
|
+
case 'KN':
|
|
727
|
+
return CountryCode.KNA;
|
|
728
|
+
case 'KP':
|
|
729
|
+
return CountryCode.PRK;
|
|
730
|
+
case 'KR':
|
|
731
|
+
return CountryCode.KOR;
|
|
732
|
+
case 'KW':
|
|
733
|
+
return CountryCode.KWT;
|
|
734
|
+
case 'KY':
|
|
735
|
+
return CountryCode.CYM;
|
|
736
|
+
case 'KZ':
|
|
737
|
+
return CountryCode.KAZ;
|
|
738
|
+
case 'LA':
|
|
739
|
+
return CountryCode.LAO;
|
|
740
|
+
case 'LB':
|
|
741
|
+
return CountryCode.LBN;
|
|
742
|
+
case 'LC':
|
|
743
|
+
return CountryCode.LCA;
|
|
744
|
+
case 'LI':
|
|
745
|
+
return CountryCode.LIE;
|
|
746
|
+
case 'LK':
|
|
747
|
+
return CountryCode.LKA;
|
|
748
|
+
case 'LR':
|
|
749
|
+
return CountryCode.LBR;
|
|
750
|
+
case 'LS':
|
|
751
|
+
return CountryCode.LSO;
|
|
752
|
+
case 'LT':
|
|
753
|
+
return CountryCode.LTU;
|
|
754
|
+
case 'LU':
|
|
755
|
+
return CountryCode.LUX;
|
|
756
|
+
case 'LV':
|
|
757
|
+
return CountryCode.LVA;
|
|
758
|
+
case 'LY':
|
|
759
|
+
return CountryCode.LBY;
|
|
760
|
+
case 'MA':
|
|
761
|
+
return CountryCode.MAR;
|
|
762
|
+
case 'MC':
|
|
763
|
+
return CountryCode.MCO;
|
|
764
|
+
case 'MD':
|
|
765
|
+
return CountryCode.MDA;
|
|
766
|
+
case 'ME':
|
|
767
|
+
return CountryCode.MNE;
|
|
768
|
+
case 'MF':
|
|
769
|
+
return CountryCode.MAF;
|
|
770
|
+
case 'MG':
|
|
771
|
+
return CountryCode.MDG;
|
|
772
|
+
case 'MH':
|
|
773
|
+
return CountryCode.MHL;
|
|
774
|
+
case 'MK':
|
|
775
|
+
return CountryCode.MKD;
|
|
776
|
+
case 'ML':
|
|
777
|
+
return CountryCode.MLI;
|
|
778
|
+
case 'MM':
|
|
779
|
+
return CountryCode.MMR;
|
|
780
|
+
case 'MN':
|
|
781
|
+
return CountryCode.MNG;
|
|
782
|
+
case 'MO':
|
|
783
|
+
return CountryCode.MAC;
|
|
784
|
+
case 'MP':
|
|
785
|
+
return CountryCode.MNP;
|
|
786
|
+
case 'MQ':
|
|
787
|
+
return CountryCode.MTQ;
|
|
788
|
+
case 'MR':
|
|
789
|
+
return CountryCode.MRT;
|
|
790
|
+
case 'MS':
|
|
791
|
+
return CountryCode.MSR;
|
|
792
|
+
case 'MT':
|
|
793
|
+
return CountryCode.MLT;
|
|
794
|
+
case 'MU':
|
|
795
|
+
return CountryCode.MUS;
|
|
796
|
+
case 'MV':
|
|
797
|
+
return CountryCode.MDV;
|
|
798
|
+
case 'MW':
|
|
799
|
+
return CountryCode.MWI;
|
|
800
|
+
case 'MX':
|
|
801
|
+
return CountryCode.MEX;
|
|
802
|
+
case 'MY':
|
|
803
|
+
return CountryCode.MYS;
|
|
804
|
+
case 'MZ':
|
|
805
|
+
return CountryCode.MOZ;
|
|
806
|
+
case 'NA':
|
|
807
|
+
return CountryCode.NAM;
|
|
808
|
+
case 'NC':
|
|
809
|
+
return CountryCode.NCL;
|
|
810
|
+
case 'NE':
|
|
811
|
+
return CountryCode.NER;
|
|
812
|
+
case 'NF':
|
|
813
|
+
return CountryCode.NFK;
|
|
814
|
+
case 'NG':
|
|
815
|
+
return CountryCode.NGA;
|
|
816
|
+
case 'NI':
|
|
817
|
+
return CountryCode.NIC;
|
|
818
|
+
case 'NL':
|
|
819
|
+
return CountryCode.NLD;
|
|
820
|
+
case 'NO':
|
|
821
|
+
return CountryCode.NOR;
|
|
822
|
+
case 'NP':
|
|
823
|
+
return CountryCode.NPL;
|
|
824
|
+
case 'NR':
|
|
825
|
+
return CountryCode.NRU;
|
|
826
|
+
case 'NU':
|
|
827
|
+
return CountryCode.NIU;
|
|
828
|
+
case 'NZ':
|
|
829
|
+
return CountryCode.NZL;
|
|
830
|
+
case 'OM':
|
|
831
|
+
return CountryCode.OMN;
|
|
832
|
+
case 'PA':
|
|
833
|
+
return CountryCode.PAN;
|
|
834
|
+
case 'PE':
|
|
835
|
+
return CountryCode.PER;
|
|
836
|
+
case 'PF':
|
|
837
|
+
return CountryCode.PYF;
|
|
838
|
+
case 'PG':
|
|
839
|
+
return CountryCode.PNG;
|
|
840
|
+
case 'PH':
|
|
841
|
+
return CountryCode.PHL;
|
|
842
|
+
case 'PK':
|
|
843
|
+
return CountryCode.PAK;
|
|
844
|
+
case 'PL':
|
|
845
|
+
return CountryCode.POL;
|
|
846
|
+
case 'PM':
|
|
847
|
+
return CountryCode.SPM;
|
|
848
|
+
case 'PN':
|
|
849
|
+
return CountryCode.PCN;
|
|
850
|
+
case 'PR':
|
|
851
|
+
return CountryCode.PRI;
|
|
852
|
+
case 'PS':
|
|
853
|
+
return CountryCode.PSE;
|
|
854
|
+
case 'PT':
|
|
855
|
+
return CountryCode.PRT;
|
|
856
|
+
case 'PW':
|
|
857
|
+
return CountryCode.PLW;
|
|
858
|
+
case 'PY':
|
|
859
|
+
return CountryCode.PRY;
|
|
860
|
+
case 'QA':
|
|
861
|
+
return CountryCode.QAT;
|
|
862
|
+
case 'RE':
|
|
863
|
+
return CountryCode.REU;
|
|
864
|
+
case 'RO':
|
|
865
|
+
return CountryCode.ROU;
|
|
866
|
+
case 'RS':
|
|
867
|
+
return CountryCode.SRB;
|
|
868
|
+
case 'RU':
|
|
869
|
+
return CountryCode.RUS;
|
|
870
|
+
case 'RW':
|
|
871
|
+
return CountryCode.RWA;
|
|
872
|
+
case 'SA':
|
|
873
|
+
return CountryCode.SAU;
|
|
874
|
+
case 'SB':
|
|
875
|
+
return CountryCode.SLB;
|
|
876
|
+
case 'SC':
|
|
877
|
+
return CountryCode.SYC;
|
|
878
|
+
case 'SD':
|
|
879
|
+
return CountryCode.SDN;
|
|
880
|
+
case 'SE':
|
|
881
|
+
return CountryCode.SWE;
|
|
882
|
+
case 'SG':
|
|
883
|
+
return CountryCode.SGP;
|
|
884
|
+
case 'SH':
|
|
885
|
+
return CountryCode.SHN;
|
|
886
|
+
case 'SI':
|
|
887
|
+
return CountryCode.SVN;
|
|
888
|
+
case 'SJ':
|
|
889
|
+
return CountryCode.SJM;
|
|
890
|
+
case 'SK':
|
|
891
|
+
return CountryCode.SVK;
|
|
892
|
+
case 'SL':
|
|
893
|
+
return CountryCode.SLE;
|
|
894
|
+
case 'SM':
|
|
895
|
+
return CountryCode.SMR;
|
|
896
|
+
case 'SN':
|
|
897
|
+
return CountryCode.SEN;
|
|
898
|
+
case 'SO':
|
|
899
|
+
return CountryCode.SOM;
|
|
900
|
+
case 'SR':
|
|
901
|
+
return CountryCode.SUR;
|
|
902
|
+
case 'SS':
|
|
903
|
+
return CountryCode.SSD;
|
|
904
|
+
case 'ST':
|
|
905
|
+
return CountryCode.STP;
|
|
906
|
+
case 'SV':
|
|
907
|
+
return CountryCode.SLV;
|
|
908
|
+
case 'SX':
|
|
909
|
+
return CountryCode.SXM;
|
|
910
|
+
case 'SY':
|
|
911
|
+
return CountryCode.SYR;
|
|
912
|
+
case 'SZ':
|
|
913
|
+
return CountryCode.SWZ;
|
|
914
|
+
case 'TC':
|
|
915
|
+
return CountryCode.TCA;
|
|
916
|
+
case 'TD':
|
|
917
|
+
return CountryCode.TCD;
|
|
918
|
+
case 'TF':
|
|
919
|
+
return CountryCode.ATF;
|
|
920
|
+
case 'TG':
|
|
921
|
+
return CountryCode.TGO;
|
|
922
|
+
case 'TH':
|
|
923
|
+
return CountryCode.THA;
|
|
924
|
+
case 'TJ':
|
|
925
|
+
return CountryCode.TJK;
|
|
926
|
+
case 'TK':
|
|
927
|
+
return CountryCode.TKL;
|
|
928
|
+
case 'TL':
|
|
929
|
+
return CountryCode.TLS;
|
|
930
|
+
case 'TM':
|
|
931
|
+
return CountryCode.TKM;
|
|
932
|
+
case 'TN':
|
|
933
|
+
return CountryCode.TUN;
|
|
934
|
+
case 'TO':
|
|
935
|
+
return CountryCode.TON;
|
|
936
|
+
case 'TR':
|
|
937
|
+
return CountryCode.TUR;
|
|
938
|
+
case 'TT':
|
|
939
|
+
return CountryCode.TTO;
|
|
940
|
+
case 'TV':
|
|
941
|
+
return CountryCode.TUV;
|
|
942
|
+
case 'TW':
|
|
943
|
+
return CountryCode.TWN;
|
|
944
|
+
case 'TZ':
|
|
945
|
+
return CountryCode.TZA;
|
|
946
|
+
case 'UA':
|
|
947
|
+
return CountryCode.UKR;
|
|
948
|
+
case 'UG':
|
|
949
|
+
return CountryCode.UGA;
|
|
950
|
+
case 'UM':
|
|
951
|
+
return CountryCode.UMI;
|
|
952
|
+
case 'US':
|
|
953
|
+
return CountryCode.USA;
|
|
954
|
+
case 'UY':
|
|
955
|
+
return CountryCode.URY;
|
|
956
|
+
case 'UZ':
|
|
957
|
+
return CountryCode.UZB;
|
|
958
|
+
case 'VA':
|
|
959
|
+
return CountryCode.VAT;
|
|
960
|
+
case 'VC':
|
|
961
|
+
return CountryCode.VCT;
|
|
962
|
+
case 'VE':
|
|
963
|
+
return CountryCode.VEN;
|
|
964
|
+
case 'VG':
|
|
965
|
+
return CountryCode.VGB;
|
|
966
|
+
case 'VI':
|
|
967
|
+
return CountryCode.VIR;
|
|
968
|
+
case 'VN':
|
|
969
|
+
return CountryCode.VNM;
|
|
970
|
+
case 'VU':
|
|
971
|
+
return CountryCode.VUT;
|
|
972
|
+
case 'WF':
|
|
973
|
+
return CountryCode.WLF;
|
|
974
|
+
case 'WS':
|
|
975
|
+
return CountryCode.WSM;
|
|
976
|
+
case 'YE':
|
|
977
|
+
return CountryCode.YEM;
|
|
978
|
+
case 'YT':
|
|
979
|
+
return CountryCode.MYT;
|
|
980
|
+
case 'ZA':
|
|
981
|
+
return CountryCode.ZAF;
|
|
982
|
+
case 'ZM':
|
|
983
|
+
return CountryCode.ZMB;
|
|
984
|
+
case 'ZW':
|
|
985
|
+
return CountryCode.ZWE;
|
|
986
|
+
case 'XK':
|
|
987
|
+
throw new Error(`Country code XK (Kosovo) is not supported in CountryCode enum`);
|
|
988
|
+
default:
|
|
989
|
+
throw new Error(`Unsupported Green Invoice country: ${country}`);
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
export function countryCodeToGreenInvoiceCountry(countryCode: CountryCode): GreenInvoiceCountry {
|
|
994
|
+
switch (countryCode) {
|
|
995
|
+
case CountryCode.AFG:
|
|
996
|
+
return 'AF';
|
|
997
|
+
case CountryCode.ALA:
|
|
998
|
+
return 'AX';
|
|
999
|
+
case CountryCode.ALB:
|
|
1000
|
+
return 'AL';
|
|
1001
|
+
case CountryCode.DZA:
|
|
1002
|
+
return 'DZ';
|
|
1003
|
+
case CountryCode.ASM:
|
|
1004
|
+
return 'AS';
|
|
1005
|
+
case CountryCode.AND:
|
|
1006
|
+
return 'AD';
|
|
1007
|
+
case CountryCode.AGO:
|
|
1008
|
+
return 'AO';
|
|
1009
|
+
case CountryCode.AIA:
|
|
1010
|
+
return 'AI';
|
|
1011
|
+
case CountryCode.ATA:
|
|
1012
|
+
return 'AQ';
|
|
1013
|
+
case CountryCode.ATG:
|
|
1014
|
+
return 'AG';
|
|
1015
|
+
case CountryCode.ARG:
|
|
1016
|
+
return 'AR';
|
|
1017
|
+
case CountryCode.ARM:
|
|
1018
|
+
return 'AM';
|
|
1019
|
+
case CountryCode.ABW:
|
|
1020
|
+
return 'AW';
|
|
1021
|
+
case CountryCode.AUS:
|
|
1022
|
+
return 'AU';
|
|
1023
|
+
case CountryCode.AUT:
|
|
1024
|
+
return 'AT';
|
|
1025
|
+
case CountryCode.AZE:
|
|
1026
|
+
return 'AZ';
|
|
1027
|
+
case CountryCode.BHS:
|
|
1028
|
+
return 'BS';
|
|
1029
|
+
case CountryCode.BHR:
|
|
1030
|
+
return 'BH';
|
|
1031
|
+
case CountryCode.BGD:
|
|
1032
|
+
return 'BD';
|
|
1033
|
+
case CountryCode.BRB:
|
|
1034
|
+
return 'BB';
|
|
1035
|
+
case CountryCode.BLR:
|
|
1036
|
+
return 'BY';
|
|
1037
|
+
case CountryCode.BEL:
|
|
1038
|
+
return 'BE';
|
|
1039
|
+
case CountryCode.BLZ:
|
|
1040
|
+
return 'BZ';
|
|
1041
|
+
case CountryCode.BEN:
|
|
1042
|
+
return 'BJ';
|
|
1043
|
+
case CountryCode.BMU:
|
|
1044
|
+
return 'BM';
|
|
1045
|
+
case CountryCode.BTN:
|
|
1046
|
+
return 'BT';
|
|
1047
|
+
case CountryCode.BOL:
|
|
1048
|
+
return 'BO';
|
|
1049
|
+
case CountryCode.BES:
|
|
1050
|
+
return 'BQ';
|
|
1051
|
+
case CountryCode.BIH:
|
|
1052
|
+
return 'BA';
|
|
1053
|
+
case CountryCode.BWA:
|
|
1054
|
+
return 'BW';
|
|
1055
|
+
case CountryCode.BVT:
|
|
1056
|
+
return 'BV';
|
|
1057
|
+
case CountryCode.BRA:
|
|
1058
|
+
return 'BR';
|
|
1059
|
+
case CountryCode.IOT:
|
|
1060
|
+
return 'IO';
|
|
1061
|
+
case CountryCode.BRN:
|
|
1062
|
+
return 'BN';
|
|
1063
|
+
case CountryCode.BGR:
|
|
1064
|
+
return 'BG';
|
|
1065
|
+
case CountryCode.BFA:
|
|
1066
|
+
return 'BF';
|
|
1067
|
+
case CountryCode.BDI:
|
|
1068
|
+
return 'BI';
|
|
1069
|
+
case CountryCode.CPV:
|
|
1070
|
+
return 'CV';
|
|
1071
|
+
case CountryCode.KHM:
|
|
1072
|
+
return 'KH';
|
|
1073
|
+
case CountryCode.CMR:
|
|
1074
|
+
return 'CM';
|
|
1075
|
+
case CountryCode.CAN:
|
|
1076
|
+
return 'CA';
|
|
1077
|
+
case CountryCode.CYM:
|
|
1078
|
+
return 'KY';
|
|
1079
|
+
case CountryCode.CAF:
|
|
1080
|
+
return 'CF';
|
|
1081
|
+
case CountryCode.TCD:
|
|
1082
|
+
return 'TD';
|
|
1083
|
+
case CountryCode.CHL:
|
|
1084
|
+
return 'CL';
|
|
1085
|
+
case CountryCode.CHN:
|
|
1086
|
+
return 'CN';
|
|
1087
|
+
case CountryCode.CXR:
|
|
1088
|
+
return 'CX';
|
|
1089
|
+
case CountryCode.CCK:
|
|
1090
|
+
return 'CC';
|
|
1091
|
+
case CountryCode.COL:
|
|
1092
|
+
return 'CO';
|
|
1093
|
+
case CountryCode.COM:
|
|
1094
|
+
return 'KM';
|
|
1095
|
+
case CountryCode.COD:
|
|
1096
|
+
return 'CD';
|
|
1097
|
+
case CountryCode.COG:
|
|
1098
|
+
return 'CG';
|
|
1099
|
+
case CountryCode.COK:
|
|
1100
|
+
return 'CK';
|
|
1101
|
+
case CountryCode.CRI:
|
|
1102
|
+
return 'CR';
|
|
1103
|
+
case CountryCode.HRV:
|
|
1104
|
+
return 'HR';
|
|
1105
|
+
case CountryCode.CUB:
|
|
1106
|
+
return 'CU';
|
|
1107
|
+
case CountryCode.CUW:
|
|
1108
|
+
return 'CW';
|
|
1109
|
+
case CountryCode.CYP:
|
|
1110
|
+
return 'CY';
|
|
1111
|
+
case CountryCode.CZE:
|
|
1112
|
+
return 'CZ';
|
|
1113
|
+
case CountryCode.CIV:
|
|
1114
|
+
return 'CI';
|
|
1115
|
+
case CountryCode.DNK:
|
|
1116
|
+
return 'DK';
|
|
1117
|
+
case CountryCode.DJI:
|
|
1118
|
+
return 'DJ';
|
|
1119
|
+
case CountryCode.DMA:
|
|
1120
|
+
return 'DM';
|
|
1121
|
+
case CountryCode.DOM:
|
|
1122
|
+
return 'DO';
|
|
1123
|
+
case CountryCode.ECU:
|
|
1124
|
+
return 'EC';
|
|
1125
|
+
case CountryCode.EGY:
|
|
1126
|
+
return 'EG';
|
|
1127
|
+
case CountryCode.SLV:
|
|
1128
|
+
return 'SV';
|
|
1129
|
+
case CountryCode.GNQ:
|
|
1130
|
+
return 'GQ';
|
|
1131
|
+
case CountryCode.ERI:
|
|
1132
|
+
return 'ER';
|
|
1133
|
+
case CountryCode.EST:
|
|
1134
|
+
return 'EE';
|
|
1135
|
+
case CountryCode.SWZ:
|
|
1136
|
+
throw new Error(`Country code SWZ (Eswatini) is not supported in GreenInvoiceCountry`);
|
|
1137
|
+
case CountryCode.ETH:
|
|
1138
|
+
return 'ET';
|
|
1139
|
+
case CountryCode.FLK:
|
|
1140
|
+
return 'FK';
|
|
1141
|
+
case CountryCode.FRO:
|
|
1142
|
+
return 'FO';
|
|
1143
|
+
case CountryCode.FJI:
|
|
1144
|
+
return 'FJ';
|
|
1145
|
+
case CountryCode.FIN:
|
|
1146
|
+
return 'FI';
|
|
1147
|
+
case CountryCode.FRA:
|
|
1148
|
+
return 'FR';
|
|
1149
|
+
case CountryCode.GUF:
|
|
1150
|
+
return 'GF';
|
|
1151
|
+
case CountryCode.PYF:
|
|
1152
|
+
return 'PF';
|
|
1153
|
+
case CountryCode.ATF:
|
|
1154
|
+
return 'TF';
|
|
1155
|
+
case CountryCode.GAB:
|
|
1156
|
+
return 'GA';
|
|
1157
|
+
case CountryCode.GMB:
|
|
1158
|
+
return 'GM';
|
|
1159
|
+
case CountryCode.GEO:
|
|
1160
|
+
return 'GE';
|
|
1161
|
+
case CountryCode.DEU:
|
|
1162
|
+
return 'DE';
|
|
1163
|
+
case CountryCode.GHA:
|
|
1164
|
+
return 'GH';
|
|
1165
|
+
case CountryCode.GIB:
|
|
1166
|
+
return 'GI';
|
|
1167
|
+
case CountryCode.GRC:
|
|
1168
|
+
return 'GR';
|
|
1169
|
+
case CountryCode.GRL:
|
|
1170
|
+
return 'GL';
|
|
1171
|
+
case CountryCode.GRD:
|
|
1172
|
+
return 'GD';
|
|
1173
|
+
case CountryCode.GLP:
|
|
1174
|
+
return 'GP';
|
|
1175
|
+
case CountryCode.GUM:
|
|
1176
|
+
return 'GU';
|
|
1177
|
+
case CountryCode.GTM:
|
|
1178
|
+
return 'GT';
|
|
1179
|
+
case CountryCode.GGY:
|
|
1180
|
+
return 'GG';
|
|
1181
|
+
case CountryCode.GIN:
|
|
1182
|
+
return 'GN';
|
|
1183
|
+
case CountryCode.GNB:
|
|
1184
|
+
return 'GW';
|
|
1185
|
+
case CountryCode.GUY:
|
|
1186
|
+
return 'GY';
|
|
1187
|
+
case CountryCode.HTI:
|
|
1188
|
+
return 'HT';
|
|
1189
|
+
case CountryCode.HMD:
|
|
1190
|
+
return 'HM';
|
|
1191
|
+
case CountryCode.VAT:
|
|
1192
|
+
return 'VA';
|
|
1193
|
+
case CountryCode.HND:
|
|
1194
|
+
return 'HN';
|
|
1195
|
+
case CountryCode.HKG:
|
|
1196
|
+
return 'HK';
|
|
1197
|
+
case CountryCode.HUN:
|
|
1198
|
+
return 'HU';
|
|
1199
|
+
case CountryCode.ISL:
|
|
1200
|
+
return 'IS';
|
|
1201
|
+
case CountryCode.IND:
|
|
1202
|
+
return 'IN';
|
|
1203
|
+
case CountryCode.IDN:
|
|
1204
|
+
return 'ID';
|
|
1205
|
+
case CountryCode.IRN:
|
|
1206
|
+
return 'IR';
|
|
1207
|
+
case CountryCode.IRQ:
|
|
1208
|
+
return 'IQ';
|
|
1209
|
+
case CountryCode.IRL:
|
|
1210
|
+
return 'IE';
|
|
1211
|
+
case CountryCode.IMN:
|
|
1212
|
+
return 'IM';
|
|
1213
|
+
case CountryCode.ISR:
|
|
1214
|
+
return 'IL';
|
|
1215
|
+
case CountryCode.ITA:
|
|
1216
|
+
return 'IT';
|
|
1217
|
+
case CountryCode.JAM:
|
|
1218
|
+
return 'JM';
|
|
1219
|
+
case CountryCode.JPN:
|
|
1220
|
+
return 'JP';
|
|
1221
|
+
case CountryCode.JEY:
|
|
1222
|
+
return 'JE';
|
|
1223
|
+
case CountryCode.JOR:
|
|
1224
|
+
return 'JO';
|
|
1225
|
+
case CountryCode.KAZ:
|
|
1226
|
+
return 'KZ';
|
|
1227
|
+
case CountryCode.KEN:
|
|
1228
|
+
return 'KE';
|
|
1229
|
+
case CountryCode.KIR:
|
|
1230
|
+
return 'KI';
|
|
1231
|
+
case CountryCode.PRK:
|
|
1232
|
+
return 'KP';
|
|
1233
|
+
case CountryCode.KOR:
|
|
1234
|
+
return 'KR';
|
|
1235
|
+
case CountryCode.KWT:
|
|
1236
|
+
return 'KW';
|
|
1237
|
+
case CountryCode.KGZ:
|
|
1238
|
+
return 'KG';
|
|
1239
|
+
case CountryCode.LAO:
|
|
1240
|
+
return 'LA';
|
|
1241
|
+
case CountryCode.LVA:
|
|
1242
|
+
return 'LV';
|
|
1243
|
+
case CountryCode.LBN:
|
|
1244
|
+
return 'LB';
|
|
1245
|
+
case CountryCode.LSO:
|
|
1246
|
+
return 'LS';
|
|
1247
|
+
case CountryCode.LBR:
|
|
1248
|
+
return 'LR';
|
|
1249
|
+
case CountryCode.LBY:
|
|
1250
|
+
return 'LY';
|
|
1251
|
+
case CountryCode.LIE:
|
|
1252
|
+
return 'LI';
|
|
1253
|
+
case CountryCode.LTU:
|
|
1254
|
+
return 'LT';
|
|
1255
|
+
case CountryCode.LUX:
|
|
1256
|
+
return 'LU';
|
|
1257
|
+
case CountryCode.MAC:
|
|
1258
|
+
return 'MO';
|
|
1259
|
+
case CountryCode.MDG:
|
|
1260
|
+
return 'MG';
|
|
1261
|
+
case CountryCode.MWI:
|
|
1262
|
+
return 'MW';
|
|
1263
|
+
case CountryCode.MYS:
|
|
1264
|
+
return 'MY';
|
|
1265
|
+
case CountryCode.MDV:
|
|
1266
|
+
return 'MV';
|
|
1267
|
+
case CountryCode.MLI:
|
|
1268
|
+
return 'ML';
|
|
1269
|
+
case CountryCode.MLT:
|
|
1270
|
+
return 'MT';
|
|
1271
|
+
case CountryCode.MHL:
|
|
1272
|
+
return 'MH';
|
|
1273
|
+
case CountryCode.MTQ:
|
|
1274
|
+
return 'MQ';
|
|
1275
|
+
case CountryCode.MRT:
|
|
1276
|
+
return 'MR';
|
|
1277
|
+
case CountryCode.MUS:
|
|
1278
|
+
return 'MU';
|
|
1279
|
+
case CountryCode.MYT:
|
|
1280
|
+
return 'YT';
|
|
1281
|
+
case CountryCode.MEX:
|
|
1282
|
+
return 'MX';
|
|
1283
|
+
case CountryCode.FSM:
|
|
1284
|
+
return 'FM';
|
|
1285
|
+
case CountryCode.MDA:
|
|
1286
|
+
return 'MD';
|
|
1287
|
+
case CountryCode.MCO:
|
|
1288
|
+
return 'MC';
|
|
1289
|
+
case CountryCode.MNG:
|
|
1290
|
+
return 'MN';
|
|
1291
|
+
case CountryCode.MNE:
|
|
1292
|
+
return 'ME';
|
|
1293
|
+
case CountryCode.MSR:
|
|
1294
|
+
return 'MS';
|
|
1295
|
+
case CountryCode.MAR:
|
|
1296
|
+
return 'MA';
|
|
1297
|
+
case CountryCode.MOZ:
|
|
1298
|
+
return 'MZ';
|
|
1299
|
+
case CountryCode.MMR:
|
|
1300
|
+
return 'MM';
|
|
1301
|
+
case CountryCode.NAM:
|
|
1302
|
+
return 'NA';
|
|
1303
|
+
case CountryCode.NRU:
|
|
1304
|
+
return 'NR';
|
|
1305
|
+
case CountryCode.NPL:
|
|
1306
|
+
return 'NP';
|
|
1307
|
+
case CountryCode.NLD:
|
|
1308
|
+
return 'NL';
|
|
1309
|
+
case CountryCode.NCL:
|
|
1310
|
+
return 'NC';
|
|
1311
|
+
case CountryCode.NZL:
|
|
1312
|
+
return 'NZ';
|
|
1313
|
+
case CountryCode.NIC:
|
|
1314
|
+
return 'NI';
|
|
1315
|
+
case CountryCode.NER:
|
|
1316
|
+
return 'NE';
|
|
1317
|
+
case CountryCode.NGA:
|
|
1318
|
+
return 'NG';
|
|
1319
|
+
case CountryCode.NIU:
|
|
1320
|
+
return 'NU';
|
|
1321
|
+
case CountryCode.NFK:
|
|
1322
|
+
return 'NF';
|
|
1323
|
+
case CountryCode.MNP:
|
|
1324
|
+
return 'MP';
|
|
1325
|
+
case CountryCode.NOR:
|
|
1326
|
+
return 'NO';
|
|
1327
|
+
case CountryCode.OMN:
|
|
1328
|
+
return 'OM';
|
|
1329
|
+
case CountryCode.PAK:
|
|
1330
|
+
return 'PK';
|
|
1331
|
+
case CountryCode.PLW:
|
|
1332
|
+
return 'PW';
|
|
1333
|
+
case CountryCode.PSE:
|
|
1334
|
+
return 'PS';
|
|
1335
|
+
case CountryCode.PAN:
|
|
1336
|
+
return 'PA';
|
|
1337
|
+
case CountryCode.PNG:
|
|
1338
|
+
return 'PG';
|
|
1339
|
+
case CountryCode.PRY:
|
|
1340
|
+
return 'PY';
|
|
1341
|
+
case CountryCode.PER:
|
|
1342
|
+
return 'PE';
|
|
1343
|
+
case CountryCode.PHL:
|
|
1344
|
+
return 'PH';
|
|
1345
|
+
case CountryCode.PCN:
|
|
1346
|
+
return 'PN';
|
|
1347
|
+
case CountryCode.POL:
|
|
1348
|
+
return 'PL';
|
|
1349
|
+
case CountryCode.PRT:
|
|
1350
|
+
return 'PT';
|
|
1351
|
+
case CountryCode.PRI:
|
|
1352
|
+
return 'PR';
|
|
1353
|
+
case CountryCode.QAT:
|
|
1354
|
+
return 'QA';
|
|
1355
|
+
case CountryCode.MKD:
|
|
1356
|
+
return 'MK';
|
|
1357
|
+
case CountryCode.ROU:
|
|
1358
|
+
return 'RO';
|
|
1359
|
+
case CountryCode.RUS:
|
|
1360
|
+
return 'RU';
|
|
1361
|
+
case CountryCode.RWA:
|
|
1362
|
+
return 'RW';
|
|
1363
|
+
case CountryCode.REU:
|
|
1364
|
+
return 'RE';
|
|
1365
|
+
case CountryCode.BLM:
|
|
1366
|
+
return 'BL';
|
|
1367
|
+
case CountryCode.SHN:
|
|
1368
|
+
return 'SH';
|
|
1369
|
+
case CountryCode.KNA:
|
|
1370
|
+
return 'KN';
|
|
1371
|
+
case CountryCode.LCA:
|
|
1372
|
+
return 'LC';
|
|
1373
|
+
case CountryCode.MAF:
|
|
1374
|
+
return 'MF';
|
|
1375
|
+
case CountryCode.SPM:
|
|
1376
|
+
return 'PM';
|
|
1377
|
+
case CountryCode.VCT:
|
|
1378
|
+
return 'VC';
|
|
1379
|
+
case CountryCode.WSM:
|
|
1380
|
+
return 'WS';
|
|
1381
|
+
case CountryCode.SMR:
|
|
1382
|
+
return 'SM';
|
|
1383
|
+
case CountryCode.STP:
|
|
1384
|
+
return 'ST';
|
|
1385
|
+
case CountryCode.SAU:
|
|
1386
|
+
return 'SA';
|
|
1387
|
+
case CountryCode.SEN:
|
|
1388
|
+
return 'SN';
|
|
1389
|
+
case CountryCode.SRB:
|
|
1390
|
+
return 'RS';
|
|
1391
|
+
case CountryCode.SYC:
|
|
1392
|
+
return 'SC';
|
|
1393
|
+
case CountryCode.SLE:
|
|
1394
|
+
return 'SL';
|
|
1395
|
+
case CountryCode.SGP:
|
|
1396
|
+
return 'SG';
|
|
1397
|
+
case CountryCode.SXM:
|
|
1398
|
+
return 'SX';
|
|
1399
|
+
case CountryCode.SVK:
|
|
1400
|
+
return 'SK';
|
|
1401
|
+
case CountryCode.SVN:
|
|
1402
|
+
return 'SI';
|
|
1403
|
+
case CountryCode.SLB:
|
|
1404
|
+
return 'SB';
|
|
1405
|
+
case CountryCode.SOM:
|
|
1406
|
+
return 'SO';
|
|
1407
|
+
case CountryCode.ZAF:
|
|
1408
|
+
return 'ZA';
|
|
1409
|
+
case CountryCode.SGS:
|
|
1410
|
+
return 'GS';
|
|
1411
|
+
case CountryCode.SSD:
|
|
1412
|
+
return 'SS';
|
|
1413
|
+
case CountryCode.ESP:
|
|
1414
|
+
return 'ES';
|
|
1415
|
+
case CountryCode.LKA:
|
|
1416
|
+
return 'LK';
|
|
1417
|
+
case CountryCode.SDN:
|
|
1418
|
+
return 'SD';
|
|
1419
|
+
case CountryCode.SUR:
|
|
1420
|
+
return 'SR';
|
|
1421
|
+
case CountryCode.SJM:
|
|
1422
|
+
return 'SJ';
|
|
1423
|
+
case CountryCode.SWE:
|
|
1424
|
+
return 'SE';
|
|
1425
|
+
case CountryCode.CHE:
|
|
1426
|
+
return 'CH';
|
|
1427
|
+
case CountryCode.SYR:
|
|
1428
|
+
return 'SY';
|
|
1429
|
+
case CountryCode.TWN:
|
|
1430
|
+
return 'TW';
|
|
1431
|
+
case CountryCode.TJK:
|
|
1432
|
+
return 'TJ';
|
|
1433
|
+
case CountryCode.TZA:
|
|
1434
|
+
return 'TZ';
|
|
1435
|
+
case CountryCode.THA:
|
|
1436
|
+
return 'TH';
|
|
1437
|
+
case CountryCode.TLS:
|
|
1438
|
+
return 'TL';
|
|
1439
|
+
case CountryCode.TGO:
|
|
1440
|
+
return 'TG';
|
|
1441
|
+
case CountryCode.TKL:
|
|
1442
|
+
return 'TK';
|
|
1443
|
+
case CountryCode.TON:
|
|
1444
|
+
return 'TO';
|
|
1445
|
+
case CountryCode.TTO:
|
|
1446
|
+
return 'TT';
|
|
1447
|
+
case CountryCode.TUN:
|
|
1448
|
+
return 'TN';
|
|
1449
|
+
case CountryCode.TUR:
|
|
1450
|
+
return 'TR';
|
|
1451
|
+
case CountryCode.TKM:
|
|
1452
|
+
return 'TM';
|
|
1453
|
+
case CountryCode.TCA:
|
|
1454
|
+
return 'TC';
|
|
1455
|
+
case CountryCode.TUV:
|
|
1456
|
+
return 'TV';
|
|
1457
|
+
case CountryCode.UGA:
|
|
1458
|
+
return 'UG';
|
|
1459
|
+
case CountryCode.UKR:
|
|
1460
|
+
return 'UA';
|
|
1461
|
+
case CountryCode.ARE:
|
|
1462
|
+
return 'AE';
|
|
1463
|
+
case CountryCode.GBR:
|
|
1464
|
+
return 'GB';
|
|
1465
|
+
case CountryCode.UMI:
|
|
1466
|
+
return 'UM';
|
|
1467
|
+
case CountryCode.USA:
|
|
1468
|
+
return 'US';
|
|
1469
|
+
case CountryCode.URY:
|
|
1470
|
+
return 'UY';
|
|
1471
|
+
case CountryCode.UZB:
|
|
1472
|
+
return 'UZ';
|
|
1473
|
+
case CountryCode.VUT:
|
|
1474
|
+
return 'VU';
|
|
1475
|
+
case CountryCode.VEN:
|
|
1476
|
+
return 'VE';
|
|
1477
|
+
case CountryCode.VNM:
|
|
1478
|
+
return 'VN';
|
|
1479
|
+
case CountryCode.VGB:
|
|
1480
|
+
return 'VG';
|
|
1481
|
+
case CountryCode.VIR:
|
|
1482
|
+
return 'VI';
|
|
1483
|
+
case CountryCode.WLF:
|
|
1484
|
+
return 'WF';
|
|
1485
|
+
case CountryCode.ESH:
|
|
1486
|
+
return 'EH';
|
|
1487
|
+
case CountryCode.YEM:
|
|
1488
|
+
return 'YE';
|
|
1489
|
+
case CountryCode.ZMB:
|
|
1490
|
+
return 'ZM';
|
|
1491
|
+
case CountryCode.ZWE:
|
|
1492
|
+
return 'ZW';
|
|
1493
|
+
default:
|
|
1494
|
+
throw new Error(`Unsupported country code: ${countryCode}`);
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
|
|
478
1498
|
export function greenInvoiceToDocumentStatus(greenInvoiceStatus: number): document_status {
|
|
479
1499
|
switch (greenInvoiceStatus) {
|
|
480
1500
|
case 0:
|
|
@@ -505,7 +1525,7 @@ export async function getLinkedDocuments(
|
|
|
505
1525
|
|
|
506
1526
|
const linkedDocuments = greenInvoiceDocument.linkedDocuments.filter(
|
|
507
1527
|
Boolean,
|
|
508
|
-
) as
|
|
1528
|
+
) as _DOLLAR_defs_DocumentLinkedDocument[];
|
|
509
1529
|
if (!linkedDocuments.length) {
|
|
510
1530
|
return null;
|
|
511
1531
|
}
|
|
@@ -532,7 +1552,7 @@ export async function getLinkedDocuments(
|
|
|
532
1552
|
|
|
533
1553
|
export async function insertNewDocumentFromGreenInvoice(
|
|
534
1554
|
injector: Injector,
|
|
535
|
-
greenInvoiceDoc:
|
|
1555
|
+
greenInvoiceDoc: _DOLLAR_defs_Document,
|
|
536
1556
|
ownerId: string,
|
|
537
1557
|
preDictatedChargeId?: string | null,
|
|
538
1558
|
) {
|
|
@@ -546,9 +1566,11 @@ export async function insertNewDocumentFromGreenInvoice(
|
|
|
546
1566
|
.uploadInvoiceToCloudinary(greenInvoiceDoc.url.origin);
|
|
547
1567
|
|
|
548
1568
|
// Get matching business
|
|
549
|
-
const clientPromise =
|
|
550
|
-
|
|
551
|
-
|
|
1569
|
+
const clientPromise = greenInvoiceDoc.client.id
|
|
1570
|
+
? injector
|
|
1571
|
+
.get(ClientsProvider)
|
|
1572
|
+
.getClientByGreenInvoiceIdLoader.load(greenInvoiceDoc.client.id)
|
|
1573
|
+
: Promise.resolve(null);
|
|
552
1574
|
|
|
553
1575
|
const linkedDocumentsPromise = getLinkedDocuments(injector, greenInvoiceDoc.id);
|
|
554
1576
|
|
|
@@ -673,7 +1695,7 @@ export async function insertNewDocumentFromGreenInvoice(
|
|
|
673
1695
|
}
|
|
674
1696
|
|
|
675
1697
|
export async function getGreenInvoiceDocuments(injector: Injector, recursive: boolean = false) {
|
|
676
|
-
const documents:
|
|
1698
|
+
const documents: _DOLLAR_defs_Document[] = [];
|
|
677
1699
|
async function getDocuments(page: number = 1) {
|
|
678
1700
|
const data = await injector.get(GreenInvoiceClientProvider).searchDocuments({
|
|
679
1701
|
input: { pageSize: 100, sort: 'creationDate', page },
|
|
@@ -704,8 +1726,8 @@ export async function getGreenInvoiceDocuments(injector: Injector, recursive: bo
|
|
|
704
1726
|
export async function convertDocumentInputIntoGreenInvoiceInput(
|
|
705
1727
|
initialInput: NewDocumentInput,
|
|
706
1728
|
injector: Injector,
|
|
707
|
-
): Promise<
|
|
708
|
-
let client:
|
|
1729
|
+
): Promise<_DOLLAR_defs_DocumentInputNew_Input> {
|
|
1730
|
+
let client: _DOLLAR_defs_addDocumentRequest_Input['client'] | undefined = undefined;
|
|
709
1731
|
if (initialInput.client) {
|
|
710
1732
|
const clientInfo = await injector
|
|
711
1733
|
.get(ClientsProvider)
|
|
@@ -785,13 +1807,14 @@ export async function convertDocumentInputIntoGreenInvoiceInput(
|
|
|
785
1807
|
}
|
|
786
1808
|
|
|
787
1809
|
export function convertGreenInvoiceDocumentToLocalDocumentInfo(
|
|
788
|
-
greenInvoiceDocument:
|
|
1810
|
+
greenInvoiceDocument: _DOLLAR_defs_Document,
|
|
789
1811
|
): NewDocumentInfo {
|
|
790
1812
|
return {
|
|
791
1813
|
...greenInvoiceDocument,
|
|
792
|
-
client: greenInvoiceDocument.client
|
|
1814
|
+
client: greenInvoiceDocument.client?.id
|
|
793
1815
|
? {
|
|
794
1816
|
...greenInvoiceDocument.client,
|
|
1817
|
+
id: greenInvoiceDocument.client.id,
|
|
795
1818
|
emails: greenInvoiceDocument.client.emails
|
|
796
1819
|
? (greenInvoiceDocument.client.emails.filter(Boolean) as string[])
|
|
797
1820
|
: [],
|