UNPKG

@aptly-as/types

Version:
52 lines (51 loc) 2.63 kB
import { AptlyDocumentSchema, AptlyOfferSchema, AptlyOrderSchema, AptlyOrganizationSchema, AptlyPaymentSchema, AptlyPaymentSettlement, AptlyProjectSchema, AptlyUnitSchema } from '../models/index.js'; export declare namespace AptlyWebhookEventData { type Organization<ID, DATE> = Pick<AptlyOrganizationSchema<ID, DATE>, '_id' | 'name' | 'logoMedia' | 'logo'>; type Project<ID, DATE> = Pick<AptlyProjectSchema<ID, DATE>, '_id' | 'name' | 'theme'>; type Unit<ID, DATE> = Pick<AptlyUnitSchema<ID, DATE>, '_id' | 'name'>; export interface UnitWebhookSchema<ID, DATE> { unit: Unit<ID, DATE>; } export interface UnitDocumentWebhookSchema<ID, DATE> { document: AptlyDocumentSchema<ID, DATE>; documentUrl: string; } export type Payment = PaymentSchema<string, string>; export interface PaymentSchema<ID, DATE> { organization: Organization<ID, DATE>; project: Project<ID, DATE>; unit: Unit<ID, DATE>; payment: AptlyPaymentSchema<ID, DATE>; order: Pick<AptlyOrderSchema<ID, DATE>, '_id' | 'orderNumber'>; offer?: Pick<AptlyOfferSchema<ID, DATE>, '_id' | 'name' | 'number' | 'description'>; documentUrl?: string; reportDocumentUrl?: string; } export type NewUnitDocument = NewUnitDocumentSchema<string, string>; export type NewUnitDocumentSchema<ID, DATE> = UnitWebhookSchema<ID, DATE> & UnitDocumentWebhookSchema<ID, DATE>; export type NewUnitOrder = NewUnitOrderSchema<string, string>; export interface NewUnitOrderSchema<ID, DATE> extends NewUnitDocumentSchema<ID, DATE> { order: Pick<AptlyOrderSchema<ID, DATE>, '_id' | 'orderNumber' | 'receipt' | 'period'>; } export type Order = OrderSchema<string, string>; export interface OrderSchema<ID, DATE> { organization: Organization<ID, DATE>; project: Project<ID, DATE>; unit: Pick<AptlyUnitSchema<ID, DATE>, '_id' | 'name' | 'shipping' | 'users'>; order: AptlyOrderSchema<ID, DATE>; offer?: Pick<AptlyOfferSchema<ID, DATE>, '_id' | 'name' | 'number' | 'description'>; receiptUrl?: string; signedReceiptUrl?: string; } export {}; } export declare namespace AptlyAppWebhookEventData { interface SettlementCreate extends Pick<AptlyPaymentSettlement, 'app' | 'at' | 'externalId' | 'externalRef' | 'destination'> { amounts: Omit<AptlyPaymentSettlement['amounts'][0], '_id'>[]; transactions: Omit<AptlyPaymentSettlement['transactions'][0], '_id'>[]; pdfDownload?: { url: string; name: string; }; } }