RefundQuery.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Web;
  4. namespace LYFZ.WxPayAPI
  5. {
  6. public class RefundQuery
  7. {
  8. /***
  9. * 退款查询完整业务流程逻辑
  10. * @param refund_id 微信退款单号(优先使用)
  11. * @param out_refund_no 商户退款单号
  12. * @param transaction_id 微信订单号
  13. * @param out_trade_no 商户订单号
  14. * @return 退款查询结果(xml格式)
  15. */
  16. public static string Run(string refund_id, string out_refund_no, string transaction_id, string out_trade_no)
  17. {
  18. Log.Info("RefundQuery", "RefundQuery is processing...");
  19. WxPayData data = new WxPayData();
  20. if(!string.IsNullOrEmpty(refund_id))
  21. {
  22. data.SetValue("refund_id", refund_id);//微信退款单号,优先级最高
  23. }
  24. else if(!string.IsNullOrEmpty(out_refund_no))
  25. {
  26. data.SetValue("out_refund_no", out_refund_no);//商户退款单号,优先级第二
  27. }
  28. else if(!string.IsNullOrEmpty(transaction_id))
  29. {
  30. data.SetValue("transaction_id", transaction_id);//微信订单号,优先级第三
  31. }
  32. else
  33. {
  34. data.SetValue("out_trade_no", out_trade_no);//商户订单号,优先级最低
  35. }
  36. WxPayData result = WxPayApi.RefundQuery(data);//提交退款查询给API,接收返回数据
  37. Log.Info("RefundQuery", "RefundQuery process complete, result : " + result.ToXml());
  38. return result.ToPrintStr();
  39. }
  40. }
  41. }