Last active
December 12, 2015 11:46
-
-
Save NTCoding/7eaa2e5fc7e0b07688db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class RecommendAFriendService | |
| { | |
| private INewAccountValidator validator; | |
| private ICustomerDirectory customerDirectory; | |
| private IReferralPolicy referralPolicy; | |
| public RecommendAFriendService(ICustomerDirectory customerDirectory, IReferralPolicy referralPolicy, | |
| INewAccountValidator validator) | |
| { | |
| this.validator = validator; | |
| this.customerDirectory = customerDirectory; | |
| this.referralPolicy = referralPolicy; | |
| } | |
| public void RecommendAFriend(int referrerId, NewAccount friendsAccountDetails) | |
| { | |
| validator.Validate(friendsAccountDetails); | |
| var referrer = customerDirectory.Find(referrerId); | |
| var friend = customerDirectory.Add(friendsAccountDetails); | |
| referralPolicy.Apply(referrer, friend); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment