123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <?php
- /**
- * 快捷支付申请 - 示例
- *
- * @author sdk-generator
- * @Description
- */
- namespace BsPayClassify;
- use BsPaySdk\core\BsPayClient;
- use BsPaySdk\request\V2TradeOnlinepaymentQuickpayApplyRequest;
- class V2TradeOnlinepaymentQuickpayApply extends BaseInfo
- {
- public function index($data)
- {
- // 2.组装请求参数
- $request = new V2TradeOnlinepaymentQuickpayApplyRequest();
- // 请求日期
- $request->setReqDate(date("Ymd"));
- // 请求流水号
- $request->setReqSeqId($data['req_seq_id']);
- // 商户号
- $request->setHuifuId($data['huifu_id']);
- // 订单金额
- $request->setTransAmt($data['trans_amt']);
- // 绑卡id
- $request->setCardBindId($data['card_bind_id']);
- // 异步通知地址
- $request->setNotifyUrl($data['notify_url']);
- // 用户客户号
- $request->setUserHuifuId($data['user_huifu_id']);
- // 安全信息
- $request->setRiskCheckData($this->getRiskCheckData());
- // 设备数据
- $request->setTerminalDeviceData($this->getTerminalDeviceData());
- // 银行扩展字段
- $request->setExtendPayData($this->getExtendPayData());
- // 设置非必填字段
- $extendInfoMap = $this->getExtendInfos($data);
- $request->setExtendInfo($extendInfoMap);
- // 3. 发起API调用
- $client = new BsPayClient();
- $result = $client->postRequest($request);
- return $result;
- }
- /**
- * 非必填字段
- *
- */
- function getExtendInfos($data) {
- // 设置非必填字段
- $extendInfoMap = array();
- // 订单类型
- $extendInfoMap["order_type"]= "P";
- // 备注
- $extendInfoMap["remark"]= $data['good_desc'];
- // 订单失效时间
- // $extendInfoMap["time_expire"]= "";
- // 补贴支付信息
- // $extendInfoMap["combinedpay_data"]= getCombinedpayData();
- // 分账对象
- // $extendInfoMap["acct_split_bunch"]= getAcctSplitBunchRucan();
- // 是否延迟交易
- $extendInfoMap["delay_acct_flag"]= "N";
- // 手续费扣款标志
- // $extendInfoMap["fee_flag"]= "";
- return $extendInfoMap;
- }
- function getRiskCheckData() {
- $dto = array();
- // ip地址
- $dto["ip_addr"] = "106.33.180.238";
- // 基站地址
- // $dto["base_station"] = "";
- // 纬度
- // $dto["latitude"] = "";
- // 经度
- // $dto["longitude"] = "";
- return json_encode($dto,JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
- }
- function getTerminalDeviceData() {
- $dto = array();
- // 交易设备ip
- $dto["device_ip"] = "106.33.180.238";
- // 设备类型
- $dto["device_type"] = "1";
- // 交易设备gps
- // $dto["device_gps"] = "";
- // 交易设备iccid
- // $dto["device_icc_id"] = "";
- // 交易设备imei
- // $dto["device_imei"] = "";
- // 交易设备imsi
- // $dto["device_imsi"] = "";
- // 交易设备mac
- // $dto["device_mac"] = "";
- // 交易设备wifimac
- // $dto["device_wifi_mac"] = "";
- return json_encode($dto,JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
- }
- function getCombinedpayData() {
- $dto = array();
- // 补贴方汇付编号
- // $dto["huifu_id"] = "test";
- // 补贴方类型
- // $dto["user_type"] = "test";
- // 补贴方账户号
- // $dto["acct_id"] = "test";
- // 补贴金额
- // $dto["amount"] = "test";
- $dtoList = array();
- array_push($dtoList, $dto);
- return json_encode($dtoList,JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
- }
- function getAcctInfos() {
- $dto = array();
- // 分账金额
- // $dto["div_amt"] = "";
- // 被分账方ID
- // $dto["huifu_id"] = "";
- // 账户号
- // $dto["acct_id"] = "";
- $dtoList = array();
- array_push($dtoList, $dto);
- return $dtoList;
- }
- function getAcctSplitBunchRucan() {
- $dto = array();
- // 分账信息列表
- // $dto["acct_infos"] = getAcctInfos();
- return json_encode($dto,JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
- }
- function getExtendPayData() {
- $dto = array();
- // 业务种类
- // $dto["biz_tp"] = "test";
- // 商品简称
- // $dto["goods_short_name"] = "test";
- // 网关支付受理渠道
- $dto["gw_chnnl_tp"] = "99";
- return json_encode($dto,JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
- }
- }
|