First part of PC-601 (docs/prd-point-coin.md §10.7): the code that has had no way in since balances moved to the wallet. - The /marketing/customer-points and /marketing/customer-tokens routes were commented out; their 16 handler methods, the GamificationService methods behind them, and the validators, transformers, mappers and contract/model types only they used are gone. - CustomerPointsProcessor loses its "not implemented" stubs; it keeps the customer app's balance, wallet and games endpoints. - CustomerTokensProcessor and the customer points and tokens repositories, wired but no longer called by anything, are gone. What stays until its preconditions are met: the customer_points and customer_tokens tables and their entities, which cmd/wallet-migrate still reads, and the /customer/points, /customer/tokens aliases and the token_used / tokens_remaining fields, until the apps no longer use them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
74 lines
2.8 KiB
Go
74 lines
2.8 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// Response Models
|
|
type GetCustomerPointsResponse struct {
|
|
Status string `json:"status"`
|
|
Message string `json:"message"`
|
|
Data *GetCustomerPointsResponseData `json:"data,omitempty"`
|
|
}
|
|
|
|
type GetCustomerPointsResponseData struct {
|
|
TotalPoints int64 `json:"total_points"`
|
|
PointsHistory []PointsHistoryItem `json:"points_history,omitempty"`
|
|
LastUpdated time.Time `json:"last_updated"`
|
|
}
|
|
|
|
type PointsHistoryItem struct {
|
|
ID string `json:"id"`
|
|
Points int64 `json:"points"`
|
|
Type string `json:"type"` // EARNED, REDEEMED, EXPIRED
|
|
Description string `json:"description"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type GetCustomerTokensResponse struct {
|
|
Status string `json:"status"`
|
|
Message string `json:"message"`
|
|
Data *GetCustomerTokensResponseData `json:"data,omitempty"`
|
|
}
|
|
|
|
type GetCustomerTokensResponseData struct {
|
|
TotalTokens int64 `json:"total_tokens"`
|
|
TokensHistory []TokensHistoryItem `json:"tokens_history,omitempty"`
|
|
LastUpdated time.Time `json:"last_updated"`
|
|
}
|
|
|
|
type TokensHistoryItem struct {
|
|
ID string `json:"id"`
|
|
Tokens int64 `json:"tokens"`
|
|
Type string `json:"type"` // EARNED, REDEEMED, EXPIRED
|
|
Description string `json:"description"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type GetCustomerWalletResponse struct {
|
|
Status string `json:"status"`
|
|
Message string `json:"message"`
|
|
Data *GetCustomerWalletResponseData `json:"data,omitempty"`
|
|
}
|
|
|
|
// GetCustomerWalletResponseData is GET /customer/wallet (docs/prd-point-coin.md F6).
|
|
type GetCustomerWalletResponseData struct {
|
|
// Balances the customer can spend now.
|
|
PointBalance int64 `json:"point_balance"`
|
|
CoinBalance int64 `json:"coin_balance"`
|
|
// Rupiah value of one EnakPoint, and of the whole point balance. EnakPoint only
|
|
// ever pays for orders, so the app shows this as "setara potongan Rp …" (K7).
|
|
PointValue int64 `json:"point_value"`
|
|
PointDiscountValue int64 `json:"point_discount_value"`
|
|
NearestExpiring CustomerWalletNearestExpiring `json:"nearest_expiring"`
|
|
RecentTransactions []CustomerWalletTransaction `json:"recent_transactions"`
|
|
|
|
// Deprecated: the shape of this endpoint before the wallet, kept for app versions
|
|
// that still read it. Filled from the wallet like the fields above.
|
|
TotalPoints int64 `json:"total_points"`
|
|
TotalTokens int64 `json:"total_tokens"`
|
|
PointsHistory []PointsHistoryItem `json:"points_history,omitempty"`
|
|
TokensHistory []TokensHistoryItem `json:"tokens_history,omitempty"`
|
|
LastUpdated time.Time `json:"last_updated"`
|
|
}
|