diff --git a/objects/composer/InstalledVersions.php b/objects/composer/InstalledVersions.php index cf0eb76a5..019fd68f9 100644 --- a/objects/composer/InstalledVersions.php +++ b/objects/composer/InstalledVersions.php @@ -1,639 +1,639 @@ array ( 'pretty_version' => 'dev-master', 'version' => 'dev-master', 'aliases' => array ( ), - 'reference' => 'ebebf747cdd294714e6f90770d94e29f7b701a10', + 'reference' => '06273135e8d043e51bd44af1ec88b3a14638941f', 'name' => 'wwbn/avideo', ), 'versions' => array ( 'cboden/ratchet' => array ( 'pretty_version' => 'v0.4.3', 'version' => '0.4.3.0', 'aliases' => array ( ), 'reference' => '466a0ecc83209c75b76645eb823401b5c52e5f21', ), 'chrisjean/php-ico' => array ( 'pretty_version' => '1.0.4', 'version' => '1.0.4.0', 'aliases' => array ( ), 'reference' => 'ccd5c0d56554f3ddcd7a823e695be83e0d1e43b6', ), 'evenement/evenement' => array ( 'pretty_version' => 'v2.1.0', 'version' => '2.1.0.0', 'aliases' => array ( ), 'reference' => '6ba9a777870ab49f417e703229d53931ed40fd7a', ), 'ezyang/htmlpurifier' => array ( 'pretty_version' => 'v4.13.0', 'version' => '4.13.0.0', 'aliases' => array ( ), 'reference' => '08e27c97e4c6ed02f37c5b2b20488046c8d90d75', ), 'firebase/php-jwt' => array ( 'pretty_version' => 'v5.2.1', 'version' => '5.2.1.0', 'aliases' => array ( ), 'reference' => 'f42c9110abe98dd6cfe9053c49bc86acc70b2d23', ), 'google/apiclient' => array ( 'pretty_version' => 'v2.9.1', 'version' => '2.9.1.0', 'aliases' => array ( ), 'reference' => '2fb6e702aca5d68203fa737f89f6f774022494c6', ), 'google/apiclient-services' => array ( 'pretty_version' => 'v0.156', 'version' => '0.156.0.0', 'aliases' => array ( ), 'reference' => '2f5e54fdef034f856208328126bddd8376dae4b3', ), 'google/auth' => array ( 'pretty_version' => 'v1.15.1', 'version' => '1.15.1.0', 'aliases' => array ( ), 'reference' => '4e0c9367719df9703e96f5ad613041b87742471c', ), 'guzzlehttp/guzzle' => array ( 'pretty_version' => '6.5.5', 'version' => '6.5.5.0', 'aliases' => array ( ), 'reference' => '9d4290de1cfd701f38099ef7e183b64b4b7b0c5e', ), 'guzzlehttp/promises' => array ( 'pretty_version' => '1.4.1', 'version' => '1.4.1.0', 'aliases' => array ( ), 'reference' => '8e7d04f1f6450fef59366c399cfad4b9383aa30d', ), 'guzzlehttp/psr7' => array ( 'pretty_version' => '1.8.2', 'version' => '1.8.2.0', 'aliases' => array ( ), 'reference' => 'dc960a912984efb74d0a90222870c72c87f10c91', ), 'hybridauth/hybridauth' => array ( 'pretty_version' => '3.7.1', 'version' => '3.7.1.0', 'aliases' => array ( ), 'reference' => '0ec1b8cb8b230aae739422c5e42bc5733b3a7316', ), 'james-heinrich/getid3' => array ( 'pretty_version' => 'v1.9.20', 'version' => '1.9.20.0', 'aliases' => array ( ), 'reference' => '3c15e353b9bb1252201c73394bb8390b573a751d', ), 'monolog/monolog' => array ( 'pretty_version' => '1.26.0', 'version' => '1.26.0.0', 'aliases' => array ( ), 'reference' => '2209ddd84e7ef1256b7af205d0717fb62cfc9c33', ), 'paragonie/random_compat' => array ( 'pretty_version' => 'v2.0.20', 'version' => '2.0.20.0', 'aliases' => array ( ), 'reference' => '0f1f60250fccffeaf5dda91eea1c018aed1adc2a', ), 'phpmailer/phpmailer' => array ( 'pretty_version' => 'v6.4.1', 'version' => '6.4.1.0', 'aliases' => array ( ), 'reference' => '9256f12d8fb0cd0500f93b19e18c356906cbed3d', ), 'phpseclib/phpseclib' => array ( 'pretty_version' => '2.0.31', 'version' => '2.0.31.0', 'aliases' => array ( ), 'reference' => '233a920cb38636a43b18d428f9a8db1f0a1a08f4', ), 'psr/cache' => array ( 'pretty_version' => '1.0.1', 'version' => '1.0.1.0', 'aliases' => array ( ), 'reference' => 'd11b50ad223250cf17b86e38383413f5a6764bf8', ), 'psr/http-message' => array ( 'pretty_version' => '1.0.1', 'version' => '1.0.1.0', 'aliases' => array ( ), 'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363', ), 'psr/http-message-implementation' => array ( 'provided' => array ( 0 => '1.0', ), ), 'psr/log' => array ( 'pretty_version' => '1.1.3', 'version' => '1.1.3.0', 'aliases' => array ( ), 'reference' => '0f73288fd15629204f9d42b7055f72dacbe811fc', ), 'psr/log-implementation' => array ( 'provided' => array ( 0 => '1.0.0', ), ), 'ralouphie/getallheaders' => array ( 'pretty_version' => '3.0.3', 'version' => '3.0.3.0', 'aliases' => array ( ), 'reference' => '120b605dfeb996808c31b6477290a714d356e822', ), 'ratchet/pawl' => array ( 'pretty_version' => 'v0.3.5', 'version' => '0.3.5.0', 'aliases' => array ( ), 'reference' => '89ec703c76dc893484a2a0ed44b48a37d445abd5', ), 'ratchet/rfc6455' => array ( 'pretty_version' => 'v0.3', 'version' => '0.3.0.0', 'aliases' => array ( ), 'reference' => 'c8651c7938651c2d55f5d8c2422ac5e57a183341', ), 'react/cache' => array ( 'pretty_version' => 'v1.1.1', 'version' => '1.1.1.0', 'aliases' => array ( ), 'reference' => '4bf736a2cccec7298bdf745db77585966fc2ca7e', ), 'react/dns' => array ( 'pretty_version' => 'v1.5.0', 'version' => '1.5.0.0', 'aliases' => array ( ), 'reference' => 'b22b0b20278e8535e633ab71a52472c5bf620aa1', ), 'react/event-loop' => array ( 'pretty_version' => 'v1.1.1', 'version' => '1.1.1.0', 'aliases' => array ( ), 'reference' => '6d24de090cd59cfc830263cfba965be77b563c13', ), 'react/promise' => array ( 'pretty_version' => 'v2.8.0', 'version' => '2.8.0.0', 'aliases' => array ( ), 'reference' => 'f3cff96a19736714524ca0dd1d4130de73dbbbc4', ), 'react/promise-timer' => array ( 'pretty_version' => 'v1.6.0', 'version' => '1.6.0.0', 'aliases' => array ( ), 'reference' => 'daee9baf6ef30c43ea4c86399f828bb5f558f6e6', ), 'react/socket' => array ( 'pretty_version' => 'v1.6.0', 'version' => '1.6.0.0', 'aliases' => array ( ), 'reference' => 'e2b96b23a13ca9b41ab343268dbce3f8ef4d524a', ), 'react/stream' => array ( 'pretty_version' => 'v1.1.1', 'version' => '1.1.1.0', 'aliases' => array ( ), 'reference' => '7c02b510ee3f582c810aeccd3a197b9c2f52ff1a', ), 'singpolyma/openpgp-php' => array ( 'pretty_version' => '0.4.0', 'version' => '0.4.0.0', 'aliases' => array ( ), 'reference' => '67aba786991e3cb3e555025b6d357779ab32a0ab', ), 'symfony/http-foundation' => array ( 'pretty_version' => 'v3.4.47', 'version' => '3.4.47.0', 'aliases' => array ( ), 'reference' => 'b9885fcce6fe494201da4f70a9309770e9d13dc8', ), 'symfony/polyfill-intl-idn' => array ( 'pretty_version' => 'v1.19.0', 'version' => '1.19.0.0', 'aliases' => array ( ), 'reference' => '4ad5115c0f5d5172a9fe8147675ec6de266d8826', ), 'symfony/polyfill-intl-normalizer' => array ( 'pretty_version' => 'v1.19.0', 'version' => '1.19.0.0', 'aliases' => array ( ), 'reference' => '8db0ae7936b42feb370840cf24de1a144fb0ef27', ), 'symfony/polyfill-mbstring' => array ( 'pretty_version' => 'v1.19.0', 'version' => '1.19.0.0', 'aliases' => array ( ), 'reference' => 'b5f7b932ee6fa802fc792eabd77c4c88084517ce', ), 'symfony/polyfill-php70' => array ( 'pretty_version' => 'v1.19.0', 'version' => '1.19.0.0', 'aliases' => array ( ), 'reference' => '3fe414077251a81a1b15b1c709faf5c2fbae3d4e', ), 'symfony/polyfill-php72' => array ( 'pretty_version' => 'v1.19.0', 'version' => '1.19.0.0', 'aliases' => array ( ), 'reference' => 'beecef6b463b06954638f02378f52496cb84bacc', ), 'symfony/routing' => array ( 'pretty_version' => 'v3.4.47', 'version' => '3.4.47.0', 'aliases' => array ( ), 'reference' => '3e522ac69cadffd8131cc2b22157fa7662331a6c', ), 'wwbn/avideo' => array ( 'pretty_version' => 'dev-master', 'version' => 'dev-master', 'aliases' => array ( ), - 'reference' => 'ebebf747cdd294714e6f90770d94e29f7b701a10', + 'reference' => '06273135e8d043e51bd44af1ec88b3a14638941f', ), ), ); private static $canGetVendors; private static $installedByVendor = array(); public static function getInstalledPackages() { $packages = array(); foreach (self::getInstalled() as $installed) { $packages[] = array_keys($installed['versions']); } if (1 === \count($packages)) { return $packages[0]; } return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); } public static function isInstalled($packageName) { foreach (self::getInstalled() as $installed) { if (isset($installed['versions'][$packageName])) { return true; } } return false; } public static function satisfies(VersionParser $parser, $packageName, $constraint) { $constraint = $parser->parseConstraints($constraint); $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); return $provided->matches($constraint); } public static function getVersionRanges($packageName) { foreach (self::getInstalled() as $installed) { if (!isset($installed['versions'][$packageName])) { continue; } $ranges = array(); if (isset($installed['versions'][$packageName]['pretty_version'])) { $ranges[] = $installed['versions'][$packageName]['pretty_version']; } if (array_key_exists('aliases', $installed['versions'][$packageName])) { $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); } if (array_key_exists('replaced', $installed['versions'][$packageName])) { $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); } if (array_key_exists('provided', $installed['versions'][$packageName])) { $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); } return implode(' || ', $ranges); } throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); } public static function getVersion($packageName) { foreach (self::getInstalled() as $installed) { if (!isset($installed['versions'][$packageName])) { continue; } if (!isset($installed['versions'][$packageName]['version'])) { return null; } return $installed['versions'][$packageName]['version']; } throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); } public static function getPrettyVersion($packageName) { foreach (self::getInstalled() as $installed) { if (!isset($installed['versions'][$packageName])) { continue; } if (!isset($installed['versions'][$packageName]['pretty_version'])) { return null; } return $installed['versions'][$packageName]['pretty_version']; } throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); } public static function getReference($packageName) { foreach (self::getInstalled() as $installed) { if (!isset($installed['versions'][$packageName])) { continue; } if (!isset($installed['versions'][$packageName]['reference'])) { return null; } return $installed['versions'][$packageName]['reference']; } throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); } public static function getRootPackage() { $installed = self::getInstalled(); return $installed[0]['root']; } public static function getRawData() { return self::$installed; } public static function reload($data) { self::$installed = $data; self::$installedByVendor = array(); } private static function getInstalled() { if (null === self::$canGetVendors) { self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); } $installed = array(); if (self::$canGetVendors) { foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { if (isset(self::$installedByVendor[$vendorDir])) { $installed[] = self::$installedByVendor[$vendorDir]; } elseif (is_file($vendorDir.'/composer/installed.php')) { $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; } } } $installed[] = self::$installed; return $installed; } } diff --git a/objects/composer/installed.php b/objects/composer/installed.php index e71c9bd3d..533654e9f 100644 --- a/objects/composer/installed.php +++ b/objects/composer/installed.php @@ -1,380 +1,380 @@ array ( 'pretty_version' => 'dev-master', 'version' => 'dev-master', 'aliases' => array ( ), - 'reference' => 'ebebf747cdd294714e6f90770d94e29f7b701a10', + 'reference' => '06273135e8d043e51bd44af1ec88b3a14638941f', 'name' => 'wwbn/avideo', ), 'versions' => array ( 'cboden/ratchet' => array ( 'pretty_version' => 'v0.4.3', 'version' => '0.4.3.0', 'aliases' => array ( ), 'reference' => '466a0ecc83209c75b76645eb823401b5c52e5f21', ), 'chrisjean/php-ico' => array ( 'pretty_version' => '1.0.4', 'version' => '1.0.4.0', 'aliases' => array ( ), 'reference' => 'ccd5c0d56554f3ddcd7a823e695be83e0d1e43b6', ), 'evenement/evenement' => array ( 'pretty_version' => 'v2.1.0', 'version' => '2.1.0.0', 'aliases' => array ( ), 'reference' => '6ba9a777870ab49f417e703229d53931ed40fd7a', ), 'ezyang/htmlpurifier' => array ( 'pretty_version' => 'v4.13.0', 'version' => '4.13.0.0', 'aliases' => array ( ), 'reference' => '08e27c97e4c6ed02f37c5b2b20488046c8d90d75', ), 'firebase/php-jwt' => array ( 'pretty_version' => 'v5.2.1', 'version' => '5.2.1.0', 'aliases' => array ( ), 'reference' => 'f42c9110abe98dd6cfe9053c49bc86acc70b2d23', ), 'google/apiclient' => array ( 'pretty_version' => 'v2.9.1', 'version' => '2.9.1.0', 'aliases' => array ( ), 'reference' => '2fb6e702aca5d68203fa737f89f6f774022494c6', ), 'google/apiclient-services' => array ( 'pretty_version' => 'v0.156', 'version' => '0.156.0.0', 'aliases' => array ( ), 'reference' => '2f5e54fdef034f856208328126bddd8376dae4b3', ), 'google/auth' => array ( 'pretty_version' => 'v1.15.1', 'version' => '1.15.1.0', 'aliases' => array ( ), 'reference' => '4e0c9367719df9703e96f5ad613041b87742471c', ), 'guzzlehttp/guzzle' => array ( 'pretty_version' => '6.5.5', 'version' => '6.5.5.0', 'aliases' => array ( ), 'reference' => '9d4290de1cfd701f38099ef7e183b64b4b7b0c5e', ), 'guzzlehttp/promises' => array ( 'pretty_version' => '1.4.1', 'version' => '1.4.1.0', 'aliases' => array ( ), 'reference' => '8e7d04f1f6450fef59366c399cfad4b9383aa30d', ), 'guzzlehttp/psr7' => array ( 'pretty_version' => '1.8.2', 'version' => '1.8.2.0', 'aliases' => array ( ), 'reference' => 'dc960a912984efb74d0a90222870c72c87f10c91', ), 'hybridauth/hybridauth' => array ( 'pretty_version' => '3.7.1', 'version' => '3.7.1.0', 'aliases' => array ( ), 'reference' => '0ec1b8cb8b230aae739422c5e42bc5733b3a7316', ), 'james-heinrich/getid3' => array ( 'pretty_version' => 'v1.9.20', 'version' => '1.9.20.0', 'aliases' => array ( ), 'reference' => '3c15e353b9bb1252201c73394bb8390b573a751d', ), 'monolog/monolog' => array ( 'pretty_version' => '1.26.0', 'version' => '1.26.0.0', 'aliases' => array ( ), 'reference' => '2209ddd84e7ef1256b7af205d0717fb62cfc9c33', ), 'paragonie/random_compat' => array ( 'pretty_version' => 'v2.0.20', 'version' => '2.0.20.0', 'aliases' => array ( ), 'reference' => '0f1f60250fccffeaf5dda91eea1c018aed1adc2a', ), 'phpmailer/phpmailer' => array ( 'pretty_version' => 'v6.4.1', 'version' => '6.4.1.0', 'aliases' => array ( ), 'reference' => '9256f12d8fb0cd0500f93b19e18c356906cbed3d', ), 'phpseclib/phpseclib' => array ( 'pretty_version' => '2.0.31', 'version' => '2.0.31.0', 'aliases' => array ( ), 'reference' => '233a920cb38636a43b18d428f9a8db1f0a1a08f4', ), 'psr/cache' => array ( 'pretty_version' => '1.0.1', 'version' => '1.0.1.0', 'aliases' => array ( ), 'reference' => 'd11b50ad223250cf17b86e38383413f5a6764bf8', ), 'psr/http-message' => array ( 'pretty_version' => '1.0.1', 'version' => '1.0.1.0', 'aliases' => array ( ), 'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363', ), 'psr/http-message-implementation' => array ( 'provided' => array ( 0 => '1.0', ), ), 'psr/log' => array ( 'pretty_version' => '1.1.3', 'version' => '1.1.3.0', 'aliases' => array ( ), 'reference' => '0f73288fd15629204f9d42b7055f72dacbe811fc', ), 'psr/log-implementation' => array ( 'provided' => array ( 0 => '1.0.0', ), ), 'ralouphie/getallheaders' => array ( 'pretty_version' => '3.0.3', 'version' => '3.0.3.0', 'aliases' => array ( ), 'reference' => '120b605dfeb996808c31b6477290a714d356e822', ), 'ratchet/pawl' => array ( 'pretty_version' => 'v0.3.5', 'version' => '0.3.5.0', 'aliases' => array ( ), 'reference' => '89ec703c76dc893484a2a0ed44b48a37d445abd5', ), 'ratchet/rfc6455' => array ( 'pretty_version' => 'v0.3', 'version' => '0.3.0.0', 'aliases' => array ( ), 'reference' => 'c8651c7938651c2d55f5d8c2422ac5e57a183341', ), 'react/cache' => array ( 'pretty_version' => 'v1.1.1', 'version' => '1.1.1.0', 'aliases' => array ( ), 'reference' => '4bf736a2cccec7298bdf745db77585966fc2ca7e', ), 'react/dns' => array ( 'pretty_version' => 'v1.5.0', 'version' => '1.5.0.0', 'aliases' => array ( ), 'reference' => 'b22b0b20278e8535e633ab71a52472c5bf620aa1', ), 'react/event-loop' => array ( 'pretty_version' => 'v1.1.1', 'version' => '1.1.1.0', 'aliases' => array ( ), 'reference' => '6d24de090cd59cfc830263cfba965be77b563c13', ), 'react/promise' => array ( 'pretty_version' => 'v2.8.0', 'version' => '2.8.0.0', 'aliases' => array ( ), 'reference' => 'f3cff96a19736714524ca0dd1d4130de73dbbbc4', ), 'react/promise-timer' => array ( 'pretty_version' => 'v1.6.0', 'version' => '1.6.0.0', 'aliases' => array ( ), 'reference' => 'daee9baf6ef30c43ea4c86399f828bb5f558f6e6', ), 'react/socket' => array ( 'pretty_version' => 'v1.6.0', 'version' => '1.6.0.0', 'aliases' => array ( ), 'reference' => 'e2b96b23a13ca9b41ab343268dbce3f8ef4d524a', ), 'react/stream' => array ( 'pretty_version' => 'v1.1.1', 'version' => '1.1.1.0', 'aliases' => array ( ), 'reference' => '7c02b510ee3f582c810aeccd3a197b9c2f52ff1a', ), 'singpolyma/openpgp-php' => array ( 'pretty_version' => '0.4.0', 'version' => '0.4.0.0', 'aliases' => array ( ), 'reference' => '67aba786991e3cb3e555025b6d357779ab32a0ab', ), 'symfony/http-foundation' => array ( 'pretty_version' => 'v3.4.47', 'version' => '3.4.47.0', 'aliases' => array ( ), 'reference' => 'b9885fcce6fe494201da4f70a9309770e9d13dc8', ), 'symfony/polyfill-intl-idn' => array ( 'pretty_version' => 'v1.19.0', 'version' => '1.19.0.0', 'aliases' => array ( ), 'reference' => '4ad5115c0f5d5172a9fe8147675ec6de266d8826', ), 'symfony/polyfill-intl-normalizer' => array ( 'pretty_version' => 'v1.19.0', 'version' => '1.19.0.0', 'aliases' => array ( ), 'reference' => '8db0ae7936b42feb370840cf24de1a144fb0ef27', ), 'symfony/polyfill-mbstring' => array ( 'pretty_version' => 'v1.19.0', 'version' => '1.19.0.0', 'aliases' => array ( ), 'reference' => 'b5f7b932ee6fa802fc792eabd77c4c88084517ce', ), 'symfony/polyfill-php70' => array ( 'pretty_version' => 'v1.19.0', 'version' => '1.19.0.0', 'aliases' => array ( ), 'reference' => '3fe414077251a81a1b15b1c709faf5c2fbae3d4e', ), 'symfony/polyfill-php72' => array ( 'pretty_version' => 'v1.19.0', 'version' => '1.19.0.0', 'aliases' => array ( ), 'reference' => 'beecef6b463b06954638f02378f52496cb84bacc', ), 'symfony/routing' => array ( 'pretty_version' => 'v3.4.47', 'version' => '3.4.47.0', 'aliases' => array ( ), 'reference' => '3e522ac69cadffd8131cc2b22157fa7662331a6c', ), 'wwbn/avideo' => array ( 'pretty_version' => 'dev-master', 'version' => 'dev-master', 'aliases' => array ( ), - 'reference' => 'ebebf747cdd294714e6f90770d94e29f7b701a10', + 'reference' => '06273135e8d043e51bd44af1ec88b3a14638941f', ), ), ); diff --git a/plugin/PayPalYPT/composer.lock b/plugin/PayPalYPT/composer.lock index bcfab72c3..50db2d1b3 100644 --- a/plugin/PayPalYPT/composer.lock +++ b/plugin/PayPalYPT/composer.lock @@ -1,114 +1,123 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], "content-hash": "c44053762671f5e67f14e0d2c9f01b33", "packages": [ { "name": "paypal/rest-api-sdk-php", - "version": "1.13.0", + "version": "1.14.0", "source": { "type": "git", "url": "https://github.com/paypal/PayPal-PHP-SDK.git", - "reference": "192e217beed14c8e75624e821fdc8ec51e2a21f5" + "reference": "72e2f2466975bf128a31e02b15110180f059fc04" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paypal/PayPal-PHP-SDK/zipball/192e217beed14c8e75624e821fdc8ec51e2a21f5", - "reference": "192e217beed14c8e75624e821fdc8ec51e2a21f5", + "url": "https://api.github.com/repos/paypal/PayPal-PHP-SDK/zipball/72e2f2466975bf128a31e02b15110180f059fc04", + "reference": "72e2f2466975bf128a31e02b15110180f059fc04", "shasum": "" }, "require": { "ext-curl": "*", "ext-json": "*", "php": ">=5.3.0", "psr/log": "^1.0.0" }, "require-dev": { "phpunit/phpunit": "^4.8.35" }, "type": "library", "autoload": { "psr-0": { "PayPal": "lib/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "Apache-2.0" ], "authors": [ { "name": "PayPal", "homepage": "https://github.com/paypal/rest-api-sdk-php/contributors" } ], "description": "PayPal's PHP SDK for REST APIs", "homepage": "http://paypal.github.io/PayPal-PHP-SDK/", "keywords": [ "payments", "paypal", "rest", "sdk" ], - "time": "2017-11-13T19:21:59+00:00" + "support": { + "issues": "https://github.com/paypal/PayPal-PHP-SDK/issues", + "source": "https://github.com/paypal/PayPal-PHP-SDK/tree/master" + }, + "abandoned": true, + "time": "2019-01-04T20:04:25+00:00" }, { "name": "psr/log", - "version": "1.0.2", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", "shasum": "" }, "require": { "php": ">=5.3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { "psr-4": { "Psr\\Log\\": "Psr/Log/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "PHP-FIG", "homepage": "http://www.php-fig.org/" } ], "description": "Common interface for logging libraries", "homepage": "https://github.com/php-fig/log", "keywords": [ "log", "psr", "psr-3" ], - "time": "2016-10-10T12:19:37+00:00" + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.3" + }, + "time": "2020-03-23T09:12:05+00:00" } ], "packages-dev": [], "aliases": [], "minimum-stability": "stable", "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": [], - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "2.0.0" } diff --git a/plugin/PayPalYPT/vendor/composer/ClassLoader.php b/plugin/PayPalYPT/vendor/composer/ClassLoader.php index 2c72175e7..247294d66 100644 --- a/plugin/PayPalYPT/vendor/composer/ClassLoader.php +++ b/plugin/PayPalYPT/vendor/composer/ClassLoader.php @@ -1,445 +1,479 @@ * Jordi Boggiano * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Composer\Autoload; /** * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. * * $loader = new \Composer\Autoload\ClassLoader(); * * // register classes with namespaces * $loader->add('Symfony\Component', __DIR__.'/component'); * $loader->add('Symfony', __DIR__.'/framework'); * * // activate the autoloader * $loader->register(); * * // to enable searching the include path (eg. for PEAR packages) * $loader->setUseIncludePath(true); * * In this example, if you try to use a class in the Symfony\Component * namespace or one of its children (Symfony\Component\Console for instance), * the autoloader will first look for the class under the component/ * directory, and it will then fallback to the framework/ directory if not * found before giving up. * * This class is loosely based on the Symfony UniversalClassLoader. * * @author Fabien Potencier * @author Jordi Boggiano - * @see http://www.php-fig.org/psr/psr-0/ - * @see http://www.php-fig.org/psr/psr-4/ + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ */ class ClassLoader { + private $vendorDir; + // PSR-4 private $prefixLengthsPsr4 = array(); private $prefixDirsPsr4 = array(); private $fallbackDirsPsr4 = array(); // PSR-0 private $prefixesPsr0 = array(); private $fallbackDirsPsr0 = array(); private $useIncludePath = false; private $classMap = array(); private $classMapAuthoritative = false; private $missingClasses = array(); private $apcuPrefix; + private static $registeredLoaders = array(); + + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + } + public function getPrefixes() { if (!empty($this->prefixesPsr0)) { - return call_user_func_array('array_merge', $this->prefixesPsr0); + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); } return array(); } public function getPrefixesPsr4() { return $this->prefixDirsPsr4; } public function getFallbackDirs() { return $this->fallbackDirsPsr0; } public function getFallbackDirsPsr4() { return $this->fallbackDirsPsr4; } public function getClassMap() { return $this->classMap; } /** * @param array $classMap Class to filename map */ public function addClassMap(array $classMap) { if ($this->classMap) { $this->classMap = array_merge($this->classMap, $classMap); } else { $this->classMap = $classMap; } } /** * Registers a set of PSR-0 directories for a given prefix, either * appending or prepending to the ones previously set for this prefix. * * @param string $prefix The prefix * @param array|string $paths The PSR-0 root directories * @param bool $prepend Whether to prepend the directories */ public function add($prefix, $paths, $prepend = false) { if (!$prefix) { if ($prepend) { $this->fallbackDirsPsr0 = array_merge( (array) $paths, $this->fallbackDirsPsr0 ); } else { $this->fallbackDirsPsr0 = array_merge( $this->fallbackDirsPsr0, (array) $paths ); } return; } $first = $prefix[0]; if (!isset($this->prefixesPsr0[$first][$prefix])) { $this->prefixesPsr0[$first][$prefix] = (array) $paths; return; } if ($prepend) { $this->prefixesPsr0[$first][$prefix] = array_merge( (array) $paths, $this->prefixesPsr0[$first][$prefix] ); } else { $this->prefixesPsr0[$first][$prefix] = array_merge( $this->prefixesPsr0[$first][$prefix], (array) $paths ); } } /** * Registers a set of PSR-4 directories for a given namespace, either * appending or prepending to the ones previously set for this namespace. * * @param string $prefix The prefix/namespace, with trailing '\\' * @param array|string $paths The PSR-4 base directories * @param bool $prepend Whether to prepend the directories * * @throws \InvalidArgumentException */ public function addPsr4($prefix, $paths, $prepend = false) { if (!$prefix) { // Register directories for the root namespace. if ($prepend) { $this->fallbackDirsPsr4 = array_merge( (array) $paths, $this->fallbackDirsPsr4 ); } else { $this->fallbackDirsPsr4 = array_merge( $this->fallbackDirsPsr4, (array) $paths ); } } elseif (!isset($this->prefixDirsPsr4[$prefix])) { // Register directories for a new namespace. $length = strlen($prefix); if ('\\' !== $prefix[$length - 1]) { throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); } $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; $this->prefixDirsPsr4[$prefix] = (array) $paths; } elseif ($prepend) { // Prepend directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( (array) $paths, $this->prefixDirsPsr4[$prefix] ); } else { // Append directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( $this->prefixDirsPsr4[$prefix], (array) $paths ); } } /** * Registers a set of PSR-0 directories for a given prefix, * replacing any others previously set for this prefix. * * @param string $prefix The prefix * @param array|string $paths The PSR-0 base directories */ public function set($prefix, $paths) { if (!$prefix) { $this->fallbackDirsPsr0 = (array) $paths; } else { $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; } } /** * Registers a set of PSR-4 directories for a given namespace, * replacing any others previously set for this namespace. * * @param string $prefix The prefix/namespace, with trailing '\\' * @param array|string $paths The PSR-4 base directories * * @throws \InvalidArgumentException */ public function setPsr4($prefix, $paths) { if (!$prefix) { $this->fallbackDirsPsr4 = (array) $paths; } else { $length = strlen($prefix); if ('\\' !== $prefix[$length - 1]) { throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); } $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; $this->prefixDirsPsr4[$prefix] = (array) $paths; } } /** * Turns on searching the include path for class files. * * @param bool $useIncludePath */ public function setUseIncludePath($useIncludePath) { $this->useIncludePath = $useIncludePath; } /** * Can be used to check if the autoloader uses the include path to check * for classes. * * @return bool */ public function getUseIncludePath() { return $this->useIncludePath; } /** * Turns off searching the prefix and fallback directories for classes * that have not been registered with the class map. * * @param bool $classMapAuthoritative */ public function setClassMapAuthoritative($classMapAuthoritative) { $this->classMapAuthoritative = $classMapAuthoritative; } /** * Should class lookup fail if not found in the current class map? * * @return bool */ public function isClassMapAuthoritative() { return $this->classMapAuthoritative; } /** * APCu prefix to use to cache found/not-found classes, if the extension is enabled. * * @param string|null $apcuPrefix */ public function setApcuPrefix($apcuPrefix) { - $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; } /** * The APCu prefix in use, or null if APCu caching is not enabled. * * @return string|null */ public function getApcuPrefix() { return $this->apcuPrefix; } /** * Registers this instance as an autoloader. * * @param bool $prepend Whether to prepend the autoloader or not */ public function register($prepend = false) { spl_autoload_register(array($this, 'loadClass'), true, $prepend); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } } /** * Unregisters this instance as an autoloader. */ public function unregister() { spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } } /** * Loads the given class or interface. * * @param string $class The name of the class * @return bool|null True if loaded, null otherwise */ public function loadClass($class) { if ($file = $this->findFile($class)) { includeFile($file); return true; } } /** * Finds the path to the file where the class is defined. * * @param string $class The name of the class * * @return string|false The path if found, false otherwise */ public function findFile($class) { // class map lookup if (isset($this->classMap[$class])) { return $this->classMap[$class]; } if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { return false; } if (null !== $this->apcuPrefix) { $file = apcu_fetch($this->apcuPrefix.$class, $hit); if ($hit) { return $file; } } $file = $this->findFileWithExtension($class, '.php'); // Search for Hack files if we are running on HHVM if (false === $file && defined('HHVM_VERSION')) { $file = $this->findFileWithExtension($class, '.hh'); } if (null !== $this->apcuPrefix) { apcu_add($this->apcuPrefix.$class, $file); } if (false === $file) { // Remember that this class does not exist. $this->missingClasses[$class] = true; } return $file; } + /** + * Returns the currently registered loaders indexed by their corresponding vendor directories. + * + * @return self[] + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + private function findFileWithExtension($class, $ext) { // PSR-4 lookup $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; $first = $class[0]; if (isset($this->prefixLengthsPsr4[$first])) { $subPath = $class; while (false !== $lastPos = strrpos($subPath, '\\')) { $subPath = substr($subPath, 0, $lastPos); - $search = $subPath.'\\'; + $search = $subPath . '\\'; if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); foreach ($this->prefixDirsPsr4[$search] as $dir) { - $length = $this->prefixLengthsPsr4[$first][$search]; - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { + if (file_exists($file = $dir . $pathEnd)) { return $file; } } } } } // PSR-4 fallback dirs foreach ($this->fallbackDirsPsr4 as $dir) { if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { return $file; } } // PSR-0 lookup if (false !== $pos = strrpos($class, '\\')) { // namespaced class name $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); } else { // PEAR-like class name $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; } if (isset($this->prefixesPsr0[$first])) { foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { if (0 === strpos($class, $prefix)) { foreach ($dirs as $dir) { if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { return $file; } } } } } // PSR-0 fallback dirs foreach ($this->fallbackDirsPsr0 as $dir) { if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { return $file; } } // PSR-0 include paths. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { return $file; } return false; } } /** * Scope isolated include. * * Prevents access to $this/self from included files. */ function includeFile($file) { include $file; } diff --git a/plugin/PayPalYPT/vendor/composer/InstalledVersions.php b/plugin/PayPalYPT/vendor/composer/InstalledVersions.php new file mode 100644 index 000000000..0a6ca53e2 --- /dev/null +++ b/plugin/PayPalYPT/vendor/composer/InstalledVersions.php @@ -0,0 +1,301 @@ + + array ( + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', + 'aliases' => + array ( + ), + 'reference' => '06273135e8d043e51bd44af1ec88b3a14638941f', + 'name' => '__root__', + ), + 'versions' => + array ( + '__root__' => + array ( + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', + 'aliases' => + array ( + ), + 'reference' => '06273135e8d043e51bd44af1ec88b3a14638941f', + ), + 'paypal/rest-api-sdk-php' => + array ( + 'pretty_version' => '1.14.0', + 'version' => '1.14.0.0', + 'aliases' => + array ( + ), + 'reference' => '72e2f2466975bf128a31e02b15110180f059fc04', + ), + 'psr/log' => + array ( + 'pretty_version' => '1.1.3', + 'version' => '1.1.3.0', + 'aliases' => + array ( + ), + 'reference' => '0f73288fd15629204f9d42b7055f72dacbe811fc', + ), + ), +); +private static $canGetVendors; +private static $installedByVendor = array(); + + + + + + + +public static function getInstalledPackages() +{ +$packages = array(); +foreach (self::getInstalled() as $installed) { +$packages[] = array_keys($installed['versions']); +} + + +if (1 === \count($packages)) { +return $packages[0]; +} + +return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); +} + + + + + + + + + +public static function isInstalled($packageName) +{ +foreach (self::getInstalled() as $installed) { +if (isset($installed['versions'][$packageName])) { +return true; +} +} + +return false; +} + + + + + + + + + + + + + + +public static function satisfies(VersionParser $parser, $packageName, $constraint) +{ +$constraint = $parser->parseConstraints($constraint); +$provided = $parser->parseConstraints(self::getVersionRanges($packageName)); + +return $provided->matches($constraint); +} + + + + + + + + + + +public static function getVersionRanges($packageName) +{ +foreach (self::getInstalled() as $installed) { +if (!isset($installed['versions'][$packageName])) { +continue; +} + +$ranges = array(); +if (isset($installed['versions'][$packageName]['pretty_version'])) { +$ranges[] = $installed['versions'][$packageName]['pretty_version']; +} +if (array_key_exists('aliases', $installed['versions'][$packageName])) { +$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); +} +if (array_key_exists('replaced', $installed['versions'][$packageName])) { +$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); +} +if (array_key_exists('provided', $installed['versions'][$packageName])) { +$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); +} + +return implode(' || ', $ranges); +} + +throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); +} + + + + + +public static function getVersion($packageName) +{ +foreach (self::getInstalled() as $installed) { +if (!isset($installed['versions'][$packageName])) { +continue; +} + +if (!isset($installed['versions'][$packageName]['version'])) { +return null; +} + +return $installed['versions'][$packageName]['version']; +} + +throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); +} + + + + + +public static function getPrettyVersion($packageName) +{ +foreach (self::getInstalled() as $installed) { +if (!isset($installed['versions'][$packageName])) { +continue; +} + +if (!isset($installed['versions'][$packageName]['pretty_version'])) { +return null; +} + +return $installed['versions'][$packageName]['pretty_version']; +} + +throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); +} + + + + + +public static function getReference($packageName) +{ +foreach (self::getInstalled() as $installed) { +if (!isset($installed['versions'][$packageName])) { +continue; +} + +if (!isset($installed['versions'][$packageName]['reference'])) { +return null; +} + +return $installed['versions'][$packageName]['reference']; +} + +throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); +} + + + + + +public static function getRootPackage() +{ +$installed = self::getInstalled(); + +return $installed[0]['root']; +} + + + + + + + +public static function getRawData() +{ +return self::$installed; +} + + + + + + + + + + + + + + + + + + + +public static function reload($data) +{ +self::$installed = $data; +self::$installedByVendor = array(); +} + + + + +private static function getInstalled() +{ +if (null === self::$canGetVendors) { +self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); +} + +$installed = array(); + +if (self::$canGetVendors) { +foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { +if (isset(self::$installedByVendor[$vendorDir])) { +$installed[] = self::$installedByVendor[$vendorDir]; +} elseif (is_file($vendorDir.'/composer/installed.php')) { +$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; +} +} +} + +$installed[] = self::$installed; + +return $installed; +} +} diff --git a/plugin/PayPalYPT/vendor/composer/autoload_classmap.php b/plugin/PayPalYPT/vendor/composer/autoload_classmap.php index 7a91153b0..b26f1b13b 100644 --- a/plugin/PayPalYPT/vendor/composer/autoload_classmap.php +++ b/plugin/PayPalYPT/vendor/composer/autoload_classmap.php @@ -1,9 +1,10 @@ $vendorDir . '/composer/InstalledVersions.php', ); diff --git a/plugin/PayPalYPT/vendor/composer/autoload_real.php b/plugin/PayPalYPT/vendor/composer/autoload_real.php index 59af8ccbe..9b73e8cc1 100644 --- a/plugin/PayPalYPT/vendor/composer/autoload_real.php +++ b/plugin/PayPalYPT/vendor/composer/autoload_real.php @@ -1,52 +1,57 @@ = 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { - require_once __DIR__ . '/autoload_static.php'; + require __DIR__ . '/autoload_static.php'; call_user_func(\Composer\Autoload\ComposerStaticInit87667b3ec94d1b7e59ef29b9d0f17c34::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { $loader->set($namespace, $path); } $map = require __DIR__ . '/autoload_psr4.php'; foreach ($map as $namespace => $path) { $loader->setPsr4($namespace, $path); } $classMap = require __DIR__ . '/autoload_classmap.php'; if ($classMap) { $loader->addClassMap($classMap); } } $loader->register(true); return $loader; } } diff --git a/plugin/PayPalYPT/vendor/composer/autoload_static.php b/plugin/PayPalYPT/vendor/composer/autoload_static.php index 64d037ecd..65c497028 100644 --- a/plugin/PayPalYPT/vendor/composer/autoload_static.php +++ b/plugin/PayPalYPT/vendor/composer/autoload_static.php @@ -1,42 +1,47 @@ array ( 'Psr\\Log\\' => 8, ), ); public static $prefixDirsPsr4 = array ( 'Psr\\Log\\' => array ( 0 => __DIR__ . '/..' . '/psr/log/Psr/Log', ), ); public static $prefixesPsr0 = array ( 'P' => array ( 'PayPal' => array ( 0 => __DIR__ . '/..' . '/paypal/rest-api-sdk-php/lib', ), ), ); + public static $classMap = array ( + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + ); + public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { $loader->prefixLengthsPsr4 = ComposerStaticInit87667b3ec94d1b7e59ef29b9d0f17c34::$prefixLengthsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInit87667b3ec94d1b7e59ef29b9d0f17c34::$prefixDirsPsr4; $loader->prefixesPsr0 = ComposerStaticInit87667b3ec94d1b7e59ef29b9d0f17c34::$prefixesPsr0; + $loader->classMap = ComposerStaticInit87667b3ec94d1b7e59ef29b9d0f17c34::$classMap; }, null, ClassLoader::class); } } diff --git a/plugin/PayPalYPT/vendor/composer/installed.json b/plugin/PayPalYPT/vendor/composer/installed.json index 414822249..9bfa4b442 100644 --- a/plugin/PayPalYPT/vendor/composer/installed.json +++ b/plugin/PayPalYPT/vendor/composer/installed.json @@ -1,102 +1,116 @@ -[ - { - "name": "psr/log", - "version": "1.0.2", - "version_normalized": "1.0.2.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" +{ + "packages": [ + { + "name": "paypal/rest-api-sdk-php", + "version": "1.14.0", + "version_normalized": "1.14.0.0", + "source": { + "type": "git", + "url": "https://github.com/paypal/PayPal-PHP-SDK.git", + "reference": "72e2f2466975bf128a31e02b15110180f059fc04" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paypal/PayPal-PHP-SDK/zipball/72e2f2466975bf128a31e02b15110180f059fc04", + "reference": "72e2f2466975bf128a31e02b15110180f059fc04", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-json": "*", + "php": ">=5.3.0", + "psr/log": "^1.0.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35" + }, + "time": "2019-01-04T20:04:25+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "PayPal": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "PayPal", + "homepage": "https://github.com/paypal/rest-api-sdk-php/contributors" + } + ], + "description": "PayPal's PHP SDK for REST APIs", + "homepage": "http://paypal.github.io/PayPal-PHP-SDK/", + "keywords": [ + "payments", + "paypal", + "rest", + "sdk" + ], + "support": { + "issues": "https://github.com/paypal/PayPal-PHP-SDK/issues", + "source": "https://github.com/paypal/PayPal-PHP-SDK/tree/master" + }, + "abandoned": true, + "install-path": "../paypal/rest-api-sdk-php" }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2016-10-10T12:19:37+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ] - }, - { - "name": "paypal/rest-api-sdk-php", - "version": "1.13.0", - "version_normalized": "1.13.0.0", - "source": { - "type": "git", - "url": "https://github.com/paypal/PayPal-PHP-SDK.git", - "reference": "192e217beed14c8e75624e821fdc8ec51e2a21f5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paypal/PayPal-PHP-SDK/zipball/192e217beed14c8e75624e821fdc8ec51e2a21f5", - "reference": "192e217beed14c8e75624e821fdc8ec51e2a21f5", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "ext-json": "*", - "php": ">=5.3.0", - "psr/log": "^1.0.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35" - }, - "time": "2017-11-13T19:21:59+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-0": { - "PayPal": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "PayPal", - "homepage": "https://github.com/paypal/rest-api-sdk-php/contributors" - } - ], - "description": "PayPal's PHP SDK for REST APIs", - "homepage": "http://paypal.github.io/PayPal-PHP-SDK/", - "keywords": [ - "payments", - "paypal", - "rest", - "sdk" - ] - } -] + { + "name": "psr/log", + "version": "1.1.3", + "version_normalized": "1.1.3.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2020-03-23T09:12:05+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.3" + }, + "install-path": "../psr/log" + } + ], + "dev": true, + "dev-package-names": [] +} diff --git a/plugin/PayPalYPT/vendor/composer/installed.php b/plugin/PayPalYPT/vendor/composer/installed.php new file mode 100644 index 000000000..78beb8341 --- /dev/null +++ b/plugin/PayPalYPT/vendor/composer/installed.php @@ -0,0 +1,42 @@ + + array ( + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', + 'aliases' => + array ( + ), + 'reference' => '06273135e8d043e51bd44af1ec88b3a14638941f', + 'name' => '__root__', + ), + 'versions' => + array ( + '__root__' => + array ( + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', + 'aliases' => + array ( + ), + 'reference' => '06273135e8d043e51bd44af1ec88b3a14638941f', + ), + 'paypal/rest-api-sdk-php' => + array ( + 'pretty_version' => '1.14.0', + 'version' => '1.14.0.0', + 'aliases' => + array ( + ), + 'reference' => '72e2f2466975bf128a31e02b15110180f059fc04', + ), + 'psr/log' => + array ( + 'pretty_version' => '1.1.3', + 'version' => '1.1.3.0', + 'aliases' => + array ( + ), + 'reference' => '0f73288fd15629204f9d42b7055f72dacbe811fc', + ), + ), +); diff --git a/plugin/PayPalYPT/vendor/composer/platform_check.php b/plugin/PayPalYPT/vendor/composer/platform_check.php new file mode 100644 index 000000000..7621d4ff9 --- /dev/null +++ b/plugin/PayPalYPT/vendor/composer/platform_check.php @@ -0,0 +1,26 @@ += 50300)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 5.3.0". You are running ' . PHP_VERSION . '.'; +} + +if ($issues) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); + } elseif (!headers_sent()) { + echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; + } + } + trigger_error( + 'Composer detected issues in your platform: ' . implode(' ', $issues), + E_USER_ERROR + ); +} diff --git a/plugin/PayPalYPT/vendor/paypal/rest-api-sdk-php/CHANGELOG.md b/plugin/PayPalYPT/vendor/paypal/rest-api-sdk-php/CHANGELOG.md index c4d21b6e0..006632792 100644 --- a/plugin/PayPalYPT/vendor/paypal/rest-api-sdk-php/CHANGELOG.md +++ b/plugin/PayPalYPT/vendor/paypal/rest-api-sdk-php/CHANGELOG.md @@ -1,303 +1,316 @@ PayPal PHP SDK release notes ============================ +1.14.0 +----- +* Update sdk_config.ini log.LogLevel comments [#983](https://github.com/paypal/PayPal-PHP-SDK/pull/983). +* Update RefundCapture.php [#998](https://github.com/paypal/PayPal-PHP-SDK/pull/998). +* update readme for direct credit card restriction [#1019](https://github.com/paypal/PayPal-PHP-SDK/pull/1019). +* Add PHP 7.1 and 7.2 in travis build [#1061](https://github.com/paypal/PayPal-PHP-SDK/pull/1061). +* Custom cache directory line was not written [#1062](https://github.com/paypal/PayPal-PHP-SDK/pull/1062). +* Re-Order the array keys so that JSON will be an array, not an object [#1034](https://github.com/paypal/PayPal-PHP-SDK/pull/1034). +* Refactoring tests [#1011](https://github.com/paypal/PayPal-PHP-SDK/pull/1011). +* Added condition to ignore extra header [#1060](https://github.com/paypal/PayPal-PHP-SDK/pull/1060). +* Fix links to Developer API Reference [#1095](https://github.com/paypal/PayPal-PHP-SDK/pull/1095). +* adding target subject to the generate access token call. + 1.13.0 ----- * Add HUF as a non-decimal currency [#974](https://github.com/paypal/PayPal-PHP-SDK/pull/974). * Add `purchaseOrder` in `CartBase` [#939](https://github.com/paypal/PayPal-PHP-SDK/pull/939). * Fixed annotation bug [#872](https://github.com/paypal/PayPal-PHP-SDK/pull/872). * Update PHPUnit [#979](https://github.com/paypal/PayPal-PHP-SDK/pull/979). 1.12.0 ----- * Add `getToken` method to `Payment` class to retrieve EC token from approval URL. * Add TLSv1.2 to cipher list [#844](https://github.com/paypal/PayPal-PHP-SDK/pull/844). * Use restCall object for function that makes REST requests [#841](https://github.com/paypal/PayPal-PHP-SDK/pull/841). * Minor bugfixes [#766](https://github.com/paypal/PayPal-PHP-SDK/issues/766), [#798](https://github.com/paypal/PayPal-PHP-SDK/issues/798), [#845](https://github.com/paypal/PayPal-PHP-SDK/pull/845). * Updated samples. 1.11.0 ----- * Update third party payment sample with PayPal payment. * Prevent error in SSL version check if curl is not available [#706](https://github.com/paypal/PayPal-PHP-SDK/pull/706). * Stop auto-generating PayPal-Request-Id header values and allow SDK users to optionally set the value [#747](https://github.com/paypal/PayPal-PHP-SDK/pull/747). * Remove automatic retries on failed requests [#747](https://github.com/paypal/PayPal-PHP-SDK/pull/747). 1.10.0 ----- * Updated Payments APIs [#700](https://github.com/paypal/PayPal-PHP-SDK/pull/700). * Minor bug fixes. 1.9.0 ----- * Updated Payouts APIs [#692](https://github.com/paypal/PayPal-PHP-SDK/pull/692). * Updated Payment Experience APIs [#682](https://github.com/paypal/PayPal-PHP-SDK/pull/682). * Updated Payments API to use Payment Card instead of credit card [#696](https://github.com/paypal/PayPal-PHP-SDK/pull/696). * Fixed bug on failed Access token call. [#665](https://github.com/paypal/PayPal-PHP-SDK/pull/665). 1.8.0 ----- * Updated Webhooks APIs [#653](https://github.com/paypal/PayPal-PHP-SDK/pull/653). * Updated Invoicing APIs [#657](https://github.com/paypal/PayPal-PHP-SDK/pull/657). * UTF-8 encoding bug fix [#655](https://github.com/paypal/PayPal-PHP-SDK/pull/655). * Updated PSR log [#654](https://github.com/paypal/PayPal-PHP-SDK/pull/654). 1.7.4 ----- * Fixed Duplicate conditional expression in PayPalCredentialManager.php [#594](https://github.com/paypal/PayPal-PHP-SDK/pull/594). * Updated Invoicing APIs [#605](https://github.com/paypal/PayPal-PHP-SDK/pull/605). * Fixed PSR code style errors [#607](https://github.com/paypal/PayPal-PHP-SDK/pull/607). 1.7.3 ----- * Enabled Third Party Invoicing [#581](https://github.com/paypal/PayPal-PHP-SDK/pull/581). 1.7.2 ---- * Vault API updates. * Fixes #575. 1.7.1 ---- * Fixes #559. 1.7.0 ---- * Enable custom logger injection. * Minor bug fixes. 1.6.4 ---- * SSL Connect Error Fix. * Fixes #474. 1.6.3 ---- * Fixes Continue 100 Header. * Minor Bug Fixes #452. 1.6.2 ---- * TLS Check Sample Added. * Updated README. 1.6.1 ---- * User Agent Changes. * SDK Version Fix. 1.6.0 ---- * Updated Payments API to latest version. * Removed ModelAccessValidator. * Minor Bug Fixes #399. 1.5.1 ---- * Fixed a bug #343 in Future Payment. * Minor Improvements. * Updates to Sample Docs. 1.5.0 ---- * Enabled Vault List API. * Added More Fields to Vault Credit Card Object. * Minor Fixes. 1.4.0 ---- * Ability to validate Webhook. * Fixes to Logging Manager to skip if mode is not set. * SDK updates and fixes. 1.3.2 ---- * Minor Fix for Agreement Details. 1.3.1 ---- * PayPalModel to differentiate between empty objects and array. * Fixed CURLINFO_HEADER_SIZE miscalculations if Proxy Enabled. 1.3.0 ---- * Updated Payment APIs. * Updating ModelAccessValidator to be disabled if not set explicitly. 1.2.1 ---- * Ability to handle missing accessors for unknown objects in json. 1.2.0 ---- * Order API Support. * Introduced DEBUG mode in Logging. Deprecated FINE. * Ability to not Log on DEBUG, while on live environment. * Vault APIs Update API Support. * Transaction Fee Added in Sale Object. * Fixed #237, #234, #233, #215. 1.1.1 ---- * Fix to Cipher Encryption (Critical). 1.1.0 ---- * Enabled Payouts Cancel API Support for Unclaimed Payouts. * Encrypting Access Token in Cached Storage. * Updated Billing Agreement Search Transaction code to pass start_date and end_date. * Updated OAuthToken to throw proper error on not receiving access token. * Minor Bug Fixes and Documentation Updates. 1.0.0 ---- * Enabled Payouts API Support. * Authorization Cache Custom Path Directory Configuration. * Helper Functions to retrieve specific HATEOS Links. * Default Mode set to Sandbox. * Enabled Rest SDK to work nicely with Classic SDKs. * If missing annotation of return type in Getters, it throws a proper exception. * `echo` on PayPalModel Objects will print nice looking JSON. * Updated Invoice Object to retrieve payments and refunds. > ## Breaking Changes * Removed Deprecated Getter Setters from all Model Classes. * All Camelcase getters and setters are removed. Please use first letter uppercase syntax. * E.g. instead of using get_notify_url(), use getNotifyUrl() instead. * Renamed Classes. * PayPal\Common\PPModel => PayPal\Common\PayPalModel. * PayPal\Common\ResourceModel => PayPal\Common\PayPalResourceModel. * PayPal\Common\PPUserAgent => PayPal\Common\PayPalUserAgent. * PayPal\Core\PPConfigManager => PayPal\Core\PayPalConfigManager. * PayPal\Core\PPConstants => PayPal\Core\PayPalConstants. * PayPal\Core\PPCredentialManager => PayPal\Core\PayPalCredentialManager. * PayPal\Core\PPHttpConfig => PayPal\Core\PayPalHttpConfig. * PayPal\Core\PPHttpConnection => PayPal\Core\PayPalHttpConnection. * PayPal\Core\PPLoggingLevel => PayPal\Core\PayPalLoggingLevel. * PayPal\Core\PPLoggingManager => PayPal\Core\PayPalLoggingManager. * PayPal\Exception\PPConfigurationException => PayPal\Exception\PayPalConfigurationException. * PayPal\Exception\PPConnectionException => PayPal\Exception\PayPalConnectionException. * PayPal\Exception\PPInvalidCredentialException => PayPal\Exception\PayPalInvalidCredentialException. * PayPal\Exception\PPMissingCredentialException => PayPal\Exception\PayPalMissingCredentialException. * PayPal\Handler\IPPHandler => PayPal\Handler\IPayPalHandler. * PayPal\Transport\PPRestCall => PayPal\Transport\PayPalRestCall. * Namespace Changes and Class Naming Convention. * PayPal\Common\FormatConverter => PayPal\Converter\FormatConverter. * PayPal\Rest\RestHandler => PayPal\Handler\RestHandler. * PayPal\Rest\OauthHandler => PayPal\Handler\OauthHandler. * Fixes to Methods. * PayPal\Api\Invoice->getPaymentDetails() was renamed to getPayments(). * PayPal\Api\Invoice->getRefundDetails() was renamed to getRefunds(). 1.0.0-beta ---- * Namespace Changes and Class Naming Convention. * Helper Functions to retrieve specific HATEOS Links. * Default Mode set to Sandbox. 0.16.1 ---- * Configurable Headers for all requests to PayPal. * Allows adding additional headers to every call to PayPal APIs. * SDK Config to add headers with http.headers.* syntax. 0.16.0 ---- * Enabled Webhook Management Capabilities. * Enabled Caching Abilities for Access Tokens. 0.15.1 ---- * Enabled Deleting Billing Plans. * Updated Samples. 0.15.0 ---- * Extended Invoicing Capabilities. * Allows QR Code Generation for Invoices. * Updated Formatter to work with multiple locales. * Removed Future Payments mandate on Correlation Id. 0.14.2 ---- * Quick Patch to Unset Cipher List for NSS. 0.14.1 ---- * Updated HttpConfig to use TLSv1 as Cipher List. * Added resetRequestId in ApiContext to enable multiple create calls in succession. * Sanitize Input for Price Variables. * Made samples look better and work best. 0.14.0 ---- * Enabled Billing Plans and Agreements APIs. * Renamed SDK name to PayPal-PHP-SDK. 0.13.2 ---- * Updated Future Payments and LIPP Support. * Updated Logging Syntax. 0.13.1 ---- * Enabled TLS version 1.x for SSL Negotiation. * Updated Identity Support from SDK Core. * Fixed Backward Compatibility changes. 0.13.0 ---- * Enabled Payment Experience. 0.12.0 ---- * Enabled EC Parameters Support for Payment APIs. * Enabled Validation for Missing Accessors. 0.11.1 ---- * Removed Dependency from SDK Core Project. * Enabled Future Payments. 0.11.0 ---- * Ability for PUT and PATCH requests. * Invoice number, custom and soft descriptor. * Order API and tests, more Authorization tests. * remove references to sdk-packages. * patch for retrieving paid invoices. * Shipping address docs patch. * Remove @array annotation. * Validate return cancel url. * type hinting, comment cleaning, and getters and setters for Shipping. 0.10.0 ----- * N/A. 0.9.0 ----- * N/A. 0.8.0 ----- * Invoicing API support added. 0.7.1 ----- * Added support for Reauthorization. 0.7.0 ----- * Added support for Auth and Capture APIs. * Types modified to match the API Spec. * Updated SDK to use namespace supported core library. 0.6.0 ----- * Adding support for dynamic configuration of SDK (Upgrading sdk-core-php dependency to V1.4.0). * Deprecating the setCredential method and changing resource class methods to take an ApiContext argument instead of a OauthTokenCredential argument. 0.5.0 ----- * Initial Release. diff --git a/plugin/PayPalYPT/vendor/paypal/rest-api-sdk-php/README.md b/plugin/PayPalYPT/vendor/paypal/rest-api-sdk-php/README.md index e07db7268..3e076febd 100644 --- a/plugin/PayPalYPT/vendor/paypal/rest-api-sdk-php/README.md +++ b/plugin/PayPalYPT/vendor/paypal/rest-api-sdk-php/README.md @@ -1,58 +1,60 @@ # REST API SDK for PHP ![Home Image](https://raw.githubusercontent.com/wiki/paypal/PayPal-PHP-SDK/images/homepage.jpg) [![Build Status](https://travis-ci.org/paypal/PayPal-PHP-SDK.svg?branch=master)](https://travis-ci.org/paypal/PayPal-PHP-SDK) [![Coverage Status](https://coveralls.io/repos/paypal/PayPal-PHP-SDK/badge.svg?branch=master)](https://coveralls.io/r/paypal/PayPal-PHP-SDK?branch=master) __Welcome to PayPal PHP SDK__. This repository contains PayPal's PHP SDK and samples for REST API. +## Direct Credit Card Support +> **Important: The PayPal REST API no longer supports new direct credit card integrations.** Please instead consider [Braintree Direct](https://www.braintreepayments.com/products/braintree-direct); which is, PayPal's preferred integration solution for accepting direct credit card payments in your mobile app or website. Braintree, a PayPal service, is the easiest way to accept credit cards, PayPal, and many other payment methods. + ## Please Note + > **The Payment Card Industry (PCI) Council has [mandated](https://blog.pcisecuritystandards.org/migrating-from-ssl-and-early-tls) that early versions of TLS be retired from service. All organizations that handle credit card information are required to comply with this standard. As part of this obligation, PayPal is updating its services to require TLS 1.2 for all HTTPS connections. At this time, PayPal will also require HTTP/1.1 for all connections. [Click here](https://github.com/paypal/tls-update) for more information** > **Connections to the sandbox environment use only TLS 1.2.** ## SDK Documentation [Our PayPal-PHP-SDK Page](http://paypal.github.io/PayPal-PHP-SDK/) includes all the documentation related to PHP SDK. Everything from SDK Wiki, to Sample Codes, to Releases. Here are few quick links to get you there faster. * [PayPal-PHP-SDK Home Page](https://paypal.github.io/PayPal-PHP-SDK/) * [Wiki](https://github.com/paypal/PayPal-PHP-SDK/wiki) * [Samples](https://paypal.github.io/PayPal-PHP-SDK/sample/) * [Installation](https://github.com/paypal/PayPal-PHP-SDK/wiki/Installation) * [Make your First SDK Call](https://github.com/paypal/PayPal-PHP-SDK/wiki/Making-First-Call) * [PayPal Developer Docs](https://developer.paypal.com/docs/) ## Latest Updates - SDK now allows injecting your logger implementation. Please read [documentation](https://github.com/paypal/PayPal-PHP-SDK/wiki/Custom-Logger) for more details. - If you are running into SSL Connect Error talking to sandbox or live, please update your SDK to latest version or, follow instructions as shown [here](https://github.com/paypal/PayPal-PHP-SDK/issues/474) - Checkout the latest 1.0.0 release. Here are all the [breaking Changes in v1.0.0](https://github.com/paypal/PayPal-PHP-SDK/wiki/Breaking-Changes---1.0.0) if you are migrating from older versions. - Now we have a [Github Page](https://paypal.github.io/PayPal-PHP-SDK/), that helps you find all helpful resources building applications using PayPal-PHP-SDK. +## 2.0 Release Candidate! +We're releasing a [brand new version of our SDK!](https://github.com/paypal/PayPal-php-SDK/tree/2.0-beta) 2.0 is currently at release candidate status, and represents a full refactor, with the goal of making all of our APIs extremely easy to use. 2.0 includes all of the existing APIs (except payouts), and includes the new Orders API (Disputes and Marketplace coming soon). Check out the [FAQ and migration guide](https://github.com/paypal/PayPal-php-SDK/tree/2.0-beta/docs), and let us know if you have any suggestions or issues! ## Prerequisites - PHP 5.3 or above - [curl](https://secure.php.net/manual/en/book.curl.php), [json](https://secure.php.net/manual/en/book.json.php) & [openssl](https://secure.php.net/manual/en/book.openssl.php) extensions must be enabled -## Direct Credit Card Support -[Braintree Direct](https://www.braintreepayments.com/products/braintree-direct) is PayPal's preferred integration solution for accepting direct credit card payments in your mobile app or website. Braintree, a PayPal service, is the easiest way to accept credit cards, PayPal, and many other payment methods. - - ## License Read [License](LICENSE) for more licensing information. ## Contributing Read [here](CONTRIBUTING.md) for more information. ## More help * [Going Live](https://github.com/paypal/PayPal-PHP-SDK/wiki/Going-Live) * [PayPal-PHP-SDK Home Page](http://paypal.github.io/PayPal-PHP-SDK/) * [SDK Documentation](https://github.com/paypal/PayPal-PHP-SDK/wiki) * [Sample Source Code](http://paypal.github.io/PayPal-PHP-SDK/sample/) - * [API Reference](https://developer.paypal.com/webapps/developer/docs/api/) + * [API Reference](https://developer.paypal.com/docs/api/) * [Reporting Issues / Feature Requests](https://github.com/paypal/PayPal-PHP-SDK/issues) diff --git a/plugin/PayPalYPT/vendor/paypal/rest-api-sdk-php/lib/PayPal/Log/PayPalLogger.php b/plugin/PayPalYPT/vendor/paypal/rest-api-sdk-php/lib/PayPal/Log/PayPalLogger.php index 2d2ca54db..6be02ec87 100644 --- a/plugin/PayPalYPT/vendor/paypal/rest-api-sdk-php/lib/PayPal/Log/PayPalLogger.php +++ b/plugin/PayPalYPT/vendor/paypal/rest-api-sdk-php/lib/PayPal/Log/PayPalLogger.php @@ -1,84 +1,84 @@ loggerName = $className; $this->initialize(); } public function initialize() { $config = PayPalConfigManager::getInstance()->getConfigHashmap(); if (!empty($config)) { $this->isLoggingEnabled = (array_key_exists('log.LogEnabled', $config) && $config['log.LogEnabled'] == '1'); if ($this->isLoggingEnabled) { $this->loggerFile = ($config['log.FileName']) ? $config['log.FileName'] : ini_get('error_log'); $loggingLevel = strtoupper($config['log.LogLevel']); $this->loggingLevel = (isset($loggingLevel) && defined("\\Psr\\Log\\LogLevel::$loggingLevel")) ? constant("\\Psr\\Log\\LogLevel::$loggingLevel") : LogLevel::INFO; } } } public function log($level, $message, array $context = array()) { if ($this->isLoggingEnabled) { // Checks if the message is at level below configured logging level if (array_search($level, $this->loggingLevels) <= array_search($this->loggingLevel, $this->loggingLevels)) { - _error_log("[" . date('d-m-Y H:i:s') . "] " . $this->loggerName . " : " . strtoupper($level) . ": $message\n", 3, $this->loggerFile); + error_log("[" . date('d-m-Y H:i:s') . "] " . $this->loggerName . " : " . strtoupper($level) . ": $message\n", 3, $this->loggerFile); } } } } diff --git a/plugin/PayPalYPT/vendor/psr/log/.gitignore b/plugin/PayPalYPT/vendor/psr/log/.gitignore deleted file mode 100644 index 22d0d82f8..000000000 --- a/plugin/PayPalYPT/vendor/psr/log/.gitignore +++ /dev/null @@ -1 +0,0 @@ -vendor diff --git a/plugin/PayPalYPT/vendor/psr/log/Psr/Log/LoggerInterface.php b/plugin/PayPalYPT/vendor/psr/log/Psr/Log/LoggerInterface.php index 5ea72438b..2206cfde4 100644 --- a/plugin/PayPalYPT/vendor/psr/log/Psr/Log/LoggerInterface.php +++ b/plugin/PayPalYPT/vendor/psr/log/Psr/Log/LoggerInterface.php @@ -1,123 +1,125 @@ log(LogLevel::EMERGENCY, $message, $context); } /** * Action must be taken immediately. * * Example: Entire website down, database unavailable, etc. This should * trigger the SMS alerts and wake you up. * * @param string $message * @param array $context * * @return void */ public function alert($message, array $context = array()) { $this->log(LogLevel::ALERT, $message, $context); } /** * Critical conditions. * * Example: Application component unavailable, unexpected exception. * * @param string $message * @param array $context * * @return void */ public function critical($message, array $context = array()) { $this->log(LogLevel::CRITICAL, $message, $context); } /** * Runtime errors that do not require immediate action but should typically * be logged and monitored. * * @param string $message * @param array $context * * @return void */ public function error($message, array $context = array()) { $this->log(LogLevel::ERROR, $message, $context); } /** * Exceptional occurrences that are not errors. * * Example: Use of deprecated APIs, poor use of an API, undesirable things * that are not necessarily wrong. * * @param string $message * @param array $context * * @return void */ public function warning($message, array $context = array()) { $this->log(LogLevel::WARNING, $message, $context); } /** * Normal but significant events. * * @param string $message * @param array $context * * @return void */ public function notice($message, array $context = array()) { $this->log(LogLevel::NOTICE, $message, $context); } /** * Interesting events. * * Example: User logs in, SQL logs. * * @param string $message * @param array $context * * @return void */ public function info($message, array $context = array()) { $this->log(LogLevel::INFO, $message, $context); } /** * Detailed debug information. * * @param string $message * @param array $context * * @return void */ public function debug($message, array $context = array()) { $this->log(LogLevel::DEBUG, $message, $context); } /** * Logs with an arbitrary level. * * @param mixed $level * @param string $message * @param array $context * * @return void + * + * @throws \Psr\Log\InvalidArgumentException */ abstract public function log($level, $message, array $context = array()); } diff --git a/plugin/PayPalYPT/vendor/psr/log/Psr/Log/NullLogger.php b/plugin/PayPalYPT/vendor/psr/log/Psr/Log/NullLogger.php index d8cd682c8..c8f7293b1 100644 --- a/plugin/PayPalYPT/vendor/psr/log/Psr/Log/NullLogger.php +++ b/plugin/PayPalYPT/vendor/psr/log/Psr/Log/NullLogger.php @@ -1,28 +1,30 @@ logger) { }` * blocks. */ class NullLogger extends AbstractLogger { /** * Logs with an arbitrary level. * * @param mixed $level * @param string $message * @param array $context * * @return void + * + * @throws \Psr\Log\InvalidArgumentException */ public function log($level, $message, array $context = array()) { // noop } } diff --git a/plugin/PayPalYPT/vendor/psr/log/Psr/Log/Test/DummyTest.php b/plugin/PayPalYPT/vendor/psr/log/Psr/Log/Test/DummyTest.php new file mode 100644 index 000000000..9638c1101 --- /dev/null +++ b/plugin/PayPalYPT/vendor/psr/log/Psr/Log/Test/DummyTest.php @@ -0,0 +1,18 @@ + ". * * Example ->error('Foo') would yield "error Foo". * * @return string[] */ abstract public function getLogs(); public function testImplements() { $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger()); } /** * @dataProvider provideLevelsAndMessages */ public function testLogsAtAllLevels($level, $message) { $logger = $this->getLogger(); $logger->{$level}($message, array('user' => 'Bob')); $logger->log($level, $message, array('user' => 'Bob')); $expected = array( $level.' message of level '.$level.' with context: Bob', $level.' message of level '.$level.' with context: Bob', ); $this->assertEquals($expected, $this->getLogs()); } public function provideLevelsAndMessages() { return array( LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'), LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'), LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'), LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'), LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'), LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'), LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'), LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'), ); } /** * @expectedException \Psr\Log\InvalidArgumentException */ public function testThrowsOnInvalidLevel() { $logger = $this->getLogger(); $logger->log('invalid level', 'Foo'); } public function testContextReplacement() { $logger = $this->getLogger(); $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar')); $expected = array('info {Message {nothing} Bob Bar a}'); $this->assertEquals($expected, $this->getLogs()); } public function testObjectCastToString() { if (method_exists($this, 'createPartialMock')) { $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString')); } else { $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString')); } $dummy->expects($this->once()) ->method('__toString') ->will($this->returnValue('DUMMY')); $this->getLogger()->warning($dummy); $expected = array('warning DUMMY'); $this->assertEquals($expected, $this->getLogs()); } public function testContextCanContainAnything() { + $closed = fopen('php://memory', 'r'); + fclose($closed); + $context = array( 'bool' => true, 'null' => null, 'string' => 'Foo', 'int' => 0, 'float' => 0.5, 'nested' => array('with object' => new DummyTest), 'object' => new \DateTime, 'resource' => fopen('php://memory', 'r'), + 'closed' => $closed, ); $this->getLogger()->warning('Crazy context data', $context); $expected = array('warning Crazy context data'); $this->assertEquals($expected, $this->getLogs()); } public function testContextExceptionKeyCanBeExceptionOrOtherValues() { $logger = $this->getLogger(); $logger->warning('Random message', array('exception' => 'oops')); $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail'))); $expected = array( 'warning Random message', 'critical Uncaught Exception!' ); $this->assertEquals($expected, $this->getLogs()); } } - -class DummyTest -{ - public function __toString() - { - } -} diff --git a/plugin/PayPalYPT/vendor/psr/log/Psr/Log/Test/TestLogger.php b/plugin/PayPalYPT/vendor/psr/log/Psr/Log/Test/TestLogger.php new file mode 100644 index 000000000..1be323049 --- /dev/null +++ b/plugin/PayPalYPT/vendor/psr/log/Psr/Log/Test/TestLogger.php @@ -0,0 +1,147 @@ + $level, + 'message' => $message, + 'context' => $context, + ]; + + $this->recordsByLevel[$record['level']][] = $record; + $this->records[] = $record; + } + + public function hasRecords($level) + { + return isset($this->recordsByLevel[$level]); + } + + public function hasRecord($record, $level) + { + if (is_string($record)) { + $record = ['message' => $record]; + } + return $this->hasRecordThatPasses(function ($rec) use ($record) { + if ($rec['message'] !== $record['message']) { + return false; + } + if (isset($record['context']) && $rec['context'] !== $record['context']) { + return false; + } + return true; + }, $level); + } + + public function hasRecordThatContains($message, $level) + { + return $this->hasRecordThatPasses(function ($rec) use ($message) { + return strpos($rec['message'], $message) !== false; + }, $level); + } + + public function hasRecordThatMatches($regex, $level) + { + return $this->hasRecordThatPasses(function ($rec) use ($regex) { + return preg_match($regex, $rec['message']) > 0; + }, $level); + } + + public function hasRecordThatPasses(callable $predicate, $level) + { + if (!isset($this->recordsByLevel[$level])) { + return false; + } + foreach ($this->recordsByLevel[$level] as $i => $rec) { + if (call_user_func($predicate, $rec, $i)) { + return true; + } + } + return false; + } + + public function __call($method, $args) + { + if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { + $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; + $level = strtolower($matches[2]); + if (method_exists($this, $genericMethod)) { + $args[] = $level; + return call_user_func_array([$this, $genericMethod], $args); + } + } + throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()'); + } + + public function reset() + { + $this->records = []; + $this->recordsByLevel = []; + } +} diff --git a/plugin/PayPalYPT/vendor/psr/log/README.md b/plugin/PayPalYPT/vendor/psr/log/README.md index 574bc1cb2..a9f20c437 100644 --- a/plugin/PayPalYPT/vendor/psr/log/README.md +++ b/plugin/PayPalYPT/vendor/psr/log/README.md @@ -1,45 +1,58 @@ PSR Log ======= This repository holds all interfaces/classes/traits related to [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md). Note that this is not a logger of its own. It is merely an interface that describes a logger. See the specification for more details. +Installation +------------ + +```bash +composer require psr/log +``` + Usage ----- If you need a logger, you can use the interface like this: ```php logger = $logger; } public function doSomething() { if ($this->logger) { $this->logger->info('Doing work'); } + + try { + $this->doSomethingElse(); + } catch (Exception $exception) { + $this->logger->error('Oh no!', array('exception' => $exception)); + } // do something useful } } ``` You can then pick one of the implementations of the interface to get a logger. If you want to implement the interface, you can require this package and implement `Psr\Log\LoggerInterface` in your code. Please read the [specification text](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) for details. diff --git a/plugin/PayPalYPT/vendor/psr/log/composer.json b/plugin/PayPalYPT/vendor/psr/log/composer.json index 87934d707..3f6d4eea4 100644 --- a/plugin/PayPalYPT/vendor/psr/log/composer.json +++ b/plugin/PayPalYPT/vendor/psr/log/composer.json @@ -1,26 +1,26 @@ { "name": "psr/log", "description": "Common interface for logging libraries", "keywords": ["psr", "psr-3", "log"], "homepage": "https://github.com/php-fig/log", "license": "MIT", "authors": [ { "name": "PHP-FIG", "homepage": "http://www.php-fig.org/" } ], "require": { "php": ">=5.3.0" }, "autoload": { "psr-4": { "Psr\\Log\\": "Psr/Log/" } }, "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } } } diff --git a/plugin/StripeYPT/.coveralls.yml b/plugin/StripeYPT/.coveralls.yml new file mode 100644 index 000000000..4eecff566 --- /dev/null +++ b/plugin/StripeYPT/.coveralls.yml @@ -0,0 +1,3 @@ +service_name: travis-ci +coverage_clover: clover.xml +json_path: coveralls-upload.json diff --git a/plugin/StripeYPT/.gitattributes b/plugin/StripeYPT/.gitattributes new file mode 100644 index 000000000..2dda28beb --- /dev/null +++ b/plugin/StripeYPT/.gitattributes @@ -0,0 +1,13 @@ +# https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes + +# A list of files and folders those will be excluded from archives and the +# Composer package (for purposes of making it smaller). +/.coveralls.yml export-ignore +/.github export-ignore +/.gitattributes export-ignore +/.travis.yml export-ignore +/.vscode export-ignore +/examples export-ignore +/phpunit.xml export-ignore +/phpunit.no_autoload.xml export-ignore +/tests export-ignore diff --git a/plugin/StripeYPT/.php_cs.dist b/plugin/StripeYPT/.php_cs.dist index 83660ffcd..2ebf9f3d8 100644 --- a/plugin/StripeYPT/.php_cs.dist +++ b/plugin/StripeYPT/.php_cs.dist @@ -1,38 +1,45 @@ setRiskyAllowed(true) ->setRules([ // Rulesets '@PSR2' => true, '@PhpCsFixer' => true, '@PhpCsFixer:risky' => true, '@PHP56Migration:risky' => true, '@PHPUnit57Migration:risky' => true, // Additional rules 'fopen_flags' => true, 'linebreak_after_opening_tag' => true, + 'native_constant_invocation' => true, 'native_function_invocation' => true, // --- Diffs from @PhpCsFixer / @PhpCsFixer:risky --- + // This is the same as the default for the @PhpCsFixer ruleset, minus + // the following values: ['include', 'include_once', 'require', + // 'require_once']. We could enable them and remove this line after + // updating codegen for the `init.php` file to be compliant. + 'blank_line_before_statement' => ['statements' => ['break', 'case', 'continue', 'declare', 'default', 'exit', 'goto', 'return', 'switch', 'throw', 'try']], + // This is just prettier / easier to read. 'concat_space' => ['spacing' => 'one'], // This causes strange ordering with codegen'd classes. We might be // able to enable this if we update codegen to output class elements // in the correct order. 'ordered_class_elements' => false, // Keep this disabled to avoid unnecessary diffs in PHPDoc comments of // codegen'd classes. 'phpdoc_align' => false, // This is a "risky" rule that causes a bug in our codebase. // Specifically, in `StripeObject.updateAttributes` we construct new // `StripeObject`s for metadata. We can't use `self` there because it // needs to be a raw `StripeObject`. 'self_accessor' => false, ]) ; diff --git a/plugin/StripeYPT/.travis.yml b/plugin/StripeYPT/.travis.yml new file mode 100644 index 000000000..6aa2ec866 --- /dev/null +++ b/plugin/StripeYPT/.travis.yml @@ -0,0 +1,68 @@ +sudo: false + +dist: bionic + +language: php + +matrix: + include: + - php: 5.6 + env: AUTOLOAD=1 + dist: xenial + - php: 5.6 + env: AUTOLOAD=0 + dist: xenial + - php: 7.0 + env: AUTOLOAD=1 + dist: xenial + - php: 7.0 + env: AUTOLOAD=0 + dist: xenial + - php: 7.1 + env: AUTOLOAD=1 + - php: 7.1 + env: AUTOLOAD=0 + - php: 7.2 + env: AUTOLOAD=1 + - php: 7.2 + env: AUTOLOAD=0 + - php: 7.3 + env: AUTOLOAD=1 + - php: 7.3 + env: AUTOLOAD=0 + - php: 7.4 + env: AUTOLOAD=1 + - php: 7.4 + env: AUTOLOAD=0 + +env: + global: + - STRIPE_MOCK_VERSION=0.103.0 +cache: + directories: + - $HOME/.composer/cache/files + - stripe-mock + +before_install: + # Install various build dependencies. We use `travis_retry` because Composer + # will occasionally fail intermittently. + - travis_retry make vendor + + # Unpack and start stripe-mock so that the test suite can talk to it + - | + if [ ! -d "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}" ]; then + mkdir -p stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/ + curl -L "https://github.com/stripe/stripe-mock/releases/download/v${STRIPE_MOCK_VERSION}/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz" -o "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz" + tar -zxf "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz" -C "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/" + fi + - | + stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/stripe-mock > /dev/null & + STRIPE_MOCK_PID=$! + - export PATH="${PATH}:${PWD}/stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}" + +script: + - ./build.php ${AUTOLOAD} + - make fmtcheck + - if [[ `php -r "echo \version_compare(PHP_VERSION, '7.1', '>=');"` && $AUTOLOAD == 1 ]]; then make phpstan; fi + +after_script: ./vendor/bin/php-coveralls -v diff --git a/plugin/StripeYPT/CHANGELOG.md b/plugin/StripeYPT/CHANGELOG.md index 935912c7c..bee17cbe2 100644 --- a/plugin/StripeYPT/CHANGELOG.md +++ b/plugin/StripeYPT/CHANGELOG.md @@ -1,1311 +1,1360 @@ # Changelog +## 7.77.0 - 2021-04-12 +* [#1110](https://github.com/stripe/stripe-php/pull/1110) Update PHPDocs + * Add support for `acss_debit` on `PaymentMethod` + * Add support for `payment_method_options` on `Checkout\Session` +* [#1107](https://github.com/stripe/stripe-php/pull/1107) Remove duplicate object phpdoc + +## 7.76.0 - 2021-03-22 +* [#1100](https://github.com/stripe/stripe-php/pull/1100) Update PHPDocs + * Added support for `amount_shipping` on `Checkout.Session.total_details` +* [#1088](https://github.com/stripe/stripe-php/pull/1088) Make possibility to extend CurlClient + +## 7.75.0 - 2021-02-22 +* [#1094](https://github.com/stripe/stripe-php/pull/1094) Add support for Billing Portal Configuration API + +## 7.74.0 - 2021-02-17 +* [#1093](https://github.com/stripe/stripe-php/pull/1093) Update PHPDocs + * Add support for on_behalf_of to Invoice + +## 7.73.0 - 2021-02-16 +* [#1091](https://github.com/stripe/stripe-php/pull/1091) Update PHPDocs + * Add support for `afterpay_clearpay` on `PaymentMethod`. + +## 7.72.0 - 2021-02-08 +* [#1089](https://github.com/stripe/stripe-php/pull/1089) Update PHPDocs + * Add support for `afterpay_clearpay_payments` on `Account.capabilities` + * Add support for `payment_settings` on `Invoice` + +## 7.71.0 - 2021-02-05 +* [#1087](https://github.com/stripe/stripe-php/pull/1087) Update PHPDocs +* [#1086](https://github.com/stripe/stripe-php/pull/1086) Update CA cert bundle URL + +## 7.70.0 - 2021-02-03 +* [#1085](https://github.com/stripe/stripe-php/pull/1085) Update PHPDocs + * Add support for `nationality` on `Person` + * Add member `gb_vat` of `TaxID` enum + + +## 7.69.0 - 2021-01-21 +* [#1079](https://github.com/stripe/stripe-php/pull/1079) Update PHPDocs + +## 7.68.0 - 2021-01-14 +* [#1063](https://github.com/stripe/stripe-php/pull/1063) Multiple API changes +* [#1061](https://github.com/stripe/stripe-php/pull/1061) Bump phpDocumentor to 3.0.0 + +## 7.67.0 - 2020-12-09 +* [#1060](https://github.com/stripe/stripe-php/pull/1060) Improve PHPDocs for `Discount` +* [#1059](https://github.com/stripe/stripe-php/pull/1059) Upgrade PHPStan to 0.12.59 +* [#1057](https://github.com/stripe/stripe-php/pull/1057) Bump PHP-CS-Fixer and update code + ## 7.66.1 - 2020-12-01 * [#1054](https://github.com/stripe/stripe-php/pull/1054) Improve error message for invalid keys in StripeClient ## 7.66.0 - 2020-11-24 * [#1053](https://github.com/stripe/stripe-php/pull/1053) Update PHPDocs ## 7.65.0 - 2020-11-19 * [#1050](https://github.com/stripe/stripe-php/pull/1050) Added constants for `proration_behavior` on `Subscription` ## 7.64.0 - 2020-11-18 * [#1049](https://github.com/stripe/stripe-php/pull/1049) Update PHPDocs ## 7.63.0 - 2020-11-17 * [#1048](https://github.com/stripe/stripe-php/pull/1048) Update PHPDocs * [#1046](https://github.com/stripe/stripe-php/pull/1046) Force IPv4 resolving ## 7.62.0 - 2020-11-09 * [#1041](https://github.com/stripe/stripe-php/pull/1041) Add missing constants on `Event` * [#1038](https://github.com/stripe/stripe-php/pull/1038) Update PHPDocs ## 7.61.0 - 2020-10-20 * [#1030](https://github.com/stripe/stripe-php/pull/1030) Add support for `jp_rn` and `ru_kpp` as a `type` on `TaxId` ## 7.60.0 - 2020-10-15 * [#1027](https://github.com/stripe/stripe-php/pull/1027) Warn if opts are in params ## 7.58.0 - 2020-10-14 * [#1026](https://github.com/stripe/stripe-php/pull/1026) Add support for the Payout Reverse API ## 7.57.0 - 2020-09-29 * [#1020](https://github.com/stripe/stripe-php/pull/1020) Add support for the `SetupAttempt` resource and List API ## 7.56.0 - 2020-09-25 * [#1019](https://github.com/stripe/stripe-php/pull/1019) Update PHPDocs ## 7.55.0 - 2020-09-24 * [#1018](https://github.com/stripe/stripe-php/pull/1018) Multiple API changes * Updated PHPDocs * Added `TYPE_CONTRIBUTION` as a constant on `BalanceTransaction` ## 7.54.0 - 2020-09-23 * [#1017](https://github.com/stripe/stripe-php/pull/1017) Updated PHPDoc ## 7.53.1 - 2020-09-22 * [#1015](https://github.com/stripe/stripe-php/pull/1015) Bugfix: don't error on systems with php_uname in disablefunctions with whitespace ## 7.53.0 - 2020-09-21 * [#1016](https://github.com/stripe/stripe-php/pull/1016) Updated PHPDocs ## 7.52.0 - 2020-09-08 * [#1010](https://github.com/stripe/stripe-php/pull/1010) Update PHPDocs ## 7.51.0 - 2020-09-02 * [#1007](https://github.com/stripe/stripe-php/pull/1007) Multiple API changes * Add support for the Issuing Dispute Submit API * Add constants for `payment_status` on Checkout `Session` * [#1003](https://github.com/stripe/stripe-php/pull/1003) Add trim to getSignatures to allow for leading whitespace. ## 7.50.0 - 2020-08-28 * [#1005](https://github.com/stripe/stripe-php/pull/1005) Updated PHPDocs ## 7.49.0 - 2020-08-19 * [#998](https://github.com/stripe/stripe-php/pull/998) PHPDocs updated ## 7.48.0 - 2020-08-17 * [#997](https://github.com/stripe/stripe-php/pull/997) PHPDocs updated * [#996](https://github.com/stripe/stripe-php/pull/996) Fixing telemetry ## 7.47.0 - 2020-08-13 * [#994](https://github.com/stripe/stripe-php/pull/994) Nullable balance_transactions on issuing disputes * [#991](https://github.com/stripe/stripe-php/pull/991) Fix invalid return types in OAuthService ## 7.46.1 - 2020-08-07 * [#990](https://github.com/stripe/stripe-php/pull/990) PHPdoc changes ## 7.46.0 - 2020-08-05 * [#989](https://github.com/stripe/stripe-php/pull/989) Add support for the `PromotionCode` resource and APIs ## 7.45.0 - 2020-07-28 * [#981](https://github.com/stripe/stripe-php/pull/981) PHPdoc updates ## 7.44.0 - 2020-07-20 * [#948](https://github.com/stripe/stripe-php/pull/948) Add `first()` and `last()` functions to `Collection` ## 7.43.0 - 2020-07-17 * [#975](https://github.com/stripe/stripe-php/pull/975) Add support for `political_exposure` on `Person` ## 7.42.0 - 2020-07-15 * [#974](https://github.com/stripe/stripe-php/pull/974) Add new constants for `purpose` on `File` ## 7.41.1 - 2020-07-15 * [#973](https://github.com/stripe/stripe-php/pull/973) Multiple PHPDoc fixes ## 7.41.0 - 2020-07-14 * [#971](https://github.com/stripe/stripe-php/pull/971) Adds enum values for `billing_address_collection` on Checkout `Session` ## 7.40.0 - 2020-07-06 * [#964](https://github.com/stripe/stripe-php/pull/964) Add OAuthService ## 7.39.0 - 2020-06-25 * [#960](https://github.com/stripe/stripe-php/pull/960) Add constants for `payment_behavior` on `Subscription` ## 7.38.0 - 2020-06-24 * [#959](https://github.com/stripe/stripe-php/pull/959) Add multiple constants missing for `Event` ## 7.37.2 - 2020-06-23 * [#957](https://github.com/stripe/stripe-php/pull/957) Updated PHPDocs ## 7.37.1 - 2020-06-11 * [#952](https://github.com/stripe/stripe-php/pull/952) Improve PHPDoc ## 7.37.0 - 2020-06-09 * [#950](https://github.com/stripe/stripe-php/pull/950) Add support for `id_npwp` and `my_frp` as `type` on `TaxId` ## 7.36.2 - 2020-06-03 * [#946](https://github.com/stripe/stripe-php/pull/946) Update PHPDoc ## 7.36.1 - 2020-05-28 * [#938](https://github.com/stripe/stripe-php/pull/938) Remove extra array_keys() call. * [#942](https://github.com/stripe/stripe-php/pull/942) fix autopagination for service methods ## 7.36.0 - 2020-05-21 * [#937](https://github.com/stripe/stripe-php/pull/937) Add support for `ae_trn`, `cl_tin` and `sa_vat` as `type` on `TaxId` ## 7.35.0 - 2020-05-20 * [#936](https://github.com/stripe/stripe-php/pull/936) Add `anticipation_repayment` as a `type` on `BalanceTransaction` ## 7.34.0 - 2020-05-18 * [#934](https://github.com/stripe/stripe-php/pull/934) Add support for `issuing_dispute` as a `type` on `BalanceTransaction` ## 7.33.1 - 2020-05-15 * [#933](https://github.com/stripe/stripe-php/pull/933) Services bugfix: convert nested null params to empty strings ## 7.33.0 - 2020-05-14 * [#771](https://github.com/stripe/stripe-php/pull/771) Introduce client/services API. The [migration guide](https://github.com/stripe/stripe-php/wiki/Migration-to-StripeClient-and-services-in-7.33.0) contains before & after examples of the backwards-compatible changes. ## 7.32.1 - 2020-05-13 * [#932](https://github.com/stripe/stripe-php/pull/932) Fix multiple PHPDoc ## 7.32.0 - 2020-05-11 * [#931](https://github.com/stripe/stripe-php/pull/931) Add support for the `LineItem` resource and APIs ## 7.31.0 - 2020-05-01 * [#927](https://github.com/stripe/stripe-php/pull/927) Add support for new tax IDs ## 7.30.0 - 2020-04-29 * [#924](https://github.com/stripe/stripe-php/pull/924) Add support for the `Price` resource and APIs ## 7.29.0 - 2020-04-22 * [#920](https://github.com/stripe/stripe-php/pull/920) Add support for the `Session` resource and APIs on the `BillingPortal` namespace ## 7.28.1 - 2020-04-10 * [#915](https://github.com/stripe/stripe-php/pull/915) Improve PHPdocs for many classes ## 7.28.0 - 2020-04-03 * [#912](https://github.com/stripe/stripe-php/pull/912) Preserve backwards compatibility for typoed `TYPE_ADJUSTEMENT` enum. * [#911](https://github.com/stripe/stripe-php/pull/911) Codegenerated PHPDoc for nested resources * [#902](https://github.com/stripe/stripe-php/pull/902) Update docstrings for nested resources ## 7.27.3 - 2020-03-18 * [#899](https://github.com/stripe/stripe-php/pull/899) Convert keys to strings in `StripeObject::toArray()` ## 7.27.2 - 2020-03-13 * [#894](https://github.com/stripe/stripe-php/pull/894) Multiple PHPDocs changes ## 7.27.1 - 2020-03-03 * [#890](https://github.com/stripe/stripe-php/pull/890) Update PHPdoc ## 7.27.0 - 2020-02-28 * [#889](https://github.com/stripe/stripe-php/pull/889) Add new constants for `type` on `TaxId` ## 7.26.0 - 2020-02-26 * [#886](https://github.com/stripe/stripe-php/pull/886) Add support for listing Checkout `Session` * [#883](https://github.com/stripe/stripe-php/pull/883) Add PHPDoc class descriptions ## 7.25.0 - 2020-02-14 * [#879](https://github.com/stripe/stripe-php/pull/879) Make `\Stripe\Collection` implement `\Countable` * [#875](https://github.com/stripe/stripe-php/pull/875) Last set of PHP-CS-Fixer updates * [#874](https://github.com/stripe/stripe-php/pull/874) Enable php_unit_internal_class rule * [#873](https://github.com/stripe/stripe-php/pull/873) Add support for phpDocumentor in Makefile * [#872](https://github.com/stripe/stripe-php/pull/872) Another batch of PHP-CS-Fixer rule updates * [#871](https://github.com/stripe/stripe-php/pull/871) Fix a few PHPDoc comments * [#870](https://github.com/stripe/stripe-php/pull/870) More PHP-CS-Fixer tweaks ## 7.24.0 - 2020-02-10 * [#862](https://github.com/stripe/stripe-php/pull/862) Better PHPDoc * [#865](https://github.com/stripe/stripe-php/pull/865) Get closer to `@PhpCsFixer` standard ruleset ## 7.23.0 - 2020-02-05 * [#860](https://github.com/stripe/stripe-php/pull/860) Add PHPDoc types for expandable fields * [#858](https://github.com/stripe/stripe-php/pull/858) Use `native_function_invocation` PHPStan rule * [#857](https://github.com/stripe/stripe-php/pull/857) Update PHPDoc on nested resources * [#855](https://github.com/stripe/stripe-php/pull/855) PHPDoc: `StripeObject` -> `ErrorObject` where appropriate * [#837](https://github.com/stripe/stripe-php/pull/837) Autogen diff * [#854](https://github.com/stripe/stripe-php/pull/854) Upgrade PHPStan and fix settings * [#850](https://github.com/stripe/stripe-php/pull/850) Yet more PHPDoc updates ## 7.22.0 - 2020-01-31 * [#849](https://github.com/stripe/stripe-php/pull/849) Add new constants for `type` on `TaxId` * [#843](https://github.com/stripe/stripe-php/pull/843) Even more PHPDoc fixes * [#841](https://github.com/stripe/stripe-php/pull/841) More PHPDoc fixes ## 7.21.1 - 2020-01-29 * [#840](https://github.com/stripe/stripe-php/pull/840) Update phpdocs across multiple resources. ## 7.21.0 - 2020-01-28 * [#839](https://github.com/stripe/stripe-php/pull/839) Add support for `TYPE_ES_CIF` on `TaxId` ## 7.20.0 - 2020-01-23 * [#836](https://github.com/stripe/stripe-php/pull/836) Add new type values for `TaxId` ## 7.19.1 - 2020-01-14 * [#831](https://github.com/stripe/stripe-php/pull/831) Fix incorrect `UnexpectedValueException` instantiation ## 7.19.0 - 2020-01-14 * [#830](https://github.com/stripe/stripe-php/pull/830) Add support for `CreditNoteLineItem` ## 7.18.0 - 2020-01-13 * [#829](https://github.com/stripe/stripe-php/pull/829) Don't call php_uname function if disabled by php.ini ## 7.17.0 - 2020-01-08 * [#821](https://github.com/stripe/stripe-php/pull/821) Improve PHPDoc types for `ApiErrorException.get/setJsonBody()` methods ## 7.16.0 - 2020-01-06 * [#826](https://github.com/stripe/stripe-php/pull/826) Rename remaining `$options` to `$opts` * [#825](https://github.com/stripe/stripe-php/pull/825) Update PHPDoc ## 7.15.0 - 2020-01-06 * [#824](https://github.com/stripe/stripe-php/pull/824) Add constant `TYPE_SG_UEN` to `TaxId` ## 7.14.2 - 2019-12-04 * [#816](https://github.com/stripe/stripe-php/pull/816) Disable autoloader when checking for `Throwable` ## 7.14.1 - 2019-11-26 * [#812](https://github.com/stripe/stripe-php/pull/812) Fix invalid PHPdoc on `Subscription` ## 7.14.0 - 2019-11-26 * [#811](https://github.com/stripe/stripe-php/pull/811) Add support for `CreditNote` preview. ## 7.13.0 - 2019-11-19 * [#808](https://github.com/stripe/stripe-php/pull/808) Add support for listing lines on an Invoice directly via `Invoice::allLines()` ## 7.12.0 - 2019-11-08 - [#805](https://github.com/stripe/stripe-php/pull/805) Add Source::allSourceTransactions and SubscriptionItem::allUsageRecordSummaries - [#798](https://github.com/stripe/stripe-php/pull/798) The argument of `array_key_exists` cannot be `null` - [#803](https://github.com/stripe/stripe-php/pull/803) Removed unwanted got ## 7.11.0 - 2019-11-06 - [#797](https://github.com/stripe/stripe-php/pull/797) Add support for reverse pagination ## 7.10.0 - 2019-11-05 - [#795](https://github.com/stripe/stripe-php/pull/795) Add support for `Mandate` ## 7.9.0 - 2019-11-05 - [#794](https://github.com/stripe/stripe-php/pull/794) Add PHPDoc to `ApiResponse` - [#792](https://github.com/stripe/stripe-php/pull/792) Use single quotes for `OBJECT_NAME` constants ## 7.8.0 - 2019-11-05 - [#790](https://github.com/stripe/stripe-php/pull/790) Mark nullable fields in PHPDoc - [#788](https://github.com/stripe/stripe-php/pull/788) Early codegen fixes - [#787](https://github.com/stripe/stripe-php/pull/787) Use PHPStan in Travis CI ## 7.7.1 - 2019-10-25 - [#781](https://github.com/stripe/stripe-php/pull/781) Fix telemetry header - [#780](https://github.com/stripe/stripe-php/pull/780) Contributor Convenant ## 7.7.0 - 2019-10-23 - [#776](https://github.com/stripe/stripe-php/pull/776) Add `CAPABILITY_TRANSFERS` to `Account` - [#778](https://github.com/stripe/stripe-php/pull/778) Add support for `TYPE_MX_RFC` type on `TaxId` ## 7.6.0 - 2019-10-22 - [#770](https://github.com/stripe/stripe-php/pull/770) Add missing constants for Customer's `TaxId` ## 7.5.0 - 2019-10-18 - [#768](https://github.com/stripe/stripe-php/pull/768) Redact API key in `RequestOptions` debug info ## 7.4.0 - 2019-10-15 - [#764](https://github.com/stripe/stripe-php/pull/764) Add support for HTTP request monitoring callback ## 7.3.1 - 2019-10-07 - [#755](https://github.com/stripe/stripe-php/pull/755) Respect Stripe-Should-Retry and Retry-After headers ## 7.3.0 - 2019-10-02 - [#752](https://github.com/stripe/stripe-php/pull/752) Add `payment_intent.canceled` and `setup_intent.canceled` events - [#749](https://github.com/stripe/stripe-php/pull/749) Call `toArray()` on objects only ## 7.2.2 - 2019-09-24 - [#746](https://github.com/stripe/stripe-php/pull/746) Add missing decline codes ## 7.2.1 - 2019-09-23 - [#744](https://github.com/stripe/stripe-php/pull/744) Added new PHPDoc ## 7.2.0 - 2019-09-17 - [#738](https://github.com/stripe/stripe-php/pull/738) Added missing constants for `SetupIntent` events ## 7.1.1 - 2019-09-16 - [#737](https://github.com/stripe/stripe-php/pull/737) Added new PHPDoc ## 7.1.0 - 2019-09-13 - [#736](https://github.com/stripe/stripe-php/pull/736) Make `CaseInsensitiveArray` countable and traversable ## 7.0.2 - 2019-09-06 - [#729](https://github.com/stripe/stripe-php/pull/729) Fix usage of `SignatureVerificationException` in PHPDoc blocks ## 7.0.1 - 2019-09-05 - [#728](https://github.com/stripe/stripe-php/pull/728) Clean up Collection ## 7.0.0 - 2019-09-03 Major version release. The [migration guide](https://github.com/stripe/stripe-php/wiki/Migration-guide-for-v7) contains a detailed list of backwards-incompatible changes with upgrade instructions. Pull requests included in this release (cf. [#552](https://github.com/stripe/stripe-php/pull/552)) (⚠️ = breaking changes): - ⚠️ Drop support for PHP 5.4 ([#551](https://github.com/stripe/stripe-php/pull/551)) - ⚠️ Drop support for PHP 5.5 ([#554](https://github.com/stripe/stripe-php/pull/554)) - Bump dependencies ([#553](https://github.com/stripe/stripe-php/pull/553)) - Remove `CURLFile` check ([#555](https://github.com/stripe/stripe-php/pull/555)) - Update constant definitions for PHP >= 5.6 ([#556](https://github.com/stripe/stripe-php/pull/556)) - ⚠️ Remove `FileUpload` alias ([#557](https://github.com/stripe/stripe-php/pull/557)) - Remove `curl_reset` check ([#570](https://github.com/stripe/stripe-php/pull/570)) - Use `\Stripe\::class` constant instead of strings ([#643](https://github.com/stripe/stripe-php/pull/643)) - Use `array_column` to flatten params ([#686](https://github.com/stripe/stripe-php/pull/686)) - ⚠️ Remove deprecated methods ([#692](https://github.com/stripe/stripe-php/pull/692)) - ⚠️ Remove `IssuerFraudRecord` ([#696](https://github.com/stripe/stripe-php/pull/696)) - Update constructors of Stripe exception classes ([#559](https://github.com/stripe/stripe-php/pull/559)) - Fix remaining TODOs ([#700](https://github.com/stripe/stripe-php/pull/700)) - Use yield for autopagination ([#703](https://github.com/stripe/stripe-php/pull/703)) - ⚠️ Rename fake magic methods and rewrite array conversion ([#704](https://github.com/stripe/stripe-php/pull/704)) - Add `ErrorObject` to Stripe exceptions ([#705](https://github.com/stripe/stripe-php/pull/705)) - Start using PHP CS Fixer ([#706](https://github.com/stripe/stripe-php/pull/706)) - Update error messages for nested resource operations ([#708](https://github.com/stripe/stripe-php/pull/708)) - Upgrade retry logic ([#707](https://github.com/stripe/stripe-php/pull/707)) - ⚠️ `Collection` improvements / fixes ([#715](https://github.com/stripe/stripe-php/pull/715)) - ⚠️ Modernize exceptions ([#709](https://github.com/stripe/stripe-php/pull/709)) - Add constants for error codes ([#716](https://github.com/stripe/stripe-php/pull/716)) - Update certificate bundle ([#717](https://github.com/stripe/stripe-php/pull/717)) - Retry requests on a 429 that's a lock timeout ([#718](https://github.com/stripe/stripe-php/pull/718)) - Fix `toArray()` calls ([#719](https://github.com/stripe/stripe-php/pull/719)) - Couple of fixes for PHP 7.4 ([#725](https://github.com/stripe/stripe-php/pull/725)) ## 6.43.1 - 2019-08-29 - [#722](https://github.com/stripe/stripe-php/pull/722) Make `LoggerInterface::error` compatible with its PSR-3 counterpart - [#714](https://github.com/stripe/stripe-php/pull/714) Add `pending_setup_intent` property in `Subscription` - [#713](https://github.com/stripe/stripe-php/pull/713) Add typehint to `ApiResponse` - [#712](https://github.com/stripe/stripe-php/pull/712) Fix comment - [#701](https://github.com/stripe/stripe-php/pull/701) Start testing PHP 7.3 ## 6.43.0 - 2019-08-09 - [#694](https://github.com/stripe/stripe-php/pull/694) Add `SubscriptionItem::createUsageRecord` method ## 6.42.0 - 2019-08-09 - [#688](https://github.com/stripe/stripe-php/pull/688) Remove `SubscriptionScheduleRevision` - Note that this is technically a breaking change, however we've chosen to release it as a minor version in light of the fact that this resource and its API methods were virtually unused. ## 6.41.0 - 2019-07-31 - [#683](https://github.com/stripe/stripe-php/pull/683) Move the List Balance History API to `/v1/balance_transactions` ## 6.40.0 - 2019-06-27 - [#675](https://github.com/stripe/stripe-php/pull/675) Add support for `SetupIntent` resource and APIs ## 6.39.2 - 2019-06-26 - [#676](https://github.com/stripe/stripe-php/pull/676) Fix exception message in `CustomerBalanceTransaction::update()` ## 6.39.1 - 2019-06-25 - [#674](https://github.com/stripe/stripe-php/pull/674) Add new constants for `collection_method` on `Invoice` ## 6.39.0 - 2019-06-24 - [#673](https://github.com/stripe/stripe-php/pull/673) Enable request latency telemetry by default ## 6.38.0 - 2019-06-17 - [#649](https://github.com/stripe/stripe-php/pull/649) Add support for `CustomerBalanceTransaction` resource and APIs ## 6.37.2 - 2019-06-17 - [#671](https://github.com/stripe/stripe-php/pull/671) Add new PHPDoc - [#672](https://github.com/stripe/stripe-php/pull/672) Add constants for `submit_type` on Checkout `Session` ## 6.37.1 - 2019-06-14 - [#670](https://github.com/stripe/stripe-php/pull/670) Add new PHPDoc ## 6.37.0 - 2019-05-23 - [#663](https://github.com/stripe/stripe-php/pull/663) Add support for `radar.early_fraud_warning` resource ## 6.36.0 - 2019-05-22 - [#661](https://github.com/stripe/stripe-php/pull/661) Add constants for new TaxId types - [#662](https://github.com/stripe/stripe-php/pull/662) Add constants for BalanceTransaction types ## 6.35.2 - 2019-05-20 - [#655](https://github.com/stripe/stripe-php/pull/655) Add constants for payment intent statuses - [#659](https://github.com/stripe/stripe-php/pull/659) Fix PHPDoc for various nested Account actions - [#660](https://github.com/stripe/stripe-php/pull/660) Fix various PHPDoc ## 6.35.1 - 2019-05-20 - [#658](https://github.com/stripe/stripe-php/pull/658) Use absolute value when checking timestamp tolerance ## 6.35.0 - 2019-05-14 - [#651](https://github.com/stripe/stripe-php/pull/651) Add support for the Capability resource and APIs ## 6.34.6 - 2019-05-13 - [#654](https://github.com/stripe/stripe-php/pull/654) Fix typo in definition of `Event::PAYMENT_METHOD_ATTACHED` constant ## 6.34.5 - 2019-05-06 - [#647](https://github.com/stripe/stripe-php/pull/647) Set the return type to static for more operations ## 6.34.4 - 2019-05-06 - [#650](https://github.com/stripe/stripe-php/pull/650) Add missing constants for Event types ## 6.34.3 - 2019-05-01 - [#644](https://github.com/stripe/stripe-php/pull/644) Update return type to `static` to improve static analysis - [#645](https://github.com/stripe/stripe-php/pull/645) Fix constant for `payment_intent.payment_failed` ## 6.34.2 - 2019-04-26 - [#642](https://github.com/stripe/stripe-php/pull/642) Fix an issue where existing idempotency keys would be overwritten when using automatic retries ## 6.34.1 - 2019-04-25 - [#640](https://github.com/stripe/stripe-php/pull/640) Add missing phpdocs ## 6.34.0 - 2019-04-24 - [#626](https://github.com/stripe/stripe-php/pull/626) Add support for the `TaxRate` resource and APIs - [#639](https://github.com/stripe/stripe-php/pull/639) Fix multiple phpdoc issues ## 6.33.0 - 2019-04-22 - [#630](https://github.com/stripe/stripe-php/pull/630) Add support for the `TaxId` resource and APIs ## 6.32.1 - 2019-04-19 - [#636](https://github.com/stripe/stripe-php/pull/636) Correct type of `$personId` in PHPDoc ## 6.32.0 - 2019-04-18 - [#621](https://github.com/stripe/stripe-php/pull/621) Add support for `CreditNote` ## 6.31.5 - 2019-04-12 - [#628](https://github.com/stripe/stripe-php/pull/628) Add constants for `person.*` event types - [#628](https://github.com/stripe/stripe-php/pull/628) Add missing constants for `Account` and `Person` ## 6.31.4 - 2019-04-05 - [#624](https://github.com/stripe/stripe-php/pull/624) Fix encoding of nested parameters in multipart requests ## 6.31.3 - 2019-04-02 - [#623](https://github.com/stripe/stripe-php/pull/623) Only use HTTP/2 with curl >= 7.60.0 ## 6.31.2 - 2019-03-25 - [#619](https://github.com/stripe/stripe-php/pull/619) Fix PHPDoc return types for list methods for nested resources ## 6.31.1 - 2019-03-22 - [#612](https://github.com/stripe/stripe-php/pull/612) Add a lot of constants - [#614](https://github.com/stripe/stripe-php/pull/614) Add missing subscription status constants ## 6.31.0 - 2019-03-18 - [#600](https://github.com/stripe/stripe-php/pull/600) Add support for the `PaymentMethod` resource and APIs - [#606](https://github.com/stripe/stripe-php/pull/606) Add support for retrieving a Checkout `Session` - [#611](https://github.com/stripe/stripe-php/pull/611) Add support for deleting a Terminal `Location` and `Reader` ## 6.30.5 - 2019-03-11 - [#607](https://github.com/stripe/stripe-php/pull/607) Correctly handle case where a metadata key is called `metadata` ## 6.30.4 - 2019-02-27 - [#602](https://github.com/stripe/stripe-php/pull/602) Add `subscription_schedule` to `Subscription` for PHPDoc. ## 6.30.3 - 2019-02-26 - [#603](https://github.com/stripe/stripe-php/pull/603) Improve PHPDoc on the `Source` object to cover all types of Sources currently supported. ## 6.30.2 - 2019-02-25 - [#601](https://github.com/stripe/stripe-php/pull/601) Fix PHPDoc across multiple resources and add support for new events. ## 6.30.1 - 2019-02-16 - [#599](https://github.com/stripe/stripe-php/pull/599) Fix PHPDoc for `SubscriptionSchedule` and `SubscriptionScheduleRevision` ## 6.30.0 - 2019-02-12 - [#590](https://github.com/stripe/stripe-php/pull/590) Add support for `SubscriptionSchedule` and `SubscriptionScheduleRevision` ## 6.29.3 - 2019-01-31 - [#592](https://github.com/stripe/stripe-php/pull/592) Some more PHPDoc fixes ## 6.29.2 - 2019-01-31 - [#591](https://github.com/stripe/stripe-php/pull/591) Fix PHPDoc for nested resources ## 6.29.1 - 2019-01-25 - [#566](https://github.com/stripe/stripe-php/pull/566) Fix dangling message contents - [#586](https://github.com/stripe/stripe-php/pull/586) Don't overwrite `CURLOPT_HTTP_VERSION` option ## 6.29.0 - 2019-01-23 - [#579](https://github.com/stripe/stripe-php/pull/579) Rename `CheckoutSession` to `Session` and move it under the `Checkout` namespace. This is a breaking change, but we've reached out to affected merchants and all new merchants would use the new approach. ## 6.28.1 - 2019-01-21 - [#580](https://github.com/stripe/stripe-php/pull/580) Properly serialize `individual` on `Account` objects ## 6.28.0 - 2019-01-03 - [#576](https://github.com/stripe/stripe-php/pull/576) Add support for iterating directly over `Collection` instances ## 6.27.0 - 2018-12-21 - [#571](https://github.com/stripe/stripe-php/pull/571) Add support for the `CheckoutSession` resource ## 6.26.0 - 2018-12-11 - [#568](https://github.com/stripe/stripe-php/pull/568) Enable persistent connections ## 6.25.0 - 2018-12-10 - [#567](https://github.com/stripe/stripe-php/pull/567) Add support for account links ## 6.24.0 - 2018-11-28 - [#562](https://github.com/stripe/stripe-php/pull/562) Add support for the Review resource - [#564](https://github.com/stripe/stripe-php/pull/564) Add event name constants for subscription schedule aborted/expiring ## 6.23.0 - 2018-11-27 - [#542](https://github.com/stripe/stripe-php/pull/542) Add support for `ValueList` and `ValueListItem` for Radar ## 6.22.1 - 2018-11-20 - [#561](https://github.com/stripe/stripe-php/pull/561) Add cast and some docs to telemetry introduced in 6.22.0/549 ## 6.22.0 - 2018-11-15 - [#549](https://github.com/stripe/stripe-php/pull/549) Add support for client telemetry ## 6.21.1 - 2018-11-12 - [#548](https://github.com/stripe/stripe-php/pull/548) Don't mutate `Exception` class properties from `OAuthBase` error ## 6.21.0 - 2018-11-08 - [#537](https://github.com/stripe/stripe-php/pull/537) Add new API endpoints for the `Invoice` resource. ## 6.20.1 - 2018-11-07 - [#546](https://github.com/stripe/stripe-php/pull/546) Drop files from the Composer package that aren't needed in the release ## 6.20.0 - 2018-10-30 - [#536](https://github.com/stripe/stripe-php/pull/536) Add support for the `Person` resource - [#541](https://github.com/stripe/stripe-php/pull/541) Add support for the `WebhookEndpoint` resource ## 6.19.5 - 2018-10-17 - [#539](https://github.com/stripe/stripe-php/pull/539) Fix methods on `\Stripe\PaymentIntent` to properly pass arguments to the API. ## 6.19.4 - 2018-10-11 - [#534](https://github.com/stripe/stripe-php/pull/534) Fix PSR-4 autoloading for `\Stripe\FileUpload` class alias ## 6.19.3 - 2018-10-09 - [#530](https://github.com/stripe/stripe-php/pull/530) Add constants for `flow` (`FLOW_*`), `status` (`STATUS_*`) and `usage` (`USAGE_*`) on `\Stripe\Source` ## 6.19.2 - 2018-10-08 - [#531](https://github.com/stripe/stripe-php/pull/531) Store HTTP response headers in case-insensitive array ## 6.19.1 - 2018-09-25 - [#526](https://github.com/stripe/stripe-php/pull/526) Ignore null values in request parameters ## 6.19.0 - 2018-09-24 - [#523](https://github.com/stripe/stripe-php/pull/523) Add support for Stripe Terminal ## 6.18.0 - 2018-09-24 - [#520](https://github.com/stripe/stripe-php/pull/520) Rename `\Stripe\FileUpload` to `\Stripe\File` ## 6.17.2 - 2018-09-18 - [#522](https://github.com/stripe/stripe-php/pull/522) Fix warning when adding a new additional owner to an existing array ## 6.17.1 - 2018-09-14 - [#517](https://github.com/stripe/stripe-php/pull/517) Integer-index encode all sequential arrays ## 6.17.0 - 2018-09-05 - [#514](https://github.com/stripe/stripe-php/pull/514) Add support for reporting resources ## 6.16.0 - 2018-08-23 - [#509](https://github.com/stripe/stripe-php/pull/509) Add support for usage record summaries ## 6.15.0 - 2018-08-03 - [#504](https://github.com/stripe/stripe-php/pull/504) Add cancel support for topups ## 6.14.0 - 2018-08-02 - [#505](https://github.com/stripe/stripe-php/pull/505) Add support for file links ## 6.13.0 - 2018-07-31 - [#502](https://github.com/stripe/stripe-php/pull/502) Add `isDeleted()` method to `\Stripe\StripeObject` ## 6.12.0 - 2018-07-28 - [#501](https://github.com/stripe/stripe-php/pull/501) Add support for scheduled query runs (`\Stripe\Sigma\ScheduledQueryRun`) for Sigma ## 6.11.0 - 2018-07-26 - [#500](https://github.com/stripe/stripe-php/pull/500) Add support for Stripe Issuing ## 6.10.4 - 2018-07-19 - [#498](https://github.com/stripe/stripe-php/pull/498) Internal improvements to the `\Stripe\ApiResource.classUrl()` method ## 6.10.3 - 2018-07-16 - [#497](https://github.com/stripe/stripe-php/pull/497) Use HTTP/2 only for HTTPS requests ## 6.10.2 - 2018-07-11 - [#494](https://github.com/stripe/stripe-php/pull/494) Enable HTTP/2 support ## 6.10.1 - 2018-07-10 - [#493](https://github.com/stripe/stripe-php/pull/493) Add PHPDoc for `auto_advance` on `\Stripe\Invoice` ## 6.10.0 - 2018-06-28 - [#488](https://github.com/stripe/stripe-php/pull/488) Add support for `$appPartnerId` to `Stripe::setAppInfo()` ## 6.9.0 - 2018-06-28 - [#487](https://github.com/stripe/stripe-php/pull/487) Add support for payment intents ## 6.8.2 - 2018-06-24 - [#486](https://github.com/stripe/stripe-php/pull/486) Make `Account.deauthorize()` return the `StripeObject` from the API ## 6.8.1 - 2018-06-13 - [#472](https://github.com/stripe/stripe-php/pull/472) Added phpDoc for `ApiRequestor` and others, especially regarding thrown errors ## 6.8.0 - 2018-06-13 - [#481](https://github.com/stripe/stripe-php/pull/481) Add new `\Stripe\Discount` and `\Stripe\OrderItem` classes, add more PHPDoc describing object attributes ## 6.7.4 - 2018-05-29 - [#480](https://github.com/stripe/stripe-php/pull/480) PHPDoc changes for API version 2018-05-21 and the addition of the new `CHARGE_EXPIRED` event type ## 6.7.3 - 2018-05-28 - [#479](https://github.com/stripe/stripe-php/pull/479) Fix unnecessary traits on `\Stripe\InvoiceLineItem` ## 6.7.2 - 2018-05-28 - [#471](https://github.com/stripe/stripe-php/pull/471) Add `OBJECT_NAME` constant to all API resource classes, add `\Stripe\InvoiceLineItem` class ## 6.7.1 - 2018-05-13 - [#468](https://github.com/stripe/stripe-php/pull/468) Update fields in PHP docs for accuracy ## 6.7.0 - 2018-05-09 - [#466](https://github.com/stripe/stripe-php/pull/466) Add support for issuer fraud records ## 6.6.0 - 2018-04-11 - [#460](https://github.com/stripe/stripe-php/pull/460) Add support for flexible billing primitives ## 6.5.0 - 2018-04-05 - [#461](https://github.com/stripe/stripe-php/pull/461) Don't zero keys on non-`metadata` subobjects ## 6.4.2 - 2018-03-17 - [#458](https://github.com/stripe/stripe-php/pull/458) Add PHPDoc for `account` on `\Stripe\Event` ## 6.4.1 - 2018-03-02 - [#455](https://github.com/stripe/stripe-php/pull/455) Fix namespaces in PHPDoc - [#456](https://github.com/stripe/stripe-php/pull/456) Fix namespaces for some exceptions ## 6.4.0 - 2018-02-28 - [#453](https://github.com/stripe/stripe-php/pull/453) Add constants for `reason` (`REASON_*`) and `status` (`STATUS_*`) on `\Stripe\Dispute` ## 6.3.2 - 2018-02-27 - [#452](https://github.com/stripe/stripe-php/pull/452) Add PHPDoc for `amount_paid` and `amount_remaining` on `\Stripe\Invoice` ## 6.3.1 - 2018-02-26 - [#443](https://github.com/stripe/stripe-php/pull/443) Add event types as constants to `\Stripe\Event` class ## 6.3.0 - 2018-02-23 - [#450](https://github.com/stripe/stripe-php/pull/450) Add support for `code` attribute on all Stripe exceptions ## 6.2.0 - 2018-02-21 - [#440](https://github.com/stripe/stripe-php/pull/440) Add support for topups - [#442](https://github.com/stripe/stripe-php/pull/442) Fix PHPDoc for `\Stripe\Error\SignatureVerification` ## 6.1.0 - 2018-02-12 - [#435](https://github.com/stripe/stripe-php/pull/435) Fix header persistence on `Collection` objects - [#436](https://github.com/stripe/stripe-php/pull/436) Introduce new `Idempotency` error class ## 6.0.0 - 2018-02-07 Major version release. List of backwards incompatible changes to watch out for: - The minimum PHP version is now 5.4.0. If you're using PHP 5.3 or older, consider upgrading to a more recent version. * `\Stripe\AttachedObject` no longer exists. Attributes that used to be instances of `\Stripe\AttachedObject` (such as `metadata`) are now instances of `\Stripe\StripeObject`. - Attributes that used to be PHP arrays (such as `legal_entity->additional_owners` on `\Stripe\Account` instances) are now instances of `\Stripe\StripeObject`, except when they are empty. `\Stripe\StripeObject` has array semantics so this should not be an issue unless you are actively checking types. * `\Stripe\Collection` now derives from `\Stripe\StripeObject` rather than from `\Stripe\ApiResource`. Pull requests included in this release: - [#410](https://github.com/stripe/stripe-php/pull/410) Drop support for PHP 5.3 - [#411](https://github.com/stripe/stripe-php/pull/411) Use traits for common API operations - [#414](https://github.com/stripe/stripe-php/pull/414) Use short array syntax - [#404](https://github.com/stripe/stripe-php/pull/404) Fix serialization logic - [#417](https://github.com/stripe/stripe-php/pull/417) Remove `ExternalAccount` class - [#418](https://github.com/stripe/stripe-php/pull/418) Increase test coverage - [#421](https://github.com/stripe/stripe-php/pull/421) Update CA bundle and add script for future updates - [#422](https://github.com/stripe/stripe-php/pull/422) Use vendored CA bundle for all requests - [#428](https://github.com/stripe/stripe-php/pull/428) Support for automatic request retries ## 5.9.2 - 2018-02-07 - [#431](https://github.com/stripe/stripe-php/pull/431) Update PHPDoc @property tags for latest API version ## 5.9.1 - 2018-02-06 - [#427](https://github.com/stripe/stripe-php/pull/427) Add and update PHPDoc @property tags on all API resources ## 5.9.0 - 2018-01-17 - [#421](https://github.com/stripe/stripe-php/pull/421) Updated bundled CA certificates - [#423](https://github.com/stripe/stripe-php/pull/423) Escape unsanitized input in OAuth example ## 5.8.0 - 2017-12-20 - [#403](https://github.com/stripe/stripe-php/pull/403) Add `__debugInfo()` magic method to `StripeObject` ## 5.7.0 - 2017-11-28 - [#390](https://github.com/stripe/stripe-php/pull/390) Remove some unsupported API methods - [#391](https://github.com/stripe/stripe-php/pull/391) Alphabetize the list of API resources in `Util::convertToStripeObject()` and add missing resources - [#393](https://github.com/stripe/stripe-php/pull/393) Fix expiry date update for card sources ## 5.6.0 - 2017-10-31 - [#386](https://github.com/stripe/stripe-php/pull/386) Support for exchange rates APIs ## 5.5.1 - 2017-10-30 - [#387](https://github.com/stripe/stripe-php/pull/387) Allow `personal_address_kana` and `personal_address_kanji` to be updated on an account ## 5.5.0 - 2017-10-27 - [#385](https://github.com/stripe/stripe-php/pull/385) Support for listing source transactions ## 5.4.0 - 2017-10-24 - [#383](https://github.com/stripe/stripe-php/pull/383) Add static methods to manipulate resources from parent - `Account` gains methods for external accounts and login links (e.g. `createExternalAccount`, `createLoginLink`) - `ApplicationFee` gains methods for refunds - `Customer` gains methods for sources - `Transfer` gains methods for reversals ## 5.3.0 - 2017-10-11 - [#378](https://github.com/stripe/stripe-php/pull/378) Rename source `delete` to `detach` (and deprecate the former) ## 5.2.3 - 2017-09-27 - Add PHPDoc for `Card` ## 5.2.2 - 2017-09-20 - Fix deserialization mapping of `FileUpload` objects ## 5.2.1 - 2017-09-14 - Serialized `shipping` nested attribute ## 5.2.0 - 2017-08-29 - Add support for `InvalidClient` OAuth error ## 5.1.3 - 2017-08-14 - Allow `address_kana` and `address_kanji` to be updated for custom accounts ## 5.1.2 - 2017-08-01 - Fix documented return type of `autoPagingIterator()` (was missing namespace) ## 5.1.1 - 2017-07-03 - Fix order returns to use the right URL `/v1/order_returns` ## 5.1.0 - 2017-06-30 - Add support for OAuth ## 5.0.0 - 2017-06-27 - `pay` on invoice now takes params as well as opts ## 4.13.0 - 2017-06-19 - Add support for ephemeral keys ## 4.12.0 - 2017-06-05 - Clients can implement `getUserAgentInfo()` to add additional user agent information ## 4.11.0 - 2017-06-05 - Implement `Countable` for `AttachedObject` (`metadata` and `additional_owners`) ## 4.10.0 - 2017-05-25 - Add support for login links ## 4.9.1 - 2017-05-10 - Fix docs to include arrays on `$id` parameter for retrieve methods ## 4.9.0 - 2017-04-28 - Support for checking webhook signatures ## 4.8.1 - 2017-04-24 - Allow nested field `payout_schedule` to be updated ## 4.8.0 - 2017-04-20 - Add `\Stripe\Stripe::setLogger()` to support an external PSR-3 compatible logger ## 4.7.0 - 2017-04-10 - Add support for payouts and recipient transfers ## 4.6.0 - 2017-04-06 - Please see 4.7.0 instead (no-op release) ## 4.5.1 - 2017-03-22 - Remove hard dependency on cURL ## 4.5.0 - 2017-03-20 - Support for detaching sources from customers ## 4.4.2 - 2017-02-27 - Correct handling of `owner` parameter when updating sources ## 4.4.1 - 2017-02-24 - Correct the error check on a bad JSON decoding ## 4.4.0 - 2017-01-18 - Add support for updating sources ## 4.3.0 - 2016-11-30 - Add support for verifying sources ## 4.2.0 - 2016-11-21 - Add retrieve method for 3-D Secure resources ## 4.1.1 - 2016-10-21 - Add docblock with model properties for `Plan` ## 4.1.0 - 2016-10-18 - Support for 403 status codes (permission denied) ## 4.0.1 - 2016-10-17 - Fix transfer reversal materialization - Fixes for some property definitions in docblocks ## 4.0.0 - 2016-09-28 - Support for subscription items - Drop attempt to force TLS 1.2: please note that this could be breaking if you're using old OS distributions or packages and upgraded recently (so please make sure to test your integration!) ## 3.23.0 - 2016-09-15 - Add support for Apple Pay domains ## 3.22.0 - 2016-09-13 - Add `Stripe::setAppInfo` to allow plugins to register user agent information ## 3.21.0 - 2016-08-25 - Add `Source` model for generic payment sources ## 3.20.0 - 2016-08-08 - Add `getDeclineCode` to card errors ## 3.19.0 - 2016-07-29 - Opt requests directly into TLS 1.2 where OpenSSL >= 1.0.1 (see #277 for context) ## 3.18.0 - 2016-07-28 - Add new `STATUS_` constants for subscriptions ## 3.17.1 - 2016-07-28 - Fix auto-paging iterator so that it plays nicely with `iterator_to_array` ## 3.17.0 - 2016-07-14 - Add field annotations to model classes for better editor hinting ## 3.16.0 - 2016-07-12 - Add `ThreeDSecure` model for 3-D secure payments ## 3.15.0 - 2016-06-29 - Add static `update` method to all resources that can be changed. ## 3.14.3 - 2016-06-20 - Make sure that cURL never sends `Expects: 100-continue`, even on large request bodies ## 3.14.2 - 2016-06-03 - Add `inventory` under `SKU` to list of keys that have nested data and can be updated ## 3.14.1 - 2016-05-27 - Fix some inconsistencies in PHPDoc ## 3.14.0 - 2016-05-25 - Add support for returning Relay orders ## 3.13.0 - 2016-05-04 - Add `list`, `create`, `update`, `retrieve`, and `delete` methods to the Subscription class ## 3.12.1 - 2016-04-07 - Additional check on value arrays for some extra safety ## 3.12.0 - 2016-03-31 - Fix bug `refreshFrom` on `StripeObject` would not take an `$opts` array - Fix bug where `$opts` not passed to parent `save` method in `Account` - Fix bug where non-existent variable was referenced in `reverse` in `Transfer` - Update CA cert bundle for compatibility with OpenSSL versions below 1.0.1 ## 3.11.0 - 2016-03-22 - Allow `CurlClient` to be initialized with default `CURLOPT_*` options ## 3.10.1 - 2016-03-22 - Fix bug where request params and options were ignored in `ApplicationFee`'s `refund.` ## 3.10.0 - 2016-03-15 - Add `reject` on `Account` to support the new API feature ## 3.9.2 - 2016-03-04 - Fix error when an object's metadata is set more than once ## 3.9.1 - 2016-02-24 - Fix encoding behavior of nested arrays for requests (see #227) ## 3.9.0 - 2016-02-09 - Add automatic pagination mechanism with `autoPagingIterator()` - Allow global account ID to be set with `Stripe::setAccountId()` ## 3.8.0 - 2016-02-08 - Add `CountrySpec` model for looking up country payment information ## 3.7.1 - 2016-02-01 - Update bundled CA certs ## 3.7.0 - 2016-01-27 - Support deleting Relay products and SKUs ## 3.6.0 - 2016-01-05 - Allow configuration of HTTP client timeouts ## 3.5.0 - 2015-12-01 - Add a verification routine for external accounts ## 3.4.0 - 2015-09-14 - Products, SKUs, and Orders -- https://stripe.com/relay ## 3.3.0 - 2015-09-11 - Add support for 429 Rate Limit response ## 3.2.0 - 2015-08-17 - Add refund listing and retrieval without an associated charge ## 3.1.0 - 2015-08-03 - Add dispute listing and retrieval - Add support for manage account deletion ## 3.0.0 - 2015-07-28 - Rename `\Stripe\Object` to `\Stripe\StripeObject` (PHP 7 compatibility) - Rename `getCode` and `getParam` in exceptions to `getStripeCode` and `getStripeParam` - Add support for calling `json_encode` on Stripe objects in PHP 5.4+ - Start supporting/testing PHP 7 ## 2.3.0 - 2015-07-06 - Add request ID to all Stripe exceptions ## 2.2.0 - 2015-06-01 - Add support for Alipay accounts as sources - Add support for bank accounts as sources (private beta) - Add support for bank accounts and cards as external_accounts on Account objects ## 2.1.4 - 2015-05-13 - Fix CA certificate file path (thanks @lphilps & @matthewarkin) ## 2.1.3 - 2015-05-12 - Fix to account updating to permit `tos_acceptance` and `personal_address` to be set properly - Fix to Transfer reversal creation (thanks @neatness!) - Network requests are now done through a swappable class for easier mocking ## 2.1.2 - 2015-04-10 - Remove SSL cert revokation checking (all pre-Heartbleed certs have expired) - Bug fixes to account updating ## 2.1.1 - 2015-02-27 - Support transfer reversals ## 2.1.0 - 2015-02-19 - Support new API version (2015-02-18) - Added Bitcoin Receiever update and delete actions - Edited tests to prefer "source" over "card" as per new API version ## 2.0.1 - 2015-02-16 - Fix to fetching endpoints that use a non-default baseUrl (`FileUpload`) ## 2.0.0 - 2015-02-14 - Bumped minimum version to 5.3.3 - Switched to Stripe namespace instead of Stripe\_ class name prefiexes (thanks @chadicus!) - Switched tests to PHPUnit (thanks @chadicus!) - Switched style guide to PSR2 (thanks @chadicus!) - Added \$opts hash to the end of most methods: this permits passing 'idempotency_key', 'stripe_account', or 'stripe_version'. The last 2 will persist across multiple object loads. - Added support for retrieving Account by ID ## 1.18.0 - 2015-01-21 - Support making bitcoin charges through BitcoinReceiver source object ## 1.17.5 - 2014-12-23 - Adding support for creating file uploads. ## 1.17.4 - 2014-12-15 - Saving objects fetched with a custom key now works (thanks @JustinHook & @jpasilan) - Added methods for reporting charges as safe or fraudulent and for specifying the reason for refunds ## 1.17.3 - 2014-11-06 - Better handling of HHVM support for SSL certificate blacklist checking. ## 1.17.2 - 2014-09-23 - Coupons now are backed by a `Stripe_Coupon` instead of `Stripe_Object`, and support updating metadata - Running operations (`create`, `retrieve`, `all`) on upcoming invoice items now works ## 1.17.1 - 2014-07-31 - Requests now send Content-Type header ## 1.17.0 - 2014-07-29 - Application Fee refunds now a list instead of array - HHVM now works - Small bug fixes (thanks @bencromwell & @fastest963) - `__toString` now returns the name of the object in addition to its JSON representation ## 1.16.0 - 2014-06-17 - Add metadata for refunds and disputes ## 1.15.0 - 2014-05-28 - Support canceling transfers ## 1.14.1 - 2014-05-21 - Support cards for recipients. ## 1.13.1 - 2014-05-15 - Fix bug in account resource where `id` wasn't in the result ## 1.13.0 - 2014-04-10 - Add support for certificate blacklisting - Update ca bundle - Drop support for HHVM (Temporarily) ## 1.12.0 - 2014-04-01 - Add Stripe_RateLimitError for catching rate limit errors. - Update to Zend coding style (thanks, @jpiasetz) ## 1.11.0 - 2014-01-29 - Add support for multiple subscriptions per customer ## 1.10.1 - 2013-12-02 - Add new ApplicationFee ## 1.9.1 - 2013-11-08 - Fix a bug where a null nestable object causes warnings to fire. ## 1.9.0 - 2013-10-16 - Add support for metadata API. ## 1.8.4 - 2013-09-18 - Add support for closing disputes. ## 1.8.3 - 2013-08-13 - Add new Balance and BalanceTransaction ## 1.8.2 - 2013-08-12 - Add support for unsetting attributes by updating to NULL. Setting properties to a blank string is now an error. ## 1.8.1 - 2013-07-12 - Add support for multiple cards API (Stripe API version 2013-07-12: https://stripe.com/docs/upgrades#2013-07-05) ## 1.8.0 - 2013-04-11 - Allow Transfers to be creatable - Add new Recipient resource ## 1.7.15 - 2013-02-21 - Add 'id' to the list of permanent object attributes ## 1.7.14 - 2013-02-20 - Don't re-encode strings that are already encoded in UTF-8. If you were previously using plan or coupon objects with UTF-8 IDs, they may have been treated as ISO-8859-1 (Latin-1) and encoded to UTF-8 a 2nd time. You may now need to pass the IDs to utf8_encode before passing them to Stripe_Plan::retrieve or Stripe_Coupon::retrieve. - Ensure that all input is encoded in UTF-8 before submitting it to Stripe's servers. (github issue #27) ## 1.7.13 - 2013-02-01 - Add support for passing options when retrieving Stripe objects e.g., Stripe_Charge::retrieve(array("id"=>"foo", "expand" => array("customer"))); Stripe_Charge::retrieve("foo") will continue to work ## 1.7.12 - 2013-01-15 - Add support for setting a Stripe API version override ## 1.7.11 - 2012-12-30 - Version bump to cleanup constants and such (fix issue #26) ## 1.7.10 - 2012-11-08 - Add support for updating charge disputes. - Fix bug preventing retrieval of null attributes ## 1.7.9 - 2012-11-08 - Fix usage under autoloaders such as the one generated by composer (fix issue #22) ## 1.7.8 - 2012-10-30 - Add support for creating invoices. - Add support for new invoice lines return format - Add support for new list objects ## 1.7.7 - 2012-09-14 - Get all of the various version numbers in the repo in sync (no other changes) ## 1.7.6 - 2012-08-31 - Add update and pay methods to Invoice resource ## 1.7.5 - 2012-08-23 - Change internal function names so that Stripe_SingletonApiRequest is E_STRICT-clean (github issue #16) ## 1.7.4 - 2012-08-21 - Bugfix so that Stripe objects (e.g. Customer, Charge objects) used in API calls are transparently converted to their object IDs ## 1.7.3 - 2012-08-15 - Add new Account resource ## 1.7.2 - 2012-06-26 - Make clearer that you should be including lib/Stripe.php, not test/Stripe.php (github issue #14) ## 1.7.1 - 2012-05-24 - Add missing argument to Stripe_InvalidRequestError constructor in Stripe_ApiResource::instanceUrl. Fixes a warning when Stripe_ApiResource::instanceUrl is called on a resource with no ID (fix issue #12) ## 1.7.0 - 2012-05-17 - Support Composer and Packagist (github issue #9) - Add new deleteDiscount method to Stripe_Customer - Add new Transfer resource - Switch from using HTTP Basic auth to Bearer auth. (Note: Stripe will support Basic auth for the indefinite future, but recommends Bearer auth when possible going forward) - Numerous test suite improvements diff --git a/plugin/StripeYPT/Makefile b/plugin/StripeYPT/Makefile index 78c586816..61b6de53e 100644 --- a/plugin/StripeYPT/Makefile +++ b/plugin/StripeYPT/Makefile @@ -1,36 +1,36 @@ -export PHPDOCUMENTOR_VERSION := v3.0.0-rc -export PHPSTAN_VERSION := 0.12.18 +export PHPDOCUMENTOR_VERSION := v3.0.0 +export PHPSTAN_VERSION := 0.12.59 vendor: composer.json composer install vendor/bin/phpstan: vendor curl -sfL https://github.com/phpstan/phpstan/releases/download/$(PHPSTAN_VERSION)/phpstan.phar -o vendor/bin/phpstan chmod +x vendor/bin/phpstan vendor/bin/phpdoc: vendor curl -sfL https://github.com/phpDocumentor/phpDocumentor/releases/download/$(PHPDOCUMENTOR_VERSION)/phpDocumentor.phar -o vendor/bin/phpdoc chmod +x vendor/bin/phpdoc test: vendor vendor/bin/phpunit .PHONY: test fmt: vendor vendor/bin/php-cs-fixer fix -v --using-cache=no . .PHONY: fmt fmtcheck: vendor vendor/bin/php-cs-fixer fix -v --dry-run --using-cache=no . .PHONY: fmtcheck phpdoc: vendor/bin/phpdoc vendor/bin/phpdoc phpstan: vendor/bin/phpstan php -d memory_limit=512M vendor/bin/phpstan analyse lib tests .PHONY: phpstan phpstan-baseline: vendor/bin/phpstan php -d memory_limit=512M vendor/bin/phpstan analyse lib tests --generate-baseline .PHONY: phpstan-baseline diff --git a/plugin/StripeYPT/README.md b/plugin/StripeYPT/README.md index 1be6aa1be..45b364058 100644 --- a/plugin/StripeYPT/README.md +++ b/plugin/StripeYPT/README.md @@ -1,266 +1,270 @@ # Stripe PHP bindings [![Build Status](https://travis-ci.org/stripe/stripe-php.svg?branch=master)](https://travis-ci.org/stripe/stripe-php) [![Latest Stable Version](https://poser.pugx.org/stripe/stripe-php/v/stable.svg)](https://packagist.org/packages/stripe/stripe-php) [![Total Downloads](https://poser.pugx.org/stripe/stripe-php/downloads.svg)](https://packagist.org/packages/stripe/stripe-php) [![License](https://poser.pugx.org/stripe/stripe-php/license.svg)](https://packagist.org/packages/stripe/stripe-php) [![Code Coverage](https://coveralls.io/repos/stripe/stripe-php/badge.svg?branch=master)](https://coveralls.io/r/stripe/stripe-php?branch=master) The Stripe PHP library provides convenient access to the Stripe API from applications written in the PHP language. It includes a pre-defined set of classes for API resources that initialize themselves dynamically from API responses which makes it compatible with a wide range of versions of the Stripe API. ## Requirements PHP 5.6.0 and later. ## Composer You can install the bindings via [Composer](http://getcomposer.org/). Run the following command: ```bash composer require stripe/stripe-php ``` To use the bindings, use Composer's [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading): ```php require_once('vendor/autoload.php'); ``` ## Manual Installation If you do not wish to use Composer, you can download the [latest release](https://github.com/stripe/stripe-php/releases). Then, to use the bindings, include the `init.php` file. ```php require_once('/path/to/stripe-php/init.php'); ``` ## Dependencies The bindings require the following extensions in order to work properly: - [`curl`](https://secure.php.net/manual/en/book.curl.php), although you can use your own non-cURL client if you prefer - [`json`](https://secure.php.net/manual/en/book.json.php) - [`mbstring`](https://secure.php.net/manual/en/book.mbstring.php) (Multibyte String) If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available. ## Getting Started Simple usage looks like: ```php $stripe = new \Stripe\StripeClient('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); $customer = $stripe->customers->create([ 'description' => 'example customer', 'email' => 'email@example.com', 'payment_method' => 'pm_card_visa', ]); echo $customer; ``` ### Client/service patterns vs legacy patterns You can continue to use the legacy integration patterns used prior to version [7.33.0](https://github.com/stripe/stripe-php/blob/master/CHANGELOG.md#7330---2020-05-14). Review the [migration guide](https://github.com/stripe/stripe-php/wiki/Migration-to-StripeClient-and-services-in-7.33.0) for the backwards-compatible client/services pattern changes. ## Documentation See the [PHP API docs](https://stripe.com/docs/api/php#intro). +See [video demonstrations][youtube-playlist] covering how to use the library. + + ## Legacy Version Support ### PHP 5.4 & 5.5 If you are using PHP 5.4 or 5.5, you can download v6.21.1 ([zip](https://github.com/stripe/stripe-php/archive/v6.21.1.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v6.21.1.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses. ### PHP 5.3 If you are using PHP 5.3, you can download v5.9.2 ([zip](https://github.com/stripe/stripe-php/archive/v5.9.2.zip), [tar.gz](https://github.com/stripe/stripe-php/archive/v5.9.2.tar.gz)) from our [releases page](https://github.com/stripe/stripe-php/releases). This version will continue to work with new versions of the Stripe API for all common uses. ## Custom Request Timeouts _NOTE:_ We do not recommend decreasing the timeout for non-read-only calls (e.g. charge creation), since even if you locally timeout, the request on Stripe's side can still complete. If you are decreasing timeouts on these calls, make sure to use [idempotency tokens](https://stripe.com/docs/api/php#idempotent_requests) to avoid executing the same transaction twice as a result of timeout retry logic. To modify request timeouts (connect or total, in seconds) you'll need to tell the API client to use a CurlClient other than its default. You'll set the timeouts in that CurlClient. ```php // set up your tweaked Curl client $curl = new \Stripe\HttpClient\CurlClient(); $curl->setTimeout(10); // default is \Stripe\HttpClient\CurlClient::DEFAULT_TIMEOUT $curl->setConnectTimeout(5); // default is \Stripe\HttpClient\CurlClient::DEFAULT_CONNECT_TIMEOUT echo $curl->getTimeout(); // 10 echo $curl->getConnectTimeout(); // 5 // tell Stripe to use the tweaked client \Stripe\ApiRequestor::setHttpClient($curl); // use the Stripe API client as you normally would ``` ## Custom cURL Options (e.g. proxies) Need to set a proxy for your requests? Pass in the requisite `CURLOPT_*` array to the CurlClient constructor, using the same syntax as `curl_stopt_array()`. This will set the default cURL options for each HTTP request made by the SDK, though many more common options (e.g. timeouts; see above on how to set those) will be overridden by the client even if set here. ```php // set up your tweaked Curl client $curl = new \Stripe\HttpClient\CurlClient([CURLOPT_PROXY => 'proxy.local:80']); // tell Stripe to use the tweaked client \Stripe\ApiRequestor::setHttpClient($curl); ``` Alternately, a callable can be passed to the CurlClient constructor that returns the above array based on request inputs. See `testDefaultOptions()` in `tests/CurlClientTest.php` for an example of this behavior. Note that the callable is called at the beginning of every API request, before the request is sent. ### Configuring a Logger The library does minimal logging, but it can be configured with a [`PSR-3` compatible logger][psr3] so that messages end up there instead of `error_log`: ```php \Stripe\Stripe::setLogger($logger); ``` ### Accessing response data You can access the data from the last API response on any object via `getLastResponse()`. ```php $customer = $stripe->customers->create([ 'description' => 'example customer', ]); echo $customer->getLastResponse()->headers['Request-Id']; ``` ### SSL / TLS compatibility issues Stripe's API now requires that [all connections use TLS 1.2](https://stripe.com/blog/upgrading-tls). Some systems (most notably some older CentOS and RHEL versions) are capable of using TLS 1.2 but will use TLS 1.0 or 1.1 by default. In this case, you'd get an `invalid_request_error` with the following error message: "Stripe no longer supports API requests made with TLS 1.0. Please initiate HTTPS connections with TLS 1.2 or later. You can learn more about this at [https://stripe.com/blog/upgrading-tls](https://stripe.com/blog/upgrading-tls).". The recommended course of action is to [upgrade your cURL and OpenSSL packages](https://support.stripe.com/questions/how-do-i-upgrade-my-stripe-integration-from-tls-1-0-to-tls-1-2#php) so that TLS 1.2 is used by default, but if that is not possible, you might be able to solve the issue by setting the `CURLOPT_SSLVERSION` option to either `CURL_SSLVERSION_TLSv1` or `CURL_SSLVERSION_TLSv1_2`: ```php $curl = new \Stripe\HttpClient\CurlClient([CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1]); \Stripe\ApiRequestor::setHttpClient($curl); ``` ### Per-request Configuration For apps that need to use multiple keys during the lifetime of a process, like one that uses [Stripe Connect][connect], it's also possible to set a per-request key and/or account: ```php $customers = $stripe->customers->all([],[ 'api_key' => 'sk_test_...', 'stripe_account' => 'acct_...' ]); $stripe->customers->retrieve('cus_123456789', [], [ 'api_key' => 'sk_test_...', 'stripe_account' => 'acct_...' ]); ``` ### Configuring CA Bundles By default, the library will use its own internal bundle of known CA certificates, but it's possible to configure your own: ```php \Stripe\Stripe::setCABundlePath("path/to/ca/bundle"); ``` ### Configuring Automatic Retries The library can be configured to automatically retry requests that fail due to an intermittent network problem: ```php \Stripe\Stripe::setMaxNetworkRetries(2); ``` [Idempotency keys][idempotency-keys] are added to requests to guarantee that retries are safe. ### Request latency telemetry By default, the library sends request latency telemetry to Stripe. These numbers help Stripe improve the overall latency of its API for all users. You can disable this behavior if you prefer: ```php \Stripe\Stripe::setEnableTelemetry(false); ``` ## Development Get [Composer][composer]. For example, on Mac OS: ```bash brew install composer ``` Install dependencies: ```bash composer install ``` The test suite depends on [stripe-mock], so make sure to fetch and run it from a background terminal ([stripe-mock's README][stripe-mock] also contains instructions for installing via Homebrew and other methods): ```bash go get -u github.com/stripe/stripe-mock stripe-mock ``` Install dependencies as mentioned above (which will resolve [PHPUnit](http://packagist.org/packages/phpunit/phpunit)), then you can run the test suite: ```bash ./vendor/bin/phpunit ``` Or to run an individual test file: ```bash ./vendor/bin/phpunit tests/UtilTest.php ``` Update bundled CA certificates from the [Mozilla cURL release][curl]: ```bash ./update_certs.php ``` The library uses [PHP CS Fixer][php-cs-fixer] for code formatting. Code must be formatted before PRs are submitted, otherwise CI will fail. Run the formatter with: ```bash ./vendor/bin/php-cs-fixer fix -v . ``` ## Attention plugin developers Are you writing a plugin that integrates Stripe and embeds our library? Then please use the `setAppInfo` function to identify your plugin. For example: ```php \Stripe\Stripe::setAppInfo("MyAwesomePlugin", "1.2.34", "https://myawesomeplugin.info"); ``` The method should be called once, before any request is sent to the API. The second and third parameters are optional. ### SSL / TLS configuration option See the "SSL / TLS compatibility issues" paragraph above for full context. If you want to ensure that your plugin can be used on all systems, you should add a configuration option to let your users choose between different values for `CURLOPT_SSLVERSION`: none (default), `CURL_SSLVERSION_TLSv1` and `CURL_SSLVERSION_TLSv1_2`. [composer]: https://getcomposer.org/ [connect]: https://stripe.com/connect [curl]: http://curl.haxx.se/docs/caextract.html [idempotency-keys]: https://stripe.com/docs/api/php#idempotent_requests [php-cs-fixer]: https://github.com/FriendsOfPHP/PHP-CS-Fixer [psr3]: http://www.php-fig.org/psr/psr-3/ [stripe-mock]: https://github.com/stripe/stripe-mock +[youtube-playlist]: https://www.youtube.com/playlist?list=PLy1nL-pvL2M6cUbiHrfMkXxZ9j9SGBxFE diff --git a/plugin/StripeYPT/VERSION b/plugin/StripeYPT/VERSION index 0de24fd30..dd2241245 100644 --- a/plugin/StripeYPT/VERSION +++ b/plugin/StripeYPT/VERSION @@ -1 +1 @@ -7.66.1 +7.77.0 diff --git a/plugin/StripeYPT/build.php b/plugin/StripeYPT/build.php index 37360ffef..1a9e2bc4b 100644 --- a/plugin/StripeYPT/build.php +++ b/plugin/StripeYPT/build.php @@ -1,25 +1,25 @@ #!/usr/bin/env php =5.6.0", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*" }, "require-dev": { "phpunit/phpunit": "^5.7", "php-coveralls/php-coveralls": "^2.1", "squizlabs/php_codesniffer": "^3.3", "symfony/process": "~3.4", - "friendsofphp/php-cs-fixer": "2.16.5" + "friendsofphp/php-cs-fixer": "2.17.1" }, "autoload": { "psr-4": { "Stripe\\": "lib/" } }, "autoload-dev": { "psr-4": { "Stripe\\": [ "tests/", "tests/Stripe/" ] } }, "extra": { "branch-alias": { "dev-master": "2.0-dev" } } } diff --git a/plugin/StripeYPT/init.php b/plugin/StripeYPT/init.php index 11ac713da..0928c4d01 100644 --- a/plugin/StripeYPT/init.php +++ b/plugin/StripeYPT/init.php @@ -1,238 +1,240 @@ start(); // You can find your endpoint's secret in your webhook settings $endpoint_secret = trim($stripeObject->SigningSecret); $payload = @file_get_contents('php://input'); $sig_header = $_SERVER['HTTP_STRIPE_SIGNATURE']; $event = null; -$payloadObj = json_decode($payload); +$payloadObj = _json_decode($payload); //$payloadObj = object_to_array($payloadObj); //_error_log("StripeIPN: WEBHOOK: ".json_encode($webhook)); //_error_log("StripeIPN: payload ".json_encode($payloadObj)); //_error_log("StripeIPN: sig_header ".json_encode($sig_header)); $whitelist = array('invoice.payment_succeeded', 'charge.succeeded'); if(!in_array($payloadObj->type, $whitelist)){ //_error_log("StripeIPN: type ignored " . $payloadObj->type ); return ''; } _error_log("StripeIPN Start"); //_error_log("StripeIPN: ({$sig_header}) ({$endpoint_secret}} payload type: " . $payloadObj->type ); try { $event = \Stripe\Webhook::constructEvent( $payload, $sig_header, $endpoint_secret ); //_error_log("Stripe IPN Valid payload and signature ". json_encode($payloadObj)); if (StripeYPT::isSubscriptionPayment($payloadObj)) { _error_log("StripeIPN: ** Subscription **" ); // subscription $stripe->processSubscriptionIPN($payloadObj); } else if (StripeYPT::isSinglePayment($payloadObj)) { _error_log("StripeIPN: ** SinglePayment **" ); $stripe->processSinglePaymentIPN($payloadObj); }else{ //_error_log("StripeIPN: something went wrong: {$payload}" , AVideoLog::$ERROR ); } } catch (\UnexpectedValueException $e) { // Invalid payload _error_log("Stripe IPN Invalid payload "); http_response_code(400); // PHP 5.4 or greater exit(); } catch (\Stripe\Error\SignatureVerification $e) { // Invalid signature _error_log("Stripe IPN sig_header [$sig_header]"); _error_log("Stripe IPN endpoint_secret [$endpoint_secret]"); _error_log("Stripe IPN Invalid signature "); http_response_code(400); // PHP 5.4 or greater exit(); } if ($event->type == "payment_intent.succeeded") { $intent = $event->data->object; _error_log("Stripe IPN Succeeded: " . $intent->id); } elseif ($event->type == "payment_intent.payment_failed") { $intent = $event->data->object; $error_message = $intent->last_payment_error ? $intent->last_payment_error->message : ""; _error_log("Stripe IPN Failed: " . $intent->id . " " . $error_message); } //_error_log("StripeIPN: ".json_encode($obj)); _error_log("StripeIPN: POST " . json_encode($_POST)); _error_log("StripeIPN: GET " . json_encode($_GET)); _error_log("StripeIPN END"); ?> \ No newline at end of file diff --git a/plugin/StripeYPT/lib/Account.php b/plugin/StripeYPT/lib/Account.php index 5cd0d80da..669b1003b 100644 --- a/plugin/StripeYPT/lib/Account.php +++ b/plugin/StripeYPT/lib/Account.php @@ -1,431 +1,431 @@ create and manage Express or * Custom accounts. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|\Stripe\StripeObject $business_profile Business information about the account. * @property null|string $business_type The business type. * @property \Stripe\StripeObject $capabilities * @property bool $charges_enabled Whether the account can create live charges. * @property \Stripe\StripeObject $company * @property string $country The account's country. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $default_currency Three-letter ISO currency code representing the default currency for the account. This must be a currency that Stripe supports in the account's country. * @property bool $details_submitted Whether account details have been submitted. Standard accounts cannot receive payouts before this is true. - * @property null|string $email The primary user's email address. + * @property null|string $email An email address associated with the account. You can treat this as metadata: it is not used for authentication or messaging account holders. * @property \Stripe\Collection $external_accounts External accounts (bank accounts and debit cards) currently attached to this account - * @property \Stripe\Person $individual

This is an object representing a person associated with a Stripe account.

Related guide: Handling Identity Verification with the API.

+ * @property \Stripe\Person $individual

This is an object representing a person associated with a Stripe account.

A platform cannot access a Standard or Express account's persons after the account starts onboarding, such as after generating an account link for the account. See the Standard onboarding or Express onboarding documentation for information about platform pre-filling and account onboarding steps.

Related guide: Handling Identity Verification with the API.

* @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property bool $payouts_enabled Whether Stripe can send payouts to this account. * @property \Stripe\StripeObject $requirements * @property null|\Stripe\StripeObject $settings Options for customizing how the account functions within Stripe. * @property \Stripe\StripeObject $tos_acceptance * @property string $type The Stripe account type. Can be standard, express, or custom. */ class Account extends ApiResource { const OBJECT_NAME = 'account'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Delete; use ApiOperations\NestedResource; use ApiOperations\Update; const BUSINESS_TYPE_COMPANY = 'company'; const BUSINESS_TYPE_GOVERNMENT_ENTITY = 'government_entity'; const BUSINESS_TYPE_INDIVIDUAL = 'individual'; const BUSINESS_TYPE_NON_PROFIT = 'non_profit'; const CAPABILITY_CARD_PAYMENTS = 'card_payments'; const CAPABILITY_LEGACY_PAYMENTS = 'legacy_payments'; const CAPABILITY_PLATFORM_PAYMENTS = 'platform_payments'; const CAPABILITY_TRANSFERS = 'transfers'; const CAPABILITY_STATUS_ACTIVE = 'active'; const CAPABILITY_STATUS_INACTIVE = 'inactive'; const CAPABILITY_STATUS_PENDING = 'pending'; const TYPE_CUSTOM = 'custom'; const TYPE_EXPRESS = 'express'; const TYPE_STANDARD = 'standard'; use ApiOperations\Retrieve { retrieve as protected _retrieve; } public static function getSavedNestedResources() { static $savedNestedResources = null; if (null === $savedNestedResources) { $savedNestedResources = new Util\Set([ 'external_account', 'bank_account', ]); } return $savedNestedResources; } public function instanceUrl() { if (null === $this['id']) { return '/v1/account'; } return parent::instanceUrl(); } public function serializeParameters($force = false) { $update = parent::serializeParameters($force); if (isset($this->_values['legal_entity'])) { $entity = $this['legal_entity']; if (isset($entity->_values['additional_owners'])) { $owners = $entity['additional_owners']; $entityUpdate = isset($update['legal_entity']) ? $update['legal_entity'] : []; $entityUpdate['additional_owners'] = $this->serializeAdditionalOwners($entity, $owners); $update['legal_entity'] = $entityUpdate; } } if (isset($this->_values['individual'])) { $individual = $this['individual']; if (($individual instanceof Person) && !isset($update['individual'])) { $update['individual'] = $individual->serializeParameters($force); } } return $update; } private function serializeAdditionalOwners($legalEntity, $additionalOwners) { if (isset($legalEntity->_originalValues['additional_owners'])) { $originalValue = $legalEntity->_originalValues['additional_owners']; } else { $originalValue = []; } if (($originalValue) && (\count($originalValue) > \count($additionalOwners))) { throw new Exception\InvalidArgumentException( 'You cannot delete an item from an array, you must instead set a new array' ); } $updateArr = []; foreach ($additionalOwners as $i => $v) { $update = ($v instanceof StripeObject) ? $v->serializeParameters() : $v; if ([] !== $update) { - if (!$originalValue || - !\array_key_exists($i, $originalValue) || - ($update !== $legalEntity->serializeParamsValue($originalValue[$i], null, false, true))) { + if (!$originalValue + || !\array_key_exists($i, $originalValue) + || ($update !== $legalEntity->serializeParamsValue($originalValue[$i], null, false, true))) { $updateArr[$i] = $update; } } } return $updateArr; } /** * @param null|array|string $id the ID of the account to retrieve, or an * options array containing an `id` key * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\Account */ public static function retrieve($id = null, $opts = null) { if (!$opts && \is_string($id) && 'sk_' === \substr($id, 0, 3)) { $opts = $id; $id = null; } return self::_retrieve($id, $opts); } /** * @param null|array $clientId * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\StripeObject object containing the response from the API */ public function deauthorize($clientId = null, $opts = null) { $params = [ 'client_id' => $clientId, 'stripe_user_id' => $this->id, ]; return OAuth::deauthorize($params, $opts); } /** * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\Collection the list of persons */ public function persons($params = null, $opts = null) { $url = $this->instanceUrl() . '/persons'; list($response, $opts) = $this->_request('get', $url, $params, $opts); $obj = Util\Util::convertToStripeObject($response, $opts); $obj->setLastResponse($response); return $obj; } /** * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return Account the rejected account */ public function reject($params = null, $opts = null) { $url = $this->instanceUrl() . '/reject'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /* * Capabilities methods * We can not add the capabilities() method today as the Account object already has a * capabilities property which is a hash and not the sub-list of capabilities. */ const PATH_CAPABILITIES = '/capabilities'; /** * @param string $id the ID of the account on which to retrieve the capabilities * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\Collection the list of capabilities */ public static function allCapabilities($id, $params = null, $opts = null) { return self::_allNestedResources($id, static::PATH_CAPABILITIES, $params, $opts); } /** * @param string $id the ID of the account to which the capability belongs * @param string $capabilityId the ID of the capability to retrieve * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\Capability */ public static function retrieveCapability($id, $capabilityId, $params = null, $opts = null) { return self::_retrieveNestedResource($id, static::PATH_CAPABILITIES, $capabilityId, $params, $opts); } /** * @param string $id the ID of the account to which the capability belongs * @param string $capabilityId the ID of the capability to update * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\Capability */ public static function updateCapability($id, $capabilityId, $params = null, $opts = null) { return self::_updateNestedResource($id, static::PATH_CAPABILITIES, $capabilityId, $params, $opts); } const PATH_EXTERNAL_ACCOUNTS = '/external_accounts'; /** * @param string $id the ID of the account on which to retrieve the external accounts * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\Collection the list of external accounts (BankAccount or Card) */ public static function allExternalAccounts($id, $params = null, $opts = null) { return self::_allNestedResources($id, static::PATH_EXTERNAL_ACCOUNTS, $params, $opts); } /** * @param string $id the ID of the account on which to create the external account * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\BankAccount|\Stripe\Card */ public static function createExternalAccount($id, $params = null, $opts = null) { return self::_createNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $params, $opts); } /** * @param string $id the ID of the account to which the external account belongs * @param string $externalAccountId the ID of the external account to delete * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\BankAccount|\Stripe\Card */ public static function deleteExternalAccount($id, $externalAccountId, $params = null, $opts = null) { return self::_deleteNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts); } /** * @param string $id the ID of the account to which the external account belongs * @param string $externalAccountId the ID of the external account to retrieve * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\BankAccount|\Stripe\Card */ public static function retrieveExternalAccount($id, $externalAccountId, $params = null, $opts = null) { return self::_retrieveNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts); } /** * @param string $id the ID of the account to which the external account belongs * @param string $externalAccountId the ID of the external account to update * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\BankAccount|\Stripe\Card */ public static function updateExternalAccount($id, $externalAccountId, $params = null, $opts = null) { return self::_updateNestedResource($id, static::PATH_EXTERNAL_ACCOUNTS, $externalAccountId, $params, $opts); } const PATH_LOGIN_LINKS = '/login_links'; /** * @param string $id the ID of the account on which to create the login link * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\LoginLink */ public static function createLoginLink($id, $params = null, $opts = null) { return self::_createNestedResource($id, static::PATH_LOGIN_LINKS, $params, $opts); } const PATH_PERSONS = '/persons'; /** * @param string $id the ID of the account on which to retrieve the persons * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\Collection the list of persons */ public static function allPersons($id, $params = null, $opts = null) { return self::_allNestedResources($id, static::PATH_PERSONS, $params, $opts); } /** * @param string $id the ID of the account on which to create the person * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\Person */ public static function createPerson($id, $params = null, $opts = null) { return self::_createNestedResource($id, static::PATH_PERSONS, $params, $opts); } /** * @param string $id the ID of the account to which the person belongs * @param string $personId the ID of the person to delete * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\Person */ public static function deletePerson($id, $personId, $params = null, $opts = null) { return self::_deleteNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts); } /** * @param string $id the ID of the account to which the person belongs * @param string $personId the ID of the person to retrieve * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\Person */ public static function retrievePerson($id, $personId, $params = null, $opts = null) { return self::_retrieveNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts); } /** * @param string $id the ID of the account to which the person belongs * @param string $personId the ID of the person to update * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\Person */ public static function updatePerson($id, $personId, $params = null, $opts = null) { return self::_updateNestedResource($id, static::PATH_PERSONS, $personId, $params, $opts); } } diff --git a/plugin/StripeYPT/lib/ApiRequestor.php b/plugin/StripeYPT/lib/ApiRequestor.php index d3d7e7af1..048c462c0 100644 --- a/plugin/StripeYPT/lib/ApiRequestor.php +++ b/plugin/StripeYPT/lib/ApiRequestor.php @@ -1,515 +1,526 @@ _apiKey = $apiKey; if (!$apiBase) { $apiBase = Stripe::$apiBase; } $this->_apiBase = $apiBase; } /** * Creates a telemetry json blob for use in 'X-Stripe-Client-Telemetry' headers. * * @static * * @param RequestTelemetry $requestTelemetry * * @return string */ private static function _telemetryJson($requestTelemetry) { $payload = [ 'last_request_metrics' => [ 'request_id' => $requestTelemetry->requestId, 'request_duration_ms' => $requestTelemetry->requestDuration, ], ]; $result = \json_encode($payload); if (false !== $result) { return $result; } Stripe::getLogger()->error('Serializing telemetry payload failed!'); return '{}'; } /** * @static * * @param ApiResource|array|bool|mixed $d * * @return ApiResource|array|mixed|string */ private static function _encodeObjects($d) { if ($d instanceof ApiResource) { return Util\Util::utf8($d->id); } if (true === $d) { return 'true'; } if (false === $d) { return 'false'; } if (\is_array($d)) { $res = []; foreach ($d as $k => $v) { $res[$k] = self::_encodeObjects($v); } return $res; } return Util\Util::utf8($d); } /** * @param string $method * @param string $url * @param null|array $params * @param null|array $headers * * @throws Exception\ApiErrorException * * @return array tuple containing (ApiReponse, API key) */ public function request($method, $url, $params = null, $headers = null) { $params = $params ?: []; $headers = $headers ?: []; list($rbody, $rcode, $rheaders, $myApiKey) = $this->_requestRaw($method, $url, $params, $headers); $json = $this->_interpretResponse($rbody, $rcode, $rheaders); $resp = new ApiResponse($rbody, $rcode, $rheaders, $json); return [$resp, $myApiKey]; } /** * @param string $rbody a JSON string * @param int $rcode * @param array $rheaders * @param array $resp * * @throws Exception\UnexpectedValueException * @throws Exception\ApiErrorException */ public function handleErrorResponse($rbody, $rcode, $rheaders, $resp) { if (!\is_array($resp) || !isset($resp['error'])) { $msg = "Invalid response object from API: {$rbody} " . "(HTTP response code was {$rcode})"; throw new Exception\UnexpectedValueException($msg); } $errorData = $resp['error']; $error = null; if (\is_string($errorData)) { $error = self::_specificOAuthError($rbody, $rcode, $rheaders, $resp, $errorData); } if (!$error) { $error = self::_specificAPIError($rbody, $rcode, $rheaders, $resp, $errorData); } throw $error; } /** * @static * * @param string $rbody * @param int $rcode * @param array $rheaders * @param array $resp * @param array $errorData * * @return Exception\ApiErrorException */ private static function _specificAPIError($rbody, $rcode, $rheaders, $resp, $errorData) { $msg = isset($errorData['message']) ? $errorData['message'] : null; $param = isset($errorData['param']) ? $errorData['param'] : null; $code = isset($errorData['code']) ? $errorData['code'] : null; $type = isset($errorData['type']) ? $errorData['type'] : null; $declineCode = isset($errorData['decline_code']) ? $errorData['decline_code'] : null; switch ($rcode) { case 400: // 'rate_limit' code is deprecated, but left here for backwards compatibility // for API versions earlier than 2015-09-08 if ('rate_limit' === $code) { return Exception\RateLimitException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code, $param); } if ('idempotency_error' === $type) { return Exception\IdempotencyException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code); } // no break case 404: return Exception\InvalidRequestException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code, $param); + case 401: return Exception\AuthenticationException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code); + case 402: return Exception\CardException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code, $declineCode, $param); + case 403: return Exception\PermissionException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code); + case 429: return Exception\RateLimitException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code, $param); + default: return Exception\UnknownApiErrorException::factory($msg, $rcode, $rbody, $resp, $rheaders, $code); } } /** * @static * * @param bool|string $rbody * @param int $rcode * @param array $rheaders * @param array $resp * @param string $errorCode * * @return Exception\OAuth\OAuthErrorException */ private static function _specificOAuthError($rbody, $rcode, $rheaders, $resp, $errorCode) { $description = isset($resp['error_description']) ? $resp['error_description'] : $errorCode; switch ($errorCode) { case 'invalid_client': return Exception\OAuth\InvalidClientException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode); + case 'invalid_grant': return Exception\OAuth\InvalidGrantException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode); + case 'invalid_request': return Exception\OAuth\InvalidRequestException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode); + case 'invalid_scope': return Exception\OAuth\InvalidScopeException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode); + case 'unsupported_grant_type': return Exception\OAuth\UnsupportedGrantTypeException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode); + case 'unsupported_response_type': return Exception\OAuth\UnsupportedResponseTypeException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode); + default: return Exception\OAuth\UnknownOAuthErrorException::factory($description, $rcode, $rbody, $resp, $rheaders, $errorCode); } } /** * @static * * @param null|array $appInfo * * @return null|string */ private static function _formatAppInfo($appInfo) { if (null !== $appInfo) { $string = $appInfo['name']; if (null !== $appInfo['version']) { $string .= '/' . $appInfo['version']; } if (null !== $appInfo['url']) { $string .= ' (' . $appInfo['url'] . ')'; } return $string; } return null; } /** * @static * * @param string $disabledFunctionsOutput - String value of the 'disable_function' setting, as output by \ini_get('disable_functions') * @param string $functionName - Name of the function we are interesting in seeing whether or not it is disabled * @param mixed $disableFunctionsOutput * * @return bool */ private static function _isDisabled($disableFunctionsOutput, $functionName) { $disabledFunctions = \explode(',', $disableFunctionsOutput); foreach ($disabledFunctions as $disabledFunction) { if (\trim($disabledFunction) === $functionName) { return true; } } return false; } /** * @static * * @param string $apiKey * @param null $clientInfo * * @return array */ private static function _defaultHeaders($apiKey, $clientInfo = null) { $uaString = 'Stripe/v1 PhpBindings/' . Stripe::VERSION; $langVersion = \PHP_VERSION; $uname_disabled = static::_isDisabled(\ini_get('disable_functions'), 'php_uname'); $uname = $uname_disabled ? '(disabled)' : \php_uname(); $appInfo = Stripe::getAppInfo(); $ua = [ 'bindings_version' => Stripe::VERSION, 'lang' => 'php', 'lang_version' => $langVersion, 'publisher' => 'stripe', 'uname' => $uname, ]; if ($clientInfo) { $ua = \array_merge($clientInfo, $ua); } if (null !== $appInfo) { $uaString .= ' ' . self::_formatAppInfo($appInfo); $ua['application'] = $appInfo; } return [ 'X-Stripe-Client-User-Agent' => \json_encode($ua), 'User-Agent' => $uaString, 'Authorization' => 'Bearer ' . $apiKey, ]; } /** * @param string $method * @param string $url * @param array $params * @param array $headers * * @throws Exception\AuthenticationException * @throws Exception\ApiConnectionException * * @return array */ private function _requestRaw($method, $url, $params, $headers) { $myApiKey = $this->_apiKey; if (!$myApiKey) { $myApiKey = Stripe::$apiKey; } if (!$myApiKey) { $msg = 'No API key provided. (HINT: set your API key using ' . '"Stripe::setApiKey()". You can generate API keys from ' . 'the Stripe web interface. See https://stripe.com/api for ' . 'details, or email support@stripe.com if you have any questions.'; throw new Exception\AuthenticationException($msg); } // Clients can supply arbitrary additional keys to be included in the // X-Stripe-Client-User-Agent header via the optional getUserAgentInfo() // method $clientUAInfo = null; if (\method_exists($this->httpClient(), 'getUserAgentInfo')) { $clientUAInfo = $this->httpClient()->getUserAgentInfo(); } if ($params && \is_array($params)) { $optionKeysInParams = \array_filter( static::$OPTIONS_KEYS, function ($key) use ($params) { return \array_key_exists($key, $params); } ); if (\count($optionKeysInParams) > 0) { $message = \sprintf('Options found in $params: %s. Options should ' . 'be passed in their own array after $params. (HINT: pass an ' . 'empty array to $params if you do not have any.)', \implode(', ', $optionKeysInParams)); \trigger_error($message, \E_USER_WARNING); } } $absUrl = $this->_apiBase . $url; $params = self::_encodeObjects($params); $defaultHeaders = $this->_defaultHeaders($myApiKey, $clientUAInfo); if (Stripe::$apiVersion) { $defaultHeaders['Stripe-Version'] = Stripe::$apiVersion; } if (Stripe::$accountId) { $defaultHeaders['Stripe-Account'] = Stripe::$accountId; } if (Stripe::$enableTelemetry && null !== self::$requestTelemetry) { $defaultHeaders['X-Stripe-Client-Telemetry'] = self::_telemetryJson(self::$requestTelemetry); } $hasFile = false; foreach ($params as $k => $v) { if (\is_resource($v)) { $hasFile = true; $params[$k] = self::_processResourceParam($v); } elseif ($v instanceof \CURLFile) { $hasFile = true; } } if ($hasFile) { $defaultHeaders['Content-Type'] = 'multipart/form-data'; } else { $defaultHeaders['Content-Type'] = 'application/x-www-form-urlencoded'; } $combinedHeaders = \array_merge($defaultHeaders, $headers); $rawHeaders = []; foreach ($combinedHeaders as $header => $value) { $rawHeaders[] = $header . ': ' . $value; } $requestStartMs = Util\Util::currentTimeMillis(); list($rbody, $rcode, $rheaders) = $this->httpClient()->request( $method, $absUrl, $rawHeaders, $params, $hasFile ); if (isset($rheaders['request-id']) && \is_string($rheaders['request-id']) && \strlen($rheaders['request-id']) > 0) { self::$requestTelemetry = new RequestTelemetry( $rheaders['request-id'], Util\Util::currentTimeMillis() - $requestStartMs ); } return [$rbody, $rcode, $rheaders, $myApiKey]; } /** * @param resource $resource * * @throws Exception\InvalidArgumentException * * @return \CURLFile|string */ private function _processResourceParam($resource) { if ('stream' !== \get_resource_type($resource)) { throw new Exception\InvalidArgumentException( 'Attempted to upload a resource that is not a stream' ); } $metaData = \stream_get_meta_data($resource); if ('plainfile' !== $metaData['wrapper_type']) { throw new Exception\InvalidArgumentException( 'Only plainfile resource streams are supported' ); } // We don't have the filename or mimetype, but the API doesn't care return new \CURLFile($metaData['uri']); } /** * @param string $rbody * @param int $rcode * @param array $rheaders * * @throws Exception\UnexpectedValueException * @throws Exception\ApiErrorException * * @return array */ private function _interpretResponse($rbody, $rcode, $rheaders) { $resp = \json_decode($rbody, true); $jsonError = \json_last_error(); if (null === $resp && \JSON_ERROR_NONE !== $jsonError) { $msg = "Invalid response body from API: {$rbody} " . "(HTTP response code was {$rcode}, json_last_error() was {$jsonError})"; throw new Exception\UnexpectedValueException($msg, $rcode); } if ($rcode < 200 || $rcode >= 300) { $this->handleErrorResponse($rbody, $rcode, $rheaders, $resp); } return $resp; } /** * @static * * @param HttpClient\ClientInterface $client */ public static function setHttpClient($client) { self::$_httpClient = $client; } /** * @static * * Resets any stateful telemetry data */ public static function resetTelemetry() { self::$requestTelemetry = null; } /** * @return HttpClient\ClientInterface */ private function httpClient() { if (!self::$_httpClient) { self::$_httpClient = HttpClient\CurlClient::instance(); } return self::$_httpClient; } } diff --git a/plugin/StripeYPT/lib/ApiResource.php b/plugin/StripeYPT/lib/ApiResource.php index 064f99c1a..521010b3f 100644 --- a/plugin/StripeYPT/lib/ApiResource.php +++ b/plugin/StripeYPT/lib/ApiResource.php @@ -1,120 +1,120 @@ {$k}; - if ((static::getSavedNestedResources()->includes($k)) && - ($v instanceof ApiResource)) { + if ((static::getSavedNestedResources()->includes($k)) + && ($v instanceof ApiResource)) { $v->saveWithParent = true; } } /** * @throws Exception\ApiErrorException * * @return ApiResource the refreshed resource */ public function refresh() { $requestor = new ApiRequestor($this->_opts->apiKey, static::baseUrl()); $url = $this->instanceUrl(); list($response, $this->_opts->apiKey) = $requestor->request( 'get', $url, $this->_retrieveOptions, $this->_opts->headers ); $this->setLastResponse($response); $this->refreshFrom($response->json, $this->_opts); return $this; } /** * @return string the base URL for the given class */ public static function baseUrl() { return Stripe::$apiBase; } /** * @return string the endpoint URL for the given class */ public static function classUrl() { // Replace dots with slashes for namespaced resources, e.g. if the object's name is // "foo.bar", then its URL will be "/v1/foo/bars". $base = \str_replace('.', '/', static::OBJECT_NAME); return "/v1/{$base}s"; } /** * @param null|string $id the ID of the resource * * @throws Exception\UnexpectedValueException if $id is null * * @return string the instance endpoint URL for the given class */ public static function resourceUrl($id) { if (null === $id) { $class = static::class; $message = 'Could not determine which URL to request: ' . "{$class} instance has invalid ID: {$id}"; throw new Exception\UnexpectedValueException($message); } $id = Util\Util::utf8($id); $base = static::classUrl(); $extn = \urlencode($id); return "{$base}/{$extn}"; } /** * @return string the full API URL for this API resource */ public function instanceUrl() { return static::resourceUrl($this['id']); } } diff --git a/plugin/StripeYPT/lib/BillingPortal/Configuration.php b/plugin/StripeYPT/lib/BillingPortal/Configuration.php new file mode 100644 index 000000000..7ad1a0398 --- /dev/null +++ b/plugin/StripeYPT/lib/BillingPortal/Configuration.php @@ -0,0 +1,31 @@ +overriden when creating the session. + * @property \Stripe\StripeObject $features + * @property bool $is_default Whether the configuration is the default. If true, this configuration can be managed in the Dashboard and portal sessions will use this configuration unless it is overriden when creating the session. + * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. + * @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch. + */ +class Configuration extends \Stripe\ApiResource +{ + const OBJECT_NAME = 'billing_portal.configuration'; + + use \Stripe\ApiOperations\All; + use \Stripe\ApiOperations\Create; + use \Stripe\ApiOperations\Retrieve; + use \Stripe\ApiOperations\Update; +} diff --git a/plugin/StripeYPT/lib/BillingPortal/Session.php b/plugin/StripeYPT/lib/BillingPortal/Session.php index ec01275ac..ea11d515c 100644 --- a/plugin/StripeYPT/lib/BillingPortal/Session.php +++ b/plugin/StripeYPT/lib/BillingPortal/Session.php @@ -1,32 +1,42 @@ Billing - * customer portal. + * Learn more in the product + * overview and integration + * guide. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property string|\Stripe\BillingPortal\Configuration $configuration The configuration used by this session, describing the features available. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $customer The ID of the customer for this session. * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. - * @property string $return_url The URL to which Stripe should send customers when they click on the link to return to your website. - * @property string $url The short-lived URL of the session giving customers access to the customer portal. + * @property null|string $on_behalf_of The account for which the session was created on behalf of. When specified, only subscriptions and invoices with this on_behalf_of account appear in the portal. For more information, see the docs. Use the Accounts API to modify the on_behalf_of account's branding settings, which the portal displays. + * @property string $return_url The URL to redirect customers to when they click on the portal's link to return to your website. + * @property string $url The short-lived URL of the session that gives customers access to the customer portal. */ class Session extends \Stripe\ApiResource { const OBJECT_NAME = 'billing_portal.session'; use \Stripe\ApiOperations\Create; } diff --git a/plugin/StripeYPT/lib/Card.php b/plugin/StripeYPT/lib/Card.php index 106cd1811..7f757d641 100644 --- a/plugin/StripeYPT/lib/Card.php +++ b/plugin/StripeYPT/lib/Card.php @@ -1,142 +1,142 @@ Card Payments * with Sources. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|string|\Stripe\Account $account The account this card belongs to. This attribute will not be in the card object if the card belongs to a customer or recipient instead. * @property null|string $address_city City/District/Suburb/Town/Village. * @property null|string $address_country Billing address country, if provided when creating card. * @property null|string $address_line1 Address line 1 (Street address/PO Box/Company name). * @property null|string $address_line1_check If address_line1 was provided, results of the check: pass, fail, unavailable, or unchecked. * @property null|string $address_line2 Address line 2 (Apartment/Suite/Unit/Building). * @property null|string $address_state State/County/Province/Region. * @property null|string $address_zip ZIP or postal code. * @property null|string $address_zip_check If address_zip was provided, results of the check: pass, fail, unavailable, or unchecked. * @property null|string[] $available_payout_methods A set of available payout methods for this card. Only values from this set should be passed as the method when creating a payout. * @property string $brand Card brand. Can be American Express, Diners Club, Discover, JCB, MasterCard, UnionPay, Visa, or Unknown. * @property null|string $country Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected. * @property null|string $currency Three-letter ISO code for currency. Only applicable on accounts (not customers or recipients). The card can be used as a transfer destination for funds in this currency. * @property null|string|\Stripe\Customer $customer The customer that this card belongs to. This attribute will not be in the card object if the card belongs to an account or recipient instead. * @property null|string $cvc_check If a CVC was provided, results of the check: pass, fail, unavailable, or unchecked. A result of unchecked indicates that CVC was provided but hasn't been checked yet. Checks are typically performed when attaching a card to a Customer object, or when creating a charge. For more details, see Check if a card is valid without a charge. * @property null|bool $default_for_currency Whether this card is the default external account for its currency. * @property null|string $dynamic_last4 (For tokenized numbers only.) The last four digits of the device account number. * @property int $exp_month Two-digit number representing the card's expiration month. * @property int $exp_year Four-digit number representing the card's expiration year. - * @property null|string $fingerprint Uniquely identifies this particular card number. You can use this attribute to check whether two customers who’ve signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number. + * @property null|string $fingerprint

Uniquely identifies this particular card number. You can use this attribute to check whether two customers who’ve signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number.

Starting May 1, 2021, card fingerprint in India for Connect will change to allow two fingerprints for the same card --- one for India and one for the rest of the world.

* @property string $funding Card funding type. Can be credit, debit, prepaid, or unknown. * @property string $last4 The last four digits of the card. * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|string $name Cardholder name. * @property null|string|\Stripe\Recipient $recipient The recipient that this card belongs to. This attribute will not be in the card object if the card belongs to a customer or account instead. * @property null|string $tokenization_method If the card number is tokenized, this is the method that was used. Can be android_pay (includes Google Pay), apple_pay, masterpass, visa_checkout, or null. */ class Card extends ApiResource { const OBJECT_NAME = 'card'; use ApiOperations\Delete; use ApiOperations\Update; /** * Possible string representations of the CVC check status. * * @see https://stripe.com/docs/api/cards/object#card_object-cvc_check */ const CVC_CHECK_FAIL = 'fail'; const CVC_CHECK_PASS = 'pass'; const CVC_CHECK_UNAVAILABLE = 'unavailable'; const CVC_CHECK_UNCHECKED = 'unchecked'; /** * Possible string representations of the funding of the card. * * @see https://stripe.com/docs/api/cards/object#card_object-funding */ const FUNDING_CREDIT = 'credit'; const FUNDING_DEBIT = 'debit'; const FUNDING_PREPAID = 'prepaid'; const FUNDING_UNKNOWN = 'unknown'; /** * Possible string representations of the tokenization method when using Apple Pay or Google Pay. * * @see https://stripe.com/docs/api/cards/object#card_object-tokenization_method */ const TOKENIZATION_METHOD_APPLE_PAY = 'apple_pay'; const TOKENIZATION_METHOD_GOOGLE_PAY = 'google_pay'; /** * @return string The instance URL for this resource. It needs to be special * cased because cards are nested resources that may belong to different * top-level resources. */ public function instanceUrl() { if ($this['customer']) { $base = Customer::classUrl(); $parent = $this['customer']; $path = 'sources'; } elseif ($this['account']) { $base = Account::classUrl(); $parent = $this['account']; $path = 'external_accounts'; } elseif ($this['recipient']) { $base = Recipient::classUrl(); $parent = $this['recipient']; $path = 'cards'; } else { $msg = 'Cards cannot be accessed without a customer ID, account ID or recipient ID.'; throw new Exception\UnexpectedValueException($msg); } $parentExtn = \urlencode(Util\Util::utf8($parent)); $extn = \urlencode(Util\Util::utf8($this['id'])); return "{$base}/{$parentExtn}/{$path}/{$extn}"; } /** * @param array|string $_id * @param null|array|string $_opts * * @throws \Stripe\Exception\BadMethodCallException */ public static function retrieve($_id, $_opts = null) { $msg = 'Cards cannot be retrieved without a customer ID or an ' . 'account ID. Retrieve a card using ' . "`Customer::retrieveSource('customer_id', 'card_id')` or " . "`Account::retrieveExternalAccount('account_id', 'card_id')`."; throw new Exception\BadMethodCallException($msg); } /** * @param string $_id * @param null|array $_params * @param null|array|string $_options * * @throws \Stripe\Exception\BadMethodCallException */ public static function update($_id, $_params = null, $_options = null) { $msg = 'Cards cannot be updated without a customer ID or an ' . 'account ID. Update a card using ' . "`Customer::updateSource('customer_id', 'card_id', " . '$updateParams)` or `Account::updateExternalAccount(' . "'account_id', 'card_id', \$updateParams)`."; throw new Exception\BadMethodCallException($msg); } } diff --git a/plugin/StripeYPT/lib/Checkout/Session.php b/plugin/StripeYPT/lib/Checkout/Session.php index 464a2b9a5..933ec036f 100644 --- a/plugin/StripeYPT/lib/Checkout/Session.php +++ b/plugin/StripeYPT/lib/Checkout/Session.php @@ -1,88 +1,90 @@ Checkout. We recommend * creating a new Session each time your customer attempts to pay. * * Once payment is successful, the Checkout Session will contain a reference to the * Customer, and either the * successful PaymentIntent or an * active Subscription. * * You can create a Checkout Session on your server and pass its ID to the client * to begin Checkout. * * Related guide: Checkout * Server Quickstart. * * @property string $id Unique identifier for the object. Used to pass to redirectToCheckout in Stripe.js. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|bool $allow_promotion_codes Enables user redeemable promotion codes. * @property null|int $amount_subtotal Total of all items before discounts or taxes are applied. * @property null|int $amount_total Total of all items after discounts and taxes are applied. * @property null|string $billing_address_collection Describes whether Checkout should collect the customer's billing address. * @property string $cancel_url The URL the customer will be directed to if they decide to cancel payment and return to your website. - * @property null|string $client_reference_id A unique string to reference the Checkout Session. This can be a customer ID, a cart ID, or similar, and can be used to reconcile the session with your internal systems. + * @property null|string $client_reference_id A unique string to reference the Checkout Session. This can be a customer ID, a cart ID, or similar, and can be used to reconcile the Session with your internal systems. * @property null|string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. - * @property null|string|\Stripe\Customer $customer The ID of the customer for this session. For Checkout Sessions in payment or subscription mode, Checkout will create a new customer object based on information provided during the session unless an existing customer was provided when the session was created. - * @property null|string $customer_email If provided, this value will be used when the Customer object is created. If not provided, customers will be asked to enter their email address. Use this parameter to prefill customer data if you already have an email on file. To access information about the customer once a session is complete, use the customer attribute. + * @property null|string|\Stripe\Customer $customer The ID of the customer for this Session. For Checkout Sessions in payment or subscription mode, Checkout will create a new customer object based on information provided during the payment flow unless an existing customer was provided when the Session was created. + * @property null|\Stripe\StripeObject $customer_details The customer details including the customer's tax exempt status and the customer's tax IDs. + * @property null|string $customer_email If provided, this value will be used when the Customer object is created. If not provided, customers will be asked to enter their email address. Use this parameter to prefill customer data if you already have an email on file. To access information about the customer once the payment flow is complete, use the customer attribute. * @property \Stripe\Collection $line_items The line items purchased by the customer. * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. * @property null|string $locale The IETF language tag of the locale Checkout is displayed in. If blank or auto, the browser's locale is used. * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property string $mode The mode of the Checkout Session. * @property null|string|\Stripe\PaymentIntent $payment_intent The ID of the PaymentIntent for Checkout Sessions in payment mode. + * @property null|\Stripe\StripeObject $payment_method_options Payment-method-specific configuration for the PaymentIntent or SetupIntent of this CheckoutSession. * @property string[] $payment_method_types A list of the types of payment methods (e.g. card) this Checkout Session is allowed to accept. * @property string $payment_status The payment status of the Checkout Session, one of paid, unpaid, or no_payment_required. You can use this value to decide when to fulfill your customer's order. * @property null|string|\Stripe\SetupIntent $setup_intent The ID of the SetupIntent for Checkout Sessions in setup mode. * @property null|\Stripe\StripeObject $shipping Shipping information for this Checkout Session. * @property null|\Stripe\StripeObject $shipping_address_collection When set, provides configuration for Checkout to collect a shipping address from a customer. * @property null|string $submit_type Describes the type of transaction being performed by Checkout in order to customize relevant text on the page, such as the submit button. submit_type can only be specified on Checkout Sessions in payment mode, but not Checkout Sessions in subscription or setup mode. * @property null|string|\Stripe\Subscription $subscription The ID of the subscription for Checkout Sessions in subscription mode. * @property string $success_url The URL the customer will be directed to after the payment or subscription creation is successful. * @property null|\Stripe\StripeObject $total_details Tax and discount details for the computed total amount. */ class Session extends \Stripe\ApiResource { const OBJECT_NAME = 'checkout.session'; use \Stripe\ApiOperations\All; use \Stripe\ApiOperations\Create; use \Stripe\ApiOperations\NestedResource; use \Stripe\ApiOperations\Retrieve; const BILLING_ADDRESS_COLLECTION_AUTO = 'auto'; const BILLING_ADDRESS_COLLECTION_REQUIRED = 'required'; const PAYMENT_STATUS_NO_PAYMENT_REQUIRED = 'no_payment_required'; const PAYMENT_STATUS_PAID = 'paid'; const PAYMENT_STATUS_UNPAID = 'unpaid'; const SUBMIT_TYPE_AUTO = 'auto'; const SUBMIT_TYPE_BOOK = 'book'; const SUBMIT_TYPE_DONATE = 'donate'; const SUBMIT_TYPE_PAY = 'pay'; const PATH_LINE_ITEMS = '/line_items'; /** * @param string $id the ID of the session on which to retrieve the items * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\Collection the list of items */ public static function allLineItems($id, $params = null, $opts = null) { return self::_allNestedResources($id, static::PATH_LINE_ITEMS, $params, $opts); } } diff --git a/plugin/StripeYPT/lib/Collection.php b/plugin/StripeYPT/lib/Collection.php index ec5bebb7a..899299d3d 100644 --- a/plugin/StripeYPT/lib/Collection.php +++ b/plugin/StripeYPT/lib/Collection.php @@ -1,281 +1,281 @@ filters; } /** * Sets the filters, removing paging options. * * @param array $filters the filters */ public function setFilters($filters) { $this->filters = $filters; } public function offsetGet($k) { if (\is_string($k)) { return parent::offsetGet($k); } $msg = "You tried to access the {$k} index, but Collection " . 'types only support string keys. (HINT: List calls ' . 'return an object with a `data` (which is the data ' . "array). You likely want to call ->data[{$k}])"; throw new Exception\InvalidArgumentException($msg); } public function all($params = null, $opts = null) { self::_validateParams($params); list($url, $params) = $this->extractPathAndUpdateParams($params); list($response, $opts) = $this->_request('get', $url, $params, $opts); $obj = Util\Util::convertToStripeObject($response, $opts); if (!($obj instanceof \Stripe\Collection)) { throw new \Stripe\Exception\UnexpectedValueException( 'Expected type ' . \Stripe\Collection::class . ', got "' . \get_class($obj) . '" instead.' ); } $obj->setFilters($params); return $obj; } public function create($params = null, $opts = null) { self::_validateParams($params); list($url, $params) = $this->extractPathAndUpdateParams($params); list($response, $opts) = $this->_request('post', $url, $params, $opts); return Util\Util::convertToStripeObject($response, $opts); } public function retrieve($id, $params = null, $opts = null) { self::_validateParams($params); list($url, $params) = $this->extractPathAndUpdateParams($params); $id = Util\Util::utf8($id); $extn = \urlencode($id); list($response, $opts) = $this->_request( 'get', "{$url}/{$extn}", $params, $opts ); return Util\Util::convertToStripeObject($response, $opts); } /** * @return int the number of objects in the current page */ public function count() { return \count($this->data); } /** * @return \ArrayIterator an iterator that can be used to iterate * across objects in the current page */ public function getIterator() { return new \ArrayIterator($this->data); } /** * @return \ArrayIterator an iterator that can be used to iterate * backwards across objects in the current page */ public function getReverseIterator() { return new \ArrayIterator(\array_reverse($this->data)); } /** * @return \Generator|StripeObject[] A generator that can be used to * iterate across all objects across all pages. As page boundaries are * encountered, the next page will be fetched automatically for * continued iteration. */ public function autoPagingIterator() { $page = $this; while (true) { $filters = $this->filters ?: []; - if (\array_key_exists('ending_before', $filters) && - !\array_key_exists('starting_after', $filters)) { + if (\array_key_exists('ending_before', $filters) + && !\array_key_exists('starting_after', $filters)) { foreach ($page->getReverseIterator() as $item) { yield $item; } $page = $page->previousPage(); } else { foreach ($page as $item) { yield $item; } $page = $page->nextPage(); } if ($page->isEmpty()) { break; } } } /** * Returns an empty collection. This is returned from {@see nextPage()} * when we know that there isn't a next page in order to replicate the * behavior of the API when it attempts to return a page beyond the last. * * @param null|array|string $opts * * @return Collection */ public static function emptyCollection($opts = null) { return Collection::constructFrom(['data' => []], $opts); } /** * Returns true if the page object contains no element. * * @return bool */ public function isEmpty() { return empty($this->data); } /** * Fetches the next page in the resource list (if there is one). * * This method will try to respect the limit of the current page. If none * was given, the default limit will be fetched again. * * @param null|array $params * @param null|array|string $opts * * @return Collection */ public function nextPage($params = null, $opts = null) { if (!$this->has_more) { return static::emptyCollection($opts); } $lastId = \end($this->data)->id; $params = \array_merge( $this->filters ?: [], ['starting_after' => $lastId], $params ?: [] ); return $this->all($params, $opts); } /** * Fetches the previous page in the resource list (if there is one). * * This method will try to respect the limit of the current page. If none * was given, the default limit will be fetched again. * * @param null|array $params * @param null|array|string $opts * * @return Collection */ public function previousPage($params = null, $opts = null) { if (!$this->has_more) { return static::emptyCollection($opts); } $firstId = $this->data[0]->id; $params = \array_merge( $this->filters ?: [], ['ending_before' => $firstId], $params ?: [] ); return $this->all($params, $opts); } /** * Gets the first item from the current page. Returns `null` if the current page is empty. * * @return null|\Stripe\StripeObject */ public function first() { return \count($this->data) > 0 ? $this->data[0] : null; } /** * Gets the last item from the current page. Returns `null` if the current page is empty. * * @return null|\Stripe\StripeObject */ public function last() { return \count($this->data) > 0 ? $this->data[\count($this->data) - 1] : null; } private function extractPathAndUpdateParams($params) { $url = \parse_url($this->url); if (!isset($url['path'])) { throw new Exception\UnexpectedValueException("Could not parse list url into parts: {$url}"); } if (isset($url['query'])) { // If the URL contains a query param, parse it out into $params so they // don't interact weirdly with each other. $query = []; \parse_str($url['query'], $query); $params = \array_merge($params ?: [], $query); } return [$url['path'], $params]; } } diff --git a/plugin/StripeYPT/lib/Discount.php b/plugin/StripeYPT/lib/Discount.php index d4656052e..f32e3c578 100644 --- a/plugin/StripeYPT/lib/Discount.php +++ b/plugin/StripeYPT/lib/Discount.php @@ -1,18 +1,23 @@ true if the object exists in live mode or the value false if the object exists in test mode. * @property string $secret The key's secret. You can use this value to make authorized requests to the Stripe API. * @property array $associated_objects */ class EphemeralKey extends ApiResource { const OBJECT_NAME = 'ephemeral_key'; - use ApiOperations\Delete; - use ApiOperations\Create { create as protected _create; } + use ApiOperations\Delete; + /** * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\InvalidArgumentException if stripe_version is missing * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\EphemeralKey the created key */ public static function create($params = null, $opts = null) { if (!$opts || !isset($opts['stripe_version'])) { throw new Exception\InvalidArgumentException('stripe_version must be specified to create an ephemeral key'); } return self::_create($params, $opts); } } diff --git a/plugin/StripeYPT/lib/Error/Api.php b/plugin/StripeYPT/lib/Error/Api.php deleted file mode 100644 index dc7d069ef..000000000 --- a/plugin/StripeYPT/lib/Error/Api.php +++ /dev/null @@ -1,7 +0,0 @@ -httpStatus = $httpStatus; - $this->httpBody = $httpBody; - $this->jsonBody = $jsonBody; - $this->httpHeaders = $httpHeaders; - $this->requestId = null; - - // TODO: make this a proper constructor argument in the next major - // release. - $this->stripeCode = isset($jsonBody["error"]["code"]) ? $jsonBody["error"]["code"] : null; - - if ($httpHeaders && isset($httpHeaders['Request-Id'])) { - $this->requestId = $httpHeaders['Request-Id']; - } - } - - public function getStripeCode() - { - return $this->stripeCode; - } - - public function getHttpStatus() - { - return $this->httpStatus; - } - - public function getHttpBody() - { - return $this->httpBody; - } - - public function getJsonBody() - { - return $this->jsonBody; - } - - public function getHttpHeaders() - { - return $this->httpHeaders; - } - - public function getRequestId() - { - return $this->requestId; - } - - public function __toString() - { - $id = $this->requestId ? " from API request '{$this->requestId}'": ""; - $message = explode("\n", parent::__toString()); - $message[0] .= $id; - return implode("\n", $message); - } -} diff --git a/plugin/StripeYPT/lib/Error/Card.php b/plugin/StripeYPT/lib/Error/Card.php deleted file mode 100644 index f3ff343d8..000000000 --- a/plugin/StripeYPT/lib/Error/Card.php +++ /dev/null @@ -1,40 +0,0 @@ -stripeParam = $stripeParam; - - // TODO: once Error\Base accepts the error code as an argument, pass it - // in the call to parent::__construct() and stop setting it here. - $this->stripeCode = $stripeCode; - - // This one is not like the others because it was added later and we're - // trying to do our best not to change the public interface of this class' - // constructor. - // TODO: make this a proper constructor argument in the next major - // release. - $this->declineCode = isset($jsonBody["error"]["decline_code"]) ? $jsonBody["error"]["decline_code"] : null; - } - - public function getDeclineCode() - { - return $this->declineCode; - } - - public function getStripeParam() - { - return $this->stripeParam; - } -} diff --git a/plugin/StripeYPT/lib/Error/Idempotency.php b/plugin/StripeYPT/lib/Error/Idempotency.php deleted file mode 100644 index ea44d12e4..000000000 --- a/plugin/StripeYPT/lib/Error/Idempotency.php +++ /dev/null @@ -1,7 +0,0 @@ -stripeParam = $stripeParam; - } - - public function getStripeParam() - { - return $this->stripeParam; - } -} diff --git a/plugin/StripeYPT/lib/Error/OAuth/InvalidClient.php b/plugin/StripeYPT/lib/Error/OAuth/InvalidClient.php deleted file mode 100644 index b47346cde..000000000 --- a/plugin/StripeYPT/lib/Error/OAuth/InvalidClient.php +++ /dev/null @@ -1,10 +0,0 @@ -errorCode = $code; - } - - public function getErrorCode() - { - return $this->errorCode; - } -} diff --git a/plugin/StripeYPT/lib/Error/OAuth/UnsupportedGrantType.php b/plugin/StripeYPT/lib/Error/OAuth/UnsupportedGrantType.php deleted file mode 100644 index 421adc996..000000000 --- a/plugin/StripeYPT/lib/Error/OAuth/UnsupportedGrantType.php +++ /dev/null @@ -1,11 +0,0 @@ -sigHeader = $sigHeader; - } - - public function getSigHeader() - { - return $this->sigHeader; - } -} diff --git a/plugin/StripeYPT/lib/File.php b/plugin/StripeYPT/lib/File.php index d73bed842..b27c9691e 100644 --- a/plugin/StripeYPT/lib/File.php +++ b/plugin/StripeYPT/lib/File.php @@ -1,81 +1,82 @@ create file request (for * example, when uploading dispute evidence) or it may have been created by Stripe * (for example, the results of a Sigma scheduled * query). * * Related guide: File Upload * Guide. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|int $expires_at The time at which the file expires and is no longer available in epoch seconds. * @property null|string $filename A filename for the file, suitable for saving to a filesystem. * @property null|\Stripe\Collection $links A list of file links that point at this file. * @property string $purpose The purpose of the uploaded file. * @property int $size The size in bytes of the file object. * @property null|string $title A user friendly title for the document. * @property null|string $type The type of the file returned (e.g., csv, pdf, jpg, or png). * @property null|string $url The URL from which the file can be downloaded using your live secret API key. */ class File extends ApiResource { const OBJECT_NAME = 'file'; use ApiOperations\All; use ApiOperations\Retrieve; + const PURPOSE_ACCOUNT_REQUIREMENT = 'account_requirement'; const PURPOSE_ADDITIONAL_VERIFICATION = 'additional_verification'; const PURPOSE_BUSINESS_ICON = 'business_icon'; const PURPOSE_BUSINESS_LOGO = 'business_logo'; const PURPOSE_CUSTOMER_SIGNATURE = 'customer_signature'; const PURPOSE_DISPUTE_EVIDENCE = 'dispute_evidence'; const PURPOSE_IDENTITY_DOCUMENT = 'identity_document'; const PURPOSE_PCI_DOCUMENT = 'pci_document'; const PURPOSE_TAX_DOCUMENT_USER_UPLOAD = 'tax_document_user_upload'; // This resource can have two different object names. In latter API // versions, only `file` is used, but since stripe-php may be used with // any API version, we need to support deserializing the older // `file_upload` object into the same class. const OBJECT_NAME_ALT = 'file_upload'; use ApiOperations\Create { create as protected _create; } public static function classUrl() { return '/v1/files'; } /** * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\File the created file */ public static function create($params = null, $opts = null) { $opts = \Stripe\Util\RequestOptions::parse($opts); if (null === $opts->apiBase) { $opts->apiBase = Stripe::$apiUploadBase; } // Manually flatten params, otherwise curl's multipart encoder will // choke on nested arrays. $flatParams = \array_column(\Stripe\Util\Util::flattenParams($params), 1, 0); return static::_create($flatParams, $opts); } } diff --git a/plugin/StripeYPT/lib/FileUpload.php b/plugin/StripeYPT/lib/FileUpload.php deleted file mode 100644 index 1d8725b4c..000000000 --- a/plugin/StripeYPT/lib/FileUpload.php +++ /dev/null @@ -1,6 +0,0 @@ -defaultOptions = $defaultOptions; $this->randomGenerator = $randomGenerator ?: new Util\RandomGenerator(); $this->initUserAgentInfo(); $this->enableHttp2 = $this->canSafelyUseHttp2(); } public function __destruct() { $this->closeCurlHandle(); } public function initUserAgentInfo() { $curlVersion = \curl_version(); $this->userAgentInfo = [ 'httplib' => 'curl ' . $curlVersion['version'], 'ssllib' => $curlVersion['ssl_version'], ]; } public function getDefaultOptions() { return $this->defaultOptions; } public function getUserAgentInfo() { return $this->userAgentInfo; } /** * @return bool */ public function getEnablePersistentConnections() { return $this->enablePersistentConnections; } /** * @param bool $enable */ public function setEnablePersistentConnections($enable) { $this->enablePersistentConnections = $enable; } /** * @return bool */ public function getEnableHttp2() { return $this->enableHttp2; } /** * @param bool $enable */ public function setEnableHttp2($enable) { $this->enableHttp2 = $enable; } /** * @return null|callable */ public function getRequestStatusCallback() { return $this->requestStatusCallback; } /** * Sets a callback that is called after each request. The callback will * receive the following parameters: *
    *
  1. string $rbody The response body
  2. *
  3. integer $rcode The response status code
  4. *
  5. \Stripe\Util\CaseInsensitiveArray $rheaders The response headers
  6. *
  7. integer $errno The curl error number
  8. *
  9. string|null $message The curl error message
  10. *
  11. boolean $shouldRetry Whether the request will be retried
  12. *
  13. integer $numRetries The number of the retry attempt
  14. *
. * * @param null|callable $requestStatusCallback */ public function setRequestStatusCallback($requestStatusCallback) { $this->requestStatusCallback = $requestStatusCallback; } // USER DEFINED TIMEOUTS const DEFAULT_TIMEOUT = 80; const DEFAULT_CONNECT_TIMEOUT = 30; private $timeout = self::DEFAULT_TIMEOUT; private $connectTimeout = self::DEFAULT_CONNECT_TIMEOUT; public function setTimeout($seconds) { $this->timeout = (int) \max($seconds, 0); return $this; } public function setConnectTimeout($seconds) { $this->connectTimeout = (int) \max($seconds, 0); return $this; } public function getTimeout() { return $this->timeout; } public function getConnectTimeout() { return $this->connectTimeout; } // END OF USER DEFINED TIMEOUTS public function request($method, $absUrl, $headers, $params, $hasFile) { $method = \strtolower($method); $opts = []; if (\is_callable($this->defaultOptions)) { // call defaultOptions callback, set options to return value $opts = \call_user_func_array($this->defaultOptions, \func_get_args()); if (!\is_array($opts)) { throw new Exception\UnexpectedValueException('Non-array value returned by defaultOptions CurlClient callback'); } } elseif (\is_array($this->defaultOptions)) { // set default curlopts from array $opts = $this->defaultOptions; } $params = Util\Util::objectsToIds($params); if ('get' === $method) { if ($hasFile) { throw new Exception\UnexpectedValueException( 'Issuing a GET request with a file parameter' ); } $opts[\CURLOPT_HTTPGET] = 1; if (\count($params) > 0) { $encoded = Util\Util::encodeParameters($params); $absUrl = "{$absUrl}?{$encoded}"; } } elseif ('post' === $method) { $opts[\CURLOPT_POST] = 1; $opts[\CURLOPT_POSTFIELDS] = $hasFile ? $params : Util\Util::encodeParameters($params); } elseif ('delete' === $method) { $opts[\CURLOPT_CUSTOMREQUEST] = 'DELETE'; if (\count($params) > 0) { $encoded = Util\Util::encodeParameters($params); $absUrl = "{$absUrl}?{$encoded}"; } } else { throw new Exception\UnexpectedValueException("Unrecognized method {$method}"); } // It is only safe to retry network failures on POST requests if we // add an Idempotency-Key header if (('post' === $method) && (Stripe::$maxNetworkRetries > 0)) { if (!$this->hasHeader($headers, 'Idempotency-Key')) { - \array_push($headers, 'Idempotency-Key: ' . $this->randomGenerator->uuid()); + $headers[] = 'Idempotency-Key: ' . $this->randomGenerator->uuid(); } } // By default for large request body sizes (> 1024 bytes), cURL will // send a request without a body and with a `Expect: 100-continue` // header, which gives the server a chance to respond with an error // status code in cases where one can be determined right away (say // on an authentication problem for example), and saves the "large" // request body from being ever sent. // // Unfortunately, the bindings don't currently correctly handle the // success case (in which the server sends back a 100 CONTINUE), so // we'll error under that condition. To compensate for that problem // for the time being, override cURL's behavior by simply always // sending an empty `Expect:` header. - \array_push($headers, 'Expect: '); + $headers[] = 'Expect: '; $absUrl = Util\Util::utf8($absUrl); $opts[\CURLOPT_URL] = $absUrl; $opts[\CURLOPT_RETURNTRANSFER] = true; $opts[\CURLOPT_CONNECTTIMEOUT] = $this->connectTimeout; $opts[\CURLOPT_TIMEOUT] = $this->timeout; $opts[\CURLOPT_HTTPHEADER] = $headers; $opts[\CURLOPT_CAINFO] = Stripe::getCABundlePath(); if (!Stripe::getVerifySslCerts()) { $opts[\CURLOPT_SSL_VERIFYPEER] = false; } if (!isset($opts[\CURLOPT_HTTP_VERSION]) && $this->getEnableHttp2()) { // For HTTPS requests, enable HTTP/2, if supported $opts[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_2TLS; } // Stripe's API servers are only accessible over IPv4. Force IPv4 resolving to avoid // potential issues (cf. https://github.com/stripe/stripe-php/issues/1045). $opts[\CURLOPT_IPRESOLVE] = \CURL_IPRESOLVE_V4; list($rbody, $rcode, $rheaders) = $this->executeRequestWithRetries($opts, $absUrl); return [$rbody, $rcode, $rheaders]; } /** * @param array $opts cURL options * @param string $absUrl */ private function executeRequestWithRetries($opts, $absUrl) { $numRetries = 0; while (true) { $rcode = 0; $errno = 0; $message = null; // Create a callback to capture HTTP headers for the response $rheaders = new Util\CaseInsensitiveArray(); $headerCallback = function ($curl, $header_line) use (&$rheaders) { // Ignore the HTTP request line (HTTP/1.1 200 OK) if (false === \strpos($header_line, ':')) { return \strlen($header_line); } list($key, $value) = \explode(':', \trim($header_line), 2); $rheaders[\trim($key)] = \trim($value); return \strlen($header_line); }; $opts[\CURLOPT_HEADERFUNCTION] = $headerCallback; $this->resetCurlHandle(); \curl_setopt_array($this->curlHandle, $opts); $rbody = \curl_exec($this->curlHandle); if (false === $rbody) { $errno = \curl_errno($this->curlHandle); $message = \curl_error($this->curlHandle); } else { $rcode = \curl_getinfo($this->curlHandle, \CURLINFO_HTTP_CODE); } if (!$this->getEnablePersistentConnections()) { $this->closeCurlHandle(); } $shouldRetry = $this->shouldRetry($errno, $rcode, $rheaders, $numRetries); if (\is_callable($this->getRequestStatusCallback())) { \call_user_func_array( $this->getRequestStatusCallback(), [$rbody, $rcode, $rheaders, $errno, $message, $shouldRetry, $numRetries] ); } if ($shouldRetry) { ++$numRetries; $sleepSeconds = $this->sleepTime($numRetries, $rheaders); \usleep((int) ($sleepSeconds * 1000000)); } else { break; } } if (false === $rbody) { $this->handleCurlError($absUrl, $errno, $message, $numRetries); } return [$rbody, $rcode, $rheaders]; } /** * @param string $url * @param int $errno * @param string $message * @param int $numRetries * * @throws Exception\ApiConnectionException */ private function handleCurlError($url, $errno, $message, $numRetries) { switch ($errno) { case \CURLE_COULDNT_CONNECT: case \CURLE_COULDNT_RESOLVE_HOST: case \CURLE_OPERATION_TIMEOUTED: $msg = "Could not connect to Stripe ({$url}). Please check your " . 'internet connection and try again. If this problem persists, ' . "you should check Stripe's service status at " . 'https://twitter.com/stripestatus, or'; break; + case \CURLE_SSL_CACERT: case \CURLE_SSL_PEER_CERTIFICATE: $msg = "Could not verify Stripe's SSL certificate. Please make sure " . 'that your network is not intercepting certificates. ' . "(Try going to {$url} in your browser.) " . 'If this problem persists,'; break; + default: $msg = 'Unexpected error communicating with Stripe. ' . 'If this problem persists,'; } $msg .= ' let us know at support@stripe.com.'; $msg .= "\n\n(Network error [errno {$errno}]: {$message})"; if ($numRetries > 0) { $msg .= "\n\nRequest was retried {$numRetries} times."; } throw new Exception\ApiConnectionException($msg); } /** * Checks if an error is a problem that we should retry on. This includes both * socket errors that may represent an intermittent problem and some special * HTTP statuses. * * @param int $errno * @param int $rcode * @param array|\Stripe\Util\CaseInsensitiveArray $rheaders * @param int $numRetries * * @return bool */ private function shouldRetry($errno, $rcode, $rheaders, $numRetries) { if ($numRetries >= Stripe::getMaxNetworkRetries()) { return false; } // Retry on timeout-related problems (either on open or read). if (\CURLE_OPERATION_TIMEOUTED === $errno) { return true; } // Destination refused the connection, the connection was reset, or a // variety of other connection failures. This could occur from a single // saturated server, so retry in case it's intermittent. if (\CURLE_COULDNT_CONNECT === $errno) { return true; } // The API may ask us not to retry (eg; if doing so would be a no-op) // or advise us to retry (eg; in cases of lock timeouts); we defer to that. if (isset($rheaders['stripe-should-retry'])) { if ('false' === $rheaders['stripe-should-retry']) { return false; } if ('true' === $rheaders['stripe-should-retry']) { return true; } } // 409 Conflict if (409 === $rcode) { return true; } // Retry on 500, 503, and other internal errors. // // Note that we expect the stripe-should-retry header to be false // in most cases when a 500 is returned, since our idempotency framework // would typically replay it anyway. if ($rcode >= 500) { return true; } return false; } /** * Provides the number of seconds to wait before retrying a request. * * @param int $numRetries * @param array|\Stripe\Util\CaseInsensitiveArray $rheaders * * @return int */ private function sleepTime($numRetries, $rheaders) { // Apply exponential backoff with $initialNetworkRetryDelay on the // number of $numRetries so far as inputs. Do not allow the number to exceed // $maxNetworkRetryDelay. $sleepSeconds = \min( Stripe::getInitialNetworkRetryDelay() * 1.0 * 2 ** ($numRetries - 1), Stripe::getMaxNetworkRetryDelay() ); // Apply some jitter by randomizing the value in the range of // ($sleepSeconds / 2) to ($sleepSeconds). $sleepSeconds *= 0.5 * (1 + $this->randomGenerator->randFloat()); // But never sleep less than the base sleep seconds. $sleepSeconds = \max(Stripe::getInitialNetworkRetryDelay(), $sleepSeconds); // And never sleep less than the time the API asks us to wait, assuming it's a reasonable ask. $retryAfter = isset($rheaders['retry-after']) ? (float) ($rheaders['retry-after']) : 0.0; if (\floor($retryAfter) === $retryAfter && $retryAfter <= Stripe::getMaxRetryAfter()) { $sleepSeconds = \max($sleepSeconds, $retryAfter); } return $sleepSeconds; } /** * Initializes the curl handle. If already initialized, the handle is closed first. */ private function initCurlHandle() { $this->closeCurlHandle(); $this->curlHandle = \curl_init(); } /** * Closes the curl handle if initialized. Do nothing if already closed. */ private function closeCurlHandle() { if (null !== $this->curlHandle) { \curl_close($this->curlHandle); $this->curlHandle = null; } } /** * Resets the curl handle. If the handle is not already initialized, or if persistent * connections are disabled, the handle is reinitialized instead. */ private function resetCurlHandle() { if (null !== $this->curlHandle && $this->getEnablePersistentConnections()) { \curl_reset($this->curlHandle); } else { $this->initCurlHandle(); } } /** * Indicates whether it is safe to use HTTP/2 or not. * * @return bool */ private function canSafelyUseHttp2() { // Versions of curl older than 7.60.0 don't respect GOAWAY frames // (cf. https://github.com/curl/curl/issues/2416), which Stripe use. $curlVersion = \curl_version()['version']; return \version_compare($curlVersion, '7.60.0') >= 0; } /** * Checks if a list of headers contains a specific header name. * * @param string[] $headers * @param string $name * * @return bool */ private function hasHeader($headers, $name) { foreach ($headers as $header) { if (0 === \strncasecmp($header, "{$name}: ", \strlen($name) + 2)) { return true; } } return false; } } diff --git a/plugin/StripeYPT/lib/Invoice.php b/plugin/StripeYPT/lib/Invoice.php index 706da0a63..455d7c8e0 100644 --- a/plugin/StripeYPT/lib/Invoice.php +++ b/plugin/StripeYPT/lib/Invoice.php @@ -1,259 +1,261 @@ invoice * items, and proration adjustments that may be caused by subscription * upgrades/downgrades (if necessary). * * If your invoice is configured to be billed through automatic charges, Stripe * automatically finalizes your invoice and attempts payment. Note that finalizing * the invoice, when * automatic, does not happen immediately as the invoice is created. Stripe * waits until one hour after the last webhook was successfully sent (or the last * webhook timed out after failing). If you (and the platforms you may have * connected to) have no webhooks configured, Stripe waits one hour after creation * to finalize the invoice. * * If your invoice is configured to be billed by sending an email, then based on * your email * settings, Stripe will email the invoice to your customer and await payment. * These emails can contain a link to a hosted page to pay the invoice. * * Stripe applies any customer credit on the account before determining the amount * due for the invoice (i.e., the amount that will be actually charged). If the * amount due for the invoice is less than Stripe's minimum allowed * charge per currency, the invoice is automatically marked paid, and we add - * the amount due to the customer's running account balance which is applied to the - * next invoice. + * the amount due to the customer's credit balance which is applied to the next + * invoice. * - * More details on the customer's account balance are here. + * More details on the customer's credit balance are here. * * Related guide: Send * Invoices to Customers. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|string $account_country The country of the business associated with this invoice, most often the business creating the invoice. * @property null|string $account_name The public name of the business associated with this invoice, most often the business creating the invoice. * @property null|(string|\Stripe\TaxId)[] $account_tax_ids The account tax IDs associated with the invoice. Only editable when the invoice is a draft. * @property int $amount_due Final amount due at this time for this invoice. If the invoice's total is smaller than the minimum charge amount, for example, or if there is account credit that can be applied to the invoice, the amount_due may be 0. If there is a positive starting_balance for the invoice (the customer owes money), the amount_due will also take that into account. The charge that gets generated for the invoice will be for the amount specified in amount_due. * @property int $amount_paid The amount, in %s, that was paid. * @property int $amount_remaining The amount remaining, in %s, that is due. * @property null|int $application_fee_amount The fee in %s that will be applied to the invoice and transferred to the application owner's Stripe account when the invoice is paid. * @property int $attempt_count Number of payment attempts made for this invoice, from the perspective of the payment retry schedule. Any payment attempt counts as the first attempt, and subsequently only automatic retries increment the attempt count. In other words, manual payment attempts after the first attempt do not affect the retry schedule. * @property bool $attempted Whether an attempt has been made to pay the invoice. An invoice is not attempted until 1 hour after the invoice.created webhook, for example, so you might not want to display that invoice as unpaid to your users. * @property bool $auto_advance Controls whether Stripe will perform automatic collection of the invoice. When false, the invoice's state will not automatically advance without an explicit action. * @property null|string $billing_reason Indicates the reason why the invoice was created. subscription_cycle indicates an invoice created by a subscription advancing into a new period. subscription_create indicates an invoice created due to creating a subscription. subscription_update indicates an invoice created due to updating a subscription. subscription is set for all old invoices to indicate either a change to a subscription or a period advancement. manual is set for all invoices unrelated to a subscription (for example: created via the invoice editor). The upcoming value is reserved for simulated invoices per the upcoming invoice endpoint. subscription_threshold indicates an invoice created due to a billing threshold being reached. * @property null|string|\Stripe\Charge $charge ID of the latest charge generated for this invoice, if any. * @property null|string $collection_method Either charge_automatically, or send_invoice. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. * @property null|\Stripe\StripeObject[] $custom_fields Custom fields displayed on the invoice. - * @property string|\Stripe\Customer $customer The ID of the customer who will be billed. + * @property null|string|\Stripe\Customer $customer The ID of the customer who will be billed. * @property null|\Stripe\StripeObject $customer_address The customer's address. Until the invoice is finalized, this field will equal customer.address. Once the invoice is finalized, this field will no longer be updated. * @property null|string $customer_email The customer's email. Until the invoice is finalized, this field will equal customer.email. Once the invoice is finalized, this field will no longer be updated. * @property null|string $customer_name The customer's name. Until the invoice is finalized, this field will equal customer.name. Once the invoice is finalized, this field will no longer be updated. * @property null|string $customer_phone The customer's phone number. Until the invoice is finalized, this field will equal customer.phone. Once the invoice is finalized, this field will no longer be updated. * @property null|\Stripe\StripeObject $customer_shipping The customer's shipping information. Until the invoice is finalized, this field will equal customer.shipping. Once the invoice is finalized, this field will no longer be updated. * @property null|string $customer_tax_exempt The customer's tax exempt status. Until the invoice is finalized, this field will equal customer.tax_exempt. Once the invoice is finalized, this field will no longer be updated. * @property null|\Stripe\StripeObject[] $customer_tax_ids The customer's tax IDs. Until the invoice is finalized, this field will contain the same tax IDs as customer.tax_ids. Once the invoice is finalized, this field will no longer be updated. * @property null|string|\Stripe\PaymentMethod $default_payment_method ID of the default payment method for the invoice. It must belong to the customer associated with the invoice. If not set, defaults to the subscription's default payment method, if any, or to the default payment method in the customer's invoice settings. * @property null|string|\Stripe\Account|\Stripe\AlipayAccount|\Stripe\BankAccount|\Stripe\BitcoinReceiver|\Stripe\Card|\Stripe\Source $default_source ID of the default payment source for the invoice. It must belong to the customer associated with the invoice and be in a chargeable state. If not set, defaults to the subscription's default source, if any, or to the customer's default source. * @property \Stripe\TaxRate[] $default_tax_rates The tax rates applied to this invoice, if any. * @property null|string $description An arbitrary string attached to the object. Often useful for displaying to users. Referenced as 'memo' in the Dashboard. * @property null|\Stripe\Discount $discount Describes the current discount applied to this invoice, if there is one. Not populated if there are multiple discounts. * @property null|(string|\Stripe\Discount)[] $discounts The discounts applied to the invoice. Line item discounts are applied before invoice discounts. Use expand[]=discounts to expand each discount. * @property null|int $due_date The date on which payment for this invoice is due. This value will be null for invoices where collection_method=charge_automatically. * @property null|int $ending_balance Ending customer balance after the invoice is finalized. Invoices are finalized approximately an hour after successful webhook delivery or when payment collection is attempted for the invoice. If the invoice has not been finalized yet, this will be null. * @property null|string $footer Footer displayed on the invoice. * @property null|string $hosted_invoice_url The URL for the hosted invoice page, which allows customers to view and pay an invoice. If the invoice has not been finalized yet, this will be null. * @property null|string $invoice_pdf The link to download the PDF for the invoice. If the invoice has not been finalized yet, this will be null. * @property null|\Stripe\ErrorObject $last_finalization_error The error encountered during the previous attempt to finalize the invoice. This field is cleared when the invoice is successfully finalized. * @property \Stripe\Collection $lines The individual line items that make up the invoice. lines is sorted as follows: invoice items in reverse chronological order, followed by the subscription, if any. * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|int $next_payment_attempt The time at which payment will next be attempted. This value will be null for invoices where collection_method=send_invoice. * @property null|string $number A unique, identifying string that appears on emails sent to the customer for this invoice. This starts with the customer's unique invoice_prefix if it is specified. + * @property null|string|\Stripe\Account $on_behalf_of The account (if any) for which the funds of the invoice payment are intended. If set, the invoice will be presented with the branding and support information of the specified account. See the Invoices with Connect documentation for details. * @property bool $paid Whether payment was successfully collected for this invoice. An invoice can be paid (most commonly) with a charge or with credit from the customer's account balance. * @property null|string|\Stripe\PaymentIntent $payment_intent The PaymentIntent associated with this invoice. The PaymentIntent is generated when the invoice is finalized, and can then be used to pay the invoice. Note that voiding an invoice will cancel the PaymentIntent. + * @property \Stripe\StripeObject $payment_settings * @property int $period_end End of the usage period during which invoice items were added to this invoice. * @property int $period_start Start of the usage period during which invoice items were added to this invoice. * @property int $post_payment_credit_notes_amount Total amount of all post-payment credit notes issued for this invoice. * @property int $pre_payment_credit_notes_amount Total amount of all pre-payment credit notes issued for this invoice. * @property null|string $receipt_number This is the transaction number that appears on email receipts sent for this invoice. * @property int $starting_balance Starting customer balance before the invoice is finalized. If the invoice has not been finalized yet, this will be the current customer balance. * @property null|string $statement_descriptor Extra information about an invoice for the customer's credit card statement. * @property null|string $status The status of the invoice, one of draft, open, paid, uncollectible, or void. Learn more * @property \Stripe\StripeObject $status_transitions * @property null|string|\Stripe\Subscription $subscription The subscription that this invoice was prepared for, if any. * @property int $subscription_proration_date Only set for upcoming invoices that preview prorations. The time used to calculate prorations. * @property int $subtotal Total of all subscriptions, invoice items, and prorations on the invoice before any invoice level discount or tax is applied. Item discounts are already incorporated * @property null|int $tax The amount of tax on this invoice. This is the sum of all the tax amounts on this invoice. * @property \Stripe\StripeObject $threshold_reason * @property int $total Total after discounts and taxes. * @property null|\Stripe\StripeObject[] $total_discount_amounts The aggregate amounts calculated per discount across all line items. * @property \Stripe\StripeObject[] $total_tax_amounts The aggregate amounts calculated per tax rate for all line items. * @property null|int $webhooks_delivered_at Invoices are automatically paid or sent 1 hour after webhooks are delivered, or until all webhook delivery attempts have been exhausted. This field tracks the time when webhooks for this invoice were successfully delivered. If the invoice had no webhooks to deliver, this will be set while the invoice is being created. */ class Invoice extends ApiResource { const OBJECT_NAME = 'invoice'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Delete; use ApiOperations\Retrieve; use ApiOperations\Update; const BILLING_CHARGE_AUTOMATICALLY = 'charge_automatically'; const BILLING_SEND_INVOICE = 'send_invoice'; const BILLING_REASON_MANUAL = 'manual'; const BILLING_REASON_SUBSCRIPTION = 'subscription'; const BILLING_REASON_SUBSCRIPTION_CREATE = 'subscription_create'; const BILLING_REASON_SUBSCRIPTION_CYCLE = 'subscription_cycle'; const BILLING_REASON_SUBSCRIPTION_THRESHOLD = 'subscription_threshold'; const BILLING_REASON_SUBSCRIPTION_UPDATE = 'subscription_update'; const BILLING_REASON_UPCOMING = 'upcoming'; const COLLECTION_METHOD_CHARGE_AUTOMATICALLY = 'charge_automatically'; const COLLECTION_METHOD_SEND_INVOICE = 'send_invoice'; const STATUS_DELETED = 'deleted'; const STATUS_DRAFT = 'draft'; const STATUS_OPEN = 'open'; const STATUS_PAID = 'paid'; const STATUS_UNCOLLECTIBLE = 'uncollectible'; const STATUS_VOID = 'void'; use ApiOperations\NestedResource; const PATH_LINES = '/lines'; /** * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\Invoice the upcoming invoice */ public static function upcoming($params = null, $opts = null) { $url = static::classUrl() . '/upcoming'; list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); $obj = Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; } /** * @param string $id the ID of the invoice on which to retrieve the lines * @param null|array $params * @param null|array|string $opts * * @throws StripeExceptionApiErrorException if the request fails * * @return \Stripe\Collection the list of lines (InvoiceLineItem) */ public static function allLines($id, $params = null, $opts = null) { return self::_allNestedResources($id, static::PATH_LINES, $params, $opts); } /** * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return Invoice the finalized invoice */ public function finalizeInvoice($params = null, $opts = null) { $url = $this->instanceUrl() . '/finalize'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return Invoice the uncollectible invoice */ public function markUncollectible($params = null, $opts = null) { $url = $this->instanceUrl() . '/mark_uncollectible'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return Invoice the paid invoice */ public function pay($params = null, $opts = null) { $url = $this->instanceUrl() . '/pay'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return Invoice the sent invoice */ public function sendInvoice($params = null, $opts = null) { $url = $this->instanceUrl() . '/send'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return Invoice the voided invoice */ public function voidInvoice($params = null, $opts = null) { $url = $this->instanceUrl() . '/void'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } diff --git a/plugin/StripeYPT/lib/IssuerFraudRecord.php b/plugin/StripeYPT/lib/IssuerFraudRecord.php deleted file mode 100644 index 8db4b31b0..000000000 --- a/plugin/StripeYPT/lib/IssuerFraudRecord.php +++ /dev/null @@ -1,25 +0,0 @@ -issued card is used to * make a purchase, an Issuing Authorization object is created. Authorizations * must be approved for the purchase to be completed successfully. * * Related guide: Issued Card * Authorizations. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $amount The total amount that was authorized or rejected. This amount is in the card's currency and in the smallest currency unit. * @property null|\Stripe\StripeObject $amount_details Detailed breakdown of amount components. These amounts are denominated in currency and in the smallest currency unit. * @property bool $approved Whether the authorization has been approved. * @property string $authorization_method How the card details were provided. * @property \Stripe\BalanceTransaction[] $balance_transactions List of balance transactions associated with this authorization. * @property \Stripe\Issuing\Card $card You can create physical or virtual cards that are issued to cardholders. * @property null|string|\Stripe\Issuing\Cardholder $cardholder The cardholder to whom this authorization belongs. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. * @property int $merchant_amount The total amount that was authorized or rejected. This amount is in the merchant_currency and in the smallest currency unit. * @property string $merchant_currency The currency that was presented to the cardholder for the authorization. Three-letter ISO currency code, in lowercase. Must be a supported currency. * @property \Stripe\StripeObject $merchant_data * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|\Stripe\StripeObject $pending_request The pending authorization request. This field will only be non-null during an issuing_authorization.request webhook. - * @property \Stripe\StripeObject[] $request_history History of every time the authorization was approved/denied (whether approved/denied by you directly or by Stripe based on your spending_controls). If the merchant changes the authorization by performing an incremental authorization or partial capture, you can look at this field to see the previous states of the authorization. + * @property \Stripe\StripeObject[] $request_history History of every time pending_request was approved/denied, either by you directly or by Stripe (e.g. based on your spending_controls). If the merchant changes the authorization by performing an incremental authorization, you can look at this field to see the previous requests for the authorization. * @property string $status The current status of the authorization in its lifecycle. * @property \Stripe\Issuing\Transaction[] $transactions List of transactions associated with this authorization. * @property \Stripe\StripeObject $verification_data * @property null|string $wallet What, if any, digital wallet was used for this authorization. One of apple_pay, google_pay, or samsung_pay. */ class Authorization extends \Stripe\ApiResource { const OBJECT_NAME = 'issuing.authorization'; use \Stripe\ApiOperations\All; use \Stripe\ApiOperations\Retrieve; use \Stripe\ApiOperations\Update; /** * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return Authorization the approved authorization */ public function approve($params = null, $opts = null) { $url = $this->instanceUrl() . '/approve'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return Authorization the declined authorization */ public function decline($params = null, $opts = null) { $url = $this->instanceUrl() . '/decline'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } diff --git a/plugin/StripeYPT/lib/Issuing/Dispute.php b/plugin/StripeYPT/lib/Issuing/Dispute.php index 5f24864b4..0df24b849 100644 --- a/plugin/StripeYPT/lib/Issuing/Dispute.php +++ b/plugin/StripeYPT/lib/Issuing/Dispute.php @@ -1,53 +1,53 @@ card issuer, you can dispute * transactions that the cardholder does not recognize, suspects to be fraudulent, * or has other issues with. * * Related guide: Disputing * Transactions * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. - * @property int $amount Disputed amount. Usually the amount of the disputed_transaction, but can differ (usually because of currency fluctuation). + * @property int $amount Disputed amount. Usually the amount of the transaction, but can differ (usually because of currency fluctuation). * @property null|\Stripe\BalanceTransaction[] $balance_transactions List of balance transactions associated with the dispute. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. - * @property string $currency The currency the disputed_transaction was made in. + * @property string $currency The currency the transaction was made in. * @property \Stripe\StripeObject $evidence * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property string $status Current status of the dispute. * @property string|\Stripe\Issuing\Transaction $transaction The transaction being disputed. */ class Dispute extends \Stripe\ApiResource { const OBJECT_NAME = 'issuing.dispute'; use \Stripe\ApiOperations\All; use \Stripe\ApiOperations\Create; use \Stripe\ApiOperations\Retrieve; use \Stripe\ApiOperations\Update; /** * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return Dispute the submited dispute */ public function submit($params = null, $opts = null) { $url = $this->instanceUrl() . '/submit'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } diff --git a/plugin/StripeYPT/lib/LineItem.php b/plugin/StripeYPT/lib/LineItem.php index d3e55af20..0a413461d 100644 --- a/plugin/StripeYPT/lib/LineItem.php +++ b/plugin/StripeYPT/lib/LineItem.php @@ -1,26 +1,26 @@ ISO currency code, in lowercase. Must be a supported currency. * @property string $description An arbitrary string attached to the object. Often useful for displaying to users. Defaults to product name. * @property \Stripe\StripeObject[] $discounts The discounts applied to the line item. - * @property \Stripe\Price $price

Prices define the unit cost, currency, and (optional) billing cycle for both recurring and one-time purchases of products. Products help you track inventory or provisioning, and prices help you track payment terms. Different physical goods or levels of service should be represented by products, and pricing options should be represented by prices. This approach lets you change prices without having to change your provisioning scheme.

For example, you might have a single "gold" product that has prices for $10/month, $100/year, and €9 once.

Related guides: Set up a subscription, create an invoice, and more about products and prices.

+ * @property null|\Stripe\Price $price The price used to generate the line item. * @property null|int $quantity The quantity of products being purchased. * @property \Stripe\StripeObject[] $taxes The taxes applied to the line item. */ class LineItem extends ApiResource { const OBJECT_NAME = 'item'; use ApiOperations\All; } diff --git a/plugin/StripeYPT/lib/PaymentMethod.php b/plugin/StripeYPT/lib/PaymentMethod.php index d9c9e2b52..7a5481eb8 100644 --- a/plugin/StripeYPT/lib/PaymentMethod.php +++ b/plugin/StripeYPT/lib/PaymentMethod.php @@ -1,86 +1,88 @@ PaymentIntents to * collect payments or saved to Customer objects to store instrument details for * future payments. * * Related guides: Payment Methods and * More Payment * Scenarios. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. + * @property \Stripe\StripeObject $acss_debit + * @property \Stripe\StripeObject $afterpay_clearpay * @property \Stripe\StripeObject $alipay * @property \Stripe\StripeObject $au_becs_debit * @property \Stripe\StripeObject $bacs_debit * @property \Stripe\StripeObject $bancontact * @property \Stripe\StripeObject $billing_details * @property \Stripe\StripeObject $card * @property \Stripe\StripeObject $card_present * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string|\Stripe\Customer $customer The ID of the Customer to which this PaymentMethod is saved. This will not be set when the PaymentMethod has not been saved to a Customer. * @property \Stripe\StripeObject $eps * @property \Stripe\StripeObject $fpx * @property \Stripe\StripeObject $giropay * @property \Stripe\StripeObject $grabpay * @property \Stripe\StripeObject $ideal * @property \Stripe\StripeObject $interac_present * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property \Stripe\StripeObject $oxxo * @property \Stripe\StripeObject $p24 * @property \Stripe\StripeObject $sepa_debit * @property \Stripe\StripeObject $sofort * @property string $type The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a name matching this value. It contains additional information specific to the PaymentMethod type. */ class PaymentMethod extends ApiResource { const OBJECT_NAME = 'payment_method'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; /** * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return PaymentMethod the attached payment method */ public function attach($params = null, $opts = null) { $url = $this->instanceUrl() . '/attach'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } /** * @param null|array $params * @param null|array|string $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return PaymentMethod the detached payment method */ public function detach($params = null, $opts = null) { $url = $this->instanceUrl() . '/detach'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } } diff --git a/plugin/StripeYPT/lib/Person.php b/plugin/StripeYPT/lib/Person.php index 151870a86..ad2b46f15 100644 --- a/plugin/StripeYPT/lib/Person.php +++ b/plugin/StripeYPT/lib/Person.php @@ -1,111 +1,120 @@ Standard onboarding + * or Express onboarding + * documentation for information about platform pre-filling and account + * onboarding steps. + * * Related guide: Handling * Identity Verification with the API. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property string $account The account the person is associated with. * @property \Stripe\StripeObject $address * @property null|\Stripe\StripeObject $address_kana The Kana variation of the person's address (Japan only). * @property null|\Stripe\StripeObject $address_kanji The Kanji variation of the person's address (Japan only). * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property \Stripe\StripeObject $dob * @property null|string $email The person's email address. * @property null|string $first_name The person's first name. * @property null|string $first_name_kana The Kana variation of the person's first name (Japan only). * @property null|string $first_name_kanji The Kanji variation of the person's first name (Japan only). * @property null|string $gender The person's gender (International regulations require either "male" or "female"). * @property bool $id_number_provided Whether the person's id_number was provided. * @property null|string $last_name The person's last name. * @property null|string $last_name_kana The Kana variation of the person's last name (Japan only). * @property null|string $last_name_kanji The Kanji variation of the person's last name (Japan only). * @property null|string $maiden_name The person's maiden name. * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + * @property null|string $nationality The country where the person is a national. * @property null|string $phone The person's phone number. * @property string $political_exposure Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction. * @property \Stripe\StripeObject $relationship * @property null|\Stripe\StripeObject $requirements Information about the requirements for this person, including what information needs to be collected, and by when. * @property bool $ssn_last_4_provided Whether the last four digits of the person's Social Security number have been provided (U.S. only). * @property \Stripe\StripeObject $verification */ class Person extends ApiResource { const OBJECT_NAME = 'person'; use ApiOperations\Delete; use ApiOperations\Update; const GENDER_FEMALE = 'female'; const GENDER_MALE = 'male'; const POLITICAL_EXPOSURE_EXISTING = 'existing'; const POLITICAL_EXPOSURE_NONE = 'none'; const VERIFICATION_STATUS_PENDING = 'pending'; const VERIFICATION_STATUS_UNVERIFIED = 'unverified'; const VERIFICATION_STATUS_VERIFIED = 'verified'; /** * @return string the API URL for this Stripe account reversal */ public function instanceUrl() { $id = $this['id']; $account = $this['account']; if (!$id) { throw new Exception\UnexpectedValueException( 'Could not determine which URL to request: ' . "class instance has invalid ID: {$id}", null ); } $id = Util\Util::utf8($id); $account = Util\Util::utf8($account); $base = Account::classUrl(); $accountExtn = \urlencode($account); $extn = \urlencode($id); return "{$base}/{$accountExtn}/persons/{$extn}"; } /** * @param array|string $_id * @param null|array|string $_opts * * @throws \Stripe\Exception\BadMethodCallException */ public static function retrieve($_id, $_opts = null) { $msg = 'Persons cannot be retrieved without an account ID. Retrieve ' . "a person using `Account::retrievePerson('account_id', " . "'person_id')`."; throw new Exception\BadMethodCallException($msg); } /** * @param string $_id * @param null|array $_params * @param null|array|string $_options * * @throws \Stripe\Exception\BadMethodCallException */ public static function update($_id, $_params = null, $_options = null) { $msg = 'Persons cannot be updated without an account ID. Update ' . "a person using `Account::updatePerson('account_id', " . "'person_id', \$updateParams)`."; throw new Exception\BadMethodCallException($msg); } } diff --git a/plugin/StripeYPT/lib/Plan.php b/plugin/StripeYPT/lib/Plan.php index bff735d78..2a818e474 100644 --- a/plugin/StripeYPT/lib/Plan.php +++ b/plugin/StripeYPT/lib/Plan.php @@ -1,57 +1,57 @@ Prices API. It replaces the Plans * API and is backwards compatible to simplify your migration. * * Plans define the base price, currency, and billing cycle for recurring purchases * of products. Products help * you track inventory or provisioning, and plans help you track pricing. Different * physical goods or levels of service should be represented by products, and * pricing options should be represented by plans. This approach lets you change * prices without having to change your provisioning scheme. * * For example, you might have a single "gold" product that has plans for * $10/month, $100/year, €9/month, and €90/year. * * Related guides: Set up * a subscription and more about products and prices. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property bool $active Whether the plan can be used for new purchases. * @property null|string $aggregate_usage Specifies a usage aggregation strategy for plans of usage_type=metered. Allowed values are sum for summing up all usage during a period, last_during_period for using the last usage record reported within a period, last_ever for using the last usage record ever (across period bounds) or max which uses the usage record with the maximum reported usage during a period. Defaults to sum. - * @property null|int $amount The unit amount in %s to be charged, represented as a whole integer if possible. - * @property null|string $amount_decimal The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places. + * @property null|int $amount The unit amount in %s to be charged, represented as a whole integer if possible. Only set if billing_scheme=per_unit. + * @property null|string $amount_decimal The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places. Only set if billing_scheme=per_unit. * @property string $billing_scheme Describes how to compute the price per period. Either per_unit or tiered. per_unit indicates that the fixed amount (specified in amount) will be charged per unit in quantity (for plans with usage_type=licensed), or per unit of total usage (for plans with usage_type=metered). tiered indicates that the unit pricing will be computed using a tiering strategy as defined using the tiers and tiers_mode attributes. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. * @property string $interval The frequency at which a subscription is billed. One of day, week, month or year. * @property int $interval_count The number of intervals (specified in the interval attribute) between subscription billings. For example, interval=month and interval_count=3 bills every 3 months. * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property null|string $nickname A brief description of the plan, hidden from customers. * @property null|string|\Stripe\Product $product The product whose pricing this plan determines. * @property \Stripe\StripeObject[] $tiers Each element represents a pricing tier. This parameter requires billing_scheme to be set to tiered. See also the documentation for billing_scheme. * @property null|string $tiers_mode Defines if the tiering price should be graduated or volume based. In volume-based tiering, the maximum quantity within a period determines the per unit price. In graduated tiering, pricing can change as the quantity grows. * @property null|\Stripe\StripeObject $transform_usage Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with tiers. * @property null|int $trial_period_days Default number of trial days when subscribing a customer to this plan using trial_from_plan=true. * @property string $usage_type Configures how the quantity per period should be determined. Can be either metered or licensed. licensed automatically bills the quantity set when adding it to a subscription. metered aggregates the total usage based on usage records. Defaults to licensed. */ class Plan extends ApiResource { const OBJECT_NAME = 'plan'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Delete; use ApiOperations\Retrieve; use ApiOperations\Update; } diff --git a/plugin/StripeYPT/lib/Price.php b/plugin/StripeYPT/lib/Price.php index 9d3c5540e..4ac5bd33c 100644 --- a/plugin/StripeYPT/lib/Price.php +++ b/plugin/StripeYPT/lib/Price.php @@ -1,62 +1,62 @@ Products help you track * inventory or provisioning, and prices help you track payment terms. Different * physical goods or levels of service should be represented by products, and * pricing options should be represented by prices. This approach lets you change * prices without having to change your provisioning scheme. * * For example, you might have a single "gold" product that has prices * for $10/month, $100/year, and €9 once. * * Related guides: Set up * a subscription, create an invoice, * and more about products * and prices. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property bool $active Whether the price can be used for new purchases. * @property string $billing_scheme Describes how to compute the price per period. Either per_unit or tiered. per_unit indicates that the fixed amount (specified in unit_amount or unit_amount_decimal) will be charged per unit in quantity (for prices with usage_type=licensed), or per unit of total usage (for prices with usage_type=metered). tiered indicates that the unit pricing will be computed using a tiering strategy as defined using the tiers and tiers_mode attributes. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string $currency Three-letter ISO currency code, in lowercase. Must be a supported currency. * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. * @property null|string $lookup_key A lookup key used to retrieve prices dynamically from a static string. * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. - * @property null|string $nickname A brief description of the plan, hidden from customers. + * @property null|string $nickname A brief description of the price, hidden from customers. * @property string|\Stripe\Product $product The ID of the product this price is associated with. * @property null|\Stripe\StripeObject $recurring The recurring components of a price such as interval and usage_type. * @property \Stripe\StripeObject[] $tiers Each element represents a pricing tier. This parameter requires billing_scheme to be set to tiered. See also the documentation for billing_scheme. * @property null|string $tiers_mode Defines if the tiering price should be graduated or volume based. In volume-based tiering, the maximum quantity within a period determines the per unit price. In graduated tiering, pricing can change as the quantity grows. * @property null|\Stripe\StripeObject $transform_quantity Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with tiers. * @property string $type One of one_time or recurring depending on whether the price is for a one-time purchase or a recurring (subscription) purchase. - * @property null|int $unit_amount The unit amount in %s to be charged, represented as a whole integer if possible. - * @property null|string $unit_amount_decimal The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places. + * @property null|int $unit_amount The unit amount in %s to be charged, represented as a whole integer if possible. Only set if billing_scheme=per_unit. + * @property null|string $unit_amount_decimal The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places. Only set if billing_scheme=per_unit. */ class Price extends ApiResource { const OBJECT_NAME = 'price'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; const BILLING_SCHEME_PER_UNIT = 'per_unit'; const BILLING_SCHEME_TIERED = 'tiered'; const TIERS_MODE_GRADUATED = 'graduated'; const TIERS_MODE_VOLUME = 'volume'; const TYPE_ONE_TIME = 'one_time'; const TYPE_RECURRING = 'recurring'; } diff --git a/plugin/StripeYPT/lib/Product.php b/plugin/StripeYPT/lib/Product.php index 5afe1f137..265326a88 100644 --- a/plugin/StripeYPT/lib/Product.php +++ b/plugin/StripeYPT/lib/Product.php @@ -1,53 +1,53 @@ Prices to * configure pricing in Checkout and Subscriptions. * * Related guides: Set up * a subscription or accept one-time * payments with Checkout and more about Products and Prices * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property bool $active Whether the product is currently available for purchase. * @property null|string[] $attributes A list of up to 5 attributes that each SKU can provide values for (e.g., ["color", "size"]). * @property null|string $caption A short one-line description of the product, meant to be displayable to the customer. Only applicable to products of type=good. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property string[] $deactivate_on An array of connect application identifiers that cannot purchase this product. Only applicable to products of type=good. * @property null|string $description The product's description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes. * @property string[] $images A list of up to 8 URLs of images for this product, meant to be displayable to the customer. * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property string $name The product's name, meant to be displayable to the customer. Whenever this product is sold via a subscription, name will show up on associated invoice line item descriptions. - * @property null|\Stripe\StripeObject $package_dimensions The dimensions of this product for shipping purposes. A SKU associated with this product can override this value by having its own package_dimensions. Only applicable to products of type=good. - * @property null|bool $shippable Whether this product is a shipped good. Only applicable to products of type=good. + * @property null|\Stripe\StripeObject $package_dimensions The dimensions of this product for shipping purposes. + * @property null|bool $shippable Whether this product is shipped (i.e., physical goods). * @property null|string $statement_descriptor Extra information about a product which will appear on your customer's credit card statement. In the case that multiple products are billed at once, the first statement descriptor will be used. * @property string $type The type of the product. The product is either of type good, which is eligible for use with Orders and SKUs, or service, which is eligible for use with Subscriptions and Plans. * @property null|string $unit_label A label that represents units of this product in Stripe and on customers’ receipts and invoices. When set, this will be included in associated invoice line item descriptions. * @property int $updated Time at which the object was last updated. Measured in seconds since the Unix epoch. - * @property null|string $url A URL of a publicly-accessible webpage for this product. Only applicable to products of type=good. + * @property null|string $url A URL of a publicly-accessible webpage for this product. */ class Product extends ApiResource { const OBJECT_NAME = 'product'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Delete; use ApiOperations\Retrieve; use ApiOperations\Update; const TYPE_GOOD = 'good'; const TYPE_SERVICE = 'service'; } diff --git a/plugin/StripeYPT/lib/Reporting/ReportRun.php b/plugin/StripeYPT/lib/Reporting/ReportRun.php index 458cbed6c..7c3d2a993 100644 --- a/plugin/StripeYPT/lib/Reporting/ReportRun.php +++ b/plugin/StripeYPT/lib/Reporting/ReportRun.php @@ -1,37 +1,37 @@ API Access to * Reports. * - * Note that reports can only be run based on your live-mode data (not test-mode - * data), and thus related requests must be made with a live-mode API key. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string $error If something should go wrong during the run, a message about the failure (populated when status=failed). - * @property bool $livemode Always true: reports can only be run on live-mode data. + * @property bool $livemode true if the report is run on live mode data and false if it is run on test mode data. * @property \Stripe\StripeObject $parameters * @property string $report_type The ID of the report type to run, such as "balance.summary.1". * @property null|\Stripe\File $result The file object representing the result of the report run (populated when status=succeeded). * @property string $status Status of this report run. This will be pending when the run is initially created. When the run finishes, this will be set to succeeded and the result field will be populated. Rarely, we may encounter an error, at which point this will be set to failed and the error field will be populated. * @property null|int $succeeded_at Timestamp at which this run successfully finished (populated when status=succeeded). Measured in seconds since the Unix epoch. */ class ReportRun extends \Stripe\ApiResource { const OBJECT_NAME = 'reporting.report_run'; use \Stripe\ApiOperations\All; use \Stripe\ApiOperations\Create; use \Stripe\ApiOperations\Retrieve; } diff --git a/plugin/StripeYPT/lib/Reporting/ReportType.php b/plugin/StripeYPT/lib/Reporting/ReportType.php index cf753012a..3bb146029 100644 --- a/plugin/StripeYPT/lib/Reporting/ReportType.php +++ b/plugin/StripeYPT/lib/Reporting/ReportType.php @@ -1,34 +1,34 @@ API Access to Reports * documentation for those Report Type IDs, along with required and optional * parameters. * - * Note that reports can only be run based on your live-mode data (not test-mode - * data), and thus related requests must be made with a live-mode API key. * * @property string $id The ID of the Report Type, such as balance.summary.1. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property int $data_available_end Most recent time for which this Report Type is available. Measured in seconds since the Unix epoch. * @property int $data_available_start Earliest time for which this Report Type is available. Measured in seconds since the Unix epoch. * @property null|string[] $default_columns List of column names that are included by default when this Report Type gets run. (If the Report Type doesn't support the columns parameter, this will be null.) * @property string $name Human-readable name of the Report Type * @property int $updated When this Report Type was latest updated. Measured in seconds since the Unix epoch. * @property int $version Version of the Report Type. Different versions report with the same ID will have the same purpose, but may take different run parameters or have different result schemas. */ class ReportType extends \Stripe\ApiResource { const OBJECT_NAME = 'reporting.report_type'; use \Stripe\ApiOperations\All; use \Stripe\ApiOperations\Retrieve; } diff --git a/plugin/StripeYPT/lib/Service/BillingPortal/BillingPortalServiceFactory.php b/plugin/StripeYPT/lib/Service/BillingPortal/BillingPortalServiceFactory.php index 756ae1769..23a4d30b2 100644 --- a/plugin/StripeYPT/lib/Service/BillingPortal/BillingPortalServiceFactory.php +++ b/plugin/StripeYPT/lib/Service/BillingPortal/BillingPortalServiceFactory.php @@ -1,25 +1,27 @@ */ private static $classMap = [ + 'configurations' => ConfigurationService::class, 'sessions' => SessionService::class, ]; protected function getServiceClass($name) { return \array_key_exists($name, self::$classMap) ? self::$classMap[$name] : null; } } diff --git a/plugin/StripeYPT/lib/Service/BillingPortal/ConfigurationService.php b/plugin/StripeYPT/lib/Service/BillingPortal/ConfigurationService.php new file mode 100644 index 000000000..5a0d70db7 --- /dev/null +++ b/plugin/StripeYPT/lib/Service/BillingPortal/ConfigurationService.php @@ -0,0 +1,73 @@ +requestCollection('get', '/v1/billing_portal/configurations', $params, $opts); + } + + /** + * Creates a configuration that describes the functionality and behavior of a + * PortalSession. + * + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\BillingPortal\Configuration + */ + public function create($params = null, $opts = null) + { + return $this->request('post', '/v1/billing_portal/configurations', $params, $opts); + } + + /** + * Retrieves a configuration that describes the functionality of the customer + * portal. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\BillingPortal\Configuration + */ + public function retrieve($id, $params = null, $opts = null) + { + return $this->request('get', $this->buildPath('/v1/billing_portal/configurations/%s', $id), $params, $opts); + } + + /** + * Updates a configuration that describes the functionality of the customer portal. + * + * @param string $id + * @param null|array $params + * @param null|array|\Stripe\Util\RequestOptions $opts + * + * @throws \Stripe\Exception\ApiErrorException if the request fails + * + * @return \Stripe\BillingPortal\Configuration + */ + public function update($id, $params = null, $opts = null) + { + return $this->request('post', $this->buildPath('/v1/billing_portal/configurations/%s', $id), $params, $opts); + } +} diff --git a/plugin/StripeYPT/lib/Service/Reporting/ReportRunService.php b/plugin/StripeYPT/lib/Service/Reporting/ReportRunService.php index 46e2139a2..692420cd4 100644 --- a/plugin/StripeYPT/lib/Service/Reporting/ReportRunService.php +++ b/plugin/StripeYPT/lib/Service/Reporting/ReportRunService.php @@ -1,57 +1,55 @@ live-mode API key.). + * Returns a list of Report Runs, with the most recent appearing first. * * @param null|array $params * @param null|array|\Stripe\Util\RequestOptions $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\Collection */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/reporting/report_runs', $params, $opts); } /** - * Creates a new object and begin running the report. (Requires a live-mode API key.). + * Creates a new object and begin running the report. (Certain report types require + * a live-mode API key.). * * @param null|array $params * @param null|array|\Stripe\Util\RequestOptions $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\Reporting\ReportRun */ public function create($params = null, $opts = null) { return $this->request('post', '/v1/reporting/report_runs', $params, $opts); } /** - * Retrieves the details of an existing Report Run. (Requires a live-mode API key.). + * Retrieves the details of an existing Report Run. * * @param string $id * @param null|array $params * @param null|array|\Stripe\Util\RequestOptions $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\Reporting\ReportRun */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/reporting/report_runs/%s', $id), $params, $opts); } } diff --git a/plugin/StripeYPT/lib/Service/Reporting/ReportTypeService.php b/plugin/StripeYPT/lib/Service/Reporting/ReportTypeService.php index 46f6bf83e..e1b4ea521 100644 --- a/plugin/StripeYPT/lib/Service/Reporting/ReportTypeService.php +++ b/plugin/StripeYPT/lib/Service/Reporting/ReportTypeService.php @@ -1,41 +1,40 @@ live-mode API key.). + * Returns a full list of Report Types. * * @param null|array $params * @param null|array|\Stripe\Util\RequestOptions $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\Collection */ public function all($params = null, $opts = null) { return $this->requestCollection('get', '/v1/reporting/report_types', $params, $opts); } /** - * Retrieves the details of a Report Type. (Requires a live-mode API key.). * * @param string $id * @param null|array $params * @param null|array|\Stripe\Util\RequestOptions $opts * * @throws \Stripe\Exception\ApiErrorException if the request fails * * @return \Stripe\Reporting\ReportType */ public function retrieve($id, $params = null, $opts = null) { return $this->request('get', $this->buildPath('/v1/reporting/report_types/%s', $id), $params, $opts); } } diff --git a/plugin/StripeYPT/lib/Stripe.php b/plugin/StripeYPT/lib/Stripe.php index 7012f9655..24dd38aee 100644 --- a/plugin/StripeYPT/lib/Stripe.php +++ b/plugin/StripeYPT/lib/Stripe.php @@ -1,278 +1,278 @@ "old_value"] * * If we update the object with `metadata[new]=new_value`, the server side * object now has *both* fields: * * metadata = ["old" => "old_value", "new" => "new_value"] * * This is okay in itself because usually users will want to treat it as * additive: * * $obj->metadata["new"] = "new_value"; * $obj->save(); * * However, in other cases, they may want to replace the entire existing * contents: * * $obj->metadata = ["new" => "new_value"]; * $obj->save(); * * This is where things get a little bit tricky because in order to clear * any old keys that may have existed, we actually have to send an explicit * empty string to the server. So the operation above would have to send * this form to get the intended behavior: * * metadata[old]=&metadata[new]=new_value * * This method allows us to track which parameters are considered additive, * and lets us behave correctly where appropriate when serializing * parameters to be sent. * * @return Util\Set Set of additive parameters */ public static function getAdditiveParams() { static $additiveParams = null; if (null === $additiveParams) { // Set `metadata` as additive so that when it's set directly we remember // to clear keys that may have been previously set by sending empty // values for them. // // It's possible that not every object has `metadata`, but having this // option set when there is no `metadata` field is not harmful. $additiveParams = new Util\Set([ 'metadata', ]); } return $additiveParams; } public function __construct($id = null, $opts = null) { list($id, $this->_retrieveOptions) = Util\Util::normalizeId($id); $this->_opts = Util\RequestOptions::parse($opts); $this->_originalValues = []; $this->_values = []; $this->_unsavedValues = new Util\Set(); $this->_transientValues = new Util\Set(); if (null !== $id) { $this->_values['id'] = $id; } } // Standard accessor magic methods public function __set($k, $v) { if (static::getPermanentAttributes()->includes($k)) { throw new Exception\InvalidArgumentException( "Cannot set {$k} on this object. HINT: you can't set: " . \implode(', ', static::getPermanentAttributes()->toArray()) ); } if ('' === $v) { throw new Exception\InvalidArgumentException( 'You cannot set \'' . $k . '\'to an empty string. ' . 'We interpret empty strings as NULL in requests. ' . 'You may set obj->' . $k . ' = NULL to delete the property' ); } $this->_values[$k] = Util\Util::convertToStripeObject($v, $this->_opts); $this->dirtyValue($this->_values[$k]); $this->_unsavedValues->add($k); } public function __isset($k) { return isset($this->_values[$k]); } public function __unset($k) { unset($this->_values[$k]); $this->_transientValues->add($k); $this->_unsavedValues->discard($k); } public function &__get($k) { // function should return a reference, using $nullval to return a reference to null $nullval = null; if (!empty($this->_values) && \array_key_exists($k, $this->_values)) { return $this->_values[$k]; } if (!empty($this->_transientValues) && $this->_transientValues->includes($k)) { $class = static::class; $attrs = \implode(', ', \array_keys($this->_values)); $message = "Stripe Notice: Undefined property of {$class} instance: {$k}. " . "HINT: The {$k} attribute was set in the past, however. " . 'It was then wiped when refreshing the object ' . "with the result returned by Stripe's API, " . 'probably as a result of a save(). The attributes currently ' . "available on this object are: {$attrs}"; Stripe::getLogger()->error($message); return $nullval; } $class = static::class; Stripe::getLogger()->error("Stripe Notice: Undefined property of {$class} instance: {$k}"); return $nullval; } // Magic method for var_dump output. Only works with PHP >= 5.6 public function __debugInfo() { return $this->_values; } // ArrayAccess methods public function offsetSet($k, $v) { $this->{$k} = $v; } public function offsetExists($k) { return \array_key_exists($k, $this->_values); } public function offsetUnset($k) { unset($this->{$k}); } public function offsetGet($k) { return \array_key_exists($k, $this->_values) ? $this->_values[$k] : null; } // Countable method public function count() { return \count($this->_values); } public function keys() { return \array_keys($this->_values); } public function values() { return \array_values($this->_values); } /** * This unfortunately needs to be public to be used in Util\Util. * * @param array $values * @param null|array|string|Util\RequestOptions $opts * * @return static the object constructed from the given values */ public static function constructFrom($values, $opts = null) { $obj = new static(isset($values['id']) ? $values['id'] : null); $obj->refreshFrom($values, $opts); return $obj; } /** * Refreshes this object using the provided values. * * @param array $values * @param null|array|string|Util\RequestOptions $opts * @param bool $partial defaults to false */ public function refreshFrom($values, $opts, $partial = false) { $this->_opts = Util\RequestOptions::parse($opts); $this->_originalValues = self::deepCopy($values); if ($values instanceof StripeObject) { $values = $values->toArray(); } // Wipe old state before setting new. This is useful for e.g. updating a // customer, where there is no persistent card parameter. Mark those values // which don't persist as transient if ($partial) { $removed = new Util\Set(); } else { $removed = new Util\Set(\array_diff(\array_keys($this->_values), \array_keys($values))); } foreach ($removed->toArray() as $k) { unset($this->{$k}); } $this->updateAttributes($values, $opts, false); foreach ($values as $k => $v) { $this->_transientValues->discard($k); $this->_unsavedValues->discard($k); } } /** * Mass assigns attributes on the model. * * @param array $values * @param null|array|string|Util\RequestOptions $opts * @param bool $dirty defaults to true */ public function updateAttributes($values, $opts = null, $dirty = true) { foreach ($values as $k => $v) { // Special-case metadata to always be cast as a StripeObject // This is necessary in case metadata is empty, as PHP arrays do // not differentiate between lists and hashes, and we consider // empty arrays to be lists. if (('metadata' === $k) && (\is_array($v))) { $this->_values[$k] = StripeObject::constructFrom($v, $opts); } else { $this->_values[$k] = Util\Util::convertToStripeObject($v, $opts); } if ($dirty) { $this->dirtyValue($this->_values[$k]); } $this->_unsavedValues->add($k); } } /** * @param bool $force defaults to false * * @return array a recursive mapping of attributes to values for this object, * including the proper value for deleted attributes */ public function serializeParameters($force = false) { $updateParams = []; foreach ($this->_values as $k => $v) { // There are a few reasons that we may want to add in a parameter for // update: // // 1. The `$force` option has been set. // 2. We know that it was modified. // 3. Its value is a StripeObject. A StripeObject may contain modified // values within in that its parent StripeObject doesn't know about. // $original = \array_key_exists($k, $this->_originalValues) ? $this->_originalValues[$k] : null; $unsaved = $this->_unsavedValues->includes($k); if ($force || $unsaved || $v instanceof StripeObject) { $updateParams[$k] = $this->serializeParamsValue( $this->_values[$k], $original, $unsaved, $force, $k ); } } // a `null` that makes it out of `serializeParamsValue` signals an empty // value that we shouldn't appear in the serialized form of the object return \array_filter( $updateParams, function ($v) { return null !== $v; } ); } public function serializeParamsValue($value, $original, $unsaved, $force, $key = null) { // The logic here is that essentially any object embedded in another // object that had a `type` is actually an API resource of a different // type that's been included in the response. These other resources must // be updated from their proper endpoints, and therefore they are not // included when serializing even if they've been modified. // // There are _some_ known exceptions though. // // For example, if the value is unsaved (meaning the user has set it), and // it looks like the API resource is persisted with an ID, then we include // the object so that parameters are serialized with a reference to its // ID. // // Another example is that on save API calls it's sometimes desirable to // update a customer's default source by setting a new card (or other) // object with `->source=` and then saving the customer. The // `saveWithParent` flag to override the default behavior allows us to // handle these exceptions. // // We throw an error if a property was set explicitly but we can't do // anything with it because the integration is probably not working as the // user intended it to. if (null === $value) { return ''; } if (($value instanceof ApiResource) && (!$value->saveWithParent)) { if (!$unsaved) { return null; } if (isset($value->id)) { return $value; } throw new Exception\InvalidArgumentException( "Cannot save property `{$key}` containing an API resource of type " . \get_class($value) . ". It doesn't appear to be persisted and is " . 'not marked as `saveWithParent`.' ); } if (\is_array($value)) { if (Util\Util::isList($value)) { // Sequential array, i.e. a list $update = []; foreach ($value as $v) { - \array_push($update, $this->serializeParamsValue($v, null, true, $force)); + $update[] = $this->serializeParamsValue($v, null, true, $force); } // This prevents an array that's unchanged from being resent. if ($update !== $this->serializeParamsValue($original, null, true, $force, $key)) { return $update; } } else { // Associative array, i.e. a map return Util\Util::convertToStripeObject($value, $this->_opts)->serializeParameters(); } } elseif ($value instanceof StripeObject) { $update = $value->serializeParameters($force); if ($original && $unsaved && $key && static::getAdditiveParams()->includes($key)) { $update = \array_merge(self::emptyValues($original), $update); } return $update; } else { return $value; } } public function jsonSerialize() { return $this->toArray(); } /** * Returns an associative array with the key and values composing the * Stripe object. * * @return array the associative array */ public function toArray() { $maybeToArray = function ($value) { if (null === $value) { return null; } return \is_object($value) && \method_exists($value, 'toArray') ? $value->toArray() : $value; }; return \array_reduce(\array_keys($this->_values), function ($acc, $k) use ($maybeToArray) { if ('_' === \substr((string) $k, 0, 1)) { return $acc; } $v = $this->_values[$k]; if (Util\Util::isList($v)) { $acc[$k] = \array_map($maybeToArray, $v); } else { $acc[$k] = $maybeToArray($v); } return $acc; }, []); } /** * Returns a pretty JSON representation of the Stripe object. * * @return string the JSON representation of the Stripe object */ public function toJSON() { return \json_encode($this->toArray(), \JSON_PRETTY_PRINT); } public function __toString() { $class = static::class; return $class . ' JSON: ' . $this->toJSON(); } /** * Sets all keys within the StripeObject as unsaved so that they will be * included with an update when `serializeParameters` is called. This * method is also recursive, so any StripeObjects contained as values or * which are values in a tenant array are also marked as dirty. */ public function dirty() { $this->_unsavedValues = new Util\Set(\array_keys($this->_values)); foreach ($this->_values as $k => $v) { $this->dirtyValue($v); } } protected function dirtyValue($value) { if (\is_array($value)) { foreach ($value as $v) { $this->dirtyValue($v); } } elseif ($value instanceof StripeObject) { $value->dirty(); } } /** * Produces a deep copy of the given object including support for arrays * and StripeObjects. * * @param mixed $obj */ protected static function deepCopy($obj) { if (\is_array($obj)) { $copy = []; foreach ($obj as $k => $v) { $copy[$k] = self::deepCopy($v); } return $copy; } if ($obj instanceof StripeObject) { return $obj::constructFrom( self::deepCopy($obj->_values), clone $obj->_opts ); } return $obj; } /** * Returns a hash of empty values for all the values that are in the given * StripeObject. * * @param mixed $obj */ public static function emptyValues($obj) { if (\is_array($obj)) { $values = $obj; } elseif ($obj instanceof StripeObject) { $values = $obj->_values; } else { throw new Exception\InvalidArgumentException( 'empty_values got unexpected object type: ' . \get_class($obj) ); } return \array_fill_keys(\array_keys($values), ''); } /** * @return null|ApiResponse The last response from the Stripe API */ public function getLastResponse() { return $this->_lastResponse; } /** * Sets the last response from the Stripe API. * * @param ApiResponse $resp */ public function setLastResponse($resp) { $this->_lastResponse = $resp; } /** * Indicates whether or not the resource has been deleted on the server. * Note that some, but not all, resources can indicate whether they have * been deleted. * * @return bool whether the resource is deleted */ public function isDeleted() { return isset($this->_values['deleted']) ? $this->_values['deleted'] : false; } } diff --git a/plugin/StripeYPT/lib/SubscriptionScheduleRevision.php b/plugin/StripeYPT/lib/SubscriptionScheduleRevision.php deleted file mode 100644 index 121772365..000000000 --- a/plugin/StripeYPT/lib/SubscriptionScheduleRevision.php +++ /dev/null @@ -1,77 +0,0 @@ -retrieveRevision('revision_id') instead."; - throw new Error\InvalidRequest($msg, null); - } - - /** - * @param array|string $_id - * @param array|string|null $_opts - * - * @throws \Stripe\Error\InvalidRequest - */ - public static function all($params = null, $opts = null) - { - $msg = "Subscription Schedule Revisions cannot be listed without a Subscription Schedule ID. " . - "List those using \$schedule->allRevisions('revision_id') instead."; - throw new Error\InvalidRequest($msg, null); - } -} diff --git a/plugin/StripeYPT/lib/TaxId.php b/plugin/StripeYPT/lib/TaxId.php index d4188fe40..7281f00ba 100644 --- a/plugin/StripeYPT/lib/TaxId.php +++ b/plugin/StripeYPT/lib/TaxId.php @@ -1,106 +1,107 @@ customer. A customer's tax IDs * are displayed on invoices and credit notes issued for the customer. * * Related guide: Customer * Tax Identification Numbers. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property null|string $country Two-letter ISO code representing the country of the tax ID. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string|\Stripe\Customer $customer ID of the customer. * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. - * @property string $type Type of the tax ID, one of ae_trn, au_abn, br_cnpj, br_cpf, ca_bn, ca_qst, ch_vat, cl_tin, es_cif, eu_vat, hk_br, id_npwp, in_gst, jp_cn, jp_rn, kr_brn, li_uid, mx_rfc, my_frp, my_itn, my_sst, no_vat, nz_gst, ru_inn, ru_kpp, sa_vat, sg_gst, sg_uen, th_vat, tw_vat, us_ein, or za_vat. Note that some legacy tax IDs have type unknown + * @property string $type Type of the tax ID, one of ae_trn, au_abn, br_cnpj, br_cpf, ca_bn, ca_qst, ch_vat, cl_tin, es_cif, eu_vat, gb_vat, hk_br, id_npwp, in_gst, jp_cn, jp_rn, kr_brn, li_uid, mx_rfc, my_frp, my_itn, my_sst, no_vat, nz_gst, ru_inn, ru_kpp, sa_vat, sg_gst, sg_uen, th_vat, tw_vat, us_ein, or za_vat. Note that some legacy tax IDs have type unknown * @property string $value Value of the tax ID. * @property null|\Stripe\StripeObject $verification Tax ID verification information. */ class TaxId extends ApiResource { const OBJECT_NAME = 'tax_id'; use ApiOperations\Delete; const TYPE_AE_TRN = 'ae_trn'; const TYPE_AU_ABN = 'au_abn'; const TYPE_BR_CNPJ = 'br_cnpj'; const TYPE_BR_CPF = 'br_cpf'; const TYPE_CA_BN = 'ca_bn'; const TYPE_CA_QST = 'ca_qst'; const TYPE_CH_VAT = 'ch_vat'; const TYPE_CL_TIN = 'cl_tin'; const TYPE_ES_CIF = 'es_cif'; const TYPE_EU_VAT = 'eu_vat'; + const TYPE_GB_VAT = 'gb_vat'; const TYPE_HK_BR = 'hk_br'; const TYPE_ID_NPWP = 'id_npwp'; const TYPE_IN_GST = 'in_gst'; const TYPE_JP_CN = 'jp_cn'; const TYPE_JP_RN = 'jp_rn'; const TYPE_KR_BRN = 'kr_brn'; const TYPE_LI_UID = 'li_uid'; const TYPE_MX_RFC = 'mx_rfc'; const TYPE_MY_FRP = 'my_frp'; const TYPE_MY_ITN = 'my_itn'; const TYPE_MY_SST = 'my_sst'; const TYPE_NO_VAT = 'no_vat'; const TYPE_NZ_GST = 'nz_gst'; const TYPE_RU_INN = 'ru_inn'; const TYPE_RU_KPP = 'ru_kpp'; const TYPE_SA_VAT = 'sa_vat'; const TYPE_SG_GST = 'sg_gst'; const TYPE_SG_UEN = 'sg_uen'; const TYPE_TH_VAT = 'th_vat'; const TYPE_TW_VAT = 'tw_vat'; const TYPE_UNKNOWN = 'unknown'; const TYPE_US_EIN = 'us_ein'; const TYPE_ZA_VAT = 'za_vat'; const VERIFICATION_STATUS_PENDING = 'pending'; const VERIFICATION_STATUS_UNAVAILABLE = 'unavailable'; const VERIFICATION_STATUS_UNVERIFIED = 'unverified'; const VERIFICATION_STATUS_VERIFIED = 'verified'; /** * @return string the API URL for this tax id */ public function instanceUrl() { $id = $this['id']; $customer = $this['customer']; if (!$id) { throw new Exception\UnexpectedValueException( "Could not determine which URL to request: class instance has invalid ID: {$id}" ); } $id = Util\Util::utf8($id); $customer = Util\Util::utf8($customer); $base = Customer::classUrl(); $customerExtn = \urlencode($customer); $extn = \urlencode($id); return "{$base}/{$customerExtn}/tax_ids/{$extn}"; } /** * @param array|string $_id * @param null|array|string $_opts * * @throws \Stripe\Exception\BadMethodCallException */ public static function retrieve($_id, $_opts = null) { $msg = 'Tax IDs cannot be retrieved without a customer ID. Retrieve ' . "a tax ID using `Customer::retrieveTaxId('customer_id', " . "'tax_id_id')`."; throw new Exception\BadMethodCallException($msg); } } diff --git a/plugin/StripeYPT/lib/TaxRate.php b/plugin/StripeYPT/lib/TaxRate.php index 2974f8383..e0ce630c3 100644 --- a/plugin/StripeYPT/lib/TaxRate.php +++ b/plugin/StripeYPT/lib/TaxRate.php @@ -1,38 +1,40 @@ invoices, subscriptions and * Checkout * Sessions to collect tax. * * Related guide: Tax * Rates. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property bool $active Defaults to true. When set to false, this tax rate cannot be used with new applications or Checkout Sessions, but will still work for subscriptions and invoices that already have it set. + * @property null|string $country Two-letter country code (ISO 3166-1 alpha-2). * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property null|string $description An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers. * @property string $display_name The display name of the tax rates as it will appear to your customer on their receipt email, PDF, and the hosted invoice page. * @property bool $inclusive This specifies if the tax rate is inclusive or exclusive. * @property null|string $jurisdiction The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. It also appears on your customer’s invoice. * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. * @property null|\Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. * @property float $percentage This represents the tax rate percent out of 100. + * @property null|string $state ISO 3166-2 subdivision code, without country prefix. For example, "NY" for New York, United States. */ class TaxRate extends ApiResource { const OBJECT_NAME = 'tax_rate'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Retrieve; use ApiOperations\Update; } diff --git a/plugin/StripeYPT/lib/Terminal/ConnectionToken.php b/plugin/StripeYPT/lib/Terminal/ConnectionToken.php index e688857b0..374147390 100644 --- a/plugin/StripeYPT/lib/Terminal/ConnectionToken.php +++ b/plugin/StripeYPT/lib/Terminal/ConnectionToken.php @@ -1,23 +1,22 @@ Fleet - * Management. + * href="https://stripe.com/docs/terminal/creating-locations">Fleet Management. * * @property string $object String representing the object's type. Objects of the same type share the same value. * @property string $location The id of the location that this connection token is scoped to. * @property string $secret Your application should pass this token to the Stripe Terminal SDK. */ class ConnectionToken extends \Stripe\ApiResource { const OBJECT_NAME = 'terminal.connection_token'; use \Stripe\ApiOperations\Create; } diff --git a/plugin/StripeYPT/lib/Terminal/Location.php b/plugin/StripeYPT/lib/Terminal/Location.php index 5769ef358..422cd756a 100644 --- a/plugin/StripeYPT/lib/Terminal/Location.php +++ b/plugin/StripeYPT/lib/Terminal/Location.php @@ -1,30 +1,29 @@ Fleet - * Management. + * href="https://stripe.com/docs/terminal/creating-locations">Fleet Management. * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property \Stripe\StripeObject $address * @property string $display_name The display name of the location. * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. * @property \Stripe\StripeObject $metadata Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. */ class Location extends \Stripe\ApiResource { const OBJECT_NAME = 'terminal.location'; use \Stripe\ApiOperations\All; use \Stripe\ApiOperations\Create; use \Stripe\ApiOperations\Delete; use \Stripe\ApiOperations\Retrieve; use \Stripe\ApiOperations\Update; } diff --git a/plugin/StripeYPT/lib/Token.php b/plugin/StripeYPT/lib/Token.php index de7988cfb..18b33e868 100644 --- a/plugin/StripeYPT/lib/Token.php +++ b/plugin/StripeYPT/lib/Token.php @@ -1,57 +1,57 @@ recommended payments integrations to * perform this process client-side. This ensures that no sensitive card data * touches your server, and allows your integration to operate in a PCI-compliant * way. * * If you cannot use client-side tokenization, you can also create tokens using the * API with either your publishable or secret API key. Keep in mind that if your * integration uses this method, you are responsible for any PCI compliance that * may be required, and you must keep your secret API key safe. Unlike with * client-side tokenization, your customer's information is not sent directly to * Stripe, so we cannot determine how it is handled or stored. * * Tokens cannot be stored or used more than once. To store card or bank account * information for later use, you can create Customer objects or Custom accounts. Note * that Radar, our integrated solution - * for automatic fraud protection, supports only integrations that use client-side - * tokenization. + * for automatic fraud protection, performs best with integrations that use + * client-side tokenization. * * Related guide: Accept * a payment * * @property string $id Unique identifier for the object. * @property string $object String representing the object's type. Objects of the same type share the same value. * @property \Stripe\BankAccount $bank_account

These bank accounts are payment methods on Customer objects.

On the other hand External Accounts are transfer destinations on Account objects for Custom accounts. They can be bank accounts or debit cards as well, and are documented in the links above.

Related guide: Bank Debits and Transfers.

* @property \Stripe\Card $card

You can store multiple cards on a customer in order to charge the customer later. You can also store multiple debit cards on a recipient in order to transfer to those cards later.

Related guide: Card Payments with Sources.

* @property null|string $client_ip IP address of the client that generated the token. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. * @property bool $livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode. * @property string $type Type of the token: account, bank_account, card, or pii. * @property bool $used Whether this token has already been used (tokens can be used only once). */ class Token extends ApiResource { const OBJECT_NAME = 'token'; use ApiOperations\Create; use ApiOperations\Retrieve; const TYPE_ACCOUNT = 'account'; const TYPE_BANK_ACCOUNT = 'bank_account'; const TYPE_CARD = 'card'; const TYPE_PII = 'pii'; } diff --git a/plugin/StripeYPT/lib/Util/AutoPagingIterator.php b/plugin/StripeYPT/lib/Util/AutoPagingIterator.php deleted file mode 100644 index 167d1258a..000000000 --- a/plugin/StripeYPT/lib/Util/AutoPagingIterator.php +++ /dev/null @@ -1,61 +0,0 @@ -page = $collection; - $this->params = $params; - } - - public function rewind() - { - // Actually rewinding would require making a copy of the original page. - } - - public function current() - { - $item = current($this->page->data); - $this->lastId = $item !== false ? $item['id'] : null; - - return $item; - } - - public function key() - { - return key($this->page->data) + $this->pageOffset; - } - - public function next() - { - $item = next($this->page->data); - if ($item === false) { - // If we've run out of data on the current page, try to fetch another one - // and increase the offset the new page would start at - $this->pageOffset += count($this->page->data); - if ($this->page['has_more']) { - $this->params = array_merge( - $this->params ?: [], - ['starting_after' => $this->lastId] - ); - $this->page = $this->page->all($this->params); - } else { - return false; - } - } - } - - public function valid() - { - $key = key($this->page->data); - $valid = ($key !== null && $key !== false); - return $valid; - } -} diff --git a/plugin/StripeYPT/lib/Util/ObjectTypes.php b/plugin/StripeYPT/lib/Util/ObjectTypes.php index 5aad2bb40..78594ef5b 100644 --- a/plugin/StripeYPT/lib/Util/ObjectTypes.php +++ b/plugin/StripeYPT/lib/Util/ObjectTypes.php @@ -1,99 +1,100 @@ \Stripe\Account::class, \Stripe\AccountLink::OBJECT_NAME => \Stripe\AccountLink::class, \Stripe\AlipayAccount::OBJECT_NAME => \Stripe\AlipayAccount::class, \Stripe\ApplePayDomain::OBJECT_NAME => \Stripe\ApplePayDomain::class, \Stripe\ApplicationFee::OBJECT_NAME => \Stripe\ApplicationFee::class, \Stripe\ApplicationFeeRefund::OBJECT_NAME => \Stripe\ApplicationFeeRefund::class, \Stripe\Balance::OBJECT_NAME => \Stripe\Balance::class, \Stripe\BalanceTransaction::OBJECT_NAME => \Stripe\BalanceTransaction::class, \Stripe\BankAccount::OBJECT_NAME => \Stripe\BankAccount::class, + \Stripe\BillingPortal\Configuration::OBJECT_NAME => \Stripe\BillingPortal\Configuration::class, \Stripe\BillingPortal\Session::OBJECT_NAME => \Stripe\BillingPortal\Session::class, \Stripe\BitcoinReceiver::OBJECT_NAME => \Stripe\BitcoinReceiver::class, \Stripe\BitcoinTransaction::OBJECT_NAME => \Stripe\BitcoinTransaction::class, \Stripe\Capability::OBJECT_NAME => \Stripe\Capability::class, \Stripe\Card::OBJECT_NAME => \Stripe\Card::class, \Stripe\Charge::OBJECT_NAME => \Stripe\Charge::class, \Stripe\Checkout\Session::OBJECT_NAME => \Stripe\Checkout\Session::class, \Stripe\Collection::OBJECT_NAME => \Stripe\Collection::class, \Stripe\CountrySpec::OBJECT_NAME => \Stripe\CountrySpec::class, \Stripe\Coupon::OBJECT_NAME => \Stripe\Coupon::class, \Stripe\CreditNote::OBJECT_NAME => \Stripe\CreditNote::class, \Stripe\CreditNoteLineItem::OBJECT_NAME => \Stripe\CreditNoteLineItem::class, \Stripe\Customer::OBJECT_NAME => \Stripe\Customer::class, \Stripe\CustomerBalanceTransaction::OBJECT_NAME => \Stripe\CustomerBalanceTransaction::class, \Stripe\Discount::OBJECT_NAME => \Stripe\Discount::class, \Stripe\Dispute::OBJECT_NAME => \Stripe\Dispute::class, \Stripe\EphemeralKey::OBJECT_NAME => \Stripe\EphemeralKey::class, \Stripe\Event::OBJECT_NAME => \Stripe\Event::class, \Stripe\ExchangeRate::OBJECT_NAME => \Stripe\ExchangeRate::class, \Stripe\File::OBJECT_NAME => \Stripe\File::class, \Stripe\File::OBJECT_NAME_ALT => \Stripe\File::class, \Stripe\FileLink::OBJECT_NAME => \Stripe\FileLink::class, \Stripe\Invoice::OBJECT_NAME => \Stripe\Invoice::class, \Stripe\InvoiceItem::OBJECT_NAME => \Stripe\InvoiceItem::class, \Stripe\InvoiceLineItem::OBJECT_NAME => \Stripe\InvoiceLineItem::class, \Stripe\Issuing\Authorization::OBJECT_NAME => \Stripe\Issuing\Authorization::class, \Stripe\Issuing\Card::OBJECT_NAME => \Stripe\Issuing\Card::class, \Stripe\Issuing\CardDetails::OBJECT_NAME => \Stripe\Issuing\CardDetails::class, \Stripe\Issuing\Cardholder::OBJECT_NAME => \Stripe\Issuing\Cardholder::class, \Stripe\Issuing\Dispute::OBJECT_NAME => \Stripe\Issuing\Dispute::class, \Stripe\Issuing\Transaction::OBJECT_NAME => \Stripe\Issuing\Transaction::class, \Stripe\LineItem::OBJECT_NAME => \Stripe\LineItem::class, \Stripe\LoginLink::OBJECT_NAME => \Stripe\LoginLink::class, \Stripe\Mandate::OBJECT_NAME => \Stripe\Mandate::class, \Stripe\Order::OBJECT_NAME => \Stripe\Order::class, \Stripe\OrderItem::OBJECT_NAME => \Stripe\OrderItem::class, \Stripe\OrderReturn::OBJECT_NAME => \Stripe\OrderReturn::class, \Stripe\PaymentIntent::OBJECT_NAME => \Stripe\PaymentIntent::class, \Stripe\PaymentMethod::OBJECT_NAME => \Stripe\PaymentMethod::class, \Stripe\Payout::OBJECT_NAME => \Stripe\Payout::class, \Stripe\Person::OBJECT_NAME => \Stripe\Person::class, \Stripe\Plan::OBJECT_NAME => \Stripe\Plan::class, \Stripe\Price::OBJECT_NAME => \Stripe\Price::class, \Stripe\Product::OBJECT_NAME => \Stripe\Product::class, \Stripe\PromotionCode::OBJECT_NAME => \Stripe\PromotionCode::class, \Stripe\Radar\EarlyFraudWarning::OBJECT_NAME => \Stripe\Radar\EarlyFraudWarning::class, \Stripe\Radar\ValueList::OBJECT_NAME => \Stripe\Radar\ValueList::class, \Stripe\Radar\ValueListItem::OBJECT_NAME => \Stripe\Radar\ValueListItem::class, \Stripe\Recipient::OBJECT_NAME => \Stripe\Recipient::class, \Stripe\RecipientTransfer::OBJECT_NAME => \Stripe\RecipientTransfer::class, \Stripe\Refund::OBJECT_NAME => \Stripe\Refund::class, \Stripe\Reporting\ReportRun::OBJECT_NAME => \Stripe\Reporting\ReportRun::class, \Stripe\Reporting\ReportType::OBJECT_NAME => \Stripe\Reporting\ReportType::class, \Stripe\Review::OBJECT_NAME => \Stripe\Review::class, \Stripe\SetupAttempt::OBJECT_NAME => \Stripe\SetupAttempt::class, \Stripe\SetupIntent::OBJECT_NAME => \Stripe\SetupIntent::class, \Stripe\Sigma\ScheduledQueryRun::OBJECT_NAME => \Stripe\Sigma\ScheduledQueryRun::class, \Stripe\SKU::OBJECT_NAME => \Stripe\SKU::class, \Stripe\Source::OBJECT_NAME => \Stripe\Source::class, \Stripe\SourceTransaction::OBJECT_NAME => \Stripe\SourceTransaction::class, \Stripe\Subscription::OBJECT_NAME => \Stripe\Subscription::class, \Stripe\SubscriptionItem::OBJECT_NAME => \Stripe\SubscriptionItem::class, \Stripe\SubscriptionSchedule::OBJECT_NAME => \Stripe\SubscriptionSchedule::class, \Stripe\TaxId::OBJECT_NAME => \Stripe\TaxId::class, \Stripe\TaxRate::OBJECT_NAME => \Stripe\TaxRate::class, \Stripe\Terminal\ConnectionToken::OBJECT_NAME => \Stripe\Terminal\ConnectionToken::class, \Stripe\Terminal\Location::OBJECT_NAME => \Stripe\Terminal\Location::class, \Stripe\Terminal\Reader::OBJECT_NAME => \Stripe\Terminal\Reader::class, \Stripe\ThreeDSecure::OBJECT_NAME => \Stripe\ThreeDSecure::class, \Stripe\Token::OBJECT_NAME => \Stripe\Token::class, \Stripe\Topup::OBJECT_NAME => \Stripe\Topup::class, \Stripe\Transfer::OBJECT_NAME => \Stripe\Transfer::class, \Stripe\TransferReversal::OBJECT_NAME => \Stripe\TransferReversal::class, \Stripe\UsageRecord::OBJECT_NAME => \Stripe\UsageRecord::class, \Stripe\UsageRecordSummary::OBJECT_NAME => \Stripe\UsageRecordSummary::class, \Stripe\WebhookEndpoint::OBJECT_NAME => \Stripe\WebhookEndpoint::class, ]; } diff --git a/plugin/StripeYPT/lib/Util/RequestOptions.php b/plugin/StripeYPT/lib/Util/RequestOptions.php index 1effb9ab5..89924bb6c 100644 --- a/plugin/StripeYPT/lib/Util/RequestOptions.php +++ b/plugin/StripeYPT/lib/Util/RequestOptions.php @@ -1,168 +1,168 @@ a list of headers that should be persisted across requests */ public static $HEADERS_TO_PERSIST = [ 'Stripe-Account', 'Stripe-Version', ]; /** @var array */ public $headers; /** @var null|string */ public $apiKey; /** @var null|string */ public $apiBase; /** * @param null|string $key * @param array $headers * @param null|string $base */ public function __construct($key = null, $headers = [], $base = null) { $this->apiKey = $key; $this->headers = $headers; $this->apiBase = $base; } /** * @return array */ public function __debugInfo() { return [ 'apiKey' => $this->redactedApiKey(), 'headers' => $this->headers, 'apiBase' => $this->apiBase, ]; } /** * Unpacks an options array and merges it into the existing RequestOptions * object. * * @param null|array|RequestOptions|string $options a key => value array * @param bool $strict when true, forbid string form and arbitrary keys in array form * * @return RequestOptions */ public function merge($options, $strict = false) { $other_options = self::parse($options, $strict); if (null === $other_options->apiKey) { $other_options->apiKey = $this->apiKey; } if (null === $other_options->apiBase) { $other_options->apiBase = $this->apiBase; } $other_options->headers = \array_merge($this->headers, $other_options->headers); return $other_options; } /** * Discards all headers that we don't want to persist across requests. */ public function discardNonPersistentHeaders() { foreach ($this->headers as $k => $v) { if (!\in_array($k, self::$HEADERS_TO_PERSIST, true)) { unset($this->headers[$k]); } } } /** * Unpacks an options array into an RequestOptions object. * * @param null|array|RequestOptions|string $options a key => value array * @param bool $strict when true, forbid string form and arbitrary keys in array form * * @throws \Stripe\Exception\InvalidArgumentException * * @return RequestOptions */ public static function parse($options, $strict = false) { if ($options instanceof self) { return $options; } if (null === $options) { return new RequestOptions(null, [], null); } if (\is_string($options)) { if ($strict) { $message = 'Do not pass a string for request options. If you want to set the ' . 'API key, pass an array like ["api_key" => ] instead.'; throw new \Stripe\Exception\InvalidArgumentException($message); } return new RequestOptions($options, [], null); } if (\is_array($options)) { $headers = []; $key = null; $base = null; if (\array_key_exists('api_key', $options)) { $key = $options['api_key']; unset($options['api_key']); } if (\array_key_exists('idempotency_key', $options)) { $headers['Idempotency-Key'] = $options['idempotency_key']; unset($options['idempotency_key']); } if (\array_key_exists('stripe_account', $options)) { $headers['Stripe-Account'] = $options['stripe_account']; unset($options['stripe_account']); } if (\array_key_exists('stripe_version', $options)) { $headers['Stripe-Version'] = $options['stripe_version']; unset($options['stripe_version']); } if (\array_key_exists('api_base', $options)) { $base = $options['api_base']; unset($options['api_base']); } if ($strict && !empty($options)) { $message = 'Got unexpected keys in options array: ' . \implode(', ', \array_keys($options)); throw new \Stripe\Exception\InvalidArgumentException($message); } return new RequestOptions($key, $headers, $base); } $message = 'The second argument to Stripe API method calls is an ' . 'optional per-request apiKey, which must be a string, or ' . 'per-request options, which must be an array. (HINT: you can set ' . 'a global apiKey by "Stripe::setApiKey()")'; throw new \Stripe\Exception\InvalidArgumentException($message); } private function redactedApiKey() { $pieces = \explode('_', $this->apiKey, 3); $last = \array_pop($pieces); $redactedLast = \strlen($last) > 4 ? (\str_repeat('*', \strlen($last) - 4) . \substr($last, -4)) : $last; - \array_push($pieces, $redactedLast); + $pieces[] = $redactedLast; return \implode('_', $pieces); } } diff --git a/plugin/StripeYPT/lib/Util/Util.php b/plugin/StripeYPT/lib/Util/Util.php index 595a7d61d..4f390500a 100644 --- a/plugin/StripeYPT/lib/Util/Util.php +++ b/plugin/StripeYPT/lib/Util/Util.php @@ -1,265 +1,265 @@ id; } if (static::isList($h)) { $results = []; foreach ($h as $v) { - \array_push($results, static::objectsToIds($v)); + $results[] = static::objectsToIds($v); } return $results; } if (\is_array($h)) { $results = []; foreach ($h as $k => $v) { if (null === $v) { continue; } $results[$k] = static::objectsToIds($v); } return $results; } return $h; } /** * @param array $params * * @return string */ public static function encodeParameters($params) { $flattenedParams = self::flattenParams($params); $pieces = []; foreach ($flattenedParams as $param) { list($k, $v) = $param; - \array_push($pieces, self::urlEncode($k) . '=' . self::urlEncode($v)); + $pieces[] = self::urlEncode($k) . '=' . self::urlEncode($v); } return \implode('&', $pieces); } /** * @param array $params * @param null|string $parentKey * * @return array */ public static function flattenParams($params, $parentKey = null) { $result = []; foreach ($params as $key => $value) { $calculatedKey = $parentKey ? "{$parentKey}[{$key}]" : $key; if (self::isList($value)) { $result = \array_merge($result, self::flattenParamsList($value, $calculatedKey)); } elseif (\is_array($value)) { $result = \array_merge($result, self::flattenParams($value, $calculatedKey)); } else { \array_push($result, [$calculatedKey, $value]); } } return $result; } /** * @param array $value * @param string $calculatedKey * * @return array */ public static function flattenParamsList($value, $calculatedKey) { $result = []; foreach ($value as $i => $elem) { if (self::isList($elem)) { $result = \array_merge($result, self::flattenParamsList($elem, $calculatedKey)); } elseif (\is_array($elem)) { $result = \array_merge($result, self::flattenParams($elem, "{$calculatedKey}[{$i}]")); } else { \array_push($result, ["{$calculatedKey}[{$i}]", $elem]); } } return $result; } /** * @param string $key a string to URL-encode * * @return string the URL-encoded string */ public static function urlEncode($key) { $s = \urlencode((string) $key); // Don't use strict form encoding by changing the square bracket control // characters back to their literals. This is fine by the server, and // makes these parameter strings easier to read. $s = \str_replace('%5B', '[', $s); return \str_replace('%5D', ']', $s); } public static function normalizeId($id) { if (\is_array($id)) { $params = $id; $id = $params['id']; unset($params['id']); } else { $params = []; } return [$id, $params]; } /** * Returns UNIX timestamp in milliseconds. * * @return int current time in millis */ public static function currentTimeMillis() { return (int) \round(\microtime(true) * 1000); } } diff --git a/plugin/StripeYPT/lib/Webhook.php b/plugin/StripeYPT/lib/Webhook.php index b9db2d6c0..a8748c99f 100644 --- a/plugin/StripeYPT/lib/Webhook.php +++ b/plugin/StripeYPT/lib/Webhook.php @@ -1,42 +1,42 @@ 0) && (\abs(\time() - $timestamp) > $tolerance)) { throw Exception\SignatureVerificationException::factory( 'Timestamp outside the tolerance zone', $payload, $header ); } return true; } /** * Extracts the timestamp in a signature header. * * @param string $header the signature header * * @return int the timestamp contained in the header, or -1 if no valid * timestamp is found */ private static function getTimestamp($header) { $items = \explode(',', $header); foreach ($items as $item) { $itemParts = \explode('=', $item, 2); if ('t' === $itemParts[0]) { if (!\is_numeric($itemParts[1])) { return -1; } return (int) ($itemParts[1]); } } return -1; } /** * Extracts the signatures matching a given scheme in a signature header. * * @param string $header the signature header * @param string $scheme the signature scheme to look for * * @return array the list of signatures matching the provided scheme */ private static function getSignatures($header, $scheme) { $signatures = []; $items = \explode(',', $header); foreach ($items as $item) { $itemParts = \explode('=', $item, 2); if (\trim($itemParts[0]) === $scheme) { - \array_push($signatures, $itemParts[1]); + $signatures[] = $itemParts[1]; } } return $signatures; } /** * Computes the signature for a given payload and secret. * * The current scheme used by Stripe ("v1") is HMAC/SHA-256. * * @param string $payload the payload to sign * @param string $secret the secret used to generate the signature * * @return string the signature as a string */ private static function computeSignature($payload, $secret) { return \hash_hmac('sha256', $payload, $secret); } } diff --git a/plugin/StripeYPT/phpstan.neon.dist b/plugin/StripeYPT/phpstan.neon.dist index 5c8f87a9d..c99645a2b 100644 --- a/plugin/StripeYPT/phpstan.neon.dist +++ b/plugin/StripeYPT/phpstan.neon.dist @@ -1,10 +1,11 @@ includes: - phpstan-baseline.neon parameters: level: 1 - bootstrap: tests/bootstrap.php + bootstrapFiles: + - tests/bootstrap.php ignoreErrors: - '#Unsafe usage of new static\(\).#' diff --git a/plugin/StripeYPT/phpunit.no_autoload.xml b/plugin/StripeYPT/phpunit.no_autoload.xml new file mode 100644 index 000000000..cf54b8d8f --- /dev/null +++ b/plugin/StripeYPT/phpunit.no_autoload.xml @@ -0,0 +1,18 @@ + + + + + + + tests + + + + + lib + + + + + + diff --git a/plugin/StripeYPT/phpunit.xml b/plugin/StripeYPT/phpunit.xml new file mode 100644 index 000000000..506e8b1b8 --- /dev/null +++ b/plugin/StripeYPT/phpunit.xml @@ -0,0 +1,18 @@ + + + + + + + tests + + + + + lib + + + + + + diff --git a/plugin/StripeYPT/update_certs.php b/plugin/StripeYPT/update_certs.php index a73622cca..cb72b6181 100644 --- a/plugin/StripeYPT/update_certs.php +++ b/plugin/StripeYPT/update_certs.php @@ -1,19 +1,19 @@ #!/usr/bin/env php $fp, \CURLOPT_TIMEOUT => 3600, - \CURLOPT_URL => 'https://curl.haxx.se/ca/cacert.pem', + \CURLOPT_URL => 'https://curl.se/ca/cacert.pem', ]; $ch = \curl_init(); \curl_setopt_array($ch, $options); \curl_exec($ch); \curl_close($ch); \fclose($fp);