@delopay/sdk 0.81.0 → 0.82.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/{chunk-PHKXFVHZ.js → chunk-G44EQT6Q.js} +49 -5
- package/dist/chunk-G44EQT6Q.js.map +1 -0
- package/dist/index.cjs +48 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +90 -2
- package/dist/index.d.ts +90 -2
- package/dist/index.js +1 -1
- package/dist/internal.cjs +48 -4
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-PHKXFVHZ.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -618,6 +618,36 @@ var Connectors = class {
|
|
|
618
618
|
`/account/${encodeURIComponent(merchantId)}/connectors/webhooks/${encodeURIComponent(connectorId)}`
|
|
619
619
|
);
|
|
620
620
|
}
|
|
621
|
+
/**
|
|
622
|
+
* Bring an already-registered webhook's event subscription up to date with
|
|
623
|
+
* the events Delopay handles.
|
|
624
|
+
* `POST /account/{merchantId}/connectors/webhooks/{connectorId}/sync-events`
|
|
625
|
+
*
|
|
626
|
+
* A PSP freezes an endpoint's event list at registration time, so an endpoint
|
|
627
|
+
* created before an event type was added never receives it — silently, with
|
|
628
|
+
* no error anywhere. {@link getWebhook} reports the gap as `missing_events`;
|
|
629
|
+
* this repairs it.
|
|
630
|
+
*
|
|
631
|
+
* Unlike re-registering, the endpoints are updated in place: the endpoint id
|
|
632
|
+
* and its signing secret are preserved, so signature verification keeps
|
|
633
|
+
* working across the change. Stripe connectors only; idempotent, so it is
|
|
634
|
+
* safe to call on a schedule or after every deploy.
|
|
635
|
+
*
|
|
636
|
+
* @example
|
|
637
|
+
* ```typescript
|
|
638
|
+
* const sync = await delopay.connectors.syncWebhookEvents('mer_abc', 'mca_xyz');
|
|
639
|
+
* for (const endpoint of sync.endpoints) {
|
|
640
|
+
* if (endpoint.error_message) console.warn(endpoint.connector_webhook_id, endpoint.error_message);
|
|
641
|
+
* else if (endpoint.updated) console.log('subscribed', endpoint.added_events);
|
|
642
|
+
* }
|
|
643
|
+
* ```
|
|
644
|
+
*/
|
|
645
|
+
async syncWebhookEvents(merchantId, connectorId) {
|
|
646
|
+
return this.request(
|
|
647
|
+
"POST",
|
|
648
|
+
`/account/${encodeURIComponent(merchantId)}/connectors/webhooks/${encodeURIComponent(connectorId)}/sync-events`
|
|
649
|
+
);
|
|
650
|
+
}
|
|
621
651
|
/** List available payment methods. `GET /account/payment-methods` */
|
|
622
652
|
async listPaymentMethods() {
|
|
623
653
|
return this.request("GET", "/account/payment-methods");
|
|
@@ -625,6 +655,15 @@ var Connectors = class {
|
|
|
625
655
|
};
|
|
626
656
|
|
|
627
657
|
// src/resources/customers.ts
|
|
658
|
+
function toQuery(params) {
|
|
659
|
+
if (!params) return void 0;
|
|
660
|
+
const { profile_ids, ...rest } = params;
|
|
661
|
+
const query = rest;
|
|
662
|
+
if (profile_ids && profile_ids.length > 0) {
|
|
663
|
+
query.profile_ids = profile_ids.join(",");
|
|
664
|
+
}
|
|
665
|
+
return query;
|
|
666
|
+
}
|
|
628
667
|
var Customers = class {
|
|
629
668
|
constructor(request) {
|
|
630
669
|
this.request = request;
|
|
@@ -690,11 +729,16 @@ var Customers = class {
|
|
|
690
729
|
* ```typescript
|
|
691
730
|
* // Customers who have transacted in a specific shop.
|
|
692
731
|
* const customers = await delopay.customers.list({ profile_id: 'pro_abc123' });
|
|
732
|
+
*
|
|
733
|
+
* // Several shops at once (unions with profile_id / project_id).
|
|
734
|
+
* const many = await delopay.customers.list({
|
|
735
|
+
* profile_ids: ['pro_abc123', 'pro_def456'],
|
|
736
|
+
* });
|
|
693
737
|
* ```
|
|
694
738
|
*/
|
|
695
739
|
async list(params) {
|
|
696
740
|
return this.request("GET", "/customers/list", {
|
|
697
|
-
query: params
|
|
741
|
+
query: toQuery(params)
|
|
698
742
|
});
|
|
699
743
|
}
|
|
700
744
|
// --- OLAP extensions (Task 4.6) ---
|
|
@@ -704,7 +748,7 @@ var Customers = class {
|
|
|
704
748
|
*/
|
|
705
749
|
async listWithCount(params) {
|
|
706
750
|
return this.request("GET", "/customers/list-with-count", {
|
|
707
|
-
query: params
|
|
751
|
+
query: toQuery(params)
|
|
708
752
|
});
|
|
709
753
|
}
|
|
710
754
|
/**
|
|
@@ -718,7 +762,7 @@ var Customers = class {
|
|
|
718
762
|
*/
|
|
719
763
|
async listByProfile(params) {
|
|
720
764
|
return this.request("GET", "/customers/profile/list", {
|
|
721
|
-
query: params
|
|
765
|
+
query: toQuery(params)
|
|
722
766
|
});
|
|
723
767
|
}
|
|
724
768
|
/**
|
|
@@ -727,7 +771,7 @@ var Customers = class {
|
|
|
727
771
|
*/
|
|
728
772
|
async listByProfileWithCount(params) {
|
|
729
773
|
return this.request("GET", "/customers/profile/list-with-count", {
|
|
730
|
-
query: params
|
|
774
|
+
query: toQuery(params)
|
|
731
775
|
});
|
|
732
776
|
}
|
|
733
777
|
/** List mandates for a customer. `GET /customers/{customerId}/mandates` */
|