@accounter/server 0.0.8-alpha-20251104120008-7c1d79bd7d8d67caed9e03a81f242f34b4150dc9 → 0.0.8-alpha-20251104121745-09978d2ad86ebda43146e8c911b6c5c7a8ea700d

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.
@@ -484,1016 +484,527 @@ export function convertCurrencyToGreenInvoice(currency: Currency): GreenInvoiceC
484
484
  }
485
485
 
486
486
  export function greenInvoiceCountryToCountryCode(country: GreenInvoiceCountry): CountryCode {
487
- switch (country) {
488
- case 'AD':
489
- return CountryCode.Andorra;
490
- case 'AE':
491
- return CountryCode['United Arab Emirates (the)'];
492
- case 'AF':
493
- return CountryCode.Afghanistan;
494
- case 'AG':
495
- return CountryCode['Antigua and Barbuda'];
496
- case 'AI':
497
- return CountryCode.Anguilla;
498
- case 'AL':
499
- return CountryCode.Albania;
500
- case 'AM':
501
- return CountryCode.Armenia;
502
- case 'AO':
503
- return CountryCode.Angola;
504
- case 'AQ':
505
- return CountryCode.Antarctica;
506
- case 'AR':
507
- return CountryCode.Argentina;
508
- case 'AS':
509
- return CountryCode['American Samoa'];
510
- case 'AT':
511
- return CountryCode.Austria;
512
- case 'AU':
513
- return CountryCode.Australia;
514
- case 'AW':
515
- return CountryCode.Aruba;
516
- case 'AX':
517
- return CountryCode['Åland Islands'];
518
- case 'AZ':
519
- return CountryCode.Azerbaijan;
520
- case 'BA':
521
- return CountryCode['Bosnia and Herzegovina'];
522
- case 'BB':
523
- return CountryCode.Barbados;
524
- case 'BD':
525
- return CountryCode.Bangladesh;
526
- case 'BE':
527
- return CountryCode.Belgium;
528
- case 'BF':
529
- return CountryCode['Burkina Faso'];
530
- case 'BG':
531
- return CountryCode.Bulgaria;
532
- case 'BH':
533
- return CountryCode.Bahrain;
534
- case 'BI':
535
- return CountryCode.Burundi;
536
- case 'BJ':
537
- return CountryCode.Benin;
538
- case 'BL':
539
- return CountryCode['Saint Barthélemy'];
540
- case 'BM':
541
- return CountryCode.Bermuda;
542
- case 'BN':
543
- return CountryCode['Brunei Darussalam'];
544
- case 'BO':
545
- return CountryCode['Bolivia (Plurinational State of)'];
546
- case 'BQ':
547
- return CountryCode['Bonaire, Sint Eustatius and Saba'];
548
- case 'BR':
549
- return CountryCode.Brazil;
550
- case 'BS':
551
- return CountryCode['Bahamas (the)'];
552
- case 'BT':
553
- return CountryCode.Bhutan;
554
- case 'BV':
555
- return CountryCode['Bouvet Island'];
556
- case 'BW':
557
- return CountryCode.Botswana;
558
- case 'BY':
559
- return CountryCode.Belarus;
560
- case 'BZ':
561
- return CountryCode.Belize;
562
- case 'CA':
563
- return CountryCode.Canada;
564
- case 'CC':
565
- return CountryCode['Cocos (Keeling) Islands (the)'];
566
- case 'CD':
567
- return CountryCode['Congo (the Democratic Republic of the)'];
568
- case 'CF':
569
- return CountryCode['Central African Republic (the)'];
570
- case 'CG':
571
- return CountryCode['Congo (the)'];
572
- case 'CH':
573
- return CountryCode.Switzerland;
574
- case 'CI':
575
- return CountryCode["Côte d'Ivoire"];
576
- case 'CK':
577
- return CountryCode['Cook Islands (the)'];
578
- case 'CL':
579
- return CountryCode.Chile;
580
- case 'CM':
581
- return CountryCode.Cameroon;
582
- case 'CN':
583
- return CountryCode.China;
584
- case 'CO':
585
- return CountryCode.Colombia;
586
- case 'CR':
587
- return CountryCode['Costa Rica'];
588
- case 'CU':
589
- return CountryCode.Cuba;
590
- case 'CV':
591
- return CountryCode['Cabo Verde'];
592
- case 'CW':
593
- return CountryCode.Curaçao;
594
- case 'CX':
595
- return CountryCode['Christmas Island'];
596
- case 'CY':
597
- return CountryCode.Cyprus;
598
- case 'CZ':
599
- return CountryCode.Czechia;
600
- case 'DE':
601
- return CountryCode.Germany;
602
- case 'DJ':
603
- return CountryCode.Djibouti;
604
- case 'DK':
605
- return CountryCode.Denmark;
606
- case 'DM':
607
- return CountryCode.Dominica;
608
- case 'DO':
609
- return CountryCode['Dominican Republic (the)'];
610
- case 'DZ':
611
- return CountryCode.Algeria;
612
- case 'EC':
613
- return CountryCode.Ecuador;
614
- case 'EE':
615
- return CountryCode.Estonia;
616
- case 'EG':
617
- return CountryCode.Egypt;
618
- case 'EH':
619
- return CountryCode['Western Sahara'];
620
- case 'ER':
621
- return CountryCode.Eritrea;
622
- case 'ES':
623
- return CountryCode.Spain;
624
- case 'ET':
625
- return CountryCode.Ethiopia;
626
- case 'FI':
627
- return CountryCode.Finland;
628
- case 'FJ':
629
- return CountryCode.Fiji;
630
- case 'FK':
631
- return CountryCode['Falkland Islands (the) [Malvinas]'];
632
- case 'FM':
633
- return CountryCode['Micronesia (Federated States of)'];
634
- case 'FO':
635
- return CountryCode['Faroe Islands (the)'];
636
- case 'FR':
637
- return CountryCode.France;
638
- case 'GA':
639
- return CountryCode.Gabon;
640
- case 'GB':
641
- return CountryCode['United Kingdom of Great Britain and Northern Ireland (the)'];
642
- case 'GD':
643
- return CountryCode.Grenada;
644
- case 'GE':
645
- return CountryCode.Georgia;
646
- case 'GF':
647
- return CountryCode['French Guiana'];
648
- case 'GG':
649
- return CountryCode.Guernsey;
650
- case 'GH':
651
- return CountryCode.Ghana;
652
- case 'GI':
653
- return CountryCode.Gibraltar;
654
- case 'GL':
655
- return CountryCode.Greenland;
656
- case 'GM':
657
- return CountryCode['Gambia (the)'];
658
- case 'GN':
659
- return CountryCode.Guinea;
660
- case 'GP':
661
- return CountryCode.Guadeloupe;
662
- case 'GQ':
663
- return CountryCode['Equatorial Guinea'];
664
- case 'GR':
665
- return CountryCode.Greece;
666
- case 'GS':
667
- return CountryCode['South Georgia and the South Sandwich Islands'];
668
- case 'GT':
669
- return CountryCode.Guatemala;
670
- case 'GU':
671
- return CountryCode.Guam;
672
- case 'GW':
673
- return CountryCode['Guinea-Bissau'];
674
- case 'GY':
675
- return CountryCode.Guyana;
676
- case 'HK':
677
- return CountryCode['Hong Kong'];
678
- case 'HM':
679
- return CountryCode['Heard Island and McDonald Islands'];
680
- case 'HN':
681
- return CountryCode.Honduras;
682
- case 'HR':
683
- return CountryCode.Croatia;
684
- case 'HT':
685
- return CountryCode.Haiti;
686
- case 'HU':
687
- return CountryCode.Hungary;
688
- case 'ID':
689
- return CountryCode.Indonesia;
690
- case 'IE':
691
- return CountryCode.Ireland;
692
- case 'IL':
693
- return CountryCode.Israel;
694
- case 'IM':
695
- return CountryCode['Isle of Man'];
696
- case 'IN':
697
- return CountryCode.India;
698
- case 'IO':
699
- return CountryCode['British Indian Ocean Territory (the)'];
700
- case 'IQ':
701
- return CountryCode.Iraq;
702
- case 'IR':
703
- return CountryCode['Iran (Islamic Republic of)'];
704
- case 'IS':
705
- return CountryCode.Iceland;
706
- case 'IT':
707
- return CountryCode.Italy;
708
- case 'JE':
709
- return CountryCode.Jersey;
710
- case 'JM':
711
- return CountryCode.Jamaica;
712
- case 'JO':
713
- return CountryCode.Jordan;
714
- case 'JP':
715
- return CountryCode.Japan;
716
- case 'KE':
717
- return CountryCode.Kenya;
718
- case 'KG':
719
- return CountryCode.Kyrgyzstan;
720
- case 'KH':
721
- return CountryCode.Cambodia;
722
- case 'KI':
723
- return CountryCode.Kiribati;
724
- case 'KM':
725
- return CountryCode['Comoros (the)'];
726
- case 'KN':
727
- return CountryCode['Saint Kitts and Nevis'];
728
- case 'KP':
729
- return CountryCode["Korea (the Democratic People's Republic of)"];
730
- case 'KR':
731
- return CountryCode['Korea (the Republic of)'];
732
- case 'KW':
733
- return CountryCode.Kuwait;
734
- case 'KY':
735
- return CountryCode['Cayman Islands (the)'];
736
- case 'KZ':
737
- return CountryCode.Kazakhstan;
738
- case 'LA':
739
- return CountryCode["Lao People's Democratic Republic (the)"];
740
- case 'LB':
741
- return CountryCode.Lebanon;
742
- case 'LC':
743
- return CountryCode['Saint Lucia'];
744
- case 'LI':
745
- return CountryCode.Liechtenstein;
746
- case 'LK':
747
- return CountryCode['Sri Lanka'];
748
- case 'LR':
749
- return CountryCode.Liberia;
750
- case 'LS':
751
- return CountryCode.Lesotho;
752
- case 'LT':
753
- return CountryCode.Lithuania;
754
- case 'LU':
755
- return CountryCode.Luxembourg;
756
- case 'LV':
757
- return CountryCode.Latvia;
758
- case 'LY':
759
- return CountryCode.Libya;
760
- case 'MA':
761
- return CountryCode.Morocco;
762
- case 'MC':
763
- return CountryCode.Monaco;
764
- case 'MD':
765
- return CountryCode['Moldova (the Republic of)'];
766
- case 'ME':
767
- return CountryCode.Montenegro;
768
- case 'MF':
769
- return CountryCode['Saint Martin (French part)'];
770
- case 'MG':
771
- return CountryCode.Madagascar;
772
- case 'MH':
773
- return CountryCode['Marshall Islands (the)'];
774
- case 'MK':
775
- return CountryCode['Republic of North Macedonia'];
776
- case 'ML':
777
- return CountryCode.Mali;
778
- case 'MM':
779
- return CountryCode.Myanmar;
780
- case 'MN':
781
- return CountryCode.Mongolia;
782
- case 'MO':
783
- return CountryCode.Macao;
784
- case 'MP':
785
- return CountryCode['Northern Mariana Islands (the)'];
786
- case 'MQ':
787
- return CountryCode.Martinique;
788
- case 'MR':
789
- return CountryCode.Mauritania;
790
- case 'MS':
791
- return CountryCode.Montserrat;
792
- case 'MT':
793
- return CountryCode.Malta;
794
- case 'MU':
795
- return CountryCode.Mauritius;
796
- case 'MV':
797
- return CountryCode.Maldives;
798
- case 'MW':
799
- return CountryCode.Malawi;
800
- case 'MX':
801
- return CountryCode.Mexico;
802
- case 'MY':
803
- return CountryCode.Malaysia;
804
- case 'MZ':
805
- return CountryCode.Mozambique;
806
- case 'NA':
807
- return CountryCode.Namibia;
808
- case 'NC':
809
- return CountryCode['New Caledonia'];
810
- case 'NE':
811
- return CountryCode['Niger (the)'];
812
- case 'NF':
813
- return CountryCode['Norfolk Island'];
814
- case 'NG':
815
- return CountryCode.Nigeria;
816
- case 'NI':
817
- return CountryCode.Nicaragua;
818
- case 'NL':
819
- return CountryCode['Netherlands (the)'];
820
- case 'NO':
821
- return CountryCode.Norway;
822
- case 'NP':
823
- return CountryCode.Nepal;
824
- case 'NR':
825
- return CountryCode.Nauru;
826
- case 'NU':
827
- return CountryCode.Niue;
828
- case 'NZ':
829
- return CountryCode['New Zealand'];
830
- case 'OM':
831
- return CountryCode.Oman;
832
- case 'PA':
833
- return CountryCode.Panama;
834
- case 'PE':
835
- return CountryCode.Peru;
836
- case 'PF':
837
- return CountryCode['French Polynesia'];
838
- case 'PG':
839
- return CountryCode['Papua New Guinea'];
840
- case 'PH':
841
- return CountryCode['Philippines (the)'];
842
- case 'PK':
843
- return CountryCode.Pakistan;
844
- case 'PL':
845
- return CountryCode.Poland;
846
- case 'PM':
847
- return CountryCode['Saint Pierre and Miquelon'];
848
- case 'PN':
849
- return CountryCode.Pitcairn;
850
- case 'PR':
851
- return CountryCode['Puerto Rico'];
852
- case 'PS':
853
- return CountryCode['Palestine, State of'];
854
- case 'PT':
855
- return CountryCode.Portugal;
856
- case 'PW':
857
- return CountryCode.Palau;
858
- case 'PY':
859
- return CountryCode.Paraguay;
860
- case 'QA':
861
- return CountryCode.Qatar;
862
- case 'RE':
863
- return CountryCode.Réunion;
864
- case 'RO':
865
- return CountryCode.Romania;
866
- case 'RS':
867
- return CountryCode.Serbia;
868
- case 'RU':
869
- return CountryCode['Russian Federation (the)'];
870
- case 'RW':
871
- return CountryCode.Rwanda;
872
- case 'SA':
873
- return CountryCode['Saudi Arabia'];
874
- case 'SB':
875
- return CountryCode['Solomon Islands'];
876
- case 'SC':
877
- return CountryCode.Seychelles;
878
- case 'SD':
879
- return CountryCode['Sudan (the)'];
880
- case 'SE':
881
- return CountryCode.Sweden;
882
- case 'SG':
883
- return CountryCode.Singapore;
884
- case 'SH':
885
- return CountryCode['Saint Helena, Ascension and Tristan da Cunha'];
886
- case 'SI':
887
- return CountryCode.Slovenia;
888
- case 'SJ':
889
- return CountryCode['Svalbard and Jan Mayen'];
890
- case 'SK':
891
- return CountryCode.Slovakia;
892
- case 'SL':
893
- return CountryCode['Sierra Leone'];
894
- case 'SM':
895
- return CountryCode['San Marino'];
896
- case 'SN':
897
- return CountryCode.Senegal;
898
- case 'SO':
899
- return CountryCode.Somalia;
900
- case 'SR':
901
- return CountryCode.Suriname;
902
- case 'SS':
903
- return CountryCode['South Sudan'];
904
- case 'ST':
905
- return CountryCode['Sao Tome and Principe'];
906
- case 'SV':
907
- return CountryCode['El Salvador'];
908
- case 'SX':
909
- return CountryCode['Sint Maarten (Dutch part)'];
910
- case 'SY':
911
- return CountryCode['Syrian Arab Republic'];
912
- case 'SZ':
913
- return CountryCode.Eswatini;
914
- case 'TC':
915
- return CountryCode['Turks and Caicos Islands (the)'];
916
- case 'TD':
917
- return CountryCode.Chad;
918
- case 'TF':
919
- return CountryCode['French Southern Territories (the)'];
920
- case 'TG':
921
- return CountryCode.Togo;
922
- case 'TH':
923
- return CountryCode.Thailand;
924
- case 'TJ':
925
- return CountryCode.Tajikistan;
926
- case 'TK':
927
- return CountryCode.Tokelau;
928
- case 'TL':
929
- return CountryCode['Timor-Leste'];
930
- case 'TM':
931
- return CountryCode.Turkmenistan;
932
- case 'TN':
933
- return CountryCode.Tunisia;
934
- case 'TO':
935
- return CountryCode.Tonga;
936
- case 'TR':
937
- return CountryCode.Turkey;
938
- case 'TT':
939
- return CountryCode['Trinidad and Tobago'];
940
- case 'TV':
941
- return CountryCode.Tuvalu;
942
- case 'TW':
943
- return CountryCode['Taiwan (Province of China)'];
944
- case 'TZ':
945
- return CountryCode['Tanzania, United Republic of'];
946
- case 'UA':
947
- return CountryCode.Ukraine;
948
- case 'UG':
949
- return CountryCode.Uganda;
950
- case 'UM':
951
- return CountryCode['United States Minor Outlying Islands (the)'];
952
- case 'US':
953
- return CountryCode['United States of America (the)'];
954
- case 'UY':
955
- return CountryCode.Uruguay;
956
- case 'UZ':
957
- return CountryCode.Uzbekistan;
958
- case 'VA':
959
- return CountryCode['Holy See (the)'];
960
- case 'VC':
961
- return CountryCode['Saint Vincent and the Grenadines'];
962
- case 'VE':
963
- return CountryCode['Venezuela (Bolivarian Republic of)'];
964
- case 'VG':
965
- return CountryCode['Virgin Islands (British)'];
966
- case 'VI':
967
- return CountryCode['Virgin Islands (U.S.)'];
968
- case 'VN':
969
- return CountryCode['Viet Nam'];
970
- case 'VU':
971
- return CountryCode.Vanuatu;
972
- case 'WF':
973
- return CountryCode['Wallis and Futuna'];
974
- case 'WS':
975
- return CountryCode.Samoa;
976
- case 'YE':
977
- return CountryCode.Yemen;
978
- case 'YT':
979
- return CountryCode.Mayotte;
980
- case 'ZA':
981
- return CountryCode['South Africa'];
982
- case 'ZM':
983
- return CountryCode.Zambia;
984
- case 'ZW':
985
- return CountryCode.Zimbabwe;
986
- case 'XK':
987
- // TODO: remove this once green invoice adds Kosovo to their list
988
- return CountryCode.Serbia;
989
- default:
990
- throw new Error(`Unsupported Green Invoice country: ${country}`);
487
+ const greenInvoiceToCountryCodeMap: Partial<Record<GreenInvoiceCountry, CountryCode>> = {
488
+ AD: CountryCode.Andorra,
489
+ AE: CountryCode['United Arab Emirates (the)'],
490
+ AF: CountryCode.Afghanistan,
491
+ AG: CountryCode['Antigua and Barbuda'],
492
+ AI: CountryCode.Anguilla,
493
+ AL: CountryCode.Albania,
494
+ AM: CountryCode.Armenia,
495
+ AO: CountryCode.Angola,
496
+ AQ: CountryCode.Antarctica,
497
+ AR: CountryCode.Argentina,
498
+ AS: CountryCode['American Samoa'],
499
+ AT: CountryCode.Austria,
500
+ AU: CountryCode.Australia,
501
+ AW: CountryCode.Aruba,
502
+ AX: CountryCode['Åland Islands'],
503
+ AZ: CountryCode.Azerbaijan,
504
+ BA: CountryCode['Bosnia and Herzegovina'],
505
+ BB: CountryCode.Barbados,
506
+ BD: CountryCode.Bangladesh,
507
+ BE: CountryCode.Belgium,
508
+ BF: CountryCode['Burkina Faso'],
509
+ BG: CountryCode.Bulgaria,
510
+ BH: CountryCode.Bahrain,
511
+ BI: CountryCode.Burundi,
512
+ BJ: CountryCode.Benin,
513
+ BL: CountryCode['Saint Barthélemy'],
514
+ BM: CountryCode.Bermuda,
515
+ BN: CountryCode['Brunei Darussalam'],
516
+ BO: CountryCode['Bolivia (Plurinational State of)'],
517
+ BQ: CountryCode['Bonaire, Sint Eustatius and Saba'],
518
+ BR: CountryCode.Brazil,
519
+ BS: CountryCode['Bahamas (the)'],
520
+ BT: CountryCode.Bhutan,
521
+ BV: CountryCode['Bouvet Island'],
522
+ BW: CountryCode.Botswana,
523
+ BY: CountryCode.Belarus,
524
+ BZ: CountryCode.Belize,
525
+ CA: CountryCode.Canada,
526
+ CC: CountryCode['Cocos (Keeling) Islands (the)'],
527
+ CD: CountryCode['Congo (the Democratic Republic of the)'],
528
+ CF: CountryCode['Central African Republic (the)'],
529
+ CG: CountryCode['Congo (the)'],
530
+ CH: CountryCode.Switzerland,
531
+ CI: CountryCode["Côte d'Ivoire"],
532
+ CK: CountryCode['Cook Islands (the)'],
533
+ CL: CountryCode.Chile,
534
+ CM: CountryCode.Cameroon,
535
+ CN: CountryCode.China,
536
+ CO: CountryCode.Colombia,
537
+ CR: CountryCode['Costa Rica'],
538
+ CU: CountryCode.Cuba,
539
+ CV: CountryCode['Cabo Verde'],
540
+ CW: CountryCode.Curaçao,
541
+ CX: CountryCode['Christmas Island'],
542
+ CY: CountryCode.Cyprus,
543
+ CZ: CountryCode.Czechia,
544
+ DE: CountryCode.Germany,
545
+ DJ: CountryCode.Djibouti,
546
+ DK: CountryCode.Denmark,
547
+ DM: CountryCode.Dominica,
548
+ DO: CountryCode['Dominican Republic (the)'],
549
+ DZ: CountryCode.Algeria,
550
+ EC: CountryCode.Ecuador,
551
+ EE: CountryCode.Estonia,
552
+ EG: CountryCode.Egypt,
553
+ EH: CountryCode['Western Sahara'],
554
+ ER: CountryCode.Eritrea,
555
+ ES: CountryCode.Spain,
556
+ ET: CountryCode.Ethiopia,
557
+ FI: CountryCode.Finland,
558
+ FJ: CountryCode.Fiji,
559
+ FK: CountryCode['Falkland Islands (the) [Malvinas]'],
560
+ FM: CountryCode['Micronesia (Federated States of)'],
561
+ FO: CountryCode['Faroe Islands (the)'],
562
+ FR: CountryCode.France,
563
+ GA: CountryCode.Gabon,
564
+ GB: CountryCode['United Kingdom of Great Britain and Northern Ireland (the)'],
565
+ GD: CountryCode.Grenada,
566
+ GE: CountryCode.Georgia,
567
+ GF: CountryCode['French Guiana'],
568
+ GG: CountryCode.Guernsey,
569
+ GH: CountryCode.Ghana,
570
+ GI: CountryCode.Gibraltar,
571
+ GL: CountryCode.Greenland,
572
+ GM: CountryCode['Gambia (the)'],
573
+ GN: CountryCode.Guinea,
574
+ GP: CountryCode.Guadeloupe,
575
+ GQ: CountryCode['Equatorial Guinea'],
576
+ GR: CountryCode.Greece,
577
+ GS: CountryCode['South Georgia and the South Sandwich Islands'],
578
+ GT: CountryCode.Guatemala,
579
+ GU: CountryCode.Guam,
580
+ GW: CountryCode['Guinea-Bissau'],
581
+ GY: CountryCode.Guyana,
582
+ HK: CountryCode['Hong Kong'],
583
+ HM: CountryCode['Heard Island and McDonald Islands'],
584
+ HN: CountryCode.Honduras,
585
+ HR: CountryCode.Croatia,
586
+ HT: CountryCode.Haiti,
587
+ HU: CountryCode.Hungary,
588
+ ID: CountryCode.Indonesia,
589
+ IE: CountryCode.Ireland,
590
+ IL: CountryCode.Israel,
591
+ IM: CountryCode['Isle of Man'],
592
+ IN: CountryCode.India,
593
+ IO: CountryCode['British Indian Ocean Territory (the)'],
594
+ IQ: CountryCode.Iraq,
595
+ IR: CountryCode['Iran (Islamic Republic of)'],
596
+ IS: CountryCode.Iceland,
597
+ IT: CountryCode.Italy,
598
+ JE: CountryCode.Jersey,
599
+ JM: CountryCode.Jamaica,
600
+ JO: CountryCode.Jordan,
601
+ JP: CountryCode.Japan,
602
+ KE: CountryCode.Kenya,
603
+ KG: CountryCode.Kyrgyzstan,
604
+ KH: CountryCode.Cambodia,
605
+ KI: CountryCode.Kiribati,
606
+ KM: CountryCode['Comoros (the)'],
607
+ KN: CountryCode['Saint Kitts and Nevis'],
608
+ KP: CountryCode["Korea (the Democratic People's Republic of)"],
609
+ KR: CountryCode['Korea (the Republic of)'],
610
+ KW: CountryCode.Kuwait,
611
+ KY: CountryCode['Cayman Islands (the)'],
612
+ KZ: CountryCode.Kazakhstan,
613
+ LA: CountryCode["Lao People's Democratic Republic (the)"],
614
+ LB: CountryCode.Lebanon,
615
+ LC: CountryCode['Saint Lucia'],
616
+ LI: CountryCode.Liechtenstein,
617
+ LK: CountryCode['Sri Lanka'],
618
+ LR: CountryCode.Liberia,
619
+ LS: CountryCode.Lesotho,
620
+ LT: CountryCode.Lithuania,
621
+ LU: CountryCode.Luxembourg,
622
+ LV: CountryCode.Latvia,
623
+ LY: CountryCode.Libya,
624
+ MA: CountryCode.Morocco,
625
+ MC: CountryCode.Monaco,
626
+ MD: CountryCode['Moldova (the Republic of)'],
627
+ ME: CountryCode.Montenegro,
628
+ MF: CountryCode['Saint Martin (French part)'],
629
+ MG: CountryCode.Madagascar,
630
+ MH: CountryCode['Marshall Islands (the)'],
631
+ MK: CountryCode['Republic of North Macedonia'],
632
+ ML: CountryCode.Mali,
633
+ MM: CountryCode.Myanmar,
634
+ MN: CountryCode.Mongolia,
635
+ MO: CountryCode.Macao,
636
+ MP: CountryCode['Northern Mariana Islands (the)'],
637
+ MQ: CountryCode.Martinique,
638
+ MR: CountryCode.Mauritania,
639
+ MS: CountryCode.Montserrat,
640
+ MT: CountryCode.Malta,
641
+ MU: CountryCode.Mauritius,
642
+ MV: CountryCode.Maldives,
643
+ MW: CountryCode.Malawi,
644
+ MX: CountryCode.Mexico,
645
+ MY: CountryCode.Malaysia,
646
+ MZ: CountryCode.Mozambique,
647
+ NA: CountryCode.Namibia,
648
+ NC: CountryCode['New Caledonia'],
649
+ NE: CountryCode['Niger (the)'],
650
+ NF: CountryCode['Norfolk Island'],
651
+ NG: CountryCode.Nigeria,
652
+ NI: CountryCode.Nicaragua,
653
+ NL: CountryCode['Netherlands (the)'],
654
+ NO: CountryCode.Norway,
655
+ NP: CountryCode.Nepal,
656
+ NR: CountryCode.Nauru,
657
+ NU: CountryCode.Niue,
658
+ NZ: CountryCode['New Zealand'],
659
+ OM: CountryCode.Oman,
660
+ PA: CountryCode.Panama,
661
+ PE: CountryCode.Peru,
662
+ PF: CountryCode['French Polynesia'],
663
+ PG: CountryCode['Papua New Guinea'],
664
+ PH: CountryCode['Philippines (the)'],
665
+ PK: CountryCode.Pakistan,
666
+ PL: CountryCode.Poland,
667
+ PM: CountryCode['Saint Pierre and Miquelon'],
668
+ PN: CountryCode.Pitcairn,
669
+ PR: CountryCode['Puerto Rico'],
670
+ PS: CountryCode['Palestine, State of'],
671
+ PT: CountryCode.Portugal,
672
+ PW: CountryCode.Palau,
673
+ PY: CountryCode.Paraguay,
674
+ QA: CountryCode.Qatar,
675
+ RE: CountryCode.Réunion,
676
+ RO: CountryCode.Romania,
677
+ RS: CountryCode.Serbia,
678
+ RU: CountryCode['Russian Federation (the)'],
679
+ RW: CountryCode.Rwanda,
680
+ SA: CountryCode['Saudi Arabia'],
681
+ SB: CountryCode['Solomon Islands'],
682
+ SC: CountryCode.Seychelles,
683
+ SD: CountryCode['Sudan (the)'],
684
+ SE: CountryCode.Sweden,
685
+ SG: CountryCode.Singapore,
686
+ SH: CountryCode['Saint Helena, Ascension and Tristan da Cunha'],
687
+ SI: CountryCode.Slovenia,
688
+ SJ: CountryCode['Svalbard and Jan Mayen'],
689
+ SK: CountryCode.Slovakia,
690
+ SL: CountryCode['Sierra Leone'],
691
+ SM: CountryCode['San Marino'],
692
+ SN: CountryCode.Senegal,
693
+ SO: CountryCode.Somalia,
694
+ SR: CountryCode.Suriname,
695
+ SS: CountryCode['South Sudan'],
696
+ ST: CountryCode['Sao Tome and Principe'],
697
+ SV: CountryCode['El Salvador'],
698
+ SX: CountryCode['Sint Maarten (Dutch part)'],
699
+ SY: CountryCode['Syrian Arab Republic'],
700
+ SZ: CountryCode.Eswatini,
701
+ TC: CountryCode['Turks and Caicos Islands (the)'],
702
+ TD: CountryCode.Chad,
703
+ TF: CountryCode['French Southern Territories (the)'],
704
+ TG: CountryCode.Togo,
705
+ TH: CountryCode.Thailand,
706
+ TJ: CountryCode.Tajikistan,
707
+ TK: CountryCode.Tokelau,
708
+ TL: CountryCode['Timor-Leste'],
709
+ TM: CountryCode.Turkmenistan,
710
+ TN: CountryCode.Tunisia,
711
+ TO: CountryCode.Tonga,
712
+ TR: CountryCode.Turkey,
713
+ TT: CountryCode['Trinidad and Tobago'],
714
+ TV: CountryCode.Tuvalu,
715
+ TW: CountryCode['Taiwan (Province of China)'],
716
+ TZ: CountryCode['Tanzania, United Republic of'],
717
+ UA: CountryCode.Ukraine,
718
+ UG: CountryCode.Uganda,
719
+ UM: CountryCode['United States Minor Outlying Islands (the)'],
720
+ US: CountryCode['United States of America (the)'],
721
+ UY: CountryCode.Uruguay,
722
+ UZ: CountryCode.Uzbekistan,
723
+ VA: CountryCode['Holy See (the)'],
724
+ VC: CountryCode['Saint Vincent and the Grenadines'],
725
+ VE: CountryCode['Venezuela (Bolivarian Republic of)'],
726
+ VG: CountryCode['Virgin Islands (British)'],
727
+ VI: CountryCode['Virgin Islands (U.S.)'],
728
+ VN: CountryCode['Viet Nam'],
729
+ VU: CountryCode.Vanuatu,
730
+ WF: CountryCode['Wallis and Futuna'],
731
+ WS: CountryCode.Samoa,
732
+ YE: CountryCode.Yemen,
733
+ YT: CountryCode.Mayotte,
734
+ ZA: CountryCode['South Africa'],
735
+ ZM: CountryCode.Zambia,
736
+ ZW: CountryCode.Zimbabwe,
737
+ };
738
+
739
+ if (country === 'XK') {
740
+ // TODO: remove this once green invoice adds Kosovo to their list
741
+ return CountryCode.Serbia;
742
+ }
743
+ const code = greenInvoiceToCountryCodeMap[country];
744
+ if (code) {
745
+ return code;
991
746
  }
747
+ throw new Error(`Unsupported Green Invoice country: ${country}`);
992
748
  }
993
749
 
994
750
  export function countryCodeToGreenInvoiceCountry(countryCode: CountryCode): GreenInvoiceCountry {
995
- switch (countryCode) {
996
- case CountryCode.Afghanistan:
997
- return 'AF';
998
- case CountryCode['Åland Islands']:
999
- return 'AX';
1000
- case CountryCode.Albania:
1001
- return 'AL';
1002
- case CountryCode.Algeria:
1003
- return 'DZ';
1004
- case CountryCode['American Samoa']:
1005
- return 'AS';
1006
- case CountryCode.Andorra:
1007
- return 'AD';
1008
- case CountryCode.Angola:
1009
- return 'AO';
1010
- case CountryCode.Anguilla:
1011
- return 'AI';
1012
- case CountryCode.Antarctica:
1013
- return 'AQ';
1014
- case CountryCode['Antigua and Barbuda']:
1015
- return 'AG';
1016
- case CountryCode.Argentina:
1017
- return 'AR';
1018
- case CountryCode.Armenia:
1019
- return 'AM';
1020
- case CountryCode.Aruba:
1021
- return 'AW';
1022
- case CountryCode.Australia:
1023
- return 'AU';
1024
- case CountryCode.Austria:
1025
- return 'AT';
1026
- case CountryCode.Azerbaijan:
1027
- return 'AZ';
1028
- case CountryCode['Bahamas (the)']:
1029
- return 'BS';
1030
- case CountryCode.Bahrain:
1031
- return 'BH';
1032
- case CountryCode.Bangladesh:
1033
- return 'BD';
1034
- case CountryCode.Barbados:
1035
- return 'BB';
1036
- case CountryCode.Belarus:
1037
- return 'BY';
1038
- case CountryCode.Belgium:
1039
- return 'BE';
1040
- case CountryCode.Belize:
1041
- return 'BZ';
1042
- case CountryCode.Benin:
1043
- return 'BJ';
1044
- case CountryCode.Bermuda:
1045
- return 'BM';
1046
- case CountryCode.Bhutan:
1047
- return 'BT';
1048
- case CountryCode['Bolivia (Plurinational State of)']:
1049
- return 'BO';
1050
- case CountryCode['Bonaire, Sint Eustatius and Saba']:
1051
- return 'BQ';
1052
- case CountryCode['Bosnia and Herzegovina']:
1053
- return 'BA';
1054
- case CountryCode.Botswana:
1055
- return 'BW';
1056
- case CountryCode['Bouvet Island']:
1057
- return 'BV';
1058
- case CountryCode.Brazil:
1059
- return 'BR';
1060
- case CountryCode['British Indian Ocean Territory (the)']:
1061
- return 'IO';
1062
- case CountryCode['Brunei Darussalam']:
1063
- return 'BN';
1064
- case CountryCode.Bulgaria:
1065
- return 'BG';
1066
- case CountryCode['Burkina Faso']:
1067
- return 'BF';
1068
- case CountryCode.Burundi:
1069
- return 'BI';
1070
- case CountryCode['Cabo Verde']:
1071
- return 'CV';
1072
- case CountryCode.Cambodia:
1073
- return 'KH';
1074
- case CountryCode.Cameroon:
1075
- return 'CM';
1076
- case CountryCode.Canada:
1077
- return 'CA';
1078
- case CountryCode['Cayman Islands (the)']:
1079
- return 'KY';
1080
- case CountryCode['Central African Republic (the)']:
1081
- return 'CF';
1082
- case CountryCode.Chad:
1083
- return 'TD';
1084
- case CountryCode.Chile:
1085
- return 'CL';
1086
- case CountryCode.China:
1087
- return 'CN';
1088
- case CountryCode['Christmas Island']:
1089
- return 'CX';
1090
- case CountryCode['Cocos (Keeling) Islands (the)']:
1091
- return 'CC';
1092
- case CountryCode.Colombia:
1093
- return 'CO';
1094
- case CountryCode['Comoros (the)']:
1095
- return 'KM';
1096
- case CountryCode['Congo (the Democratic Republic of the)']:
1097
- return 'CD';
1098
- case CountryCode['Congo (the)']:
1099
- return 'CG';
1100
- case CountryCode['Cook Islands (the)']:
1101
- return 'CK';
1102
- case CountryCode['Costa Rica']:
1103
- return 'CR';
1104
- case CountryCode.Croatia:
1105
- return 'HR';
1106
- case CountryCode.Cuba:
1107
- return 'CU';
1108
- case CountryCode.Curaçao:
1109
- return 'CW';
1110
- case CountryCode.Cyprus:
1111
- return 'CY';
1112
- case CountryCode.Czechia:
1113
- return 'CZ';
1114
- case CountryCode["Côte d'Ivoire"]:
1115
- return 'CI';
1116
- case CountryCode.Denmark:
1117
- return 'DK';
1118
- case CountryCode.Djibouti:
1119
- return 'DJ';
1120
- case CountryCode.Dominica:
1121
- return 'DM';
1122
- case CountryCode['Dominican Republic (the)']:
1123
- return 'DO';
1124
- case CountryCode.Ecuador:
1125
- return 'EC';
1126
- case CountryCode.Egypt:
1127
- return 'EG';
1128
- case CountryCode['El Salvador']:
1129
- return 'SV';
1130
- case CountryCode['Equatorial Guinea']:
1131
- return 'GQ';
1132
- case CountryCode.Eritrea:
1133
- return 'ER';
1134
- case CountryCode.Estonia:
1135
- return 'EE';
1136
- case CountryCode.Eswatini:
1137
- return 'SZ';
1138
- case CountryCode.Ethiopia:
1139
- return 'ET';
1140
- case CountryCode['Falkland Islands (the) [Malvinas]']:
1141
- return 'FK';
1142
- case CountryCode['Faroe Islands (the)']:
1143
- return 'FO';
1144
- case CountryCode.Fiji:
1145
- return 'FJ';
1146
- case CountryCode.Finland:
1147
- return 'FI';
1148
- case CountryCode.France:
1149
- return 'FR';
1150
- case CountryCode['French Guiana']:
1151
- return 'GF';
1152
- case CountryCode['French Polynesia']:
1153
- return 'PF';
1154
- case CountryCode['French Southern Territories (the)']:
1155
- return 'TF';
1156
- case CountryCode.Gabon:
1157
- return 'GA';
1158
- case CountryCode['Gambia (the)']:
1159
- return 'GM';
1160
- case CountryCode.Georgia:
1161
- return 'GE';
1162
- case CountryCode.Germany:
1163
- return 'DE';
1164
- case CountryCode.Ghana:
1165
- return 'GH';
1166
- case CountryCode.Gibraltar:
1167
- return 'GI';
1168
- case CountryCode.Greece:
1169
- return 'GR';
1170
- case CountryCode.Greenland:
1171
- return 'GL';
1172
- case CountryCode.Grenada:
1173
- return 'GD';
1174
- case CountryCode.Guadeloupe:
1175
- return 'GP';
1176
- case CountryCode.Guam:
1177
- return 'GU';
1178
- case CountryCode.Guatemala:
1179
- return 'GT';
1180
- case CountryCode.Guernsey:
1181
- return 'GG';
1182
- case CountryCode.Guinea:
1183
- return 'GN';
1184
- case CountryCode['Guinea-Bissau']:
1185
- return 'GW';
1186
- case CountryCode.Guyana:
1187
- return 'GY';
1188
- case CountryCode.Haiti:
1189
- return 'HT';
1190
- case CountryCode['Heard Island and McDonald Islands']:
1191
- return 'HM';
1192
- case CountryCode['Holy See (the)']:
1193
- return 'VA';
1194
- case CountryCode.Honduras:
1195
- return 'HN';
1196
- case CountryCode['Hong Kong']:
1197
- return 'HK';
1198
- case CountryCode.Hungary:
1199
- return 'HU';
1200
- case CountryCode.Iceland:
1201
- return 'IS';
1202
- case CountryCode.India:
1203
- return 'IN';
1204
- case CountryCode.Indonesia:
1205
- return 'ID';
1206
- case CountryCode['Iran (Islamic Republic of)']:
1207
- return 'IR';
1208
- case CountryCode.Iraq:
1209
- return 'IQ';
1210
- case CountryCode.Ireland:
1211
- return 'IE';
1212
- case CountryCode['Isle of Man']:
1213
- return 'IM';
1214
- case CountryCode.Israel:
1215
- return 'IL';
1216
- case CountryCode.Italy:
1217
- return 'IT';
1218
- case CountryCode.Jamaica:
1219
- return 'JM';
1220
- case CountryCode.Japan:
1221
- return 'JP';
1222
- case CountryCode.Jersey:
1223
- return 'JE';
1224
- case CountryCode.Jordan:
1225
- return 'JO';
1226
- case CountryCode.Kazakhstan:
1227
- return 'KZ';
1228
- case CountryCode.Kenya:
1229
- return 'KE';
1230
- case CountryCode.Kiribati:
1231
- return 'KI';
1232
- case CountryCode["Korea (the Democratic People's Republic of)"]:
1233
- return 'KP';
1234
- case CountryCode['Korea (the Republic of)']:
1235
- return 'KR';
1236
- case CountryCode.Kuwait:
1237
- return 'KW';
1238
- case CountryCode.Kyrgyzstan:
1239
- return 'KG';
1240
- case CountryCode["Lao People's Democratic Republic (the)"]:
1241
- return 'LA';
1242
- case CountryCode.Latvia:
1243
- return 'LV';
1244
- case CountryCode.Lebanon:
1245
- return 'LB';
1246
- case CountryCode.Lesotho:
1247
- return 'LS';
1248
- case CountryCode.Liberia:
1249
- return 'LR';
1250
- case CountryCode.Libya:
1251
- return 'LY';
1252
- case CountryCode.Liechtenstein:
1253
- return 'LI';
1254
- case CountryCode.Lithuania:
1255
- return 'LT';
1256
- case CountryCode.Luxembourg:
1257
- return 'LU';
1258
- case CountryCode.Macao:
1259
- return 'MO';
1260
- case CountryCode.Madagascar:
1261
- return 'MG';
1262
- case CountryCode.Malawi:
1263
- return 'MW';
1264
- case CountryCode.Malaysia:
1265
- return 'MY';
1266
- case CountryCode.Maldives:
1267
- return 'MV';
1268
- case CountryCode.Mali:
1269
- return 'ML';
1270
- case CountryCode.Malta:
1271
- return 'MT';
1272
- case CountryCode['Marshall Islands (the)']:
1273
- return 'MH';
1274
- case CountryCode.Martinique:
1275
- return 'MQ';
1276
- case CountryCode.Mauritania:
1277
- return 'MR';
1278
- case CountryCode.Mauritius:
1279
- return 'MU';
1280
- case CountryCode.Mayotte:
1281
- return 'YT';
1282
- case CountryCode.Mexico:
1283
- return 'MX';
1284
- case CountryCode['Micronesia (Federated States of)']:
1285
- return 'FM';
1286
- case CountryCode['Moldova (the Republic of)']:
1287
- return 'MD';
1288
- case CountryCode.Monaco:
1289
- return 'MC';
1290
- case CountryCode.Mongolia:
1291
- return 'MN';
1292
- case CountryCode.Montenegro:
1293
- return 'ME';
1294
- case CountryCode.Montserrat:
1295
- return 'MS';
1296
- case CountryCode.Morocco:
1297
- return 'MA';
1298
- case CountryCode.Mozambique:
1299
- return 'MZ';
1300
- case CountryCode.Myanmar:
1301
- return 'MM';
1302
- case CountryCode.Namibia:
1303
- return 'NA';
1304
- case CountryCode.Nauru:
1305
- return 'NR';
1306
- case CountryCode.Nepal:
1307
- return 'NP';
1308
- case CountryCode['Netherlands (the)']:
1309
- return 'NL';
1310
- case CountryCode['New Caledonia']:
1311
- return 'NC';
1312
- case CountryCode['New Zealand']:
1313
- return 'NZ';
1314
- case CountryCode.Nicaragua:
1315
- return 'NI';
1316
- case CountryCode['Niger (the)']:
1317
- return 'NE';
1318
- case CountryCode.Nigeria:
1319
- return 'NG';
1320
- case CountryCode.Niue:
1321
- return 'NU';
1322
- case CountryCode['Norfolk Island']:
1323
- return 'NF';
1324
- case CountryCode['Northern Mariana Islands (the)']:
1325
- return 'MP';
1326
- case CountryCode.Norway:
1327
- return 'NO';
1328
- case CountryCode.Oman:
1329
- return 'OM';
1330
- case CountryCode.Pakistan:
1331
- return 'PK';
1332
- case CountryCode.Palau:
1333
- return 'PW';
1334
- case CountryCode['Palestine, State of']:
1335
- return 'PS';
1336
- case CountryCode.Panama:
1337
- return 'PA';
1338
- case CountryCode['Papua New Guinea']:
1339
- return 'PG';
1340
- case CountryCode.Paraguay:
1341
- return 'PY';
1342
- case CountryCode.Peru:
1343
- return 'PE';
1344
- case CountryCode['Philippines (the)']:
1345
- return 'PH';
1346
- case CountryCode.Pitcairn:
1347
- return 'PN';
1348
- case CountryCode.Poland:
1349
- return 'PL';
1350
- case CountryCode.Portugal:
1351
- return 'PT';
1352
- case CountryCode['Puerto Rico']:
1353
- return 'PR';
1354
- case CountryCode.Qatar:
1355
- return 'QA';
1356
- case CountryCode['Republic of North Macedonia']:
1357
- return 'MK';
1358
- case CountryCode.Romania:
1359
- return 'RO';
1360
- case CountryCode['Russian Federation (the)']:
1361
- return 'RU';
1362
- case CountryCode.Rwanda:
1363
- return 'RW';
1364
- case CountryCode.Réunion:
1365
- return 'RE';
1366
- case CountryCode['Saint Barthélemy']:
1367
- return 'BL';
1368
- case CountryCode['Saint Helena, Ascension and Tristan da Cunha']:
1369
- return 'SH';
1370
- case CountryCode['Saint Kitts and Nevis']:
1371
- return 'KN';
1372
- case CountryCode['Saint Lucia']:
1373
- return 'LC';
1374
- case CountryCode['Saint Martin (French part)']:
1375
- return 'MF';
1376
- case CountryCode['Saint Pierre and Miquelon']:
1377
- return 'PM';
1378
- case CountryCode['Saint Vincent and the Grenadines']:
1379
- return 'VC';
1380
- case CountryCode.Samoa:
1381
- return 'WS';
1382
- case CountryCode['San Marino']:
1383
- return 'SM';
1384
- case CountryCode['Sao Tome and Principe']:
1385
- return 'ST';
1386
- case CountryCode['Saudi Arabia']:
1387
- return 'SA';
1388
- case CountryCode.Senegal:
1389
- return 'SN';
1390
- case CountryCode.Serbia:
1391
- return 'RS';
1392
- case CountryCode.Seychelles:
1393
- return 'SC';
1394
- case CountryCode['Sierra Leone']:
1395
- return 'SL';
1396
- case CountryCode.Singapore:
1397
- return 'SG';
1398
- case CountryCode['Sint Maarten (Dutch part)']:
1399
- return 'SX';
1400
- case CountryCode.Slovakia:
1401
- return 'SK';
1402
- case CountryCode.Slovenia:
1403
- return 'SI';
1404
- case CountryCode['Solomon Islands']:
1405
- return 'SB';
1406
- case CountryCode.Somalia:
1407
- return 'SO';
1408
- case CountryCode['South Africa']:
1409
- return 'ZA';
1410
- case CountryCode['South Georgia and the South Sandwich Islands']:
1411
- return 'GS';
1412
- case CountryCode['South Sudan']:
1413
- return 'SS';
1414
- case CountryCode.Spain:
1415
- return 'ES';
1416
- case CountryCode['Sri Lanka']:
1417
- return 'LK';
1418
- case CountryCode['Sudan (the)']:
1419
- return 'SD';
1420
- case CountryCode.Suriname:
1421
- return 'SR';
1422
- case CountryCode['Svalbard and Jan Mayen']:
1423
- return 'SJ';
1424
- case CountryCode.Sweden:
1425
- return 'SE';
1426
- case CountryCode.Switzerland:
1427
- return 'CH';
1428
- case CountryCode['Syrian Arab Republic']:
1429
- return 'SY';
1430
- case CountryCode['Taiwan (Province of China)']:
1431
- return 'TW';
1432
- case CountryCode.Tajikistan:
1433
- return 'TJ';
1434
- case CountryCode['Tanzania, United Republic of']:
1435
- return 'TZ';
1436
- case CountryCode.Thailand:
1437
- return 'TH';
1438
- case CountryCode['Timor-Leste']:
1439
- return 'TL';
1440
- case CountryCode.Togo:
1441
- return 'TG';
1442
- case CountryCode.Tokelau:
1443
- return 'TK';
1444
- case CountryCode.Tonga:
1445
- return 'TO';
1446
- case CountryCode['Trinidad and Tobago']:
1447
- return 'TT';
1448
- case CountryCode.Tunisia:
1449
- return 'TN';
1450
- case CountryCode.Turkey:
1451
- return 'TR';
1452
- case CountryCode.Turkmenistan:
1453
- return 'TM';
1454
- case CountryCode['Turks and Caicos Islands (the)']:
1455
- return 'TC';
1456
- case CountryCode.Tuvalu:
1457
- return 'TV';
1458
- case CountryCode.Uganda:
1459
- return 'UG';
1460
- case CountryCode.Ukraine:
1461
- return 'UA';
1462
- case CountryCode['United Arab Emirates (the)']:
1463
- return 'AE';
1464
- case CountryCode['United Kingdom of Great Britain and Northern Ireland (the)']:
1465
- return 'GB';
1466
- case CountryCode['United States Minor Outlying Islands (the)']:
1467
- return 'UM';
1468
- case CountryCode['United States of America (the)']:
1469
- return 'US';
1470
- case CountryCode.Uruguay:
1471
- return 'UY';
1472
- case CountryCode.Uzbekistan:
1473
- return 'UZ';
1474
- case CountryCode.Vanuatu:
1475
- return 'VU';
1476
- case CountryCode['Venezuela (Bolivarian Republic of)']:
1477
- return 'VE';
1478
- case CountryCode['Viet Nam']:
1479
- return 'VN';
1480
- case CountryCode['Virgin Islands (British)']:
1481
- return 'VG';
1482
- case CountryCode['Virgin Islands (U.S.)']:
1483
- return 'VI';
1484
- case CountryCode['Wallis and Futuna']:
1485
- return 'WF';
1486
- case CountryCode['Western Sahara']:
1487
- return 'EH';
1488
- case CountryCode.Yemen:
1489
- return 'YE';
1490
- case CountryCode.Zambia:
1491
- return 'ZM';
1492
- case CountryCode.Zimbabwe:
1493
- return 'ZW';
1494
- default:
1495
- throw new Error(`Unsupported country code: ${countryCode}`);
751
+ const countryCodeToGreenInvoiceMap: Partial<Record<CountryCode, GreenInvoiceCountry>> = {
752
+ [CountryCode.Afghanistan]: 'AF',
753
+ [CountryCode['Åland Islands']]: 'AX',
754
+ [CountryCode.Albania]: 'AL',
755
+ [CountryCode.Algeria]: 'DZ',
756
+ [CountryCode['American Samoa']]: 'AS',
757
+ [CountryCode.Andorra]: 'AD',
758
+ [CountryCode.Angola]: 'AO',
759
+ [CountryCode.Anguilla]: 'AI',
760
+ [CountryCode.Antarctica]: 'AQ',
761
+ [CountryCode['Antigua and Barbuda']]: 'AG',
762
+ [CountryCode.Argentina]: 'AR',
763
+ [CountryCode.Armenia]: 'AM',
764
+ [CountryCode.Aruba]: 'AW',
765
+ [CountryCode.Australia]: 'AU',
766
+ [CountryCode.Austria]: 'AT',
767
+ [CountryCode.Azerbaijan]: 'AZ',
768
+ [CountryCode['Bahamas (the)']]: 'BS',
769
+ [CountryCode.Bahrain]: 'BH',
770
+ [CountryCode.Bangladesh]: 'BD',
771
+ [CountryCode.Barbados]: 'BB',
772
+ [CountryCode.Belarus]: 'BY',
773
+ [CountryCode.Belgium]: 'BE',
774
+ [CountryCode.Belize]: 'BZ',
775
+ [CountryCode.Benin]: 'BJ',
776
+ [CountryCode.Bermuda]: 'BM',
777
+ [CountryCode.Bhutan]: 'BT',
778
+ [CountryCode['Bolivia (Plurinational State of)']]: 'BO',
779
+ [CountryCode['Bonaire, Sint Eustatius and Saba']]: 'BQ',
780
+ [CountryCode['Bosnia and Herzegovina']]: 'BA',
781
+ [CountryCode.Botswana]: 'BW',
782
+ [CountryCode['Bouvet Island']]: 'BV',
783
+ [CountryCode.Brazil]: 'BR',
784
+ [CountryCode['British Indian Ocean Territory (the)']]: 'IO',
785
+ [CountryCode['Brunei Darussalam']]: 'BN',
786
+ [CountryCode.Bulgaria]: 'BG',
787
+ [CountryCode['Burkina Faso']]: 'BF',
788
+ [CountryCode.Burundi]: 'BI',
789
+ [CountryCode['Cabo Verde']]: 'CV',
790
+ [CountryCode.Cambodia]: 'KH',
791
+ [CountryCode.Cameroon]: 'CM',
792
+ [CountryCode.Canada]: 'CA',
793
+ [CountryCode['Cayman Islands (the)']]: 'KY',
794
+ [CountryCode['Central African Republic (the)']]: 'CF',
795
+ [CountryCode.Chad]: 'TD',
796
+ [CountryCode.Chile]: 'CL',
797
+ [CountryCode.China]: 'CN',
798
+ [CountryCode['Christmas Island']]: 'CX',
799
+ [CountryCode['Cocos (Keeling) Islands (the)']]: 'CC',
800
+ [CountryCode.Colombia]: 'CO',
801
+ [CountryCode['Comoros (the)']]: 'KM',
802
+ [CountryCode['Congo (the Democratic Republic of the)']]: 'CD',
803
+ [CountryCode['Congo (the)']]: 'CG',
804
+ [CountryCode['Cook Islands (the)']]: 'CK',
805
+ [CountryCode['Costa Rica']]: 'CR',
806
+ [CountryCode.Croatia]: 'HR',
807
+ [CountryCode.Cuba]: 'CU',
808
+ [CountryCode.Curaçao]: 'CW',
809
+ [CountryCode.Cyprus]: 'CY',
810
+ [CountryCode.Czechia]: 'CZ',
811
+ [CountryCode["Côte d'Ivoire"]]: 'CI',
812
+ [CountryCode.Denmark]: 'DK',
813
+ [CountryCode.Djibouti]: 'DJ',
814
+ [CountryCode.Dominica]: 'DM',
815
+ [CountryCode['Dominican Republic (the)']]: 'DO',
816
+ [CountryCode.Ecuador]: 'EC',
817
+ [CountryCode.Egypt]: 'EG',
818
+ [CountryCode['El Salvador']]: 'SV',
819
+ [CountryCode['Equatorial Guinea']]: 'GQ',
820
+ [CountryCode.Eritrea]: 'ER',
821
+ [CountryCode.Estonia]: 'EE',
822
+ [CountryCode.Eswatini]: 'SZ',
823
+ [CountryCode.Ethiopia]: 'ET',
824
+ [CountryCode['Falkland Islands (the) [Malvinas]']]: 'FK',
825
+ [CountryCode['Faroe Islands (the)']]: 'FO',
826
+ [CountryCode.Fiji]: 'FJ',
827
+ [CountryCode.Finland]: 'FI',
828
+ [CountryCode.France]: 'FR',
829
+ [CountryCode['French Guiana']]: 'GF',
830
+ [CountryCode['French Polynesia']]: 'PF',
831
+ [CountryCode['French Southern Territories (the)']]: 'TF',
832
+ [CountryCode.Gabon]: 'GA',
833
+ [CountryCode['Gambia (the)']]: 'GM',
834
+ [CountryCode.Georgia]: 'GE',
835
+ [CountryCode.Germany]: 'DE',
836
+ [CountryCode.Ghana]: 'GH',
837
+ [CountryCode.Gibraltar]: 'GI',
838
+ [CountryCode.Greece]: 'GR',
839
+ [CountryCode.Greenland]: 'GL',
840
+ [CountryCode.Grenada]: 'GD',
841
+ [CountryCode.Guadeloupe]: 'GP',
842
+ [CountryCode.Guam]: 'GU',
843
+ [CountryCode.Guatemala]: 'GT',
844
+ [CountryCode.Guernsey]: 'GG',
845
+ [CountryCode.Guinea]: 'GN',
846
+ [CountryCode['Guinea-Bissau']]: 'GW',
847
+ [CountryCode.Guyana]: 'GY',
848
+ [CountryCode.Haiti]: 'HT',
849
+ [CountryCode['Heard Island and McDonald Islands']]: 'HM',
850
+ [CountryCode['Holy See (the)']]: 'VA',
851
+ [CountryCode.Honduras]: 'HN',
852
+ [CountryCode['Hong Kong']]: 'HK',
853
+ [CountryCode.Hungary]: 'HU',
854
+ [CountryCode.Iceland]: 'IS',
855
+ [CountryCode.India]: 'IN',
856
+ [CountryCode.Indonesia]: 'ID',
857
+ [CountryCode['Iran (Islamic Republic of)']]: 'IR',
858
+ [CountryCode.Iraq]: 'IQ',
859
+ [CountryCode.Ireland]: 'IE',
860
+ [CountryCode['Isle of Man']]: 'IM',
861
+ [CountryCode.Israel]: 'IL',
862
+ [CountryCode.Italy]: 'IT',
863
+ [CountryCode.Jamaica]: 'JM',
864
+ [CountryCode.Japan]: 'JP',
865
+ [CountryCode.Jersey]: 'JE',
866
+ [CountryCode.Jordan]: 'JO',
867
+ [CountryCode.Kazakhstan]: 'KZ',
868
+ [CountryCode.Kenya]: 'KE',
869
+ [CountryCode.Kiribati]: 'KI',
870
+ [CountryCode["Korea (the Democratic People's Republic of)"]]: 'KP',
871
+ [CountryCode['Korea (the Republic of)']]: 'KR',
872
+ [CountryCode.Kuwait]: 'KW',
873
+ [CountryCode.Kyrgyzstan]: 'KG',
874
+ [CountryCode["Lao People's Democratic Republic (the)"]]: 'LA',
875
+ [CountryCode.Latvia]: 'LV',
876
+ [CountryCode.Lebanon]: 'LB',
877
+ [CountryCode.Lesotho]: 'LS',
878
+ [CountryCode.Liberia]: 'LR',
879
+ [CountryCode.Libya]: 'LY',
880
+ [CountryCode.Liechtenstein]: 'LI',
881
+ [CountryCode.Lithuania]: 'LT',
882
+ [CountryCode.Luxembourg]: 'LU',
883
+ [CountryCode.Macao]: 'MO',
884
+ [CountryCode.Madagascar]: 'MG',
885
+ [CountryCode.Malawi]: 'MW',
886
+ [CountryCode.Malaysia]: 'MY',
887
+ [CountryCode.Maldives]: 'MV',
888
+ [CountryCode.Mali]: 'ML',
889
+ [CountryCode.Malta]: 'MT',
890
+ [CountryCode['Marshall Islands (the)']]: 'MH',
891
+ [CountryCode.Martinique]: 'MQ',
892
+ [CountryCode.Mauritania]: 'MR',
893
+ [CountryCode.Mauritius]: 'MU',
894
+ [CountryCode.Mayotte]: 'YT',
895
+ [CountryCode.Mexico]: 'MX',
896
+ [CountryCode['Micronesia (Federated States of)']]: 'FM',
897
+ [CountryCode['Moldova (the Republic of)']]: 'MD',
898
+ [CountryCode.Monaco]: 'MC',
899
+ [CountryCode.Mongolia]: 'MN',
900
+ [CountryCode.Montenegro]: 'ME',
901
+ [CountryCode.Montserrat]: 'MS',
902
+ [CountryCode.Morocco]: 'MA',
903
+ [CountryCode.Mozambique]: 'MZ',
904
+ [CountryCode.Myanmar]: 'MM',
905
+ [CountryCode.Namibia]: 'NA',
906
+ [CountryCode.Nauru]: 'NR',
907
+ [CountryCode.Nepal]: 'NP',
908
+ [CountryCode['Netherlands (the)']]: 'NL',
909
+ [CountryCode['New Caledonia']]: 'NC',
910
+ [CountryCode['New Zealand']]: 'NZ',
911
+ [CountryCode.Nicaragua]: 'NI',
912
+ [CountryCode['Niger (the)']]: 'NE',
913
+ [CountryCode.Nigeria]: 'NG',
914
+ [CountryCode.Niue]: 'NU',
915
+ [CountryCode['Norfolk Island']]: 'NF',
916
+ [CountryCode['Northern Mariana Islands (the)']]: 'MP',
917
+ [CountryCode.Norway]: 'NO',
918
+ [CountryCode.Oman]: 'OM',
919
+ [CountryCode.Pakistan]: 'PK',
920
+ [CountryCode.Palau]: 'PW',
921
+ [CountryCode['Palestine, State of']]: 'PS',
922
+ [CountryCode.Panama]: 'PA',
923
+ [CountryCode['Papua New Guinea']]: 'PG',
924
+ [CountryCode.Paraguay]: 'PY',
925
+ [CountryCode.Peru]: 'PE',
926
+ [CountryCode['Philippines (the)']]: 'PH',
927
+ [CountryCode.Pitcairn]: 'PN',
928
+ [CountryCode.Poland]: 'PL',
929
+ [CountryCode.Portugal]: 'PT',
930
+ [CountryCode['Puerto Rico']]: 'PR',
931
+ [CountryCode.Qatar]: 'QA',
932
+ [CountryCode['Republic of North Macedonia']]: 'MK',
933
+ [CountryCode.Romania]: 'RO',
934
+ [CountryCode['Russian Federation (the)']]: 'RU',
935
+ [CountryCode.Rwanda]: 'RW',
936
+ [CountryCode.Réunion]: 'RE',
937
+ [CountryCode['Saint Barthélemy']]: 'BL',
938
+ [CountryCode['Saint Helena, Ascension and Tristan da Cunha']]: 'SH',
939
+ [CountryCode['Saint Kitts and Nevis']]: 'KN',
940
+ [CountryCode['Saint Lucia']]: 'LC',
941
+ [CountryCode['Saint Martin (French part)']]: 'MF',
942
+ [CountryCode['Saint Pierre and Miquelon']]: 'PM',
943
+ [CountryCode['Saint Vincent and the Grenadines']]: 'VC',
944
+ [CountryCode.Samoa]: 'WS',
945
+ [CountryCode['San Marino']]: 'SM',
946
+ [CountryCode['Sao Tome and Principe']]: 'ST',
947
+ [CountryCode['Saudi Arabia']]: 'SA',
948
+ [CountryCode.Senegal]: 'SN',
949
+ [CountryCode.Serbia]: 'RS',
950
+ [CountryCode.Seychelles]: 'SC',
951
+ [CountryCode['Sierra Leone']]: 'SL',
952
+ [CountryCode.Singapore]: 'SG',
953
+ [CountryCode['Sint Maarten (Dutch part)']]: 'SX',
954
+ [CountryCode.Slovakia]: 'SK',
955
+ [CountryCode.Slovenia]: 'SI',
956
+ [CountryCode['Solomon Islands']]: 'SB',
957
+ [CountryCode.Somalia]: 'SO',
958
+ [CountryCode['South Africa']]: 'ZA',
959
+ [CountryCode['South Georgia and the South Sandwich Islands']]: 'GS',
960
+ [CountryCode['South Sudan']]: 'SS',
961
+ [CountryCode.Spain]: 'ES',
962
+ [CountryCode['Sri Lanka']]: 'LK',
963
+ [CountryCode['Sudan (the)']]: 'SD',
964
+ [CountryCode.Suriname]: 'SR',
965
+ [CountryCode['Svalbard and Jan Mayen']]: 'SJ',
966
+ [CountryCode.Sweden]: 'SE',
967
+ [CountryCode.Switzerland]: 'CH',
968
+ [CountryCode['Syrian Arab Republic']]: 'SY',
969
+ [CountryCode['Taiwan (Province of China)']]: 'TW',
970
+ [CountryCode.Tajikistan]: 'TJ',
971
+ [CountryCode['Tanzania, United Republic of']]: 'TZ',
972
+ [CountryCode.Thailand]: 'TH',
973
+ [CountryCode['Timor-Leste']]: 'TL',
974
+ [CountryCode.Togo]: 'TG',
975
+ [CountryCode.Tokelau]: 'TK',
976
+ [CountryCode.Tonga]: 'TO',
977
+ [CountryCode['Trinidad and Tobago']]: 'TT',
978
+ [CountryCode.Tunisia]: 'TN',
979
+ [CountryCode.Turkey]: 'TR',
980
+ [CountryCode.Turkmenistan]: 'TM',
981
+ [CountryCode['Turks and Caicos Islands (the)']]: 'TC',
982
+ [CountryCode.Tuvalu]: 'TV',
983
+ [CountryCode.Uganda]: 'UG',
984
+ [CountryCode.Ukraine]: 'UA',
985
+ [CountryCode['United Arab Emirates (the)']]: 'AE',
986
+ [CountryCode['United Kingdom of Great Britain and Northern Ireland (the)']]: 'GB',
987
+ [CountryCode['United States Minor Outlying Islands (the)']]: 'UM',
988
+ [CountryCode['United States of America (the)']]: 'US',
989
+ [CountryCode.Uruguay]: 'UY',
990
+ [CountryCode.Uzbekistan]: 'UZ',
991
+ [CountryCode.Vanuatu]: 'VU',
992
+ [CountryCode['Venezuela (Bolivarian Republic of)']]: 'VE',
993
+ [CountryCode['Viet Nam']]: 'VN',
994
+ [CountryCode['Virgin Islands (British)']]: 'VG',
995
+ [CountryCode['Virgin Islands (U.S.)']]: 'VI',
996
+ [CountryCode['Wallis and Futuna']]: 'WF',
997
+ [CountryCode['Western Sahara']]: 'EH',
998
+ [CountryCode.Yemen]: 'YE',
999
+ [CountryCode.Zambia]: 'ZM',
1000
+ [CountryCode.Zimbabwe]: 'ZW',
1001
+ };
1002
+
1003
+ const greenInvoiceCountry = countryCodeToGreenInvoiceMap[countryCode];
1004
+ if (greenInvoiceCountry) {
1005
+ return greenInvoiceCountry;
1496
1006
  }
1007
+ throw new Error(`Unsupported country code: ${countryCode}`);
1497
1008
  }
1498
1009
 
1499
1010
  export function greenInvoiceToDocumentStatus(greenInvoiceStatus: number): document_status {