testNotify.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /*
  3. * The file is part of the payment lib.
  4. *
  5. * (c) Leo <dayugog@gmail.com>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. /**
  11. * Class TestNotify
  12. * @author : helei
  13. * @date : 2020/2/1 3:56 下午
  14. * @version : 1.0.0
  15. * @desc : 测试异步通知
  16. *
  17. */
  18. class TestNotify implements \Payment\Contracts\IPayNotify
  19. {
  20. /**
  21. * @param string $channel 通知的渠道,如:支付宝、微信、招商
  22. * @param string $notifyType 通知的类型,如:支付、退款
  23. * @param string $notifyWay 通知的方式,如:异步 async,同步 sync
  24. * @param array $notifyData 通知的数据
  25. * @return bool
  26. */
  27. public function handle(
  28. string $channel,
  29. string $notifyType,
  30. string $notifyWay,
  31. array $notifyData
  32. ) {
  33. var_dump($channel, $notifyType, $notifyWay, $notifyData);
  34. exit;
  35. // 支付宝的同步通知不可信,并且没有 trade status 参数,无法判断交易是否成功
  36. // 微信只有异步通知
  37. return true;
  38. }
  39. }