public async Task <IActionResult> Transfer(string out_biz_no, string payee_type, string payee_account, string amount, string payer_show_name, string payee_real_name, string remark) { var model = new AlipayFundTransToaccountTransferModel { OutBizNo = out_biz_no, PayeeType = payee_type, PayeeAccount = payee_account, Amount = amount, PayerShowName = payer_show_name, PayeeRealName = payee_real_name, Remark = remark }; var req = new AlipayFundTransToaccountTransferRequest(); req.SetBizModel(model); var response = await _client.ExecuteAsync(req); ResponseModel responseModel = new ResponseModel() { code = HTTPResponseCode.PartialContent, message = string.Empty, data = response.Body }; if (response.IsError) { responseModel.code = HTTPResponseCode.BadRequest; responseModel.message = response.Msg; } else { responseModel.code = HTTPResponseCode.Successful; } return(Json(responseModel)); }
public AlipayFundTransToaccountTransferResponse TransferAmount(string toUserAliPayAccount, string userOpenId, double amount) { EAliPayApplication app = StaticDataSrv.GetAliPayApplication(); IAopClient aliyapClient = new DefaultAopClient("https://openapi.alipay.com/gateway.do", app.AppId, app.Merchant_Private_Key, "json", "1.0", "RSA2", app.Merchant_Public_key, "GBK", false); AlipayFundTransToaccountTransferRequest request = new AlipayFundTransToaccountTransferRequest(); var TransferId = EduCodeGenerator.TransferOrderNo(); AlipayFundTransToaccountTransferModel model = new AlipayFundTransToaccountTransferModel(); model.Amount = amount.ToString("0.00"); model.OutBizNo = TransferId; model.PayeeType = "ALIPAY_LOGONID"; model.PayeeAccount = toUserAliPayAccount; model.PayerShowName = "云艺书院奖励金"; request.SetBizModel(model); AlipayFundTransToaccountTransferResponse response = aliyapClient.Execute(request); return(response); //if (PayTargetMode == PayTargetMode.AliPayAccount) // model.PayeeType = "ALIPAY_LOGONID"; //else // model.PayeeType = "ALIPAY_USERID"; //model.PayeeAccount = toAliPayAccount; //if (!string.IsNullOrEmpty(ShowName)) //{ // model.PayerShowName = ShowName; //} //else //{ // string profix = ""; // if (target == TransferTarget.ParentAgent) // profix = "(上级佣金)"; // else if (target == TransferTarget.Agent) // profix = "(代理费)"; // else if (target == TransferTarget.User) // profix = "(打款)"; // else if (target == TransferTarget.L3Agent) // profix = "(三级)"; // else if (target == TransferTarget.MidStore) // profix = "(码商)"; // model.PayerShowName = profix + "服务费"; //} //if (order != null) // model.Remark = string.Format("#{0}-订单金额:{1}-订单ID:{2}", order.AgentName, order.TotalAmount, order.OrderNo); //request.SetBizModel(model); //AlipayFundTransToaccountTransferResponse response = aliyapClient.Execute(request); //return response; }
public async Task <IActionResult> Trans(string out_biz_no, string payee_account, string payee_type, string amount, string remark) { var model = new AlipayFundTransToaccountTransferModel() { OutBizNo = out_biz_no, PayeeType = payee_type, PayeeAccount = payee_account, Amount = amount, Remark = remark }; var req = new AlipayFundTransToaccountTransferRequest(); req.SetBizModel(model); var response = await _client.ExecuteAsync(req); return(Ok(response.Body)); }
public async Task <IActionResult> Transfer(AlipayTransferViewModel viewMode) { var model = new AlipayFundTransToaccountTransferModel { OutBizNo = viewMode.OutBizNo, PayeeType = viewMode.PayeeType, PayeeAccount = viewMode.PayeeAccount, Amount = viewMode.Amount, Remark = viewMode.Remark }; var req = new AlipayFundTransToaccountTransferRequest(); req.SetBizModel(model); var response = await _client.ExecuteAsync(req, _optionsAccessor.Value); ViewData["response"] = response.ResponseBody; return(View()); }
/// <summary> /// 支付宝单笔转账(蚂蚁金服) /// </summary> /// <param name="fundTransToaccountTransferInfo">转账信息</param> /// <param name="config">config</param> /// <returns>转账结果</returns> public static FundTransToaccountTransferInfoResult FundTransToAccountTransfer(FundTransToaccountTransferInfo fundTransToaccountTransferInfo, SdkPay.Config config) { const string url = SdkPay.Config.ServerUrl; string appId = config.GetAppId(); string privateKeyPem = config.GetPrivateKeyPem(); const string format = SdkPay.Config.Format; const string version = SdkPay.Config.Version; const string signType = SdkPay.Config.SignType; string publicKeyPem = config.GetPublicKeyPemAliPay(); const string charset = SdkPay.Config.Charset; IAopClient client = new DefaultAopClient(url, appId, privateKeyPem, format, version, signType, publicKeyPem, charset, false); var request = new AlipayFundTransToaccountTransferRequest(); AlipayFundTransToaccountTransferModel model = new AlipayFundTransToaccountTransferModel { OutBizNo = fundTransToaccountTransferInfo.OutBizNo, PayeeAccount = fundTransToaccountTransferInfo.PayeeAccount, Amount = fundTransToaccountTransferInfo.Amount, PayeeRealName = fundTransToaccountTransferInfo.PayeeRealName, Remark = fundTransToaccountTransferInfo.Remark }; request.SetBizModel(model); AlipayFundTransToaccountTransferResponse response = client.Execute(request); FundTransToaccountTransferInfoResult result = new FundTransToaccountTransferInfoResult(); result.Body = response.Body; if (response.Code == "10000") { result.IsSuccess = true; result.Message = response.Msg; result.OrderId = response.OrderId; result.PayDate = Convert.ToDateTime(response.PayDate); } else { result.IsSuccess = false; result.Message = $"{response.Msg}-{response.SubMsg}"; } return(result); }
public AlipayFundTransToaccountTransferResponse DoTransferAmount(TransferTarget target, EAliPayApplication app, string toAliPayAccount, string Amount, PayTargetMode PayTargetMode, out string TransferId, EOrderInfo order = null, string ShowName = null) { IAopClient aliyapClient = new DefaultAopClient("https://openapi.alipay.com/gateway.do", app.AppId, app.Merchant_Private_Key, "json", "1.0", "RSA2", app.Merchant_Public_key, "GBK", false); AlipayFundTransToaccountTransferRequest request = new AlipayFundTransToaccountTransferRequest(); TransferId = StringHelper.GenerateTransferNo(target); AlipayFundTransToaccountTransferModel model = new AlipayFundTransToaccountTransferModel(); model.Amount = Amount; model.OutBizNo = TransferId; if (PayTargetMode == PayTargetMode.AliPayAccount) { model.PayeeType = "ALIPAY_LOGONID"; } else { model.PayeeType = "ALIPAY_USERID"; } model.PayeeAccount = toAliPayAccount; if (!string.IsNullOrEmpty(ShowName)) { model.PayerShowName = ShowName; } else { string profix = ""; if (target == TransferTarget.ParentAgent) { profix = "(上级佣金)"; } else if (target == TransferTarget.Agent) { profix = "(代理费)"; } else if (target == TransferTarget.User) { profix = "(打款)"; } else if (target == TransferTarget.L3Agent) { profix = "(三级)"; } else if (target == TransferTarget.MidStore) { profix = "(码商)"; } model.PayerShowName = profix + "服务费"; } if (order != null) { model.Remark = string.Format("#{0}-订单金额:{1}-订单ID:{2}", order.AgentName, order.TotalAmount, order.OrderNo); } request.SetBizModel(model); AlipayFundTransToaccountTransferResponse response = aliyapClient.Execute(request); return(response); }