EnakGame phase 10 of docs/tasks-enakgame.md (EG-1001 to EG-1003). Spin (EG-1001) - PROBABILITY entries take an optional label (a wheel segment). The customer game list shows a PROBABILITY game's prizes (entry, label, amount, never weights), and completing returns the drawn prize, so the client can draw the wheel and stop it on the server's draw. - docs/enakgame-spin.md: the admin steps to set up spin per organization (no seeder) and the customer app flow. An HTTP test plays it end to end. Old game flow removed (EG-1002) - Routes POST /customer/spin, GET /customer/games, GET /customer/ferris-wheel, and admin /marketing/games, /marketing/game-prizes, /marketing/rewards, with their handlers, services, processors, repositories, validators, models, contracts, mappers and tests (GamePlayProcessor, SpinGameService, rewards, ...). This also closes RFC §15 findings 1 and 2 (double charge, spinning another org's game). - Tables games, game_prizes, game_plays and rewards stay for ledger history. entities.StringSlice moves to its own file; the omset tracker (unrouted) keeps game_id but no longer embeds the old game response. games.is_active dropped (EG-1003) - Migration 000115; nothing reads metadata.coin_cost any more. The EnakPoint integration docs now point at /customer/enakgame. The Postgres tests were not run: no test database here. Migration 000115 has not been run anywhere. The customer app must stop calling the removed endpoints before this is deployed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
94 lines
4.1 KiB
Go
94 lines
4.1 KiB
Go
package constants
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
)
|
|
|
|
const (
|
|
InternalServerErrorCode = "900"
|
|
MissingFieldErrorCode = "303"
|
|
MalformedFieldErrorCode = "310"
|
|
ValidationErrorCode = "304"
|
|
InvalidFieldErrorCode = "305"
|
|
NotFoundErrorCode = "404"
|
|
// PIN outcomes the customer app tells apart (docs/prd-point-coin.md §9).
|
|
PinNotSetErrorCode = "PIN_NOT_SET"
|
|
PinInvalidErrorCode = "PIN_INVALID"
|
|
PinLockedErrorCode = "PIN_LOCKED"
|
|
TransferBlockedErrorCode = "TRANSFER_BLOCKED"
|
|
TooManyRequestsErrorCode = "429"
|
|
)
|
|
|
|
const (
|
|
RequestEntity = "request"
|
|
UserServiceEntity = "user_service"
|
|
OrganizationServiceEntity = "organization_service"
|
|
CategoryServiceEntity = "category_service"
|
|
ProductServiceEntity = "product_service"
|
|
ProductVariantServiceEntity = "product_variant_service"
|
|
InventoryServiceEntity = "inventory_service"
|
|
OrderServiceEntity = "order_service"
|
|
CustomerServiceEntity = "customer_service"
|
|
UserValidatorEntity = "user_validator"
|
|
AuthHandlerEntity = "auth_handler"
|
|
UserHandlerEntity = "user_handler"
|
|
CategoryHandlerEntity = "category_handler"
|
|
ProductHandlerEntity = "product_handler"
|
|
ProductVariantHandlerEntity = "product_variant_handler"
|
|
InventoryHandlerEntity = "inventory_handler"
|
|
OrderValidatorEntity = "order_validator"
|
|
OrderHandlerEntity = "order_handler"
|
|
OrganizationValidatorEntity = "organization_validator"
|
|
OrgHandlerEntity = "organization_handler"
|
|
PaymentMethodValidatorEntity = "payment_method_validator"
|
|
PaymentMethodHandlerEntity = "payment_method_handler"
|
|
OutletServiceEntity = "outlet_service"
|
|
VendorServiceEntity = "vendor_service"
|
|
PurchaseOrderServiceEntity = "purchase_order_service"
|
|
PurchaseCategoryServiceEntity = "purchase_category_service"
|
|
IngredientUnitConverterServiceEntity = "ingredient_unit_converter_service"
|
|
IngredientCompositionServiceEntity = "ingredient_composition_service"
|
|
TableEntity = "table"
|
|
// Gamification entities
|
|
CustomerPointsEntity = "customer_points"
|
|
TierEntity = "tier"
|
|
OmsetTrackerEntity = "omset_tracker"
|
|
CampaignEntity = "campaign"
|
|
CampaignRuleEntity = "campaign_rule"
|
|
CustomerEntity = "customer"
|
|
UserDeviceServiceEntity = "user_device_service"
|
|
NotificationServiceEntity = "notification_service"
|
|
NotificationHandlerEntity = "notification_handler"
|
|
ProductOutletPriceServiceEntity = "product_outlet_price_service"
|
|
ExpenseServiceEntity = "expense_service"
|
|
CashAdvanceServiceEntity = "cash_advance_service"
|
|
WalletServiceEntity = "wallet_service"
|
|
EnakGameServiceEntity = "enakgame_service"
|
|
LoyaltySettingsServiceEntity = "loyalty_settings_service"
|
|
CustomerPinServiceEntity = "customer_pin_service"
|
|
)
|
|
|
|
var HttpErrorMap = map[string]int{
|
|
InternalServerErrorCode: http.StatusInternalServerError,
|
|
MissingFieldErrorCode: http.StatusBadRequest,
|
|
MalformedFieldErrorCode: http.StatusBadRequest,
|
|
ValidationErrorCode: http.StatusBadRequest,
|
|
InvalidFieldErrorCode: http.StatusBadRequest,
|
|
NotFoundErrorCode: http.StatusNotFound,
|
|
PinNotSetErrorCode: http.StatusForbidden,
|
|
PinInvalidErrorCode: http.StatusBadRequest,
|
|
PinLockedErrorCode: http.StatusLocked,
|
|
TransferBlockedErrorCode: http.StatusForbidden,
|
|
TooManyRequestsErrorCode: http.StatusTooManyRequests,
|
|
}
|
|
|
|
// Error messages
|
|
var (
|
|
ErrPaymentMethodNameRequired = fmt.Errorf("payment method name is required")
|
|
ErrPaymentMethodTypeRequired = fmt.Errorf("payment method type is required")
|
|
ErrInvalidPaymentMethodType = fmt.Errorf("invalid payment method type")
|
|
ErrInvalidPageNumber = fmt.Errorf("page number must be greater than 0")
|
|
ErrInvalidLimit = fmt.Errorf("limit must be between 1 and 100")
|
|
)
|