Skip to content

Commit 00e22c0

Browse files
committed
Support API CredentialVerifyIntl.
1 parent 23c7aea commit 00e22c0

File tree

8 files changed

+673
-0
lines changed

8 files changed

+673
-0
lines changed

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2025-04-24 Version: 3.5.0
2+
- Support API CredentialVerifyIntl.
3+
4+
15
2025-04-23 Version: 3.4.2
26
- Update API Initialize: add request parameters DateOfBirth.
37
- Update API Initialize: add request parameters DateOfExpiry.

composer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
"require": {
2828
"php": ">5.5",
2929
"alibabacloud/darabonba": "^1.0.0",
30+
"alibabacloud/tea-oss-sdk": "^0.3.1",
31+
"alibabacloud/openplatform-20191219": "2.0.1",
32+
"alibabacloud/tea-oss-utils": "^0.3.1",
33+
"alibabacloud/tea-fileform": "^0.3.0",
3034
"alibabacloud/openapi-core": "^1.0.0"
3135
},
3236
"prefer-stable": true

src/Cloudauthintl.php

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
use AlibabaCloud\SDK\Cloudauthintl\V20220809\Models\CheckResultResponse;
1212
use AlibabaCloud\SDK\Cloudauthintl\V20220809\Models\CheckVerifyLogRequest;
1313
use AlibabaCloud\SDK\Cloudauthintl\V20220809\Models\CheckVerifyLogResponse;
14+
use AlibabaCloud\SDK\Cloudauthintl\V20220809\Models\CredentialVerifyIntlAdvanceRequest;
15+
use AlibabaCloud\SDK\Cloudauthintl\V20220809\Models\CredentialVerifyIntlRequest;
16+
use AlibabaCloud\SDK\Cloudauthintl\V20220809\Models\CredentialVerifyIntlResponse;
1417
use AlibabaCloud\SDK\Cloudauthintl\V20220809\Models\DeepfakeDetectIntlRequest;
1518
use AlibabaCloud\SDK\Cloudauthintl\V20220809\Models\DeepfakeDetectIntlResponse;
1619
use AlibabaCloud\SDK\Cloudauthintl\V20220809\Models\DeleteVerifyResultRequest;
@@ -36,6 +39,14 @@
3639
use AlibabaCloud\SDK\Cloudauthintl\V20220809\Models\InitializeShrinkRequest;
3740
use AlibabaCloud\SDK\Cloudauthintl\V20220809\Models\Mobile3MetaVerifyIntlRequest;
3841
use AlibabaCloud\SDK\Cloudauthintl\V20220809\Models\Mobile3MetaVerifyIntlResponse;
42+
use AlibabaCloud\SDK\OpenPlatform\V20191219\Models\AuthorizeFileUploadRequest;
43+
use AlibabaCloud\SDK\OpenPlatform\V20191219\Models\AuthorizeFileUploadResponse;
44+
use AlibabaCloud\SDK\OpenPlatform\V20191219\OpenPlatform;
45+
use AlibabaCloud\SDK\OSS\OSS;
46+
use AlibabaCloud\SDK\OSS\OSS\PostObjectRequest;
47+
use AlibabaCloud\SDK\OSS\OSS\PostObjectRequest\header;
48+
use AlibabaCloud\Tea\FileForm\FileForm\FileField;
49+
use Darabonba\OpenApi\Models\Config;
3950
use Darabonba\OpenApi\Models\OpenApiRequest;
4051
use Darabonba\OpenApi\Models\Params;
4152
use Darabonba\OpenApi\OpenApiClient;
@@ -306,6 +317,162 @@ public function checkVerifyLog($request)
306317
return $this->checkVerifyLogWithOptions($request, $runtime);
307318
}
308319

320+
/**
321+
* 凭证核验.
322+
*
323+
* @param request - CredentialVerifyIntlRequest
324+
* @param runtime - runtime options for this request RuntimeOptions
325+
*
326+
* @returns CredentialVerifyIntlResponse
327+
*
328+
* @param CredentialVerifyIntlRequest $request
329+
* @param RuntimeOptions $runtime
330+
*
331+
* @return CredentialVerifyIntlResponse
332+
*/
333+
public function credentialVerifyIntlWithOptions($request, $runtime)
334+
{
335+
$request->validate();
336+
$query = [];
337+
if (null !== $request->credName) {
338+
@$query['CredName'] = $request->credName;
339+
}
340+
341+
if (null !== $request->credType) {
342+
@$query['CredType'] = $request->credType;
343+
}
344+
345+
if (null !== $request->imageUrl) {
346+
@$query['ImageUrl'] = $request->imageUrl;
347+
}
348+
349+
if (null !== $request->productCode) {
350+
@$query['ProductCode'] = $request->productCode;
351+
}
352+
353+
$body = [];
354+
if (null !== $request->imageFile) {
355+
@$body['ImageFile'] = $request->imageFile;
356+
}
357+
358+
$req = new OpenApiRequest([
359+
'query' => Utils::query($query),
360+
'body' => Utils::parseToMap($body),
361+
]);
362+
$params = new Params([
363+
'action' => 'CredentialVerifyIntl',
364+
'version' => '2022-08-09',
365+
'protocol' => 'HTTPS',
366+
'pathname' => '/',
367+
'method' => 'POST',
368+
'authType' => 'AK',
369+
'style' => 'RPC',
370+
'reqBodyType' => 'formData',
371+
'bodyType' => 'json',
372+
]);
373+
374+
return CredentialVerifyIntlResponse::fromMap($this->callApi($params, $req, $runtime));
375+
}
376+
377+
/**
378+
* 凭证核验.
379+
*
380+
* @param request - CredentialVerifyIntlRequest
381+
*
382+
* @returns CredentialVerifyIntlResponse
383+
*
384+
* @param CredentialVerifyIntlRequest $request
385+
*
386+
* @return CredentialVerifyIntlResponse
387+
*/
388+
public function credentialVerifyIntl($request)
389+
{
390+
$runtime = new RuntimeOptions([]);
391+
392+
return $this->credentialVerifyIntlWithOptions($request, $runtime);
393+
}
394+
395+
/**
396+
* @param CredentialVerifyIntlAdvanceRequest $request
397+
* @param RuntimeOptions $runtime
398+
*
399+
* @return CredentialVerifyIntlResponse
400+
*/
401+
public function credentialVerifyIntlAdvance($request, $runtime)
402+
{
403+
// Step 0: init client
404+
$accessKeyId = $this->_credential->getAccessKeyId();
405+
$accessKeySecret = $this->_credential->getAccessKeySecret();
406+
$securityToken = $this->_credential->getSecurityToken();
407+
$credentialType = $this->_credential->getType();
408+
$openPlatformEndpoint = $this->_openPlatformEndpoint;
409+
if (null === $openPlatformEndpoint) {
410+
$openPlatformEndpoint = 'openplatform.aliyuncs.com';
411+
}
412+
413+
if (null === $credentialType) {
414+
$credentialType = 'access_key';
415+
}
416+
417+
$authConfig = new Config([
418+
'accessKeyId' => $accessKeyId,
419+
'accessKeySecret' => $accessKeySecret,
420+
'securityToken' => $securityToken,
421+
'type' => $credentialType,
422+
'endpoint' => $openPlatformEndpoint,
423+
'protocol' => $this->_protocol,
424+
'regionId' => $this->_regionId,
425+
]);
426+
$authClient = new OpenPlatform($authConfig);
427+
$authRequest = new AuthorizeFileUploadRequest([
428+
'product' => 'Cloudauth-intl',
429+
'regionId' => $this->_regionId,
430+
]);
431+
$authResponse = new AuthorizeFileUploadResponse([]);
432+
$ossConfig = new OSS\Config([
433+
'accessKeyId' => $accessKeyId,
434+
'accessKeySecret' => $accessKeySecret,
435+
'type' => 'access_key',
436+
'protocol' => $this->_protocol,
437+
'regionId' => $this->_regionId,
438+
]);
439+
$ossClient = new OSS($ossConfig);
440+
$fileObj = new FileField([]);
441+
$ossHeader = new header([]);
442+
$uploadRequest = new PostObjectRequest([]);
443+
$ossRuntime = new \AlibabaCloud\Tea\OSSUtils\OSSUtils\RuntimeOptions([]);
444+
Utils::convert($runtime, $ossRuntime);
445+
$credentialVerifyIntlReq = new CredentialVerifyIntlRequest([]);
446+
Utils::convert($request, $credentialVerifyIntlReq);
447+
if (null !== $request->imageFileObject) {
448+
$authResponse = $authClient->authorizeFileUploadWithOptions($authRequest, $runtime);
449+
$ossConfig->accessKeyId = $authResponse->body->accessKeyId;
450+
$ossConfig->endpoint = Utils::getEndpoint($authResponse->body->endpoint, $authResponse->body->useAccelerate, $this->_endpointType);
451+
$ossClient = new OSS($ossConfig);
452+
$fileObj = new FileField([
453+
'filename' => $authResponse->body->objectKey,
454+
'content' => $request->imageFileObject,
455+
'contentType' => '',
456+
]);
457+
$ossHeader = new header([
458+
'accessKeyId' => $authResponse->body->accessKeyId,
459+
'policy' => $authResponse->body->encodedPolicy,
460+
'signature' => $authResponse->body->signature,
461+
'key' => $authResponse->body->objectKey,
462+
'file' => $fileObj,
463+
'successActionStatus' => '201',
464+
]);
465+
$uploadRequest = new PostObjectRequest([
466+
'bucketName' => $authResponse->body->bucket,
467+
'header' => $ossHeader,
468+
]);
469+
$ossClient->postObject($uploadRequest, $ossRuntime);
470+
$credentialVerifyIntlReq->imageFile = 'http://' . $authResponse->body->bucket . '.' . $authResponse->body->endpoint . '/' . $authResponse->body->objectKey . '';
471+
}
472+
473+
return $this->credentialVerifyIntlWithOptions($credentialVerifyIntlReq, $runtime);
474+
}
475+
309476
/**
310477
* 人脸凭证核验.
311478
*
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<?php
2+
3+
// This file is auto-generated, don't edit it. Thanks.
4+
5+
namespace AlibabaCloud\SDK\Cloudauthintl\V20220809\Models;
6+
7+
use AlibabaCloud\Dara\Model;
8+
use GuzzleHttp\Psr7\Stream;
9+
10+
class CredentialVerifyIntlAdvanceRequest extends Model
11+
{
12+
/**
13+
* @var string
14+
*/
15+
public $credName;
16+
17+
/**
18+
* @var string
19+
*/
20+
public $credType;
21+
22+
/**
23+
* @var Stream
24+
*/
25+
public $imageFileObject;
26+
27+
/**
28+
* @var string
29+
*/
30+
public $imageUrl;
31+
32+
/**
33+
* @var string
34+
*/
35+
public $productCode;
36+
protected $_name = [
37+
'credName' => 'CredName',
38+
'credType' => 'CredType',
39+
'imageFileObject' => 'ImageFile',
40+
'imageUrl' => 'ImageUrl',
41+
'productCode' => 'ProductCode',
42+
];
43+
44+
public function validate()
45+
{
46+
parent::validate();
47+
}
48+
49+
public function toArray($noStream = false)
50+
{
51+
$res = [];
52+
if (null !== $this->credName) {
53+
$res['CredName'] = $this->credName;
54+
}
55+
56+
if (null !== $this->credType) {
57+
$res['CredType'] = $this->credType;
58+
}
59+
60+
if (null !== $this->imageFileObject) {
61+
$res['ImageFile'] = $this->imageFileObject;
62+
}
63+
64+
if (null !== $this->imageUrl) {
65+
$res['ImageUrl'] = $this->imageUrl;
66+
}
67+
68+
if (null !== $this->productCode) {
69+
$res['ProductCode'] = $this->productCode;
70+
}
71+
72+
return $res;
73+
}
74+
75+
public function toMap($noStream = false)
76+
{
77+
return $this->toArray($noStream);
78+
}
79+
80+
public static function fromMap($map = [])
81+
{
82+
$model = new self();
83+
if (isset($map['CredName'])) {
84+
$model->credName = $map['CredName'];
85+
}
86+
87+
if (isset($map['CredType'])) {
88+
$model->credType = $map['CredType'];
89+
}
90+
91+
if (isset($map['ImageFile'])) {
92+
$model->imageFileObject = $map['ImageFile'];
93+
}
94+
95+
if (isset($map['ImageUrl'])) {
96+
$model->imageUrl = $map['ImageUrl'];
97+
}
98+
99+
if (isset($map['ProductCode'])) {
100+
$model->productCode = $map['ProductCode'];
101+
}
102+
103+
return $model;
104+
}
105+
}

0 commit comments

Comments
 (0)