Payment Approve / Reject
Discord buttons for admin approval or rejection of P2P payments.
Source: src/data/payment/payment.command.ts
Button custom IDs
| Pattern | Type | Description |
|---|---|---|
payment:approve:<paymentId> | Button | Admin approves the payment |
payment:reject:<paymentId> | Button | Admin clicks to open reject-reason modal |
payment:reject-modal:<paymentId> | Modal submit | Admin submits rejection reason |
Approve flow
- Admin sees the approval embed posted to the admin channel.
- Admin clicks Approve.
- Bot checks admin role via
isAdmin. - Bot calls
PaymentService.confirmPayment(ctx, paymentId, adminUserId). - Bot replies with an ephemeral "Payment confirmed" message.
- Bot posts a thread/channel message:
Payment for order \ORD-XXX` confirmed by @admin`.
Reject flow
- Admin clicks Reject.
- Bot checks admin role, then opens the rejection reason modal.
- Admin submits a reason (3–500 characters).
- Bot calls
PaymentService.rejectPayment(ctx, paymentId, adminUserId, reason). - Bot replies with an ephemeral "Payment rejected" message.
- Bot posts a thread/channel message with the reason.
Permission requirement
Both flows call isAdmin(tenantId, memberRoleIds) before proceeding. Unauthorized users receive an ephemeral error.
Wiring
The handlers are registered in discord-command-router.ts via the paymentCommands dependency:
createDiscordCommandRouter({
// ...
paymentCommands: {
paymentService,
sendThreadMessage, // optional — omit if thread posting not needed
},
})