Beispiel #1
0
        /// <summary>
        ///  保存用户实名认证信息
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public static CustomerAuthenticationInfo SaveCustomerAuthenticationInfo(CustomerAuthenticationInfo info)
        {
            if (!info.CustomerSysNo.HasValue || info.CustomerSysNo.Value <= 0)
            {
                throw new BusinessException("此用户不存在");
            }
            if (string.IsNullOrWhiteSpace(info.Name))
            {
                throw new BusinessException("实名认证信息姓名不能为空");
            }
            if (!info.IDCardType.HasValue)
            {
                throw new BusinessException("实名认证信息必须选择一种证件类型");
            }
            if (string.IsNullOrWhiteSpace(info.IDCardNumber))
            {
                throw new BusinessException("实名认证信息证件号不能为空");
            }
            if (!info.Birthday.HasValue)
            {
                throw new BusinessException("实名认证信息出生日期不能为空");
            }
            if (info.IDCardType.Value == IDCardType.IdentityCard)
            {
                string errorMsg;
                bool   checkResult = CheckIDCard(info.IDCardNumber, info.Birthday.Value, out errorMsg);
                if (!checkResult)
                {
                    throw new BusinessException(errorMsg);
                }
            }

            var authInfo = CustomerDA.GetCustomerAuthenticationInfo(info.CustomerSysNo.Value);

            if (authInfo == null)
            {
                return(CustomerDA.InsertCustomerAuthenticationInfo(info));
            }
            else
            {
                info.SysNo = authInfo.SysNo;
                return(CustomerDA.UpdateCustomerAuthenticationInfo(info));
            }
        }
Beispiel #2
0
 /// <summary>
 /// 取得用户实名认证信息
 /// </summary>
 /// <param name="customerSysno"></param>
 /// <returns></returns>
 public static CustomerAuthenticationInfo GetCustomerAuthenticationInfo(int customerSysno)
 {
     return(CustomerDA.GetCustomerAuthenticationInfo(customerSysno));
 }
        private static CheckOutResult PreCheckAndBuild(CheckOutContext context, ShoppingCart shoppingCart, int customerSysNo, int orderSource
                                                       , Func <OrderInfo, OrderPipelineProcessResult> action)
        {
            CheckOutResult result = new CheckOutResult();

            MemberInfo memberInfo = CustomerDA.GetCustomerInfo(customerSysNo);

            CheckOutContext newCheckoutContenxt = new CheckOutContext();

            if (context != null)
            {
                newCheckoutContenxt = context.Clone();
            }

            CustomerInfo customerInfo = new CustomerInfo()
            {
                AccountBalance   = memberInfo.ValidPrepayAmt,
                AccountPoint     = memberInfo.ValidScore,
                CustomerRank     = (int)memberInfo.CustomerRank,
                ID               = memberInfo.CustomerID,
                SysNo            = memberInfo.SysNo,
                Name             = memberInfo.CustomerName,
                IsEmailConfirmed = memberInfo.IsEmailConfirmed,
                IsPhoneValided   = memberInfo.IsPhoneValided,
                CellPhone        = memberInfo.CellPhone,
                SocietyID        = memberInfo.SocietyID
            };

            result.Customer = customerInfo;
            //用户个人实名认证信息
            result.CustomerAuthenticationInfo = CustomerDA.GetCustomerAuthenticationInfo(customerSysNo);

            //用户购物发票信息
            result.CustomerInvoiceInfo = CustomerDA.GetCustomerInvoiceInfo(customerSysNo);
            if (result.CustomerInvoiceInfo == null)
            {
                result.CustomerInvoiceInfo = new Entity.Member.CustomerInvoiceInfo()
                {
                    CustomerSysNo = customerSysNo, InvoiceTitle = customerInfo.Name
                };
            }

            //收货地址
            var custShippingAddressListResult = GetCustomerShippingAddressList(context, customerSysNo);

            result.ShippingAddressList = custShippingAddressListResult.ShippingAddressList;
            result.SelShippingAddress  = custShippingAddressListResult.SelShippingAddress;

            //支付方式&配送方式
            var payAndShipTypeResult = GetPayAndShipTypeList(context, customerSysNo, shoppingCart);

            result.PaymentCategoryList  = payAndShipTypeResult.PaymentCategoryList;
            result.SelPaymentCategoryID = payAndShipTypeResult.SelPaymentCategoryID;
            result.PayTypeList          = payAndShipTypeResult.PayTypeList;
            result.SelPayType           = payAndShipTypeResult.SelPayType;
            result.ShipTypeList         = payAndShipTypeResult.ShipTypeList;
            result.SelShipType          = payAndShipTypeResult.SelShipType;

            //根据CheckOutContext 进一步构造shoppingCartResult.ReturnData对象
            OrderInfo preOrderInfo = SOPipelineProcessor.Convert2OrderInfo(shoppingCart);

            preOrderInfo.Customer               = customerInfo;
            preOrderInfo.PayTypeID              = result.SelPayType.PayTypeID.ToString();
            preOrderInfo.ShipTypeID             = result.SelShipType.ShipTypeSysNo.ToString();
            preOrderInfo.Memo                   = newCheckoutContenxt.OrderMemo;
            preOrderInfo.CouponCode             = newCheckoutContenxt.PromotionCode;
            preOrderInfo.ChannelID              = shoppingCart.ChannelID;
            preOrderInfo.LanguageCode           = shoppingCart.LanguageCode;
            preOrderInfo.OrderSource            = orderSource;
            preOrderInfo.VirualGroupBuyOrderTel = context != null ? context.VirualGroupBuyOrderTel : "";

            preOrderInfo.Contact = new ContactInfo()
            {
                AddressAreaID = result.SelShippingAddress.ReceiveAreaSysNo,
                //AddressAreaID = result.SelShippingAddress.ReceiveAreaCitySysNo,
                AddressTitle  = result.SelShippingAddress.AddressTitle,
                AddressDetail = result.SelShippingAddress.ReceiveAddress,
                MobilePhone   = result.SelShippingAddress.ReceiveCellPhone,
                Phone         = result.SelShippingAddress.ReceivePhone,
                Name          = result.SelShippingAddress.ReceiveName,
                ZipCode       = result.SelShippingAddress.ReceiveZip,
                ID            = result.SelShippingAddress.SysNo,
            };
            //使用余额进行支付,给订单的余额支付金额赋值,在SOPipline中会对订单的余额支付金额重新进行计算
            if (newCheckoutContenxt.IsUsedPrePay > 0)
            {
                preOrderInfo.BalancePayAmount = customerInfo.AccountBalance;
            }
            //积分
            preOrderInfo.PointPay = newCheckoutContenxt.PointPay;
            //礼品卡
            if (newCheckoutContenxt.GiftCardList != null && newCheckoutContenxt.GiftCardList.Count > 0)
            {
                preOrderInfo.GiftCardList = new List <GiftCardInfo>();
                foreach (var giftCardContext in newCheckoutContenxt.GiftCardList)
                {
                    if (!string.IsNullOrWhiteSpace(giftCardContext.Crypto))
                    {
                        giftCardContext.Password = ExtractGiftCardPassword(giftCardContext.Password, customerSysNo);
                    }
                    GiftCardInfo giftCardInfo = new GiftCardInfo()
                    {
                        Code     = giftCardContext.Code,
                        Password = giftCardContext.Password
                    };
                    giftCardInfo["Crypto"] = giftCardContext.Crypto;
                    preOrderInfo.GiftCardList.Add(giftCardInfo);
                }
            }
            //购物发票,1表示要开发票
            if (newCheckoutContenxt.NeedInvoice == 1)
            {
                preOrderInfo.Receipt = new ReceiptInfo()
                {
                    PersonalInvoiceTitle = result.CustomerInvoiceInfo.InvoiceTitle
                };
            }
            //执行真正的action操作
            OrderPipelineProcessResult checkOutResult = action(preOrderInfo);

            SetCheckoutResult(checkOutResult, result, newCheckoutContenxt);

            return(result);
        }