feat: initialize project backend structure and document system specifications across all modules
This commit is contained in:
64
docs/specs/reward_campaign/reward_campaign_rule.md
Normal file
64
docs/specs/reward_campaign/reward_campaign_rule.md
Normal file
@@ -0,0 +1,64 @@
|
||||
---
|
||||
title: "Reward Campaign Rule"
|
||||
type: OpenSpec
|
||||
status: Draft
|
||||
domain: Reward Campaign Management
|
||||
---
|
||||
|
||||
# Reward Campaign Rule
|
||||
|
||||
## Requirement Definition
|
||||
Campaign Rules define the business rules for giving a reward, defining conditions for redemption, or triggering batch updates (CEP/REP). This spec covers standard Award, Redeem, and Adjust rules.
|
||||
|
||||
## Process Flow
|
||||
|
||||
### Pre-Conditions
|
||||
- Users must have access rights.
|
||||
|
||||
## Business Rules
|
||||
|
||||
### Data Schema
|
||||
|
||||
#### General Information
|
||||
| Field Name | Description | Logic Type | Constraints / Rules |
|
||||
|---|---|---|---|
|
||||
| Campaign ID | Parent campaign. | Enum (Lookup) | Required. |
|
||||
| Campaign Rule ID | System-generated identifier. | String (10) | Required. |
|
||||
| Campaign Rule Name | Name of the rule. | String (50) | Required. |
|
||||
| Rule Type | Award, Redeem, Adjust. | Enum (Lookup) | Required. |
|
||||
| Effective Date From | Start of effective period. | Date | Required. |
|
||||
| Effective Date To | End of effective period. | Date | Required. |
|
||||
|
||||
#### Rule Setting
|
||||
| Field Name | Description | Logic Type | Constraints / Rules |
|
||||
|---|---|---|---|
|
||||
| Effective Period is Based On| Transaction Date vs Post Date. | Enum | Required. |
|
||||
| Pool | Reward pool applied to this rule. | Enum (Lookup) | Required. |
|
||||
| Item Code | eVoucher item if Pool Type is eVoucher. | Enum (Lookup) | Conditional. |
|
||||
| Message Template ID | SMS/Email template if rule hit. | Enum (Lookup) | Optional. |
|
||||
| Stop if criteria met | If true, halts further rule evaluation for this TC. | Boolean | Default False. |
|
||||
| Do not update pool | Rule updates Counters/Attributes but not the pool. | Boolean | Default False. |
|
||||
|
||||
#### Transaction Code Linkage
|
||||
| Field Name | Description | Logic Type | Constraints / Rules |
|
||||
|---|---|---|---|
|
||||
| Transaction Code | TC that triggers this rule. | Enum (Lookup) | Required. |
|
||||
| Execution Sequence | Priority order of execution. | Integer | Required. Unique per Rule Type + TC combo. |
|
||||
|
||||
#### Formula Setting (If Rule Type requires formula)
|
||||
| Field Name | Description | Logic Type | Constraints / Rules |
|
||||
|---|---|---|---|
|
||||
| Amount to Use (A) | Derived amount (from tx data or counter). | Enum | Required. |
|
||||
| Cap A not more than | Caps the input 'A'. | Decimal | Optional. |
|
||||
| Formula Result is rounded | Down, Nearest, Up. | Enum | Required. |
|
||||
| Award Limit (At Least) | Minimum guaranteed result. | Decimal | Optional. |
|
||||
| Award Limit (No More Than) | Max limit (can be tied to a Counter). | Decimal | Optional. |
|
||||
|
||||
### Execution
|
||||
- An incoming transaction's TC is matched against Rules.
|
||||
- Rules linked to the TC are evaluated in Execution Sequence order.
|
||||
- If Rule Criteria (defined separately) pass, the Formula (defined separately) calculates the reward.
|
||||
- If "Stop if criteria met" is true, processing halts.
|
||||
|
||||
## Exception Flow
|
||||
- N/A
|
||||
Reference in New Issue
Block a user