public function testFetchCheckout()
 {
     $options = array('token' => 'abc123');
     $request = $this->gateway->fetchCheckout($options);
     $this->assertInstanceOf('\\Omnipay\\PayPal\\Message\\ExpressFetchCheckoutRequest', $request);
     $this->assertSame('abc123', $request->getToken());
 }
 public function testCompletePurchaseCustomOptions()
 {
     $this->setMockHttpResponse('ExpressPurchaseSuccess.txt');
     // Those values should not be used if custom token or payerid are passed
     $this->getHttpRequest()->query->replace(array('token' => 'GET_TOKEN', 'PayerID' => 'GET_PAYERID'));
     $response = $this->gateway->completePurchase(array('amount' => '10.00', 'currency' => 'BYR', 'token' => 'CUSTOM_TOKEN', 'payerid' => 'CUSTOM_PAYERID'))->send();
     $httpRequests = $this->getMockedRequests();
     $httpRequest = $httpRequests[0];
     $queryArguments = $httpRequest->getQuery()->toArray();
     $this->assertSame('CUSTOM_TOKEN', $queryArguments['TOKEN']);
     $this->assertSame('CUSTOM_PAYERID', $queryArguments['PAYERID']);
 }
 public function testTransactionSearch()
 {
     $transactionSearch = $this->gateway->transactionSearch(array('startDate' => '2015-01-01', 'endDate' => '2015-12-31'));
     $this->assertInstanceOf('\\Omnipay\\PayPal\\Message\\ExpressTransactionSearchRequest', $transactionSearch);
     $this->assertInstanceOf('\\DateTime', $transactionSearch->getStartDate());
     $this->assertInstanceOf('\\DateTime', $transactionSearch->getEndDate());
 }
 /**
  * Handle the command.
  *
  * @param ConfigurationRepositoryInterface $configuration
  */
 public function handle(ConfigurationRepositoryInterface $configuration)
 {
     /* @var EncryptedFieldTypePresenter $username */
     /* @var EncryptedFieldTypePresenter $password */
     /* @var EncryptedFieldTypePresenter $signature */
     /* @var ConfigurationInterface $mode */
     $username = $configuration->presenter('anomaly.extension.paypal_express_gateway::username', $this->gateway->getSlug());
     $password = $configuration->presenter('anomaly.extension.paypal_express_gateway::password', $this->gateway->getSlug());
     $signature = $configuration->presenter('anomaly.extension.paypal_express_gateway::signature', $this->gateway->getSlug());
     $mode = $configuration->get('anomaly.extension.paypal_express_gateway::test_mode', $this->gateway->getSlug());
     $gateway = new ExpressGateway();
     $gateway->setUsername($username->decrypted());
     $gateway->setPassword($password->decrypted());
     $gateway->setSignature($signature->decrypted());
     $gateway->setTestMode($mode->getValue());
     return $gateway;
 }