@delopay/sdk 0.162.0 → 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/index.cjs CHANGED
@@ -67,6 +67,7 @@ __export(index_exports, {
67
67
  DelopayAuthenticationError: () => DelopayAuthenticationError,
68
68
  DelopayError: () => DelopayError,
69
69
  Export: () => Export,
70
+ ExternalRecords: () => ExternalRecords,
70
71
  FeatureMatrix: () => FeatureMatrix,
71
72
  FeeProgramBuilder: () => FeeProgramBuilder,
72
73
  Files: () => Files,
@@ -91,6 +92,7 @@ __export(index_exports, {
91
92
  PAYPAL_LABEL_STYLES: () => PAYPAL_LABEL_STYLES,
92
93
  PaypalDisputes: () => PaypalDisputes,
93
94
  ProcessorCosts: () => ProcessorCosts,
95
+ Products: () => Products,
94
96
  RTL_CHECKOUT_LOCALES: () => RTL_CHECKOUT_LOCALES,
95
97
  Regions: () => Regions,
96
98
  Risk: () => Risk,
@@ -4669,6 +4671,142 @@ var CostRules = class {
4669
4671
  }
4670
4672
  };
4671
4673
 
4674
+ // src/resources/externalRecords.ts
4675
+ var ExternalRecords = class {
4676
+ constructor(request) {
4677
+ this.request = request;
4678
+ }
4679
+ /**
4680
+ * Record one out-of-band transition.
4681
+ * `POST /external-records`
4682
+ *
4683
+ * Which kinds a deployment answers for depends on the payment's connector
4684
+ * and on which arms are live: an arm that is not served answers `501`, which
4685
+ * is a statement about this rail rather than about the request.
4686
+ *
4687
+ * @param params - What happened, and why it is being recorded.
4688
+ */
4689
+ async create(params) {
4690
+ return this.request("POST", "/external-records", { body: params });
4691
+ }
4692
+ };
4693
+
4694
+ // src/resources/products.ts
4695
+ var Products = class {
4696
+ constructor(request) {
4697
+ this.request = request;
4698
+ }
4699
+ /** The shop scope every route here takes, as the backend expects it. */
4700
+ scoped(profileId, options) {
4701
+ return { ...options, headers: { "X-Profile-Id": profileId, ...options?.headers } };
4702
+ }
4703
+ /**
4704
+ * Create a product together with its prices.
4705
+ * `POST /products`
4706
+ *
4707
+ * @param params - The product, with at least one price.
4708
+ * @param profileId - The shop the product belongs to.
4709
+ */
4710
+ async create(params, profileId, options) {
4711
+ return this.request("POST", "/products", {
4712
+ body: params,
4713
+ ...this.scoped(profileId, options)
4714
+ });
4715
+ }
4716
+ /**
4717
+ * One page of the shop's catalogue.
4718
+ * `GET /products/list`
4719
+ *
4720
+ * Archived products are returned too unless `status` narrows them away —
4721
+ * they are what past charges refer to.
4722
+ */
4723
+ async list(params, profileId, options) {
4724
+ return this.request("GET", "/products/list", {
4725
+ query: params === void 0 ? void 0 : { ...params },
4726
+ ...this.scoped(profileId, options)
4727
+ });
4728
+ }
4729
+ /**
4730
+ * Retrieve one product with its prices.
4731
+ * `GET /products/{product_id}`
4732
+ */
4733
+ async retrieve(productId, profileId, options) {
4734
+ return this.request("GET", `/products/${encodeURIComponent(productId)}`, {
4735
+ ...this.scoped(profileId, options)
4736
+ });
4737
+ }
4738
+ /**
4739
+ * Change a product's name, description or metadata.
4740
+ * `POST /products/{product_id}`
4741
+ *
4742
+ * Its kind and its prices are not editable here — see the class note.
4743
+ */
4744
+ async update(productId, params, profileId, options) {
4745
+ return this.request("POST", `/products/${encodeURIComponent(productId)}`, {
4746
+ body: params,
4747
+ ...this.scoped(profileId, options)
4748
+ });
4749
+ }
4750
+ /**
4751
+ * Take a product off sale.
4752
+ * `POST /products/{product_id}/archive`
4753
+ *
4754
+ * It stays readable and keeps its prices: a payment made against it has to
4755
+ * remain explicable after it is withdrawn.
4756
+ */
4757
+ async archive(productId, profileId, options) {
4758
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/archive`, {
4759
+ ...this.scoped(profileId, options)
4760
+ });
4761
+ }
4762
+ /**
4763
+ * Put an archived product back on sale.
4764
+ * `POST /products/{product_id}/restore`
4765
+ */
4766
+ async restore(productId, profileId, options) {
4767
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/restore`, {
4768
+ ...this.scoped(profileId, options)
4769
+ });
4770
+ }
4771
+ /**
4772
+ * Add a price to an existing product.
4773
+ * `POST /products/{product_id}/prices`
4774
+ *
4775
+ * This is how a price changes: the new figure is added and the old price is
4776
+ * archived, so both remain readable.
4777
+ */
4778
+ async addPrice(productId, params, profileId, options) {
4779
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/prices`, {
4780
+ body: params,
4781
+ ...this.scoped(profileId, options)
4782
+ });
4783
+ }
4784
+ /**
4785
+ * Change a price's label, its default flag or its metadata.
4786
+ * `POST /products/{product_id}/prices/{price_id}`
4787
+ *
4788
+ * Not its amount, its currency or its interval: see the class note.
4789
+ */
4790
+ async updatePrice(productId, priceId, params, profileId, options) {
4791
+ return this.request(
4792
+ "POST",
4793
+ `/products/${encodeURIComponent(productId)}/prices/${encodeURIComponent(priceId)}`,
4794
+ { body: params, ...this.scoped(profileId, options) }
4795
+ );
4796
+ }
4797
+ /**
4798
+ * Take one price off sale, leaving the product on it.
4799
+ * `POST /products/{product_id}/prices/{price_id}/archive`
4800
+ */
4801
+ async archivePrice(productId, priceId, profileId, options) {
4802
+ return this.request(
4803
+ "POST",
4804
+ `/products/${encodeURIComponent(productId)}/prices/${encodeURIComponent(priceId)}/archive`,
4805
+ { ...this.scoped(profileId, options) }
4806
+ );
4807
+ }
4808
+ };
4809
+
4672
4810
  // src/resources/processorCosts.ts
4673
4811
  var ProcessorCosts = class {
4674
4812
  constructor(request) {
@@ -5690,6 +5828,8 @@ var Delopay = class {
5690
5828
  this.availabilityOverrides = new AvailabilityOverrides(request);
5691
5829
  this.sellToRestrictions = new SellToRestrictions(request);
5692
5830
  this.costRules = new CostRules(request);
5831
+ this.externalRecords = new ExternalRecords(request);
5832
+ this.products = new Products(request);
5693
5833
  this.processorCosts = new ProcessorCosts(request);
5694
5834
  this.checkoutMethods = new CheckoutMethods(request);
5695
5835
  this.analytics = new Analytics(request);
@@ -9323,6 +9463,7 @@ var encodeNativePanes = encodePanes;
9323
9463
  DelopayAuthenticationError,
9324
9464
  DelopayError,
9325
9465
  Export,
9466
+ ExternalRecords,
9326
9467
  FeatureMatrix,
9327
9468
  FeeProgramBuilder,
9328
9469
  Files,
@@ -9347,6 +9488,7 @@ var encodeNativePanes = encodePanes;
9347
9488
  PAYPAL_LABEL_STYLES,
9348
9489
  PaypalDisputes,
9349
9490
  ProcessorCosts,
9491
+ Products,
9350
9492
  RTL_CHECKOUT_LOCALES,
9351
9493
  Regions,
9352
9494
  Risk,