@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.
@@ -4448,6 +4448,142 @@ var CostRules = class {
4448
4448
  }
4449
4449
  };
4450
4450
 
4451
+ // src/resources/externalRecords.ts
4452
+ var ExternalRecords = class {
4453
+ constructor(request) {
4454
+ this.request = request;
4455
+ }
4456
+ /**
4457
+ * Record one out-of-band transition.
4458
+ * `POST /external-records`
4459
+ *
4460
+ * Which kinds a deployment answers for depends on the payment's connector
4461
+ * and on which arms are live: an arm that is not served answers `501`, which
4462
+ * is a statement about this rail rather than about the request.
4463
+ *
4464
+ * @param params - What happened, and why it is being recorded.
4465
+ */
4466
+ async create(params) {
4467
+ return this.request("POST", "/external-records", { body: params });
4468
+ }
4469
+ };
4470
+
4471
+ // src/resources/products.ts
4472
+ var Products = class {
4473
+ constructor(request) {
4474
+ this.request = request;
4475
+ }
4476
+ /** The shop scope every route here takes, as the backend expects it. */
4477
+ scoped(profileId, options) {
4478
+ return { ...options, headers: { "X-Profile-Id": profileId, ...options?.headers } };
4479
+ }
4480
+ /**
4481
+ * Create a product together with its prices.
4482
+ * `POST /products`
4483
+ *
4484
+ * @param params - The product, with at least one price.
4485
+ * @param profileId - The shop the product belongs to.
4486
+ */
4487
+ async create(params, profileId, options) {
4488
+ return this.request("POST", "/products", {
4489
+ body: params,
4490
+ ...this.scoped(profileId, options)
4491
+ });
4492
+ }
4493
+ /**
4494
+ * One page of the shop's catalogue.
4495
+ * `GET /products/list`
4496
+ *
4497
+ * Archived products are returned too unless `status` narrows them away —
4498
+ * they are what past charges refer to.
4499
+ */
4500
+ async list(params, profileId, options) {
4501
+ return this.request("GET", "/products/list", {
4502
+ query: params === void 0 ? void 0 : { ...params },
4503
+ ...this.scoped(profileId, options)
4504
+ });
4505
+ }
4506
+ /**
4507
+ * Retrieve one product with its prices.
4508
+ * `GET /products/{product_id}`
4509
+ */
4510
+ async retrieve(productId, profileId, options) {
4511
+ return this.request("GET", `/products/${encodeURIComponent(productId)}`, {
4512
+ ...this.scoped(profileId, options)
4513
+ });
4514
+ }
4515
+ /**
4516
+ * Change a product's name, description or metadata.
4517
+ * `POST /products/{product_id}`
4518
+ *
4519
+ * Its kind and its prices are not editable here — see the class note.
4520
+ */
4521
+ async update(productId, params, profileId, options) {
4522
+ return this.request("POST", `/products/${encodeURIComponent(productId)}`, {
4523
+ body: params,
4524
+ ...this.scoped(profileId, options)
4525
+ });
4526
+ }
4527
+ /**
4528
+ * Take a product off sale.
4529
+ * `POST /products/{product_id}/archive`
4530
+ *
4531
+ * It stays readable and keeps its prices: a payment made against it has to
4532
+ * remain explicable after it is withdrawn.
4533
+ */
4534
+ async archive(productId, profileId, options) {
4535
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/archive`, {
4536
+ ...this.scoped(profileId, options)
4537
+ });
4538
+ }
4539
+ /**
4540
+ * Put an archived product back on sale.
4541
+ * `POST /products/{product_id}/restore`
4542
+ */
4543
+ async restore(productId, profileId, options) {
4544
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/restore`, {
4545
+ ...this.scoped(profileId, options)
4546
+ });
4547
+ }
4548
+ /**
4549
+ * Add a price to an existing product.
4550
+ * `POST /products/{product_id}/prices`
4551
+ *
4552
+ * This is how a price changes: the new figure is added and the old price is
4553
+ * archived, so both remain readable.
4554
+ */
4555
+ async addPrice(productId, params, profileId, options) {
4556
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/prices`, {
4557
+ body: params,
4558
+ ...this.scoped(profileId, options)
4559
+ });
4560
+ }
4561
+ /**
4562
+ * Change a price's label, its default flag or its metadata.
4563
+ * `POST /products/{product_id}/prices/{price_id}`
4564
+ *
4565
+ * Not its amount, its currency or its interval: see the class note.
4566
+ */
4567
+ async updatePrice(productId, priceId, params, profileId, options) {
4568
+ return this.request(
4569
+ "POST",
4570
+ `/products/${encodeURIComponent(productId)}/prices/${encodeURIComponent(priceId)}`,
4571
+ { body: params, ...this.scoped(profileId, options) }
4572
+ );
4573
+ }
4574
+ /**
4575
+ * Take one price off sale, leaving the product on it.
4576
+ * `POST /products/{product_id}/prices/{price_id}/archive`
4577
+ */
4578
+ async archivePrice(productId, priceId, profileId, options) {
4579
+ return this.request(
4580
+ "POST",
4581
+ `/products/${encodeURIComponent(productId)}/prices/${encodeURIComponent(priceId)}/archive`,
4582
+ { ...this.scoped(profileId, options) }
4583
+ );
4584
+ }
4585
+ };
4586
+
4451
4587
  // src/resources/processorCosts.ts
4452
4588
  var ProcessorCosts = class {
4453
4589
  constructor(request) {
@@ -5469,6 +5605,8 @@ var Delopay = class {
5469
5605
  this.availabilityOverrides = new AvailabilityOverrides(request);
5470
5606
  this.sellToRestrictions = new SellToRestrictions(request);
5471
5607
  this.costRules = new CostRules(request);
5608
+ this.externalRecords = new ExternalRecords(request);
5609
+ this.products = new Products(request);
5472
5610
  this.processorCosts = new ProcessorCosts(request);
5473
5611
  this.checkoutMethods = new CheckoutMethods(request);
5474
5612
  this.analytics = new Analytics(request);
@@ -9073,6 +9211,8 @@ export {
9073
9211
  AvailabilityOverrides,
9074
9212
  SellToRestrictions,
9075
9213
  CostRules,
9214
+ ExternalRecords,
9215
+ Products,
9076
9216
  ProcessorCosts,
9077
9217
  CheckoutMethods,
9078
9218
  Subscriptions,
@@ -9252,4 +9392,4 @@ export {
9252
9392
  decodeNativePanes,
9253
9393
  encodeNativePanes
9254
9394
  };
9255
- //# sourceMappingURL=chunk-P2KP3WRS.js.map
9395
+ //# sourceMappingURL=chunk-Y6TADN6R.js.map