예제 #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));
 }