Notify.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace Cmbc\Api;
  3. class Notify extends Core
  4. {
  5. protected function init()
  6. {
  7. $this->api = 'https://ipaynow.acquire.cmbchina.com/';
  8. $this->param['funcode'] = 'WP001';
  9. $this->param['version'] = '1.0.0';
  10. }
  11. public function request($request, $tool = false)
  12. {
  13. $this->data = $request;
  14. $tool->log('支付回调-初始化11', $request);
  15. $this->setParam('mhtOrderNo');
  16. $this->setParam('mhtOrderName');
  17. $this->setParam('mhtOrderType');
  18. $this->setParam('mhtCurrencyType');
  19. $this->setParam('mhtOrderAmt');
  20. $this->setParam('oriMhtOrderAmt');
  21. $this->setParam('discountAmt');
  22. $this->setParam('mhtOrderDetail');
  23. $this->setParam('mhtOrderTimeOut');
  24. $this->setParam('mhtOrderStartTime');
  25. $this->setParam('payTime');
  26. $this->setParam('nowPayOrderNo');
  27. $this->setParam('transStatus');
  28. $this->setParam('mhtCharset');
  29. $this->setParam('deviceType');
  30. $this->setParam('payChannelType');
  31. $this->setParam('channelOrderNo');
  32. $this->setParam('payConsumerId');
  33. $this->setParam('mhtReserved');
  34. $this->setParam('bankType');
  35. $this->setParam('cardType');
  36. $this->setParam('signType');
  37. $this->setParam('funcode');
  38. $error = $this->getError();
  39. if ($error) {
  40. $tool->updateOrder($this->param['mhtOrderNo'], $this->param['mhtOrderAmt'], $error);
  41. return false;
  42. }
  43. $tool->log('支付回调-初始化22', $this->param);
  44. $signature = $this->createSignature($this->param['signType']);
  45. $tool->log('支付回调-初始化33', $signature);
  46. if ($signature != $this->data['signature']) {
  47. $tool->updateOrder($this->param['mhtOrderNo'], $this->param['mhtOrderAmt'], '签名错误');
  48. return false;
  49. }
  50. return $this->param;
  51. }
  52. public function response($response)
  53. {
  54. return $response;
  55. }
  56. }