/// <summary> /// 生成支付圈签署链接(航旅版) /// </summary> /// <param name="account">签署账户</param> /// <param name="config">config</param> /// <returns>结果</returns> public static string SignProtocolWithPartner(string account, Config config) { Submit submit = new Submit(config); SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string> { { "partner", config.GetPid() }, { "_input_charset", Config.InputCharset }, { "service", "sign_protocol_with_partner" }, { "email", account } }; string responseResult = submit.BuildLinkUrl(sParaTemp); return(responseResult); }
/// <summary> /// 支付宝支付圈签约查询(航旅版) /// </summary> /// <param name="account">签署账户</param> /// <param name="config">config</param> /// <returns>分润处理结果</returns> public static string CreateQueryCustomerProtocol(string account, Config config) { Submit submit = new Submit(config); SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string> { { "partner", config.GetPid() }, { "_input_charset", Config.InputCharset }, { "service", "query_customer_protocol" }, { "biz_type", "10004" }, { "user_email", account } }; string requestStr; string sHtmlText = submit.BuildRequest(sParaTemp, out requestStr); XmlDocument xmlDoc = new XmlDocument(); try { xmlDoc.LoadXml(sHtmlText); var selectSingleNode = xmlDoc.SelectSingleNode("/alipay/is_success"); if (selectSingleNode != null) { string strXmlResponse = selectSingleNode.InnerText; if (strXmlResponse == "T") { return("success"); } else { var singleNode = xmlDoc.SelectSingleNode("/alipay/error"); if (singleNode != null) { return(singleNode.InnerText); } else { return("fail"); } } } else { return("fail"); } } catch (Exception exp) { return(exp.Message); } }
/// <summary> /// 创建PC支付链接串(航旅版) /// </summary> /// <param name="directInfo">支付信息</param> /// <param name="config">config</param> /// <returns>请求连接</returns> public static string CreateDirectGetPcPayByUser(DirectInfo directInfo, Config config) { var partner = config.GetPid(); Submit submit = new Submit(config); var sParaTemp = new SortedDictionary <string, string> { { "service", "create_direct_pay_by_user" }, { "partner", partner }, { "_input_charset", Config.InputCharset.ToLower() }, { "payment_type", "1" }, { "notify_url", directInfo.Notify }, { "return_url", directInfo.Return }, { "out_trade_no", directInfo.OutTradeNo }, { "subject", directInfo.Subject }, { "total_fee", directInfo.TotalFee.ToString("0.00") }, { "show_url", directInfo.ShowUrl }, { "seller_email", Config.SellerEmail }, }; string responseResult = submit.BuildRequest(sParaTemp); return(responseResult); }
/// <summary> /// 创建Wap支付链接串(航旅版) /// </summary> /// <param name="directInfo">支付信息</param> /// <param name="config">config</param> /// <returns>请求连接</returns> public static string CreateDirectWapPayByUser(DirectInfo directInfo, Config config) { var partner = config.GetPid(); Submit submit = new Submit(config); var sParaTemp = new SortedDictionary <string, string> { { "partner", partner }, { "seller_id", partner }, { "_input_charset", Config.InputCharset.ToLower() }, { "service", "alipay.wap.create.direct.pay.by.user" }, { "payment_type", "1" }, { "notify_url", directInfo.Notify }, { "return_url", directInfo.Return }, { "out_trade_no", directInfo.OutTradeNo }, { "subject", directInfo.Subject }, { "total_fee", directInfo.TotalFee.ToString("0.00") }, { "show_url", directInfo.ShowUrl }, { "body", directInfo.ExtraCommonParam } }; string responseResult = submit.BuildRequest(sParaTemp, "post", "确认"); return(responseResult); }
/// <summary> /// 交易明细查询(航旅版) /// </summary> /// <param name="outTradeNo">商户订单号</param> /// <param name="config">config</param> /// <returns>结果</returns> public static List <AccountPageQueryResut> QueryAccountPage(string outTradeNo, Config config) { Submit submit = new Submit(config); string requestStr; List <AccountPageQueryResut> queryList = new List <AccountPageQueryResut>(); SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string> { { "partner", config.GetPid() }, { "_input_charset", Config.InputCharset }, { "service", "account.page.query" }, { "page_no", "1" }, { "merchant_out_order_no", outTradeNo } }; string sHtmlText = submit.BuildRequest(sParaTemp, out requestStr); XmlDocument xmlDoc = new XmlDocument(); try { xmlDoc.LoadXml(sHtmlText); XmlNodeList nodelist = xmlDoc.SelectNodes("/alipay/response/account_page_query_result/account_log_list/AccountQueryAccountLogVO"); if (nodelist != null) { foreach (XmlNode item in nodelist) { AccountPageQueryResut model = new AccountPageQueryResut(); model.balance = item.SelectSingleNode("balance")?.InnerText; model.buyer_account = item.SelectSingleNode("buyer_account")?.InnerText; model.deposit_bank_no = item.SelectSingleNode("deposit_bank_no")?.InnerText; model.goods_title = item.SelectSingleNode("goods_title")?.InnerText; model.income = item.SelectSingleNode("income")?.InnerText; model.iw_account_log_id = item.SelectSingleNode("iw_account_log_id")?.InnerText; model.memo = item.SelectSingleNode("memo")?.InnerText; model.merchant_out_order_no = item.SelectSingleNode("merchant_out_order_no")?.InnerText; model.outcome = item.SelectSingleNode("outcome")?.InnerText; model.partner_id = item.SelectSingleNode("partner_id")?.InnerText; model.rate = item.SelectSingleNode("rate")?.InnerText; model.seller_account = item.SelectSingleNode("seller_account")?.InnerText; model.seller_fullname = item.SelectSingleNode("seller_fullname")?.InnerText; model.service_fee = item.SelectSingleNode("service_fee")?.InnerText; model.service_fee_ratio = item.SelectSingleNode("service_fee_ratio")?.InnerText; model.sign_product_name = item.SelectSingleNode("sign_product_name")?.InnerText; model.sub_trans_code_msg = item.SelectSingleNode("sub_trans_code_msg")?.InnerText; model.total_fee = item.SelectSingleNode("total_fee")?.InnerText; model.trade_no = item.SelectSingleNode("trade_no")?.InnerText; model.trade_refund_amount = item.SelectSingleNode("trade_refund_amount")?.InnerText; model.trans_code_msg = item.SelectSingleNode("trans_code_msg")?.InnerText; model.trans_date = item.SelectSingleNode("trans_date")?.InnerText; queryList.Add(model); } } } catch (Exception) { return(new List <AccountPageQueryResut>()); } return(queryList); }
/// <summary> /// 分润请求(航旅版) /// </summary> /// <param name="billInfo">分信息</param> /// <param name="requestStr">支付请求原始信息</param> /// <param name="responseStr">支付返回原始信息</param> /// <param name="config">config</param> /// <returns>成功?success:其他错误信息</returns> public static string CreateDistributeRoyalty(BillInfo billInfo, out string requestStr, out string responseStr, Config config) { Submit submit = new Submit(config); var royaltyParameters = Core.ToRoyaltyParameters(billInfo.RoyaltyParameters); SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string> { { "partner", config.GetPid() }, { "_input_charset", Config.InputCharset.ToLower() }, { "service", "distribute_royalty" }, { "out_bill_no", billInfo.OutBillNo }, { "out_trade_no", string.Empty }, { "trade_no", billInfo.TradeNo }, { "royalty_parameters", royaltyParameters }, { "royalty_type", "10" } }; responseStr = submit.BuildRequest(sParaTemp, out requestStr); XmlDocument xmlDoc = new XmlDocument(); try { xmlDoc.LoadXml(responseStr); var selectSingleNode = xmlDoc.SelectSingleNode("/alipay/is_success"); if (selectSingleNode != null) { string strXmlResponse = selectSingleNode.InnerText; if (strXmlResponse == "T") { return("success"); } else { var singleNode = xmlDoc.SelectSingleNode("/alipay/error"); if (singleNode != null) { return(singleNode.InnerText.TranslationZhCn <DistributeErrorCode>()); } else { return("/alipay/error节点为空"); } } } else { return("/alipay/is_success节点为空"); } } catch (Exception exp) { return(exp.Message); } }