Пример #1
0
 /**
  * @param Event $event
  *
  * @throws PagSeguroException
  */
 public function handleError(Event $event)
 {
     if (!Environment::isValid($event->getRequest()->getHost())) {
         return;
     }
     throw PagSeguroException::create($event->getResponse());
 }
Пример #2
0
 /**
  * @test
  */
 public function getUrlShouldAppendProtocolAndHostToResource()
 {
     $this->assertEquals('https://test.com/test', $this->environment->getUrl('/test'));
 }
Пример #3
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     $this->environment = $this->getMockForAbstractClass(Environment::class);
     $this->environment->expects($this->any())->method('getHost')->willReturn('test.com');
     $this->environment->expects($this->any())->method('getWsHost')->willReturn('ws.test.com');
 }
Пример #4
0
 /**
  * @param string $resource
  * @param array $params
  *
  * @return string
  */
 public function getWsUrl($resource, array $params = [])
 {
     $params = array_merge($params, ['email' => $this->email, 'token' => $this->token]);
     return sprintf('%s?%s', $this->environment->getWsUrl($resource), http_build_query($params));
 }