Example #1
0
        /// <summary>
        /// 获取支付字符串
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public Response Execute(string request)
        {
            var req  = JsonConvert.DeserializeObject <Request <PayInfo> >(request);
            var info = req.FirstEntity();

            if (info.PayOption.IsNullOrEmpty())
            {
                return(ResultHelper.Fail("没有设置支付方式。"));
            }

            IPay pay = CreatePay(info.PayOption);

            pay.SetPayId(info);
            if (info.AlipayId.IsNullOrEmpty())
            {
                return(ResultHelper.Fail("没有设置支付宝帐号。"));
            }
            var result = ResultHelper.Success();

            result.Tag = pay.GetPayString(info);

            return(result);
        }