43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Extend\Ca_V2;
|
|
|
|
use App\Constants\HttpEnumCode;
|
|
use App\Exception\BusinessException;
|
|
use GuzzleHttp\Exception\GuzzleException;
|
|
|
|
class CaOffline extends Ca
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->initConfig('ca.v2.offline', 'ca_v2_offline');
|
|
}
|
|
|
|
public function getCloudCert(array $data, string $type = 'Personal'): mixed
|
|
{
|
|
$option = [
|
|
'form_params' => [
|
|
'entityId' => $data['user_id'],
|
|
'entityType' => $type,
|
|
'pin' => $data['user_id'],
|
|
'cardNumber' => $data['card_num'],
|
|
],
|
|
];
|
|
|
|
try {
|
|
$response = $this->httpRequest(
|
|
$this->api_url . '/cloud-certificate-service/api/cloudCert/open/v2/cert/offlineAuthCertEnroll',
|
|
$option
|
|
);
|
|
if (empty($response)) {
|
|
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR));
|
|
}
|
|
|
|
return $response;
|
|
} catch (GuzzleException $e) {
|
|
throw new BusinessException($e->getMessage());
|
|
}
|
|
}
|
|
}
|