| 1: | <?php |
| 2: | |
| 3: | |
| 4: | |
| 5: | namespace Worldline\Acquiring\Sdk\V1\Acquirer\Merchant\Balanceinquiries; |
| 6: | |
| 7: | use Worldline\Acquiring\Sdk\ApiResource; |
| 8: | use Worldline\Acquiring\Sdk\CallContext; |
| 9: | use Worldline\Acquiring\Sdk\Communication\ErrorResponseException; |
| 10: | use Worldline\Acquiring\Sdk\Communication\InvalidResponseException; |
| 11: | use Worldline\Acquiring\Sdk\Communication\ResponseClassMap; |
| 12: | use Worldline\Acquiring\Sdk\V1\ApiException; |
| 13: | use Worldline\Acquiring\Sdk\V1\AuthorizationException; |
| 14: | use Worldline\Acquiring\Sdk\V1\Domain\ApiBalanceInquiryRequest; |
| 15: | use Worldline\Acquiring\Sdk\V1\Domain\ApiBalanceInquiryResponse; |
| 16: | use Worldline\Acquiring\Sdk\V1\ExceptionFactory; |
| 17: | use Worldline\Acquiring\Sdk\V1\PlatformException; |
| 18: | use Worldline\Acquiring\Sdk\V1\ReferenceException; |
| 19: | use Worldline\Acquiring\Sdk\V1\ValidationException; |
| 20: | |
| 21: | |
| 22: | |
| 23: | |
| 24: | class BalanceInquiriesClient extends ApiResource |
| 25: | { |
| 26: | |
| 27: | private $responseExceptionFactory = null; |
| 28: | |
| 29: | |
| 30: | |
| 31: | |
| 32: | |
| 33: | |
| 34: | |
| 35: | |
| 36: | |
| 37: | |
| 38: | |
| 39: | |
| 40: | |
| 41: | |
| 42: | |
| 43: | |
| 44: | public function processBalanceInquiry(ApiBalanceInquiryRequest $body, CallContext $callContext = null) |
| 45: | { |
| 46: | $responseClassMap = new ResponseClassMap(); |
| 47: | $responseClassMap->defaultSuccessResponseClassName = '\Worldline\Acquiring\Sdk\V1\Domain\ApiBalanceInquiryResponse'; |
| 48: | $responseClassMap->defaultErrorResponseClassName = '\Worldline\Acquiring\Sdk\V1\Domain\ApiPaymentErrorResponse'; |
| 49: | try { |
| 50: | return $this->getCommunicator()->post( |
| 51: | $responseClassMap, |
| 52: | $this->instantiateUri('/processing/v1/{acquirerId}/{merchantId}/balance-inquiries'), |
| 53: | $body, |
| 54: | null, |
| 55: | $callContext |
| 56: | ); |
| 57: | } catch (ErrorResponseException $e) { |
| 58: | throw $this->getResponseExceptionFactory()->createException( |
| 59: | $e->getHttpStatusCode(), |
| 60: | $e->getErrorResponse(), |
| 61: | $callContext |
| 62: | ); |
| 63: | } |
| 64: | } |
| 65: | |
| 66: | |
| 67: | private function getResponseExceptionFactory() |
| 68: | { |
| 69: | if (is_null($this->responseExceptionFactory)) { |
| 70: | $this->responseExceptionFactory = new ExceptionFactory(); |
| 71: | } |
| 72: | return $this->responseExceptionFactory; |
| 73: | } |
| 74: | } |
| 75: | |