Example #1
0
 /**
  * @test
  */
 public function shouldAllowGetPreviouslySetToken()
 {
     $token = $this->getMock(TokenInterface::class);
     $request = new GetToken('aHash');
     $request->setToken($token);
     $this->assertSame($token, $request->getToken());
 }
 /**
  * {@inheritDoc}
  *
  * @param Notify $request
  */
 public function execute($request)
 {
     RequestNotSupportedException::assertSupports($this, $request);
     $this->gateway->execute($httpRequest = new GetHttpRequest());
     if (!isset($httpRequest->request['label']) || empty($httpRequest->request['label'])) {
         throw new HttpResponse('The notification is invalid. [1]', 400, array('x-reason-code' => 1));
     }
     $this->gateway->execute($getToken = new GetToken($httpRequest->request['label']));
     $this->gateway->execute(new Notify($getToken->getToken()));
 }
Example #3
0
 /**
  * {@inheritDoc}
  *
  * @param $request Notify
  */
 public function execute($request)
 {
     RequestNotSupportedException::assertSupports($this, $request);
     $this->gateway->execute($httpRequest = new GetHttpRequest());
     //we are back from be2bill site so we have to just update model.
     if (empty($httpRequest->query['EXTRADATA'])) {
         throw new HttpResponse('The notification is invalid. Code Be2Bell1', 400);
     }
     $extraDataJson = $httpRequest->query['EXTRADATA'];
     if (false == ($extraData = json_decode($extraDataJson, true))) {
         throw new HttpResponse('The notification is invalid. Code Be2Bell2', 400);
     }
     if (empty($extraData['notify_token'])) {
         throw new HttpResponse('The notification is invalid. Code Be2Bell3', 400);
     }
     $this->gateway->execute($getToken = new GetToken($extraData['notify_token']));
     $this->gateway->execute(new Notify($getToken->getToken()));
 }
 /**
  * {@inheritDoc}
  *
  * @param Capture $request
  */
 public function execute($request)
 {
     RequestNotSupportedException::assertSupports($this, $request);
     $this->gateway->execute($httpRequest = new GetHttpRequest());
     //we are back from be2bill site so we have to just update model.
     if (empty($httpRequest->query['EXTRADATA'])) {
         throw new HttpResponse('The capture is invalid. Code Be2Bell1', 400);
     }
     $extraDataJson = $httpRequest->query['EXTRADATA'];
     if (false == ($extraData = json_decode($extraDataJson, true))) {
         throw new HttpResponse('The capture is invalid. Code Be2Bell2', 400);
     }
     if (empty($extraData['capture_token'])) {
         throw new HttpResponse('The capture is invalid. Code Be2Bell3', 400);
     }
     $this->gateway->execute($getToken = new GetToken($extraData['capture_token']));
     $uri = HttpUri::createFromString($getToken->getToken()->getTargetUrl());
     $uri = $uri->withQuery((string) Query::createFromArray($httpRequest->query));
     throw new HttpRedirect((string) $uri);
 }