Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

08 — Form Specifications (Payments)

Every form field, derived from process-payment.dto.ts, refund-payment.dto.ts, and the reconcile endpoint body.


F1 — Record payment (POST /payments)

FieldType / controlLabelHint / placeholderKeyboardValidation (server)Error message
amountAppTextField decimalAmounte.g. 250.00numeric-decimal@IsNumber @Min(0)"Enter a valid amount (min 0)"
currencyAppTextField (read-only default)CurrencyUSDtext@IsString @IsOptional
gatewayAppDropdownGatewayrequired@IsEnum(PaymentGateway)"Select payment method"
gatewayTransactionIdAppTextFieldGateway referenceoptional, gateway methodstext@IsString @IsOptional
invoiceIdAppDropdown searchableInvoiceoptional (search by invoice no.)@IsString @IsOptional
invoiceTypeAppTextFieldInvoice typeoptionaltext@IsString @IsOptional
payerIdAppTextFieldPayer IDoptionaltext@IsString @IsOptional
payerEmailAppTextFieldPayer emailemailemail@IsString @IsOptional"Enter a valid email" (client)
payerNameAppTextFieldPayer nameoptionaltext@IsString @IsOptional
descriptionAppTextField multilineDescriptionoptionaltext@IsString @IsOptional
  • Defaults: currency USD; amounts empty; gateway none.
  • Dependencies/conditional: selecting an invoice prefills amount + payerName (editable). Offline methods (cash/cheque/bank_transfer) recommend payerName; gateway methods show gatewayTransactionId.
  • Autocomplete: payer name/email from recent payers (client cache) (proposed).
  • Submission: client validates → POST /payments; button loading; no optimistic update (server is source of truth).
  • Success: inline payment + receipt cards; offer "View receipt", "Done".
  • Failure: 400 field errors mapped; 409 conflict banner + refresh; 5xx generic + retry; values preserved.
  • Undo: not applicable (confirmatory commitment).

F2 — Refund (POST /payments/refund)

FieldLabelValidationNotes
paymentIdhidden (from S2 context)@IsStringlocked
amountRefund amount@IsNumber @Min(0) @IsOptional; max = amount − refundedAmountdefault full refundable; 0 → inline error
reasonReason@IsString @IsOptional; client min 3 charsshow in confirmation
  • Submission: loading; on success snackbar + status updated; on 409 "Only completed payments can be refunded."/"Refund amount exceeds payment amount." → inline/banner.
  • Optimistic: no.

F3 — Reconcile (PATCH /payments/:transactionRef/reconcile)

FieldTypeValidation
status (body)AppRadio"success"→completed, "failed"→failed, else pending
gatewayResponse (optional client field)textinformational
  • Submission: loading; result status reflected after refresh.
  • Error 404: payment not found → error state.

F4 — Local filters (S1)

  • Search term + status chips — client-side only (no server query support).
  • Debounce 300 ms; clear restores.
  • No validation.