@delopay/sdk 0.184.0 → 0.186.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
@@ -4252,6 +4252,20 @@ var Users = class {
4252
4252
  async deleteUserRole(params) {
4253
4253
  return this.request("DELETE", "/user/employees/delete", { body: params });
4254
4254
  }
4255
+ /**
4256
+ * Move a team member between a merchant-level role and shop-level roles.
4257
+ * `POST /user/employees/change-scope`
4258
+ *
4259
+ * A merchant-level `role_id` takes no `profile_ids`; a shop-level one needs
4260
+ * at least one. Every earlier merchant- and shop-level binding of the member
4261
+ * in your merchant is replaced. When the change takes a scope away, the
4262
+ * member's sessions end (`sessions_revoked: true`). Needs a caller at
4263
+ * merchant level or above. A refusal is a `UR_23` error whose `data.reason`
4264
+ * names the rule; an unknown `role_id` is `UR_22`.
4265
+ */
4266
+ async changeMemberScope(params) {
4267
+ return this.request("POST", "/user/employees/change-scope", { body: params });
4268
+ }
4255
4269
  /** Sign in via OIDC. `POST /user/oidc` */
4256
4270
  async signInOidc(params) {
4257
4271
  return this.request("POST", "/user/oidc", { body: params });
@@ -4801,6 +4815,24 @@ var Export = class {
4801
4815
  options
4802
4816
  );
4803
4817
  }
4818
+ async transactionLines(params, options) {
4819
+ return runExport(
4820
+ this.request,
4821
+ "POST",
4822
+ "/export/transactions/lines",
4823
+ { body: params ?? {} },
4824
+ options
4825
+ );
4826
+ }
4827
+ async transactionLinesForProfile(params, options) {
4828
+ return runExport(
4829
+ this.request,
4830
+ "POST",
4831
+ "/export/profile/transactions/lines",
4832
+ { body: params ?? {} },
4833
+ options
4834
+ );
4835
+ }
4804
4836
  async refunds(params, options) {
4805
4837
  return runExport(this.request, "POST", "/refunds/list/export", { body: params ?? {} }, options);
4806
4838
  }
@@ -5200,6 +5232,19 @@ var Products = class {
5200
5232
  ...this.scoped(profileId, options)
5201
5233
  });
5202
5234
  }
5235
+ /**
5236
+ * Find the product a name or a connector's id belongs to. Pass exactly one
5237
+ * of `alias`, `connector_product_id` and `connector_price_id`; the connector
5238
+ * ids need `connector` as well. Archived products resolve too, so a payment
5239
+ * that references one is still attributed. No match answers 404.
5240
+ * `GET /products/resolve`
5241
+ */
5242
+ async resolve(query, profileId, options) {
5243
+ return this.request("GET", "/products/resolve", {
5244
+ query: { ...query },
5245
+ ...this.scoped(profileId, options)
5246
+ });
5247
+ }
5203
5248
  /**
5204
5249
  * Retrieve one product with its prices.
5205
5250
  * `GET /products/{product_id}`
@@ -5210,7 +5255,22 @@ var Products = class {
5210
5255
  });
5211
5256
  }
5212
5257
  /**
5213
- * Change a product's name, description or metadata.
5258
+ * What a product sold in a window, per currency, net of the refunds credited
5259
+ * to its lines. Refunds that named no product line are not included.
5260
+ * `GET /products/{product_id}/sales`
5261
+ *
5262
+ * Needs payment read; refused (403) to a caller limited to some connector
5263
+ * accounts.
5264
+ */
5265
+ async sales(productId, query, profileId, options) {
5266
+ return this.request("GET", `/products/${encodeURIComponent(productId)}/sales`, {
5267
+ ...this.scoped(profileId, options),
5268
+ query: { ...query }
5269
+ });
5270
+ }
5271
+ /**
5272
+ * Change a product's name, description, image, metadata or category
5273
+ * (`category_id: null` makes it uncategorized).
5214
5274
  * `POST /products/{product_id}`
5215
5275
  *
5216
5276
  * Its kind and its prices are not editable here — see the class note.
@@ -5334,6 +5394,148 @@ var Products = class {
5334
5394
  ...this.scoped(profileId, options)
5335
5395
  });
5336
5396
  }
5397
+ // --- identity: names and connector references ---------------------
5398
+ /**
5399
+ * Add a name the product goes by. A name it already goes by is returned
5400
+ * as it is; one another product of the shop goes by is refused.
5401
+ * `POST /products/{product_id}/aliases`
5402
+ */
5403
+ async addAlias(productId, body, profileId, options) {
5404
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/aliases`, {
5405
+ body,
5406
+ ...this.scoped(profileId, options)
5407
+ });
5408
+ }
5409
+ /**
5410
+ * Remove a name the product goes by. Its current name stays.
5411
+ * `POST /products/{product_id}/aliases/{alias_id}/remove`
5412
+ */
5413
+ async removeAlias(productId, aliasId, profileId, options) {
5414
+ return this.request(
5415
+ "POST",
5416
+ `/products/${encodeURIComponent(productId)}/aliases/${encodeURIComponent(aliasId)}/remove`,
5417
+ { ...this.scoped(profileId, options) }
5418
+ );
5419
+ }
5420
+ /**
5421
+ * Tie a connected account's product, or one of its prices, to the product.
5422
+ * Recorded as `manual_id`: the ids are not checked against the account.
5423
+ * `POST /products/{product_id}/connector-references`
5424
+ */
5425
+ async addConnectorReference(productId, body, profileId, options) {
5426
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/connector-references`, {
5427
+ body,
5428
+ ...this.scoped(profileId, options)
5429
+ });
5430
+ }
5431
+ /**
5432
+ * Remove a connected account's product or price from the product.
5433
+ * `POST /products/{product_id}/connector-references/{reference_id}/remove`
5434
+ */
5435
+ async removeConnectorReference(productId, referenceId, profileId, options) {
5436
+ return this.request(
5437
+ "POST",
5438
+ `/products/${encodeURIComponent(productId)}/connector-references/${encodeURIComponent(referenceId)}/remove`,
5439
+ { ...this.scoped(profileId, options) }
5440
+ );
5441
+ }
5442
+ /**
5443
+ * One bounded page of a connected billing account's products, to pick an
5444
+ * existing one to tie to a product. Reads only.
5445
+ * `GET /products/import-suggestions`
5446
+ */
5447
+ async importSuggestions(query, profileId, options) {
5448
+ return this.request("GET", "/products/import-suggestions", {
5449
+ query: { ...query },
5450
+ ...this.scoped(profileId, options)
5451
+ });
5452
+ }
5453
+ /**
5454
+ * Tie one of a connected account's existing products (or a price of it) to
5455
+ * the product, verified against a fresh read of the page it was suggested
5456
+ * on — pass the same `limit` and `offset`. Recorded as `map_existing`.
5457
+ * `POST /products/{product_id}/connector-references/import`
5458
+ */
5459
+ async acceptImport(productId, body, profileId, options) {
5460
+ return this.request(
5461
+ "POST",
5462
+ `/products/${encodeURIComponent(productId)}/connector-references/import`,
5463
+ { body, ...this.scoped(profileId, options) }
5464
+ );
5465
+ }
5466
+ // --- categories ------------------------------------------------------
5467
+ /**
5468
+ * Add a category to the shop, at the end of its order. File products under
5469
+ * it with `category_id` on `create` or `update`.
5470
+ * `POST /products/categories`
5471
+ */
5472
+ async createCategory(body, profileId, options) {
5473
+ return this.request("POST", "/products/categories", {
5474
+ body,
5475
+ ...this.scoped(profileId, options)
5476
+ });
5477
+ }
5478
+ /**
5479
+ * The shop's categories in order. Archived ones only with
5480
+ * `include_archived`; deleted ones never.
5481
+ * `GET /products/categories/list`
5482
+ */
5483
+ async listCategories(query, profileId, options) {
5484
+ return this.request("GET", "/products/categories/list", {
5485
+ query: query === void 0 ? void 0 : { ...query },
5486
+ ...this.scoped(profileId, options)
5487
+ });
5488
+ }
5489
+ /**
5490
+ * Put the shop's categories in a new order. Name every live category,
5491
+ * archived ones included, exactly once. Returns the categories in their new
5492
+ * order.
5493
+ * `POST /products/categories/reorder`
5494
+ */
5495
+ async reorderCategories(body, profileId, options) {
5496
+ return this.request("POST", "/products/categories/reorder", {
5497
+ body,
5498
+ ...this.scoped(profileId, options)
5499
+ });
5500
+ }
5501
+ /**
5502
+ * Rename a category.
5503
+ * `POST /products/categories/{category_id}`
5504
+ */
5505
+ async updateCategory(categoryId, changes, profileId, options) {
5506
+ return this.request("POST", `/products/categories/${encodeURIComponent(categoryId)}`, {
5507
+ body: changes,
5508
+ ...this.scoped(profileId, options)
5509
+ });
5510
+ }
5511
+ /**
5512
+ * Mark a category deleted. Its products become uncategorized and no payment
5513
+ * changes. Returns the deleted category.
5514
+ * `DELETE /products/categories/{category_id}`
5515
+ */
5516
+ async deleteCategory(categoryId, profileId, options) {
5517
+ return this.request("DELETE", `/products/categories/${encodeURIComponent(categoryId)}`, {
5518
+ ...this.scoped(profileId, options)
5519
+ });
5520
+ }
5521
+ /**
5522
+ * Keep a category with its products, but file no new product under it.
5523
+ * `POST /products/categories/{category_id}/archive`
5524
+ */
5525
+ async archiveCategory(categoryId, profileId, options) {
5526
+ return this.request("POST", `/products/categories/${encodeURIComponent(categoryId)}/archive`, {
5527
+ ...this.scoped(profileId, options)
5528
+ });
5529
+ }
5530
+ /**
5531
+ * Let an archived category take products again.
5532
+ * `POST /products/categories/{category_id}/restore`
5533
+ */
5534
+ async restoreCategory(categoryId, profileId, options) {
5535
+ return this.request("POST", `/products/categories/${encodeURIComponent(categoryId)}/restore`, {
5536
+ ...this.scoped(profileId, options)
5537
+ });
5538
+ }
5337
5539
  // --- provider import ---------------------------------------------
5338
5540
  /**
5339
5541
  * Read a connected billing account's products and say how each relates to
@@ -5369,6 +5571,44 @@ var Products = class {
5369
5571
  ...this.scoped(profileId, options)
5370
5572
  });
5371
5573
  }
5574
+ // --- provider sync -----------------------------------------------
5575
+ /**
5576
+ * Compare the product with its copy at every connected account it is tied
5577
+ * to. Reads the providers now; an unreadable provider answers `unknown`,
5578
+ * never `in_sync`.
5579
+ * `GET /products/{product_id}/provider-sync`
5580
+ */
5581
+ async providerSync(productId, profileId, options) {
5582
+ return this.request("GET", `/products/${encodeURIComponent(productId)}/provider-sync`, {
5583
+ ...this.scoped(profileId, options)
5584
+ });
5585
+ }
5586
+ /**
5587
+ * {@link providerSync} for 1 to 50 products at once, such as one page of the
5588
+ * product list. Unknown ids are left out of the answer.
5589
+ * `POST /products/provider-sync`
5590
+ */
5591
+ async providerSyncBatch(request, profileId, options) {
5592
+ return this.request("POST", "/products/provider-sync", {
5593
+ body: request,
5594
+ ...this.scoped(profileId, options)
5595
+ });
5596
+ }
5597
+ /**
5598
+ * Write the catalog's state onto one connected account's copy of the
5599
+ * product, for the differences a push changes and nothing else. When it
5600
+ * would change a difference not named in `confirmed`, nothing is written and
5601
+ * the answer carries `confirmation_outdated: true` with the current
5602
+ * differences in `result`; `nothing_to_push` answers without a provider
5603
+ * write when nothing pushable differs.
5604
+ * `POST /products/{product_id}/provider-sync/push`
5605
+ */
5606
+ async providerPush(productId, request, profileId, options) {
5607
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/provider-sync/push`, {
5608
+ body: request,
5609
+ ...this.scoped(profileId, options)
5610
+ });
5611
+ }
5372
5612
  };
5373
5613
 
5374
5614
  // src/resources/processorCosts.ts