PayTool.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace Tool\MayouTool;
  3. use Tool\MayouTool\Bean\Pay\GetCodePayUrlParamBean;
  4. use Tool\MayouTool\Exception\PayException;
  5. use Tool\MayouTool\Pay\PayService;
  6. /**
  7. * 支付工具类
  8. * Class PayTool
  9. * @package Tool\MayouTool
  10. */
  11. class PayTool
  12. {
  13. /**
  14. * 获取支付二维码接口
  15. * @param GetCodePayUrlParamBean $bean
  16. * @return array ["qrcode_url"=>"支付二维码","qr"=>"支付二维码","order_number"=>"订单编号"]
  17. * @throws PayException
  18. */
  19. public static function getCodePayUrl(GetCodePayUrlParamBean $bean)
  20. {
  21. return PayService::getCodePayUrlService($bean);
  22. }
  23. /**
  24. * 根据官方订单编号获取订单
  25. * @param $token string token
  26. * @param $trade_sn string 官方订单编号
  27. * @param $amount int 金额(单位为分)
  28. * @return ["order_sn"=>"淘象订单编号","price"=>"支付金额(单位为分)"]
  29. */
  30. public static function getOfficialOrderByOrderNumber($token, $trade_sn, $amount)
  31. {
  32. return PayService::getOfficialOrderByOrderNumberService($token,$trade_sn,$amount);
  33. }
  34. /**
  35. * 获取支付方式
  36. * @param $appKey
  37. * @param $appSecret
  38. */
  39. public static function getPayMethod($appKey, $appSecret)
  40. {
  41. return PayService::getPayMethodService($appKey,$appSecret);
  42. }
  43. }