@delopay/sdk 0.51.0 → 0.53.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
@@ -525,10 +525,17 @@ var Customers = class {
525
525
  return this.request("DELETE", `/customers/${encodeURIComponent(customerId)}`);
526
526
  }
527
527
  /**
528
- * List customers, optionally filtered by email.
528
+ * List customers, optionally filtered by email, shop (`profile_id`), or
529
+ * project (`project_id`).
529
530
  *
530
531
  * @param params - Optional filter and pagination parameters.
531
532
  * @returns Array of customer objects.
533
+ *
534
+ * @example
535
+ * ```typescript
536
+ * // Customers who have transacted in a specific shop.
537
+ * const customers = await delopay.customers.list({ profile_id: 'pro_abc123' });
538
+ * ```
532
539
  */
533
540
  async list(params) {
534
541
  return this.request("GET", "/customers/list", {
@@ -536,12 +543,38 @@ var Customers = class {
536
543
  });
537
544
  }
538
545
  // --- OLAP extensions (Task 4.6) ---
539
- /** List customers with count. `GET /customers/list-with-count` */
546
+ /**
547
+ * List customers with count. Supports the same `profile_id` / `project_id`
548
+ * shop filters as {@link list}. `GET /customers/list-with-count`
549
+ */
540
550
  async listWithCount(params) {
541
551
  return this.request("GET", "/customers/list-with-count", {
542
552
  query: params
543
553
  });
544
554
  }
555
+ /**
556
+ * List customers scoped to the authenticated dashboard user's shop
557
+ * (business profile). The JWT auto-scopes to its own `profile`; an explicit
558
+ * `profile_id` / `project_id` outside that scope is rejected with
559
+ * `AccessForbidden`. `GET /customers/profile/list`
560
+ *
561
+ * @param params - Optional filter and pagination parameters.
562
+ * @returns Array of customer objects.
563
+ */
564
+ async listByProfile(params) {
565
+ return this.request("GET", "/customers/profile/list", {
566
+ query: params
567
+ });
568
+ }
569
+ /**
570
+ * Profile-scoped variant of {@link listWithCount}.
571
+ * `GET /customers/profile/list-with-count`
572
+ */
573
+ async listByProfileWithCount(params) {
574
+ return this.request("GET", "/customers/profile/list-with-count", {
575
+ query: params
576
+ });
577
+ }
545
578
  /** List mandates for a customer. `GET /customers/{customerId}/mandates` */
546
579
  async listMandates(customerId) {
547
580
  return this.request("GET", `/customers/${encodeURIComponent(customerId)}/mandates`);
@@ -1160,11 +1193,7 @@ var Payments = class {
1160
1193
  * ```
1161
1194
  */
1162
1195
  async listAttempts(paymentId, options) {
1163
- return this.request(
1164
- "GET",
1165
- `/payments/${encodeURIComponent(paymentId)}/attempts`,
1166
- options
1167
- );
1196
+ return this.request("GET", `/payments/${encodeURIComponent(paymentId)}/attempts`, options);
1168
1197
  }
1169
1198
  /**
1170
1199
  * Update an existing payment intent before it is confirmed.
@@ -2509,7 +2538,7 @@ var Webhooks = {
2509
2538
  * req.header('x-webhook-signature-512') ?? '',
2510
2539
  * process.env.DELOPAY_WEBHOOK_SECRET!,
2511
2540
  * );
2512
- * console.log(event.type, event.data);
2541
+ * console.log(event.event_type, event.content.object);
2513
2542
  * res.sendStatus(200);
2514
2543
  * } catch {
2515
2544
  * res.status(400).send('Invalid signature');