public int GetTransactionAmountOfPaymentSource(PaymentSource paymentSource) { if (_totalTransactionDetails.ContainsKey(paymentSource)) { return(_totalTransactionDetails[paymentSource]); } return(0); }
public int GetMaxmimumTrasactionAmountEligibleForOffer(PaymentSource paymentSource) { if (_paymentSourceOffers.ContainsKey(paymentSource)) { return(_paymentSourceOffers[paymentSource]); } throw new OfferNotFoundException(); }
public void makeTransaction(PaymentSource paymentSource, int amount) { if (_totalTransactionDetails.ContainsKey(paymentSource)) { _totalTransactionDetails[paymentSource] += amount; } else { _totalTransactionDetails[paymentSource] = amount; } }
public Boolean IsUserEligibleForOffer(PaymentSource paymentSource) { var maximumAmountForOffer = _offerEligibilityManager.GetMaxmimumTrasactionAmountEligibleForOffer(paymentSource); var totalTransactionAmount = _transactionManager.GetTransactionAmountOfPaymentSource(paymentSource); if (totalTransactionAmount > maximumAmountForOffer) { return(true); } return(false); }
public void SetMaxmimumTrasactionAmountEligibleForOffer(PaymentSource paymentSource, int amount) { if (_paymentSourceOffers.ContainsKey(paymentSource)) { _paymentSourceOffers[paymentSource] = amount; } else { _paymentSourceOffers.Add(paymentSource, amount); } }