@innvoid/getmarket-sdk 0.2.6 → 0.2.8

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.
@@ -598,8 +598,43 @@ function createResClient() {
598
598
  apiPrefix: env.apiPrefix,
599
599
  path: "/refs/varieties"
600
600
  });
601
+ const resources = createBulkRefsClient({
602
+ namespace: "res:resource",
603
+ baseURL: env.baseURL,
604
+ apiPrefix: env.apiPrefix,
605
+ path: "/refs/resources"
606
+ });
607
+ const categories = createBulkRefsClient({
608
+ namespace: "res:category",
609
+ baseURL: env.baseURL,
610
+ apiPrefix: env.apiPrefix,
611
+ path: "/refs/categories"
612
+ });
613
+ const attributes = createBulkRefsClient({
614
+ namespace: "res:attribute",
615
+ baseURL: env.baseURL,
616
+ apiPrefix: env.apiPrefix,
617
+ path: "/refs/attributes"
618
+ });
619
+ const attributeOptions = createBulkRefsClient({
620
+ namespace: "res:attribute_option",
621
+ baseURL: env.baseURL,
622
+ apiPrefix: env.apiPrefix,
623
+ path: "/refs/attribute-options"
624
+ });
625
+ const attributeValues = createBulkRefsClient({
626
+ namespace: "res:attribute_value",
627
+ baseURL: env.baseURL,
628
+ apiPrefix: env.apiPrefix,
629
+ path: "/refs/attribute-values"
630
+ });
601
631
  return {
602
- varietiesRefs: (uids, opts) => varieties.bulkRefs(uids, opts)
632
+ varietiesRefs: (uids, opts) => varieties.bulkRefs(uids, opts),
633
+ resourcesRefs: (uids, opts) => resources.bulkRefs(uids, opts),
634
+ categoriesRefs: (uids, opts) => categories.bulkRefs(uids, opts),
635
+ attributesRefs: (uids, opts) => attributes.bulkRefs(uids, opts),
636
+ attributeOptionsRefs: (uids, opts) => attributeOptions.bulkRefs(uids, opts),
637
+ attributeValuesRefs: (uids, opts) => attributeValues.bulkRefs(uids, opts)
603
638
  };
604
639
  }
605
640
 
@@ -624,10 +659,31 @@ function createMdClient() {
624
659
  apiPrefix: env.apiPrefix,
625
660
  path: "/refs/countries"
626
661
  });
662
+ const currencies = createBulkRefsClient({
663
+ namespace: "md:currency",
664
+ baseURL: env.baseURL,
665
+ apiPrefix: env.apiPrefix,
666
+ path: "/refs/currencies"
667
+ });
668
+ const regions = createBulkRefsClient({
669
+ namespace: "md:region",
670
+ baseURL: env.baseURL,
671
+ apiPrefix: env.apiPrefix,
672
+ path: "/refs/regions"
673
+ });
674
+ const communes = createBulkRefsClient({
675
+ namespace: "md:commune",
676
+ baseURL: env.baseURL,
677
+ apiPrefix: env.apiPrefix,
678
+ path: "/refs/communes"
679
+ });
627
680
  return {
628
681
  measuresRefs: (uids, opts) => measures.bulkRefs(uids, opts),
629
682
  measureTypesRefs: (uids, opts) => measureTypes.bulkRefs(uids, opts),
630
- countriesRefs: (uids, opts) => countries.bulkRefs(uids, opts)
683
+ countriesRefs: (uids, opts) => countries.bulkRefs(uids, opts),
684
+ currenciesRefs: (uids, opts) => currencies.bulkRefs(uids, opts),
685
+ regionsRefs: (uids, opts) => regions.bulkRefs(uids, opts),
686
+ communesRefs: (uids, opts) => communes.bulkRefs(uids, opts)
631
687
  };
632
688
  }
633
689
 
@@ -648,11 +704,11 @@ function createFisClient() {
648
704
  baseURL: `${env.baseURL}${env.apiPrefix}`,
649
705
  timeoutMs: 8e3
650
706
  });
651
- const taxes = createBulkRefsClient({
652
- namespace: "fis:tax",
707
+ const profiles = createBulkRefsClient({
708
+ namespace: "fis:profile",
653
709
  baseURL: env.baseURL,
654
710
  apiPrefix: env.apiPrefix,
655
- path: "/refs/taxes"
711
+ path: "/refs/profiles"
656
712
  });
657
713
  const documents = createBulkRefsClient({
658
714
  namespace: "fis:document",
@@ -660,77 +716,113 @@ function createFisClient() {
660
716
  apiPrefix: env.apiPrefix,
661
717
  path: "/refs/documents"
662
718
  });
719
+ const snapshots = createBulkRefsClient({
720
+ namespace: "fis:snapshot",
721
+ baseURL: env.baseURL,
722
+ apiPrefix: env.apiPrefix,
723
+ path: "/refs/snapshots"
724
+ });
663
725
  const submissions = createBulkRefsClient({
664
726
  namespace: "fis:submission",
665
727
  baseURL: env.baseURL,
666
728
  apiPrefix: env.apiPrefix,
667
729
  path: "/refs/submissions"
668
730
  });
731
+ const folioPools = createBulkRefsClient({
732
+ namespace: "fis:folio_pool",
733
+ baseURL: env.baseURL,
734
+ apiPrefix: env.apiPrefix,
735
+ path: "/refs/folio-pools"
736
+ });
737
+ const taxRules = createBulkRefsClient({
738
+ namespace: "fis:tax_rule",
739
+ baseURL: env.baseURL,
740
+ apiPrefix: env.apiPrefix,
741
+ path: "/refs/tax-rules"
742
+ });
669
743
  return {
670
744
  // -----------------------------------------------------------------------
671
745
  // Bulk refs
672
746
  // -----------------------------------------------------------------------
673
- taxesRefs: (uids, opts) => taxes.bulkRefs(uids, opts),
747
+ profilesRefs: (uids, opts) => profiles.bulkRefs(uids, opts),
674
748
  documentsRefs: (uids, opts) => documents.bulkRefs(uids, opts),
749
+ snapshotsRefs: (uids, opts) => snapshots.bulkRefs(uids, opts),
675
750
  submissionsRefs: (uids, opts) => submissions.bulkRefs(uids, opts),
751
+ folioPoolsRefs: (uids, opts) => folioPools.bulkRefs(uids, opts),
752
+ taxRulesRefs: (uids, opts) => taxRules.bulkRefs(uids, opts),
676
753
  // -----------------------------------------------------------------------
677
754
  // Fiscal calculation / build / lifecycle
678
755
  // -----------------------------------------------------------------------
679
- calculate: async (body) => {
756
+ async calculate(body) {
680
757
  const { data } = await http.post("/calculate", body);
681
758
  return data;
682
759
  },
683
- buildDocument: async (body) => {
684
- const { data } = await http.post("/documents/build", body);
760
+ async calculateTaxes(body) {
761
+ const { data } = await http.post("/tax/calculate", body);
685
762
  return data;
686
763
  },
687
- signDocument: async (body) => {
688
- const { data } = await http.post("/documents/sign", body);
764
+ async buildDocument(body) {
765
+ const { data } = await http.post("/documents", body);
689
766
  return data;
690
767
  },
691
- submitDocument: async (body) => {
692
- const { data } = await http.post("/documents/submit", body);
768
+ async signDocument(body) {
769
+ const { data } = await http.post(
770
+ `/documents/${body.document_uid}/sign`,
771
+ body
772
+ );
773
+ return data;
774
+ },
775
+ async submitDocument(body) {
776
+ const { data } = await http.post(
777
+ `/documents/${body.document_uid}/submit`,
778
+ body
779
+ );
693
780
  return data;
694
781
  },
695
- cancelDocument: async (body) => {
696
- const { data } = await http.post("/documents/cancel", body);
782
+ async cancelDocument(body) {
783
+ const { data } = await http.post(
784
+ `/documents/${body.document_uid}/cancel`,
785
+ body
786
+ );
697
787
  return data;
698
788
  },
699
789
  // -----------------------------------------------------------------------
700
790
  // Folios / series
701
791
  // -----------------------------------------------------------------------
702
- reserveFolio: async (body) => {
792
+ async reserveFolio(body) {
703
793
  const { data } = await http.post("/folios/reserve", body);
704
794
  return data;
705
795
  },
706
- consumeFolio: async (body) => {
796
+ async consumeFolio(body) {
707
797
  const { data } = await http.post("/folios/consume", body);
708
798
  return data;
709
799
  },
710
800
  // -----------------------------------------------------------------------
711
801
  // Queries / detail
712
802
  // -----------------------------------------------------------------------
713
- queryDocuments: async (params) => {
714
- const { data } = await http.get("/documents", { params });
803
+ async queryDocuments(body) {
804
+ const { data } = await http.post("/documents/query", body);
715
805
  return data;
716
806
  },
717
- getDocumentByUid: async (uid) => {
807
+ async getDocumentByUid(uid) {
718
808
  const { data } = await http.get(`/documents/${uid}`);
719
809
  return data;
720
810
  },
721
- getSnapshotByUid: async (uid) => {
811
+ async getSnapshotByUid(uid) {
722
812
  const { data } = await http.get(`/snapshots/${uid}`);
723
813
  return data;
724
814
  },
725
- getSubmissionByUid: async (uid) => {
815
+ async getSubmissionByUid(uid) {
726
816
  const { data } = await http.get(`/submissions/${uid}`);
727
817
  return data;
728
818
  },
729
- getStatusEventsByDocumentUid: async (documentUid) => {
730
- const { data } = await http.get(`/documents/${documentUid}/status-events`);
819
+ async getStatusEventsByDocumentUid(documentUid) {
820
+ const { data } = await http.get(
821
+ `/documents/${documentUid}/status-events`
822
+ );
731
823
  return data;
732
824
  },
733
- retrySubmission: async (body) => {
825
+ async retrySubmission(body) {
734
826
  const { data } = await http.post("/submissions/retry", body);
735
827
  return data;
736
828
  }
@@ -786,25 +878,107 @@ function createPayClient() {
786
878
  baseURL: `${env.baseURL}${env.apiPrefix}`,
787
879
  timeoutMs: 8e3
788
880
  });
881
+ const intents = createBulkRefsClient({
882
+ namespace: "pay:intent",
883
+ baseURL: env.baseURL,
884
+ apiPrefix: env.apiPrefix,
885
+ path: "/refs/intents"
886
+ });
887
+ const attempts = createBulkRefsClient({
888
+ namespace: "pay:attempt",
889
+ baseURL: env.baseURL,
890
+ apiPrefix: env.apiPrefix,
891
+ path: "/refs/attempts"
892
+ });
893
+ const transactions = createBulkRefsClient({
894
+ namespace: "pay:transaction",
895
+ baseURL: env.baseURL,
896
+ apiPrefix: env.apiPrefix,
897
+ path: "/refs/transactions"
898
+ });
899
+ const refunds = createBulkRefsClient({
900
+ namespace: "pay:refund",
901
+ baseURL: env.baseURL,
902
+ apiPrefix: env.apiPrefix,
903
+ path: "/refs/refunds"
904
+ });
905
+ const allocations = createBulkRefsClient({
906
+ namespace: "pay:allocation",
907
+ baseURL: env.baseURL,
908
+ apiPrefix: env.apiPrefix,
909
+ path: "/refs/allocations"
910
+ });
911
+ const providerAccounts = createBulkRefsClient({
912
+ namespace: "pay:provider_account",
913
+ baseURL: env.baseURL,
914
+ apiPrefix: env.apiPrefix,
915
+ path: "/refs/provider-accounts"
916
+ });
917
+ const paymentMethods = createBulkRefsClient({
918
+ namespace: "pay:payment_method",
919
+ baseURL: env.baseURL,
920
+ apiPrefix: env.apiPrefix,
921
+ path: "/refs/payment-methods"
922
+ });
789
923
  return {
924
+ // -----------------------------------------------------------------------
925
+ // Payment intents
926
+ // -----------------------------------------------------------------------
790
927
  async createIntent(body) {
791
- const { data } = await http.post("/intents", body);
928
+ const { data } = await http.post("/payment-intents", body);
792
929
  return data;
793
930
  },
931
+ async getIntentByUid(uid) {
932
+ const { data } = await http.get(`/payment-intents/${uid}`);
933
+ return data;
934
+ },
935
+ async confirmIntent(body) {
936
+ const { data } = await http.post(
937
+ `/payment-intents/${body.intent_uid}/confirm`,
938
+ body
939
+ );
940
+ return data;
941
+ },
942
+ // -----------------------------------------------------------------------
943
+ // Attempts
944
+ // -----------------------------------------------------------------------
794
945
  async startAttempt(body) {
795
946
  const { data } = await http.post("/attempts", body);
796
947
  return data;
797
948
  },
949
+ // -----------------------------------------------------------------------
950
+ // Methods / availability
951
+ // -----------------------------------------------------------------------
798
952
  async getAvailableMethods(params) {
799
953
  const { data } = await http.get("/methods/available", {
800
954
  params
801
955
  });
802
956
  return data;
803
957
  },
804
- async getIntentByUid(uid) {
805
- const { data } = await http.get(`/intents/${uid}`);
958
+ // -----------------------------------------------------------------------
959
+ // Queries / allocations
960
+ // -----------------------------------------------------------------------
961
+ async queryPayments(body) {
962
+ const { data } = await http.post("/payments/query", body);
806
963
  return data;
807
- }
964
+ },
965
+ async getAllocationsByTarget(body) {
966
+ const { data } = await http.post(
967
+ "/allocations/by-target",
968
+ body
969
+ );
970
+ return data;
971
+ },
972
+ // -----------------------------------------------------------------------
973
+ // Bulk refs
974
+ // -----------------------------------------------------------------------
975
+ intentsRefs: (uids, opts) => intents.bulkRefs(uids, opts),
976
+ attemptsRefs: (uids, opts) => attempts.bulkRefs(uids, opts),
977
+ transactionsRefs: (uids, opts) => transactions.bulkRefs(uids, opts),
978
+ refundsRefs: (uids, opts) => refunds.bulkRefs(uids, opts),
979
+ allocationsRefs: (uids, opts) => allocations.bulkRefs(uids, opts),
980
+ providerAccountsRefs: (uids, opts) => providerAccounts.bulkRefs(uids, opts),
981
+ paymentMethodsRefs: (uids, opts) => paymentMethods.bulkRefs(uids, opts)
808
982
  };
809
983
  }
810
984
  // Annotate the CommonJS export names for ESM import in node: