first commit

This commit is contained in:
2025-01-06 20:47:25 +01:00
commit 3bdbd78c2f
25591 changed files with 3586440 additions and 0 deletions

7
modules/paynow/vendor/autoload.php vendored Normal file
View File

@@ -0,0 +1,7 @@
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitb31aa05dff4ca49df03ed75531f10ba8::getLoader();

11
modules/paynow/vendor/clue/index.php vendored Normal file
View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015 Christian Lück
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,26 @@
{
"name": "clue/stream-filter",
"description": "A simple and modern approach to stream filtering in PHP",
"keywords": ["stream", "callback", "filter", "php_user_filter", "stream_filter_append", "stream_filter_register", "bucket brigade"],
"homepage": "https://github.com/clue/php-stream-filter",
"license": "MIT",
"authors": [
{
"name": "Christian Lück",
"email": "christian@clue.engineering"
}
],
"require": {
"php": ">=5.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.36"
},
"autoload": {
"psr-4": { "Clue\\StreamFilter\\": "src/" },
"files": [ "src/functions_include.php" ]
},
"autoload-dev": {
"psr-4": { "Clue\\Tests\\StreamFilter\\": "tests/" }
}
}

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,120 @@
<?php
namespace Clue\StreamFilter;
/**
* @internal
* @see append()
* @see prepend()
*/
class CallbackFilter extends \php_user_filter
{
private $callback;
private $closed = true;
private $supportsClose = false;
/** @return bool */
#[\ReturnTypeWillChange]
public function onCreate()
{
$this->closed = false;
if (!\is_callable($this->params)) {
throw new \InvalidArgumentException('No valid callback parameter given to stream_filter_(append|prepend)');
}
$this->callback = $this->params;
// callback supports end event if it accepts invocation without arguments
$ref = new \ReflectionFunction($this->callback);
$this->supportsClose = ($ref->getNumberOfRequiredParameters() === 0);
return true;
}
/** @return void */
#[\ReturnTypeWillChange]
public function onClose()
{
$this->closed = true;
// callback supports closing and is not already closed
if ($this->supportsClose) {
$this->supportsClose = false;
// invoke without argument to signal end and discard resulting buffer
try {
\call_user_func($this->callback);
} catch (\Exception $ignored) {
// this might be called during engine shutdown, so it's not safe
// to raise any errors or exceptions here
// trigger_error('Error closing filter: ' . $ignored->getMessage(), E_USER_WARNING);
}
}
$this->callback = null;
}
/** @return int */
#[\ReturnTypeWillChange]
public function filter($in, $out, &$consumed, $closing)
{
// concatenate whole buffer from input brigade
$data = '';
while ($bucket = \stream_bucket_make_writeable($in)) {
$consumed += $bucket->datalen;
$data .= $bucket->data;
}
// skip processing callback that already ended
if ($this->closed) {
return \PSFS_FEED_ME;
}
// only invoke filter function if buffer is not empty
// this may skip flushing a closing filter
if ($data !== '') {
try {
$data = \call_user_func($this->callback, $data);
} catch (\Exception $e) {
// exception should mark filter as closed
$this->onClose();
\trigger_error('Error invoking filter: ' . $e->getMessage(), \E_USER_WARNING);
return \PSFS_ERR_FATAL;
}
}
// mark filter as closed after processing closing chunk
if ($closing) {
$this->closed = true;
// callback supports closing and is not already closed
if ($this->supportsClose) {
$this->supportsClose = false;
// invoke without argument to signal end and append resulting buffer
try {
$data .= \call_user_func($this->callback);
} catch (\Exception $e) {
\trigger_error('Error ending filter: ' . $e->getMessage(), \E_USER_WARNING);
return \PSFS_ERR_FATAL;
}
}
}
if ($data !== '') {
// create a new bucket for writing the resulting buffer to the output brigade
// reusing an existing bucket turned out to be bugged in some environments (ancient PHP versions and HHVM)
$bucket = @\stream_bucket_new($this->stream, $data);
// legacy PHP versions (PHP < 5.4) do not support passing data from the event signal handler
// because closing the stream invalidates the stream and its stream bucket brigade before
// invoking the filter close handler.
if ($bucket !== false) {
\stream_bucket_append($out, $bucket);
}
}
return \PSFS_PASS_ON;
}
}

View File

@@ -0,0 +1,327 @@
<?php
namespace Clue\StreamFilter;
/**
* Append a filter callback to the given stream.
*
* Each stream can have a list of filters attached.
* This function appends a filter to the end of this list.
*
* If the given filter can not be added, it throws an `Exception`.
*
* The `$stream` can be any valid stream resource, such as:
*
* ```php
* $stream = fopen('demo.txt', 'w+');
* ```
*
* The `$callback` should be a valid callable function which accepts
* an individual chunk of data and should return the updated chunk:
*
* ```php
* $filter = Clue\StreamFilter\append($stream, function ($chunk) {
* // will be called each time you read or write a $chunk to/from the stream
* return $chunk;
* });
* ```
*
* As such, you can also use native PHP functions or any other `callable`:
*
* ```php
* Clue\StreamFilter\append($stream, 'strtoupper');
*
* // will write "HELLO" to the underlying stream
* fwrite($stream, 'hello');
* ```
*
* If the `$callback` accepts invocation without parameters,
* then this signature will be invoked once ending (flushing) the filter:
*
* ```php
* Clue\StreamFilter\append($stream, function ($chunk = null) {
* if ($chunk === null) {
* // will be called once ending the filter
* return 'end';
* }
* // will be called each time you read or write a $chunk to/from the stream
* return $chunk;
* });
*
* fclose($stream);
* ```
*
* > Note: Legacy PHP versions (PHP < 5.4) do not support passing additional data
* from the end signal handler if the stream is being closed.
*
* If your callback throws an `Exception`, then the filter process will be aborted.
* In order to play nice with PHP's stream handling,
* the `Exception` will be transformed to a PHP warning instead:
*
* ```php
* Clue\StreamFilter\append($stream, function ($chunk) {
* throw new \RuntimeException('Unexpected chunk');
* });
*
* // raises an E_USER_WARNING with "Error invoking filter: Unexpected chunk"
* fwrite($stream, 'hello');
* ```
*
* The optional `$read_write` parameter can be used to only invoke the `$callback`
* when either writing to the stream or only when reading from the stream:
*
* ```php
* Clue\StreamFilter\append($stream, function ($chunk) {
* // will be called each time you write to the stream
* return $chunk;
* }, STREAM_FILTER_WRITE);
*
* Clue\StreamFilter\append($stream, function ($chunk) {
* // will be called each time you read from the stream
* return $chunk;
* }, STREAM_FILTER_READ);
* ```
*
* This function returns a filter resource which can be passed to [`remove()`](#remove).
*
* > Note that once a filter has been added to stream, the stream can no longer be passed to
* > [`stream_select()`](https://www.php.net/manual/en/function.stream-select.php)
* > (and family).
* >
* > > Warning: stream_select(): cannot cast a filtered stream on this system in {file} on line {line}
* >
* > This is due to limitations of PHP's stream filter support, as it can no longer reliably
* > tell when the underlying stream resource is actually ready.
* > As an alternative, consider calling `stream_select()` on the unfiltered stream and
* > then pass the unfiltered data through the [`fun()`](#fun) function.
*
* @param resource $stream
* @param callable $callback
* @param int $read_write
* @return resource filter resource which can be used for `remove()`
* @throws \Exception on error
* @uses stream_filter_append()
*/
function append($stream, $callback, $read_write = STREAM_FILTER_ALL)
{
$ret = @\stream_filter_append($stream, register(), $read_write, $callback);
// PHP 8 throws above on type errors, older PHP and memory issues can throw here
// @codeCoverageIgnoreStart
if ($ret === false) {
$error = \error_get_last() + array('message' => '');
throw new \RuntimeException('Unable to append filter: ' . $error['message']);
}
// @codeCoverageIgnoreEnd
return $ret;
}
/**
* Prepend a filter callback to the given stream.
*
* Each stream can have a list of filters attached.
* This function prepends a filter to the start of this list.
*
* If the given filter can not be added, it throws an `Exception`.
*
* ```php
* $filter = Clue\StreamFilter\prepend($stream, function ($chunk) {
* // will be called each time you read or write a $chunk to/from the stream
* return $chunk;
* });
* ```
*
* This function returns a filter resource which can be passed to [`remove()`](#remove).
*
* Except for the position in the list of filters, this function behaves exactly
* like the [`append()`](#append) function.
* For more details about its behavior, see also the [`append()`](#append) function.
*
* @param resource $stream
* @param callable $callback
* @param int $read_write
* @return resource filter resource which can be used for `remove()`
* @throws \Exception on error
* @uses stream_filter_prepend()
*/
function prepend($stream, $callback, $read_write = STREAM_FILTER_ALL)
{
$ret = @\stream_filter_prepend($stream, register(), $read_write, $callback);
// PHP 8 throws above on type errors, older PHP and memory issues can throw here
// @codeCoverageIgnoreStart
if ($ret === false) {
$error = \error_get_last() + array('message' => '');
throw new \RuntimeException('Unable to prepend filter: ' . $error['message']);
}
// @codeCoverageIgnoreEnd
return $ret;
}
/**
* Create a filter function which uses the given built-in `$filter`.
*
* PHP comes with a useful set of [built-in filters](https://www.php.net/manual/en/filters.php).
* Using `fun()` makes accessing these as easy as passing an input string to filter
* and getting the filtered output string.
*
* ```php
* $fun = Clue\StreamFilter\fun('string.rot13');
*
* assert('grfg' === $fun('test'));
* assert('test' === $fun($fun('test'));
* ```
*
* Please note that not all filter functions may be available depending
* on installed PHP extensions and the PHP version in use.
* In particular, [HHVM](https://hhvm.com/) may not offer the same filter functions
* or parameters as Zend PHP.
* Accessing an unknown filter function will result in a `RuntimeException`:
*
* ```php
* Clue\StreamFilter\fun('unknown'); // throws RuntimeException
* ```
*
* Some filters may accept or require additional filter parameters most
* filters do not require filter parameters.
* If given, the optional `$parameters` argument will be passed to the
* underlying filter handler as-is.
* In particular, note how *not passing* this parameter at all differs from
* explicitly passing a `null` value (which many filters do not accept).
* Please refer to the individual filter definition for more details.
* For example, the `string.strip_tags` filter can be invoked like this:
*
* ```php
* $fun = Clue\StreamFilter\fun('string.strip_tags', '<a><b>');
*
* $ret = $fun('<b>h<br>i</b>');
* assert('<b>hi</b>' === $ret);
* ```
*
* Under the hood, this function allocates a temporary memory stream, so it's
* recommended to clean up the filter function after use.
* Also, some filter functions (in particular the
* [zlib compression filters](https://www.php.net/manual/en/filters.compression.php))
* may use internal buffers and may emit a final data chunk on close.
* The filter function can be closed by invoking without any arguments:
*
* ```php
* $fun = Clue\StreamFilter\fun('zlib.deflate');
*
* $ret = $fun('hello') . $fun('world') . $fun();
* assert('helloworld' === gzinflate($ret));
* ```
*
* The filter function must not be used anymore after it has been closed.
* Doing so will result in a `RuntimeException`:
*
* ```php
* $fun = Clue\StreamFilter\fun('string.rot13');
* $fun();
*
* $fun('test'); // throws RuntimeException
* ```
*
* > Note: If you're using the zlib compression filters, then you should be wary
* about engine inconsistencies between different PHP versions and HHVM.
* These inconsistencies exist in the underlying PHP engines and there's little we
* can do about this in this library.
* [Our test suite](tests/) contains several test cases that exhibit these issues.
* If you feel some test case is missing or outdated, we're happy to accept PRs! :)
*
* @param string $filter built-in filter name. See stream_get_filters() or http://php.net/manual/en/filters.php
* @param mixed $parameters (optional) parameters to pass to the built-in filter as-is
* @return callable a filter callback which can be append()'ed or prepend()'ed
* @throws \RuntimeException on error
* @link http://php.net/manual/en/filters.php
* @see stream_get_filters()
* @see append()
*/
function fun($filter, $parameters = null)
{
$fp = \fopen('php://memory', 'w');
if (\func_num_args() === 1) {
$filter = @\stream_filter_append($fp, $filter, \STREAM_FILTER_WRITE);
} else {
$filter = @\stream_filter_append($fp, $filter, \STREAM_FILTER_WRITE, $parameters);
}
if ($filter === false) {
\fclose($fp);
$error = \error_get_last() + array('message' => '');
throw new \RuntimeException('Unable to access built-in filter: ' . $error['message']);
}
// append filter function which buffers internally
$buffer = '';
append($fp, function ($chunk) use (&$buffer) {
$buffer .= $chunk;
// always return empty string in order to skip actually writing to stream resource
return '';
}, \STREAM_FILTER_WRITE);
$closed = false;
return function ($chunk = null) use ($fp, $filter, &$buffer, &$closed) {
if ($closed) {
throw new \RuntimeException('Unable to perform operation on closed stream');
}
if ($chunk === null) {
$closed = true;
$buffer = '';
\fclose($fp);
return $buffer;
}
// initialize buffer and invoke filters by attempting to write to stream
$buffer = '';
\fwrite($fp, $chunk);
// buffer now contains everything the filter function returned
return $buffer;
};
}
/**
* Remove a filter previously added via `append()` or `prepend()`.
*
* ```php
* $filter = Clue\StreamFilter\append($stream, function () {
* // …
* });
* Clue\StreamFilter\remove($filter);
* ```
*
* @param resource $filter
* @return bool true on success or false on error
* @throws \RuntimeException on error
* @uses stream_filter_remove()
*/
function remove($filter)
{
if (@\stream_filter_remove($filter) === false) {
// PHP 8 throws above on type errors, older PHP and memory issues can throw here
$error = \error_get_last();
throw new \RuntimeException('Unable to remove filter: ' . $error['message']);
}
}
/**
* Registers the callback filter and returns the resulting filter name
*
* There should be little reason to call this function manually.
*
* @return string filter name
* @uses CallbackFilter
*/
function register()
{
static $registered = null;
if ($registered === null) {
$registered = 'stream-callback';
\stream_filter_register($registered, __NAMESPACE__ . '\CallbackFilter');
}
return $registered;
}

View File

@@ -0,0 +1,6 @@
<?php
// @codeCoverageIgnoreStart
if (!\function_exists('Clue\\StreamFilter\\append')) {
require __DIR__ . '/functions.php';
}

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,445 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* 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 <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
// 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;
public function getPrefixes()
{
if (!empty($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') && 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);
}
/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* 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;
}
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 . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
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;
}

21
modules/paynow/vendor/composer/LICENSE vendored Normal file
View File

@@ -0,0 +1,21 @@
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,181 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Clue\\StreamFilter\\CallbackFilter' => $vendorDir . '/clue/stream-filter/src/CallbackFilter.php',
'Http\\Client\\Curl\\Client' => $vendorDir . '/php-http/curl-client/src/Client.php',
'Http\\Client\\Curl\\CurlPromise' => $vendorDir . '/php-http/curl-client/src/CurlPromise.php',
'Http\\Client\\Curl\\MultiRunner' => $vendorDir . '/php-http/curl-client/src/MultiRunner.php',
'Http\\Client\\Curl\\PromiseCore' => $vendorDir . '/php-http/curl-client/src/PromiseCore.php',
'Http\\Client\\Curl\\ResponseBuilder' => $vendorDir . '/php-http/curl-client/src/ResponseBuilder.php',
'Http\\Client\\Exception' => $vendorDir . '/php-http/httplug/src/Exception.php',
'Http\\Client\\Exception\\HttpException' => $vendorDir . '/php-http/httplug/src/Exception/HttpException.php',
'Http\\Client\\Exception\\NetworkException' => $vendorDir . '/php-http/httplug/src/Exception/NetworkException.php',
'Http\\Client\\Exception\\RequestAwareTrait' => $vendorDir . '/php-http/httplug/src/Exception/RequestAwareTrait.php',
'Http\\Client\\Exception\\RequestException' => $vendorDir . '/php-http/httplug/src/Exception/RequestException.php',
'Http\\Client\\Exception\\TransferException' => $vendorDir . '/php-http/httplug/src/Exception/TransferException.php',
'Http\\Client\\HttpAsyncClient' => $vendorDir . '/php-http/httplug/src/HttpAsyncClient.php',
'Http\\Client\\HttpClient' => $vendorDir . '/php-http/httplug/src/HttpClient.php',
'Http\\Client\\Promise\\HttpFulfilledPromise' => $vendorDir . '/php-http/httplug/src/Promise/HttpFulfilledPromise.php',
'Http\\Client\\Promise\\HttpRejectedPromise' => $vendorDir . '/php-http/httplug/src/Promise/HttpRejectedPromise.php',
'Http\\Discovery\\ClassDiscovery' => $vendorDir . '/php-http/discovery/src/ClassDiscovery.php',
'Http\\Discovery\\Exception' => $vendorDir . '/php-http/discovery/src/Exception.php',
'Http\\Discovery\\Exception\\ClassInstantiationFailedException' => $vendorDir . '/php-http/discovery/src/Exception/ClassInstantiationFailedException.php',
'Http\\Discovery\\Exception\\DiscoveryFailedException' => $vendorDir . '/php-http/discovery/src/Exception/DiscoveryFailedException.php',
'Http\\Discovery\\Exception\\NoCandidateFoundException' => $vendorDir . '/php-http/discovery/src/Exception/NoCandidateFoundException.php',
'Http\\Discovery\\Exception\\NotFoundException' => $vendorDir . '/php-http/discovery/src/Exception/NotFoundException.php',
'Http\\Discovery\\Exception\\PuliUnavailableException' => $vendorDir . '/php-http/discovery/src/Exception/PuliUnavailableException.php',
'Http\\Discovery\\Exception\\StrategyUnavailableException' => $vendorDir . '/php-http/discovery/src/Exception/StrategyUnavailableException.php',
'Http\\Discovery\\HttpAsyncClientDiscovery' => $vendorDir . '/php-http/discovery/src/HttpAsyncClientDiscovery.php',
'Http\\Discovery\\HttpClientDiscovery' => $vendorDir . '/php-http/discovery/src/HttpClientDiscovery.php',
'Http\\Discovery\\MessageFactoryDiscovery' => $vendorDir . '/php-http/discovery/src/MessageFactoryDiscovery.php',
'Http\\Discovery\\NotFoundException' => $vendorDir . '/php-http/discovery/src/NotFoundException.php',
'Http\\Discovery\\Psr17FactoryDiscovery' => $vendorDir . '/php-http/discovery/src/Psr17FactoryDiscovery.php',
'Http\\Discovery\\Psr18ClientDiscovery' => $vendorDir . '/php-http/discovery/src/Psr18ClientDiscovery.php',
'Http\\Discovery\\Strategy\\CommonClassesStrategy' => $vendorDir . '/php-http/discovery/src/Strategy/CommonClassesStrategy.php',
'Http\\Discovery\\Strategy\\CommonPsr17ClassesStrategy' => $vendorDir . '/php-http/discovery/src/Strategy/CommonPsr17ClassesStrategy.php',
'Http\\Discovery\\Strategy\\DiscoveryStrategy' => $vendorDir . '/php-http/discovery/src/Strategy/DiscoveryStrategy.php',
'Http\\Discovery\\Strategy\\MockClientStrategy' => $vendorDir . '/php-http/discovery/src/Strategy/MockClientStrategy.php',
'Http\\Discovery\\Strategy\\PuliBetaStrategy' => $vendorDir . '/php-http/discovery/src/Strategy/PuliBetaStrategy.php',
'Http\\Discovery\\StreamFactoryDiscovery' => $vendorDir . '/php-http/discovery/src/StreamFactoryDiscovery.php',
'Http\\Discovery\\UriFactoryDiscovery' => $vendorDir . '/php-http/discovery/src/UriFactoryDiscovery.php',
'Http\\Message\\Authentication' => $vendorDir . '/php-http/message/src/Authentication.php',
'Http\\Message\\Authentication\\AutoBasicAuth' => $vendorDir . '/php-http/message/src/Authentication/AutoBasicAuth.php',
'Http\\Message\\Authentication\\BasicAuth' => $vendorDir . '/php-http/message/src/Authentication/BasicAuth.php',
'Http\\Message\\Authentication\\Bearer' => $vendorDir . '/php-http/message/src/Authentication/Bearer.php',
'Http\\Message\\Authentication\\Chain' => $vendorDir . '/php-http/message/src/Authentication/Chain.php',
'Http\\Message\\Authentication\\Header' => $vendorDir . '/php-http/message/src/Authentication/Header.php',
'Http\\Message\\Authentication\\Matching' => $vendorDir . '/php-http/message/src/Authentication/Matching.php',
'Http\\Message\\Authentication\\QueryParam' => $vendorDir . '/php-http/message/src/Authentication/QueryParam.php',
'Http\\Message\\Authentication\\RequestConditional' => $vendorDir . '/php-http/message/src/Authentication/RequestConditional.php',
'Http\\Message\\Authentication\\Wsse' => $vendorDir . '/php-http/message/src/Authentication/Wsse.php',
'Http\\Message\\Builder\\ResponseBuilder' => $vendorDir . '/php-http/message/src/Builder/ResponseBuilder.php',
'Http\\Message\\Cookie' => $vendorDir . '/php-http/message/src/Cookie.php',
'Http\\Message\\CookieJar' => $vendorDir . '/php-http/message/src/CookieJar.php',
'Http\\Message\\CookieUtil' => $vendorDir . '/php-http/message/src/CookieUtil.php',
'Http\\Message\\Decorator\\MessageDecorator' => $vendorDir . '/php-http/message/src/Decorator/MessageDecorator.php',
'Http\\Message\\Decorator\\RequestDecorator' => $vendorDir . '/php-http/message/src/Decorator/RequestDecorator.php',
'Http\\Message\\Decorator\\ResponseDecorator' => $vendorDir . '/php-http/message/src/Decorator/ResponseDecorator.php',
'Http\\Message\\Decorator\\StreamDecorator' => $vendorDir . '/php-http/message/src/Decorator/StreamDecorator.php',
'Http\\Message\\Encoding\\ChunkStream' => $vendorDir . '/php-http/message/src/Encoding/ChunkStream.php',
'Http\\Message\\Encoding\\CompressStream' => $vendorDir . '/php-http/message/src/Encoding/CompressStream.php',
'Http\\Message\\Encoding\\DechunkStream' => $vendorDir . '/php-http/message/src/Encoding/DechunkStream.php',
'Http\\Message\\Encoding\\DecompressStream' => $vendorDir . '/php-http/message/src/Encoding/DecompressStream.php',
'Http\\Message\\Encoding\\DeflateStream' => $vendorDir . '/php-http/message/src/Encoding/DeflateStream.php',
'Http\\Message\\Encoding\\Filter\\Chunk' => $vendorDir . '/php-http/message/src/Encoding/Filter/Chunk.php',
'Http\\Message\\Encoding\\FilteredStream' => $vendorDir . '/php-http/message/src/Encoding/FilteredStream.php',
'Http\\Message\\Encoding\\GzipDecodeStream' => $vendorDir . '/php-http/message/src/Encoding/GzipDecodeStream.php',
'Http\\Message\\Encoding\\GzipEncodeStream' => $vendorDir . '/php-http/message/src/Encoding/GzipEncodeStream.php',
'Http\\Message\\Encoding\\InflateStream' => $vendorDir . '/php-http/message/src/Encoding/InflateStream.php',
'Http\\Message\\Exception' => $vendorDir . '/php-http/message/src/Exception.php',
'Http\\Message\\Exception\\UnexpectedValueException' => $vendorDir . '/php-http/message/src/Exception/UnexpectedValueException.php',
'Http\\Message\\Formatter' => $vendorDir . '/php-http/message/src/Formatter.php',
'Http\\Message\\Formatter\\CurlCommandFormatter' => $vendorDir . '/php-http/message/src/Formatter/CurlCommandFormatter.php',
'Http\\Message\\Formatter\\FullHttpMessageFormatter' => $vendorDir . '/php-http/message/src/Formatter/FullHttpMessageFormatter.php',
'Http\\Message\\Formatter\\SimpleFormatter' => $vendorDir . '/php-http/message/src/Formatter/SimpleFormatter.php',
'Http\\Message\\MessageFactory' => $vendorDir . '/php-http/message-factory/src/MessageFactory.php',
'Http\\Message\\MessageFactory\\DiactorosMessageFactory' => $vendorDir . '/php-http/message/src/MessageFactory/DiactorosMessageFactory.php',
'Http\\Message\\MessageFactory\\GuzzleMessageFactory' => $vendorDir . '/php-http/message/src/MessageFactory/GuzzleMessageFactory.php',
'Http\\Message\\MessageFactory\\SlimMessageFactory' => $vendorDir . '/php-http/message/src/MessageFactory/SlimMessageFactory.php',
'Http\\Message\\RequestFactory' => $vendorDir . '/php-http/message-factory/src/RequestFactory.php',
'Http\\Message\\RequestMatcher' => $vendorDir . '/php-http/message/src/RequestMatcher.php',
'Http\\Message\\RequestMatcher\\CallbackRequestMatcher' => $vendorDir . '/php-http/message/src/RequestMatcher/CallbackRequestMatcher.php',
'Http\\Message\\RequestMatcher\\RegexRequestMatcher' => $vendorDir . '/php-http/message/src/RequestMatcher/RegexRequestMatcher.php',
'Http\\Message\\RequestMatcher\\RequestMatcher' => $vendorDir . '/php-http/message/src/RequestMatcher/RequestMatcher.php',
'Http\\Message\\ResponseFactory' => $vendorDir . '/php-http/message-factory/src/ResponseFactory.php',
'Http\\Message\\StreamFactory' => $vendorDir . '/php-http/message-factory/src/StreamFactory.php',
'Http\\Message\\StreamFactory\\DiactorosStreamFactory' => $vendorDir . '/php-http/message/src/StreamFactory/DiactorosStreamFactory.php',
'Http\\Message\\StreamFactory\\GuzzleStreamFactory' => $vendorDir . '/php-http/message/src/StreamFactory/GuzzleStreamFactory.php',
'Http\\Message\\StreamFactory\\SlimStreamFactory' => $vendorDir . '/php-http/message/src/StreamFactory/SlimStreamFactory.php',
'Http\\Message\\Stream\\BufferedStream' => $vendorDir . '/php-http/message/src/Stream/BufferedStream.php',
'Http\\Message\\UriFactory' => $vendorDir . '/php-http/message-factory/src/UriFactory.php',
'Http\\Message\\UriFactory\\DiactorosUriFactory' => $vendorDir . '/php-http/message/src/UriFactory/DiactorosUriFactory.php',
'Http\\Message\\UriFactory\\GuzzleUriFactory' => $vendorDir . '/php-http/message/src/UriFactory/GuzzleUriFactory.php',
'Http\\Message\\UriFactory\\SlimUriFactory' => $vendorDir . '/php-http/message/src/UriFactory/SlimUriFactory.php',
'Http\\Promise\\FulfilledPromise' => $vendorDir . '/php-http/promise/src/FulfilledPromise.php',
'Http\\Promise\\Promise' => $vendorDir . '/php-http/promise/src/Promise.php',
'Http\\Promise\\RejectedPromise' => $vendorDir . '/php-http/promise/src/RejectedPromise.php',
'Nyholm\\Psr7\\Factory\\HttplugFactory' => $vendorDir . '/nyholm/psr7/src/Factory/HttplugFactory.php',
'Nyholm\\Psr7\\Factory\\Psr17Factory' => $vendorDir . '/nyholm/psr7/src/Factory/Psr17Factory.php',
'Nyholm\\Psr7\\MessageTrait' => $vendorDir . '/nyholm/psr7/src/MessageTrait.php',
'Nyholm\\Psr7\\Request' => $vendorDir . '/nyholm/psr7/src/Request.php',
'Nyholm\\Psr7\\RequestTrait' => $vendorDir . '/nyholm/psr7/src/RequestTrait.php',
'Nyholm\\Psr7\\Response' => $vendorDir . '/nyholm/psr7/src/Response.php',
'Nyholm\\Psr7\\ServerRequest' => $vendorDir . '/nyholm/psr7/src/ServerRequest.php',
'Nyholm\\Psr7\\Stream' => $vendorDir . '/nyholm/psr7/src/Stream.php',
'Nyholm\\Psr7\\UploadedFile' => $vendorDir . '/nyholm/psr7/src/UploadedFile.php',
'Nyholm\\Psr7\\Uri' => $vendorDir . '/nyholm/psr7/src/Uri.php',
'Paynow\\Client' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Client.php',
'Paynow\\Configuration' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Configuration.php',
'Paynow\\ConfigurationInterface' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/ConfigurationInterface.php',
'Paynow\\Environment' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Environment.php',
'Paynow\\Exception\\ConfigurationException' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Exception/ConfigurationException.php',
'Paynow\\Exception\\Error' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Exception/Error.php',
'Paynow\\Exception\\PaynowException' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Exception/PaynowException.php',
'Paynow\\Exception\\SignatureVerificationException' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Exception/SignatureVerificationException.php',
'Paynow\\HttpClient\\ApiResponse' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/HttpClient/ApiResponse.php',
'Paynow\\HttpClient\\HttpClient' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/HttpClient/HttpClient.php',
'Paynow\\HttpClient\\HttpClientException' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/HttpClient/HttpClientException.php',
'Paynow\\HttpClient\\HttpClientInterface' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/HttpClient/HttpClientInterface.php',
'Paynow\\Model\\DataProcessing\\Notice' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Model/DataProcessing/Notice.php',
'Paynow\\Model\\PaymentMethods\\AuthorizationType' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Model/PaymentMethods/AuthorizationType.php',
'Paynow\\Model\\PaymentMethods\\PaymentMethod' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Model/PaymentMethods/PaymentMethod.php',
'Paynow\\Model\\PaymentMethods\\Status' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Model/PaymentMethods/Status.php',
'Paynow\\Model\\PaymentMethods\\Type' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Model/PaymentMethods/Type.php',
'Paynow\\Model\\Payment\\Status' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Model/Payment/Status.php',
'Paynow\\Model\\Refund\\Status' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Model/Refund/Status.php',
'Paynow\\Notification' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Notification.php',
'Paynow\\Response\\DataProcessing\\Notices' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Response/DataProcessing/Notices.php',
'Paynow\\Response\\PaymentMethods\\PaymentMethods' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Response/PaymentMethods/PaymentMethods.php',
'Paynow\\Response\\Payment\\Authorize' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Response/Payment/Authorize.php',
'Paynow\\Response\\Payment\\Status' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Response/Payment/Status.php',
'Paynow\\Response\\Refund\\Status' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Response/Refund/Status.php',
'Paynow\\Service\\DataProcessing' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Service/DataProcessing.php',
'Paynow\\Service\\Payment' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Service/Payment.php',
'Paynow\\Service\\Refund' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Service/Refund.php',
'Paynow\\Service\\Service' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Service/Service.php',
'Paynow\\Service\\ShopConfiguration' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Service/ShopConfiguration.php',
'Paynow\\Tests\\NotificationTest' => $vendorDir . '/pay-now/paynow-php-sdk/tests/NotificationTest.php',
'Paynow\\Tests\\Service\\DataProcessingTest' => $vendorDir . '/pay-now/paynow-php-sdk/tests/Service/DataProcessingTest.php',
'Paynow\\Tests\\Service\\PaymentMethodsTest' => $vendorDir . '/pay-now/paynow-php-sdk/tests/Service/PaymentMethodsTest.php',
'Paynow\\Tests\\Service\\PaymentTest' => $vendorDir . '/pay-now/paynow-php-sdk/tests/Service/PaymentTest.php',
'Paynow\\Tests\\Service\\RefundTest' => $vendorDir . '/pay-now/paynow-php-sdk/tests/Service/RefundTest.php',
'Paynow\\Tests\\Service\\ShopConfigurationTest' => $vendorDir . '/pay-now/paynow-php-sdk/tests/Service/ShopConfigurationTest.php',
'Paynow\\Tests\\TestCase' => $vendorDir . '/pay-now/paynow-php-sdk/tests/TestCase.php',
'Paynow\\Tests\\TestHttpClient' => $vendorDir . '/pay-now/paynow-php-sdk/tests/TestHttpClient.php',
'Paynow\\Tests\\Util\\SignatureCalculatorTest' => $vendorDir . '/pay-now/paynow-php-sdk/tests/Util/SignatureCalculatorTest.php',
'Paynow\\Util\\SignatureCalculator' => $vendorDir . '/pay-now/paynow-php-sdk/src/Paynow/Util/SignatureCalculator.php',
'Psr\\Http\\Client\\ClientExceptionInterface' => $vendorDir . '/psr/http-client/src/ClientExceptionInterface.php',
'Psr\\Http\\Client\\ClientInterface' => $vendorDir . '/psr/http-client/src/ClientInterface.php',
'Psr\\Http\\Client\\NetworkExceptionInterface' => $vendorDir . '/psr/http-client/src/NetworkExceptionInterface.php',
'Psr\\Http\\Client\\RequestExceptionInterface' => $vendorDir . '/psr/http-client/src/RequestExceptionInterface.php',
'Psr\\Http\\Message\\MessageInterface' => $vendorDir . '/psr/http-message/src/MessageInterface.php',
'Psr\\Http\\Message\\RequestFactoryInterface' => $vendorDir . '/psr/http-factory/src/RequestFactoryInterface.php',
'Psr\\Http\\Message\\RequestInterface' => $vendorDir . '/psr/http-message/src/RequestInterface.php',
'Psr\\Http\\Message\\ResponseFactoryInterface' => $vendorDir . '/psr/http-factory/src/ResponseFactoryInterface.php',
'Psr\\Http\\Message\\ResponseInterface' => $vendorDir . '/psr/http-message/src/ResponseInterface.php',
'Psr\\Http\\Message\\ServerRequestFactoryInterface' => $vendorDir . '/psr/http-factory/src/ServerRequestFactoryInterface.php',
'Psr\\Http\\Message\\ServerRequestInterface' => $vendorDir . '/psr/http-message/src/ServerRequestInterface.php',
'Psr\\Http\\Message\\StreamFactoryInterface' => $vendorDir . '/psr/http-factory/src/StreamFactoryInterface.php',
'Psr\\Http\\Message\\StreamInterface' => $vendorDir . '/psr/http-message/src/StreamInterface.php',
'Psr\\Http\\Message\\UploadedFileFactoryInterface' => $vendorDir . '/psr/http-factory/src/UploadedFileFactoryInterface.php',
'Psr\\Http\\Message\\UploadedFileInterface' => $vendorDir . '/psr/http-message/src/UploadedFileInterface.php',
'Psr\\Http\\Message\\UriFactoryInterface' => $vendorDir . '/psr/http-factory/src/UriFactoryInterface.php',
'Psr\\Http\\Message\\UriInterface' => $vendorDir . '/psr/http-message/src/UriInterface.php',
'Symfony\\Component\\OptionsResolver\\Debug\\OptionsResolverIntrospector' => $vendorDir . '/symfony/options-resolver/Debug/OptionsResolverIntrospector.php',
'Symfony\\Component\\OptionsResolver\\Exception\\AccessException' => $vendorDir . '/symfony/options-resolver/Exception/AccessException.php',
'Symfony\\Component\\OptionsResolver\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/options-resolver/Exception/ExceptionInterface.php',
'Symfony\\Component\\OptionsResolver\\Exception\\InvalidArgumentException' => $vendorDir . '/symfony/options-resolver/Exception/InvalidArgumentException.php',
'Symfony\\Component\\OptionsResolver\\Exception\\InvalidOptionsException' => $vendorDir . '/symfony/options-resolver/Exception/InvalidOptionsException.php',
'Symfony\\Component\\OptionsResolver\\Exception\\MissingOptionsException' => $vendorDir . '/symfony/options-resolver/Exception/MissingOptionsException.php',
'Symfony\\Component\\OptionsResolver\\Exception\\NoConfigurationException' => $vendorDir . '/symfony/options-resolver/Exception/NoConfigurationException.php',
'Symfony\\Component\\OptionsResolver\\Exception\\NoSuchOptionException' => $vendorDir . '/symfony/options-resolver/Exception/NoSuchOptionException.php',
'Symfony\\Component\\OptionsResolver\\Exception\\OptionDefinitionException' => $vendorDir . '/symfony/options-resolver/Exception/OptionDefinitionException.php',
'Symfony\\Component\\OptionsResolver\\Exception\\UndefinedOptionsException' => $vendorDir . '/symfony/options-resolver/Exception/UndefinedOptionsException.php',
'Symfony\\Component\\OptionsResolver\\Options' => $vendorDir . '/symfony/options-resolver/Options.php',
'Symfony\\Component\\OptionsResolver\\OptionsResolver' => $vendorDir . '/symfony/options-resolver/OptionsResolver.php',
);

View File

@@ -0,0 +1,11 @@
<?php
// autoload_files.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'9c67151ae59aff4788964ce8eb2a0f43' => $vendorDir . '/clue/stream-filter/src/functions_include.php',
'8cff32064859f4559445b89279f3199c' => $vendorDir . '/php-http/message/src/filters.php',
);

View File

@@ -0,0 +1,9 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

View File

@@ -0,0 +1,21 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Symfony\\Component\\OptionsResolver\\' => array($vendorDir . '/symfony/options-resolver'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'),
'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
'Paynow\\Tests\\' => array($vendorDir . '/pay-now/paynow-php-sdk/tests'),
'Paynow\\' => array($vendorDir . '/pay-now/paynow-php-sdk/src/Paynow'),
'Nyholm\\Psr7\\' => array($vendorDir . '/nyholm/psr7/src'),
'Http\\Promise\\' => array($vendorDir . '/php-http/promise/src'),
'Http\\Message\\' => array($vendorDir . '/php-http/message/src', $vendorDir . '/php-http/message-factory/src'),
'Http\\Discovery\\' => array($vendorDir . '/php-http/discovery/src'),
'Http\\Client\\Curl\\' => array($vendorDir . '/php-http/curl-client/src'),
'Http\\Client\\' => array($vendorDir . '/php-http/httplug/src'),
'Clue\\StreamFilter\\' => array($vendorDir . '/clue/stream-filter/src'),
);

View File

@@ -0,0 +1,73 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitb31aa05dff4ca49df03ed75531f10ba8
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitb31aa05dff4ca49df03ed75531f10ba8', 'loadClassLoader'), true, false);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitb31aa05dff4ca49df03ed75531f10ba8', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitb31aa05dff4ca49df03ed75531f10ba8::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(false);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInitb31aa05dff4ca49df03ed75531f10ba8::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequireb31aa05dff4ca49df03ed75531f10ba8($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequireb31aa05dff4ca49df03ed75531f10ba8($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
}
}

View File

@@ -0,0 +1,281 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInitb31aa05dff4ca49df03ed75531f10ba8
{
public static $files = array (
'9c67151ae59aff4788964ce8eb2a0f43' => __DIR__ . '/..' . '/clue/stream-filter/src/functions_include.php',
'8cff32064859f4559445b89279f3199c' => __DIR__ . '/..' . '/php-http/message/src/filters.php',
);
public static $prefixLengthsPsr4 = array (
'S' =>
array (
'Symfony\\Component\\OptionsResolver\\' => 34,
),
'P' =>
array (
'Psr\\Http\\Message\\' => 17,
'Psr\\Http\\Client\\' => 16,
'Paynow\\Tests\\' => 13,
'Paynow\\' => 7,
),
'N' =>
array (
'Nyholm\\Psr7\\' => 12,
),
'H' =>
array (
'Http\\Promise\\' => 13,
'Http\\Message\\' => 13,
'Http\\Discovery\\' => 15,
'Http\\Client\\Curl\\' => 17,
'Http\\Client\\' => 12,
),
'C' =>
array (
'Clue\\StreamFilter\\' => 18,
),
);
public static $prefixDirsPsr4 = array (
'Symfony\\Component\\OptionsResolver\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/options-resolver',
),
'Psr\\Http\\Message\\' =>
array (
0 => __DIR__ . '/..' . '/psr/http-factory/src',
1 => __DIR__ . '/..' . '/psr/http-message/src',
),
'Psr\\Http\\Client\\' =>
array (
0 => __DIR__ . '/..' . '/psr/http-client/src',
),
'Paynow\\Tests\\' =>
array (
0 => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/tests',
),
'Paynow\\' =>
array (
0 => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow',
),
'Nyholm\\Psr7\\' =>
array (
0 => __DIR__ . '/..' . '/nyholm/psr7/src',
),
'Http\\Promise\\' =>
array (
0 => __DIR__ . '/..' . '/php-http/promise/src',
),
'Http\\Message\\' =>
array (
0 => __DIR__ . '/..' . '/php-http/message/src',
1 => __DIR__ . '/..' . '/php-http/message-factory/src',
),
'Http\\Discovery\\' =>
array (
0 => __DIR__ . '/..' . '/php-http/discovery/src',
),
'Http\\Client\\Curl\\' =>
array (
0 => __DIR__ . '/..' . '/php-http/curl-client/src',
),
'Http\\Client\\' =>
array (
0 => __DIR__ . '/..' . '/php-http/httplug/src',
),
'Clue\\StreamFilter\\' =>
array (
0 => __DIR__ . '/..' . '/clue/stream-filter/src',
),
);
public static $classMap = array (
'Clue\\StreamFilter\\CallbackFilter' => __DIR__ . '/..' . '/clue/stream-filter/src/CallbackFilter.php',
'Http\\Client\\Curl\\Client' => __DIR__ . '/..' . '/php-http/curl-client/src/Client.php',
'Http\\Client\\Curl\\CurlPromise' => __DIR__ . '/..' . '/php-http/curl-client/src/CurlPromise.php',
'Http\\Client\\Curl\\MultiRunner' => __DIR__ . '/..' . '/php-http/curl-client/src/MultiRunner.php',
'Http\\Client\\Curl\\PromiseCore' => __DIR__ . '/..' . '/php-http/curl-client/src/PromiseCore.php',
'Http\\Client\\Curl\\ResponseBuilder' => __DIR__ . '/..' . '/php-http/curl-client/src/ResponseBuilder.php',
'Http\\Client\\Exception' => __DIR__ . '/..' . '/php-http/httplug/src/Exception.php',
'Http\\Client\\Exception\\HttpException' => __DIR__ . '/..' . '/php-http/httplug/src/Exception/HttpException.php',
'Http\\Client\\Exception\\NetworkException' => __DIR__ . '/..' . '/php-http/httplug/src/Exception/NetworkException.php',
'Http\\Client\\Exception\\RequestAwareTrait' => __DIR__ . '/..' . '/php-http/httplug/src/Exception/RequestAwareTrait.php',
'Http\\Client\\Exception\\RequestException' => __DIR__ . '/..' . '/php-http/httplug/src/Exception/RequestException.php',
'Http\\Client\\Exception\\TransferException' => __DIR__ . '/..' . '/php-http/httplug/src/Exception/TransferException.php',
'Http\\Client\\HttpAsyncClient' => __DIR__ . '/..' . '/php-http/httplug/src/HttpAsyncClient.php',
'Http\\Client\\HttpClient' => __DIR__ . '/..' . '/php-http/httplug/src/HttpClient.php',
'Http\\Client\\Promise\\HttpFulfilledPromise' => __DIR__ . '/..' . '/php-http/httplug/src/Promise/HttpFulfilledPromise.php',
'Http\\Client\\Promise\\HttpRejectedPromise' => __DIR__ . '/..' . '/php-http/httplug/src/Promise/HttpRejectedPromise.php',
'Http\\Discovery\\ClassDiscovery' => __DIR__ . '/..' . '/php-http/discovery/src/ClassDiscovery.php',
'Http\\Discovery\\Exception' => __DIR__ . '/..' . '/php-http/discovery/src/Exception.php',
'Http\\Discovery\\Exception\\ClassInstantiationFailedException' => __DIR__ . '/..' . '/php-http/discovery/src/Exception/ClassInstantiationFailedException.php',
'Http\\Discovery\\Exception\\DiscoveryFailedException' => __DIR__ . '/..' . '/php-http/discovery/src/Exception/DiscoveryFailedException.php',
'Http\\Discovery\\Exception\\NoCandidateFoundException' => __DIR__ . '/..' . '/php-http/discovery/src/Exception/NoCandidateFoundException.php',
'Http\\Discovery\\Exception\\NotFoundException' => __DIR__ . '/..' . '/php-http/discovery/src/Exception/NotFoundException.php',
'Http\\Discovery\\Exception\\PuliUnavailableException' => __DIR__ . '/..' . '/php-http/discovery/src/Exception/PuliUnavailableException.php',
'Http\\Discovery\\Exception\\StrategyUnavailableException' => __DIR__ . '/..' . '/php-http/discovery/src/Exception/StrategyUnavailableException.php',
'Http\\Discovery\\HttpAsyncClientDiscovery' => __DIR__ . '/..' . '/php-http/discovery/src/HttpAsyncClientDiscovery.php',
'Http\\Discovery\\HttpClientDiscovery' => __DIR__ . '/..' . '/php-http/discovery/src/HttpClientDiscovery.php',
'Http\\Discovery\\MessageFactoryDiscovery' => __DIR__ . '/..' . '/php-http/discovery/src/MessageFactoryDiscovery.php',
'Http\\Discovery\\NotFoundException' => __DIR__ . '/..' . '/php-http/discovery/src/NotFoundException.php',
'Http\\Discovery\\Psr17FactoryDiscovery' => __DIR__ . '/..' . '/php-http/discovery/src/Psr17FactoryDiscovery.php',
'Http\\Discovery\\Psr18ClientDiscovery' => __DIR__ . '/..' . '/php-http/discovery/src/Psr18ClientDiscovery.php',
'Http\\Discovery\\Strategy\\CommonClassesStrategy' => __DIR__ . '/..' . '/php-http/discovery/src/Strategy/CommonClassesStrategy.php',
'Http\\Discovery\\Strategy\\CommonPsr17ClassesStrategy' => __DIR__ . '/..' . '/php-http/discovery/src/Strategy/CommonPsr17ClassesStrategy.php',
'Http\\Discovery\\Strategy\\DiscoveryStrategy' => __DIR__ . '/..' . '/php-http/discovery/src/Strategy/DiscoveryStrategy.php',
'Http\\Discovery\\Strategy\\MockClientStrategy' => __DIR__ . '/..' . '/php-http/discovery/src/Strategy/MockClientStrategy.php',
'Http\\Discovery\\Strategy\\PuliBetaStrategy' => __DIR__ . '/..' . '/php-http/discovery/src/Strategy/PuliBetaStrategy.php',
'Http\\Discovery\\StreamFactoryDiscovery' => __DIR__ . '/..' . '/php-http/discovery/src/StreamFactoryDiscovery.php',
'Http\\Discovery\\UriFactoryDiscovery' => __DIR__ . '/..' . '/php-http/discovery/src/UriFactoryDiscovery.php',
'Http\\Message\\Authentication' => __DIR__ . '/..' . '/php-http/message/src/Authentication.php',
'Http\\Message\\Authentication\\AutoBasicAuth' => __DIR__ . '/..' . '/php-http/message/src/Authentication/AutoBasicAuth.php',
'Http\\Message\\Authentication\\BasicAuth' => __DIR__ . '/..' . '/php-http/message/src/Authentication/BasicAuth.php',
'Http\\Message\\Authentication\\Bearer' => __DIR__ . '/..' . '/php-http/message/src/Authentication/Bearer.php',
'Http\\Message\\Authentication\\Chain' => __DIR__ . '/..' . '/php-http/message/src/Authentication/Chain.php',
'Http\\Message\\Authentication\\Header' => __DIR__ . '/..' . '/php-http/message/src/Authentication/Header.php',
'Http\\Message\\Authentication\\Matching' => __DIR__ . '/..' . '/php-http/message/src/Authentication/Matching.php',
'Http\\Message\\Authentication\\QueryParam' => __DIR__ . '/..' . '/php-http/message/src/Authentication/QueryParam.php',
'Http\\Message\\Authentication\\RequestConditional' => __DIR__ . '/..' . '/php-http/message/src/Authentication/RequestConditional.php',
'Http\\Message\\Authentication\\Wsse' => __DIR__ . '/..' . '/php-http/message/src/Authentication/Wsse.php',
'Http\\Message\\Builder\\ResponseBuilder' => __DIR__ . '/..' . '/php-http/message/src/Builder/ResponseBuilder.php',
'Http\\Message\\Cookie' => __DIR__ . '/..' . '/php-http/message/src/Cookie.php',
'Http\\Message\\CookieJar' => __DIR__ . '/..' . '/php-http/message/src/CookieJar.php',
'Http\\Message\\CookieUtil' => __DIR__ . '/..' . '/php-http/message/src/CookieUtil.php',
'Http\\Message\\Decorator\\MessageDecorator' => __DIR__ . '/..' . '/php-http/message/src/Decorator/MessageDecorator.php',
'Http\\Message\\Decorator\\RequestDecorator' => __DIR__ . '/..' . '/php-http/message/src/Decorator/RequestDecorator.php',
'Http\\Message\\Decorator\\ResponseDecorator' => __DIR__ . '/..' . '/php-http/message/src/Decorator/ResponseDecorator.php',
'Http\\Message\\Decorator\\StreamDecorator' => __DIR__ . '/..' . '/php-http/message/src/Decorator/StreamDecorator.php',
'Http\\Message\\Encoding\\ChunkStream' => __DIR__ . '/..' . '/php-http/message/src/Encoding/ChunkStream.php',
'Http\\Message\\Encoding\\CompressStream' => __DIR__ . '/..' . '/php-http/message/src/Encoding/CompressStream.php',
'Http\\Message\\Encoding\\DechunkStream' => __DIR__ . '/..' . '/php-http/message/src/Encoding/DechunkStream.php',
'Http\\Message\\Encoding\\DecompressStream' => __DIR__ . '/..' . '/php-http/message/src/Encoding/DecompressStream.php',
'Http\\Message\\Encoding\\DeflateStream' => __DIR__ . '/..' . '/php-http/message/src/Encoding/DeflateStream.php',
'Http\\Message\\Encoding\\Filter\\Chunk' => __DIR__ . '/..' . '/php-http/message/src/Encoding/Filter/Chunk.php',
'Http\\Message\\Encoding\\FilteredStream' => __DIR__ . '/..' . '/php-http/message/src/Encoding/FilteredStream.php',
'Http\\Message\\Encoding\\GzipDecodeStream' => __DIR__ . '/..' . '/php-http/message/src/Encoding/GzipDecodeStream.php',
'Http\\Message\\Encoding\\GzipEncodeStream' => __DIR__ . '/..' . '/php-http/message/src/Encoding/GzipEncodeStream.php',
'Http\\Message\\Encoding\\InflateStream' => __DIR__ . '/..' . '/php-http/message/src/Encoding/InflateStream.php',
'Http\\Message\\Exception' => __DIR__ . '/..' . '/php-http/message/src/Exception.php',
'Http\\Message\\Exception\\UnexpectedValueException' => __DIR__ . '/..' . '/php-http/message/src/Exception/UnexpectedValueException.php',
'Http\\Message\\Formatter' => __DIR__ . '/..' . '/php-http/message/src/Formatter.php',
'Http\\Message\\Formatter\\CurlCommandFormatter' => __DIR__ . '/..' . '/php-http/message/src/Formatter/CurlCommandFormatter.php',
'Http\\Message\\Formatter\\FullHttpMessageFormatter' => __DIR__ . '/..' . '/php-http/message/src/Formatter/FullHttpMessageFormatter.php',
'Http\\Message\\Formatter\\SimpleFormatter' => __DIR__ . '/..' . '/php-http/message/src/Formatter/SimpleFormatter.php',
'Http\\Message\\MessageFactory' => __DIR__ . '/..' . '/php-http/message-factory/src/MessageFactory.php',
'Http\\Message\\MessageFactory\\DiactorosMessageFactory' => __DIR__ . '/..' . '/php-http/message/src/MessageFactory/DiactorosMessageFactory.php',
'Http\\Message\\MessageFactory\\GuzzleMessageFactory' => __DIR__ . '/..' . '/php-http/message/src/MessageFactory/GuzzleMessageFactory.php',
'Http\\Message\\MessageFactory\\SlimMessageFactory' => __DIR__ . '/..' . '/php-http/message/src/MessageFactory/SlimMessageFactory.php',
'Http\\Message\\RequestFactory' => __DIR__ . '/..' . '/php-http/message-factory/src/RequestFactory.php',
'Http\\Message\\RequestMatcher' => __DIR__ . '/..' . '/php-http/message/src/RequestMatcher.php',
'Http\\Message\\RequestMatcher\\CallbackRequestMatcher' => __DIR__ . '/..' . '/php-http/message/src/RequestMatcher/CallbackRequestMatcher.php',
'Http\\Message\\RequestMatcher\\RegexRequestMatcher' => __DIR__ . '/..' . '/php-http/message/src/RequestMatcher/RegexRequestMatcher.php',
'Http\\Message\\RequestMatcher\\RequestMatcher' => __DIR__ . '/..' . '/php-http/message/src/RequestMatcher/RequestMatcher.php',
'Http\\Message\\ResponseFactory' => __DIR__ . '/..' . '/php-http/message-factory/src/ResponseFactory.php',
'Http\\Message\\StreamFactory' => __DIR__ . '/..' . '/php-http/message-factory/src/StreamFactory.php',
'Http\\Message\\StreamFactory\\DiactorosStreamFactory' => __DIR__ . '/..' . '/php-http/message/src/StreamFactory/DiactorosStreamFactory.php',
'Http\\Message\\StreamFactory\\GuzzleStreamFactory' => __DIR__ . '/..' . '/php-http/message/src/StreamFactory/GuzzleStreamFactory.php',
'Http\\Message\\StreamFactory\\SlimStreamFactory' => __DIR__ . '/..' . '/php-http/message/src/StreamFactory/SlimStreamFactory.php',
'Http\\Message\\Stream\\BufferedStream' => __DIR__ . '/..' . '/php-http/message/src/Stream/BufferedStream.php',
'Http\\Message\\UriFactory' => __DIR__ . '/..' . '/php-http/message-factory/src/UriFactory.php',
'Http\\Message\\UriFactory\\DiactorosUriFactory' => __DIR__ . '/..' . '/php-http/message/src/UriFactory/DiactorosUriFactory.php',
'Http\\Message\\UriFactory\\GuzzleUriFactory' => __DIR__ . '/..' . '/php-http/message/src/UriFactory/GuzzleUriFactory.php',
'Http\\Message\\UriFactory\\SlimUriFactory' => __DIR__ . '/..' . '/php-http/message/src/UriFactory/SlimUriFactory.php',
'Http\\Promise\\FulfilledPromise' => __DIR__ . '/..' . '/php-http/promise/src/FulfilledPromise.php',
'Http\\Promise\\Promise' => __DIR__ . '/..' . '/php-http/promise/src/Promise.php',
'Http\\Promise\\RejectedPromise' => __DIR__ . '/..' . '/php-http/promise/src/RejectedPromise.php',
'Nyholm\\Psr7\\Factory\\HttplugFactory' => __DIR__ . '/..' . '/nyholm/psr7/src/Factory/HttplugFactory.php',
'Nyholm\\Psr7\\Factory\\Psr17Factory' => __DIR__ . '/..' . '/nyholm/psr7/src/Factory/Psr17Factory.php',
'Nyholm\\Psr7\\MessageTrait' => __DIR__ . '/..' . '/nyholm/psr7/src/MessageTrait.php',
'Nyholm\\Psr7\\Request' => __DIR__ . '/..' . '/nyholm/psr7/src/Request.php',
'Nyholm\\Psr7\\RequestTrait' => __DIR__ . '/..' . '/nyholm/psr7/src/RequestTrait.php',
'Nyholm\\Psr7\\Response' => __DIR__ . '/..' . '/nyholm/psr7/src/Response.php',
'Nyholm\\Psr7\\ServerRequest' => __DIR__ . '/..' . '/nyholm/psr7/src/ServerRequest.php',
'Nyholm\\Psr7\\Stream' => __DIR__ . '/..' . '/nyholm/psr7/src/Stream.php',
'Nyholm\\Psr7\\UploadedFile' => __DIR__ . '/..' . '/nyholm/psr7/src/UploadedFile.php',
'Nyholm\\Psr7\\Uri' => __DIR__ . '/..' . '/nyholm/psr7/src/Uri.php',
'Paynow\\Client' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Client.php',
'Paynow\\Configuration' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Configuration.php',
'Paynow\\ConfigurationInterface' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/ConfigurationInterface.php',
'Paynow\\Environment' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Environment.php',
'Paynow\\Exception\\ConfigurationException' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Exception/ConfigurationException.php',
'Paynow\\Exception\\Error' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Exception/Error.php',
'Paynow\\Exception\\PaynowException' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Exception/PaynowException.php',
'Paynow\\Exception\\SignatureVerificationException' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Exception/SignatureVerificationException.php',
'Paynow\\HttpClient\\ApiResponse' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/HttpClient/ApiResponse.php',
'Paynow\\HttpClient\\HttpClient' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/HttpClient/HttpClient.php',
'Paynow\\HttpClient\\HttpClientException' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/HttpClient/HttpClientException.php',
'Paynow\\HttpClient\\HttpClientInterface' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/HttpClient/HttpClientInterface.php',
'Paynow\\Model\\DataProcessing\\Notice' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Model/DataProcessing/Notice.php',
'Paynow\\Model\\PaymentMethods\\AuthorizationType' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Model/PaymentMethods/AuthorizationType.php',
'Paynow\\Model\\PaymentMethods\\PaymentMethod' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Model/PaymentMethods/PaymentMethod.php',
'Paynow\\Model\\PaymentMethods\\Status' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Model/PaymentMethods/Status.php',
'Paynow\\Model\\PaymentMethods\\Type' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Model/PaymentMethods/Type.php',
'Paynow\\Model\\Payment\\Status' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Model/Payment/Status.php',
'Paynow\\Model\\Refund\\Status' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Model/Refund/Status.php',
'Paynow\\Notification' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Notification.php',
'Paynow\\Response\\DataProcessing\\Notices' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Response/DataProcessing/Notices.php',
'Paynow\\Response\\PaymentMethods\\PaymentMethods' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Response/PaymentMethods/PaymentMethods.php',
'Paynow\\Response\\Payment\\Authorize' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Response/Payment/Authorize.php',
'Paynow\\Response\\Payment\\Status' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Response/Payment/Status.php',
'Paynow\\Response\\Refund\\Status' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Response/Refund/Status.php',
'Paynow\\Service\\DataProcessing' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Service/DataProcessing.php',
'Paynow\\Service\\Payment' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Service/Payment.php',
'Paynow\\Service\\Refund' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Service/Refund.php',
'Paynow\\Service\\Service' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Service/Service.php',
'Paynow\\Service\\ShopConfiguration' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Service/ShopConfiguration.php',
'Paynow\\Tests\\NotificationTest' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/tests/NotificationTest.php',
'Paynow\\Tests\\Service\\DataProcessingTest' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/tests/Service/DataProcessingTest.php',
'Paynow\\Tests\\Service\\PaymentMethodsTest' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/tests/Service/PaymentMethodsTest.php',
'Paynow\\Tests\\Service\\PaymentTest' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/tests/Service/PaymentTest.php',
'Paynow\\Tests\\Service\\RefundTest' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/tests/Service/RefundTest.php',
'Paynow\\Tests\\Service\\ShopConfigurationTest' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/tests/Service/ShopConfigurationTest.php',
'Paynow\\Tests\\TestCase' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/tests/TestCase.php',
'Paynow\\Tests\\TestHttpClient' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/tests/TestHttpClient.php',
'Paynow\\Tests\\Util\\SignatureCalculatorTest' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/tests/Util/SignatureCalculatorTest.php',
'Paynow\\Util\\SignatureCalculator' => __DIR__ . '/..' . '/pay-now/paynow-php-sdk/src/Paynow/Util/SignatureCalculator.php',
'Psr\\Http\\Client\\ClientExceptionInterface' => __DIR__ . '/..' . '/psr/http-client/src/ClientExceptionInterface.php',
'Psr\\Http\\Client\\ClientInterface' => __DIR__ . '/..' . '/psr/http-client/src/ClientInterface.php',
'Psr\\Http\\Client\\NetworkExceptionInterface' => __DIR__ . '/..' . '/psr/http-client/src/NetworkExceptionInterface.php',
'Psr\\Http\\Client\\RequestExceptionInterface' => __DIR__ . '/..' . '/psr/http-client/src/RequestExceptionInterface.php',
'Psr\\Http\\Message\\MessageInterface' => __DIR__ . '/..' . '/psr/http-message/src/MessageInterface.php',
'Psr\\Http\\Message\\RequestFactoryInterface' => __DIR__ . '/..' . '/psr/http-factory/src/RequestFactoryInterface.php',
'Psr\\Http\\Message\\RequestInterface' => __DIR__ . '/..' . '/psr/http-message/src/RequestInterface.php',
'Psr\\Http\\Message\\ResponseFactoryInterface' => __DIR__ . '/..' . '/psr/http-factory/src/ResponseFactoryInterface.php',
'Psr\\Http\\Message\\ResponseInterface' => __DIR__ . '/..' . '/psr/http-message/src/ResponseInterface.php',
'Psr\\Http\\Message\\ServerRequestFactoryInterface' => __DIR__ . '/..' . '/psr/http-factory/src/ServerRequestFactoryInterface.php',
'Psr\\Http\\Message\\ServerRequestInterface' => __DIR__ . '/..' . '/psr/http-message/src/ServerRequestInterface.php',
'Psr\\Http\\Message\\StreamFactoryInterface' => __DIR__ . '/..' . '/psr/http-factory/src/StreamFactoryInterface.php',
'Psr\\Http\\Message\\StreamInterface' => __DIR__ . '/..' . '/psr/http-message/src/StreamInterface.php',
'Psr\\Http\\Message\\UploadedFileFactoryInterface' => __DIR__ . '/..' . '/psr/http-factory/src/UploadedFileFactoryInterface.php',
'Psr\\Http\\Message\\UploadedFileInterface' => __DIR__ . '/..' . '/psr/http-message/src/UploadedFileInterface.php',
'Psr\\Http\\Message\\UriFactoryInterface' => __DIR__ . '/..' . '/psr/http-factory/src/UriFactoryInterface.php',
'Psr\\Http\\Message\\UriInterface' => __DIR__ . '/..' . '/psr/http-message/src/UriInterface.php',
'Symfony\\Component\\OptionsResolver\\Debug\\OptionsResolverIntrospector' => __DIR__ . '/..' . '/symfony/options-resolver/Debug/OptionsResolverIntrospector.php',
'Symfony\\Component\\OptionsResolver\\Exception\\AccessException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/AccessException.php',
'Symfony\\Component\\OptionsResolver\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/ExceptionInterface.php',
'Symfony\\Component\\OptionsResolver\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/InvalidArgumentException.php',
'Symfony\\Component\\OptionsResolver\\Exception\\InvalidOptionsException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/InvalidOptionsException.php',
'Symfony\\Component\\OptionsResolver\\Exception\\MissingOptionsException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/MissingOptionsException.php',
'Symfony\\Component\\OptionsResolver\\Exception\\NoConfigurationException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/NoConfigurationException.php',
'Symfony\\Component\\OptionsResolver\\Exception\\NoSuchOptionException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/NoSuchOptionException.php',
'Symfony\\Component\\OptionsResolver\\Exception\\OptionDefinitionException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/OptionDefinitionException.php',
'Symfony\\Component\\OptionsResolver\\Exception\\UndefinedOptionsException' => __DIR__ . '/..' . '/symfony/options-resolver/Exception/UndefinedOptionsException.php',
'Symfony\\Component\\OptionsResolver\\Options' => __DIR__ . '/..' . '/symfony/options-resolver/Options.php',
'Symfony\\Component\\OptionsResolver\\OptionsResolver' => __DIR__ . '/..' . '/symfony/options-resolver/OptionsResolver.php',
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitb31aa05dff4ca49df03ed75531f10ba8::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitb31aa05dff4ca49df03ed75531f10ba8::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitb31aa05dff4ca49df03ed75531f10ba8::$classMap;
}, null, ClassLoader::class);
}
}

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,800 @@
[
{
"name": "clue/stream-filter",
"version": "v1.6.0",
"version_normalized": "1.6.0.0",
"source": {
"type": "git",
"url": "https://github.com/clue/stream-filter.git",
"reference": "d6169430c7731d8509da7aecd0af756a5747b78e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/clue/stream-filter/zipball/d6169430c7731d8509da7aecd0af756a5747b78e",
"reference": "d6169430c7731d8509da7aecd0af756a5747b78e",
"shasum": ""
},
"require": {
"php": ">=5.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.36"
},
"time": "2022-02-21T13:15:14+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"files": [
"src/functions_include.php"
],
"psr-4": {
"Clue\\StreamFilter\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christian Lück",
"email": "christian@clue.engineering"
}
],
"description": "A simple and modern approach to stream filtering in PHP",
"homepage": "https://github.com/clue/php-stream-filter",
"keywords": [
"bucket brigade",
"callback",
"filter",
"php_user_filter",
"stream",
"stream_filter_append",
"stream_filter_register"
],
"funding": [
{
"url": "https://clue.engineering/support",
"type": "custom"
},
{
"url": "https://github.com/clue",
"type": "github"
}
]
},
{
"name": "nyholm/psr7",
"version": "1.5.0",
"version_normalized": "1.5.0.0",
"source": {
"type": "git",
"url": "https://github.com/Nyholm/psr7.git",
"reference": "1461e07a0f2a975a52082ca3b769ca912b816226"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Nyholm/psr7/zipball/1461e07a0f2a975a52082ca3b769ca912b816226",
"reference": "1461e07a0f2a975a52082ca3b769ca912b816226",
"shasum": ""
},
"require": {
"php": ">=7.1",
"php-http/message-factory": "^1.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0"
},
"provide": {
"psr/http-factory-implementation": "1.0",
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"http-interop/http-factory-tests": "^0.9",
"php-http/psr7-integration-tests": "^1.0",
"phpunit/phpunit": "^7.5 || 8.5 || 9.4",
"symfony/error-handler": "^4.4"
},
"time": "2022-02-02T18:37:57+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Nyholm\\Psr7\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com"
},
{
"name": "Martijn van der Ven",
"email": "martijn@vanderven.se"
}
],
"description": "A fast PHP7 implementation of PSR-7",
"homepage": "https://tnyholm.se",
"keywords": [
"psr-17",
"psr-7"
],
"funding": [
{
"url": "https://github.com/Zegnat",
"type": "github"
},
{
"url": "https://github.com/nyholm",
"type": "github"
}
]
},
{
"name": "pay-now/paynow-php-sdk",
"version": "2.2.1",
"version_normalized": "2.2.1.0",
"source": {
"type": "git",
"url": "https://github.com/pay-now/paynow-php-sdk.git",
"reference": "e7b182f1f1587d8d9f9dc3d57e4df5fee5764a70"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pay-now/paynow-php-sdk/zipball/e7b182f1f1587d8d9f9dc3d57e4df5fee5764a70",
"reference": "e7b182f1f1587d8d9f9dc3d57e4df5fee5764a70",
"shasum": ""
},
"require": {
"php": ">=7.1",
"php-http/client-implementation": "^1.0",
"php-http/discovery": "^1.12",
"php-http/httplug": "^2.2",
"php-http/message-factory": "^1.0",
"psr/http-message": "^1.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"friendsofphp/php-cs-fixer": "^2.15",
"guzzlehttp/psr7": "^1.6",
"nyholm/psr7": "^1.2",
"php-http/guzzle6-adapter": "^2.0",
"php-http/mock-client": "^1.3",
"phpcompatibility/php-compatibility": "^9.3",
"phpunit/phpunit": "^7.0",
"squizlabs/php_codesniffer": "^3.4"
},
"suggest": {
"nyholm/psr7": "A super lightweight PSR-7 implementation",
"php-http/curl-client": "PSR-18 and HTTPlug Async client with cURL"
},
"time": "2022-02-10T08:16:59+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Paynow\\": "src/Paynow/",
"Paynow\\Tests\\": "tests/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "mBank S.A.",
"email": "kontakt@paynow.pl"
}
],
"description": "PHP client library for accessing Paynow API",
"homepage": "https://www.paynow.pl",
"keywords": [
"api",
"mbank",
"payment processing",
"paynow"
]
},
{
"name": "php-http/curl-client",
"version": "2.2.1",
"version_normalized": "2.2.1.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/curl-client.git",
"reference": "2ed4245a817d859dd0c1d51c7078cdb343cf5233"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/curl-client/zipball/2ed4245a817d859dd0c1d51c7078cdb343cf5233",
"reference": "2ed4245a817d859dd0c1d51c7078cdb343cf5233",
"shasum": ""
},
"require": {
"ext-curl": "*",
"php": "^7.1 || ^8.0",
"php-http/discovery": "^1.6",
"php-http/httplug": "^2.0",
"php-http/message": "^1.2",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"symfony/options-resolver": "^3.4 || ^4.0 || ^5.0 || ^6.0"
},
"provide": {
"php-http/async-client-implementation": "1.0",
"php-http/client-implementation": "1.0",
"psr/http-client-implementation": "1.0"
},
"require-dev": {
"guzzlehttp/psr7": "^1.0",
"laminas/laminas-diactoros": "^2.0",
"php-http/client-integration-tests": "^3.0",
"phpunit/phpunit": "^7.5 || ^9.4"
},
"time": "2021-12-10T18:02:07+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Http\\Client\\Curl\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Михаил Красильников",
"email": "m.krasilnikov@yandex.ru"
}
],
"description": "PSR-18 and HTTPlug Async client with cURL",
"homepage": "http://php-http.org",
"keywords": [
"curl",
"http",
"psr-18"
]
},
{
"name": "php-http/discovery",
"version": "1.14.2",
"version_normalized": "1.14.2.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/discovery.git",
"reference": "c8d48852fbc052454af42f6de27635ddd916b959"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/discovery/zipball/c8d48852fbc052454af42f6de27635ddd916b959",
"reference": "c8d48852fbc052454af42f6de27635ddd916b959",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"conflict": {
"nyholm/psr7": "<1.0"
},
"require-dev": {
"graham-campbell/phpspec-skip-example-extension": "^5.0",
"php-http/httplug": "^1.0 || ^2.0",
"php-http/message-factory": "^1.0",
"phpspec/phpspec": "^5.1 || ^6.1"
},
"suggest": {
"php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories"
},
"time": "2022-05-25T07:26:05+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.9-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Http\\Discovery\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
}
],
"description": "Finds installed HTTPlug implementations and PSR-7 message factories",
"homepage": "http://php-http.org",
"keywords": [
"adapter",
"client",
"discovery",
"factory",
"http",
"message",
"psr7"
]
},
{
"name": "php-http/httplug",
"version": "2.3.0",
"version_normalized": "2.3.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/httplug.git",
"reference": "f640739f80dfa1152533976e3c112477f69274eb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/httplug/zipball/f640739f80dfa1152533976e3c112477f69274eb",
"reference": "f640739f80dfa1152533976e3c112477f69274eb",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0",
"php-http/promise": "^1.1",
"psr/http-client": "^1.0",
"psr/http-message": "^1.0"
},
"require-dev": {
"friends-of-phpspec/phpspec-code-coverage": "^4.1",
"phpspec/phpspec": "^5.1 || ^6.0"
},
"time": "2022-02-21T09:52:22+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Http\\Client\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Eric GELOEN",
"email": "geloen.eric@gmail.com"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com",
"homepage": "https://sagikazarmark.hu"
}
],
"description": "HTTPlug, the HTTP client abstraction for PHP",
"homepage": "http://httplug.io",
"keywords": [
"client",
"http"
]
},
{
"name": "php-http/message",
"version": "1.13.0",
"version_normalized": "1.13.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/message.git",
"reference": "7886e647a30a966a1a8d1dad1845b71ca8678361"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/message/zipball/7886e647a30a966a1a8d1dad1845b71ca8678361",
"reference": "7886e647a30a966a1a8d1dad1845b71ca8678361",
"shasum": ""
},
"require": {
"clue/stream-filter": "^1.5",
"php": "^7.1 || ^8.0",
"php-http/message-factory": "^1.0.2",
"psr/http-message": "^1.0"
},
"provide": {
"php-http/message-factory-implementation": "1.0"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.6",
"ext-zlib": "*",
"guzzlehttp/psr7": "^1.0",
"laminas/laminas-diactoros": "^2.0",
"phpspec/phpspec": "^5.1 || ^6.3 || ^7.1",
"slim/slim": "^3.0"
},
"suggest": {
"ext-zlib": "Used with compressor/decompressor streams",
"guzzlehttp/psr7": "Used with Guzzle PSR-7 Factories",
"laminas/laminas-diactoros": "Used with Diactoros Factories",
"slim/slim": "Used with Slim Framework PSR-7 implementation"
},
"time": "2022-02-11T13:41:14+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.10-dev"
}
},
"installation-source": "dist",
"autoload": {
"files": [
"src/filters.php"
],
"psr-4": {
"Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
}
],
"description": "HTTP Message related tools",
"homepage": "http://php-http.org",
"keywords": [
"http",
"message",
"psr-7"
]
},
{
"name": "php-http/message-factory",
"version": "v1.0.2",
"version_normalized": "1.0.2.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/message-factory.git",
"reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/message-factory/zipball/a478cb11f66a6ac48d8954216cfed9aa06a501a1",
"reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1",
"shasum": ""
},
"require": {
"php": ">=5.4",
"psr/http-message": "^1.0"
},
"time": "2015-12-19T14:08:53+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
}
],
"description": "Factory interfaces for PSR-7 HTTP Message",
"homepage": "http://php-http.org",
"keywords": [
"factory",
"http",
"message",
"stream",
"uri"
]
},
{
"name": "php-http/promise",
"version": "1.1.0",
"version_normalized": "1.1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/promise.git",
"reference": "4c4c1f9b7289a2ec57cde7f1e9762a5789506f88"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/promise/zipball/4c4c1f9b7289a2ec57cde7f1e9762a5789506f88",
"reference": "4c4c1f9b7289a2ec57cde7f1e9762a5789506f88",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"friends-of-phpspec/phpspec-code-coverage": "^4.3.2",
"phpspec/phpspec": "^5.1.2 || ^6.2"
},
"time": "2020-07-07T09:29:14+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Http\\Promise\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Joel Wurtz",
"email": "joel.wurtz@gmail.com"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
}
],
"description": "Promise used for asynchronous HTTP requests",
"homepage": "http://httplug.io",
"keywords": [
"promise"
]
},
{
"name": "psr/http-client",
"version": "1.0.1",
"version_normalized": "1.0.1.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-client.git",
"reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
"reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0",
"psr/http-message": "^1.0"
},
"time": "2020-06-29T06:28:15+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Psr\\Http\\Client\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP clients",
"homepage": "https://github.com/php-fig/http-client",
"keywords": [
"http",
"http-client",
"psr",
"psr-18"
]
},
{
"name": "psr/http-factory",
"version": "1.0.1",
"version_normalized": "1.0.1.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-factory.git",
"reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
"reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be",
"shasum": ""
},
"require": {
"php": ">=7.0.0",
"psr/http-message": "^1.0"
},
"time": "2019-04-30T12:38:16+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interfaces for PSR-7 HTTP message factories",
"keywords": [
"factory",
"http",
"message",
"psr",
"psr-17",
"psr-7",
"request",
"response"
]
},
{
"name": "psr/http-message",
"version": "1.0.1",
"version_normalized": "1.0.1.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"time": "2016-08-06T14:39:51+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
"homepage": "https://github.com/php-fig/http-message",
"keywords": [
"http",
"http-message",
"psr",
"psr-7",
"request",
"response"
]
},
{
"name": "symfony/options-resolver",
"version": "v3.4.47",
"version_normalized": "3.4.47.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/options-resolver.git",
"reference": "c7efc97a47b2ebaabc19d5b6c6b50f5c37c92744"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/c7efc97a47b2ebaabc19d5b6c6b50f5c37c92744",
"reference": "c7efc97a47b2ebaabc19d5b6c6b50f5c37c92744",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8"
},
"time": "2020-10-24T10:57:07+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Component\\OptionsResolver\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony OptionsResolver Component",
"homepage": "https://symfony.com",
"keywords": [
"config",
"configuration",
"options"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
]
}
]

11
modules/paynow/vendor/index.php vendored Normal file
View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

11
modules/paynow/vendor/nyholm/index.php vendored Normal file
View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2016 Tobias Nyholm
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,48 @@
{
"name": "nyholm/psr7",
"description": "A fast PHP7 implementation of PSR-7",
"license": "MIT",
"keywords": ["psr-7", "psr-17"],
"homepage": "https://tnyholm.se",
"authors": [
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com"
},
{
"name": "Martijn van der Ven",
"email": "martijn@vanderven.se"
}
],
"require": {
"php": ">=7.1",
"psr/http-message": "^1.0",
"php-http/message-factory": "^1.0",
"psr/http-factory": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^7.5 || 8.5 || 9.4",
"php-http/psr7-integration-tests": "^1.0",
"http-interop/http-factory-tests": "^0.9",
"symfony/error-handler": "^4.4"
},
"provide": {
"psr/http-message-implementation": "1.0",
"psr/http-factory-implementation": "1.0"
},
"autoload": {
"psr-4": {
"Nyholm\\Psr7\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\Nyholm\\Psr7\\": "tests/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
}
}

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,45 @@
<?php
declare(strict_types=1);
namespace Nyholm\Psr7\Factory;
use Http\Message\{MessageFactory, StreamFactory, UriFactory};
use Nyholm\Psr7\{Request, Response, Stream, Uri};
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
use Psr\Http\Message\UriInterface;
/**
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
* @author Martijn van der Ven <martijn@vanderven.se>
*
* @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md
*/
class HttplugFactory implements MessageFactory, StreamFactory, UriFactory
{
public function createRequest($method, $uri, array $headers = [], $body = null, $protocolVersion = '1.1'): RequestInterface
{
return new Request($method, $uri, $headers, $body, $protocolVersion);
}
public function createResponse($statusCode = 200, $reasonPhrase = null, array $headers = [], $body = null, $version = '1.1'): ResponseInterface
{
return new Response((int) $statusCode, $headers, $body, $version, $reasonPhrase);
}
public function createStream($body = null): StreamInterface
{
return Stream::create($body ?? '');
}
public function createUri($uri = ''): UriInterface
{
if ($uri instanceof UriInterface) {
return $uri;
}
return new Uri($uri);
}
}

View File

@@ -0,0 +1,78 @@
<?php
declare(strict_types=1);
namespace Nyholm\Psr7\Factory;
use Nyholm\Psr7\{Request, Response, ServerRequest, Stream, UploadedFile, Uri};
use Psr\Http\Message\{RequestFactoryInterface, RequestInterface, ResponseFactoryInterface, ResponseInterface, ServerRequestFactoryInterface, ServerRequestInterface, StreamFactoryInterface, StreamInterface, UploadedFileFactoryInterface, UploadedFileInterface, UriFactoryInterface, UriInterface};
/**
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
* @author Martijn van der Ven <martijn@vanderven.se>
*
* @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md
*/
class Psr17Factory implements RequestFactoryInterface, ResponseFactoryInterface, ServerRequestFactoryInterface, StreamFactoryInterface, UploadedFileFactoryInterface, UriFactoryInterface
{
public function createRequest(string $method, $uri): RequestInterface
{
return new Request($method, $uri);
}
public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface
{
if (2 > \func_num_args()) {
// This will make the Response class to use a custom reasonPhrase
$reasonPhrase = null;
}
return new Response($code, [], null, '1.1', $reasonPhrase);
}
public function createStream(string $content = ''): StreamInterface
{
return Stream::create($content);
}
public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface
{
if ('' === $filename) {
throw new \RuntimeException('Path cannot be empty');
}
if (false === $resource = @\fopen($filename, $mode)) {
if ('' === $mode || false === \in_array($mode[0], ['r', 'w', 'a', 'x', 'c'], true)) {
throw new \InvalidArgumentException(\sprintf('The mode "%s" is invalid.', $mode));
}
throw new \RuntimeException(\sprintf('The file "%s" cannot be opened: %s', $filename, \error_get_last()['message'] ?? ''));
}
return Stream::create($resource);
}
public function createStreamFromResource($resource): StreamInterface
{
return Stream::create($resource);
}
public function createUploadedFile(StreamInterface $stream, int $size = null, int $error = \UPLOAD_ERR_OK, string $clientFilename = null, string $clientMediaType = null): UploadedFileInterface
{
if (null === $size) {
$size = $stream->getSize();
}
return new UploadedFile($stream, $size, $error, $clientFilename, $clientMediaType);
}
public function createUri(string $uri = ''): UriInterface
{
return new Uri($uri);
}
public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface
{
return new ServerRequest($method, $uri, [], null, '1.1', $serverParams);
}
}

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,207 @@
<?php
declare(strict_types=1);
namespace Nyholm\Psr7;
use Psr\Http\Message\StreamInterface;
/**
* Trait implementing functionality common to requests and responses.
*
* @author Michael Dowling and contributors to guzzlehttp/psr7
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
* @author Martijn van der Ven <martijn@vanderven.se>
*
* @internal should not be used outside of Nyholm/Psr7 as it does not fall under our BC promise
*/
trait MessageTrait
{
/** @var array Map of all registered headers, as original name => array of values */
private $headers = [];
/** @var array Map of lowercase header name => original name at registration */
private $headerNames = [];
/** @var string */
private $protocol = '1.1';
/** @var StreamInterface|null */
private $stream;
public function getProtocolVersion(): string
{
return $this->protocol;
}
public function withProtocolVersion($version): self
{
if ($this->protocol === $version) {
return $this;
}
$new = clone $this;
$new->protocol = $version;
return $new;
}
public function getHeaders(): array
{
return $this->headers;
}
public function hasHeader($header): bool
{
return isset($this->headerNames[\strtr($header, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')]);
}
public function getHeader($header): array
{
$header = \strtr($header, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
if (!isset($this->headerNames[$header])) {
return [];
}
$header = $this->headerNames[$header];
return $this->headers[$header];
}
public function getHeaderLine($header): string
{
return \implode(', ', $this->getHeader($header));
}
public function withHeader($header, $value): self
{
$value = $this->validateAndTrimHeader($header, $value);
$normalized = \strtr($header, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
$new = clone $this;
if (isset($new->headerNames[$normalized])) {
unset($new->headers[$new->headerNames[$normalized]]);
}
$new->headerNames[$normalized] = $header;
$new->headers[$header] = $value;
return $new;
}
public function withAddedHeader($header, $value): self
{
if (!\is_string($header) || '' === $header) {
throw new \InvalidArgumentException('Header name must be an RFC 7230 compatible string.');
}
$new = clone $this;
$new->setHeaders([$header => $value]);
return $new;
}
public function withoutHeader($header): self
{
$normalized = \strtr($header, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
if (!isset($this->headerNames[$normalized])) {
return $this;
}
$header = $this->headerNames[$normalized];
$new = clone $this;
unset($new->headers[$header], $new->headerNames[$normalized]);
return $new;
}
public function getBody(): StreamInterface
{
if (null === $this->stream) {
$this->stream = Stream::create('');
}
return $this->stream;
}
public function withBody(StreamInterface $body): self
{
if ($body === $this->stream) {
return $this;
}
$new = clone $this;
$new->stream = $body;
return $new;
}
private function setHeaders(array $headers): void
{
foreach ($headers as $header => $value) {
if (\is_int($header)) {
// If a header name was set to a numeric string, PHP will cast the key to an int.
// We must cast it back to a string in order to comply with validation.
$header = (string) $header;
}
$value = $this->validateAndTrimHeader($header, $value);
$normalized = \strtr($header, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
if (isset($this->headerNames[$normalized])) {
$header = $this->headerNames[$normalized];
$this->headers[$header] = \array_merge($this->headers[$header], $value);
} else {
$this->headerNames[$normalized] = $header;
$this->headers[$header] = $value;
}
}
}
/**
* Make sure the header complies with RFC 7230.
*
* Header names must be a non-empty string consisting of token characters.
*
* Header values must be strings consisting of visible characters with all optional
* leading and trailing whitespace stripped. This method will always strip such
* optional whitespace. Note that the method does not allow folding whitespace within
* the values as this was deprecated for almost all instances by the RFC.
*
* header-field = field-name ":" OWS field-value OWS
* field-name = 1*( "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." / "^"
* / "_" / "`" / "|" / "~" / %x30-39 / ( %x41-5A / %x61-7A ) )
* OWS = *( SP / HTAB )
* field-value = *( ( %x21-7E / %x80-FF ) [ 1*( SP / HTAB ) ( %x21-7E / %x80-FF ) ] )
*
* @see https://tools.ietf.org/html/rfc7230#section-3.2.4
*/
private function validateAndTrimHeader($header, $values): array
{
if (!\is_string($header) || 1 !== \preg_match("@^[!#$%&'*+.^_`|~0-9A-Za-z-]+$@", $header)) {
throw new \InvalidArgumentException('Header name must be an RFC 7230 compatible string.');
}
if (!\is_array($values)) {
// This is simple, just one value.
if ((!\is_numeric($values) && !\is_string($values)) || 1 !== \preg_match("@^[ \t\x21-\x7E\x80-\xFF]*$@", (string) $values)) {
throw new \InvalidArgumentException('Header values must be RFC 7230 compatible strings.');
}
return [\trim((string) $values, " \t")];
}
if (empty($values)) {
throw new \InvalidArgumentException('Header values must be a string or an array of strings, empty array given.');
}
// Assert Non empty array
$returnValues = [];
foreach ($values as $v) {
if ((!\is_numeric($v) && !\is_string($v)) || 1 !== \preg_match("@^[ \t\x21-\x7E\x80-\xFF]*$@", (string) $v)) {
throw new \InvalidArgumentException('Header values must be RFC 7230 compatible strings.');
}
$returnValues[] = \trim((string) $v, " \t");
}
return $returnValues;
}
}

View File

@@ -0,0 +1,47 @@
<?php
declare(strict_types=1);
namespace Nyholm\Psr7;
use Psr\Http\Message\{RequestInterface, StreamInterface, UriInterface};
/**
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
* @author Martijn van der Ven <martijn@vanderven.se>
*
* @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md
*/
class Request implements RequestInterface
{
use MessageTrait;
use RequestTrait;
/**
* @param string $method HTTP method
* @param string|UriInterface $uri URI
* @param array $headers Request headers
* @param string|resource|StreamInterface|null $body Request body
* @param string $version Protocol version
*/
public function __construct(string $method, $uri, array $headers = [], $body = null, string $version = '1.1')
{
if (!($uri instanceof UriInterface)) {
$uri = new Uri($uri);
}
$this->method = $method;
$this->uri = $uri;
$this->setHeaders($headers);
$this->protocol = $version;
if (!$this->hasHeader('Host')) {
$this->updateHostFromUri();
}
// If we got no body, defer initialization of the stream until Request::getBody()
if ('' !== $body && null !== $body) {
$this->stream = Stream::create($body);
}
}
}

View File

@@ -0,0 +1,113 @@
<?php
declare(strict_types=1);
namespace Nyholm\Psr7;
use Psr\Http\Message\UriInterface;
/**
* @author Michael Dowling and contributors to guzzlehttp/psr7
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
* @author Martijn van der Ven <martijn@vanderven.se>
*
* @internal should not be used outside of Nyholm/Psr7 as it does not fall under our BC promise
*/
trait RequestTrait
{
/** @var string */
private $method;
/** @var string|null */
private $requestTarget;
/** @var UriInterface|null */
private $uri;
public function getRequestTarget(): string
{
if (null !== $this->requestTarget) {
return $this->requestTarget;
}
if ('' === $target = $this->uri->getPath()) {
$target = '/';
}
if ('' !== $this->uri->getQuery()) {
$target .= '?' . $this->uri->getQuery();
}
return $target;
}
public function withRequestTarget($requestTarget): self
{
if (\preg_match('#\s#', $requestTarget)) {
throw new \InvalidArgumentException('Invalid request target provided; cannot contain whitespace');
}
$new = clone $this;
$new->requestTarget = $requestTarget;
return $new;
}
public function getMethod(): string
{
return $this->method;
}
public function withMethod($method): self
{
if (!\is_string($method)) {
throw new \InvalidArgumentException('Method must be a string');
}
$new = clone $this;
$new->method = $method;
return $new;
}
public function getUri(): UriInterface
{
return $this->uri;
}
public function withUri(UriInterface $uri, $preserveHost = false): self
{
if ($uri === $this->uri) {
return $this;
}
$new = clone $this;
$new->uri = $uri;
if (!$preserveHost || !$this->hasHeader('Host')) {
$new->updateHostFromUri();
}
return $new;
}
private function updateHostFromUri(): void
{
if ('' === $host = $this->uri->getHost()) {
return;
}
if (null !== ($port = $this->uri->getPort())) {
$host .= ':' . $port;
}
if (isset($this->headerNames['host'])) {
$header = $this->headerNames['host'];
} else {
$this->headerNames['host'] = $header = 'Host';
}
// Ensure Host is the first header.
// See: http://tools.ietf.org/html/rfc7230#section-5.4
$this->headers = [$header => [$host]] + $this->headers;
}
}

View File

@@ -0,0 +1,90 @@
<?php
declare(strict_types=1);
namespace Nyholm\Psr7;
use Psr\Http\Message\{ResponseInterface, StreamInterface};
/**
* @author Michael Dowling and contributors to guzzlehttp/psr7
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
* @author Martijn van der Ven <martijn@vanderven.se>
*
* @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md
*/
class Response implements ResponseInterface
{
use MessageTrait;
/** @var array Map of standard HTTP status code/reason phrases */
private const PHRASES = [
100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing',
200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-status', 208 => 'Already Reported',
300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => 'Switch Proxy', 307 => 'Temporary Redirect',
400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Time-out', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Large', 415 => 'Unsupported Media Type', 416 => 'Requested range not satisfiable', 417 => 'Expectation Failed', 418 => 'I\'m a teapot', 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', 425 => 'Unordered Collection', 426 => 'Upgrade Required', 428 => 'Precondition Required', 429 => 'Too Many Requests', 431 => 'Request Header Fields Too Large', 451 => 'Unavailable For Legal Reasons',
500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Time-out', 505 => 'HTTP Version not supported', 506 => 'Variant Also Negotiates', 507 => 'Insufficient Storage', 508 => 'Loop Detected', 511 => 'Network Authentication Required',
];
/** @var string */
private $reasonPhrase = '';
/** @var int */
private $statusCode;
/**
* @param int $status Status code
* @param array $headers Response headers
* @param string|resource|StreamInterface|null $body Response body
* @param string $version Protocol version
* @param string|null $reason Reason phrase (when empty a default will be used based on the status code)
*/
public function __construct(int $status = 200, array $headers = [], $body = null, string $version = '1.1', string $reason = null)
{
// If we got no body, defer initialization of the stream until Response::getBody()
if ('' !== $body && null !== $body) {
$this->stream = Stream::create($body);
}
$this->statusCode = $status;
$this->setHeaders($headers);
if (null === $reason && isset(self::PHRASES[$this->statusCode])) {
$this->reasonPhrase = self::PHRASES[$status];
} else {
$this->reasonPhrase = $reason ?? '';
}
$this->protocol = $version;
}
public function getStatusCode(): int
{
return $this->statusCode;
}
public function getReasonPhrase(): string
{
return $this->reasonPhrase;
}
public function withStatus($code, $reasonPhrase = ''): self
{
if (!\is_int($code) && !\is_string($code)) {
throw new \InvalidArgumentException('Status code has to be an integer');
}
$code = (int) $code;
if ($code < 100 || $code > 599) {
throw new \InvalidArgumentException(\sprintf('Status code has to be an integer between 100 and 599. A status code of %d was given', $code));
}
$new = clone $this;
$new->statusCode = $code;
if ((null === $reasonPhrase || '' === $reasonPhrase) && isset(self::PHRASES[$new->statusCode])) {
$reasonPhrase = self::PHRASES[$new->statusCode];
}
$new->reasonPhrase = $reasonPhrase;
return $new;
}
}

View File

@@ -0,0 +1,167 @@
<?php
declare(strict_types=1);
namespace Nyholm\Psr7;
use Psr\Http\Message\{ServerRequestInterface, StreamInterface, UploadedFileInterface, UriInterface};
/**
* @author Michael Dowling and contributors to guzzlehttp/psr7
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
* @author Martijn van der Ven <martijn@vanderven.se>
*
* @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md
*/
class ServerRequest implements ServerRequestInterface
{
use MessageTrait;
use RequestTrait;
/** @var array */
private $attributes = [];
/** @var array */
private $cookieParams = [];
/** @var array|object|null */
private $parsedBody;
/** @var array */
private $queryParams = [];
/** @var array */
private $serverParams;
/** @var UploadedFileInterface[] */
private $uploadedFiles = [];
/**
* @param string $method HTTP method
* @param string|UriInterface $uri URI
* @param array $headers Request headers
* @param string|resource|StreamInterface|null $body Request body
* @param string $version Protocol version
* @param array $serverParams Typically the $_SERVER superglobal
*/
public function __construct(string $method, $uri, array $headers = [], $body = null, string $version = '1.1', array $serverParams = [])
{
$this->serverParams = $serverParams;
if (!($uri instanceof UriInterface)) {
$uri = new Uri($uri);
}
$this->method = $method;
$this->uri = $uri;
$this->setHeaders($headers);
$this->protocol = $version;
if (!$this->hasHeader('Host')) {
$this->updateHostFromUri();
}
// If we got no body, defer initialization of the stream until ServerRequest::getBody()
if ('' !== $body && null !== $body) {
$this->stream = Stream::create($body);
}
}
public function getServerParams(): array
{
return $this->serverParams;
}
public function getUploadedFiles(): array
{
return $this->uploadedFiles;
}
public function withUploadedFiles(array $uploadedFiles)
{
$new = clone $this;
$new->uploadedFiles = $uploadedFiles;
return $new;
}
public function getCookieParams(): array
{
return $this->cookieParams;
}
public function withCookieParams(array $cookies)
{
$new = clone $this;
$new->cookieParams = $cookies;
return $new;
}
public function getQueryParams(): array
{
return $this->queryParams;
}
public function withQueryParams(array $query)
{
$new = clone $this;
$new->queryParams = $query;
return $new;
}
public function getParsedBody()
{
return $this->parsedBody;
}
public function withParsedBody($data)
{
if (!\is_array($data) && !\is_object($data) && null !== $data) {
throw new \InvalidArgumentException('First parameter to withParsedBody MUST be object, array or null');
}
$new = clone $this;
$new->parsedBody = $data;
return $new;
}
public function getAttributes(): array
{
return $this->attributes;
}
/**
* @return mixed
*/
public function getAttribute($attribute, $default = null)
{
if (false === \array_key_exists($attribute, $this->attributes)) {
return $default;
}
return $this->attributes[$attribute];
}
public function withAttribute($attribute, $value): self
{
$new = clone $this;
$new->attributes[$attribute] = $value;
return $new;
}
public function withoutAttribute($attribute): self
{
if (false === \array_key_exists($attribute, $this->attributes)) {
return $this;
}
$new = clone $this;
unset($new->attributes[$attribute]);
return $new;
}
}

View File

@@ -0,0 +1,306 @@
<?php
declare(strict_types=1);
namespace Nyholm\Psr7;
use Psr\Http\Message\StreamInterface;
use Symfony\Component\Debug\ErrorHandler as SymfonyLegacyErrorHandler;
use Symfony\Component\ErrorHandler\ErrorHandler as SymfonyErrorHandler;
/**
* @author Michael Dowling and contributors to guzzlehttp/psr7
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
* @author Martijn van der Ven <martijn@vanderven.se>
*
* @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md
*/
class Stream implements StreamInterface
{
/** @var resource|null A resource reference */
private $stream;
/** @var bool */
private $seekable;
/** @var bool */
private $readable;
/** @var bool */
private $writable;
/** @var array|mixed|void|bool|null */
private $uri;
/** @var int|null */
private $size;
/** @var array Hash of readable and writable stream types */
private const READ_WRITE_HASH = [
'read' => [
'r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true,
'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true,
'c+b' => true, 'rt' => true, 'w+t' => true, 'r+t' => true,
'x+t' => true, 'c+t' => true, 'a+' => true,
],
'write' => [
'w' => true, 'w+' => true, 'rw' => true, 'r+' => true, 'x+' => true,
'c+' => true, 'wb' => true, 'w+b' => true, 'r+b' => true,
'x+b' => true, 'c+b' => true, 'w+t' => true, 'r+t' => true,
'x+t' => true, 'c+t' => true, 'a' => true, 'a+' => true,
],
];
private function __construct()
{
}
/**
* Creates a new PSR-7 stream.
*
* @param string|resource|StreamInterface $body
*
* @throws \InvalidArgumentException
*/
public static function create($body = ''): StreamInterface
{
if ($body instanceof StreamInterface) {
return $body;
}
if (\is_string($body)) {
$resource = \fopen('php://temp', 'rw+');
\fwrite($resource, $body);
$body = $resource;
}
if (\is_resource($body)) {
$new = new self();
$new->stream = $body;
$meta = \stream_get_meta_data($new->stream);
$new->seekable = $meta['seekable'] && 0 === \fseek($new->stream, 0, \SEEK_CUR);
$new->readable = isset(self::READ_WRITE_HASH['read'][$meta['mode']]);
$new->writable = isset(self::READ_WRITE_HASH['write'][$meta['mode']]);
return $new;
}
throw new \InvalidArgumentException('First argument to Stream::create() must be a string, resource or StreamInterface.');
}
/**
* Closes the stream when the destructed.
*/
public function __destruct()
{
$this->close();
}
/**
* @return string
*/
public function __toString()
{
try {
if ($this->isSeekable()) {
$this->seek(0);
}
return $this->getContents();
} catch (\Throwable $e) {
if (\PHP_VERSION_ID >= 70400) {
throw $e;
}
if (\is_array($errorHandler = \set_error_handler('var_dump'))) {
$errorHandler = $errorHandler[0] ?? null;
}
\restore_error_handler();
if ($e instanceof \Error || $errorHandler instanceof SymfonyErrorHandler || $errorHandler instanceof SymfonyLegacyErrorHandler) {
return \trigger_error((string) $e, \E_USER_ERROR);
}
return '';
}
}
public function close(): void
{
if (isset($this->stream)) {
if (\is_resource($this->stream)) {
\fclose($this->stream);
}
$this->detach();
}
}
public function detach()
{
if (!isset($this->stream)) {
return null;
}
$result = $this->stream;
unset($this->stream);
$this->size = $this->uri = null;
$this->readable = $this->writable = $this->seekable = false;
return $result;
}
private function getUri()
{
if (false !== $this->uri) {
$this->uri = $this->getMetadata('uri') ?? false;
}
return $this->uri;
}
public function getSize(): ?int
{
if (null !== $this->size) {
return $this->size;
}
if (!isset($this->stream)) {
return null;
}
// Clear the stat cache if the stream has a URI
if ($uri = $this->getUri()) {
\clearstatcache(true, $uri);
}
$stats = \fstat($this->stream);
if (isset($stats['size'])) {
$this->size = $stats['size'];
return $this->size;
}
return null;
}
public function tell(): int
{
if (!isset($this->stream)) {
throw new \RuntimeException('Stream is detached');
}
if (false === $result = @\ftell($this->stream)) {
throw new \RuntimeException('Unable to determine stream position: ' . (\error_get_last()['message'] ?? ''));
}
return $result;
}
public function eof(): bool
{
return !isset($this->stream) || \feof($this->stream);
}
public function isSeekable(): bool
{
return $this->seekable;
}
public function seek($offset, $whence = \SEEK_SET): void
{
if (!isset($this->stream)) {
throw new \RuntimeException('Stream is detached');
}
if (!$this->seekable) {
throw new \RuntimeException('Stream is not seekable');
}
if (-1 === \fseek($this->stream, $offset, $whence)) {
throw new \RuntimeException('Unable to seek to stream position "' . $offset . '" with whence ' . \var_export($whence, true));
}
}
public function rewind(): void
{
$this->seek(0);
}
public function isWritable(): bool
{
return $this->writable;
}
public function write($string): int
{
if (!isset($this->stream)) {
throw new \RuntimeException('Stream is detached');
}
if (!$this->writable) {
throw new \RuntimeException('Cannot write to a non-writable stream');
}
// We can't know the size after writing anything
$this->size = null;
if (false === $result = @\fwrite($this->stream, $string)) {
throw new \RuntimeException('Unable to write to stream: ' . (\error_get_last()['message'] ?? ''));
}
return $result;
}
public function isReadable(): bool
{
return $this->readable;
}
public function read($length): string
{
if (!isset($this->stream)) {
throw new \RuntimeException('Stream is detached');
}
if (!$this->readable) {
throw new \RuntimeException('Cannot read from non-readable stream');
}
if (false === $result = @\fread($this->stream, $length)) {
throw new \RuntimeException('Unable to read from stream: ' . (\error_get_last()['message'] ?? ''));
}
return $result;
}
public function getContents(): string
{
if (!isset($this->stream)) {
throw new \RuntimeException('Stream is detached');
}
if (false === $contents = @\stream_get_contents($this->stream)) {
throw new \RuntimeException('Unable to read stream contents: ' . (\error_get_last()['message'] ?? ''));
}
return $contents;
}
/**
* @return mixed
*/
public function getMetadata($key = null)
{
if (!isset($this->stream)) {
return $key ? null : [];
}
$meta = \stream_get_meta_data($this->stream);
if (null === $key) {
return $meta;
}
return $meta[$key] ?? null;
}
}

View File

@@ -0,0 +1,179 @@
<?php
declare(strict_types=1);
namespace Nyholm\Psr7;
use Psr\Http\Message\{StreamInterface, UploadedFileInterface};
/**
* @author Michael Dowling and contributors to guzzlehttp/psr7
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
* @author Martijn van der Ven <martijn@vanderven.se>
*
* @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md
*/
class UploadedFile implements UploadedFileInterface
{
/** @var array */
private const ERRORS = [
\UPLOAD_ERR_OK => 1,
\UPLOAD_ERR_INI_SIZE => 1,
\UPLOAD_ERR_FORM_SIZE => 1,
\UPLOAD_ERR_PARTIAL => 1,
\UPLOAD_ERR_NO_FILE => 1,
\UPLOAD_ERR_NO_TMP_DIR => 1,
\UPLOAD_ERR_CANT_WRITE => 1,
\UPLOAD_ERR_EXTENSION => 1,
];
/** @var string */
private $clientFilename;
/** @var string */
private $clientMediaType;
/** @var int */
private $error;
/** @var string|null */
private $file;
/** @var bool */
private $moved = false;
/** @var int */
private $size;
/** @var StreamInterface|null */
private $stream;
/**
* @param StreamInterface|string|resource $streamOrFile
* @param int $size
* @param int $errorStatus
* @param string|null $clientFilename
* @param string|null $clientMediaType
*/
public function __construct($streamOrFile, $size, $errorStatus, $clientFilename = null, $clientMediaType = null)
{
if (false === \is_int($errorStatus) || !isset(self::ERRORS[$errorStatus])) {
throw new \InvalidArgumentException('Upload file error status must be an integer value and one of the "UPLOAD_ERR_*" constants.');
}
if (false === \is_int($size)) {
throw new \InvalidArgumentException('Upload file size must be an integer');
}
if (null !== $clientFilename && !\is_string($clientFilename)) {
throw new \InvalidArgumentException('Upload file client filename must be a string or null');
}
if (null !== $clientMediaType && !\is_string($clientMediaType)) {
throw new \InvalidArgumentException('Upload file client media type must be a string or null');
}
$this->error = $errorStatus;
$this->size = $size;
$this->clientFilename = $clientFilename;
$this->clientMediaType = $clientMediaType;
if (\UPLOAD_ERR_OK === $this->error) {
// Depending on the value set file or stream variable.
if (\is_string($streamOrFile) && '' !== $streamOrFile) {
$this->file = $streamOrFile;
} elseif (\is_resource($streamOrFile)) {
$this->stream = Stream::create($streamOrFile);
} elseif ($streamOrFile instanceof StreamInterface) {
$this->stream = $streamOrFile;
} else {
throw new \InvalidArgumentException('Invalid stream or file provided for UploadedFile');
}
}
}
/**
* @throws \RuntimeException if is moved or not ok
*/
private function validateActive(): void
{
if (\UPLOAD_ERR_OK !== $this->error) {
throw new \RuntimeException('Cannot retrieve stream due to upload error');
}
if ($this->moved) {
throw new \RuntimeException('Cannot retrieve stream after it has already been moved');
}
}
public function getStream(): StreamInterface
{
$this->validateActive();
if ($this->stream instanceof StreamInterface) {
return $this->stream;
}
if (false === $resource = @\fopen($this->file, 'r')) {
throw new \RuntimeException(\sprintf('The file "%s" cannot be opened: %s', $this->file, \error_get_last()['message'] ?? ''));
}
return Stream::create($resource);
}
public function moveTo($targetPath): void
{
$this->validateActive();
if (!\is_string($targetPath) || '' === $targetPath) {
throw new \InvalidArgumentException('Invalid path provided for move operation; must be a non-empty string');
}
if (null !== $this->file) {
$this->moved = 'cli' === \PHP_SAPI ? @\rename($this->file, $targetPath) : @\move_uploaded_file($this->file, $targetPath);
if (false === $this->moved) {
throw new \RuntimeException(\sprintf('Uploaded file could not be moved to "%s": %s', $targetPath, \error_get_last()['message'] ?? ''));
}
} else {
$stream = $this->getStream();
if ($stream->isSeekable()) {
$stream->rewind();
}
if (false === $resource = @\fopen($targetPath, 'w')) {
throw new \RuntimeException(\sprintf('The file "%s" cannot be opened: %s', $targetPath, \error_get_last()['message'] ?? ''));
}
$dest = Stream::create($resource);
while (!$stream->eof()) {
if (!$dest->write($stream->read(1048576))) {
break;
}
}
$this->moved = true;
}
}
public function getSize(): int
{
return $this->size;
}
public function getError(): int
{
return $this->error;
}
public function getClientFilename(): ?string
{
return $this->clientFilename;
}
public function getClientMediaType(): ?string
{
return $this->clientMediaType;
}
}

View File

@@ -0,0 +1,312 @@
<?php
declare(strict_types=1);
namespace Nyholm\Psr7;
use Psr\Http\Message\UriInterface;
/**
* PSR-7 URI implementation.
*
* @author Michael Dowling
* @author Tobias Schultze
* @author Matthew Weier O'Phinney
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
* @author Martijn van der Ven <martijn@vanderven.se>
*
* @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md
*/
class Uri implements UriInterface
{
private const SCHEMES = ['http' => 80, 'https' => 443];
private const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~';
private const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;=';
/** @var string Uri scheme. */
private $scheme = '';
/** @var string Uri user info. */
private $userInfo = '';
/** @var string Uri host. */
private $host = '';
/** @var int|null Uri port. */
private $port;
/** @var string Uri path. */
private $path = '';
/** @var string Uri query string. */
private $query = '';
/** @var string Uri fragment. */
private $fragment = '';
public function __construct(string $uri = '')
{
if ('' !== $uri) {
if (false === $parts = \parse_url($uri)) {
throw new \InvalidArgumentException(\sprintf('Unable to parse URI: "%s"', $uri));
}
// Apply parse_url parts to a URI.
$this->scheme = isset($parts['scheme']) ? \strtr($parts['scheme'], 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') : '';
$this->userInfo = $parts['user'] ?? '';
$this->host = isset($parts['host']) ? \strtr($parts['host'], 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') : '';
$this->port = isset($parts['port']) ? $this->filterPort($parts['port']) : null;
$this->path = isset($parts['path']) ? $this->filterPath($parts['path']) : '';
$this->query = isset($parts['query']) ? $this->filterQueryAndFragment($parts['query']) : '';
$this->fragment = isset($parts['fragment']) ? $this->filterQueryAndFragment($parts['fragment']) : '';
if (isset($parts['pass'])) {
$this->userInfo .= ':' . $parts['pass'];
}
}
}
public function __toString(): string
{
return self::createUriString($this->scheme, $this->getAuthority(), $this->path, $this->query, $this->fragment);
}
public function getScheme(): string
{
return $this->scheme;
}
public function getAuthority(): string
{
if ('' === $this->host) {
return '';
}
$authority = $this->host;
if ('' !== $this->userInfo) {
$authority = $this->userInfo . '@' . $authority;
}
if (null !== $this->port) {
$authority .= ':' . $this->port;
}
return $authority;
}
public function getUserInfo(): string
{
return $this->userInfo;
}
public function getHost(): string
{
return $this->host;
}
public function getPort(): ?int
{
return $this->port;
}
public function getPath(): string
{
return $this->path;
}
public function getQuery(): string
{
return $this->query;
}
public function getFragment(): string
{
return $this->fragment;
}
public function withScheme($scheme): self
{
if (!\is_string($scheme)) {
throw new \InvalidArgumentException('Scheme must be a string');
}
if ($this->scheme === $scheme = \strtr($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')) {
return $this;
}
$new = clone $this;
$new->scheme = $scheme;
$new->port = $new->filterPort($new->port);
return $new;
}
public function withUserInfo($user, $password = null): self
{
$info = $user;
if (null !== $password && '' !== $password) {
$info .= ':' . $password;
}
if ($this->userInfo === $info) {
return $this;
}
$new = clone $this;
$new->userInfo = $info;
return $new;
}
public function withHost($host): self
{
if (!\is_string($host)) {
throw new \InvalidArgumentException('Host must be a string');
}
if ($this->host === $host = \strtr($host, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')) {
return $this;
}
$new = clone $this;
$new->host = $host;
return $new;
}
public function withPort($port): self
{
if ($this->port === $port = $this->filterPort($port)) {
return $this;
}
$new = clone $this;
$new->port = $port;
return $new;
}
public function withPath($path): self
{
if ($this->path === $path = $this->filterPath($path)) {
return $this;
}
$new = clone $this;
$new->path = $path;
return $new;
}
public function withQuery($query): self
{
if ($this->query === $query = $this->filterQueryAndFragment($query)) {
return $this;
}
$new = clone $this;
$new->query = $query;
return $new;
}
public function withFragment($fragment): self
{
if ($this->fragment === $fragment = $this->filterQueryAndFragment($fragment)) {
return $this;
}
$new = clone $this;
$new->fragment = $fragment;
return $new;
}
/**
* Create a URI string from its various parts.
*/
private static function createUriString(string $scheme, string $authority, string $path, string $query, string $fragment): string
{
$uri = '';
if ('' !== $scheme) {
$uri .= $scheme . ':';
}
if ('' !== $authority) {
$uri .= '//' . $authority;
}
if ('' !== $path) {
if ('/' !== $path[0]) {
if ('' !== $authority) {
// If the path is rootless and an authority is present, the path MUST be prefixed by "/"
$path = '/' . $path;
}
} elseif (isset($path[1]) && '/' === $path[1]) {
if ('' === $authority) {
// If the path is starting with more than one "/" and no authority is present, the
// starting slashes MUST be reduced to one.
$path = '/' . \ltrim($path, '/');
}
}
$uri .= $path;
}
if ('' !== $query) {
$uri .= '?' . $query;
}
if ('' !== $fragment) {
$uri .= '#' . $fragment;
}
return $uri;
}
/**
* Is a given port non-standard for the current scheme?
*/
private static function isNonStandardPort(string $scheme, int $port): bool
{
return !isset(self::SCHEMES[$scheme]) || $port !== self::SCHEMES[$scheme];
}
private function filterPort($port): ?int
{
if (null === $port) {
return null;
}
$port = (int) $port;
if (0 > $port || 0xffff < $port) {
throw new \InvalidArgumentException(\sprintf('Invalid port: %d. Must be between 0 and 65535', $port));
}
return self::isNonStandardPort($this->scheme, $port) ? $port : null;
}
private function filterPath($path): string
{
if (!\is_string($path)) {
throw new \InvalidArgumentException('Path must be a string');
}
return \preg_replace_callback('/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/', [__CLASS__, 'rawurlencodeMatchZero'], $path);
}
private function filterQueryAndFragment($str): string
{
if (!\is_string($str)) {
throw new \InvalidArgumentException('Query and fragment must be a string');
}
return \preg_replace_callback('/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/', [__CLASS__, 'rawurlencodeMatchZero'], $str);
}
private static function rawurlencodeMatchZero(array $match): string
{
return \rawurlencode($match[0]);
}
}

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

11
modules/paynow/vendor/pay-now/index.php vendored Normal file
View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 mBank S.A.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,56 @@
{
"name": "pay-now/paynow-php-sdk",
"description": "PHP client library for accessing Paynow API",
"version": "2.2.1",
"keywords": [
"paynow",
"mbank",
"payment processing",
"api"
],
"type": "library",
"homepage": "https://www.paynow.pl",
"license": "MIT",
"authors": [
{
"name": "mBank S.A.",
"email": "kontakt@paynow.pl"
}
],
"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"php": ">=7.1",
"psr/http-message": "^1.0",
"php-http/client-implementation": "^1.0",
"php-http/message-factory": "^1.0",
"php-http/discovery": "^1.12",
"php-http/httplug": "^2.2"
},
"require-dev": {
"phpunit/phpunit": "^7.0",
"php-http/mock-client": "^1.3",
"squizlabs/php_codesniffer": "^3.4",
"friendsofphp/php-cs-fixer": "^2.15",
"phpcompatibility/php-compatibility": "^9.3",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"nyholm/psr7": "^1.2",
"guzzlehttp/psr7": "^1.6",
"php-http/guzzle6-adapter": "^2.0"
},
"suggest": {
"nyholm/psr7": "A super lightweight PSR-7 implementation",
"php-http/curl-client": "PSR-18 and HTTPlug Async client with cURL"
},
"autoload": {
"psr-4": {
"Paynow\\": "src/Paynow/",
"Paynow\\Tests\\": "tests/"
}
},
"scripts": {
"test": "vendor/bin/phpunit",
"cs-check": "php-cs-fixer fix --no-interaction --dry-run --diff",
"cs-fix": "php-cs-fixer fix -v --diff"
}
}

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,17 @@
<phpunit bootstrap="tests/bootstrap.php"
colors="false">
<testsuites>
<testsuite name="Paynow PHP Test Suite">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./src</directory>
<exclude>
<directory>vendor</directory>
<directory suffix=".php">tests</directory>
</exclude>
</whitelist>
</filter>
</phpunit>

View File

@@ -0,0 +1,57 @@
<?php
namespace Paynow;
use Paynow\HttpClient\HttpClient;
use Paynow\HttpClient\HttpClientInterface;
class Client
{
private $configuration;
private $httpClient;
/**
* @param string $apiKey
* @param string $apiSignatureKey
* @param string $environment
* @param string|null $applicationName
*/
public function __construct(
string $apiKey,
string $apiSignatureKey,
string $environment,
?string $applicationName = null
) {
$this->configuration = new Configuration();
$this->configuration->setApiKey($apiKey);
$this->configuration->setSignatureKey($apiSignatureKey);
$this->configuration->setEnvironment($environment);
$this->configuration->setApplicationName($applicationName);
$this->httpClient = new HttpClient($this->configuration);
}
/**
* @return Configuration
*/
public function getConfiguration(): Configuration
{
return $this->configuration;
}
/**
* @param HttpClientInterface $httpClient
*/
public function setHttpClient(HttpClientInterface $httpClient): void
{
$this->httpClient = $httpClient;
}
/**
* @return HttpClientInterface
*/
public function getHttpClient(): HttpClientInterface
{
return $this->httpClient;
}
}

View File

@@ -0,0 +1,131 @@
<?php
namespace Paynow;
class Configuration implements ConfigurationInterface
{
public const API_VERSION = 'v1';
public const API_VERSION_V2 = 'v2';
public const API_PRODUCTION_URL = 'https://api.paynow.pl';
public const API_SANDBOX_URL = 'https://api.sandbox.paynow.pl';
public const USER_AGENT = 'paynow-php-sdk';
/** @var array */
protected $data = [];
/**
* Set a key value pair
*
* @param string $key Key to set
* @param mixed $value Value to set
*/
private function set($key, $value)
{
$this->data[$key] = $value;
}
/**
* Get a specific key value
*
* @param string $key key to retrieve
* @return mixed|null Value of the key or NULL
*/
private function get($key)
{
return isset($this->data[$key]) ? $this->data[$key] : null;
}
/**
* Get an API key
*
* @return mixed|null
*/
public function getApiKey()
{
return $this->get('api_key');
}
/**
* Get Signature key
*
* @return mixed|null
*/
public function getSignatureKey()
{
return $this->get('signature_key');
}
/**
* Get environment name
*
* @return mixed|null
*/
public function getEnvironment()
{
return $this->get('environment');
}
/**
* Get API url
*
* @return mixed|null
*/
public function getUrl()
{
return $this->get('url');
}
/**
* Set an API Key
*
* @param $apiKey
*/
public function setApiKey($apiKey)
{
$this->set('api_key', $apiKey);
}
/**
* Set Signature Key
*
* @param $signatureKey
*/
public function setSignatureKey($signatureKey)
{
$this->set('signature_key', $signatureKey);
}
/**
* Set environment
*
* @param $environment
*/
public function setEnvironment($environment)
{
if (Environment::PRODUCTION === $environment) {
$this->set('environment', Environment::PRODUCTION);
$this->set('url', self::API_PRODUCTION_URL);
} else {
$this->set('environment', Environment::SANDBOX);
$this->set('url', self::API_SANDBOX_URL);
}
}
/**
* Set an application name
*
* @param $applicationName
*/
public function setApplicationName($applicationName)
{
$this->set('application_name', $applicationName);
}
/**
* @return mixed|null
*/
public function getApplicationName()
{
return $this->get('application_name');
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace Paynow;
interface ConfigurationInterface
{
public function getApiKey();
public function getSignatureKey();
public function getEnvironment();
public function getUrl();
}

View File

@@ -0,0 +1,9 @@
<?php
namespace Paynow;
class Environment
{
public const PRODUCTION = 'production';
public const SANDBOX = 'sandbox';
}

View File

@@ -0,0 +1,7 @@
<?php
namespace Paynow\Exception;
class ConfigurationException extends PaynowException
{
}

View File

@@ -0,0 +1,34 @@
<?php
namespace Paynow\Exception;
class Error
{
/** @var string */
private $type;
/** @var string */
private $message;
public function __construct(string $type, string $message)
{
$this->type = $type;
$this->message = $message;
}
/**
* @return string
*/
public function getType(): string
{
return $this->type;
}
/**
* @return string
*/
public function getMessage(): string
{
return $this->message;
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace Paynow\Exception;
use Exception;
use Throwable;
class PaynowException extends Exception
{
/** @var Error[] */
private $errors = [];
/**
* PaynowException constructor.
* @param string $message
* @param int $code
* @param string|null $body
* @param Throwable|null $previous
*/
public function __construct(string $message, int $code = 0, ?string $body = null, Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
if ($body) {
$json = json_decode($body);
if (isset($json->errors) && ! empty($json->errors)) {
foreach ($json->errors as $error) {
$this->errors[] = new Error($error->errorType, $error->message);
}
}
}
}
/**
* @return Error[]
*/
public function getErrors(): array
{
return $this->errors;
}
}

View File

@@ -0,0 +1,7 @@
<?php
namespace Paynow\Exception;
class SignatureVerificationException extends PaynowException
{
}

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,78 @@
<?php
namespace Paynow\HttpClient;
use Psr\Http\Message\ResponseInterface;
class ApiResponse
{
/**
* Body content
*
* @var string
*/
public $body;
/**
* Http status
*
* @var int
*/
public $status;
/**
* Headers list
*
* @var array
*/
protected $headers;
/**
* @param ResponseInterface $response
* @throws HttpClientException
*/
public function __construct(ResponseInterface $response)
{
$this->body = $response->getBody();
$this->status = $response->getStatusCode();
$this->headers = $response->getHeaders();
if ($response->getStatusCode() >= 400) {
throw new HttpClientException(
'Error occurred during processing request',
$response->getStatusCode(),
$response->getBody()->getContents()
);
}
}
/**
* Parse JSON
*
* @return mixed
*/
public function decode()
{
return json_decode((string)$this->body);
}
/**
* Get status
*
* @return int
*/
public function getStatus(): int
{
return $this->status;
}
/**
* Get headers
*
* @return array
*/
public function getHeaders(): array
{
return $this->headers;
}
}

View File

@@ -0,0 +1,175 @@
<?php
namespace Paynow\HttpClient;
use Http\Discovery\Exception\NotFoundException;
use Http\Discovery\HttpClientDiscovery;
use Http\Discovery\Psr17FactoryDiscovery;
use Http\Discovery\Psr18ClientDiscovery;
use Paynow\Configuration;
use Paynow\Util\SignatureCalculator;
use Psr\Http\Client\ClientExceptionInterface;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestFactoryInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\StreamFactoryInterface;
use Psr\Http\Message\UriInterface;
class HttpClient implements HttpClientInterface
{
/** @var ClientInterface */
protected $client;
/** @var RequestFactoryInterface */
protected $messageFactory;
/** @var StreamFactoryInterface */
protected $streamFactory;
/** @var Configuration */
protected $config;
/** @var UriInterface */
private $url;
/** @param Configuration $config */
public function __construct(Configuration $config)
{
$this->config = $config;
$this->messageFactory = Psr17FactoryDiscovery::findRequestFactory();
$this->streamFactory = Psr17FactoryDiscovery::findStreamFactory();
try {
$this->client = Psr18ClientDiscovery::find();
} catch (NotFoundException $exception) {
$this->client = HttpClientDiscovery::find();
}
$this->url = Psr17FactoryDiscovery::findUrlFactory()->createUri((string)$config->getUrl());
}
/**
* @return string
*/
private function getUserAgent(): string
{
if ($this->config->getApplicationName()) {
return $this->config->getApplicationName() . ' (' . Configuration::USER_AGENT . ')';
}
return Configuration::USER_AGENT;
}
/**
* @param RequestInterface $request
* @throws HttpClientException
* @return ApiResponse
*/
private function send(RequestInterface $request): ApiResponse
{
try {
return new ApiResponse($this->client->sendRequest($request));
} catch (ClientExceptionInterface $exception) {
throw new HttpClientException($exception->getMessage(), $exception->getCode());
}
}
/**
* @param string $url
* @param array $data
* @param string|null $idempotencyKey
* @throws HttpClientException
* @return ApiResponse
*/
public function post(string $url, array $data, ?string $idempotencyKey = null): ApiResponse
{
$headers = $this->prepareHeaders($data);
if ($idempotencyKey) {
$headers['Idempotency-Key'] = $idempotencyKey;
}
$request = $this->messageFactory->createRequest(
'POST',
$this->url->withPath($url)
);
foreach ($headers as $name => $value) {
$request = $request->withHeader($name, $value);
}
$request = $request->withBody($this->streamFactory->createStream($this->arrayAsJson($data)));
return $this->send($request);
}
/**
* @param string $url
* @param array $data
* @throws HttpClientException
* @return ApiResponse
*/
public function patch(string $url, array $data): ApiResponse
{
$headers = $this->prepareHeaders($data);
$request = $this->messageFactory->createRequest(
'PATCH',
$this->url->withPath($url)
);
foreach ($headers as $name => $value) {
$request = $request->withHeader($name, $value);
}
$request = $request->withBody($this->streamFactory->createStream($this->arrayAsJson($data)));
return $this->send($request);
}
/**
* @param string $url
* @param string|null $query
* @throws HttpClientException
* @return ApiResponse
*/
public function get(string $url, string $query = null): ApiResponse
{
$request = $this->messageFactory->createRequest(
'GET',
$query ? $this->url->withPath($url)->withQuery($query) : $this->url->withPath($url)
);
foreach ($this->prepareHeaders() as $name => $value) {
$request = $request->withHeader($name, $value);
}
return $this->send($request);
}
/**
* @param array $data
* @return string
*/
private function arrayAsJson(array $data): string
{
return json_encode($data);
}
/**
* @param null|array $data
* @return array
*/
private function prepareHeaders(?array $data = null)
{
$headers = [
'Api-Key' => $this->config->getApiKey(),
'User-Agent' => $this->getUserAgent(),
'Accept' => 'application/json'
];
if ($data) {
$headers['Content-Type'] = 'application/json';
$headers['Signature'] = (string)new SignatureCalculator($this->config->getSignatureKey(), json_encode($data));
}
return $headers;
}
}

View File

@@ -0,0 +1,53 @@
<?php
namespace Paynow\HttpClient;
use Exception;
class HttpClientException extends Exception
{
/** @var string|null */
private $body;
/** @var array */
private $errors;
/** @var int|null */
private $status;
/**
* @param string $message
* @param int|null $status
* @param string|null $body
*/
public function __construct(string $message, ?int $status = null, ?string $body = null)
{
parent::__construct($message);
$this->status = $status;
$this->body = $body;
}
/**
* @return string|null
*/
public function getBody(): ?string
{
return $this->body;
}
/**
* @return int|null
*/
public function getStatus(): ?int
{
return $this->status;
}
/**
* @return array
*/
public function getErrors()
{
return $this->errors;
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace Paynow\HttpClient;
interface HttpClientInterface
{
public function post(string $url, array $data, ?string $idempotencyKey = null): ApiResponse;
public function patch(string $url, array $data): ApiResponse;
public function get(string $url, ?string $query = null): ApiResponse;
}

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,51 @@
<?php
namespace Paynow\Model\DataProcessing;
/**
* Class Notice
*
* @package Paynow\Model\DataProcessing
*/
class Notice
{
/**
* @var string
*/
private $title;
private $content;
private $locale;
public function __construct($title, $content, $locale)
{
$this->title = $title;
$this->content = $content;
$this->locale = $locale;
}
/**
* @return string
*/
public function getTitle(): string
{
return $this->title;
}
/**
* @return mixed
*/
public function getContent()
{
return $this->content;
}
/**
* @return mixed
*/
public function getLocale()
{
return $this->locale;
}
}

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,16 @@
<?php
namespace Paynow\Model\Payment;
class Status
{
public const STATUS_ABANDONED = 'ABANDONED';
public const STATUS_CANCELLED = 'CANCELLED';
public const STATUS_CONFIRMED = 'CONFIRMED';
public const STATUS_ERROR = 'ERROR';
public const STATUS_EXPIRED = 'EXPIRED';
public const STATUS_NEW = 'NEW';
public const STATUS_PENDING = 'PENDING';
public const STATUS_REJECTED = 'REJECTED';
public const STATUS_WAITING_FOR_CONFIRMATION = 'WAITING_FOR_CONFIRMATION';
}

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,9 @@
<?php
namespace Paynow\Model\PaymentMethods;
class AuthorizationType
{
public const CODE = 'CODE';
public const REDIRECT = 'REDIRECT';
}

View File

@@ -0,0 +1,68 @@
<?php
namespace Paynow\Model\PaymentMethods;
class PaymentMethod
{
private $id;
private $type;
private $name;
private $description;
private $image;
private $status;
private $authorizationType;
public function __construct($id, $type, $name, $description, $image, $status, $authorizationType)
{
$this->id = $id;
$this->type = $type;
$this->name = $name;
$this->description = $description;
$this->image = $image;
$this->status = $status;
$this->authorizationType = $authorizationType;
}
public function getId()
{
return $this->id;
}
public function getType()
{
return $this->type;
}
public function getName()
{
return $this->name;
}
public function getDescription()
{
return $this->description;
}
public function getImage()
{
return $this->image;
}
public function getStatus()
{
return $this->status;
}
/**
* @return bool
*/
public function isEnabled(): bool
{
return $this->status == Status::ENABLED;
}
public function getAuthorizationType()
{
return $this->authorizationType;
}
}

View File

@@ -0,0 +1,9 @@
<?php
namespace Paynow\Model\PaymentMethods;
class Status
{
public const DISABLED = 'DISABLED';
public const ENABLED = 'ENABLED';
}

View File

@@ -0,0 +1,11 @@
<?php
namespace Paynow\Model\PaymentMethods;
class Type
{
public const BLIK = 'BLIK';
public const CARD = 'CARD';
public const GOOGLE_PAY = 'GOOGLE_PAY';
public const PBL = 'PBL';
}

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,12 @@
<?php
namespace Paynow\Model\Refund;
class Status
{
public const CANCELLED = 'CANCELLED';
public const FAILED = 'FAILED';
public const NEW = 'NEW';
public const PENDING = 'PENDING';
public const SUCCESSFUL = 'SUCCESSFUL';
}

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,72 @@
<?php
namespace Paynow;
use InvalidArgumentException;
use Paynow\Exception\SignatureVerificationException;
use Paynow\Util\SignatureCalculator;
class Notification
{
/**
* @param $signatureKey
* @param $payload
* @param $headers
* @throws SignatureVerificationException
*/
public function __construct($signatureKey, $payload = null, ?array $headers = null)
{
if (! $payload) {
throw new InvalidArgumentException('No payload has been provided');
}
if (! $headers) {
throw new InvalidArgumentException('No headers have been provided');
}
$this->verify($signatureKey, $payload, $headers);
}
/**
* Verify payload Signature
*
* @param string $signatureKey
* @param string $data
* @param array $headers
* @throws SignatureVerificationException
* @return bool
*/
private function verify(string $signatureKey, string $data, array $headers)
{
$calculatedSignature = (string)new SignatureCalculator($signatureKey, $data);
if ($calculatedSignature !== $this->getPayloadSignature($headers)) {
throw new SignatureVerificationException('Signature mismatched for payload');
}
return true;
}
/**
* Retrieve Signature from payload
*
* @param array $headers
* @throws SignatureVerificationException
* @return string
*/
private function getPayloadSignature(array $headers)
{
if (isset($headers['Signature']) && $headers['Signature']) {
$signature = $headers['Signature'];
}
if (isset($headers['signature']) && $headers['signature']) {
$signature = $headers['signature'];
}
if (empty($signature)) {
throw new SignatureVerificationException('No signature was found for payload');
}
return $signature;
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace Paynow\Response\DataProcessing;
use Paynow\Model\DataProcessing\Notice;
class Notices
{
/**
* @var Notice[]
*/
private $list;
public function __construct($body)
{
if (! empty($body)) {
foreach ($body as $item) {
$this->list[] = new Notice(
$item->title,
$item->content,
$item->locale
);
}
}
}
/**
* @return array|Notice[]
*/
public function getAll()
{
return $this->list;
}
}

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,44 @@
<?php
namespace Paynow\Response\Payment;
use Paynow\Model\Payment\Status;
class Authorize
{
/** @var string */
private $paymentId;
/** @var Status|string */
private $status;
/** @var null|string */
private $redirectUrl;
public function __construct($paymentId, $status, ?string $redirectUrl = null)
{
$this->paymentId = $paymentId;
$this->status = $status;
$this->redirectUrl = $redirectUrl;
}
/**
* @return string|null
*/
public function getRedirectUrl(): ?string
{
return $this->redirectUrl;
}
/** @return string */
public function getPaymentId(): string
{
return $this->paymentId;
}
/** @return string */
public function getStatus(): string
{
return $this->status;
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace Paynow\Response\Payment;
class Status
{
/** @var string */
private $paymentId;
/** @var string */
private $status;
public function __construct($paymentId, $status)
{
$this->paymentId = $paymentId;
$this->status = $status;
}
/** @return string */
public function getPaymentId(): string
{
return $this->paymentId;
}
/** @return string */
public function getStatus(): string
{
return $this->status;
}
}

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,121 @@
<?php
namespace Paynow\Response\PaymentMethods;
use Paynow\Model\PaymentMethods\PaymentMethod;
use Paynow\Model\PaymentMethods\Type;
class PaymentMethods
{
/**
* @var PaymentMethod[]
*/
private $list;
public function __construct($body)
{
if (! empty($body)) {
foreach ($body as $group) {
if (! empty($group->paymentMethods)) {
foreach ($group->paymentMethods as $item) {
$this->list[] = new PaymentMethod(
$item->id,
$group->type,
$item->name,
$item->description,
$item->image,
$item->status,
$item->authorizationType ?? null
);
}
}
}
}
}
/**
* Retrieve all available payment methods
*
* @return PaymentMethod[]
*/
public function getAll()
{
return $this->list;
}
/**
* Retrieve only Blik payment methods
*
* @return PaymentMethod[]
*/
public function getOnlyBlik()
{
$blikPaymentMethods = [];
if (! empty($this->list)) {
foreach ($this->list as $item) {
if (Type::BLIK === $item->getType()) {
$blikPaymentMethods[] = $item;
}
}
}
return $blikPaymentMethods;
}
/**
* Retrieve only Card payment methods
*
* @return PaymentMethod[]
*/
public function getOnlyCards()
{
$cardPaymentMethods = [];
if (! empty($this->list)) {
foreach ($this->list as $item) {
if (Type::CARD === $item->getType()) {
$cardPaymentMethods[] = $item;
}
}
}
return $cardPaymentMethods;
}
/**
* Retrieve only GooglePay payment method
*
* @return PaymentMethod[]
*/
public function getOnlyGooglePay()
{
$cardPaymentMethods = [];
if (! empty($this->list)) {
foreach ($this->list as $item) {
if (Type::GOOGLE_PAY === $item->getType()) {
$cardPaymentMethods[] = $item;
}
}
}
return $cardPaymentMethods;
}
/**
* Retrieve only Pbl payment methods
*
* @return PaymentMethod[]
*/
public function getOnlyPbls()
{
$pblPaymentMethods = [];
if (! empty($this->list)) {
foreach ($this->list as $item) {
if (Type::PBL === $item->getType()) {
$pblPaymentMethods[] = $item;
}
}
}
return $pblPaymentMethods;
}
}

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,30 @@
<?php
namespace Paynow\Response\Refund;
class Status
{
/** @var string */
private $refundId;
/** @var string|Status */
private $status;
public function __construct($refundId, $status)
{
$this->refundId = $refundId;
$this->status = $status;
}
/** @return string */
public function getRefundId(): string
{
return $this->refundId;
}
/** @return string */
public function getStatus(): string
{
return $this->status;
}
}

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,46 @@
<?php
namespace Paynow\Service;
use Paynow\Configuration;
use Paynow\Exception\PaynowException;
use Paynow\HttpClient\HttpClientException;
use Paynow\Response\DataProcessing\Notices;
class DataProcessing extends Service
{
/**
* Retrieve data processing notice
*
* @param string|null $locale
*
* @throws PaynowException
* @return Notices
*/
public function getNotices(?string $locale): Notices
{
$parameters = [];
if (! empty($locale)) {
$parameters['locale'] = $locale;
}
try {
$decodedApiResponse = $this->getClient()
->getHttpClient()
->get(
Configuration::API_VERSION . "/payments/dataprocessing/notices",
http_build_query($parameters, '', '&')
)
->decode();
return new Notices($decodedApiResponse);
} catch (HttpClientException $exception) {
throw new PaynowException(
$exception->getMessage(),
$exception->getStatus(),
$exception->getBody(),
$exception
);
}
}
}

View File

@@ -0,0 +1,113 @@
<?php
namespace Paynow\Service;
use Paynow\Configuration;
use Paynow\Exception\PaynowException;
use Paynow\HttpClient\HttpClientException;
use Paynow\Response\Payment\Authorize;
use Paynow\Response\Payment\Status;
use Paynow\Response\PaymentMethods\PaymentMethods;
class Payment extends Service
{
/**
* Authorize payment
*
* @param array $data
* @param string|null $idempotencyKey
* @throws PaynowException
* @return Authorize
*/
public function authorize(array $data, ?string $idempotencyKey = null): Authorize
{
try {
$decodedApiResponse = $this->getClient()
->getHttpClient()
->post(
'/' . Configuration::API_VERSION . '/payments',
$data,
$idempotencyKey ?? $data['externalId']
)
->decode();
return new Authorize(
$decodedApiResponse->paymentId,
$decodedApiResponse->status,
! empty($decodedApiResponse->redirectUrl) ? $decodedApiResponse->redirectUrl : null
);
} catch (HttpClientException $exception) {
throw new PaynowException(
$exception->getMessage(),
$exception->getStatus(),
$exception->getBody(),
$exception
);
}
}
/**
* Retrieve available payment methods
*
* @param string|null $currency
* @param int|null $amount
*
* @throws PaynowException
* @return PaymentMethods
*/
public function getPaymentMethods(?string $currency = null, ?int $amount = 0): PaymentMethods
{
$parameters = [];
if (! empty($currency)) {
$parameters['currency'] = $currency;
}
if ($amount > 0) {
$parameters['amount'] = $amount;
}
try {
$decodedApiResponse = $this->getClient()
->getHttpClient()
->get(
Configuration::API_VERSION_V2 . '/payments/paymentmethods',
http_build_query($parameters, '', '&')
)
->decode();
return new PaymentMethods($decodedApiResponse);
} catch (HttpClientException $exception) {
throw new PaynowException(
$exception->getMessage(),
$exception->getStatus(),
$exception->getBody(),
$exception
);
}
}
/**
* Retrieve payment status
*
* @param string $paymentId
* @throws PaynowException
* @return Status
*/
public function status(string $paymentId): Status
{
try {
$decodedApiResponse = $this->getClient()
->getHttpClient()
->get(Configuration::API_VERSION . "/payments/$paymentId/status")
->decode();
return new Status($decodedApiResponse->paymentId, $decodedApiResponse->status);
} catch (HttpClientException $exception) {
throw new PaynowException(
$exception->getMessage(),
$exception->getStatus(),
$exception->getBody(),
$exception
);
}
}
}

View File

@@ -0,0 +1,71 @@
<?php
namespace Paynow\Service;
use Paynow\Configuration;
use Paynow\Exception\PaynowException;
use Paynow\HttpClient\HttpClientException;
use Paynow\Response\Refund\Status;
class Refund extends Service
{
/**
* Refund payment
*
* @param string $paymentId
* @param string $idempotencyKey
* @param int $amount
* @param null $reason
* @throws PaynowException
* @return Status
*/
public function create(string $paymentId, string $idempotencyKey, int $amount, $reason = null): Status
{
try {
$decodedApiResponse = $this->getClient()
->getHttpClient()
->post(
'/' . Configuration::API_VERSION . '/payments/' . $paymentId . '/refunds',
[
'amount' => $amount,
'reason' => $reason
],
$idempotencyKey
)
->decode();
return new Status($decodedApiResponse->refundId, $decodedApiResponse->status);
} catch (HttpClientException $exception) {
throw new PaynowException(
$exception->getMessage(),
$exception->getStatus(),
$exception->getBody(),
$exception
);
}
}
/**
* Retrieve refund status
* @param $refundId
* @throws PaynowException
* @return Status
*/
public function status($refundId): Status
{
try {
$decodedApiResponse = $this->getClient()
->getHttpClient()
->get(Configuration::API_VERSION . "/refunds/$refundId/status")
->decode();
return new Status($decodedApiResponse->refundId, $decodedApiResponse->status);
} catch (HttpClientException $exception) {
throw new PaynowException(
$exception->getMessage(),
$exception->getStatus(),
$exception->getBody(),
$exception
);
}
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace Paynow\Service;
use Paynow\Client;
use Paynow\Environment;
use Paynow\Exception\ConfigurationException;
class Service
{
/**
* @var Client
*/
private $client;
/**
* @param Client $client
* @throws ConfigurationException
*/
public function __construct(Client $client)
{
if (! $client->getConfiguration()->getEnvironment()) {
$message = 'Provide correct environment, use '.Environment::PRODUCTION.' or '.Environment::SANDBOX;
throw new ConfigurationException($message);
}
if (! $client->getConfiguration()->getApiKey()) {
throw new ConfigurationException('You did not provide Api Key');
}
if (! $client->getConfiguration()->getSignatureKey()) {
throw new ConfigurationException('You did not provide Signature Key');
}
$this->client = $client;
}
/**
* @return Client
*/
public function getClient(): Client
{
return $this->client;
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace Paynow\Service;
use Paynow\Configuration;
use Paynow\Exception\PaynowException;
use Paynow\HttpClient\ApiResponse;
use Paynow\HttpClient\HttpClientException;
class ShopConfiguration extends Service
{
/**
* @param string $continueUrl
* @param string $notificationUrl
* @throws PaynowException
* @return ApiResponse
*/
public function changeUrls(string $continueUrl, string $notificationUrl)
{
$data = [
'continueUrl' => $continueUrl,
'notificationUrl' => $notificationUrl,
];
try {
return $this->getClient()
->getHttpClient()
->patch(
'/' . Configuration::API_VERSION.'/configuration/shop/urls',
$data
);
} catch (HttpClientException $exception) {
throw new PaynowException(
$exception->getMessage(),
$exception->getStatus(),
$exception->getBody(),
$exception
);
}
}
}

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,44 @@
<?php
namespace Paynow\Util;
use InvalidArgumentException;
class SignatureCalculator
{
/** @var string */
protected $hash;
/**
* @param string $signatureKey
* @param string $data
* @throws InvalidArgumentException
*/
public function __construct(string $signatureKey, string $data)
{
if (empty($signatureKey)) {
throw new InvalidArgumentException('You did not provide a Signature key');
}
if (empty($data)) {
throw new InvalidArgumentException('You did not provide any data');
}
$this->hash = base64_encode(hash_hmac('sha256', $data, $signatureKey, true));
}
/**
* @return string
*/
public function __toString(): string
{
return (string) $this->getHash();
}
/**
* @return string
*/
public function getHash(): string
{
return $this->hash;
}
}

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,81 @@
<?php
namespace Paynow\Tests;
use InvalidArgumentException;
use Paynow\Exception\SignatureVerificationException;
use Paynow\Notification;
class NotificationTest extends TestCase
{
/**
* @dataProvider requestsToTest
* @param $payload
* @param $headers
* @throws SignatureVerificationException
*/
public function testVerifyPayloadSuccessfully($payload, $headers)
{
// given
// when
new Notification('s3ecret-k3y', $payload, $headers);
// then
$this->assertTrue(true);
}
public function requestsToTest()
{
$payload = $this->loadData('notification.json', true);
return [
[
$payload,
['Signature' => 'Aq/VmN15rtjVbuy9F7Yw+Ym76H+VZjVSuHGpg4dwitY=']
],
[
$payload,
['signature' => 'Aq/VmN15rtjVbuy9F7Yw+Ym76H+VZjVSuHGpg4dwitY=']
]
];
}
public function testShouldThrowExceptionOnIncorrectSignature()
{
// given
$this->expectException(SignatureVerificationException::class);
$payload = $this->loadData('notification.json', true);
$headers = ['Signature' => 'Wq/V2N15rtjVbuy9F7Yw+Ym76H+VZjVSuHGpg4dwitY='];
// when
new Notification('s3ecret-k3y', $payload, $headers);
// then
}
public function testShouldThrowExceptionOnMissingPayload()
{
// given
$this->expectException(InvalidArgumentException::class);
$payload = null;
$headers = [];
// when
new Notification('s3ecret-k3y', null, null);
// then
}
public function testShouldThrowExceptionOnMissingPayloadHeaders()
{
// given
$this->expectException(InvalidArgumentException::class);
$payload = $this->loadData('notification.json', true);
$headers = null;
// when
new Notification('s3ecret-k3y', $payload, null);
// then
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Paynow\Tests\Service;
use Paynow\Service\DataProcessing;
use Paynow\Tests\TestCase;
class DataProcessingTest extends TestCase
{
public function testShouldRetrieveAllNoticeListSuccessfully()
{
// given
$this->testHttpClient->mockResponse('data_processing_notices_success.json', 200);
$this->client->setHttpClient($this->testHttpClient);
$dataProcessing = new DataProcessing($this->client);
// when
$notices = $dataProcessing->getNotices('pl-PL')->getAll();
// then
$this->assertNotEmpty($notices);
}
}

View File

@@ -0,0 +1,128 @@
<?php
namespace Paynow\Tests\Service;
use Paynow\Model\PaymentMethods\AuthorizationType;
use Paynow\Model\PaymentMethods\Status;
use Paynow\Model\PaymentMethods\Type;
use Paynow\Service\Payment;
use Paynow\Tests\TestCase;
class PaymentMethodsTest extends TestCase
{
public function testShouldRetrieveAllPaymentMethodsListSuccessfully()
{
// given
$this->testHttpClient->mockResponse('payment_methods_success.json', 200);
$this->client->setHttpClient($this->testHttpClient);
$paymentService = new Payment($this->client);
// when
$paymentMethods = $paymentService->getPaymentMethods('PLN', 1000)->getAll();
// then
$this->assertNotEmpty($paymentMethods);
$this->assertEquals('2007', $paymentMethods[0]->getId());
$this->assertEquals('BLIK', $paymentMethods[0]->getName());
$this->assertEquals('https://static.sandbox.paynow.pl/payment-method-icons/2007.png', $paymentMethods[0]->getImage());
$this->assertEquals('Płacę z Blikiem', $paymentMethods[0]->getDescription());
$this->assertEquals(Type::BLIK, $paymentMethods[0]->getType());
$this->assertEquals(Status::ENABLED, $paymentMethods[0]->getStatus());
$this->assertTrue($paymentMethods[0]->isEnabled());
}
public function testShouldRetrieveAllPaymentMethodsListSuccessfullyForWhiteLabel()
{
// given
$this->testHttpClient->mockResponse('payment_methods_white_label_success.json', 200);
$this->client->setHttpClient($this->testHttpClient);
$paymentService = new Payment($this->client);
// when
$paymentMethods = $paymentService->getPaymentMethods('PLN', 1000, true)->getAll();
// then
$this->assertNotEmpty($paymentMethods);
$this->assertEquals('2007', $paymentMethods[0]->getId());
$this->assertEquals('BLIK', $paymentMethods[0]->getName());
$this->assertEquals('https://static.sandbox.paynow.pl/payment-method-icons/2007.png', $paymentMethods[0]->getImage());
$this->assertEquals(Status::ENABLED, $paymentMethods[0]->getStatus());
$this->assertEquals('Płacę z Blikiem', $paymentMethods[0]->getDescription());
$this->assertEquals(Type::BLIK, $paymentMethods[0]->getType());
$this->assertEquals(Status::ENABLED, $paymentMethods[0]->getStatus());
$this->assertEquals(AuthorizationType::CODE, $paymentMethods[0]->getAuthorizationType());
$this->assertTrue($paymentMethods[0]->isEnabled());
}
public function testShouldRetrieveOnlyBlikPaymentMethodsListSuccessfully()
{
// given
$this->testHttpClient->mockResponse('payment_methods_success.json', 200);
$this->client->setHttpClient($this->testHttpClient);
$paymentService = new Payment($this->client);
// when
$blikPaymentMethods = $paymentService->getPaymentMethods("PLN")->getOnlyBlik();
// then
$this->assertNotEmpty($blikPaymentMethods);
$this->assertEquals(1, sizeof($blikPaymentMethods));
$this->assertEquals('BLIK', $blikPaymentMethods[0]->getName());
$this->assertEquals(Type::BLIK, $blikPaymentMethods[0]->getType());
$this->assertTrue($blikPaymentMethods[0]->isEnabled());
}
public function testShouldRetrieveOnlyCardPaymentMethodsListSuccessfully()
{
// given
$this->testHttpClient->mockResponse('payment_methods_success.json', 200);
$this->client->setHttpClient($this->testHttpClient);
$paymentService = new Payment($this->client);
// when
$cardPaymentMethods = $paymentService->getPaymentMethods()->getOnlyCards();
// then
$this->assertNotEmpty($cardPaymentMethods);
$this->assertEquals(1, sizeof($cardPaymentMethods));
$this->assertEquals('Karta płatnicza', $cardPaymentMethods[0]->getName());
$this->assertEquals(Type::CARD, $cardPaymentMethods[0]->getType());
$this->assertTrue($cardPaymentMethods[0]->isEnabled());
}
public function testShouldRetrieveOnlyGooglePayPaymentMethodsListSuccessfully()
{
// given
$this->testHttpClient->mockResponse('payment_methods_success.json', 200);
$this->client->setHttpClient($this->testHttpClient);
$paymentService = new Payment($this->client);
// when
$cardPaymentMethods = $paymentService->getPaymentMethods()->getOnlyGooglePay();
// then
$this->assertNotEmpty($cardPaymentMethods);
$this->assertEquals(1, sizeof($cardPaymentMethods));
$this->assertEquals('Google Pay', $cardPaymentMethods[0]->getName());
$this->assertEquals(Type::GOOGLE_PAY, $cardPaymentMethods[0]->getType());
$this->assertTrue($cardPaymentMethods[0]->isEnabled());
}
public function testShouldRetrieveOnlyPblPaymentMethodsListSuccessfully()
{
// given
$this->testHttpClient->mockResponse('payment_methods_success.json', 200);
$this->client->setHttpClient($this->testHttpClient);
$paymentService = new Payment($this->client);
// when
$pblPaymentMethods = $paymentService->getPaymentMethods()->getOnlyPbls();
// then
$this->assertNotEmpty($pblPaymentMethods);
$this->assertEquals(3, sizeof($pblPaymentMethods));
$this->assertEquals('mTransfer', $pblPaymentMethods[0]->getName());
$this->assertEquals(Type::PBL, $pblPaymentMethods[0]->getType());
$this->assertTrue($pblPaymentMethods[0]->isEnabled());
}
}

View File

@@ -0,0 +1,88 @@
<?php
namespace Paynow\Tests\Service;
use Paynow\Exception\PaynowException;
use Paynow\Service\Payment;
use Paynow\Tests\TestCase;
class PaymentTest extends TestCase
{
public function testShouldAuthorizePaymentSuccessfully()
{
// given
$this->testHttpClient->mockResponse('payment_success.json', 200);
$this->client->setHttpClient($this->testHttpClient);
$paymentService = new Payment($this->client);
$paymentData = $this->loadData('payment_request.json');
// when
$response = $paymentService->authorize($paymentData, 'idempotencyKey123');
// then
$this->assertNotEmpty($response->getRedirectUrl());
$this->assertNotEmpty($response->getPaymentId());
$this->assertNotEmpty($response->getStatus());
}
public function testShouldNotAuthorizePaymentSuccessfully()
{
// given
$this->testHttpClient->mockResponse('payment_failed.json', 400);
$this->client->setHttpClient($this->testHttpClient);
$paymentData = $this->loadData('payment_request.json');
$paymentService = new Payment($this->client);
// when
try {
$response = $paymentService->authorize($paymentData, 'idempotencyKey123');
} catch (PaynowException $exception) {
// then
$this->assertEquals(400, $exception->getCode());
$this->assertEquals('VALIDATION_ERROR', $exception->getErrors()[0]->getType());
$this->assertEquals(
'currency: invalid field value (EUR)',
$exception->getErrors()[0]->getMessage()
);
}
}
public function testShouldRetrievePaymentStatusSuccessfully()
{
// given
$this->testHttpClient->mockResponse('payment_status_success.json', 200);
$this->client->setHttpClient($this->testHttpClient);
$paymentService = new Payment($this->client);
$paymentId = 'PBYV-3AZ-UPW-DPC';
// when
$response = $paymentService->status($paymentId);
// then
$this->assertEquals($paymentId, $response->getPaymentId());
$this->assertEquals('NEW', $response->getStatus());
}
public function testShouldNotRetrievePaymentStatusSuccesfully()
{
// given
$this->testHttpClient->mockResponse('payment_status_not_found.json', 404);
$this->client->setHttpClient($this->testHttpClient);
$paymentService = new Payment($this->client);
$paymentId = 'PBYV-3AZ-UPW-DPC';
// when
try {
$response = $paymentService->status($paymentId);
} catch (PaynowException $exception) {
// then
$this->assertEquals(404, $exception->getCode());
$this->assertEquals('NOT_FOUND', $exception->getErrors()[0]->getType());
$this->assertEquals(
'Could not find status for payment {paymentId=PBYV-3AZ-UPW-DPC}',
$exception->getErrors()[0]->getMessage()
);
}
}
}

View File

@@ -0,0 +1,84 @@
<?php
namespace Paynow\Tests\Service;
use Paynow\Exception\PaynowException;
use Paynow\Service\Refund;
use Paynow\Tests\TestCase;
class RefundTest extends TestCase
{
public function testShouldRefundPaymentSuccessfully()
{
// given
$this->testHttpClient->mockResponse('refund_success.json', 200);
$this->client->setHttpClient($this->testHttpClient);
$refundService = new Refund($this->client);
// when
$response = $refundService->create('NOR3-FUN-D4U-LOL', 'idempotencyKey123', 100, null);
// then
$this->assertNotEmpty($response->getRefundId());
$this->assertNotEmpty($response->getStatus());
}
public function testShouldNotAuthorizePaymentSuccessfully()
{
// given
$this->testHttpClient->mockResponse('refund_failed.json', 400);
$this->client->setHttpClient($this->testHttpClient);
$refundService = new Refund($this->client);
// when
try {
$response = $refundService->create('NOR3-FUN-D4U-LOL', 'idempotencyKey123', 100, null);
} catch (PaynowException $exception) {
// then
$this->assertEquals(400, $exception->getCode());
$this->assertEquals('INSUFFICIENT_BALANCE_FUNDS', $exception->getErrors()[0]->getType());
$this->assertEquals(
'Insufficient funds on balance',
$exception->getErrors()[0]->getMessage()
);
}
}
public function testShouldRetrieveRefundStatusSuccessfully()
{
// given
$this->testHttpClient->mockResponse('refund_status_success.json', 200);
$this->client->setHttpClient($this->testHttpClient);
$refundService = new Refund($this->client);
$refundId = 'R3FU-UND-D8K-WZD';
// when
$response = $refundService->status($refundId);
// then
$this->assertEquals($refundId, $response->getRefundId());
$this->assertEquals('NEW', $response->getStatus());
}
public function testShouldNotRetrievePaymentStatusSuccesfully()
{
// given
$this->testHttpClient->mockResponse('refund_status_not_found.json', 404);
$this->client->setHttpClient($this->testHttpClient);
$refundService = new Refund($this->client);
$refundId = 'R3FU-UND-D8K-WZD';
// when
try {
$response = $refundService->status($refundId);
} catch (PaynowException $exception) {
// then
$this->assertEquals(404, $exception->getCode());
$this->assertEquals('NOT_FOUND', $exception->getErrors()[0]->getType());
$this->assertEquals(
'Could not find status for refund {refundId=R3FU-UND-D8K-WZD}',
$exception->getErrors()[0]->getMessage()
);
}
}
}

View File

@@ -0,0 +1,47 @@
<?php
namespace Paynow\Tests\Service;
use Paynow\Exception\PaynowException;
use Paynow\Service\ShopConfiguration;
use Paynow\Tests\TestCase;
class ShopConfigurationTest extends TestCase
{
private $continueUrl = 'http://shopdomain.com/return';
private $notificationUrl = 'http://shopdomain.com/notifications';
public function testShouldUpdateShopConfigurationSuccessfully()
{
// given
$this->testHttpClient->mockResponse(null, 204);
$this->client->setHttpClient($this->testHttpClient);
$shopConfigurationService = new ShopConfiguration($this->client);
// when
$response = $shopConfigurationService->changeUrls($this->continueUrl, $this->notificationUrl);
// then
$this->assertEquals(204, $response->status);
}
public function testShouldNotUpdateShopConfigurationSuccessfully()
{
// given
$this->testHttpClient->mockResponse('shop_configuration_urls_failed.json', 400);
$this->client->setHttpClient($this->testHttpClient);
$shopConfigurationService = new ShopConfiguration($this->client);
// when
try {
$response = $shopConfigurationService->changeUrls($this->continueUrl, $this->notificationUrl);
} catch (PaynowException $exception) {
// then
$this->assertEquals(400, $exception->getCode());
$this->assertEquals('VALIDATION_ERROR', $exception->getErrors()[0]->getType());
$this->assertEquals(
'continue_url: invalid field value',
$exception->getErrors()[0]->getMessage()
);
}
}
}

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,36 @@
<?php
namespace Paynow\Tests;
use Paynow\Client;
use Paynow\Environment;
use PHPUnit\Framework\TestCase as BaseTestCase;
class TestCase extends BaseTestCase
{
protected $testHttpClient;
protected $client;
public function __construct($name = null, array $data = [], $dataName = '')
{
$this->client = new Client(
'TestApiKey',
'TestSignatureKey',
Environment::SANDBOX,
'PHPUnitTests'
);
$this->testHttpClient = new TestHttpClient($this->client->getConfiguration());
parent::__construct($name, $data, $dataName);
}
public function loadData($fileName, $asString = false)
{
$filePath = dirname(__FILE__).'/resources/'.$fileName;
if (! $asString) {
return json_decode(file_get_contents($filePath), true);
} else {
return file_get_contents($filePath);
}
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace Paynow\Tests;
use GuzzleHttp\Psr7\Response;
use Http\Mock\Client;
use Paynow\HttpClient\HttpClient;
class TestHttpClient extends HttpClient
{
public function mockResponse($responseFile, $httpStatus)
{
$this->client = new Client();
$content = null;
if (null != $responseFile) {
$filePath = dirname(__FILE__).'/resources/'.$responseFile;
$content = file_get_contents($filePath, true);
}
$response = new Response($httpStatus, ['Content-Type' => 'application/json'], $content);
$this->client->addResponse($response);
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace Paynow\Tests\Util;
use InvalidArgumentException;
use Paynow\Tests\TestCase;
use Paynow\Util\SignatureCalculator;
class SignatureCalculatorTest extends TestCase
{
public function testNotValidSuccessfully()
{
// given + when
$signatureCalculator = new SignatureCalculator('InvalidSecretKey', json_encode(['key' => 'value']));
// then
$this->assertNotEquals('hash', $signatureCalculator->getHash());
}
public function testShouldValidSuccessfully()
{
// given + when
$signatureCalculator = new SignatureCalculator(
'a621a1fb-b4d8-48ba-a6a3-2a28ed61f605',
json_encode([
'key1' => 'value1',
'key2' => 'value2',
])
);
// then
$this->assertEquals('rFAkhfbUFRn4bTR82qb742Mwy34g/CSi8frEHciZhCU=', $signatureCalculator->getHash());
}
public function testExceptionForEmptyData()
{
// given
$this->expectException(InvalidArgumentException::class);
// when
$signatureCalculator = new SignatureCalculator('a621a1fb-b4d8-48ba-a6a3-2a28ed61f605', "");
// then
}
}

View File

@@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@@ -0,0 +1,5 @@
<?php
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/TestCase.php';
require_once __DIR__.'/TestHttpClient.php';

Some files were not shown because too many files have changed in this diff Show More