1.请求支付:

控制器:

public ActionResult Index(decimal amount, string submitType, string relationCode, int? couponId = 0)
        {
            var model = new TenpayModel();
            amount = Math.Round((amount * 0.035M) + amount, 2);
            if (amount < 1)
            {
                model.ErrorMsg = "The amount cannot be less than 1USD.";
                return View(model);
            }
            if (amount > 2000)
            {
                model.ErrorMsg = "The amount cannot be less than 2000USD.";
                return View(model);
            }
            string relationId;
            relationId = submitType == "AddMoney" ? CurrentUserId.ToString() : relationCode;

            model.IsSend = false;

            RelationTypeEnum relationType = (RelationTypeEnum)Enum.Parse(typeof(RelationTypeEnum), submitType);

            var ourPaymentNumber = AddMoneyDataService.GetOrderId();    //我们的交易号

            model.Request = TenpayManager.CreateTenPayRequest(amount, relationId, CurrentUserId.ToString(), ourPaymentNumber, LanguageType.En);

            model.sign = TenpayManager.createRequestSign(model.Request);

            var TenpayBegin = AddMoneyDataService.TenpayAddMoney(CurrentUserId, amount, ourPaymentNumber, relationType,
                relationId, model.ToJson(), LanguageType.En); //begin

            if (TenpayBegin)
            {
                model.IsSend = true;
            }
            else
            {
                model.ErrorMsg = "System Error";
            }

            YOYBuyComLogDataService.Log("提交TenPay充值信息", LogType.TenpaySend, CurrentUserId, null, model.ToJson());
            return View(model);
        }
View Code

相关文章: