Example #1
0
 protected function createRequest($class, array $parameters)
 {
     if (!$this->signator instanceof DataSignator) {
         throw new \Exception('Cannot create request, Signator is not set');
     }
     if ($this->timezone === null) {
         $this->timezone = new \DateTimeZone('UTC');
     }
     $request = parent::createRequest($class, $parameters);
     $request->setSignator($this->signator);
     $request->setTimestamp((new \DateTime(null, $this->timezone))->format('dmYHis'));
     return $request;
 }
Example #2
0
 /**
  * Create Request
  *
  * This overrides the parent createRequest function ensuring that the OAuth
  * 2.0 access token is passed along with the request data -- unless the
  * request is a RestTokenRequest in which case no token is needed.  If no
  * token is available then a new one is created (e.g. if there has been no
  * token request or the current token has expired).
  *
  * @param string $class
  * @param array $parameters
  * @return \Omnipay\PayPal\Message\AbstractRestRequest
  */
 public function createRequest($class, array $parameters = array())
 {
     if (!$this->hasToken() && $class != '\\Omnipay\\PayPal\\Message\\RestTokenRequest') {
         // This will set the internal token parameter which the parent
         // createRequest will find when it calls getParameters().
         $this->getToken(true);
     }
     return parent::createRequest($class, $parameters);
 }
Example #3
0
 public function acceptNotification()
 {
     $this->setToken($this->getAccessToken()->getToken());
     $parameters = ['transactionReference' => $this->httpRequest->query->get('id')];
     $request = parent::createRequest(StatusRequest::class, $parameters);
     /** @var PurchaseResponse $response */
     $response = $request->send();
     $parameters = ['code' => $response->getCode(), 'transactionReference' => $response->getTransactionReference(), 'transactionId' => $response->getTransactionId(), 'data' => $response->getData()];
     return new Notification($this->httpRequest, $this->httpClient, $parameters);
 }
Example #4
0
 protected function createRequest($class, array $parameters)
 {
     if (!$this->signator instanceof DataSignator) {
         throw new \Exception('Cannot create request, Signator is not set');
     }
     if (!$this->verifier instanceof DataVerifier) {
         throw new \Exception('Cannot create request, Verifier is not set');
     }
     /** @var \Omnipay\Csob\Message\AbstractRequest $request */
     $request = parent::createRequest($class, $parameters);
     $request->setSignator($this->signator);
     $request->setVerifier($this->verifier);
     $apiUrl = $this->getApiUrl();
     $request->setApiUrl($apiUrl);
     return $request;
 }