@delopay/sdk 0.162.1 → 0.163.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/internal.cjs CHANGED
@@ -77,6 +77,7 @@ __export(internal_exports, {
77
77
  DelopayInternal: () => DelopayInternal,
78
78
  Diagnostic: () => Diagnostic,
79
79
  Export: () => Export,
80
+ ExternalRecords: () => ExternalRecords,
80
81
  FeatureMatrix: () => FeatureMatrix,
81
82
  FeeProgramBuilder: () => FeeProgramBuilder,
82
83
  Files: () => Files,
@@ -104,6 +105,7 @@ __export(internal_exports, {
104
105
  PlatformBilling: () => PlatformBilling,
105
106
  PlatformFees: () => PlatformFees,
106
107
  ProcessorCosts: () => ProcessorCosts,
108
+ Products: () => Products,
107
109
  RTL_CHECKOUT_LOCALES: () => RTL_CHECKOUT_LOCALES,
108
110
  Regions: () => Regions,
109
111
  Risk: () => Risk,
@@ -4682,6 +4684,142 @@ var CostRules = class {
4682
4684
  }
4683
4685
  };
4684
4686
 
4687
+ // src/resources/externalRecords.ts
4688
+ var ExternalRecords = class {
4689
+ constructor(request) {
4690
+ this.request = request;
4691
+ }
4692
+ /**
4693
+ * Record one out-of-band transition.
4694
+ * `POST /external-records`
4695
+ *
4696
+ * Which kinds a deployment answers for depends on the payment's connector
4697
+ * and on which arms are live: an arm that is not served answers `501`, which
4698
+ * is a statement about this rail rather than about the request.
4699
+ *
4700
+ * @param params - What happened, and why it is being recorded.
4701
+ */
4702
+ async create(params) {
4703
+ return this.request("POST", "/external-records", { body: params });
4704
+ }
4705
+ };
4706
+
4707
+ // src/resources/products.ts
4708
+ var Products = class {
4709
+ constructor(request) {
4710
+ this.request = request;
4711
+ }
4712
+ /** The shop scope every route here takes, as the backend expects it. */
4713
+ scoped(profileId, options) {
4714
+ return { ...options, headers: { "X-Profile-Id": profileId, ...options?.headers } };
4715
+ }
4716
+ /**
4717
+ * Create a product together with its prices.
4718
+ * `POST /products`
4719
+ *
4720
+ * @param params - The product, with at least one price.
4721
+ * @param profileId - The shop the product belongs to.
4722
+ */
4723
+ async create(params, profileId, options) {
4724
+ return this.request("POST", "/products", {
4725
+ body: params,
4726
+ ...this.scoped(profileId, options)
4727
+ });
4728
+ }
4729
+ /**
4730
+ * One page of the shop's catalogue.
4731
+ * `GET /products/list`
4732
+ *
4733
+ * Archived products are returned too unless `status` narrows them away —
4734
+ * they are what past charges refer to.
4735
+ */
4736
+ async list(params, profileId, options) {
4737
+ return this.request("GET", "/products/list", {
4738
+ query: params === void 0 ? void 0 : { ...params },
4739
+ ...this.scoped(profileId, options)
4740
+ });
4741
+ }
4742
+ /**
4743
+ * Retrieve one product with its prices.
4744
+ * `GET /products/{product_id}`
4745
+ */
4746
+ async retrieve(productId, profileId, options) {
4747
+ return this.request("GET", `/products/${encodeURIComponent(productId)}`, {
4748
+ ...this.scoped(profileId, options)
4749
+ });
4750
+ }
4751
+ /**
4752
+ * Change a product's name, description or metadata.
4753
+ * `POST /products/{product_id}`
4754
+ *
4755
+ * Its kind and its prices are not editable here — see the class note.
4756
+ */
4757
+ async update(productId, params, profileId, options) {
4758
+ return this.request("POST", `/products/${encodeURIComponent(productId)}`, {
4759
+ body: params,
4760
+ ...this.scoped(profileId, options)
4761
+ });
4762
+ }
4763
+ /**
4764
+ * Take a product off sale.
4765
+ * `POST /products/{product_id}/archive`
4766
+ *
4767
+ * It stays readable and keeps its prices: a payment made against it has to
4768
+ * remain explicable after it is withdrawn.
4769
+ */
4770
+ async archive(productId, profileId, options) {
4771
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/archive`, {
4772
+ ...this.scoped(profileId, options)
4773
+ });
4774
+ }
4775
+ /**
4776
+ * Put an archived product back on sale.
4777
+ * `POST /products/{product_id}/restore`
4778
+ */
4779
+ async restore(productId, profileId, options) {
4780
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/restore`, {
4781
+ ...this.scoped(profileId, options)
4782
+ });
4783
+ }
4784
+ /**
4785
+ * Add a price to an existing product.
4786
+ * `POST /products/{product_id}/prices`
4787
+ *
4788
+ * This is how a price changes: the new figure is added and the old price is
4789
+ * archived, so both remain readable.
4790
+ */
4791
+ async addPrice(productId, params, profileId, options) {
4792
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/prices`, {
4793
+ body: params,
4794
+ ...this.scoped(profileId, options)
4795
+ });
4796
+ }
4797
+ /**
4798
+ * Change a price's label, its default flag or its metadata.
4799
+ * `POST /products/{product_id}/prices/{price_id}`
4800
+ *
4801
+ * Not its amount, its currency or its interval: see the class note.
4802
+ */
4803
+ async updatePrice(productId, priceId, params, profileId, options) {
4804
+ return this.request(
4805
+ "POST",
4806
+ `/products/${encodeURIComponent(productId)}/prices/${encodeURIComponent(priceId)}`,
4807
+ { body: params, ...this.scoped(profileId, options) }
4808
+ );
4809
+ }
4810
+ /**
4811
+ * Take one price off sale, leaving the product on it.
4812
+ * `POST /products/{product_id}/prices/{price_id}/archive`
4813
+ */
4814
+ async archivePrice(productId, priceId, profileId, options) {
4815
+ return this.request(
4816
+ "POST",
4817
+ `/products/${encodeURIComponent(productId)}/prices/${encodeURIComponent(priceId)}/archive`,
4818
+ { ...this.scoped(profileId, options) }
4819
+ );
4820
+ }
4821
+ };
4822
+
4685
4823
  // src/resources/processorCosts.ts
4686
4824
  var ProcessorCosts = class {
4687
4825
  constructor(request) {
@@ -5703,6 +5841,8 @@ var Delopay = class {
5703
5841
  this.availabilityOverrides = new AvailabilityOverrides(request);
5704
5842
  this.sellToRestrictions = new SellToRestrictions(request);
5705
5843
  this.costRules = new CostRules(request);
5844
+ this.externalRecords = new ExternalRecords(request);
5845
+ this.products = new Products(request);
5706
5846
  this.processorCosts = new ProcessorCosts(request);
5707
5847
  this.checkoutMethods = new CheckoutMethods(request);
5708
5848
  this.analytics = new Analytics(request);
@@ -10750,6 +10890,7 @@ var DelopayInternal = class extends Delopay {
10750
10890
  DelopayInternal,
10751
10891
  Diagnostic,
10752
10892
  Export,
10893
+ ExternalRecords,
10753
10894
  FeatureMatrix,
10754
10895
  FeeProgramBuilder,
10755
10896
  Files,
@@ -10777,6 +10918,7 @@ var DelopayInternal = class extends Delopay {
10777
10918
  PlatformBilling,
10778
10919
  PlatformFees,
10779
10920
  ProcessorCosts,
10921
+ Products,
10780
10922
  RTL_CHECKOUT_LOCALES,
10781
10923
  Regions,
10782
10924
  Risk,