国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 line
1.8KB

  1. <?php
  2. //nps 网上支付接口
  3. include_once DEDEMEMBER.'/paycenter/nps/nps_config.inc.php';
  4. //支付手续费
  5. if($payment_exp[1] < 0.01) $payment_exp[1] = 0;
  6. $piice_ex = $price*$payment_exp[1];
  7. $price = $price+$piice_ex;
  8. // 公共函数定义
  9. function HexToStr($hex)
  10. {
  11. $string="";
  12. for($i=0;$i<strlen($hex)-1;$i+=2){ $string.=chr(hexdec($hex[$i].$hex[$i+1])); }
  13. return $string;
  14. }
  15. function StrToHex($string)
  16. {
  17. $hex="";
  18. for($i=0;$i<strlen($string);$i++){ $hex.=dechex(ord($string[$i])); }
  19. $hex=strtoupper($hex);
  20. return $hex;
  21. }
  22. //nps信息
  23. $m_language = 1;
  24. $s_name = "陈康";
  25. $s_addr = "深圳";
  26. $s_postcode = 518000;
  27. $s_tel = "0755-83791960";
  28. $r_name = "陈大康";
  29. $r_addr = "深圳";
  30. $r_postcode = 100080;
  31. $r_tel = "010-81234567";
  32. $r_eml = "service@nps.cn";
  33. $m_status = 0;
  34. $m_ocurrency = 1;
  35. $m_id = $cfg_merchant;
  36. $m_orderid = $buyid;
  37. $m_oamount = $price;
  38. $m_url = $cfg_basehost."/paycenter/nps/pay_back_nps.php";
  39. $m_ocomment = $cfg_ml->M_ID;
  40. $modate = GetDateTimeMk($mtime);
  41. //组织订单信息
  42. $m_info = $m_id."|".$m_orderid."|".$m_oamount."|".$m_ocurrency."|".$m_url."|".$m_language;
  43. $s_info = $s_name."|".$s_addr."|".$s_postcode."|".$s_tel."|".$s_eml;
  44. $r_info = $r_name."|".$r_addr."|".$r_postcode."|".$r_tel."|".$r_eml."|".$m_ocomment."|".$m_status."|".$modate;
  45. $OrderInfo = $m_info."|".$s_info."|".$r_info;
  46. //订单信息先转换成HEX,然后再加密
  47. $OrderInfo = StrToHex($OrderInfo);
  48. $digest = strtoupper(md5($OrderInfo.$cfg_merpassword));
  49. $strRequestUrl = $payment_url.'?OrderMessage='.$OrderInfo.'&digest='.$digest.'&M_ID='.$cfg_merchant;
  50. echo '<html>
  51. <head>
  52. <title>转到NPS支付页面</title>
  53. </head>
  54. <body onload="document.nps.submit();">
  55. <form name="nps" action="'.$strRequestUrl.'" method="post">
  56. </form>
  57. </body>
  58. </html>';
  59. exit;
  60. ?>