/** * Resource /{merchantId}/hostedcheckouts/{hostedCheckoutId} * Get hosted checkout status * * @param string $hostedCheckoutId * @param CallContext $callContext * @return GetHostedCheckoutResponse * * @throws GlobalCollectException * @throws InvalidResponseException * @throws AuthorizationException * @throws ValidationException * @throws ReferenceException * @throws IdempotenceException * @throws ApiException * @link https://developer.globalcollect.com/documentation/api/server/#__merchantId__hostedcheckouts__hostedCheckoutId__get Get hosted checkout status */ public function get($hostedCheckoutId, CallContext $callContext = null) { $this->context['hostedCheckoutId'] = $hostedCheckoutId; $responseClassMap = new ResponseClassMap(); $responseClassMap->addResponseClassName(200, '\\Ingenico\\Connect\\Sdk\\Domain\\Hostedcheckout\\GetHostedCheckoutResponse'); return $this->getCommunicator()->get($responseClassMap, $this->instantiateUri('/{apiVersion}/{merchantId}/hostedcheckouts/{hostedCheckoutId}'), $this->getClientMetaInfo(), null, $callContext); }
/** * @param ConnectionResponse $response * @param ResponseClassMap $responseClassMap * @return DataObject */ protected function getResponseObject(ConnectionResponse $response, ResponseClassMap $responseClassMap) { $contentType = $response->getHeaderValue('Content-Type'); if (!$contentType) { throw new UnexpectedValueException('Content type is missing or empty'); } if ($contentType != static::MIME_APPLICATION_JSON) { throw new UnexpectedValueException("Invalid content type; got '{$contentType}', expected '" . static::MIME_APPLICATION_JSON . "'"); } $httpStatusCode = $response->getHttpStatusCode(); if (!$httpStatusCode) { throw new UnexpectedValueException('HTTP status code is missing'); } $responseClassName = $responseClassMap->getResponseClassName($httpStatusCode); if (empty($responseClassName)) { if ($httpStatusCode < 400) { return null; } $responseClassName = '\\Ingenico\\Connect\\Sdk\\Domain\\Errors\\ErrorResponse'; } if (!class_exists($responseClassName)) { throw new UnexpectedValueException("class '{$responseClassName}' does not exist"); } $responseObject = new $responseClassName(); if (!$responseObject instanceof DataObject) { throw new UnexpectedValueException("class '{$responseClassName}' is not a 'DataObject'"); } /** @var DataObject $responseObject */ $responseObject->fromJson($response->getBody()); return $responseObject; }
/** * Resource /{merchantId}/productgroups/{paymentProductGroupId} * Get payment product group * * @param string $paymentProductGroupId * @param GetProductgroupParams $query * @param CallContext $callContext * @return PaymentProductGroupResponse * * @throws GlobalCollectException * @throws InvalidResponseException * @throws AuthorizationException * @throws ApiException * @throws ReferenceException * @throws IdempotenceException * @throws ValidationException * @link https://developer.globalcollect.com/documentation/api/server/#__merchantId__productgroups__paymentProductGroupId__get Get payment product group */ public function get($paymentProductGroupId, $query, CallContext $callContext = null) { $this->context['paymentProductGroupId'] = $paymentProductGroupId; $responseClassMap = new ResponseClassMap(); $responseClassMap->addResponseClassName(200, '\\Ingenico\\Connect\\Sdk\\Domain\\Product\\PaymentProductGroupResponse'); $responseClassMap->addResponseClassName(404, '\\Ingenico\\Connect\\Sdk\\Domain\\Errors\\ErrorResponse'); return $this->getCommunicator()->get($responseClassMap, $this->instantiateUri('/{apiVersion}/{merchantId}/productgroups/{paymentProductGroupId}'), $this->getClientMetaInfo(), $query, $callContext); }
/** * Resource /{merchantId}/riskassessments/bankaccounts * Risk-assess bank account * * @param RiskAssessmentBankAccount $body * @param CallContext $callContext * @return RiskAssessmentResponse * * @throws GlobalCollectException * @throws InvalidResponseException * @throws AuthorizationException * @throws ValidationException * @throws ReferenceException * @throws IdempotenceException * @throws ApiException * @link https://developer.globalcollect.com/documentation/api/server/#__merchantId__riskassessments_bankaccounts_post Risk-assess bank account */ public function bankaccounts($body, CallContext $callContext = null) { $responseClassMap = new ResponseClassMap(); $responseClassMap->addResponseClassName(200, '\\Ingenico\\Connect\\Sdk\\Domain\\Riskassessments\\RiskAssessmentResponse'); return $this->getCommunicator()->post($responseClassMap, $this->instantiateUri('/{apiVersion}/{merchantId}/riskassessments/bankaccounts'), $this->getClientMetaInfo(), $body, null, $callContext); }
/** * Resource /{merchantId}/services/convert/amount * Convert amount * * @param ConvertAmountParams $query * @param CallContext $callContext * @return ConvertAmount * * @throws GlobalCollectException * @throws InvalidResponseException * @throws AuthorizationException * @throws ValidationException * @throws ReferenceException * @throws IdempotenceException * @throws ApiException * @link https://developer.globalcollect.com/documentation/api/server/#__merchantId__services_convert_amount_get Convert amount */ public function convertAmount($query, CallContext $callContext = null) { $responseClassMap = new ResponseClassMap(); $responseClassMap->addResponseClassName(200, '\\Ingenico\\Connect\\Sdk\\Domain\\Services\\ConvertAmount'); return $this->getCommunicator()->get($responseClassMap, $this->instantiateUri('/{apiVersion}/{merchantId}/services/convert/amount'), $this->getClientMetaInfo(), $query, $callContext); }
/** * Resource /{merchantId}/tokens/{tokenId} * Delete token * * @param string $tokenId * @param DeleteTokenParams $query * @param CallContext $callContext * @return null * * @throws GlobalCollectException * @throws InvalidResponseException * @throws AuthorizationException * @throws ApiException * @throws ReferenceException * @throws IdempotenceException * @throws ValidationException * @link https://developer.globalcollect.com/documentation/api/server/#__merchantId__tokens__tokenId__delete Delete token */ public function delete($tokenId, $query, CallContext $callContext = null) { $this->context['tokenId'] = $tokenId; $responseClassMap = new ResponseClassMap(); $responseClassMap->addResponseClassName(204, ''); $responseClassMap->addResponseClassName(404, '\\Ingenico\\Connect\\Sdk\\Domain\\Errors\\ErrorResponse'); return $this->getCommunicator()->delete($responseClassMap, $this->instantiateUri('/{apiVersion}/{merchantId}/tokens/{tokenId}'), $this->getClientMetaInfo(), $query, $callContext); }
/** * Resource /{merchantId}/payments/{paymentId}/cancelapproval * Undo capture payment request * * @param string $paymentId * @param CallContext $callContext * @return CancelApprovalPaymentResponse * * @throws GlobalCollectException * @throws InvalidResponseException * @throws AuthorizationException * @throws ApiException * @throws ReferenceException * @throws IdempotenceException * @throws ValidationException * @link https://developer.globalcollect.com/documentation/api/server/#__merchantId__payments__paymentId__cancelapproval_post Undo capture payment request */ public function cancelapproval($paymentId, CallContext $callContext = null) { $this->context['paymentId'] = $paymentId; $responseClassMap = new ResponseClassMap(); $responseClassMap->addResponseClassName(200, '\\Ingenico\\Connect\\Sdk\\Domain\\Payment\\CancelApprovalPaymentResponse'); $responseClassMap->addResponseClassName(404, '\\Ingenico\\Connect\\Sdk\\Domain\\Errors\\ErrorResponse'); return $this->getCommunicator()->post($responseClassMap, $this->instantiateUri('/{apiVersion}/{merchantId}/payments/{paymentId}/cancelapproval'), $this->getClientMetaInfo(), null, null, $callContext); }