-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Open
Description
Integrate the Incentives API into Midas Core so that after a transaction is validated, it is posted to the Incentives API endpoint (http://localhost:8080/incentive) as a JSON serialized Transaction object. The API will respond with an Incentive object containing the "amount" field. This incentive amount should be recorded alongside the transaction and added to the recipient's balance, but not deducted from the sender's balance.
Requirements:
- Use Spring RestTemplate to POST validated transactions to the Incentives API
- Ensure the Transaction object is properly serialized (Spring can handle serialization)
- Update the Transaction model to include an incentive field
- When modifying balances, add incentive to recipient; do not deduct from sender
- Ensure robust error handling for API communication
- Document integration steps and expected behaviors
- Run "TaskFourTests" after integration and verify user balances
API Contract:
- Endpoint: POST http://localhost:8080/incentive
- Request: Transaction object (JSON)
- Response: Incentive object (JSON, field: amount >= 0)
Edge Cases:
- Handle failed API calls gracefully
- Ensure incentives are always >= 0
- Incentive must be recorded correctly for auditing purposes
Testing:
- Use the debugger to verify the final balance of user "wilbur" after processing all transactions.
- Submit the integer balance as required.
Metadata
Metadata
Assignees
Labels
No labels