feat(260519-0oz-01): add QboPaymentCreatePayload, QboDepositCreatePayload types and createPayment/createDeposit methods to QboClient

- Add QboPaymentCreatePayload + QboDepositCreatePayload interfaces to lib/types/qbo.ts
- Add createPayment(payload) and createDeposit(payload) public methods to QboClient
- Both methods use existing private this.request<T>() with POST + minorversion=65
- Both methods throw descriptively if QBO returns no Id in response
This commit is contained in:
lorentz 2026-05-19 00:36:01 -04:00
parent 5f4ccb9c56
commit ef9b31e7c2
2 changed files with 93 additions and 0 deletions

View file

@ -87,6 +87,37 @@ export interface QboDeposit {
MetaData?: QboMetaData;
}
// Payload for creating a Payment via POST /v3/company/{realmId}/payment
// Only the fields we actually send — QBO accepts many more but we keep the
// surface area small and explicit.
export interface QboPaymentCreatePayload {
CustomerRef: QboRef; // { value: customer_ref_id }
TotalAmt: number;
TxnDate?: string; // YYYY-MM-DD
DepositToAccountRef?: QboRef; // { value: account id }
PaymentRefNum?: string; // check number (max 21 chars per QBO)
PrivateNote?: string;
Line?: Array<{
Amount: number;
LinkedTxn?: QboLinkedTxn[]; // one entry per invoice being paid
}>;
}
// Payload for creating a Deposit via POST /v3/company/{realmId}/deposit
// Each Line links to a previously-created Payment so QBO groups them as a
// single bank deposit (matches the bank slip).
export interface QboDepositCreatePayload {
TxnDate?: string;
DepositToAccountRef: QboRef; // required for deposit
PrivateNote?: string;
Line: Array<{
Amount: number;
DetailType: 'DepositLineDetail';
LinkedTxn?: QboLinkedTxn[]; // [{ TxnId: payment_id, TxnType: 'Payment' }]
DepositLineDetail?: Record<string, unknown>;
}>;
}
// Purchase (expense/credit card)
export interface QboPurchase {
Id: string;
@ -156,6 +187,7 @@ export interface QboEntitySyncResult {
entity: string;
success: boolean;
recordsUpserted: number;
recordsDeleted?: number;
duration: number;
error?: string;
}