@delopay/sdk 0.50.0 → 0.52.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/README.md +12 -10
- package/dist/{chunk-P45MMRTD.js → chunk-7EHSQIPR.js} +2 -2
- package/dist/chunk-7EHSQIPR.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -7
- package/dist/index.d.ts +48 -7
- package/dist/index.js +1 -1
- package/dist/internal.cjs +30 -1
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +20 -3
- package/dist/internal.d.ts +20 -3
- package/dist/internal.js +30 -1
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-P45MMRTD.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -4663,18 +4663,59 @@ declare class DelopayAuthenticationError extends DelopayError {
|
|
|
4663
4663
|
});
|
|
4664
4664
|
}
|
|
4665
4665
|
|
|
4666
|
+
/**
|
|
4667
|
+
* The payload of a webhook event, tagged by kind.
|
|
4668
|
+
*
|
|
4669
|
+
* Mirrors the backend's `{ "type": …, "object": … }` envelope: `type` names the
|
|
4670
|
+
* payload shape and `object` carries it. Narrow on `content.type` to get a
|
|
4671
|
+
* fully-typed `object`:
|
|
4672
|
+
*
|
|
4673
|
+
* ```typescript
|
|
4674
|
+
* if (event.content.type === 'payment_details') {
|
|
4675
|
+
* event.content.object.payment_id; // typed as PaymentResponse
|
|
4676
|
+
* }
|
|
4677
|
+
* ```
|
|
4678
|
+
*/
|
|
4679
|
+
type WebhookContent = {
|
|
4680
|
+
type: 'payment_details';
|
|
4681
|
+
object: PaymentResponse;
|
|
4682
|
+
} | {
|
|
4683
|
+
type: 'refund_details';
|
|
4684
|
+
object: RefundResponse;
|
|
4685
|
+
} | {
|
|
4686
|
+
type: 'dispute_details';
|
|
4687
|
+
object: DisputeResponse;
|
|
4688
|
+
} | {
|
|
4689
|
+
type: 'mandate_details';
|
|
4690
|
+
object: MandateResponse;
|
|
4691
|
+
} | {
|
|
4692
|
+
type: 'payout_details';
|
|
4693
|
+
object: PayoutResponse;
|
|
4694
|
+
} | {
|
|
4695
|
+
type: 'subscription_details';
|
|
4696
|
+
object: ConfirmSubscriptionResponse;
|
|
4697
|
+
};
|
|
4666
4698
|
/**
|
|
4667
4699
|
* A parsed and verified Delopay webhook event.
|
|
4668
4700
|
*
|
|
4669
|
-
*
|
|
4670
|
-
*
|
|
4701
|
+
* Matches the signed wire body exactly:
|
|
4702
|
+
* `{ merchant_id, event_id, event_type, content: { type, object }, timestamp }`.
|
|
4703
|
+
*
|
|
4704
|
+
* - `event_type` identifies the event, e.g. `'payment_succeeded'`.
|
|
4705
|
+
* - `content.type` tags the payload kind, e.g. `'payment_details'`.
|
|
4706
|
+
* - `content.object` is the payload; narrow on `content.type` to type it.
|
|
4671
4707
|
*/
|
|
4672
4708
|
interface WebhookEvent {
|
|
4709
|
+
/** ID of the merchant that owns this event. */
|
|
4710
|
+
merchant_id: string;
|
|
4711
|
+
/** Unique ID for this event (stable across delivery retries). */
|
|
4712
|
+
event_id: string;
|
|
4673
4713
|
/** Event type identifier, e.g. `'payment_succeeded'` or `'refund_succeeded'`. */
|
|
4674
|
-
|
|
4675
|
-
/**
|
|
4676
|
-
|
|
4677
|
-
|
|
4714
|
+
event_type: EventType;
|
|
4715
|
+
/** The event payload, tagged by kind. Narrow on `content.type` to type `object`. */
|
|
4716
|
+
content: WebhookContent;
|
|
4717
|
+
/** ISO 8601 timestamp at which the webhook was sent. */
|
|
4718
|
+
timestamp: string;
|
|
4678
4719
|
}
|
|
4679
4720
|
declare const Webhooks: {
|
|
4680
4721
|
/**
|
|
@@ -4709,7 +4750,7 @@ declare const Webhooks: {
|
|
|
4709
4750
|
* req.header('x-webhook-signature-512') ?? '',
|
|
4710
4751
|
* process.env.DELOPAY_WEBHOOK_SECRET!,
|
|
4711
4752
|
* );
|
|
4712
|
-
* console.log(event.
|
|
4753
|
+
* console.log(event.event_type, event.content.object);
|
|
4713
4754
|
* res.sendStatus(200);
|
|
4714
4755
|
* } catch {
|
|
4715
4756
|
* res.status(400).send('Invalid signature');
|
package/dist/index.d.ts
CHANGED
|
@@ -4663,18 +4663,59 @@ declare class DelopayAuthenticationError extends DelopayError {
|
|
|
4663
4663
|
});
|
|
4664
4664
|
}
|
|
4665
4665
|
|
|
4666
|
+
/**
|
|
4667
|
+
* The payload of a webhook event, tagged by kind.
|
|
4668
|
+
*
|
|
4669
|
+
* Mirrors the backend's `{ "type": …, "object": … }` envelope: `type` names the
|
|
4670
|
+
* payload shape and `object` carries it. Narrow on `content.type` to get a
|
|
4671
|
+
* fully-typed `object`:
|
|
4672
|
+
*
|
|
4673
|
+
* ```typescript
|
|
4674
|
+
* if (event.content.type === 'payment_details') {
|
|
4675
|
+
* event.content.object.payment_id; // typed as PaymentResponse
|
|
4676
|
+
* }
|
|
4677
|
+
* ```
|
|
4678
|
+
*/
|
|
4679
|
+
type WebhookContent = {
|
|
4680
|
+
type: 'payment_details';
|
|
4681
|
+
object: PaymentResponse;
|
|
4682
|
+
} | {
|
|
4683
|
+
type: 'refund_details';
|
|
4684
|
+
object: RefundResponse;
|
|
4685
|
+
} | {
|
|
4686
|
+
type: 'dispute_details';
|
|
4687
|
+
object: DisputeResponse;
|
|
4688
|
+
} | {
|
|
4689
|
+
type: 'mandate_details';
|
|
4690
|
+
object: MandateResponse;
|
|
4691
|
+
} | {
|
|
4692
|
+
type: 'payout_details';
|
|
4693
|
+
object: PayoutResponse;
|
|
4694
|
+
} | {
|
|
4695
|
+
type: 'subscription_details';
|
|
4696
|
+
object: ConfirmSubscriptionResponse;
|
|
4697
|
+
};
|
|
4666
4698
|
/**
|
|
4667
4699
|
* A parsed and verified Delopay webhook event.
|
|
4668
4700
|
*
|
|
4669
|
-
*
|
|
4670
|
-
*
|
|
4701
|
+
* Matches the signed wire body exactly:
|
|
4702
|
+
* `{ merchant_id, event_id, event_type, content: { type, object }, timestamp }`.
|
|
4703
|
+
*
|
|
4704
|
+
* - `event_type` identifies the event, e.g. `'payment_succeeded'`.
|
|
4705
|
+
* - `content.type` tags the payload kind, e.g. `'payment_details'`.
|
|
4706
|
+
* - `content.object` is the payload; narrow on `content.type` to type it.
|
|
4671
4707
|
*/
|
|
4672
4708
|
interface WebhookEvent {
|
|
4709
|
+
/** ID of the merchant that owns this event. */
|
|
4710
|
+
merchant_id: string;
|
|
4711
|
+
/** Unique ID for this event (stable across delivery retries). */
|
|
4712
|
+
event_id: string;
|
|
4673
4713
|
/** Event type identifier, e.g. `'payment_succeeded'` or `'refund_succeeded'`. */
|
|
4674
|
-
|
|
4675
|
-
/**
|
|
4676
|
-
|
|
4677
|
-
|
|
4714
|
+
event_type: EventType;
|
|
4715
|
+
/** The event payload, tagged by kind. Narrow on `content.type` to type `object`. */
|
|
4716
|
+
content: WebhookContent;
|
|
4717
|
+
/** ISO 8601 timestamp at which the webhook was sent. */
|
|
4718
|
+
timestamp: string;
|
|
4678
4719
|
}
|
|
4679
4720
|
declare const Webhooks: {
|
|
4680
4721
|
/**
|
|
@@ -4709,7 +4750,7 @@ declare const Webhooks: {
|
|
|
4709
4750
|
* req.header('x-webhook-signature-512') ?? '',
|
|
4710
4751
|
* process.env.DELOPAY_WEBHOOK_SECRET!,
|
|
4711
4752
|
* );
|
|
4712
|
-
* console.log(event.
|
|
4753
|
+
* console.log(event.event_type, event.content.object);
|
|
4713
4754
|
* res.sendStatus(200);
|
|
4714
4755
|
* } catch {
|
|
4715
4756
|
* res.status(400).send('Invalid signature');
|
package/dist/index.js
CHANGED
package/dist/internal.cjs
CHANGED
|
@@ -2521,7 +2521,7 @@ var Webhooks = {
|
|
|
2521
2521
|
* req.header('x-webhook-signature-512') ?? '',
|
|
2522
2522
|
* process.env.DELOPAY_WEBHOOK_SECRET!,
|
|
2523
2523
|
* );
|
|
2524
|
-
* console.log(event.
|
|
2524
|
+
* console.log(event.event_type, event.content.object);
|
|
2525
2525
|
* res.sendStatus(200);
|
|
2526
2526
|
* } catch {
|
|
2527
2527
|
* res.status(400).send('Invalid signature');
|
|
@@ -4148,6 +4148,35 @@ var AdminPortal = class {
|
|
|
4148
4148
|
query: params
|
|
4149
4149
|
});
|
|
4150
4150
|
}
|
|
4151
|
+
/**
|
|
4152
|
+
* Full detail for a single transaction of ANY merchant — the same
|
|
4153
|
+
* `PaymentResponse` the merchant `payments.retrieve` returns. Admin-scoped:
|
|
4154
|
+
* the JWT (or admin API key) does not need to belong to the payment's
|
|
4155
|
+
* merchant; the backend resolves the owning merchant and reads it read-only
|
|
4156
|
+
* (no connector sync).
|
|
4157
|
+
*/
|
|
4158
|
+
async getTransaction(paymentId) {
|
|
4159
|
+
return this.request("GET", `/admin-portal/transactions/${encodeURIComponent(paymentId)}`);
|
|
4160
|
+
}
|
|
4161
|
+
/**
|
|
4162
|
+
* Per-attempt history (retries across connectors, decline reasons) for a
|
|
4163
|
+
* single transaction of ANY merchant.
|
|
4164
|
+
*/
|
|
4165
|
+
async getTransactionAttempts(paymentId) {
|
|
4166
|
+
return this.request(
|
|
4167
|
+
"GET",
|
|
4168
|
+
`/admin-portal/transactions/${encodeURIComponent(paymentId)}/attempts`
|
|
4169
|
+
);
|
|
4170
|
+
}
|
|
4171
|
+
/**
|
|
4172
|
+
* Refunds for a single transaction of ANY merchant.
|
|
4173
|
+
*/
|
|
4174
|
+
async getTransactionRefunds(paymentId) {
|
|
4175
|
+
return this.request(
|
|
4176
|
+
"GET",
|
|
4177
|
+
`/admin-portal/transactions/${encodeURIComponent(paymentId)}/refunds`
|
|
4178
|
+
);
|
|
4179
|
+
}
|
|
4151
4180
|
async analytics(params) {
|
|
4152
4181
|
return this.request("GET", "/admin-portal/analytics", {
|
|
4153
4182
|
query: params
|