@sweepconsole/node 0.2.0 → 0.2.1
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/types.d.ts +45 -1
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -193,7 +193,7 @@ export interface RetrievedSession {
|
|
|
193
193
|
expiresAt: Date;
|
|
194
194
|
createdAt: Date;
|
|
195
195
|
}
|
|
196
|
-
export type WebhookEventType = "checkout.session.completed" | "subscription.created" | "subscription.renewed" | "subscription.past_due" | "subscription.cancelled" | "payment.succeeded" | "payment.failed" | "mandate.authorized" | "mandate.revoked" | "mandate.expiring" | "mandate.expired" | "charge.succeeded" | "charge.failed";
|
|
196
|
+
export type WebhookEventType = "checkout.session.completed" | "subscription.created" | "subscription.renewed" | "subscription.past_due" | "subscription.cancelled" | "payment.succeeded" | "payment.failed" | "mandate.authorized" | "mandate.revoked" | "grant.revoked" | "grant.added" | "mandate.expiring" | "mandate.expired" | "charge.succeeded" | "charge.failed";
|
|
197
197
|
/**
|
|
198
198
|
* What each event carries.
|
|
199
199
|
*
|
|
@@ -320,6 +320,12 @@ export interface WebhookPayloads {
|
|
|
320
320
|
*/
|
|
321
321
|
wallet_reused: boolean;
|
|
322
322
|
};
|
|
323
|
+
/**
|
|
324
|
+
* The authorization is FINISHED — nothing left to charge on any chain.
|
|
325
|
+
*
|
|
326
|
+
* One chain leaving a live mandate is `grant.revoked`, not this. Acting on
|
|
327
|
+
* the wrong one cuts off a customer who is still paying you.
|
|
328
|
+
*/
|
|
323
329
|
"mandate.revoked": {
|
|
324
330
|
mandate_id: string;
|
|
325
331
|
external_ref: string;
|
|
@@ -333,6 +339,44 @@ export interface WebhookPayloads {
|
|
|
333
339
|
* guaranteed is that Sweep Console will not redeem it again.
|
|
334
340
|
*/
|
|
335
341
|
on_chain: boolean;
|
|
342
|
+
/** Always empty here — the authorization is over. */
|
|
343
|
+
remaining_chains: string[];
|
|
344
|
+
/** Always false here. Branch on this rather than on the event name. */
|
|
345
|
+
mandate_still_active: boolean;
|
|
346
|
+
};
|
|
347
|
+
/**
|
|
348
|
+
* A payer withdrew ONE chain's permission in their own wallet.
|
|
349
|
+
*
|
|
350
|
+
* The authorization survives on the rest, so this is not a reason to stop
|
|
351
|
+
* serving. A wallet-side withdrawal is invisible to Sweep until the daily
|
|
352
|
+
* reconciliation looks, so this arrives then rather than the moment they act.
|
|
353
|
+
*/
|
|
354
|
+
"grant.revoked": {
|
|
355
|
+
mandate_id: string;
|
|
356
|
+
chain_id: number;
|
|
357
|
+
grant_id: string | null;
|
|
358
|
+
subscription_id: string | null;
|
|
359
|
+
reason: string;
|
|
360
|
+
/** What is still chargeable. Empty would make this a mandate.revoked. */
|
|
361
|
+
remaining_chains: string[];
|
|
362
|
+
/** True here, by definition. */
|
|
363
|
+
mandate_still_active: boolean;
|
|
364
|
+
};
|
|
365
|
+
/**
|
|
366
|
+
* A payer authorized an EXTRA chain on a live mandate.
|
|
367
|
+
*
|
|
368
|
+
* The mirror of `grant.revoked` — more ways for a charge to succeed, and
|
|
369
|
+
* nothing to stop. Not sent during the first authorization, where
|
|
370
|
+
* `mandate.authorized` already carries every chain in `chain_ids`.
|
|
371
|
+
*/
|
|
372
|
+
"grant.added": {
|
|
373
|
+
mandate_id: string;
|
|
374
|
+
chain_id: number;
|
|
375
|
+
grant_id: string | null;
|
|
376
|
+
/** The whole chargeable set after the change, not just the new chain. */
|
|
377
|
+
granted_chains: string[];
|
|
378
|
+
/** True here, by definition. */
|
|
379
|
+
mandate_still_active: boolean;
|
|
336
380
|
};
|
|
337
381
|
"mandate.expiring": {
|
|
338
382
|
mandate_id: string;
|