PayApiLogic.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?php
  2. namespace addons\HuijuBill\common\logic;
  3. use common\logic\middleground\base\ApiAbstract;
  4. /**
  5. * 汇聚分账
  6. */
  7. class PayApiLogic extends ApiAbstract
  8. {
  9. /**
  10. * API列表
  11. *
  12. * @var array
  13. */
  14. public $api_list = [
  15. 'create_order' => 'hj/order/create', // 创建支付订单
  16. 'order_query' => 'hj/order/query', // 订单查询
  17. 'mch_info' => 'hj/mch/info', // 分账方信息
  18. 'order_refund' => 'hj/order/refund', // 订单退款
  19. 'order_refund_query' => 'hj/order/refundQuery', // 退款查询
  20. 'order_alt_list' => 'hj/order/altList', // 分账列表
  21. 'order_settle_list' => 'hj/order/settleList', // 结算记录
  22. 'sign_content' => 'hj/mch/signContent', // 签约内容
  23. 'confirm_sign' => 'hj/mch/confirmSign', // 确认签约
  24. ];
  25. /**
  26. * 创建支付订单
  27. *
  28. * @param array $params
  29. * @return array
  30. */
  31. public function create_order($params)
  32. {
  33. return $this->request($this->getFullUrl(__FUNCTION__), array_filter($params), 'post');
  34. }
  35. /**
  36. * 订单查询
  37. *
  38. * @param string $order_no
  39. * @return array
  40. */
  41. public function order_query($sys_order_no)
  42. {
  43. return $this->request($this->getFullUrl(__FUNCTION__), array_filter(compact('sys_order_no')), 'get');
  44. }
  45. /**
  46. * 订单退款
  47. *
  48. * @param array $params
  49. * [
  50. * 'order_no' => '商户订单号'
  51. * 'refund_order_no' => '退款订单号'
  52. * 'refund_amount' => '退款金额'
  53. * 'reason' => '退款理由'
  54. * 'notify_url' => '通知地址'
  55. * ]
  56. * @return array
  57. */
  58. public function order_refund($params)
  59. {
  60. return $this->request($this->getFullUrl(__FUNCTION__), array_filter($params), 'post');
  61. }
  62. /**
  63. * 退款订单查询
  64. *
  65. * @param string $refund_order_no 退款订单号
  66. * @return array
  67. */
  68. public function order_refund_query($refund_order_no)
  69. {
  70. return $this->request($this->getFullUrl(__FUNCTION__), array_filter(compact('refund_order_no')), 'get');
  71. }
  72. /**
  73. * 查询分账
  74. *
  75. * @param string $start_time 2022-03-01
  76. * @param string $end_time 2022-03-01
  77. * @param string $order_no 流水单号
  78. * @param integer $page
  79. * @return array
  80. */
  81. public function order_alt_list($start_time, $end_time, $order_no = '', $page = 1)
  82. {
  83. return $this->request($this->getFullUrl(__FUNCTION__), array_filter(compact(
  84. 'start_time',
  85. 'end_time',
  86. 'order_no',
  87. 'page'
  88. )), 'get');
  89. }
  90. /**
  91. * 查询结算记录
  92. *
  93. * @param string $start_time 2022-03-01
  94. * @param string $end_time 2022-03-01
  95. * @param integer $page
  96. * @return array
  97. */
  98. public function order_settle_list($start_time, $end_time, $page = 1)
  99. {
  100. return $this->request($this->getFullUrl(__FUNCTION__), array_filter(compact(
  101. 'start_time',
  102. 'end_time',
  103. 'page'
  104. )), 'get');
  105. }
  106. /**
  107. * 分账方信息
  108. *
  109. * @param string $alt_mch_no
  110. * @return array
  111. */
  112. public function mch_info($alt_mch_no)
  113. {
  114. return $this->request($this->getFullUrl(__FUNCTION__), array_filter(compact(
  115. 'alt_mch_no'
  116. )), 'get');
  117. }
  118. /**
  119. * 获取签约内容
  120. *
  121. * @return string
  122. */
  123. public function sign_content()
  124. {
  125. return $this->request($this->getFullUrl(__FUNCTION__), [], 'get');
  126. }
  127. /**
  128. * 执行确认签约
  129. *
  130. * @return boolean
  131. */
  132. public function confirm_sign()
  133. {
  134. return $this->request($this->getFullUrl(__FUNCTION__), [], 'get');
  135. }
  136. }