4.0 Donation ‐ Core Components - FatinaAlTaherr/HopeConnect GitHub Wiki
Overview
The Donation Management System handles monetary and in-kind donations to orphanages, including payment processing, tracking, and reporting. It integrates with Stripe for payment processing and provides comprehensive tracking of donation status and impact.
Models
Donation
Core donation entity tracking all contributions.
- Attributes:
id
: Unique identifierdonor
: Contributing userorphanage
: Beneficiary organizationtype
: MONEY, GOODS, or SERVICEScategory
: GENERAL_FUND, EDUCATION_SUPPORT, etc.amount
: Donation valuestatus
: PENDING, PROCESSING, COMPLETED, etc.paymentIntent
: Stripe payment referencetransactionFee
: Processing fee amountnetAmount
: Amount after feescreatedAt/updatedAt
: Timestamps
DonationItem
For in-kind donations.
- Attributes:
name
: Item descriptionquantity
: Number of itemsitemCondition
: Condition descriptionsize
: Relevant for clothing
DeliveryTracking
Package tracking for physical donations.
- Attributes:
trackingNumber
: Carrier referencestatus
: PICKED_UP, IN_TRANSIT, etc.checkpoints
: List of delivery milestonesestimated/actualDelivery
: Timestamps
DonationUpdate
Progress updates for donors.
- Attributes:
title
: Update headlinedescription
: Detailed informationimageUrl
: Optional visual evidence
Review
Donor feedback system.
- Attributes:
rating
: 1-5 scalecomment
: Written feedbackreviewDate
: Submission timestamp
Enums
DonationType
- MONEY
- GOODS
- SERVICES
DonationCategory
- GENERAL_FUND
- EDUCATION_SUPPORT
- MEDICAL_AID
- CLOTHING
- FOOD
- EDUCATIONAL_MATERIALS
DonationStatus
- PENDING
- PROCESSING
- COMPLETED
- DELIVERED
- CANCELLED
DeliveryStatus
- PICKED_UP
- IN_TRANSIT
- AT_WAREHOUSE
- OUT_FOR_DELIVERY
- DELIVERED
- RETURNED
Services
DonationService
Core donation processing logic.
- Key Methods:
createDonation()
: Handles new donations with fee calculationsconfirmDonationPayment()
: Finalizes successful transactions- Management methods for items, updates, tracking, and reviews
- Email notification system for donors/orphanages
DonationPaymentService
Stripe integration handling.
- Key Methods:
createDonationSession()
: Sets up Stripe checkoutconfirmSuccessfulPayment()
: Validates completed payments
Controllers
DonationController
Primary donation endpoints.
- Key Endpoints:
POST /donations
: Create new donation- Payment processing endpoints
- Donation item management
- Delivery tracking updates
- Review submission
FeeConfig
Transaction fee configuration.
transactionFeePercentage
: Percentage feeminimumFee
: Minimum chargemaximumFee
: Maximum charge cap