Esempio n. 1
0
        public RecommendAFriendResponse RecommendAFriend(RecommendAFriendRequest request)
        {
            try
            {
                var command = new RecommendAFriend
                {
                    ReferrerId = request.ReferrerId,
                    Friend = request.Friend
                };

                policy.Apply(command);

                return new RecommendAFriendResponse
                {
                    Status = RecommendAFriendStatus.Success
                };
            }
            catch (ReferralRejectedDueToLongTermOutstandingBalance)
            {
                return new RecommendAFriendResponse
                {
                    Status = RecommendAFriendStatus.ReferralRejected
                };
            }
        }
Esempio n. 2
0
 public void RecommendAFriend(int referrerId, NewAccount friend)
 {
     // validation, open transaction etc
     var command = new RecommendAFriend
     {
         ReferrerId = referrerId,
         Friend = friend
     };
     Task.Factory.StartNew(() => policy.Apply(command));
     // close transaction - success and failure handled in handlers
 }