示例#1
0
        public ServiceResult <SignonDTO> Signup(SignupModel model)
        {
            ServiceResult <SignonDTO> result = new ServiceResult <SignonDTO>();

            if (!ModelState.IsValid)
            {
                result.Code = ReasonCode.MISSING_REQUIRED_FIELDS;
                foreach (string error in ModelState.Values.SelectMany(v => v.Errors.Select(b => b.ErrorMessage)))
                {
                    result.Message += error + Environment.NewLine;
                }

                return(result);
            }

            if (!PinProcessor.TryParse(model.PIN, out string pin))
            {
                result.Code    = ReasonCode.MISSING_REQUIRED_FIELDS;
                result.Message = Resources.PIN格式不正确;
                return(result);
            }


            result.Data = new MerchantAccountComponent().Signup(model.CountryId, model.Cellphone, model.MerchantAccount, model.MerchantName, model.POSSN, model.InvitationCode, pin);
            return(result);
        }
示例#2
0
        public ServiceResult ModifyPIN(ModifyPINModel model)
        {
            var result = new ServiceResult();

            if (!ModelState.IsValid)
            {
                result.Code = ReasonCode.MISSING_REQUIRED_FIELDS;
                foreach (string error in ModelState.Values.SelectMany(v => v.Errors.Select(b => b.ErrorMessage)))
                {
                    result.Message += error + Environment.NewLine;
                }

                return(result);
            }

            if (!PinProcessor.TryParse(model.PIN, out string pin))
            {
                result.Code    = ReasonCode.MISSING_REQUIRED_FIELDS;
                result.Message = Resources.PIN格式不正确;
                return(result);
            }

            new MerchantAccountComponent().ModifyPIN(this.GetMerchantAccountId(), pin);

            return(result);
        }
示例#3
0
        public ServiceResult <bool> ResetPIN(ResetPINModel im)
        {
            var result = new ServiceResult <bool>();

            if (!ModelState.IsValid)
            {
                result.Code = ReasonCode.MISSING_REQUIRED_FIELDS;
                foreach (string error in ModelState.Values.SelectMany(v => v.Errors.Select(b => b.ErrorMessage)))
                {
                    result.Message += error + Environment.NewLine;
                }
                return(result);
            }
            if (!PinProcessor.TryParse(im.PIN, out string pin))
            {
                result.Code    = ReasonCode.MISSING_REQUIRED_FIELDS;
                result.Message = MessageResources.PINInvalidFormat;
                return(result);
            }
            new SecurityComponent().ResetPIN(this.GetUser().Id, pin);
            result.Success();
            result.Data = true;
            return(result);
        }