Files
ncd-fe/packages/pl-api/lib/entities/subscription-invoice.ts
Nicole Mikołajczyk 3fb0dfb617 pl-api: untested imethods for mitra subscriptions
Signed-off-by: Nicole Mikołajczyk <git@mkljczk.pl>
2025-04-09 13:41:32 +02:00

38 lines
1.0 KiB
TypeScript

import * as v from 'valibot';
import { datetimeSchema } from './utils';
/**
* @category Schemas
*/
const subscriptionInvoiceSchema = v.object({
/** Invoice ID. */
invoice_id: v.string(),
/** The ID of the sender. */
sender_id: v.string(),
/** The ID of the recipient. */
recipient_id: v.string(),
/** CAIP-2 chain ID. */
chain_id: v.string(),
/** Payment address. */
payment_address: v.string(),
/** Requested payment amount (in atomic units). */
amount: v.number(),
/** Invoice status. */
status: v.picklist(['open', 'paid', 'forwarded', 'timeout', 'cancelled', 'underpaid', 'completed', 'failed']),
/** The date when invoice was created. */
created_at: v.fallback(datetimeSchema, new Date().toISOString()),
/** The date when invoice times out. */
invoice_expires_at: v.fallback(datetimeSchema, new Date().toISOString()),
});
/**
* @category Entity types
*/
type SubscriptionInvoice = v.InferOutput<typeof subscriptionInvoiceSchema>;
export {
subscriptionInvoiceSchema,
type SubscriptionInvoice,
};