| Action | Method | Resource | Description |
|---|---|---|---|
| Get all | GET | /loyalty_plans/ | Get all loyalty plans. |
| Get | GET | /loyalty_plans/loyalty_plan_id | Get loyalty plan by id. |
| Update | POST | /loyalty_plans/loyalty_plan_id | Update loyalty plan. Only admins |
| Create | POST | /loyalty_plans | Create loyalty plan. |
| Delete | DELETE | /loyalty_plans/loyalty_plan_id | Delete loyalty plan by id. |
The loyalty plan model is composed of the following attributes:
| Attribute | Type | Required | Description | whereable |
|---|---|---|---|---|
| id | Integer | No | Identifier of the loyalty plan | |
| name | String | Yes | Name of the loyalty plan | |
| type | String | Yes | Type of the loyalty plan: credit_point,cashback | |
| redemption_rate | Float | Yes | Redemption rate of the loyalty plan | |
| accumulation_rate | Float | Yes | Accumulation rate of the loyalty plan | |
| maximum_redemption_type | Integer | No | Maximum redemption type of the loyalty plan: 1, 2 | |
| maximum_redemption_rate | Float | No | Maximum redemption rate of the loyalty plan | |
| maximum_accumulation | Float | No | Maximum accumulation of the loyalty plan | |
| expire_after_minutes | Integer | No | Expire after minutes of the loyalty plan | |
| businesses | array | Yes | Business of the loyalty plan | |
| created_at | Timestamp | No | Date when the loyalty plan was created | |
| updated_at | Timestamp | No | Date when the loyalty plan was updated |
Data of business
| Attribute | Type | Required | Description |
|---|---|---|---|
| id | Integer | Yes | Identifier of the business |
| redeems | Boolean | No | |
| accumulates | Boolean | No | |
| redemption_rate | Float | No | |
| accumulation_rate | Float | No | |
| maximum_redemption_type | Integer | No | Type: 1, 2 |
| maximum_redemption_rate | Float | No | |
| maximum_accumulation | Float | No | |
| expire_after_minutes | Integer | No |

