Notify.php 915 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace JiaLeo\Payment\Paypal;
  3. use JiaLeo\Payment\Common\PaymentException;
  4. class Notify extends BasePaypalPay
  5. {
  6. public $rawData = array();
  7. /**
  8. * 回调
  9. * @return array
  10. * @throws PaymentException
  11. */
  12. public function handle()
  13. {
  14. //获取回调信息
  15. $data = empty($_POST) ? $_GET : $_POST;
  16. if (empty($data) || !is_array($data)) {
  17. throw new PaymentException('获取参数失败!');
  18. }
  19. $this->rawData = $data;
  20. //IPN验证
  21. $flag = $this->notifyValidate($data);
  22. if (!$flag) {
  23. throw new PaymentException('IPN验证失败!');
  24. }
  25. return $data;
  26. }
  27. /**
  28. * 回复成功
  29. */
  30. public function returnSuccess()
  31. {
  32. echo 'success';
  33. }
  34. /**
  35. * 回复失败
  36. */
  37. public function returnFailure()
  38. {
  39. echo 'failure';
  40. }
  41. }