69 lines
3.1 KiB
Go
69 lines
3.1 KiB
Go
package handlers
|
|
|
|
// ReferralCodeData is the learner's stable, case-insensitive share code.
|
|
type ReferralCodeData struct {
|
|
Code string `json:"code" validate:"required" example:"ABCDEF0123456789"`
|
|
}
|
|
|
|
type applyReferralReq struct {
|
|
Code string `json:"code" validate:"required" example:"ABCDEF0123456789"`
|
|
}
|
|
|
|
type updateReferralSettingsReq struct {
|
|
// Percentage of the qualifying verified course payment, with at most two decimal places. Zero disables new commissions.
|
|
Percent *float64 `json:"commission_percent" validate:"required" minimum:"0" maximum:"100" example:"10.25"`
|
|
}
|
|
|
|
type ReferralWalletBalance struct {
|
|
Currency string `json:"currency" example:"ETB"`
|
|
// Decimal string; balances are not combined across currencies.
|
|
Balance string `json:"balance" example:"125.50"`
|
|
}
|
|
|
|
type ReferralOverviewData struct {
|
|
Code string `json:"code" validate:"required" example:"ABCDEF0123456789"`
|
|
CommissionPercent string `json:"commission_percent" example:"10.25"`
|
|
TotalReferrals int64 `json:"total_referrals" example:"12"`
|
|
ConvertedReferrals int64 `json:"converted_referrals" example:"3"`
|
|
Wallet []ReferralWalletBalance `json:"wallet"`
|
|
}
|
|
|
|
type ReferralHistoryItem struct {
|
|
ID int64 `json:"id" example:"14"`
|
|
CreatedAt string `json:"created_at" format:"date-time" example:"2026-10-28T09:00:00Z"`
|
|
Converted bool `json:"converted" example:"true"`
|
|
}
|
|
type ReferralHistoryData struct {
|
|
Items []ReferralHistoryItem `json:"items"`
|
|
Limit int32 `json:"limit" example:"20"`
|
|
Offset int32 `json:"offset" example:"0"`
|
|
}
|
|
type ReferralCommissionItem struct {
|
|
ID int64 `json:"id" example:"7"`
|
|
PaymentID int64 `json:"payment_id" example:"42"`
|
|
CommissionPercent string `json:"commission_percent" example:"10.25"`
|
|
Amount string `json:"amount" example:"51.25"`
|
|
Currency string `json:"currency" example:"ETB"`
|
|
CreatedAt string `json:"created_at" format:"date-time" example:"2026-10-28T09:00:00Z"`
|
|
// Null until the qualifying payment leaves SUCCESS; reversed credits no longer contribute to the balance.
|
|
ReversedAt *string `json:"reversed_at" format:"date-time" extensions:"x-nullable"`
|
|
}
|
|
type ReferralWalletData struct {
|
|
Balances []ReferralWalletBalance `json:"balances"`
|
|
Transactions []ReferralCommissionItem `json:"transactions"`
|
|
Limit int32 `json:"limit" example:"20"`
|
|
Offset int32 `json:"offset" example:"0"`
|
|
}
|
|
type ReferralSettingsData struct {
|
|
CommissionPercent string `json:"commission_percent" example:"10.25"`
|
|
UpdatedAt string `json:"updated_at" format:"date-time" example:"2026-10-28T09:00:00Z"`
|
|
}
|
|
|
|
// NotificationDispatchResponse describes immediate single or bulk notification delivery.
|
|
type NotificationDispatchResponse struct {
|
|
Message string `json:"message"`
|
|
NotificationID string `json:"notification_id,omitempty"`
|
|
RecipientCount *int `json:"recipient_count,omitempty"`
|
|
NotificationIDs []string `json:"notification_ids,omitempty"`
|
|
}
|