Preskoči na sadržaj

E8-F3: Refund Processing

Epic: E8: Payment Processing

Size: M (Medium)

Problem / Outcome

Process refunds via Stripe and create credit notes. Supports both self-service refunds (triggered by buyer cancellation) and support-initiated refunds.

Scope

In-Scope:

  • Refund via Stripe gateway
  • Credit note creation via e-racuni
  • Self-service refunds (full refund including service fee)
  • Support-initiated refunds (service fee non-refundable)
  • Partial refunds (some tickets from order)
  • Full refunds (all tickets from order)

Out-of-Scope:

  • Alternative refund methods
  • Cash refunds

Refund Types

Type Trigger Service Fee Processing
Self-Service Buyer cancellation (>48h) Refundable Automatic
Support Support agent action Non-refundable Manual approval
System Match cancellation Refundable Automatic

Acceptance Criteria

  • AC1: Self-service refunds include ticket price + service fee
  • AC2: Support refunds process ticket price only (fee retained)
  • AC3: Stripe refund initiated via API
  • AC4: Credit note created via e-racuni API
  • AC5: Refund source tracked (self_service, support, system)

Data Model Impact

Refund table:
- id (UUID, PK)
- order_id (UUID, FK)
- ticket_id (UUID, FK, nullable)
- stripe_refund_id (VARCHAR)
- refund_amount (DECIMAL)
- fee_retained (DECIMAL)
- reason (VARCHAR)
- source (ENUM: self_service, support, system)
- cancellation_reason (VARCHAR, nullable)
- status (ENUM: pending, processing, completed, failed)
- requested_by (UUID, FK)
- approved_by (UUID, FK, nullable)
- created_at (TIMESTAMP)
- completed_at (TIMESTAMP)

Payment table:
- refund_status (ENUM: none, partial, full)
- refunded_amount (DECIMAL)

Order table:
- refund_status (ENUM: none, partial, full)
- refunded_amount (DECIMAL)

Permissions/Roles

  • Admin (Support Agent, Finance)

How to Verify

npm test -- --grep "refund processing"

Expected: Refund amount correct, credit note created.

Dependencies

Implementation Tasks

See E8: Payment Processing Tasks

Doc References


Last Updated: January 2026