/**
  * @param WebhookRequest $webhookRequest
  * @param bool           $authenticateClientIp
  *
  * @return Response
  */
 public function getSymfonyResponse(WebhookRequest $webhookRequest = null, $authenticateClientIp = true)
 {
     try {
         if (!$webhookRequest) {
             $webhookRequest = WebhookRequest::fromGlobals();
         }
         $this->webhookAuthenticator->authenticate($webhookRequest, $authenticateClientIp);
         $message = Message::fromArray($webhookRequest->toArray());
         call_user_func($this->webhookCallback, $message);
         $webhookResponse = new WebhookResponse();
         return $webhookResponse->getSymfonyResponse();
     } catch (\Exception $e) {
         return WebhookResponse::fromException($e)->getSymfonyResponse();
     }
 }
 public function __construct($pinCode)
 {
     if (!is_string($pinCode)) {
         throw new XsollaWebhookException(sprintf('Pin code should be non-empty string. %s given', is_object($pinCode) ? get_class($pinCode) : gettype($pinCode)));
     }
     if ('' === $pinCode) {
         throw new XsollaWebhookException('Pin code should be non-empty string. Empty string given');
     }
     parent::__construct(200, XsollaClient::jsonEncode(array('pin_code' => $pinCode)));
 }
 /**
  * @param string $pinCode
  */
 public function __construct($pinCode)
 {
     $this->validateStringParameter('Pin code', $pinCode);
     parent::__construct(200, XsollaClient::jsonEncode(array('pin_code' => $pinCode)));
 }
Example #4
0
 /**
  * @param User $user
  */
 public function __construct(User $user)
 {
     $this->validateStringParameter('User id', $user->getId());
     parent::__construct(200, $user->toJson());
 }