RenXinPayment.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. namespace Biz\Pay\Payment;
  3. /**
  4. * 汇付天下接口
  5. */
  6. class RenXinPayment extends \Biz\Pay\BasePayment {
  7. function init() {
  8. $this->sellerInfo = array(
  9. 'busKey' => "fbce600379c88a223c70d6a566d834bf",
  10. 'busAccount' => '20424',
  11. );
  12. # code...
  13. }
  14. protected $getWay = "http://dpos.qqjun.cn/Online/GateWay";
  15. protected $paymentName = "RenXin";
  16. function toPay() {
  17. $data = array(
  18. 'version' => '3.0',
  19. 'method' => 'Rx.online.pay',
  20. 'partner' => $this->sellerInfo['busAccount'],
  21. 'banktype' => '',
  22. 'paymoney' => $this->dataAccess->money,
  23. 'ordernumber' => $this->dataAccess->orderSn,
  24. 'callbackurl' => $this->notifyUrl,
  25. );
  26. $sign = $this->md5mcrypt($data, $this->sellerInfo['busKey']);
  27. $data['hrefbackurl'] = $this->redirectUrl;
  28. $data['sign'] = $sign;
  29. $data = $this->goPay($data);
  30. }
  31. function md5mcrypt($data, $key) {
  32. $str = http_build_query($data) . $key;
  33. $str = urldecode($str);
  34. return md5($str);
  35. }
  36. public function notify($order) {
  37. # code...
  38. $re = $this->check($order);
  39. return $re;
  40. }
  41. public function redirect($order) {
  42. $re = $this->check($order);
  43. return $re;
  44. }
  45. public function check($order) {
  46. $data = array();
  47. $data['partner'] = $_GET['partner'];
  48. $this->dataAccess->orderSn = $data['ordernumber'] = $_GET['ordernumber'];
  49. $data['orderstatus'] = $_GET['orderstatus'];
  50. $this->dataAccess->money = $data['paymoney'] = $_GET['paymoney'];
  51. $sign = $this->md5mcrypt($data, $this->sellerInfo['busKey']);
  52. $this->dataAccess->goodsName = '';
  53. $data['sysnumber'] = $_GET['sysnumber'];
  54. $data['attach'] = $_GET['attach'];
  55. $data['sign'] = $_GET['sign'];
  56. if ($sign == $data['sign']) {
  57. if ($data['orderstatus'] == '1') {
  58. return 1;
  59. } else {
  60. return 0;
  61. }
  62. }
  63. }
  64. function notifyMsg($key) {
  65. if ($key > 0) {
  66. echo 'ok';
  67. } else {
  68. echo '';
  69. }
  70. }
  71. public function getPaymentType() {
  72. # code...
  73. return array(
  74. "alipay" => "ALIPAY", //"支付宝",
  75. "weixin" => "WEIXIN", //"微信",
  76. "qqpay" => "QQ ", //QQ钱包",
  77. 'tenpay' => 'TENPAY', //财付通
  78. );
  79. }
  80. }