12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- /**
- * 银行卡代发 - 示例
- *
- * @author sdk-generator
- * @Description
- */
- namespace BsPayDemo;
- // 1. 资源及配置加载
- require_once dirname(__FILE__) . "/loader.php";
- require_once dirname(__FILE__). "/../BsPaySdk/request/V2TradeSettlementSurrogateRequest.php";
- use BsPaySdk\core\BsPayClient;
- use BsPaySdk\request\V2TradeSettlementSurrogateRequest;
- // 2.组装请求参数
- $request = new V2TradeSettlementSurrogateRequest();
- // 请求流水号
- $request->setReqSeqId(date("YmdHis").mt_rand());
- // 请求日期
- $request->setReqDate(date("Ymd"));
- // 商户号
- $request->setHuifuId("6666000000041651");
- // 代发金额
- $request->setCashAmt("9.00");
- // 代发用途描述
- $request->setPurposeDesc("v2测试用");
- // 省份选填,参见[代发省市地区码](https://cloudpnrcdn.oss-cn-shanghai.aliyuncs.com/opps/api/prod/download_file/area/%E6%96%97%E6%8B%B1%E4%BB%A3%E5%8F%91%E7%9C%81%E4%BB%BD%E5%9C%B0%E5%8C%BA%E7%BC%96%E7%A0%81.xlsx);<font color="green">示例值:0013</font><br/>对公代发(省份+地区)与联行号信息二选一填入;对私代发非必填;
- $request->setProvince("0278");
- // 地区选填,参见[代发省市地区码](https://cloudpnrcdn.oss-cn-shanghai.aliyuncs.com/opps/api/prod/download_file/area/%E6%96%97%E6%8B%B1%E4%BB%A3%E5%8F%91%E7%9C%81%E4%BB%BD%E5%9C%B0%E5%8C%BA%E7%BC%96%E7%A0%81.xlsx);<font color="green">示例值:1301</font><br/>对公代发(省份+地区)与联行号信息二选一填入;对私代发非必填;
- $request->setArea("2619");
- // 银行编号
- $request->setBankCode("01020000");
- // 联行号选填,参见:[银行支行编码](https://paas.huifu.com/partners/api/#/csfl/api_csfl_yhzhbm) <font color="green">示例值:102290026507</font><br/>对公代发(省份+地区)与联行号信息二选一填入;对私代发非必填;
- $request->setCorrespondentCode("correspondentCode");
- // 银行卡用户名
- $request->setBankAccountName("王大锤");
- // 对公对私标识
- $request->setCardAcctType("E");
- // 银行账号密文
- $request->setBankCardNoCrypt("fM3G4fV8dfyA9GvSPckj7DM/0ZPgIuTrCj5chjRP2np/j+5xBkDp+hGLSskALgMijL837blhwVwfpPstkR2t+0aLtRLC1IpggVKKbNefoqcahF2a4zh+YssAulOoQ6T7DDWTjaa0qzILmLV+J/CCW6ioE+pdsBlGKee7Cc0iD6VqAjkSmnx2kWadz9CpaH8ayvyivdkc87SHsSgexQ5scyZdkGYSpXtRf/rSTcfsf5Q3NP+uKA6lJ0hnESiCw/1POoszJrSlGT2U7jpQLDWVENKcW06bReKxQuAdxFaX4DqkwbQeN5nzHvYh14IU8KrZZDAoiCx12x+IcHIVB2tBmw==");
- // 证件号密文
- $request->setCertificateNoCrypt("cw8BlH40+weHiFnIonCiSak1wWeCiRWpMF1cBHhuE+vagzKT37MRvouVboLnaWwIry3joQOoVJipDTPpzAMGVrbLQTdtZoHhgyynnD3MS0NTPch2W4i9dO3/ikLylbs2HitUlCThXEX7DIrIbLLYZ7zzeYUyXAs6dKlehMNxAaF4utJpxV84tB3ZmCKKFairE6+al4Id+/c7536G0j5lKn7lWSawl8A1UEbMMmHFvydGEBgaCAmvu0WEx7llhtPl1GpJnwqieAt9u+lM0cjUGEYfw54/JnmEF3uVuHqjco/EAMKmWiqONqCT4ptBLlOiT15FUejK0iFiUrS0Y3ytMg==");
- // 证件类型
- $request->setCertificateType("01");
- // 手机号密文
- $request->setMobileNoCrypt("Uc2rjt3iqQMIjUubLKvrE4ynG2XoZDXl4sSqHB7xFvz6EyhS+WMm+tp7WLzG97PqdsmlfURRLjmSR3u98Zz0HV7wO4zvUwdOMzA1rX2Ab9Cz6eKHBWwkRpEn8zmq3KdsHpifKd5y6/MuEyXJ6tdKjBrmXTn3Ut6goz+yhUcPbvV4HEMCybRmF9YTvblb7Yk8trMHjOkq6J6EIEfQL3X07WTNpseCtuYF/j5tNws4boezEmOnS2hNkneMR+OfRaZ6UndFAMHd/Lj9fY2mscpPnWNACtmsD2nh0Z8ziwzCYnYAH2EV988cSq2vi3fkgCtd5b8zNGp+XJBefPaK7Vcp+w==");
- // 到账日期类型
- $request->setIntoAcctDateType("T0");
- // 设置非必填字段
- $extendInfoMap = getExtendInfos();
- $request->setExtendInfo($extendInfoMap);
- // 3. 发起API调用
- $client = new BsPayClient();
- $result = $client->postRequest($request);
- if (!$result || $result->isError()) { //失败处理
- var_dump($result -> getErrorInfo());
- } else { //成功处理
- var_dump($result);
- }
- /**
- * 非必填字段
- *
- */
- function getExtendInfos() {
- // 设置非必填字段
- $extendInfoMap = array();
- // 支行名
- $extendInfoMap["subbranch_bank_name"]= "subbranchBankName";
- // 收款方三证合一码
- $extendInfoMap["bank_acct_three_in_one"]= "dfa";
- // 异步通知地址
- $extendInfoMap["notify_url"]= "http://www.gangcai.com";
- return $extendInfoMap;
- }
|