国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

201 řádky
6.2KB

  1. <?php
  2. namespace WeChat;
  3. if (!defined('DEDEINC')) exit('dedebiz');
  4. use WeChat\Contracts\BasicWePay;
  5. use WePay\Bill;
  6. use WePay\Order;
  7. use WePay\Refund;
  8. use WePay\Transfers;
  9. use WePay\TransfersBank;
  10. /**
  11. * 微信支付商户
  12. * Class Pay
  13. * @package WeChat\Contracts
  14. */
  15. class Pay extends BasicWePay
  16. {
  17. /**
  18. * 统一下单
  19. * @param array $options
  20. * @return array
  21. * @throws \WeChat\Exceptions\InvalidResponseException
  22. * @throws \WeChat\Exceptions\LocalCacheException
  23. */
  24. public function createOrder(array $options)
  25. {
  26. return Order::instance($this->config->get())->create($options);
  27. }
  28. /**
  29. * 刷卡支付
  30. * @param array $options
  31. * @return array
  32. * @throws \WeChat\Exceptions\InvalidResponseException
  33. * @throws \WeChat\Exceptions\LocalCacheException
  34. */
  35. public function createMicropay($options)
  36. {
  37. return Order::instance($this->config->get())->micropay($options);
  38. }
  39. /**
  40. * 创建JsApi及H5支付参数
  41. * @param string $prepay_id 统一下单预支付码
  42. * @return array
  43. */
  44. public function createParamsForJsApi($prepay_id)
  45. {
  46. return Order::instance($this->config->get())->jsapiParams($prepay_id);
  47. }
  48. /**
  49. * 获取APP支付参数
  50. * @param string $prepay_id 统一下单预支付码
  51. * @return array
  52. */
  53. public function createParamsForApp($prepay_id)
  54. {
  55. return Order::instance($this->config->get())->appParams($prepay_id);
  56. }
  57. /**
  58. * 获取支付规则二维码
  59. * @param string $product_id 商户定义的商品id 或者订单号
  60. * @return string
  61. */
  62. public function createParamsForRuleQrc($product_id)
  63. {
  64. return Order::instance($this->config->get())->qrcParams($product_id);
  65. }
  66. /**
  67. * 查询订单
  68. * @param array $options
  69. * @return array
  70. * @throws \WeChat\Exceptions\InvalidResponseException
  71. * @throws \WeChat\Exceptions\LocalCacheException
  72. */
  73. public function queryOrder(array $options)
  74. {
  75. return Order::instance($this->config->get())->query($options);
  76. }
  77. /**
  78. * 关闭订单
  79. * @param string $out_trade_no 商户订单号
  80. * @return array
  81. * @throws \WeChat\Exceptions\InvalidResponseException
  82. * @throws \WeChat\Exceptions\LocalCacheException
  83. */
  84. public function closeOrder($out_trade_no)
  85. {
  86. return Order::instance($this->config->get())->close($out_trade_no);
  87. }
  88. /**
  89. * 申请退款
  90. * @param array $options
  91. * @return array
  92. * @throws \WeChat\Exceptions\InvalidResponseException
  93. * @throws \WeChat\Exceptions\LocalCacheException
  94. */
  95. public function createRefund(array $options)
  96. {
  97. return Refund::instance($this->config->get())->create($options);
  98. }
  99. /**
  100. * 查询退款
  101. * @param array $options
  102. * @return array
  103. * @throws \WeChat\Exceptions\InvalidResponseException
  104. * @throws \WeChat\Exceptions\LocalCacheException
  105. */
  106. public function queryRefund(array $options)
  107. {
  108. return Refund::instance($this->config->get())->query($options);
  109. }
  110. /**
  111. * 交易保障
  112. * @param array $options
  113. * @return array
  114. * @throws \WeChat\Exceptions\InvalidResponseException
  115. * @throws \WeChat\Exceptions\LocalCacheException
  116. */
  117. public function report(array $options)
  118. {
  119. return Order::instance($this->config->get())->report($options);
  120. }
  121. /**
  122. * 授权码查询openid
  123. * @param string $authCode 扫码支付授权码,设备读取会员微信中的条码或者二维码信息
  124. * @return array
  125. * @throws \WeChat\Exceptions\InvalidResponseException
  126. * @throws \WeChat\Exceptions\LocalCacheException
  127. */
  128. public function queryAuthCode($authCode)
  129. {
  130. return Order::instance($this->config->get())->queryAuthCode($authCode);
  131. }
  132. /**
  133. * 下载对账单
  134. * @param array $options 静音参数
  135. * @param null|string $outType 输出类型
  136. * @return bool|string
  137. * @throws \WeChat\Exceptions\InvalidResponseException
  138. * @throws \WeChat\Exceptions\LocalCacheException
  139. */
  140. public function billDownload(array $options, $outType = null)
  141. {
  142. return Bill::instance($this->config->get())->download($options, $outType);
  143. }
  144. /**
  145. * 拉取订单评价数据
  146. * @param array $options
  147. * @return array
  148. * @throws \WeChat\Exceptions\InvalidResponseException
  149. * @throws \WeChat\Exceptions\LocalCacheException
  150. */
  151. public function billCommtent(array $options)
  152. {
  153. return Bill::instance($this->config->get())->comment($options);
  154. }
  155. /**
  156. * 企业付款到零钱
  157. * @param array $options
  158. * @return array
  159. * @throws \WeChat\Exceptions\InvalidResponseException
  160. * @throws \WeChat\Exceptions\LocalCacheException
  161. */
  162. public function createTransfers(array $options)
  163. {
  164. return Transfers::instance($this->config->get())->create($options);
  165. }
  166. /**
  167. * 查询企业付款到零钱
  168. * @param string $partner_trade_no 商户调用企业付款API时使用的商户订单号
  169. * @return array
  170. * @throws \WeChat\Exceptions\InvalidResponseException
  171. * @throws \WeChat\Exceptions\LocalCacheException
  172. */
  173. public function queryTransfers($partner_trade_no)
  174. {
  175. return Transfers::instance($this->config->get())->query($partner_trade_no);
  176. }
  177. /**
  178. * 企业付款到银行卡
  179. * @param array $options
  180. * @return array
  181. * @throws \WeChat\Exceptions\InvalidDecryptException
  182. * @throws \WeChat\Exceptions\InvalidResponseException
  183. * @throws \WeChat\Exceptions\LocalCacheException
  184. */
  185. public function createTransfersBank(array $options)
  186. {
  187. return TransfersBank::instance($this->config->get())->create($options);
  188. }
  189. /**
  190. * 商户企业付款到银行卡操作进行结果查询
  191. * @param string $partner_trade_no 商户订单号,需保持唯一
  192. * @return array
  193. * @throws \WeChat\Exceptions\InvalidResponseException
  194. * @throws \WeChat\Exceptions\LocalCacheException
  195. */
  196. public function queryTransFresBank($partner_trade_no)
  197. {
  198. return TransfersBank::instance($this->config->get())->query($partner_trade_no);
  199. }
  200. }
  201. ?>