removePromotionFromDatabase method
override
Implementation
@override
Future<void> removePromotionFromDatabase(PromotionRemovalRequest req) async {
await Future.delayed(Duration(milliseconds: 200));
if (cardDatabase.containsKey(req.targetCardId)) {
for (Promotion promo in cardDatabase[req.targetCardId].promotions) {
if (promo.id == req.targetPromotionId) {
cardDatabase[req.targetCardId].promotions.remove(promo);
return;
}
}
throw Exception('The promotion is not found');
} else {
throw Exception('The credit card is not found');
}
}