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. dd($this->getConfig());
  18. $data = array(
  19. 'version' => '3.0',
  20. 'method' => 'Rx.online.pay',
  21. 'partner' => $this->sellerInfo['busAccount'],
  22. 'banktype' => '',
  23. 'paymoney' => $this->dataAccess->money,
  24. 'ordernumber' => $this->dataAccess->orderSn,
  25. 'callbackurl' => $this->notifyUrl,
  26. );
  27. $sign = $this->md5mcrypt($data, $this->sellerInfo['busKey']);
  28. $data['hrefbackurl'] = $this->redirectUrl;
  29. $data['sign'] = $sign;
  30. $this->goPay($data);
  31. }
  32. function md5mcrypt($data, $key) {
  33. $str = http_build_query($data) . $key;
  34. $str = urldecode($str);
  35. return md5($str);
  36. }
  37. public function notify($order) {
  38. # code...
  39. $re = $this->check($order);
  40. return $re;
  41. }
  42. public function redirect($order) {
  43. $re = $this->check($order);
  44. return $re;
  45. }
  46. public function check($order) {
  47. $data = array();
  48. $data['partner'] = $_GET['partner'];
  49. $this->dataAccess->orderSn = $data['ordernumber'] = $_GET['ordernumber'];
  50. $data['orderstatus'] = $_GET['orderstatus'];
  51. $this->dataAccess->money = $data['paymoney'] = $_GET['paymoney'];
  52. $sign = $this->md5mcrypt($data, $this->sellerInfo['busKey']);
  53. $this->dataAccess->goodsName = '';
  54. $data['sysnumber'] = $_GET['sysnumber'];
  55. $data['attach'] = $_GET['attach'];
  56. $data['sign'] = $_GET['sign'];
  57. if ($sign == $data['sign']) {
  58. if ($data['orderstatus'] == '1') {
  59. return 1;
  60. } else {
  61. return 0;
  62. }
  63. }
  64. }
  65. function notifyMsg($key) {
  66. if ($key > 0) {
  67. echo 'ok';
  68. } else {
  69. echo '';
  70. }
  71. }
  72. public function getPaymentType() {
  73. # code...
  74. return array(
  75. "alipay" => "ALIPAY", //"支付宝",
  76. "weixin" => "WEIXIN", //"微信",
  77. "qqpay" => "QQ ", //QQ钱包",
  78. 'tenpay' => 'TENPAY', //财付通
  79. );
  80. }
  81. }