You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
221 lines
6.4 KiB
221 lines
6.4 KiB
<?php
|
|
|
|
namespace Tansilu\HfPayLib\factory\impl;
|
|
|
|
use Tansilu\HfPayLib\Constant;
|
|
use Tansilu\HfPayLib\exception\ParamsException;
|
|
use Tansilu\HfPayLib\factory\object\manage\BindCashCard;
|
|
use Tansilu\HfPayLib\factory\object\manage\CertificateInfo;
|
|
use Tansilu\HfPayLib\factory\object\manage\DownloadFiles;
|
|
use Tansilu\HfPayLib\factory\object\manage\UnBindCard;
|
|
use Tansilu\HfPayLib\http\Factory;
|
|
|
|
class ManageFactory extends Factory
|
|
{
|
|
/**
|
|
* 绑定取现卡
|
|
*
|
|
* @param string $customId
|
|
* @param string $orderId
|
|
* @param string $orderDate
|
|
* @param string $cardNo
|
|
* @param string $cardType
|
|
* @param string $bankId
|
|
* @param string $branchName
|
|
* @param string $cardProv
|
|
* @param string $cardArea
|
|
* @param string $cashFlag
|
|
* @param string $bgRetUrl
|
|
* @param string $attach
|
|
* @param string $extension
|
|
*
|
|
* @return BindCashCard|null
|
|
* @throws ParamsException
|
|
*
|
|
* @ses https://hfpay.cloudpnr.com/customers/nft/#/manage/bindCashCard
|
|
*/
|
|
function bindCashCard(
|
|
string $customId,
|
|
string $orderId,
|
|
string $orderDate,
|
|
string $cardNo,
|
|
string $cardType = Constant::CARD_TYPE_USER,
|
|
string $bankId = '',
|
|
string $branchName = '',
|
|
string $cardProv = '',
|
|
string $cardArea = '',
|
|
string $cashFlag = Constant::CARD_CASH_FLAG_NONE,
|
|
string $bgRetUrl = '',
|
|
string $attach = '',
|
|
string $extension = ''
|
|
): ?BindCashCard
|
|
{
|
|
$params = [
|
|
'user_cust_id' => $customId,
|
|
'order_id' => $orderId,
|
|
'order_date' => $orderDate,
|
|
'bank_id' => $bankId,
|
|
'card_num' => $cardNo,
|
|
'card_type' => $cardType,
|
|
'default_cash_flag' => $cashFlag
|
|
];
|
|
if($cardType == Constant::CARD_TYPE_COMPANY) {
|
|
if(empty($bankId)) {
|
|
throw new ParamsException('对公账户需要填写银行代码');
|
|
}
|
|
}
|
|
if(!empty($branchName)) {
|
|
$params['branch_name'] = $branchName;
|
|
}
|
|
if(!empty($cardProv)) {
|
|
$params['card_prov'] = $cardProv;
|
|
}
|
|
if(!empty($cardArea)) {
|
|
$params['card_area'] = $cardArea;
|
|
}
|
|
if(!empty($attach)) {
|
|
$params['mer_priv'] = $attach;
|
|
}
|
|
if(!empty($extension)) {
|
|
$params['extension'] = $extension;
|
|
}
|
|
if(!empty($bgRetUrl)) {
|
|
$params['bg_ret_url'] = $bgRetUrl;
|
|
}
|
|
$result = $this->post('/api/acou/bind08', $params);
|
|
if(!$result->isSuccess()) {
|
|
return null;
|
|
}
|
|
return BindCashCard::make($result->getBody());
|
|
}
|
|
|
|
|
|
/**
|
|
* 银行卡解绑
|
|
*
|
|
* @param string $customId
|
|
* @param string $orderId
|
|
* @param string $orderDate
|
|
* @param string $bindCardId
|
|
* @param string $cardType
|
|
* @param string $bgRetUrl
|
|
* @param string $attach
|
|
* @param string $extension
|
|
* @param string $devInfoJson
|
|
*
|
|
* @return UnBindCard|null
|
|
*
|
|
* @see https://hfpay.cloudpnr.com/customers/nft/#/manage/unbindCard
|
|
*/
|
|
public function unBindCard(string $customId, string $orderId, string $orderDate, string $bindCardId, string $cardType,
|
|
string $bgRetUrl,
|
|
string $attach = '', string $extension = '', string $devInfoJson = ''
|
|
): ?UnBindCard
|
|
{
|
|
$params = [
|
|
'user_cust_id' => $customId,
|
|
'order_id' => $orderId,
|
|
'order_date' => $orderDate,
|
|
'bind_card_id' => $bindCardId,
|
|
'card_buss_type' => $cardType,
|
|
'bg_ret_url' => $bgRetUrl,
|
|
];
|
|
if(!empty($attach)) {
|
|
$params['mer_priv'] = $attach;
|
|
}
|
|
if(!empty($extension)) {
|
|
$params['extension'] = $extension;
|
|
}
|
|
if(!empty($devInfoJson)) {
|
|
$params['dev_info_json'] = $devInfoJson;
|
|
}
|
|
$result = $this->post('/api/acou/unbd01', $params);
|
|
|
|
if(!$result->isSuccess()) {
|
|
return null;
|
|
}
|
|
return UnBindCard::make($result->getBody());
|
|
}
|
|
|
|
/**
|
|
* 文件下载
|
|
*
|
|
* @param string $fileDate
|
|
* @param string $fileType
|
|
*
|
|
* @return DownloadFiles
|
|
*
|
|
* @see https://hfpay.cloudpnr.com/customers/nft/#/manage/fileDownload
|
|
*/
|
|
function fileDownload(string $fileDate, string $fileType = Constant::FILE_TYPE_CHARGE): ?DownloadFiles
|
|
{
|
|
$params = [
|
|
'file_date' => $fileDate,
|
|
'file_type' => $fileType
|
|
];
|
|
$result = $this->post('/api/alse/file02', $params);
|
|
if(!$result->isSuccess()) {
|
|
return null;
|
|
}
|
|
|
|
return DownloadFiles::make($result->getBody());
|
|
}
|
|
|
|
|
|
/**
|
|
* 电子凭证下载
|
|
*
|
|
* 后台返回(异步)
|
|
*
|
|
* @param string $customId
|
|
* @param string $orderId
|
|
* @param string $orderDate
|
|
* @param string $originalOrderDate
|
|
* @param string $bgRetUrl
|
|
* @param array $originalOrderId
|
|
* @param string $stage
|
|
* @param string $attach
|
|
* @param string $extension
|
|
*
|
|
* @return ?CertificateInfo
|
|
*
|
|
* https://hfpay.cloudpnr.com/customers/nft/#/manage/electronicCertificate
|
|
*/
|
|
function eCertificate(
|
|
string $customId,
|
|
string $orderId,
|
|
string $orderDate,
|
|
string $originalOrderDate,
|
|
string $bgRetUrl,
|
|
array $originalOrderId = [],
|
|
string $stage = Constant::GUARANTEE_STAGE_IN,
|
|
string $attach = '',
|
|
string $extension = ''
|
|
): ?CertificateInfo
|
|
{
|
|
$params = [
|
|
'user_cust_id' => $customId,
|
|
'order_id' => $orderId,
|
|
'order_date' => $orderDate,
|
|
'bg_ret_url' => $bgRetUrl,
|
|
'org_order_date' => $originalOrderDate,
|
|
'guarantee_stage' => $stage,
|
|
];
|
|
if(!empty($attach)) {
|
|
$params['mer_priv'] = $attach;
|
|
}
|
|
if(!empty($extension)) {
|
|
$params['extension'] = $extension;
|
|
}
|
|
if(!empty($originalOrderId)) {
|
|
$params['org_order_id'] = join(',', $originalOrderId);
|
|
}
|
|
$result = $this->post('/api/alse/file05', $params);
|
|
|
|
if(!$result->isSuccess()) {
|
|
return null;
|
|
}
|
|
|
|
return CertificateInfo::make($result->getBody());
|
|
}
|
|
} |