1: <?php
2: /*
3: * This class was auto-generated from the API references found at
4: * https://apireference.connect.worldline-solutions.com/
5: */
6: namespace Worldline\Connect\Sdk\V1\Merchant\Riskassessments;
7:
8: use Worldline\Connect\Sdk\ApiResource;
9: use Worldline\Connect\Sdk\CallContext;
10: use Worldline\Connect\Sdk\Communication\ErrorResponseException;
11: use Worldline\Connect\Sdk\Communication\InvalidResponseException;
12: use Worldline\Connect\Sdk\Communication\ResponseClassMap;
13: use Worldline\Connect\Sdk\V1\ApiException;
14: use Worldline\Connect\Sdk\V1\AuthorizationException;
15: use Worldline\Connect\Sdk\V1\Domain\RiskAssessmentBankAccount;
16: use Worldline\Connect\Sdk\V1\Domain\RiskAssessmentCard;
17: use Worldline\Connect\Sdk\V1\Domain\RiskAssessmentResponse;
18: use Worldline\Connect\Sdk\V1\ExceptionFactory;
19: use Worldline\Connect\Sdk\V1\IdempotenceException;
20: use Worldline\Connect\Sdk\V1\PlatformException;
21: use Worldline\Connect\Sdk\V1\ReferenceException;
22: use Worldline\Connect\Sdk\V1\ValidationException;
23:
24: /**
25: * Risk assessments client.
26: *
27: * @package Worldline\Connect\Sdk\V1\Merchant\Riskassessments
28: */
29: class RiskassessmentsClient extends ApiResource
30: {
31: /**
32: * @var ExceptionFactory|null
33: */
34: private ?ExceptionFactory $responseExceptionFactory = null;
35:
36: /**
37: * Resource /{merchantId}/riskassessments/bankaccounts - Risk-assess bankaccount
38: *
39: * @param RiskAssessmentBankAccount $body
40: * @param CallContext|null $callContext
41: *
42: * @return RiskAssessmentResponse
43: * @throws IdempotenceException
44: * @throws ValidationException
45: * @throws AuthorizationException
46: * @throws ReferenceException
47: * @throws PlatformException
48: * @throws ApiException
49: * @throws InvalidResponseException
50: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/riskassessments/bankaccounts.html Risk-assess bankaccount
51: */
52: public function bankaccounts(RiskAssessmentBankAccount $body, ?CallContext $callContext = null): RiskAssessmentResponse
53: {
54: $responseClassMap = new ResponseClassMap();
55: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\RiskAssessmentResponse';
56: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse';
57: try {
58: return $this->getCommunicator()->post(
59: $responseClassMap,
60: $this->instantiateUri('/v1/{merchantId}/riskassessments/bankaccounts'),
61: $this->getClientMetaInfo(),
62: $body,
63: null,
64: $callContext
65: );
66: } catch (ErrorResponseException $e) {
67: throw $this->getResponseExceptionFactory()->createException(
68: $e->getHttpStatusCode(),
69: $e->getErrorResponse(),
70: $callContext
71: );
72: }
73: }
74:
75: /**
76: * Resource /{merchantId}/riskassessments/cards - Risk-assess card
77: *
78: * @param RiskAssessmentCard $body
79: * @param CallContext|null $callContext
80: *
81: * @return RiskAssessmentResponse
82: * @throws IdempotenceException
83: * @throws ValidationException
84: * @throws AuthorizationException
85: * @throws ReferenceException
86: * @throws PlatformException
87: * @throws ApiException
88: * @throws InvalidResponseException
89: * @link https://apireference.connect.worldline-solutions.com/s2sapi/v1/en_US/php/riskassessments/cards.html Risk-assess card
90: */
91: public function cards(RiskAssessmentCard $body, ?CallContext $callContext = null): RiskAssessmentResponse
92: {
93: $responseClassMap = new ResponseClassMap();
94: $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\RiskAssessmentResponse';
95: $responseClassMap->defaultErrorResponseClassName = '\Worldline\Connect\Sdk\V1\Domain\ErrorResponse';
96: try {
97: return $this->getCommunicator()->post(
98: $responseClassMap,
99: $this->instantiateUri('/v1/{merchantId}/riskassessments/cards'),
100: $this->getClientMetaInfo(),
101: $body,
102: null,
103: $callContext
104: );
105: } catch (ErrorResponseException $e) {
106: throw $this->getResponseExceptionFactory()->createException(
107: $e->getHttpStatusCode(),
108: $e->getErrorResponse(),
109: $callContext
110: );
111: }
112: }
113:
114: /**
115: * @return ExceptionFactory
116: */
117: private function getResponseExceptionFactory(): ExceptionFactory
118: {
119: if (is_null($this->responseExceptionFactory)) {
120: $this->responseExceptionFactory = new ExceptionFactory();
121: }
122: return $this->responseExceptionFactory;
123: }
124: }
125: