@accounter/server 0.0.8-alpha-20251102090006-19af6733a3520f285296a817bc4c06801e8a37b4 → 0.0.8-alpha-20251102162123-4116da86b4346a2ba1598da87dfbed6dff5b3393
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 +1454 -1201
- 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 +194 -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 +2 -2
- 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 +241 -0
- package/src/modules/green-invoice/helpers/green-invoice.helper.ts +1068 -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,1020 @@ 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(
|
|
988
|
+
`GreenInvoiceCountry 'XK' (Kosovo) is not supported for conversion to CountryCode`,
|
|
989
|
+
);
|
|
990
|
+
default:
|
|
991
|
+
throw new Error(`Unsupported Green Invoice country: ${country}`);
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
export function countryCodeToGreenInvoiceCountry(countryCode: CountryCode): GreenInvoiceCountry {
|
|
996
|
+
switch (countryCode) {
|
|
997
|
+
case CountryCode.AFG:
|
|
998
|
+
return 'AF';
|
|
999
|
+
case CountryCode.ALA:
|
|
1000
|
+
return 'AX';
|
|
1001
|
+
case CountryCode.ALB:
|
|
1002
|
+
return 'AL';
|
|
1003
|
+
case CountryCode.DZA:
|
|
1004
|
+
return 'DZ';
|
|
1005
|
+
case CountryCode.ASM:
|
|
1006
|
+
return 'AS';
|
|
1007
|
+
case CountryCode.AND:
|
|
1008
|
+
return 'AD';
|
|
1009
|
+
case CountryCode.AGO:
|
|
1010
|
+
return 'AO';
|
|
1011
|
+
case CountryCode.AIA:
|
|
1012
|
+
return 'AI';
|
|
1013
|
+
case CountryCode.ATA:
|
|
1014
|
+
return 'AQ';
|
|
1015
|
+
case CountryCode.ATG:
|
|
1016
|
+
return 'AG';
|
|
1017
|
+
case CountryCode.ARG:
|
|
1018
|
+
return 'AR';
|
|
1019
|
+
case CountryCode.ARM:
|
|
1020
|
+
return 'AM';
|
|
1021
|
+
case CountryCode.ABW:
|
|
1022
|
+
return 'AW';
|
|
1023
|
+
case CountryCode.AUS:
|
|
1024
|
+
return 'AU';
|
|
1025
|
+
case CountryCode.AUT:
|
|
1026
|
+
return 'AT';
|
|
1027
|
+
case CountryCode.AZE:
|
|
1028
|
+
return 'AZ';
|
|
1029
|
+
case CountryCode.BHS:
|
|
1030
|
+
return 'BS';
|
|
1031
|
+
case CountryCode.BHR:
|
|
1032
|
+
return 'BH';
|
|
1033
|
+
case CountryCode.BGD:
|
|
1034
|
+
return 'BD';
|
|
1035
|
+
case CountryCode.BRB:
|
|
1036
|
+
return 'BB';
|
|
1037
|
+
case CountryCode.BLR:
|
|
1038
|
+
return 'BY';
|
|
1039
|
+
case CountryCode.BEL:
|
|
1040
|
+
return 'BE';
|
|
1041
|
+
case CountryCode.BLZ:
|
|
1042
|
+
return 'BZ';
|
|
1043
|
+
case CountryCode.BEN:
|
|
1044
|
+
return 'BJ';
|
|
1045
|
+
case CountryCode.BMU:
|
|
1046
|
+
return 'BM';
|
|
1047
|
+
case CountryCode.BTN:
|
|
1048
|
+
return 'BT';
|
|
1049
|
+
case CountryCode.BOL:
|
|
1050
|
+
return 'BO';
|
|
1051
|
+
case CountryCode.BES:
|
|
1052
|
+
return 'BQ';
|
|
1053
|
+
case CountryCode.BIH:
|
|
1054
|
+
return 'BA';
|
|
1055
|
+
case CountryCode.BWA:
|
|
1056
|
+
return 'BW';
|
|
1057
|
+
case CountryCode.BVT:
|
|
1058
|
+
return 'BV';
|
|
1059
|
+
case CountryCode.BRA:
|
|
1060
|
+
return 'BR';
|
|
1061
|
+
case CountryCode.IOT:
|
|
1062
|
+
return 'IO';
|
|
1063
|
+
case CountryCode.BRN:
|
|
1064
|
+
return 'BN';
|
|
1065
|
+
case CountryCode.BGR:
|
|
1066
|
+
return 'BG';
|
|
1067
|
+
case CountryCode.BFA:
|
|
1068
|
+
return 'BF';
|
|
1069
|
+
case CountryCode.BDI:
|
|
1070
|
+
return 'BI';
|
|
1071
|
+
case CountryCode.CPV:
|
|
1072
|
+
return 'CV';
|
|
1073
|
+
case CountryCode.KHM:
|
|
1074
|
+
return 'KH';
|
|
1075
|
+
case CountryCode.CMR:
|
|
1076
|
+
return 'CM';
|
|
1077
|
+
case CountryCode.CAN:
|
|
1078
|
+
return 'CA';
|
|
1079
|
+
case CountryCode.CYM:
|
|
1080
|
+
return 'KY';
|
|
1081
|
+
case CountryCode.CAF:
|
|
1082
|
+
return 'CF';
|
|
1083
|
+
case CountryCode.TCD:
|
|
1084
|
+
return 'TD';
|
|
1085
|
+
case CountryCode.CHL:
|
|
1086
|
+
return 'CL';
|
|
1087
|
+
case CountryCode.CHN:
|
|
1088
|
+
return 'CN';
|
|
1089
|
+
case CountryCode.CXR:
|
|
1090
|
+
return 'CX';
|
|
1091
|
+
case CountryCode.CCK:
|
|
1092
|
+
return 'CC';
|
|
1093
|
+
case CountryCode.COL:
|
|
1094
|
+
return 'CO';
|
|
1095
|
+
case CountryCode.COM:
|
|
1096
|
+
return 'KM';
|
|
1097
|
+
case CountryCode.COD:
|
|
1098
|
+
return 'CD';
|
|
1099
|
+
case CountryCode.COG:
|
|
1100
|
+
return 'CG';
|
|
1101
|
+
case CountryCode.COK:
|
|
1102
|
+
return 'CK';
|
|
1103
|
+
case CountryCode.CRI:
|
|
1104
|
+
return 'CR';
|
|
1105
|
+
case CountryCode.HRV:
|
|
1106
|
+
return 'HR';
|
|
1107
|
+
case CountryCode.CUB:
|
|
1108
|
+
return 'CU';
|
|
1109
|
+
case CountryCode.CUW:
|
|
1110
|
+
return 'CW';
|
|
1111
|
+
case CountryCode.CYP:
|
|
1112
|
+
return 'CY';
|
|
1113
|
+
case CountryCode.CZE:
|
|
1114
|
+
return 'CZ';
|
|
1115
|
+
case CountryCode.CIV:
|
|
1116
|
+
return 'CI';
|
|
1117
|
+
case CountryCode.DNK:
|
|
1118
|
+
return 'DK';
|
|
1119
|
+
case CountryCode.DJI:
|
|
1120
|
+
return 'DJ';
|
|
1121
|
+
case CountryCode.DMA:
|
|
1122
|
+
return 'DM';
|
|
1123
|
+
case CountryCode.DOM:
|
|
1124
|
+
return 'DO';
|
|
1125
|
+
case CountryCode.ECU:
|
|
1126
|
+
return 'EC';
|
|
1127
|
+
case CountryCode.EGY:
|
|
1128
|
+
return 'EG';
|
|
1129
|
+
case CountryCode.SLV:
|
|
1130
|
+
return 'SV';
|
|
1131
|
+
case CountryCode.GNQ:
|
|
1132
|
+
return 'GQ';
|
|
1133
|
+
case CountryCode.ERI:
|
|
1134
|
+
return 'ER';
|
|
1135
|
+
case CountryCode.EST:
|
|
1136
|
+
return 'EE';
|
|
1137
|
+
case CountryCode.SWZ:
|
|
1138
|
+
return 'SZ';
|
|
1139
|
+
case CountryCode.ETH:
|
|
1140
|
+
return 'ET';
|
|
1141
|
+
case CountryCode.FLK:
|
|
1142
|
+
return 'FK';
|
|
1143
|
+
case CountryCode.FRO:
|
|
1144
|
+
return 'FO';
|
|
1145
|
+
case CountryCode.FJI:
|
|
1146
|
+
return 'FJ';
|
|
1147
|
+
case CountryCode.FIN:
|
|
1148
|
+
return 'FI';
|
|
1149
|
+
case CountryCode.FRA:
|
|
1150
|
+
return 'FR';
|
|
1151
|
+
case CountryCode.GUF:
|
|
1152
|
+
return 'GF';
|
|
1153
|
+
case CountryCode.PYF:
|
|
1154
|
+
return 'PF';
|
|
1155
|
+
case CountryCode.ATF:
|
|
1156
|
+
return 'TF';
|
|
1157
|
+
case CountryCode.GAB:
|
|
1158
|
+
return 'GA';
|
|
1159
|
+
case CountryCode.GMB:
|
|
1160
|
+
return 'GM';
|
|
1161
|
+
case CountryCode.GEO:
|
|
1162
|
+
return 'GE';
|
|
1163
|
+
case CountryCode.DEU:
|
|
1164
|
+
return 'DE';
|
|
1165
|
+
case CountryCode.GHA:
|
|
1166
|
+
return 'GH';
|
|
1167
|
+
case CountryCode.GIB:
|
|
1168
|
+
return 'GI';
|
|
1169
|
+
case CountryCode.GRC:
|
|
1170
|
+
return 'GR';
|
|
1171
|
+
case CountryCode.GRL:
|
|
1172
|
+
return 'GL';
|
|
1173
|
+
case CountryCode.GRD:
|
|
1174
|
+
return 'GD';
|
|
1175
|
+
case CountryCode.GLP:
|
|
1176
|
+
return 'GP';
|
|
1177
|
+
case CountryCode.GUM:
|
|
1178
|
+
return 'GU';
|
|
1179
|
+
case CountryCode.GTM:
|
|
1180
|
+
return 'GT';
|
|
1181
|
+
case CountryCode.GGY:
|
|
1182
|
+
return 'GG';
|
|
1183
|
+
case CountryCode.GIN:
|
|
1184
|
+
return 'GN';
|
|
1185
|
+
case CountryCode.GNB:
|
|
1186
|
+
return 'GW';
|
|
1187
|
+
case CountryCode.GUY:
|
|
1188
|
+
return 'GY';
|
|
1189
|
+
case CountryCode.HTI:
|
|
1190
|
+
return 'HT';
|
|
1191
|
+
case CountryCode.HMD:
|
|
1192
|
+
return 'HM';
|
|
1193
|
+
case CountryCode.VAT:
|
|
1194
|
+
return 'VA';
|
|
1195
|
+
case CountryCode.HND:
|
|
1196
|
+
return 'HN';
|
|
1197
|
+
case CountryCode.HKG:
|
|
1198
|
+
return 'HK';
|
|
1199
|
+
case CountryCode.HUN:
|
|
1200
|
+
return 'HU';
|
|
1201
|
+
case CountryCode.ISL:
|
|
1202
|
+
return 'IS';
|
|
1203
|
+
case CountryCode.IND:
|
|
1204
|
+
return 'IN';
|
|
1205
|
+
case CountryCode.IDN:
|
|
1206
|
+
return 'ID';
|
|
1207
|
+
case CountryCode.IRN:
|
|
1208
|
+
return 'IR';
|
|
1209
|
+
case CountryCode.IRQ:
|
|
1210
|
+
return 'IQ';
|
|
1211
|
+
case CountryCode.IRL:
|
|
1212
|
+
return 'IE';
|
|
1213
|
+
case CountryCode.IMN:
|
|
1214
|
+
return 'IM';
|
|
1215
|
+
case CountryCode.ISR:
|
|
1216
|
+
return 'IL';
|
|
1217
|
+
case CountryCode.ITA:
|
|
1218
|
+
return 'IT';
|
|
1219
|
+
case CountryCode.JAM:
|
|
1220
|
+
return 'JM';
|
|
1221
|
+
case CountryCode.JPN:
|
|
1222
|
+
return 'JP';
|
|
1223
|
+
case CountryCode.JEY:
|
|
1224
|
+
return 'JE';
|
|
1225
|
+
case CountryCode.JOR:
|
|
1226
|
+
return 'JO';
|
|
1227
|
+
case CountryCode.KAZ:
|
|
1228
|
+
return 'KZ';
|
|
1229
|
+
case CountryCode.KEN:
|
|
1230
|
+
return 'KE';
|
|
1231
|
+
case CountryCode.KIR:
|
|
1232
|
+
return 'KI';
|
|
1233
|
+
case CountryCode.PRK:
|
|
1234
|
+
return 'KP';
|
|
1235
|
+
case CountryCode.KOR:
|
|
1236
|
+
return 'KR';
|
|
1237
|
+
case CountryCode.KWT:
|
|
1238
|
+
return 'KW';
|
|
1239
|
+
case CountryCode.KGZ:
|
|
1240
|
+
return 'KG';
|
|
1241
|
+
case CountryCode.LAO:
|
|
1242
|
+
return 'LA';
|
|
1243
|
+
case CountryCode.LVA:
|
|
1244
|
+
return 'LV';
|
|
1245
|
+
case CountryCode.LBN:
|
|
1246
|
+
return 'LB';
|
|
1247
|
+
case CountryCode.LSO:
|
|
1248
|
+
return 'LS';
|
|
1249
|
+
case CountryCode.LBR:
|
|
1250
|
+
return 'LR';
|
|
1251
|
+
case CountryCode.LBY:
|
|
1252
|
+
return 'LY';
|
|
1253
|
+
case CountryCode.LIE:
|
|
1254
|
+
return 'LI';
|
|
1255
|
+
case CountryCode.LTU:
|
|
1256
|
+
return 'LT';
|
|
1257
|
+
case CountryCode.LUX:
|
|
1258
|
+
return 'LU';
|
|
1259
|
+
case CountryCode.MAC:
|
|
1260
|
+
return 'MO';
|
|
1261
|
+
case CountryCode.MDG:
|
|
1262
|
+
return 'MG';
|
|
1263
|
+
case CountryCode.MWI:
|
|
1264
|
+
return 'MW';
|
|
1265
|
+
case CountryCode.MYS:
|
|
1266
|
+
return 'MY';
|
|
1267
|
+
case CountryCode.MDV:
|
|
1268
|
+
return 'MV';
|
|
1269
|
+
case CountryCode.MLI:
|
|
1270
|
+
return 'ML';
|
|
1271
|
+
case CountryCode.MLT:
|
|
1272
|
+
return 'MT';
|
|
1273
|
+
case CountryCode.MHL:
|
|
1274
|
+
return 'MH';
|
|
1275
|
+
case CountryCode.MTQ:
|
|
1276
|
+
return 'MQ';
|
|
1277
|
+
case CountryCode.MRT:
|
|
1278
|
+
return 'MR';
|
|
1279
|
+
case CountryCode.MUS:
|
|
1280
|
+
return 'MU';
|
|
1281
|
+
case CountryCode.MYT:
|
|
1282
|
+
return 'YT';
|
|
1283
|
+
case CountryCode.MEX:
|
|
1284
|
+
return 'MX';
|
|
1285
|
+
case CountryCode.FSM:
|
|
1286
|
+
return 'FM';
|
|
1287
|
+
case CountryCode.MDA:
|
|
1288
|
+
return 'MD';
|
|
1289
|
+
case CountryCode.MCO:
|
|
1290
|
+
return 'MC';
|
|
1291
|
+
case CountryCode.MNG:
|
|
1292
|
+
return 'MN';
|
|
1293
|
+
case CountryCode.MNE:
|
|
1294
|
+
return 'ME';
|
|
1295
|
+
case CountryCode.MSR:
|
|
1296
|
+
return 'MS';
|
|
1297
|
+
case CountryCode.MAR:
|
|
1298
|
+
return 'MA';
|
|
1299
|
+
case CountryCode.MOZ:
|
|
1300
|
+
return 'MZ';
|
|
1301
|
+
case CountryCode.MMR:
|
|
1302
|
+
return 'MM';
|
|
1303
|
+
case CountryCode.NAM:
|
|
1304
|
+
return 'NA';
|
|
1305
|
+
case CountryCode.NRU:
|
|
1306
|
+
return 'NR';
|
|
1307
|
+
case CountryCode.NPL:
|
|
1308
|
+
return 'NP';
|
|
1309
|
+
case CountryCode.NLD:
|
|
1310
|
+
return 'NL';
|
|
1311
|
+
case CountryCode.NCL:
|
|
1312
|
+
return 'NC';
|
|
1313
|
+
case CountryCode.NZL:
|
|
1314
|
+
return 'NZ';
|
|
1315
|
+
case CountryCode.NIC:
|
|
1316
|
+
return 'NI';
|
|
1317
|
+
case CountryCode.NER:
|
|
1318
|
+
return 'NE';
|
|
1319
|
+
case CountryCode.NGA:
|
|
1320
|
+
return 'NG';
|
|
1321
|
+
case CountryCode.NIU:
|
|
1322
|
+
return 'NU';
|
|
1323
|
+
case CountryCode.NFK:
|
|
1324
|
+
return 'NF';
|
|
1325
|
+
case CountryCode.MNP:
|
|
1326
|
+
return 'MP';
|
|
1327
|
+
case CountryCode.NOR:
|
|
1328
|
+
return 'NO';
|
|
1329
|
+
case CountryCode.OMN:
|
|
1330
|
+
return 'OM';
|
|
1331
|
+
case CountryCode.PAK:
|
|
1332
|
+
return 'PK';
|
|
1333
|
+
case CountryCode.PLW:
|
|
1334
|
+
return 'PW';
|
|
1335
|
+
case CountryCode.PSE:
|
|
1336
|
+
return 'PS';
|
|
1337
|
+
case CountryCode.PAN:
|
|
1338
|
+
return 'PA';
|
|
1339
|
+
case CountryCode.PNG:
|
|
1340
|
+
return 'PG';
|
|
1341
|
+
case CountryCode.PRY:
|
|
1342
|
+
return 'PY';
|
|
1343
|
+
case CountryCode.PER:
|
|
1344
|
+
return 'PE';
|
|
1345
|
+
case CountryCode.PHL:
|
|
1346
|
+
return 'PH';
|
|
1347
|
+
case CountryCode.PCN:
|
|
1348
|
+
return 'PN';
|
|
1349
|
+
case CountryCode.POL:
|
|
1350
|
+
return 'PL';
|
|
1351
|
+
case CountryCode.PRT:
|
|
1352
|
+
return 'PT';
|
|
1353
|
+
case CountryCode.PRI:
|
|
1354
|
+
return 'PR';
|
|
1355
|
+
case CountryCode.QAT:
|
|
1356
|
+
return 'QA';
|
|
1357
|
+
case CountryCode.MKD:
|
|
1358
|
+
return 'MK';
|
|
1359
|
+
case CountryCode.ROU:
|
|
1360
|
+
return 'RO';
|
|
1361
|
+
case CountryCode.RUS:
|
|
1362
|
+
return 'RU';
|
|
1363
|
+
case CountryCode.RWA:
|
|
1364
|
+
return 'RW';
|
|
1365
|
+
case CountryCode.REU:
|
|
1366
|
+
return 'RE';
|
|
1367
|
+
case CountryCode.BLM:
|
|
1368
|
+
return 'BL';
|
|
1369
|
+
case CountryCode.SHN:
|
|
1370
|
+
return 'SH';
|
|
1371
|
+
case CountryCode.KNA:
|
|
1372
|
+
return 'KN';
|
|
1373
|
+
case CountryCode.LCA:
|
|
1374
|
+
return 'LC';
|
|
1375
|
+
case CountryCode.MAF:
|
|
1376
|
+
return 'MF';
|
|
1377
|
+
case CountryCode.SPM:
|
|
1378
|
+
return 'PM';
|
|
1379
|
+
case CountryCode.VCT:
|
|
1380
|
+
return 'VC';
|
|
1381
|
+
case CountryCode.WSM:
|
|
1382
|
+
return 'WS';
|
|
1383
|
+
case CountryCode.SMR:
|
|
1384
|
+
return 'SM';
|
|
1385
|
+
case CountryCode.STP:
|
|
1386
|
+
return 'ST';
|
|
1387
|
+
case CountryCode.SAU:
|
|
1388
|
+
return 'SA';
|
|
1389
|
+
case CountryCode.SEN:
|
|
1390
|
+
return 'SN';
|
|
1391
|
+
case CountryCode.SRB:
|
|
1392
|
+
return 'RS';
|
|
1393
|
+
case CountryCode.SYC:
|
|
1394
|
+
return 'SC';
|
|
1395
|
+
case CountryCode.SLE:
|
|
1396
|
+
return 'SL';
|
|
1397
|
+
case CountryCode.SGP:
|
|
1398
|
+
return 'SG';
|
|
1399
|
+
case CountryCode.SXM:
|
|
1400
|
+
return 'SX';
|
|
1401
|
+
case CountryCode.SVK:
|
|
1402
|
+
return 'SK';
|
|
1403
|
+
case CountryCode.SVN:
|
|
1404
|
+
return 'SI';
|
|
1405
|
+
case CountryCode.SLB:
|
|
1406
|
+
return 'SB';
|
|
1407
|
+
case CountryCode.SOM:
|
|
1408
|
+
return 'SO';
|
|
1409
|
+
case CountryCode.ZAF:
|
|
1410
|
+
return 'ZA';
|
|
1411
|
+
case CountryCode.SGS:
|
|
1412
|
+
return 'GS';
|
|
1413
|
+
case CountryCode.SSD:
|
|
1414
|
+
return 'SS';
|
|
1415
|
+
case CountryCode.ESP:
|
|
1416
|
+
return 'ES';
|
|
1417
|
+
case CountryCode.LKA:
|
|
1418
|
+
return 'LK';
|
|
1419
|
+
case CountryCode.SDN:
|
|
1420
|
+
return 'SD';
|
|
1421
|
+
case CountryCode.SUR:
|
|
1422
|
+
return 'SR';
|
|
1423
|
+
case CountryCode.SJM:
|
|
1424
|
+
return 'SJ';
|
|
1425
|
+
case CountryCode.SWE:
|
|
1426
|
+
return 'SE';
|
|
1427
|
+
case CountryCode.CHE:
|
|
1428
|
+
return 'CH';
|
|
1429
|
+
case CountryCode.SYR:
|
|
1430
|
+
return 'SY';
|
|
1431
|
+
case CountryCode.TWN:
|
|
1432
|
+
return 'TW';
|
|
1433
|
+
case CountryCode.TJK:
|
|
1434
|
+
return 'TJ';
|
|
1435
|
+
case CountryCode.TZA:
|
|
1436
|
+
return 'TZ';
|
|
1437
|
+
case CountryCode.THA:
|
|
1438
|
+
return 'TH';
|
|
1439
|
+
case CountryCode.TLS:
|
|
1440
|
+
return 'TL';
|
|
1441
|
+
case CountryCode.TGO:
|
|
1442
|
+
return 'TG';
|
|
1443
|
+
case CountryCode.TKL:
|
|
1444
|
+
return 'TK';
|
|
1445
|
+
case CountryCode.TON:
|
|
1446
|
+
return 'TO';
|
|
1447
|
+
case CountryCode.TTO:
|
|
1448
|
+
return 'TT';
|
|
1449
|
+
case CountryCode.TUN:
|
|
1450
|
+
return 'TN';
|
|
1451
|
+
case CountryCode.TUR:
|
|
1452
|
+
return 'TR';
|
|
1453
|
+
case CountryCode.TKM:
|
|
1454
|
+
return 'TM';
|
|
1455
|
+
case CountryCode.TCA:
|
|
1456
|
+
return 'TC';
|
|
1457
|
+
case CountryCode.TUV:
|
|
1458
|
+
return 'TV';
|
|
1459
|
+
case CountryCode.UGA:
|
|
1460
|
+
return 'UG';
|
|
1461
|
+
case CountryCode.UKR:
|
|
1462
|
+
return 'UA';
|
|
1463
|
+
case CountryCode.ARE:
|
|
1464
|
+
return 'AE';
|
|
1465
|
+
case CountryCode.GBR:
|
|
1466
|
+
return 'GB';
|
|
1467
|
+
case CountryCode.UMI:
|
|
1468
|
+
return 'UM';
|
|
1469
|
+
case CountryCode.USA:
|
|
1470
|
+
return 'US';
|
|
1471
|
+
case CountryCode.URY:
|
|
1472
|
+
return 'UY';
|
|
1473
|
+
case CountryCode.UZB:
|
|
1474
|
+
return 'UZ';
|
|
1475
|
+
case CountryCode.VUT:
|
|
1476
|
+
return 'VU';
|
|
1477
|
+
case CountryCode.VEN:
|
|
1478
|
+
return 'VE';
|
|
1479
|
+
case CountryCode.VNM:
|
|
1480
|
+
return 'VN';
|
|
1481
|
+
case CountryCode.VGB:
|
|
1482
|
+
return 'VG';
|
|
1483
|
+
case CountryCode.VIR:
|
|
1484
|
+
return 'VI';
|
|
1485
|
+
case CountryCode.WLF:
|
|
1486
|
+
return 'WF';
|
|
1487
|
+
case CountryCode.ESH:
|
|
1488
|
+
return 'EH';
|
|
1489
|
+
case CountryCode.YEM:
|
|
1490
|
+
return 'YE';
|
|
1491
|
+
case CountryCode.ZMB:
|
|
1492
|
+
return 'ZM';
|
|
1493
|
+
case CountryCode.ZWE:
|
|
1494
|
+
return 'ZW';
|
|
1495
|
+
default:
|
|
1496
|
+
throw new Error(`Unsupported country code: ${countryCode}`);
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
|
|
478
1500
|
export function greenInvoiceToDocumentStatus(greenInvoiceStatus: number): document_status {
|
|
479
1501
|
switch (greenInvoiceStatus) {
|
|
480
1502
|
case 0:
|
|
@@ -505,7 +1527,7 @@ export async function getLinkedDocuments(
|
|
|
505
1527
|
|
|
506
1528
|
const linkedDocuments = greenInvoiceDocument.linkedDocuments.filter(
|
|
507
1529
|
Boolean,
|
|
508
|
-
) as
|
|
1530
|
+
) as _DOLLAR_defs_DocumentLinkedDocument[];
|
|
509
1531
|
if (!linkedDocuments.length) {
|
|
510
1532
|
return null;
|
|
511
1533
|
}
|
|
@@ -532,7 +1554,7 @@ export async function getLinkedDocuments(
|
|
|
532
1554
|
|
|
533
1555
|
export async function insertNewDocumentFromGreenInvoice(
|
|
534
1556
|
injector: Injector,
|
|
535
|
-
greenInvoiceDoc:
|
|
1557
|
+
greenInvoiceDoc: _DOLLAR_defs_Document,
|
|
536
1558
|
ownerId: string,
|
|
537
1559
|
preDictatedChargeId?: string | null,
|
|
538
1560
|
) {
|
|
@@ -546,9 +1568,11 @@ export async function insertNewDocumentFromGreenInvoice(
|
|
|
546
1568
|
.uploadInvoiceToCloudinary(greenInvoiceDoc.url.origin);
|
|
547
1569
|
|
|
548
1570
|
// Get matching business
|
|
549
|
-
const clientPromise =
|
|
550
|
-
|
|
551
|
-
|
|
1571
|
+
const clientPromise = greenInvoiceDoc.client.id
|
|
1572
|
+
? injector
|
|
1573
|
+
.get(ClientsProvider)
|
|
1574
|
+
.getClientByGreenInvoiceIdLoader.load(greenInvoiceDoc.client.id)
|
|
1575
|
+
: Promise.resolve(null);
|
|
552
1576
|
|
|
553
1577
|
const linkedDocumentsPromise = getLinkedDocuments(injector, greenInvoiceDoc.id);
|
|
554
1578
|
|
|
@@ -673,7 +1697,7 @@ export async function insertNewDocumentFromGreenInvoice(
|
|
|
673
1697
|
}
|
|
674
1698
|
|
|
675
1699
|
export async function getGreenInvoiceDocuments(injector: Injector, recursive: boolean = false) {
|
|
676
|
-
const documents:
|
|
1700
|
+
const documents: _DOLLAR_defs_Document[] = [];
|
|
677
1701
|
async function getDocuments(page: number = 1) {
|
|
678
1702
|
const data = await injector.get(GreenInvoiceClientProvider).searchDocuments({
|
|
679
1703
|
input: { pageSize: 100, sort: 'creationDate', page },
|
|
@@ -704,8 +1728,8 @@ export async function getGreenInvoiceDocuments(injector: Injector, recursive: bo
|
|
|
704
1728
|
export async function convertDocumentInputIntoGreenInvoiceInput(
|
|
705
1729
|
initialInput: NewDocumentInput,
|
|
706
1730
|
injector: Injector,
|
|
707
|
-
): Promise<
|
|
708
|
-
let client:
|
|
1731
|
+
): Promise<_DOLLAR_defs_DocumentInputNew_Input> {
|
|
1732
|
+
let client: _DOLLAR_defs_addDocumentRequest_Input['client'] | undefined = undefined;
|
|
709
1733
|
if (initialInput.client) {
|
|
710
1734
|
const clientInfo = await injector
|
|
711
1735
|
.get(ClientsProvider)
|
|
@@ -785,13 +1809,14 @@ export async function convertDocumentInputIntoGreenInvoiceInput(
|
|
|
785
1809
|
}
|
|
786
1810
|
|
|
787
1811
|
export function convertGreenInvoiceDocumentToLocalDocumentInfo(
|
|
788
|
-
greenInvoiceDocument:
|
|
1812
|
+
greenInvoiceDocument: _DOLLAR_defs_Document,
|
|
789
1813
|
): NewDocumentInfo {
|
|
790
1814
|
return {
|
|
791
1815
|
...greenInvoiceDocument,
|
|
792
|
-
client: greenInvoiceDocument.client
|
|
1816
|
+
client: greenInvoiceDocument.client?.id
|
|
793
1817
|
? {
|
|
794
1818
|
...greenInvoiceDocument.client,
|
|
1819
|
+
id: greenInvoiceDocument.client.id,
|
|
795
1820
|
emails: greenInvoiceDocument.client.emails
|
|
796
1821
|
? (greenInvoiceDocument.client.emails.filter(Boolean) as string[])
|
|
797
1822
|
: [],
|