コード例 #1
0
        /// <summary>
        /// 支付
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public string Payment(int SOSysNo)
        {
            ChargeContext context = new ChargeContext();

            context.SOInfo = ShoppingOrderDA.PayGetCenterDBOrderInfoBySOSysNo(SOSysNo);
            if (context.SOInfo == null || context.SOInfo.SOItemList == null ||
                context.SOInfo.SOItemList.Count == 0)
            {
                throw new BusinessException("订单不存在!");
            }
            if (context.SOInfo.Status != Enums.SOStatus.Original)
            {
                throw new BusinessException("订单不是待支付状态!");
            }
            var netPayInfo = ShoppingOrderDA.GetCenterDBNetpayBySOSysNo(SOSysNo);

            if (netPayInfo != null && netPayInfo.Status > (int)NetPayStatusType.Origin)
            {
                throw new BusinessException("订单已支付!");
            }

            if (context.SOInfo.Payment != null)
            {
                context.PaymentModeId = context.SOInfo.Payment.PayTypeID;
                CustomerFacade.UpdateCustomerLastOrderPayTypeID(context.SOInfo.CustomerSysNo, context.SOInfo.Payment.PayTypeID);
            }

            Charges charge = Charges.GetInstance(context);

            if (charge != null)
            {
                charge.UpdateChargePayment(context);
            }

            return(charge != null?charge.GetRequestContent(context) : string.Empty);
        }