GoldCardPayment.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. namespace Biz\Payment;
  3. /**
  4. * 金付卡支付
  5. */
  6. class GoldCardPayment extends \Biz\BasePayment {
  7. protected $gatWay = "http://www.goldenpay88.com/gateway/orderPay";
  8. protected $paymentName = "GoldCard";
  9. public function toPay($order) {
  10. $data = array();
  11. $data['terId'] = ''; //商户号
  12. $data['businessOrdid'] = $this->dataAccess->orderSn; //订单号
  13. $data['orderName'] = $this->dataAccess->goodsName;
  14. $data['tradeMoney'] = $this->dataAccess->money * 100;
  15. $data['selfParam'] = '';
  16. $data['payType'] = empty($this->dataAccess->payType) ? '1000' : $this->dataAccess->payType;
  17. $data['appSence'] = $this->dataAccess->paySet;
  18. $data['syncURL'] = $this->redirectUrl;
  19. $data['asynURL'] = $this->notifyUrl;
  20. $enc_json = json_encode($data, JSON_UNESCAPED_UNICODE);
  21. $Split = str_split($enc_json, 64);
  22. ForEach ($Split as $Part) {
  23. openssl_public_encrypt($Part, $PartialData, $pubkey); //服务器公钥加密
  24. $t = strlen($PartialData);
  25. $encParam_encrypted .= $PartialData;
  26. }
  27. $encParam = base64_encode(($encParam_encrypted)); //加密的业务参数
  28. openssl_sign($encParam_encrypted, $sign_info, $priKey);
  29. $sign = base64_encode($sign_info); //加密业务参数的签名
  30. $data = array();
  31. $data['merId'] = ''; //终端号
  32. $data['version'] = '1.0.9';
  33. $data['sign'] = $sign;
  34. $data['encParam'] = $encParam;
  35. $this->goPay($data);
  36. }
  37. public function redirect($order) {
  38. }
  39. public function notify($order) {
  40. $re = $this->check($order);
  41. if ($re) {
  42. return 'success';
  43. }
  44. return 'fail';
  45. }
  46. function check($order) {
  47. $data = array();
  48. if ($data['signature'] == $md5sign) {
  49. return 1;
  50. }
  51. return 0;
  52. }
  53. function rsaDecode($data) {
  54. }
  55. /**
  56. * 得到所有设备
  57. * @return [type] [description]
  58. */
  59. function getSetname() {
  60. return array(
  61. 'pc' => '1001', //
  62. 'h5' => '1002', //
  63. 'kuaijieApi' => '1003', //
  64. 'kuaijiesdk' => '1004', //
  65. );
  66. }
  67. public function getPaymentType() {
  68. # code...
  69. return array(
  70. 'all' => '1000', //默认支持所有
  71. 'kuaijie' => '1001',
  72. 'shuakaqi' => '1002', //刷卡器支付
  73. 'kuaijie' => '1003', //银行卡支付
  74. 'scan_weixin_qr' => '1005', //微信扫码支付
  75. 'scan_alipay_qr' => '1006', //支付宝扫码支付
  76. 'foreign_card' => '1007', //外卡支付
  77. 'alipay_app' => '1008', //支付宝 APP 支付
  78. 'weixin_app' => '1009', //微信 APP 支付
  79. );
  80. }
  81. }
  82. ?>