Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
PavelJurasek committed Feb 9, 2022
1 parent 209d8da commit 005452c
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
18 changes: 10 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@
"issues": "https://github.com/MetisFW/PayPal/issues"
},
"require": {
"php": ">=5.6.0",
"nette/di": "^2.4",
"nette/application": "^2.4",
"paypal/rest-api-sdk-php": "^1.5"
"php": "^7.1",
"ext-curl": "*",
"ext-json": "*",
"nette/di": "^3.0",
"nette/application": "3.0",
"paypal/rest-api-sdk-php": "^1.14"
},
"require-dev": {
"nette/bootstrap": "^2.4",
"nette/robot-loader": "^2.4",
"nette/tester": "^2.4",
"mockery/mockery": "^1.4"
"nette/bootstrap": "^3.0",
"tracy/tracy": "^2.6",
"nette/tester": "^2.2",
"mockery/mockery": "^1.2"
},
"autoload": {
"psr-0": {
Expand Down
19 changes: 10 additions & 9 deletions src/MetisFW/PayPal/DI/PayPalExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Nette\Configurator;
use Nette\DI\Compiler;
use Nette\DI\CompilerExtension;
use Nette\DI\Config\Helpers;
use Nette\Utils\Validators;

class PayPalExtension extends CompilerExtension {
Expand All @@ -19,26 +20,29 @@ class PayPalExtension extends CompilerExtension {

public function loadConfiguration() {
$builder = $this->getContainerBuilder();
$config = $this->getConfig($this->defaults);
$config = Helpers::merge($this->getConfig(), $this->defaults);

Validators::assertField($config, 'clientId');
Validators::assertField($config, 'secret');
Validators::assertField($config, 'sdkConfig', 'array');

$builder->addDefinition($this->prefix('simplePaymentOperationFactory'))
$builder->addFactoryDefinition($this->prefix('simplePaymentOperationFactory'))
->setImplement('MetisFW\PayPal\Payment\SimplePaymentOperationFactory');

$builder->addDefinition($this->prefix('plainPaymentOperationFactory'))
$builder->addFactoryDefinition($this->prefix('plainPaymentOperationFactory'))
->setImplement('MetisFW\PayPal\Payment\PlainPaymentOperationFactory');

$builder->addDefinition($this->prefix('credentials'))
->setClass('PayPal\Auth\OAuthTokenCredential', array($config['clientId'], $config['secret']));
->setType('PayPal\Auth\OAuthTokenCredential')
->setArguments(array($config['clientId'], $config['secret']));

$builder->addDefinition($this->prefix('apiContext'))
->setClass('PayPal\Rest\ApiContext', array($this->prefix('@credentials')));
->setType('PayPal\Rest\ApiContext')
->setArguments(array($this->prefix('@credentials')));

$paypal = $builder->addDefinition($this->prefix('PayPal'))
->setClass('MetisFW\PayPal\PayPalContext', array($this->prefix('@apiContext')))
->setType('MetisFW\PayPal\PayPalContext')
->setArguments(array($this->prefix('@apiContext')))
->addSetup('setConfig', array($config['sdkConfig']))
->addSetup('setCurrency', array($config['currency']))
->addSetup('setGaTrackingEnabled', array($config['gaTrackingEnabled']));
Expand All @@ -48,9 +52,6 @@ public function loadConfiguration() {
}
}

/**
* @param Configurator $configurator
*/
public static function register(Configurator $configurator) {
$configurator->onCompile[] = function ($config, Compiler $compiler) {
$compiler->addExtension('payPal', new PayPalExtension());
Expand Down
3 changes: 0 additions & 3 deletions src/MetisFW/PayPal/Helpers/GaTracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
namespace MetisFW\PayPal\Helpers;

use Nette\Http\Url;
use Nette\SmartObject;
use PayPal\Api\Payment;

class GaTracking {

use SmartObject;

private function __construct() {
// nothing
}
Expand Down
3 changes: 0 additions & 3 deletions src/MetisFW/PayPal/PayPalContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@

namespace MetisFW\PayPal;

use Nette\SmartObject;
use PayPal\Rest\ApiContext;

class PayPalContext {

use SmartObject;

/** @var ApiContext */
private $apiContext;

Expand Down
4 changes: 4 additions & 0 deletions src/MetisFW/PayPal/Payment/BasePaymentOperation.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
use PayPal\Exception\PayPalInvalidCredentialException;
use PayPal\Exception\PayPalMissingCredentialException;

/**
* @method void onCancel(self $self)
* @method void onReturn(self $self, Payment $payment)
*/
abstract class BasePaymentOperation implements PaymentOperation {

use SmartObject;
Expand Down
1 change: 0 additions & 1 deletion src/MetisFW/PayPal/UI/PaymentControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class PaymentControl extends Control {
* @param PaymentOperation $operation
*/
public function __construct(PaymentOperation $operation) {
parent::__construct();
$this->operation = $operation;
}

Expand Down

0 comments on commit 005452c

Please sign in to comment.