Ejegg has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/398906 )
Change subject: Update Amazon SDK for logging ...................................................................... Update Amazon SDK for logging Change-Id: I70bc7c763aa19c3bc47ba54d9710756ad0ad61f6 --- M amzn/login-and-pay-with-amazon-sdk-php/PayWithAmazon/BaseClient.php M amzn/login-and-pay-with-amazon-sdk-php/composer.json M composer/autoload_classmap.php M composer/autoload_static.php M composer/installed.json 5 files changed, 70 insertions(+), 45 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface/vendor refs/changes/06/398906/1 diff --git a/amzn/login-and-pay-with-amazon-sdk-php/PayWithAmazon/BaseClient.php b/amzn/login-and-pay-with-amazon-sdk-php/PayWithAmazon/BaseClient.php index 899ae49..5e6eecf 100644 --- a/amzn/login-and-pay-with-amazon-sdk-php/PayWithAmazon/BaseClient.php +++ b/amzn/login-and-pay-with-amazon-sdk-php/PayWithAmazon/BaseClient.php @@ -1,5 +1,7 @@ <?php namespace PayWithAmazon; +use Psr\Log\LoggerInterface; +use Psr\Log\NullLogger; /* Class BaseClient * Takes configuration information @@ -18,6 +20,11 @@ // Override in concrete classes with API's service version protected $serviceVersion; + + /** + * @var LoggerInterface + */ + protected $logger; // Construct User agent string based off of the application_name, application_version, PHP platform protected $userAgent = null; @@ -39,7 +46,8 @@ 'proxy_username' => null, 'proxy_password' => null, 'client_id' => null, - 'handle_throttle' => true + 'handle_throttle' => true, + 'logger' => null ); protected $modePath = null; @@ -81,6 +89,17 @@ $this->checkConfigKeys($configArray); } else { throw new \Exception('$config is of the incorrect type ' . gettype($configArray) . ' and should be of the type array'); + } + if (empty($configArray['logger'])) { + $this->logger = new NullLogger(); + } else { + if ($configArray['logger'] instanceof LoggerInterface) { + $this->logger = $configArray['logger']; + } else { + throw new \InvalidArgumentException( + 'Logger passed in config must implement Psr\Log\LoggerInterface' + ); + } } } else { throw new \Exception('$config cannot be null.'); @@ -560,6 +579,7 @@ $this->pauseOnRetry(++$retries, $statusCode); } } else { + $this->logger->info("Returned status code $statusCode, not retrying."); $shouldRetry = false; } } catch (\Exception $e) { @@ -582,6 +602,7 @@ { if ($retries <= self::MAX_ERROR_RETRY) { $delay = (int) (pow(4, $retries) * $this->basePause); + $this->logger->info("Returned status code $status on try $retries, waiting $delay microseconds."); usleep($delay); } else { throw new \Exception('Error Code: '. $status.PHP_EOL.'Maximum number of retry attempts - '. $retries .' reached'); diff --git a/amzn/login-and-pay-with-amazon-sdk-php/composer.json b/amzn/login-and-pay-with-amazon-sdk-php/composer.json index a34204b..3aecf61 100644 --- a/amzn/login-and-pay-with-amazon-sdk-php/composer.json +++ b/amzn/login-and-pay-with-amazon-sdk-php/composer.json @@ -25,6 +25,7 @@ }, "require": { "ext-curl": "*", - "php": ">=5.3.0" + "php": ">=5.3.0", + "psr/log": "^1.0" } } diff --git a/composer/autoload_classmap.php b/composer/autoload_classmap.php index 42bf3e5..354c9be 100644 --- a/composer/autoload_classmap.php +++ b/composer/autoload_classmap.php @@ -33,13 +33,13 @@ 'BlankAddressFields' => $baseDir . '/adyen_gateway/BlankAddressFields.php', 'CallbackFilterIterator' => $vendorDir . '/symfony/polyfill-php54/Resources/stubs/CallbackFilterIterator.php', 'CleanupRecurringLength' => $baseDir . '/paypal_gateway/CleanupRecurringLength.php', + 'ClientErrorApi' => $baseDir . '/gateway_common/clientError.api.php', 'ClientSideValidationHelper' => $baseDir . '/gateway_common/ClientSideValidationHelper.php', 'Clio\\Console' => $vendorDir . '/clio/clio/src/Clio/Console.php', 'Clio\\Daemon' => $vendorDir . '/clio/clio/src/Clio/Daemon.php', 'Composer\\CaBundle\\CaBundle' => $vendorDir . '/composer/ca-bundle/src/CaBundle.php', 'ConfigurationReader' => $baseDir . '/gateway_common/ConfigurationReader.php', 'ContributionTrackingPlusUnique' => $baseDir . '/gateway_common/ContributionTrackingPlusUnique.php', - 'CountryCodes' => $baseDir . '/gateway_forms/includes/CountryCodes.php', 'CountryValidation' => $baseDir . '/gateway_common/CountryValidation.php', 'DataValidator' => $baseDir . '/gateway_common/DataValidator.php', 'DonationApi' => $baseDir . '/gateway_common/donation.api.php', @@ -338,6 +338,7 @@ 'PHPQueue\\Runner' => $vendorDir . '/coderkungfu/php-queue/src/PHPQueue/Runner.php', 'PHPQueue\\Worker' => $vendorDir . '/coderkungfu/php-queue/src/PHPQueue/Worker.php', 'POP3' => $vendorDir . '/phpmailer/phpmailer/class.pop3.php', + 'PayPalCountry' => $baseDir . '/paypal_gateway/PayPalCountry.php', 'PayWithAmazon\\BaseClient' => $vendorDir . '/amzn/login-and-pay-with-amazon-sdk-php/PayWithAmazon/BaseClient.php', 'PayWithAmazon\\HttpCurl' => $vendorDir . '/amzn/login-and-pay-with-amazon-sdk-php/PayWithAmazon/HttpCurl.php', 'PayWithAmazon\\HttpCurlInterface' => $vendorDir . '/amzn/login-and-pay-with-amazon-sdk-php/PayWithAmazon/HttpCurlInterface.php', diff --git a/composer/autoload_static.php b/composer/autoload_static.php index cb56818..3e4af0a 100644 --- a/composer/autoload_static.php +++ b/composer/autoload_static.php @@ -198,13 +198,13 @@ 'BlankAddressFields' => __DIR__ . '/../..' . '/adyen_gateway/BlankAddressFields.php', 'CallbackFilterIterator' => __DIR__ . '/..' . '/symfony/polyfill-php54/Resources/stubs/CallbackFilterIterator.php', 'CleanupRecurringLength' => __DIR__ . '/../..' . '/paypal_gateway/CleanupRecurringLength.php', + 'ClientErrorApi' => __DIR__ . '/../..' . '/gateway_common/clientError.api.php', 'ClientSideValidationHelper' => __DIR__ . '/../..' . '/gateway_common/ClientSideValidationHelper.php', 'Clio\\Console' => __DIR__ . '/..' . '/clio/clio/src/Clio/Console.php', 'Clio\\Daemon' => __DIR__ . '/..' . '/clio/clio/src/Clio/Daemon.php', 'Composer\\CaBundle\\CaBundle' => __DIR__ . '/..' . '/composer/ca-bundle/src/CaBundle.php', 'ConfigurationReader' => __DIR__ . '/../..' . '/gateway_common/ConfigurationReader.php', 'ContributionTrackingPlusUnique' => __DIR__ . '/../..' . '/gateway_common/ContributionTrackingPlusUnique.php', - 'CountryCodes' => __DIR__ . '/../..' . '/gateway_forms/includes/CountryCodes.php', 'CountryValidation' => __DIR__ . '/../..' . '/gateway_common/CountryValidation.php', 'DataValidator' => __DIR__ . '/../..' . '/gateway_common/DataValidator.php', 'DonationApi' => __DIR__ . '/../..' . '/gateway_common/donation.api.php', @@ -503,6 +503,7 @@ 'PHPQueue\\Runner' => __DIR__ . '/..' . '/coderkungfu/php-queue/src/PHPQueue/Runner.php', 'PHPQueue\\Worker' => __DIR__ . '/..' . '/coderkungfu/php-queue/src/PHPQueue/Worker.php', 'POP3' => __DIR__ . '/..' . '/phpmailer/phpmailer/class.pop3.php', + 'PayPalCountry' => __DIR__ . '/../..' . '/paypal_gateway/PayPalCountry.php', 'PayWithAmazon\\BaseClient' => __DIR__ . '/..' . '/amzn/login-and-pay-with-amazon-sdk-php/PayWithAmazon/BaseClient.php', 'PayWithAmazon\\HttpCurl' => __DIR__ . '/..' . '/amzn/login-and-pay-with-amazon-sdk-php/PayWithAmazon/HttpCurl.php', 'PayWithAmazon\\HttpCurlInterface' => __DIR__ . '/..' . '/amzn/login-and-pay-with-amazon-sdk-php/PayWithAmazon/HttpCurlInterface.php', diff --git a/composer/installed.json b/composer/installed.json index 81585ce..24ef163 100644 --- a/composer/installed.json +++ b/composer/installed.json @@ -43,47 +43,6 @@ ] }, { - "name": "amzn/login-and-pay-with-amazon-sdk-php", - "version": "dev-master", - "version_normalized": "9999999-dev", - "source": { - "type": "git", - "url": "https://github.com/ejegg/login-and-pay-with-amazon-sdk-php", - "reference": "855d642f85f14c76ca810013b0323ae4ac37f1c6" - }, - "require": { - "ext-curl": "*", - "php": ">=5.3.0" - }, - "time": "2016-02-17T00:53:20+00:00", - "type": "library", - "installation-source": "source", - "autoload": { - "psr-4": { - "PayWithAmazon\\": "PayWithAmazon/" - } - }, - "license": [ - "Apache OSL-2" - ], - "authors": [ - { - "name": "Amazon Payments", - "email": "eps-...@amazon.com" - } - ], - "description": "Pay with Amazon SDK", - "homepage": "https://github.com/amzn/login-and-pay-with-amazon-sdk-php", - "keywords": [ - "amazon", - "amazon payments", - "pay", - "pay with amazon", - "payment", - "payments" - ] - }, - { "name": "predis/predis", "version": "v1.1.1", "version_normalized": "1.1.1.0", @@ -1434,5 +1393,47 @@ "maxmind", "minfraud" ] + }, + { + "name": "amzn/login-and-pay-with-amazon-sdk-php", + "version": "dev-master", + "version_normalized": "9999999-dev", + "source": { + "type": "git", + "url": "https://github.com/ejegg/login-and-pay-with-amazon-sdk-php", + "reference": "198cc8ccab51e270909602cee38706b4d1f6bbba" + }, + "require": { + "ext-curl": "*", + "php": ">=5.3.0", + "psr/log": "^1.0" + }, + "time": "2017-12-15T15:03:21+00:00", + "type": "library", + "installation-source": "source", + "autoload": { + "psr-4": { + "PayWithAmazon\\": "PayWithAmazon/" + } + }, + "license": [ + "Apache OSL-2" + ], + "authors": [ + { + "name": "Amazon Payments", + "email": "eps-...@amazon.com" + } + ], + "description": "Pay with Amazon SDK", + "homepage": "https://github.com/amzn/login-and-pay-with-amazon-sdk-php", + "keywords": [ + "amazon", + "amazon payments", + "pay", + "pay with amazon", + "payment", + "payments" + ] } ] -- To view, visit https://gerrit.wikimedia.org/r/398906 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I70bc7c763aa19c3bc47ba54d9710756ad0ad61f6 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/DonationInterface/vendor Gerrit-Branch: master Gerrit-Owner: Ejegg <ej...@ejegg.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits