尝试取消手续费
This commit is contained in:
@@ -117,30 +117,54 @@ class EplPayService
|
||||
|
||||
//单笔提现
|
||||
public function withDraw($params){
|
||||
// 构建请求提现接口的URL
|
||||
$url = $this->eplConfig['url'].'/api/txs/pay/withdrawalToCard';
|
||||
|
||||
// 构建请求参数数组
|
||||
$param = [
|
||||
// 设置商户订单号
|
||||
'outTradeNo' => $params['order_no'],
|
||||
// 设置客户代码
|
||||
'customerCode' => $this->eplConfig['customerCode'],
|
||||
// 设置提现金额,将申请的现金金额乘以100,转换为分
|
||||
'amount' => bcmul($params['apply_cash'], 100, 0),
|
||||
'arrivalType' => 0,// 到账类型 0当日 1次日 最大99
|
||||
'procedureType' => 'inner', //inner内扣 outer外扣
|
||||
'bankUserName' => $this->public_encrypt($params['bank_user_name']), //开户人姓名
|
||||
'bankCardNo' => $this->public_encrypt($params['bank_card']), //银行卡号
|
||||
'bankName' => $params['bank_name'],// 银行名称
|
||||
'bankAccountType' => $params['bank_account_type'], //1对公 2对私 5存折
|
||||
// 设置到账类型,0表示当日到账
|
||||
'arrivalType' => 0,
|
||||
// 设置手续费扣除方式,内扣或外扣
|
||||
'procedureType' => 'inner',
|
||||
// 设置开户人姓名,使用公钥加密
|
||||
'bankUserName' => $this->public_encrypt($params['bank_user_name']),
|
||||
// 设置银行卡号,使用公钥加密
|
||||
'bankCardNo' => $this->public_encrypt($params['bank_card']),
|
||||
// 设置银行名称
|
||||
'bankName' => $params['bank_name'],
|
||||
// 设置账户类型,对公、对私或存折
|
||||
'bankAccountType' => $params['bank_account_type'],
|
||||
// 设置服务器回调通知URL
|
||||
'notifyUrl' => $this->eplConfig['withdraw_notify_url'],
|
||||
// 设置支付货币类型
|
||||
'payCurrency' => 'CNY',
|
||||
// 设置随机字符串
|
||||
'nonceStr' => FuncHelper::uuid()
|
||||
];
|
||||
|
||||
// 根据银行账户类型和银行卡号的前两位判断是否需要设置银行代码
|
||||
if($params['bank_account_type'] != '2' || substr($params['bank_card'],0,2) != '62'){
|
||||
$param['bankNo'] = $params['bank_no'];
|
||||
}
|
||||
|
||||
// 生成请求的签名
|
||||
$sign = $this->sign(Json::encode($param));
|
||||
|
||||
// 发起提现请求
|
||||
$result = $this->http_post_json($url,Json::encode($param),$sign);
|
||||
|
||||
// 验证请求结果,如果结果为空或HTTP状态码不是200,则抛出异常
|
||||
if(!$result || $result[0] != 200){
|
||||
throw new Exception('提现失败');
|
||||
}
|
||||
|
||||
// 解析并返回提现请求的结果
|
||||
return Json::decode($result[1]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user