elf 1 year ago
parent 5a4bedc366
commit 17eef6737f

@ -473,4 +473,50 @@ class Baofu
$data['tradeId'] = $params['tradeId']; $data['tradeId'] = $params['tradeId'];
return $this->api('query-order', $data); return $this->api('query-order', $data);
} }
public function transferWithdraw($params) {
$header = [];
$header['memberId'] = $params['memberId'];
$header['terminalId'] = $params['82254'];
$header['serviceTp'] = 'T-1001-003-01';
$header['verifyType'] = 1;
$items = [];
foreach ($params['transContent'] as $transItem) {
$item = [];
$item['transNo'] = $transItem['transNo'];
$item['transMoney'] = $transItem['transMoney'];
$item['transType'] = $transItem['transType'];
$item['transAccNo'] = $transItem['transAccNo'];
$item['transAccName'] = $transItem['transAccName'];
$item['transSummary'] = $transItem['transSummary'] ?? '转账';
if ($transItem['transType'] == 0) {
// 付款类型为银行时 传银行信息
$item['cardBankName'] = $transItem['cardBankName'];
$item['cardProName'] = $transItem['cardProName'];
$item['cardCityName'] = $transItem['cardCityName'];
$item['cardAccDept'] = $transItem['cardAccDept'];
$item['cardCnap'] = $transItem['cardCnap'];
$item['transIdCard'] = $transItem['transIdCard'];
$item['transMobile'] = $transItem['transMobile'];
}
ksort($item);
$items[] = $item;
}
$body = ['transContent' => $items];
$content = [
'header' => $header,
'body' => $body,
];
ksort($content);
$contentSign = SignatureUtil::sign(base64_encode(json_encode($content)), $this->getPfxFilePath(), $this->getPrivateKeyPassword());
$header['content'] = $contentSign;
$url = 'https://vgw.baofoo.com/union-gw/api/' . $header['serviceTp'] . '/transReq.do';
$response = HttpClient::post($url, $header);
$result = Rsa::decryptByPublicKey($response, $this->getCerFilePath());
$result = base64_decode($result);
return json_encode($result, true);
}
} }

Loading…
Cancel
Save