国内流行的内容管理系统(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.

71 lines
1.9KB

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