InCome.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <?php
  2. header("Content-type: text/html; charset=utf-8");
  3. require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'AopClient.php';
  4. $privateKey = "MIICWwIBAAKBgQCOmsrFtFPTnEzfpJ/hDl5RODBxw4i9Ex3NmmG/N7A1+by032zZ
  5. ZgLLpdNh8y5otjFY0E37Nyr4FGKFRSSuDiTk8vfx3pv6ImS1Rxjjg4qdVHIfqhCe
  6. B0Z2ZPuBD3Gbj8hHFEtXZq8+msAFu/5ZQjiVhgs5WWBjh54LYWSum+d9+wIDAQAB
  7. AoGABKpLt+wOUf3rBeX81QADVeTgsNgUwRq+/truF7NasGlbIw+sH/CWZtMl9y5d
  8. dk9/jchCxNUpMrR4BKQebxNHYaltARH7fmdEVhEccrMwG1tsv5ZNt6zdEzHn5sWx
  9. lGEdgiRdceXBr9ApfrPEbSf9znKTZomaMrLUb1oTG8kgpQECQQDd3sHcyuYv0/5F
  10. 1xJjZKbUDtACNHjXY/b9LNjViA4+6u8hPDiu1OHD7/hO6r86tyKyQE8ERSVM2eMb
  11. KgLy40zlAkEApIqPpoaGPqf1ZjXmLxjDc/UZzHr0KZYSobTI/bDyP3H4NBBIXaJL
  12. bKBtRn55+rvnUalZfwxmtC7hxAZjgzvRXwJACCAAOXW0uEurJCOcKMem1F02gN4r
  13. Drg6c0sRJcC1xNgVqcHq0Xw6SFKhZUJzflL2klCIlD9z/jx8dKI1OW/ZgQJAWfJt
  14. CMltRX8nhVJdnM1au173VXK5WqpxUPi1DwnVw50X484q4RTBSoaAdhLZt5lUoK2F
  15. ARDUbBdcz332lFz03QJAbMtVN2FC3NZW4CGaGuTfp5+tCGxLi5HFttgzPhhkvgXo
  16. wkeHBhf+DT8OslSxIpBhsb2l+o4Pv4wKBdBg5WJlRw==";
  17. //随行付公钥
  18. $sxfPublic =
  19. "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCOmsrFtFPTnEzfpJ/hDl5RODBxw4i9Ex3NmmG/N7A1+by032zZZgLLpdNh8y5otjFY0E37Nyr4FGKFRSSuDiTk8vfx3pv6ImS1Rxjjg4qdVHIfqhCeB0Z2ZPuBD3Gbj8hHFEtXZq8+msAFu/5ZQjiVhgs5WWBjh54LYWSum+d9+wIDAQAB";
  20. $array = array( //普通数组
  21. "reqId" => "c3ba4932950a42618bc17a85bd2ec846",
  22. "orgId" => "26680846",
  23. "mecDisNm" => "签购单的的名称", //商户简称
  24. "mblNo" => "185xxxxxx54",//商户联系电话
  25. "operationalType" => "01",//经营类型(01线下 02线上 03非盈利类 04缴费类 05保险类 06私立院校类 )
  26. "haveLicenseNo" => "03",//资质类型 ( 01自然人 02个体户 03企业)
  27. "mecTypeFlag" => "00",//商户类型(00普通单店商户(非连锁商户) 01连锁总 02连锁分 03 1+n总 04 1+n分
  28. "cprRegNmCn" => "澧县xxxxx责任公司",//营业执照注册名称
  29. "registCode" => "914xxxxxxRLX3",//营业执照注册号
  30. "licenseMatch" => "00",//是否三证合一(00是 01否)
  31. "cprRegAddr" => "西商xxxxxx无校验",//地址
  32. "regProvCd" => "130000000000",//省编码(国标)
  33. "regCityCd" => "130700000000",//市编码(国标)
  34. "regDistCd" => "130728000000",//区编码(国标)
  35. "mccCd" => "5309",//微信类目(和mcc传其一,如果都传,以mcc为准)
  36. "csTelNo" => "13xxxxxx222",//客服电话
  37. "identityName" => "郭xx",//法人姓名
  38. "identityTyp" => "00",//法人证件类型
  39. "identityNo" => "4324xxxxxxxxx3X",//法人证件号
  40. "actNm" => "澧县xxxxxxxxxx公司",//结算账户名
  41. "actTyp" => "00",//结算账户类型(00对公 01对私)
  42. "stmManIdNo" => "4324xxxxxxX",//账户人身份证号
  43. "actNo" => "622848xxxxxxxxx000",//结算卡号
  44. "lbnkNo" => "1031xxxxxx17",//开户支行联行行号xxxxxx
  45. "licensePic" => "f94aa57552f0434d80026bccb9820f59",//营业执照
  46. "legalPersonidPositivePic" => "7fbd5e6d0610422292af5f88c32e58b7",//法人身份证正面
  47. "legalPersonidOppositePic" => "89535a39b5d9450294d59dae776ccc32",//法人身份证反面
  48. "storePic" => "d704fe706ad040a99981b7ac37b7cb89",//门头照片
  49. "insideScenePic" => "4236c4f475da4e79b50f9186ac048a27",//真实商户内景图片
  50. "openingAccountLicensePic" => "697b9ea61f08404abf80de59fd17f594",//开户许可证
  51. );
  52. $qrcodeType = array("01", "02", "06", "07");
  53. $qrcoderate = array("0.2", "0.2", "0.2", "0.2");
  54. $qrcodeList = array();
  55. for ($i = 0; $i < count($qrcodeType); $i++) {
  56. $arr = array(
  57. "rateType" => $qrcodeType[$i],
  58. "rate" => $qrcoderate[$i],
  59. );
  60. array_push($qrcodeList, $arr);
  61. }
  62. $qrcodeList = array(
  63. "qrcodeList" => $qrcodeList
  64. );
  65. $array = array_merge($array, $qrcodeList);
  66. $response = getJsonParam($array);
  67. $aopClient = new AopClient();
  68. $signContent = $aopClient->generateSign($response,$privateKey);
  69. $sign = array(
  70. "sign" => $signContent
  71. );
  72. $reqStr = array_merge($response, $sign);
  73. $reqStr = json_encode($reqStr,320);
  74. $requestUrl = 'https://openapi-test.tianquetech.com/merchant/income';
  75. $resp = $aopClient->curl($requestUrl, $reqStr);
  76. echo "resp" . $resp;
  77. $result = json_decode($resp,320);
  78. $signResult = $result["sign"];
  79. echo "signResult" . $signResult;
  80. // result.remove("sign");
  81. unset($result["sign"]);
  82. // String resultStr = RSASignature.getOrderContent(result);
  83. //sign
  84. /// String resultSign = RSASignature.encryptBASE64(RSASignature.sign(signContent, privateKey));
  85. $signContent = $aopClient->getSignContent($result);
  86. echo "<br><br><br><br>";
  87. echo "signContent:".$signContent;
  88. echo "<br><br><br><br>";
  89. $verify = $aopClient->verify($signContent, $signResult,$sxfPublic);
  90. //组装加密串
  91. if ($verify) {
  92. echo("验签成功");
  93. }
  94. function getJsonParam($reqData)
  95. {
  96. $reqDataJson = array(
  97. "mblNo" => $reqData["mblNo"],//商户联系电话
  98. "mecDisNm" => $reqData["mecDisNm"],//商户简称
  99. "operationalType" => $reqData["operationalType"],//经营类型(01线下 02线上 03非盈利类 04缴费类 05保险类 06私立院校类 )
  100. //"attachMerces3hantNo"=> $reqData["attachMerchantNo"],//挂靠平台商编
  101. "mecTypeFlag" => $reqData["mecTypeFlag"],//商户类型(新: 00普通单店商户(非连锁商户)01连锁总 02连锁分 03 1+n总 04 1+n分,旧:01线上平台入驻 02普通 03连锁总店 04连锁分店 05 1+n总 06 1+n分)
  102. "haveLicenseNo" => $reqData["haveLicenseNo"],//资质类型 ( 01自然人 02个体户 03企业)
  103. //"parentMno"=> $reqData["parentMno"],//所属总店商户编号
  104. //"independentModel"=> $reqData["independentModel"],//分店是否独立结算(00是 01否)
  105. "qrcodeList" => $reqData["qrcodeList"],//二维码费率(01微信 02支付宝)
  106. //"settleType"=> $reqData["settleType"],//结算类型(新:03 T1 04 D1,旧:01-T1 02-D1)---默认值为D1
  107. //"supportPayChannels"=> $reqData["supportPayChannels"],//支持的支付渠道(01微信 02支付宝 03银联)不填默认全开
  108. //"supportTradeTypes"=> $reqData["supportTradeTypes"],//支持的交易类型(01主扫 02被扫 03公众号 04退货 05APP)不填默认全开
  109. //"specifyWechatChannel"=> $reqData["specifyWechatChannel"],//指定微信渠道号
  110. //"onlineType"=> $reqData["onlineType"],//线上普通商户类型 ( 01APP 02网站 03公众号)
  111. //"onlineName"=> $reqData["onlineName"],//线上普通商户名称 (APP名称/网站网址/公众号名称)
  112. //"onlineTypeInfo"=> $reqData["onlineTypeInfo"],//线上普通商户信息 (APP下载地址及账号信息)
  113. "cprRegNmCn" => $reqData["cprRegNmCn"],//营业执照注册名称
  114. "registCode" => $reqData["registCode"],//营业执照注册号
  115. "licenseMatch" => $reqData["licenseMatch"],//是否三证合一(00是 01否)
  116. //"orgCode"=> $reqData["orgCode"],//组织机构代码
  117. //"taxRegNo"=> $reqData["taxRegNo"],//税务登记号
  118. //"businessLicStt"=> $reqData["businessLicStt"],//营业执照起始日
  119. //"businessLicEnt"=> $reqData["businessLicEnt"],//营业执照到期日
  120. "cprRegAddr" => $reqData["cprRegAddr"],//地址
  121. "regProvCd" => $reqData["regProvCd"],//省编码(国标)
  122. "regCityCd" => $reqData["regCityCd"],//市编码(国标)
  123. "regDistCd" => $reqData["regDistCd"],//区编码(国标)
  124. "mccCd" => $reqData["mccCd"],//微信类目(和mcc传其一,如果都传,以mcc为准)
  125. "csTelNo" => $reqData["csTelNo"],//客服电话
  126. "identityName" => $reqData["identityName"],//法人姓名
  127. "identityTyp" => $reqData["identityTyp"],//法人证件类型
  128. "identityNo" => $reqData["identityNo"],//法人证件号
  129. //"legalPersonLicStt"=> $reqData["legalPersonLicStt"],//法人身份证开始日期
  130. //"legalPersonLicEnt"=> $reqData["legalPersonLicEnt"],//法人身份证结束日期
  131. "actNm" => $reqData["actNm"],//结算账户名
  132. "actTyp" => $reqData["actTyp"],//结算账户类型(00对公 01对私)
  133. "stmManIdNo" => $reqData["stmManIdNo"],//账户人身份证号
  134. //"accountLicStt"=> $reqData["accountLicStt"],//账户人证件号起始日
  135. //"accountLicEnt"=> $reqData["accountLicEnt"],//账户人证件号到期日
  136. "actNo" => $reqData["actNo"],//结算卡号
  137. "lbnkNo" => $reqData["lbnkNo"],//开户支行联行行号
  138. //"lbnkNm"=> $reqData["lbnkNm"],//开户支行名称
  139. "licensePic" => $reqData["licensePic"],//营业执照
  140. //"taxRegistLicensePic"=> $reqData["taxRegistLicensePic"],//税务登记证
  141. //"orgCodePic"=> $reqData["orgCodePic"],//组织机构代码证
  142. "legalPersonidPositivePic" => $reqData["legalPersonidPositivePic"],//法人身份证正面
  143. "legalPersonidOppositePic" => $reqData["legalPersonidOppositePic"],//法人身份证反面
  144. "openingAccountLicensePic" => $reqData["openingAccountLicensePic"],//开户许可证
  145. //"bankCardPositivePic"=> $reqData["bankCardPositivePic"],//银行卡正面
  146. //"bankCardOppositePic"=> $reqData["bankCardOppositePic"],//银行卡反面
  147. //"settlePersonIdcardOpposite"=> $reqData["settlePersonIdcardOpposite"],//结算人身份证反面
  148. //"settlePersonIdcardPositive"=> $reqData["settlePersonIdcardPositive"],//结算人身份证正面
  149. //"merchantAgreementPic"=> $reqData["merchantAgreementPic"],//商户协议照片
  150. "storePic" => $reqData["storePic"],//门头照片
  151. "insideScenePic" => $reqData["insideScenePic"],//真实商户内景图片
  152. //"businessPlacePic"=> $reqData["businessPlacePic"],//经营场所-含收银台
  153. //"merchantEnterProtocol"=> $reqData["merchantEnterProtocol"],//商家入驻协议
  154. //"icpLicence"=> $reqData["icpLicence"],//ICP许可证
  155. //"handIdcardPic"=> $reqData["handIdcardPic"],//手持身份证照片
  156. //"leaseAgreementThreePic"=> $reqData["leaseAgreementThreePic"],//租赁协议三(签章页)
  157. //"leaseAgreementTwoPic"=> $reqData["leaseAgreementTwoPic"],//租赁协议二(面积、有效期页)
  158. //"leaseAgreementOnePic"=> $reqData["leaseAgreementOnePic"],//租赁协议一(封面)
  159. //"otherMaterialPictureOne"=> $reqData["otherMaterialPictureOne"],//其他资料照片1
  160. //"otherMaterialPictureTwo"=> $reqData["otherMaterialPictureTwo"],//其他资料照片2
  161. //"otherMaterialPictureThree"=> $reqData["otherMaterialPictureThree"],//其他资料照片3
  162. //"otherMaterialPictureFour"=> $reqData["otherMaterialPictureFour"],//其他资料照片4
  163. //"otherMaterialPictureFive"=> $reqData["otherMaterialPictureFive"],//其他资料照片5
  164. //"agentPersonSignature"=> $reqData["agentPersonSignature"],//代理人签名
  165. //"confirmPersonSignature"=> $reqData["confirmPersonSignature"],//确认人签名
  166. //"letterOfAuthPic"=> $reqData["letterOfAuthPic"],//非法人结算授权函
  167. //"unionSettleWithoutLicense"=> $reqData["unionSettleWithoutLicense"],//统一结算无营业执照说明
  168. //"societyGroupLegPerPic"=> $reqData["societyGroupLegPerPic"],//社会团体法人证书
  169. //"foundationLegPerRegPic"=> $reqData["foundationLegPerRegPic"],//基金会法人登记证书
  170. //"schoolLicese"=> $reqData["schoolLicese"],//办学许可证
  171. //"medicalInstitutionLicense"=> $reqData["medicalInstitutionLicense"],//医疗机构办学许可证
  172. //"insuranceLicese"=> $reqData["insuranceLicese"],//经营保险业务许可证
  173. //"insuranceLegPerGradePic"=> $reqData["insuranceLegPerGradePic"],//保险业务法人等级证书
  174. //"privateEducationLicense"=> $reqData["privateEducationLicense"],//民办教育许可证
  175. //"chargeProofPic"=> $reqData["chargeProofPic"],//收费证明文件
  176. //"Add("societyGroupLegPerPic", $reqData["societyGroupLegPerPic"]),//其他资料照片1
  177. //"Add("foundationLegPerRegPic", $reqData["foundationLegPerRegPic"]),//其他资料照片2
  178. //"Add("schoolLicese", $reqData["schoolLicese"]),//其他资料照片3
  179. //"Add("medicalInstitutionLicense", $reqData["medicalInstitutionLicense"]),//其他资料照片4
  180. //"Add("insuranceLicese", $reqData["insuranceLicese"]),//其他资料照片5
  181. //"Add("insuranceLegPerGradePic", $reqData["insuranceLegPerGradePic"]),//其他资料照片5
  182. //"Add("privateEducationLicense", $reqData["privateEducationLicense"]),//其他资料照片5
  183. //"Add("chargeProofPic", $reqData["chargeProofPic"]),//其他资料照片5
  184. );
  185. $reqJson = array(
  186. "reqData" => $reqDataJson,
  187. "orgId" => $reqData["orgId"],
  188. "reqId" => $reqData["reqId"],
  189. "version" => "1.0",//OEM和代理商的要传2.0,服务商传1.0
  190. "signType" => "RSA",
  191. "timestamp" => 1583570048783,
  192. );
  193. return $reqJson;
  194. }
  195. ?>