Notify.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. }
  9. public function request($request, $tool = false)
  10. {
  11. $this->data = $request;
  12. $this->setParam('mhtOrderNo');
  13. $this->setParam('mhtOrderName');
  14. $this->setParam('mhtOrderType');
  15. $this->setParam('mhtCurrencyType');
  16. $this->setParam('mhtOrderAmt');
  17. $this->setParam('oriMhtOrderAmt');
  18. $this->setParam('discountAmt');
  19. $this->setParam('mhtOrderDetail');
  20. $this->setParam('mhtOrderTimeOut');
  21. $this->setParam('mhtOrderStartTime');
  22. $this->setParam('payTime');
  23. $this->setParam('nowPayOrderNo');
  24. $this->setParam('transStatus');
  25. $this->setParam('mhtCharset');
  26. $this->setParam('deviceType');
  27. $this->setParam('payChannelType');
  28. $this->setParam('channelOrderNo');
  29. $this->setParam('payConsumerId');
  30. $this->setParam('mhtReserved');
  31. $this->setParam('bankType');
  32. $this->setParam('cardType');
  33. $this->setParam('signType');
  34. $this->setParam('funcode');
  35. $this->setParam('version');
  36. $error = $this->getError();
  37. if ($error) {
  38. $tool->updateOrder($this->param['mhtOrderNo'], $this->param['mhtOrderAmt'], $error);
  39. return false;
  40. }
  41. unset($this->param['mhtSubAppId']);
  42. $signature = $this->createSignature($this->param['signType']);
  43. if ($signature != $this->data['signature']) {
  44. $tool->updateOrder($this->param['mhtOrderNo'], $this->param['mhtOrderAmt'], '签名错误');
  45. return false;
  46. }
  47. return $this->param;
  48. }
  49. public function response($response)
  50. {
  51. return $response;
  52. }
  53. }