Test.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php namespace Pay\Lib;
  2. use Dever;
  3. class Test extends Core
  4. {
  5. public function __construct($config)
  6. {
  7. $this->config = $config;
  8. }
  9. /**
  10. * 通知
  11. */
  12. public function notify()
  13. {
  14. }
  15. /**
  16. * 获取统一下单的基本信息
  17. */
  18. public function order($account_id, $project_id, $uid, $username, $product_id, $name, $cash, $openid = false, $type = 1, $order_id = false)
  19. {
  20. $order_id = $this->createOrder($uid, $username, $account_id, $project_id, $product_id, $name, $cash, $this->config['type'], $order_id);
  21. return $order_id;
  22. }
  23. /**
  24. * 获取二维码支付
  25. */
  26. public function qrcode($order, $refer)
  27. {
  28. return $order;
  29. }
  30. /**
  31. * 获取小程序支付
  32. */
  33. public function applet($order)
  34. {
  35. return $order;
  36. }
  37. /**
  38. * 获取页面支付
  39. */
  40. public function page($order, $refer)
  41. {
  42. return $order;
  43. }
  44. # 退款
  45. public function refund($order_id, $cash)
  46. {
  47. $out_trade_no = $order_id;
  48. $cash = $cash * 100;
  49. $total_fee = $cash;
  50. $refund_fee = $cash;
  51. $input = new \WxPayRefund();
  52. $input->SetOut_trade_no($out_trade_no);
  53. $input->SetTotal_fee($total_fee);
  54. $input->SetRefund_fee($refund_fee);
  55. $input->SetOut_refund_no($out_trade_no . '_' . time());
  56. $input->SetOp_user_id($this->config->GetMerchantId());
  57. $result = \WxPayApi::refund($this->config, $input);
  58. return $result;
  59. }
  60. }