예제 #1
0
        /// <summary>
        /// Implementation with a generic return type to allow caller to return what type is required
        /// </summary>
        /// <typeparam name="TR"></typeparam>
        /// <param name="membershipDataInput"></param>
        /// <param name="membershipAction"></param>
        /// <returns></returns>
        protected TR1 UpdateOrCancelMembershipDetails <TR1>(
            MembershipDataInput membershipDataInput,
            MembershipActionType membershipAction = MembershipActionType.Unknown) where TR1 : MembershipDetails
        {
            TR1 updatedMembershipdetails = null;

            string message = string.Empty;

            try
            {
                var customerId = UpdatedOrCancelMembership_Worker(membershipDataInput, membershipAction, ref message);

                // Get return membership details instance via a new Get db call using the customer_id -
                // This will return an instance of the requested TR1 return type (MembershipDetails
                // or MembershipDetailsV2) depending on if we have been called from a V1 or V2 route.
                updatedMembershipdetails      = _membershipdataAccess.GetMembershipDetails <string, TR1>(customerId);
                updatedMembershipdetails.Info = message;
                // return updatedMembershipdetails;
            }
            catch (DatabaseException ex)
            {
                throw new DatabaseException(ex.Message);
            }
            catch (ParameterProcessException ex)
            {
                throw new PreprocessingException(ex.Message);
            }
            catch (Exception ex)
            {
                // _logger.Error("UpdateMembershipData : ErrorTag: " + ErrorTagProvider.ErrorTag + " -- " + ex.Message, ex);
                throw new Exception(ex.Message);
            }

            return(updatedMembershipdetails);
        }
예제 #2
0
        protected TR1 ProductSoldMembershipUpdate(MembershipDataInput membershipDataInput)
        {
            TR1 message = default(TR1);

            // GITCS-187 : ProductSold
            message = (TR1)(object)_membershipdataAccess.SetEligible(membershipDataInput);
            return(message);
        }
예제 #3
0
        public TR1 Process(T1 param1)
        {
            TR1 outcome = default(TR1);

            if (param1 is MembershipDataInput)
            {
                dynamic             _membershipInputModel    = param1;
                MembershipDataInput membershipDataInputModel = ((MembershipDataInput)_membershipInputModel);

                // Call worker method
                outcome = (TR1)ProductSoldMembershipUpdate(membershipDataInputModel);
            }
            return(outcome);
        }
예제 #4
0
        public TR1 Process(T1 param1)
        {
            //dynamic updatedMembershipdetails = null;
            TR1 updatedMembershipdetails = default(TR1);

            if (param1 is MembershipDataInput)
            {
                dynamic             _membershipInputModel    = param1;
                MembershipDataInput membershipDataInputModel = ((MembershipDataInput)_membershipInputModel);
                // Convert to the target DataInput model

                // Call base worker method - pass requested result type
                // updatedMembershipdetails = UpdateOrCancelMembershipDetails(membershipDataInputModel, MembershipActionType.Cancel);
                updatedMembershipdetails = UpdateOrCancelMembershipDetails <TR1>(membershipDataInputModel, MembershipActionType.Cancel);
                // GITS-8 : Use generic base method
            }
            return(updatedMembershipdetails);
        }
예제 #5
0
        private string UpdatedOrCancelMembership_Worker(MembershipDataInput membershipDataInput,
                                                        MembershipActionType membershipAction, ref string message)
        {
            // GITCS-9 : Support Activation or Cancellation via new model computed member :
            // MembershipDetails membershipDetails = _membershipdataAccess.GetMembershipDetails( membershipDataInput.CancelationOrActivationKey  );
            MembershipDetails membershipDetails =
                _membershipdataAccess.GetMembershipDetails <string, MembershipDetails>(membershipDataInput.CancelationOrActivationKey);

            MembershipActionType actionToRun = membershipAction;


            switch (actionToRun)
            {
            case MembershipActionType.Decline:
                message = _membershipdataAccess.DeclineMembership(membershipDataInput);
                break;

            case MembershipActionType.Activate:
                message = _membershipdataAccess.UpdateMembership(membershipDataInput);
                break;

            case MembershipActionType.Cancel:
                // GICTS-9 : Implement this branch for cancellation ...
                message = _membershipdataAccess.CancelMembership(membershipDataInput);
                break;

            case MembershipActionType.DoNothing:
                message = "";
                break;

            default:
                throw new Exception($"Unexpected Action to Run: {actionToRun}");
                break;
            }

            return(membershipDetails.CustomerId);
        }
        public MembershipDetails UpdateMembershipData(MembershipDataInput member)
        {
            string            message = string.Empty;
            MembershipDetails updatedMembershipdetails = new MembershipDetails();

            try
            {
                var activation = string.IsNullOrEmpty(member.ActivationId)
                    ? member.EncryptedActivationId
                    : member.ActivationId;
                MembershipDetails membershipDetails = _membershipService.GetMembershipDetails(activation);

                if (membershipDetails.IsEligible != null && membershipDetails.IsEligible.Value)
                {
                    switch (member.OriginalStatus)
                    {
                    case Common.MembershipStatus.NotActivated:
                        switch (member.UpdatedStatus)
                        {
                        case Common.ActionMembershipStatus.Activate:
                            _logger.Info("-----1-------");
                            message = _membershipService.UpdateMembership(member);
                            break;

                        case Common.ActionMembershipStatus.Decline:
                            _logger.Info("-----2-------");
                            message = _membershipService.DeclineMembership(member);
                            break;
                        }
                        break;

                    case Common.MembershipStatus.Declined:
                        switch (member.UpdatedStatus)
                        {
                        case Common.ActionMembershipStatus.Activate:
                            _logger.Info("-----3-------");
                            message = _membershipService.UpdateMembership(member);
                            break;
                        }
                        break;

                    case Common.MembershipStatus.Cancelled:
                        switch (member.UpdatedStatus)
                        {
                        case Common.ActionMembershipStatus.Activate:
                            _logger.Info("----4-------");
                            message = _membershipService.UpdateMembership(member);
                            break;
                        }
                        break;

                    case Common.MembershipStatus.Lapsed:
                        switch (member.UpdatedStatus)
                        {
                        case Common.ActionMembershipStatus.Activate:
                            _logger.Info("----5-------");
                            message = _membershipService.UpdateMembership(member);
                            break;
                        }
                        break;
                    }
                }
                else if (member.OverrideFlag != null && (membershipDetails.IsEligible != null &&
                                                         (membershipDetails.IsEligible.Value == false &&
                                                          member.OriginalStatus == Common.MembershipStatus.NotActivated &&
                                                          member.UpdatedStatus == Common.ActionMembershipStatus.Activate) &&
                                                         member.OverrideFlag.Value))
                {
                    _logger.Info("-----6-------");
                    message = _membershipService.UpdateMembership(member);
                }
                else if (membershipDetails.IsEligible != null &&
                         (membershipDetails.IsEligible.Value == false &&
                          member.OriginalStatus == Common.MembershipStatus.Declined &&
                          member.UpdatedStatus == Common.ActionMembershipStatus.Activate))
                {
                    _logger.Info("-----7-------");
                    message = _membershipService.UpdateMembership(member);
                }
                else if (membershipDetails.IsEligible != null &&
                         (membershipDetails.IsEligible.Value == false &&
                          member.OriginalStatus == Common.MembershipStatus.NotActivated &&
                          member.UpdatedStatus == Common.ActionMembershipStatus.Decline))
                {
                    member.OverrideReason = member.DeclineReason;
                    member.OverrideFlag   = true;
                    _logger.Info("-----8-------");
                    message = _membershipService.DeclineMembership(member);
                }

                else if (membershipDetails.IsEligible != null &&
                         (membershipDetails.IsEligible.Value == false &&
                          member.OriginalStatus == Common.MembershipStatus.Cancelled &&
                          member.UpdatedStatus == Common.ActionMembershipStatus.Activate))
                {
                    {
                        _logger.Info("-----9-------");
                        message = _membershipService.UpdateMembership(member);
                    }
                }
                else if (membershipDetails.IsEligible != null &&
                         (membershipDetails.IsEligible.Value == false &&
                          member.OriginalStatus == Common.MembershipStatus.Lapsed &&
                          member.UpdatedStatus == Common.ActionMembershipStatus.Activate))
                {
                    {
                        _logger.Info("-----10-------");
                        message = _membershipService.UpdateMembership(member);
                    }
                }

                updatedMembershipdetails      = _membershipService.GetMembershipDetails(membershipDetails.CustomerId);
                updatedMembershipdetails.Info = message;
                return(updatedMembershipdetails);
            }
            catch (DatabaseException ex)
            {
                throw new DatabaseException(ex.Message);
            }
            catch (ParameterProcessException ex)
            {
                throw new PreprocessingException(ex.Message);
            }
            catch (Exception ex)
            {
                // _logger.Error("UpdateMembershipData : ErrorTag: " + ErrorTagProvider.ErrorTag + " -- " + ex.Message, ex);
                throw new Exception(ex.Message);
            }
        }
 string IMembershipService.CreateTempMembership(MembershipDataInput input)
 {
     return(_dataAccess.CreateTempMembership(input));
 }
 public string DeclineMembership(MembershipDataInput input)
 {
     return(_dataAccess.DeclineMembership(input));
 }
 public string UpdateMembership(MembershipDataInput input)
 {
     return(_dataAccess.UpdateMembership(input));
 }