/// <summary> /// 参数要判断response_code,然后判断trade_status状态是否成功。 /// </summary> /// <param name="req"></param> /// <returns></returns> public async Task <DefrayPayRsp> DefrayPayAsync(DefrayPayReq req) { req.NotNull("请求参数"); debugInfo.Info($"代付请求:{req.ToJsonString()}"); req.CustomerNo.NotNull("客户号"); req.OutTradeNo.NotNull("商户订单流水号"); req.TradeAmount.NotNull("订单交易金额"); if (!decimal.TryParse(req.TradeAmount, out decimal tradeAmount)) { throw new BizException("金额不合法"); } tradeAmount.ShouldLargeThan(0, "订单交易金额"); req.TradeSubject.NotNull("订单摘要"); if (req.PayTool == PayTool.ACCT.ToString()) { req.PayeeBankCode.NotNull("收款银行编码"); req.PayeeCardType.NotNull("收款卡种"); req.PayeeAccountType.EnumValueValid("收款账户类型"); req.PayeeAccountNo.NotNull("收款账户号"); req.PayeeAccountName.NotNull("收款账户名称"); } var rst = await JdHelper.GetWithdrawRspAsync <DefrayPayRsp>(jdConfig.DefrayPayUrl, jdConfig.CustomerNo, jdConfig.Sha256SignKey, req); return(rst); }
public async Task <IActionResult> DefrayPayAsync([FromBody] DefrayPayReq req) { req.CustomerNo = jdConfig.CustomerNo; req.NotifyUrl = jdConfig.DefrayPayNotifyUrl; var rst = await jdService.DefrayPayAsync(req); return(Ok(rst)); }