diff --git a/paynlpaymentmethods/paynlpaymentmethods.php b/paynlpaymentmethods/paynlpaymentmethods.php index 5648ab0..e703db3 100644 --- a/paynlpaymentmethods/paynlpaymentmethods.php +++ b/paynlpaymentmethods/paynlpaymentmethods.php @@ -917,7 +917,7 @@ public function processPayment($transactionId, &$message = null) */ public function getTransaction($transactionId) { - PayHelper::sdkLogin(); + PayHelper::sdkLogin(true); return \Paynl\Transaction::status($transactionId); } @@ -953,7 +953,7 @@ public function payLog($method, $message, $cartid = null, $transactionId = null) */ public function startPayment(Cart $cart, $payment_option_id, $extra_data = array()) { - PayHelper::sdkLogin(); + PayHelper::sdkLogin(true); $currency = new Currency($cart->id_currency); /** @var CurrencyCore $currency */ @@ -1385,6 +1385,22 @@ public function getLanguages() ); } + /** + * @return array + */ + public function getGateways() + { + $cores = \Paynl\Config::getCores(); + $cores_array = array_merge($cores, ['custom' => $this->l('Custom')]); + + $arrResult = []; + foreach ($cores_array as $value => $label) { + $arrResult[] = ['failover_gateway_id' => $value, 'label' => $label]; + } + + return $arrResult; + } + /** * @param integer $payment_option_id * @param object $objPaymentMethod @@ -1438,14 +1454,9 @@ public function getContent() $this->adminDisplayWarning($this->l('Cannot find PAY. SDK, did you install the source code instead of the package?')); return false; } - try { - $loggedin = PayHelper::isLoggedIn()['status']; - } catch (\Exception $e) { - } + $this->_html .= $this->renderAccountSettingsForm(); - if ($loggedin) { - $this->_html .= $this->renderPaymentMethodsForm(); - } + $this->_html .= $this->renderPaymentMethodsForm(); $this->_html .= $this->renderFeatureRequest(); return $this->_html; @@ -1458,12 +1469,10 @@ protected function _postValidation() // phpcs:ignore { if (Tools::isSubmit('btnSubmit')) { if (!Tools::getValue('PAYNL_API_TOKEN') && empty(Configuration::get('PAYNL_API_TOKEN'))) { - $this->_postErrors[] = $this->l('APItoken is required'); + $this->_postErrors[] = $this->l('API token is required'); } elseif (!Tools::getValue('PAYNL_SERVICE_ID')) { - $this->_postErrors[] = $this->l('ServiceId is required'); + $this->_postErrors[] = $this->l('Sales location code is required'); } - - } } @@ -1479,6 +1488,7 @@ protected function _postProcess() // phpcs:ignore Configuration::updateValue('PAYNL_SERVICE_ID', Tools::getValue('PAYNL_SERVICE_ID')); Configuration::updateValue('PAYNL_TEST_MODE', Tools::getValue('PAYNL_TEST_MODE')); Configuration::updateValue('PAYNL_FAILOVER_GATEWAY', Tools::getValue('PAYNL_FAILOVER_GATEWAY')); + Configuration::updateValue('PAYNL_CUSTOM_FAILOVER_GATEWAY', Tools::getValue('PAYNL_CUSTOM_FAILOVER_GATEWAY')); Configuration::updateValue('PAYNL_EXCHANGE_URL', Tools::getValue('PAYNL_EXCHANGE_URL')); Configuration::updateValue('PAYNL_VALIDATION_DELAY', Tools::getValue('PAYNL_VALIDATION_DELAY')); Configuration::updateValue('PAYNL_PAYLOGGER', Tools::getValue('PAYNL_PAYLOGGER')); @@ -1505,7 +1515,7 @@ public function renderAccountSettingsForm() $statusHTML = '' . $this->l('Pay. successfully connected') . ''; } elseif (!empty($status['error'])) { if ($status['error'] == 'Could not authorize') { - $statusHTML = '' . sprintf($this->l('We are experiencing technical issues. Please check %s for the latest updates.'), 'status.pay.nl') . '
' . $this->l('You can set your failover gateway in the \'Failover gateway\' input field.') . '
'; // phpcs:ignore + $statusHTML = '' . sprintf($this->l('We are experiencing technical issues. Please check %s for the latest updates.'), 'status.pay.nl') . '
' . $this->l('You can set your core in the \'Custom core\' input field.') . '
'; // phpcs:ignore } else { $statusHTML = '' . $this->l('Pay. connection failed') . ' (' . $status['error'] . ')' . ''; } @@ -1553,10 +1563,21 @@ public function renderAccountSettingsForm() 'required' => false ), array( - 'type' => 'text', - 'label' => $this->l('Failover gateway'), + 'type' => 'select', + 'label' => $this->l('Multicore'), 'name' => 'PAYNL_FAILOVER_GATEWAY', - 'desc' => $this->l('Leave this empty unless we at PAY. advice you to fill this in with a gateway we give to you'), + 'desc' => $this->l('Select the core to be used for processing payments'), + 'options' => array( + 'query' => $this->getGateways(), + 'id' => 'failover_gateway_id', + 'name' => 'label' + ) + ), + array( + 'type' => 'text', + 'label' => $this->l('Custom multicore'), + 'name' => 'PAYNL_CUSTOM_FAILOVER_GATEWAY', + 'desc' => $this->l('Leave this empty unless Pay. advised otherwise'), 'required' => false ), array( @@ -1785,6 +1806,7 @@ public function getConfigFieldsValues() 'PAYNL_SERVICE_ID' => Tools::getValue('PAYNL_SERVICE_ID', Configuration::get('PAYNL_SERVICE_ID')), 'PAYNL_TEST_MODE' => Tools::getValue('PAYNL_TEST_MODE', Configuration::get('PAYNL_TEST_MODE')), 'PAYNL_FAILOVER_GATEWAY' => Tools::getValue('PAYNL_FAILOVER_GATEWAY', Configuration::get('PAYNL_FAILOVER_GATEWAY')), + 'PAYNL_CUSTOM_FAILOVER_GATEWAY' => Tools::getValue('PAYNL_CUSTOM_FAILOVER_GATEWAY', Configuration::get('PAYNL_CUSTOM_FAILOVER_GATEWAY')), 'PAYNL_EXCHANGE_URL' => Tools::getValue('PAYNL_EXCHANGE_URL', Configuration::get('PAYNL_EXCHANGE_URL')), 'PAYNL_VALIDATION_DELAY' => Tools::getValue('PAYNL_VALIDATION_DELAY', Configuration::get('PAYNL_VALIDATION_DELAY')), 'PAYNL_PAYLOGGER' => $logging, @@ -1808,119 +1830,120 @@ private function getPaymentMethodsCombined() $resultArray = array(); $savedPaymentMethods = json_decode(Configuration::get('PAYNL_PAYMENTMETHODS')); try { - if (!empty(Configuration::get('PAYNL_FAILOVER_GATEWAY'))) { + if (Configuration::get('PAYNL_FAILOVER_GATEWAY') !== 'https://rest-api.pay.nl') { $resultArray = $savedPaymentMethods; } else { PayHelper::sdkLogin(); $paymentmethods = \Paynl\Paymentmethods::getList(); $paymentmethods = (array)$paymentmethods; $languages = Language::getLanguages(true); - foreach ($savedPaymentMethods as $paymentmethod) { - if (isset($paymentmethods[$paymentmethod->id])) { - # The paymentmethod allready exists in the config. Check if fields are set.. - $extMethod = $paymentmethods[$paymentmethod->id]; - if (!isset($paymentmethod->min_amount)) { - $paymentmethod->min_amount = isset($extMethod['min_amount']) ? intval($extMethod['min_amount'] / 100) : 0; - $changed = true; - } - - if (!isset($paymentmethod->max_amount)) { - $paymentmethod->max_amount = isset($extMethod['max_amount']) ? intval($extMethod['max_amount'] / 100) : 0; - $changed = true; - } - - if (!isset($paymentmethod->description)) { - $paymentmethod->description = isset($extMethod['brand']['public_description']) ? $extMethod['brand']['public_description'] : ''; - $changed = true; - } - - if (!isset($paymentmethod->brand_id)) { - $paymentmethod->brand_id = isset($extMethod['brand']['id']) ? $extMethod['brand']['id'] : ''; - $changed = true; - } + if(is_array($savedPaymentMethods)) { + foreach ($savedPaymentMethods as $paymentmethod) { + if (isset($paymentmethods[$paymentmethod->id])) { + # The paymentmethod allready exists in the config. Check if fields are set.. + $extMethod = $paymentmethods[$paymentmethod->id]; + if (!isset($paymentmethod->min_amount)) { + $paymentmethod->min_amount = isset($extMethod['min_amount']) ? intval($extMethod['min_amount'] / 100) : 0; + $changed = true; + } - if (!isset($paymentmethod->limit_countries)) { - $paymentmethod->limit_countries = false; - $changed = true; - } + if (!isset($paymentmethod->max_amount)) { + $paymentmethod->max_amount = isset($extMethod['max_amount']) ? intval($extMethod['max_amount'] / 100) : 0; + $changed = true; + } - if (!isset($paymentmethod->allowed_countries)) { - $paymentmethod->allowed_countries = []; - $changed = true; - } - if (isset($paymentmethod->allowed_countries) && !is_array($paymentmethod->allowed_countries)) { - $paymentmethod->allowed_countries = []; - $changed = true; - } + if (!isset($paymentmethod->description)) { + $paymentmethod->description = isset($extMethod['brand']['public_description']) ? $extMethod['brand']['public_description'] : ''; + $changed = true; + } - if (!isset($paymentmethod->limit_carriers)) { - $paymentmethod->limit_carriers = false; - $changed = true; - } + if (!isset($paymentmethod->brand_id)) { + $paymentmethod->brand_id = isset($extMethod['brand']['id']) ? $extMethod['brand']['id'] : ''; + $changed = true; + } - if (!isset($paymentmethod->allowed_carriers)) { - $paymentmethod->allowed_carriers = []; - $changed = true; - } - if (isset($paymentmethod->allowed_carriers) && !is_array($paymentmethod->allowed_carriers)) { - $paymentmethod->allowed_carriers = []; - $changed = true; - } + if (!isset($paymentmethod->limit_countries)) { + $paymentmethod->limit_countries = false; + $changed = true; + } - if (!isset($paymentmethod->fee_percentage)) { - $paymentmethod->fee_percentage = false; - $changed = true; - } + if (!isset($paymentmethod->allowed_countries)) { + $paymentmethod->allowed_countries = []; + $changed = true; + } + if (isset($paymentmethod->allowed_countries) && !is_array($paymentmethod->allowed_countries)) { + $paymentmethod->allowed_countries = []; + $changed = true; + } - if (!isset($paymentmethod->fee_value)) { - $paymentmethod->fee_value = ''; - $changed = true; - } + if (!isset($paymentmethod->limit_carriers)) { + $paymentmethod->limit_carriers = false; + $changed = true; + } - if (!isset($paymentmethod->customer_type)) { - $paymentmethod->customer_type = 'both'; - $changed = true; - } + if (!isset($paymentmethod->allowed_carriers)) { + $paymentmethod->allowed_carriers = []; + $changed = true; + } + if (isset($paymentmethod->allowed_carriers) && !is_array($paymentmethod->allowed_carriers)) { + $paymentmethod->allowed_carriers = []; + $changed = true; + } - if (!isset($paymentmethod->external_logo)) { - $paymentmethod->external_logo = ''; - $changed = true; - } + if (!isset($paymentmethod->fee_percentage)) { + $paymentmethod->fee_percentage = false; + $changed = true; + } - if (!isset($paymentmethod->create_order_on)) { - $paymentmethod->create_order_on = 'success'; - $changed = true; - } + if (!isset($paymentmethod->fee_value)) { + $paymentmethod->fee_value = ''; + $changed = true; + } - if (!isset($paymentmethod->bank_selection)) { - $paymentmethod->bank_selection = ''; - if ($paymentmethod->id == PaymentMethod::METHOD_INSTORE) { - $paymentmethod->bank_selection = 'dropdown'; + if (!isset($paymentmethod->customer_type)) { + $paymentmethod->customer_type = 'both'; + $changed = true; } - if ($paymentmethod->id == PaymentMethod::METHOD_IDEAL) { - $paymentmethod->bank_selection = 'radio'; + + if (!isset($paymentmethod->external_logo)) { + $paymentmethod->external_logo = ''; + $changed = true; } - $changed = true; - } - foreach ($languages as $language) { - $key_name = 'name_' . $language['iso_code']; - if (!isset($paymentmethod->$key_name)) { - $paymentmethod->$key_name = ''; + if (!isset($paymentmethod->create_order_on)) { + $paymentmethod->create_order_on = 'success'; $changed = true; } - $key_description = 'description_' . $language['iso_code']; - if (!isset($paymentmethod->$key_description)) { - $paymentmethod->$key_description = ''; + + if (!isset($paymentmethod->bank_selection)) { + $paymentmethod->bank_selection = ''; + if ($paymentmethod->id == PaymentMethod::METHOD_INSTORE) { + $paymentmethod->bank_selection = 'dropdown'; + } + if ($paymentmethod->id == PaymentMethod::METHOD_IDEAL) { + $paymentmethod->bank_selection = 'radio'; + } $changed = true; } - } - $resultArray[] = $paymentmethod; - unset($paymentmethods[$paymentmethod->id]); + foreach ($languages as $language) { + $key_name = 'name_' . $language['iso_code']; + if (!isset($paymentmethod->$key_name)) { + $paymentmethod->$key_name = ''; + $changed = true; + } + $key_description = 'description_' . $language['iso_code']; + if (!isset($paymentmethod->$key_description)) { + $paymentmethod->$key_description = ''; + $changed = true; + } + } + + $resultArray[] = $paymentmethod; + unset($paymentmethods[$paymentmethod->id]); + } } } - # Nieuwe payment methods voorzien van standaard values. foreach ($paymentmethods as $paymentmethod) { $defaultArray = [ diff --git a/paynlpaymentmethods/src/PayHelper.php b/paynlpaymentmethods/src/PayHelper.php index 572e01c..16adf4e 100644 --- a/paynlpaymentmethods/src/PayHelper.php +++ b/paynlpaymentmethods/src/PayHelper.php @@ -8,19 +8,22 @@ class PayHelper { /** + * @param $useMultiCore * @return void */ - public static function sdkLogin() + public static function sdkLogin($useMultiCore = false) { $apitoken = Tools::getValue('PAYNL_API_TOKEN', Configuration::get('PAYNL_API_TOKEN')); if (empty($apitoken) && !empty(Configuration::get('PAYNL_API_TOKEN'))) { $apitoken = Configuration::get('PAYNL_API_TOKEN'); } $serviceId = Tools::getValue('PAYNL_SERVICE_ID', Configuration::get('PAYNL_SERVICE_ID')); - $gateway = Tools::getValue('PAYNL_FAILOVER_GATEWAY', Configuration::get('PAYNL_FAILOVER_GATEWAY')); - if (!empty(trim($gateway))) { - \Paynl\Config::setApiBase(trim($gateway)); + if ($useMultiCore) { + $gateway = self::getFailoverGateway(); + if (!empty(trim($gateway))) { + \Paynl\Config::setApiBase(trim($gateway)); + } } \Paynl\Config::setApiToken($apitoken); \Paynl\Config::setServiceId($serviceId); @@ -36,8 +39,9 @@ public static function isLoggedIn() \Paynl\Paymentmethods::getList(); return ['status' => true]; } catch (\Paynl\Error\Error $e) { - $gateway = Tools::getValue('PAYNL_FAILOVER_GATEWAY', Configuration::get('PAYNL_FAILOVER_GATEWAY')); - if (!empty($gateway) && str_contains($gateway, 'https://rest-api.achterelkebetaling.nl')) { + $gateway = self::getFailoverGateway(); + + if (!empty($gateway) && str_contains($gateway, 'https://rest.achterelkebetaling.nl')) { return ['status' => true]; } return ['status' => false, 'error' => $e->getMessage()]; @@ -144,4 +148,16 @@ public static function checkCredentials($object) } return ['status' => $status, 'error' => $error]; } + + /** + * @return mixed + */ + public static function getFailoverGateway() + { + $gateway = Tools::getValue('PAYNL_FAILOVER_GATEWAY', Configuration::get('PAYNL_FAILOVER_GATEWAY')); + if ($gateway == 'custom') { + $gateway = Tools::getValue('PAYNL_CUSTOM_FAILOVER_GATEWAY', Configuration::get('PAYNL_CUSTOM_FAILOVER_GATEWAY')); + } + return $gateway; + } } diff --git a/paynlpaymentmethods/vendor/autoload.php b/paynlpaymentmethods/vendor/autoload.php index 1bf9dab..725969b 100644 --- a/paynlpaymentmethods/vendor/autoload.php +++ b/paynlpaymentmethods/vendor/autoload.php @@ -2,6 +2,24 @@ // autoload.php @generated by Composer +if (PHP_VERSION_ID < 50600) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, $err); + } elseif (!headers_sent()) { + echo $err; + } + } + trigger_error( + $err, + E_USER_ERROR + ); +} + require_once __DIR__ . '/composer/autoload_real.php'; return ComposerAutoloaderInita3a46c0e362da920ffeb331fe601b182::getLoader(); diff --git a/paynlpaymentmethods/vendor/composer/ClassLoader.php b/paynlpaymentmethods/vendor/composer/ClassLoader.php index fce8549..a72151c 100644 --- a/paynlpaymentmethods/vendor/composer/ClassLoader.php +++ b/paynlpaymentmethods/vendor/composer/ClassLoader.php @@ -37,57 +37,134 @@ * * @author Fabien Potencier * @author Jordi Boggiano - * @see http://www.php-fig.org/psr/psr-0/ - * @see http://www.php-fig.org/psr/psr-4/ + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ */ class ClassLoader { + /** @var \Closure(string):void */ + private static $includeFile; + + /** @var ?string */ + private $vendorDir; + // PSR-4 + /** + * @var array[] + * @psalm-var array> + */ private $prefixLengthsPsr4 = array(); + /** + * @var array[] + * @psalm-var array> + */ private $prefixDirsPsr4 = array(); + /** + * @var array[] + * @psalm-var array + */ private $fallbackDirsPsr4 = array(); // PSR-0 + /** + * @var array[] + * @psalm-var array> + */ private $prefixesPsr0 = array(); + /** + * @var array[] + * @psalm-var array + */ private $fallbackDirsPsr0 = array(); + /** @var bool */ private $useIncludePath = false; + + /** + * @var string[] + * @psalm-var array + */ private $classMap = array(); + + /** @var bool */ private $classMapAuthoritative = false; + + /** + * @var bool[] + * @psalm-var array + */ private $missingClasses = array(); + + /** @var ?string */ private $apcuPrefix; + /** + * @var self[] + */ + private static $registeredLoaders = array(); + + /** + * @param ?string $vendorDir + */ + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + self::initializeIncludeClosure(); + } + + /** + * @return string[] + */ public function getPrefixes() { if (!empty($this->prefixesPsr0)) { - return call_user_func_array('array_merge', $this->prefixesPsr0); + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); } return array(); } + /** + * @return array[] + * @psalm-return array> + */ public function getPrefixesPsr4() { return $this->prefixDirsPsr4; } + /** + * @return array[] + * @psalm-return array + */ public function getFallbackDirs() { return $this->fallbackDirsPsr0; } + /** + * @return array[] + * @psalm-return array + */ public function getFallbackDirsPsr4() { return $this->fallbackDirsPsr4; } + /** + * @return string[] Array of classname => path + * @psalm-return array + */ public function getClassMap() { return $this->classMap; } /** - * @param array $classMap Class to filename map + * @param string[] $classMap Class to filename map + * @psalm-param array $classMap + * + * @return void */ public function addClassMap(array $classMap) { @@ -102,9 +179,11 @@ public function addClassMap(array $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 + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + * + * @return void */ public function add($prefix, $paths, $prepend = false) { @@ -147,11 +226,13 @@ public function add($prefix, $paths, $prepend = false) * 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 + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories * * @throws \InvalidArgumentException + * + * @return void */ public function addPsr4($prefix, $paths, $prepend = false) { @@ -195,8 +276,10 @@ public function addPsr4($prefix, $paths, $prepend = false) * 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 + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 base directories + * + * @return void */ public function set($prefix, $paths) { @@ -211,10 +294,12 @@ public function set($prefix, $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 + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories * * @throws \InvalidArgumentException + * + * @return void */ public function setPsr4($prefix, $paths) { @@ -234,6 +319,8 @@ public function setPsr4($prefix, $paths) * Turns on searching the include path for class files. * * @param bool $useIncludePath + * + * @return void */ public function setUseIncludePath($useIncludePath) { @@ -256,6 +343,8 @@ public function getUseIncludePath() * that have not been registered with the class map. * * @param bool $classMapAuthoritative + * + * @return void */ public function setClassMapAuthoritative($classMapAuthoritative) { @@ -276,6 +365,8 @@ public function isClassMapAuthoritative() * APCu prefix to use to cache found/not-found classes, if the extension is enabled. * * @param string|null $apcuPrefix + * + * @return void */ public function setApcuPrefix($apcuPrefix) { @@ -296,33 +387,55 @@ public function getApcuPrefix() * Registers this instance as an autoloader. * * @param bool $prepend Whether to prepend the autoloader or not + * + * @return void */ public function register($prepend = false) { spl_autoload_register(array($this, 'loadClass'), true, $prepend); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } } /** * Unregisters this instance as an autoloader. + * + * @return void */ public function unregister() { spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } } /** * Loads the given class or interface. * * @param string $class The name of the class - * @return bool|null True if loaded, null otherwise + * @return true|null True if loaded, null otherwise */ public function loadClass($class) { if ($file = $this->findFile($class)) { - includeFile($file); + $includeFile = self::$includeFile; + $includeFile($file); return true; } + + return null; } /** @@ -367,6 +480,21 @@ public function findFile($class) return $file; } + /** + * Returns the currently registered loaders indexed by their corresponding vendor directories. + * + * @return self[] + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + + /** + * @param string $class + * @param string $ext + * @return string|false + */ private function findFileWithExtension($class, $ext) { // PSR-4 lookup @@ -432,14 +560,26 @@ private function findFileWithExtension($class, $ext) return false; } -} -/** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - */ -function includeFile($file) -{ - include $file; + /** + * @return void + */ + private static function initializeIncludeClosure() + { + if (self::$includeFile !== null) { + return; + } + + /** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + */ + self::$includeFile = \Closure::bind(static function($file) { + include $file; + }, null, null); + } } diff --git a/paynlpaymentmethods/vendor/composer/InstalledVersions.php b/paynlpaymentmethods/vendor/composer/InstalledVersions.php new file mode 100644 index 0000000..51e734a --- /dev/null +++ b/paynlpaymentmethods/vendor/composer/InstalledVersions.php @@ -0,0 +1,359 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer; + +use Composer\Autoload\ClassLoader; +use Composer\Semver\VersionParser; + +/** + * This class is copied in every Composer installed project and available to all + * + * See also https://getcomposer.org/doc/07-runtime.md#installed-versions + * + * To require its presence, you can require `composer-runtime-api ^2.0` + * + * @final + */ +class InstalledVersions +{ + /** + * @var mixed[]|null + * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null + */ + private static $installed; + + /** + * @var bool|null + */ + private static $canGetVendors; + + /** + * @var array[] + * @psalm-var array}> + */ + private static $installedByVendor = array(); + + /** + * Returns a list of all package names which are present, either by being installed, replaced or provided + * + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackages() + { + $packages = array(); + foreach (self::getInstalled() as $installed) { + $packages[] = array_keys($installed['versions']); + } + + if (1 === \count($packages)) { + return $packages[0]; + } + + return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); + } + + /** + * Returns a list of all package names with a specific type e.g. 'library' + * + * @param string $type + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackagesByType($type) + { + $packagesByType = array(); + + foreach (self::getInstalled() as $installed) { + foreach ($installed['versions'] as $name => $package) { + if (isset($package['type']) && $package['type'] === $type) { + $packagesByType[] = $name; + } + } + } + + return $packagesByType; + } + + /** + * Checks whether the given package is installed + * + * This also returns true if the package name is provided or replaced by another package + * + * @param string $packageName + * @param bool $includeDevRequirements + * @return bool + */ + public static function isInstalled($packageName, $includeDevRequirements = true) + { + foreach (self::getInstalled() as $installed) { + if (isset($installed['versions'][$packageName])) { + return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; + } + } + + return false; + } + + /** + * Checks whether the given package satisfies a version constraint + * + * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: + * + * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') + * + * @param VersionParser $parser Install composer/semver to have access to this class and functionality + * @param string $packageName + * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package + * @return bool + */ + public static function satisfies(VersionParser $parser, $packageName, $constraint) + { + $constraint = $parser->parseConstraints((string) $constraint); + $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); + + return $provided->matches($constraint); + } + + /** + * Returns a version constraint representing all the range(s) which are installed for a given package + * + * It is easier to use this via isInstalled() with the $constraint argument if you need to check + * whether a given version of a package is installed, and not just whether it exists + * + * @param string $packageName + * @return string Version constraint usable with composer/semver + */ + public static function getVersionRanges($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + $ranges = array(); + if (isset($installed['versions'][$packageName]['pretty_version'])) { + $ranges[] = $installed['versions'][$packageName]['pretty_version']; + } + if (array_key_exists('aliases', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); + } + if (array_key_exists('replaced', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); + } + if (array_key_exists('provided', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); + } + + return implode(' || ', $ranges); + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['version'])) { + return null; + } + + return $installed['versions'][$packageName]['version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getPrettyVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['pretty_version'])) { + return null; + } + + return $installed['versions'][$packageName]['pretty_version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference + */ + public static function getReference($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['reference'])) { + return null; + } + + return $installed['versions'][$packageName]['reference']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. + */ + public static function getInstallPath($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @return array + * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} + */ + public static function getRootPackage() + { + $installed = self::getInstalled(); + + return $installed[0]['root']; + } + + /** + * Returns the raw installed.php data for custom implementations + * + * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. + * @return array[] + * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} + */ + public static function getRawData() + { + @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + self::$installed = include __DIR__ . '/installed.php'; + } else { + self::$installed = array(); + } + } + + return self::$installed; + } + + /** + * Returns the raw data of all installed.php which are currently loaded for custom implementations + * + * @return array[] + * @psalm-return list}> + */ + public static function getAllRawData() + { + return self::getInstalled(); + } + + /** + * Lets you reload the static array from another file + * + * This is only useful for complex integrations in which a project needs to use + * this class but then also needs to execute another project's autoloader in process, + * and wants to ensure both projects have access to their version of installed.php. + * + * A typical case would be PHPUnit, where it would need to make sure it reads all + * the data it needs from this class, then call reload() with + * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure + * the project in which it runs can then also use this class safely, without + * interference between PHPUnit's dependencies and the project's dependencies. + * + * @param array[] $data A vendor/composer/installed.php data set + * @return void + * + * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $data + */ + public static function reload($data) + { + self::$installed = $data; + self::$installedByVendor = array(); + } + + /** + * @return array[] + * @psalm-return list}> + */ + private static function getInstalled() + { + if (null === self::$canGetVendors) { + self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); + } + + $installed = array(); + + if (self::$canGetVendors) { + foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { + if (isset(self::$installedByVendor[$vendorDir])) { + $installed[] = self::$installedByVendor[$vendorDir]; + } elseif (is_file($vendorDir.'/composer/installed.php')) { + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require $vendorDir.'/composer/installed.php'; + $installed[] = self::$installedByVendor[$vendorDir] = $required; + if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { + self::$installed = $installed[count($installed) - 1]; + } + } + } + } + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require __DIR__ . '/installed.php'; + self::$installed = $required; + } else { + self::$installed = array(); + } + } + + if (self::$installed !== array()) { + $installed[] = self::$installed; + } + + return $installed; + } +} diff --git a/paynlpaymentmethods/vendor/composer/autoload_classmap.php b/paynlpaymentmethods/vendor/composer/autoload_classmap.php index 7a91153..0fb0a2c 100644 --- a/paynlpaymentmethods/vendor/composer/autoload_classmap.php +++ b/paynlpaymentmethods/vendor/composer/autoload_classmap.php @@ -2,8 +2,9 @@ // autoload_classmap.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( + 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', ); diff --git a/paynlpaymentmethods/vendor/composer/autoload_namespaces.php b/paynlpaymentmethods/vendor/composer/autoload_namespaces.php index b7fc012..15a2ff3 100644 --- a/paynlpaymentmethods/vendor/composer/autoload_namespaces.php +++ b/paynlpaymentmethods/vendor/composer/autoload_namespaces.php @@ -2,7 +2,7 @@ // autoload_namespaces.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( diff --git a/paynlpaymentmethods/vendor/composer/autoload_psr4.php b/paynlpaymentmethods/vendor/composer/autoload_psr4.php index 0cce175..20f906a 100644 --- a/paynlpaymentmethods/vendor/composer/autoload_psr4.php +++ b/paynlpaymentmethods/vendor/composer/autoload_psr4.php @@ -2,7 +2,7 @@ // autoload_psr4.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( diff --git a/paynlpaymentmethods/vendor/composer/autoload_real.php b/paynlpaymentmethods/vendor/composer/autoload_real.php index 7762d0b..9d82195 100644 --- a/paynlpaymentmethods/vendor/composer/autoload_real.php +++ b/paynlpaymentmethods/vendor/composer/autoload_real.php @@ -13,37 +13,23 @@ public static function loadClassLoader($class) } } + /** + * @return \Composer\Autoload\ClassLoader + */ public static function getLoader() { if (null !== self::$loader) { return self::$loader; } + require __DIR__ . '/platform_check.php'; + spl_autoload_register(array('ComposerAutoloaderInita3a46c0e362da920ffeb331fe601b182', 'loadClassLoader'), true, true); - self::$loader = $loader = new \Composer\Autoload\ClassLoader(); + self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); spl_autoload_unregister(array('ComposerAutoloaderInita3a46c0e362da920ffeb331fe601b182', '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\ComposerStaticInita3a46c0e362da920ffeb331fe601b182::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); - } - } + require __DIR__ . '/autoload_static.php'; + call_user_func(\Composer\Autoload\ComposerStaticInita3a46c0e362da920ffeb331fe601b182::getInitializer($loader)); $loader->register(true); diff --git a/paynlpaymentmethods/vendor/composer/autoload_static.php b/paynlpaymentmethods/vendor/composer/autoload_static.php index cce396c..7c75440 100644 --- a/paynlpaymentmethods/vendor/composer/autoload_static.php +++ b/paynlpaymentmethods/vendor/composer/autoload_static.php @@ -33,11 +33,16 @@ class ComposerStaticInita3a46c0e362da920ffeb331fe601b182 ), ); + public static $classMap = array ( + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + ); + public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { $loader->prefixLengthsPsr4 = ComposerStaticInita3a46c0e362da920ffeb331fe601b182::$prefixLengthsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInita3a46c0e362da920ffeb331fe601b182::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInita3a46c0e362da920ffeb331fe601b182::$classMap; }, null, ClassLoader::class); } diff --git a/paynlpaymentmethods/vendor/composer/installed.json b/paynlpaymentmethods/vendor/composer/installed.json index 4f375fe..5d557d5 100644 --- a/paynlpaymentmethods/vendor/composer/installed.json +++ b/paynlpaymentmethods/vendor/composer/installed.json @@ -1,117 +1,127 @@ -[ - { - "name": "paynl/sdk", - "version": "v1.5.16", - "version_normalized": "1.5.16.0", - "source": { - "type": "git", - "url": "https://github.com/paynl/sdk.git", - "reference": "da650911f57e406ce71da6cf530bdb1402b3808a" +{ + "packages": [ + { + "name": "paynl/sdk", + "version": "1.6.7", + "version_normalized": "1.6.7.0", + "source": { + "type": "git", + "url": "https://github.com/paynl/sdk.git", + "reference": "03c21abadb382676fdc0c1d488712ae1a50e4fde" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paynl/sdk/zipball/03c21abadb382676fdc0c1d488712ae1a50e4fde", + "reference": "03c21abadb382676fdc0c1d488712ae1a50e4fde", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-json": "*", + "php-curl-class/php-curl-class": "^8.3||^9.0" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^1.0", + "phpunit/phpunit": "^4.8" + }, + "suggest": { + "ext-simplexml": "*" + }, + "time": "2023-11-13T15:33:10+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Paynl\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andy Pieters", + "email": "andy@pay.nl" + } + ], + "support": { + "issues": "https://github.com/paynl/sdk/issues", + "source": "https://github.com/paynl/sdk/tree/v1.6.7" + }, + "install-path": "../paynl/sdk" }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paynl/sdk/zipball/da650911f57e406ce71da6cf530bdb1402b3808a", - "reference": "da650911f57e406ce71da6cf530bdb1402b3808a", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "ext-json": "*", - "php-curl-class/php-curl-class": "^8.3" - }, - "require-dev": { - "php-coveralls/php-coveralls": "^1.0", - "phpunit/phpunit": "^4.8" - }, - "suggest": { - "ext-simplexml": "*" - }, - "time": "2020-07-13T17:53:29+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Paynl\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Andy Pieters", - "email": "andy@pay.nl" - } - ] - }, - { - "name": "php-curl-class/php-curl-class", - "version": "8.5.0", - "version_normalized": "8.5.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-curl-class/php-curl-class.git", - "reference": "2b387e3ef1c8a1d6116a1459c0e3e71643f86806" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-curl-class/php-curl-class/zipball/2b387e3ef1c8a1d6116a1459c0e3e71643f86806", - "reference": "2b387e3ef1c8a1d6116a1459c0e3e71643f86806", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "php": ">=5.3" - }, - "require-dev": { - "ext-gd": "*", - "phpunit/phpunit": "*", - "squizlabs/php_codesniffer": "*" - }, - "suggest": { - "ext-mbstring": "*" - }, - "time": "2019-01-07T06:43:45+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Curl\\": "src/Curl/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Unlicense" - ], - "authors": [ - { - "name": "Zach Borboa" - } - ], - "description": "PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs.", - "homepage": "https://github.com/php-curl-class/php-curl-class", - "keywords": [ - "API-Client", - "api", - "class", - "client", - "curl", - "framework", - "http", - "http-client", - "http-proxy", - "json", - "php", - "php-curl", - "php-curl-library", - "proxy", - "requests", - "restful", - "web-scraper", - "web-scraping ", - "web-service", - "xml" - ] - } -] + { + "name": "php-curl-class/php-curl-class", + "version": "8.5.0", + "version_normalized": "8.5.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-curl-class/php-curl-class.git", + "reference": "2b387e3ef1c8a1d6116a1459c0e3e71643f86806" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-curl-class/php-curl-class/zipball/2b387e3ef1c8a1d6116a1459c0e3e71643f86806", + "reference": "2b387e3ef1c8a1d6116a1459c0e3e71643f86806", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "php": ">=5.3" + }, + "require-dev": { + "ext-gd": "*", + "phpunit/phpunit": "*", + "squizlabs/php_codesniffer": "*" + }, + "suggest": { + "ext-mbstring": "*" + }, + "time": "2019-01-07T06:43:45+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Curl\\": "src/Curl/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Unlicense" + ], + "authors": [ + { + "name": "Zach Borboa" + } + ], + "description": "PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs.", + "homepage": "https://github.com/php-curl-class/php-curl-class", + "keywords": [ + "API-Client", + "api", + "class", + "client", + "curl", + "framework", + "http", + "http-client", + "http-proxy", + "json", + "php", + "php-curl", + "php-curl-library", + "proxy", + "requests", + "restful", + "web-scraper", + "web-scraping ", + "web-service", + "xml" + ], + "install-path": "../php-curl-class/php-curl-class" + } + ], + "dev": true, + "dev-package-names": [] +} diff --git a/paynlpaymentmethods/vendor/composer/installed.php b/paynlpaymentmethods/vendor/composer/installed.php new file mode 100644 index 0000000..4be8e08 --- /dev/null +++ b/paynlpaymentmethods/vendor/composer/installed.php @@ -0,0 +1,41 @@ + array( + 'name' => 'paynl/paynlpaymentmethods', + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', + 'reference' => '2ea4f7686143fcff725a9296fdb2b55b6d956cfe', + 'type' => 'prestashop-module', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev' => true, + ), + 'versions' => array( + 'paynl/paynlpaymentmethods' => array( + 'pretty_version' => 'dev-master', + 'version' => 'dev-master', + 'reference' => '2ea4f7686143fcff725a9296fdb2b55b6d956cfe', + 'type' => 'prestashop-module', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'paynl/sdk' => array( + 'pretty_version' => '1.6.7', + 'version' => '1.6.7.0', + 'reference' => '03c21abadb382676fdc0c1d488712ae1a50e4fde', + 'type' => 'library', + 'install_path' => __DIR__ . '/../paynl/sdk', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'php-curl-class/php-curl-class' => array( + 'pretty_version' => '8.5.0', + 'version' => '8.5.0.0', + 'reference' => '2b387e3ef1c8a1d6116a1459c0e3e71643f86806', + 'type' => 'library', + 'install_path' => __DIR__ . '/../php-curl-class/php-curl-class', + 'aliases' => array(), + 'dev_requirement' => false, + ), + ), +); diff --git a/paynlpaymentmethods/vendor/composer/platform_check.php b/paynlpaymentmethods/vendor/composer/platform_check.php new file mode 100644 index 0000000..60cb1be --- /dev/null +++ b/paynlpaymentmethods/vendor/composer/platform_check.php @@ -0,0 +1,26 @@ += 50302)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 5.3.2". You are running ' . PHP_VERSION . '.'; +} + +if ($issues) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); + } elseif (!headers_sent()) { + echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; + } + } + trigger_error( + 'Composer detected issues in your platform: ' . implode(' ', $issues), + E_USER_ERROR + ); +} diff --git a/paynlpaymentmethods/vendor/paynl/sdk/README.md b/paynlpaymentmethods/vendor/paynl/sdk/README.md index 62da4e9..39e3620 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/README.md +++ b/paynlpaymentmethods/vendor/paynl/sdk/README.md @@ -148,6 +148,8 @@ require __DIR__ . '/vendor/autoload.php'; \Paynl\Config::setTokenCode('AT-####-####'); \Paynl\Config::setApiToken('****************************************'); +$transactionId = $_REQUEST['orderId']; + $transaction = \Paynl\Transaction::status($transactionId); # Manual transfer transactions are always pending when the user is returned @@ -165,6 +167,8 @@ require __DIR__ . '/vendor/autoload.php'; \Paynl\Config::setTokenCode('AT-####-####'); \Paynl\Config::setApiToken('****************************************'); +$transactionId = $_REQUEST['order_id']; + $transaction = \Paynl\Transaction::status($transactionId); if($transaction->isPaid() || $transaction->isAuthorized()) { @@ -183,5 +187,29 @@ echo ($transaction->isPaid() || $transaction->isAuthorized())?'Paid':'Not paid'; ``` +### Failover gateway +In the event of an outage, set the failover gateway like this: + +``` +use Paynl\Config; +use Paynl\Transaction; + +require __DIR__ . '/vendor/autoload.php'; + +Config::setTokenCode('AT-####-####'); +Config::setApiToken('****************************************'); +Config::setServiceId('SL-####-####'); + +# Setting Failover gateway (for available cores, call Config::getCores()) +Config::setCore( Config::CORE2 ); + +# Or for SDK versions lower then 1.6.7, use: +Config::setApiBase('https://rest.achterelkebetaling.nl'); + +$requiredArguments = []; // See: Start a transaction example +$result = Transaction::start($requiredArguments); +``` + + ### Testing Please run ```vendor/bin/phpunit --bootstrap vendor/autoload.php tests/``` to test the application diff --git a/paynlpaymentmethods/vendor/paynl/sdk/composer.json b/paynlpaymentmethods/vendor/paynl/sdk/composer.json index bbf6177..c193f6a 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/composer.json +++ b/paynlpaymentmethods/vendor/paynl/sdk/composer.json @@ -1,7 +1,8 @@ { "name": "paynl/sdk", + "version": "1.6.7", "require": { - "php-curl-class/php-curl-class": "^8.3", + "php-curl-class/php-curl-class": "^8.3||^9.0", "ext-json": "*", "ext-curl": "*" }, diff --git a/paynlpaymentmethods/vendor/paynl/sdk/samples/exchange.php b/paynlpaymentmethods/vendor/paynl/sdk/samples/exchange.php index ffebec2..39df74c 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/samples/exchange.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/samples/exchange.php @@ -20,7 +20,14 @@ require_once 'config.php'; try { - $transaction = \Paynl\Transaction::getForExchange(); + $transactionId = $_REQUEST['order_id']; + $action = $_REQUEST['action']; + + if (\Paynl\Config::getIgnoreOnPending() && $action == 'pending') { + die("TRUE| Ignoring pending"); + } + + $transaction = \Paynl\Transaction::status($transactionId); if ($transaction->isBeingVerified()) { // here you can do your own checks and approve or decline the order yourself // the script is stopped after approving or declining, after which a new exchange call will follow. diff --git a/paynlpaymentmethods/vendor/paynl/sdk/samples/return.php b/paynlpaymentmethods/vendor/paynl/sdk/samples/return.php index f16892f..8cf1225 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/samples/return.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/samples/return.php @@ -20,12 +20,11 @@ require_once 'config.php'; try { - $transaction = \Paynl\Transaction::getForReturn(); + $transactionId = $_REQUEST['orderId']; + $transaction = \Paynl\Transaction::status($transactionId); - - if ($transaction->isPaid() || - $transaction->isPending() //manual transfer transactions are always pending when the user is returned - ) { + # Manual transfer transactions are always pending when the user is returned + if ($transaction->isPaid() || $transaction->isPending()) { // redirect to thank you page echo "Thank you
New payment"; if ($transaction->isPaid()) { @@ -41,4 +40,4 @@ } } catch (\Paynl\Error\Error $e) { echo "Fout: " . $e->getMessage(); -} +} \ No newline at end of file diff --git a/paynlpaymentmethods/vendor/paynl/sdk/samples/transaction/capture.php b/paynlpaymentmethods/vendor/paynl/sdk/samples/transaction/capture.php index 6ac24f7..85c70d7 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/samples/transaction/capture.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/samples/transaction/capture.php @@ -23,8 +23,12 @@ $amount = $_GET['amount']; $tracktrace = $_GET['tracktrace']; +$articleId = '1019'; +$quantityToBeCaptured = '1'; +$products[$articleId] = $quantityToBeCaptured; + try { - $result = \Paynl\Transaction::capture($transactionId, $amount, $tracktrace); + $result = \Paynl\Transaction::capture($transactionId, $amount, $tracktrace, $products); } catch (\Paynl\Error\Error $e) { echo $e->getMessage(); } diff --git a/paynlpaymentmethods/vendor/paynl/sdk/samples/transaction/paymentMethods.php b/paynlpaymentmethods/vendor/paynl/sdk/samples/transaction/paymentMethods.php index 6b92de3..13824fe 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/samples/transaction/paymentMethods.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/samples/transaction/paymentMethods.php @@ -1,20 +1,5 @@ - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ + require_once '../../vendor/autoload.php'; require_once '../config.php'; @@ -23,5 +8,5 @@ $paymentMethods = \Paynl\Paymentmethods::getList(); var_dump($paymentMethods); } catch (\Paynl\Error\Error $e) { - echo "Fout: " . $e->getMessage(); + echo "ERROR: " . $e->getMessage(); } diff --git a/paynlpaymentmethods/vendor/paynl/sdk/samples/transaction/start.php b/paynlpaymentmethods/vendor/paynl/sdk/samples/transaction/start.php index 0c633b8..da211b0 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/samples/transaction/start.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/samples/transaction/start.php @@ -23,7 +23,8 @@ 'extra3' => 'ext3', 'transferData' => array( 'transferData1' => 'transferData1', - 'transferData2' => 'transferData2' + 'transferData2' => 'transferData2', + 'gaClientId' => '123456789.1234567890' ), 'ipaddress' => '10.0.0.1', 'invoiceDate' => new \DateTime('now'), @@ -103,7 +104,8 @@ 'houseNumberExtension' => 'A', 'zipCode' => '5678CD', 'city' => 'ITest', - 'country' => 'NL', + 'country' => 'CA', + 'regionCode' => 'CA-NL', ), 'object' => 'Object', // 64 characters max diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Api.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Api.php index 9010258..6f771e8 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Api.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Api.php @@ -10,7 +10,7 @@ /** * Description of Api * - * @author Andy Pieters + * @author Andy Pieters */ class Api { @@ -48,7 +48,7 @@ public function doRequest($endpoint, $version = null) if ($version === null) { $version = $this->version; } - + $auth = $this->getAuth(); $data = $this->getData(); $uri = Config::getApiUrl($endpoint, (int) $version); @@ -68,7 +68,7 @@ public function doRequest($endpoint, $version = null) $curl->setOpt(CURLOPT_SSL_VERIFYPEER, Config::getVerifyPeer()); $result = $curl->post($uri, $data); - + if (isset($result->status) && $result->status === 'FALSE') { throw new Error\Api($result->error); } @@ -90,7 +90,7 @@ protected function getData() Helper::requireServiceId(); $this->data['serviceId'] = Config::getServiceId(); - } + } return $this->data; } @@ -98,7 +98,7 @@ protected function getData() * @return array|null * @throws Error\Required\ApiToken */ - private function getAuth() + protected function getAuth() { if (!$this->isApiTokenRequired()) { return null; diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Creditcard/AbstractCseRequest.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Creditcard/AbstractCseRequest.php deleted file mode 100644 index a6a0cf3..0000000 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Creditcard/AbstractCseRequest.php +++ /dev/null @@ -1,84 +0,0 @@ - - */ -abstract class AbstractCseRequest extends Api -{ - private $orderId; - private $payload; - private $threeDSTransactionId; - - /** - * @var int the version of the api - */ - protected $version = 2; - - /** - * @var bool Is the ApiToken required for this API - */ - protected $apiTokenRequired = true; - - public function getData() - { - return array_merge(parent::getData(), array( - 'orderId' => $this->getOrderId(), - 'threeDSTransactionId' => $this->getThreeDSTransactionId(), - 'payload' => $this->getPayload() - )); - } - - /** - * @return string - */ - public function getOrderId() - { - return $this->orderId; - } - - /** - * @param string $orderId - */ - public function setOrderId($orderId) - { - $this->orderId = $orderId; - } - - /** - * @return string - */ - public function getPayload() - { - return $this->payload; - } - - /** - * @param string $payload - */ - public function setPayload($payload) - { - $this->payload = $payload; - } - - /** - * @return string|null - */ - public function getThreeDSTransactionId() - { - return $this->threeDSTransactionId; - } - - /** - * @param string|null $threeDSTransactionId - */ - public function setThreeDSTransactionId($threeDSTransactionId) - { - $this->threeDSTransactionId = $threeDSTransactionId; - } -} diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Creditcard/CseAuthenticate.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Creditcard/CseAuthenticate.php deleted file mode 100644 index b34334f..0000000 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Creditcard/CseAuthenticate.php +++ /dev/null @@ -1,21 +0,0 @@ - - */ -class CseAuthenticate extends AbstractCseRequest -{ - /** - * @inheritdoc - */ - public function doRequest($endpoint = null, $version = null) - { - return parent::doRequest('creditcard/cseAuthenticate'); - } -} diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Creditcard/CseAuthorize.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Creditcard/CseAuthorize.php deleted file mode 100644 index 04ea8eb..0000000 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Creditcard/CseAuthorize.php +++ /dev/null @@ -1,21 +0,0 @@ - - */ -class CseAuthorize extends AbstractCseRequest -{ - /** - * @inheritdoc - */ - public function doRequest($endpoint = null, $version = null) - { - return parent::doRequest('creditcard/cseAuthorize'); - } -} diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Creditcard/CseTdsStatus.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Creditcard/CseTdsStatus.php deleted file mode 100644 index 9958928..0000000 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Creditcard/CseTdsStatus.php +++ /dev/null @@ -1,57 +0,0 @@ - - */ -class CseTdsStatus extends Api -{ - /** - * @var int the version of the api - */ - protected $version = 2; - - /** - * @var string - */ - private $transactionId; - - /** - * @inheritdoc - */ - public function doRequest($endpoint = null, $version = null) - { - return parent::doRequest('creditcard/cseTdsStatus'); - } - - /** - * {@inheritDoc} - */ - public function getData() - { - return array_merge(parent::getData(), array( - 'transactionId' => $this->transactionId - )); - } - - /** - * @return string - */ - public function getTransactionId() - { - return $this->transactionId; - } - - /** - * @param string $transactionId - */ - public function setTransactionId($transactionId) - { - $this->transactionId = $transactionId; - } -} diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Creditcard/PublicKeys.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Creditcard/PublicKeys.php deleted file mode 100644 index f296f44..0000000 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Creditcard/PublicKeys.php +++ /dev/null @@ -1,22 +0,0 @@ -authenticate = $authenticate; + } + + /** + * @inheritdoc + */ + public function doRequest($endpoint = null, $version = null) + { + return parent::doRequest("Payment/authenticate", 1); + } + + /** + * @return array + */ + public function getData() + { + return $this->authenticate->toArray(); + } +} diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/AuthenticateMethod.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/AuthenticateMethod.php new file mode 100644 index 0000000..483123c --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/AuthenticateMethod.php @@ -0,0 +1,39 @@ +authenticateMethod = $authenticateMethod; + } + + /** + * @inheritdoc + */ + public function doRequest($endpoint = null, $version = null) + { + return parent::doRequest("Payment/authenticate", 1); + } + + /** + * @return array + */ + public function getData() + { + return $this->authenticateMethod->toArray(); + } +} \ No newline at end of file diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/AuthenticationStatus.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/AuthenticationStatus.php new file mode 100644 index 0000000..26ec5cf --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/AuthenticationStatus.php @@ -0,0 +1,41 @@ +transactionId = $transactionId; + } + + /** + * @inheritdoc + */ + public function doRequest($endpoint = null, $version = null) + { + return parent::doRequest("Payment/getAuthenticationStatus", 1); + } + + /** + * @return array + */ + public function getData() + { + return array( + 'transactionId' => $this->transactionId + ); + } +} \ No newline at end of file diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Authorize.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Authorize.php new file mode 100644 index 0000000..1f90a39 --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Authorize.php @@ -0,0 +1,48 @@ +authorize = $authorize; + } + + /** + * @param $endpoint + * @param null $version + * @return array + * @throws Error\Required\ApiToken + * @throws Error\Api + * @throws Error\Error + */ + public function doRequest($endpoint = null, $version = null) + { + return parent::doRequest('Payment/authorize', 1); + } + + /** + * @return array + */ + public function getData() + { + return $this->authorize->toArray(); + } +} diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/EncryptionKeys.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/EncryptionKeys.php new file mode 100644 index 0000000..e5135ea --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/EncryptionKeys.php @@ -0,0 +1,28 @@ +streetName; + } + + /** + * @param string $streetName + * @return Address + */ + public function setStreetName($streetName) + { + $this->streetName = $streetName; + return $this; + } + + /** + * @param string $streetNumber + * @return Address + */ + public function setStreetNumber($streetNumber) + { + $this->streetNumber = $streetNumber; + return $this; + } + + /** + * @return string + */ + public function getStreetNumber() + { + return $this->streetNumber; + } + + /** + * @param string $streetNumberExtension + * @return Address + */ + public function setStreetNumberExtension($streetNumberExtension) + { + $this->streetNumberExtension = $streetNumberExtension; + return $this; + } + + /** + * @return string + */ + public function getStreetNumberExtension() + { + return $this->streetNumberExtension; + } + + /** + * @return string + */ + public function getZipCode() + { + return $this->zipCode; + } + + /** + * @param string $zipCode + * @return Address + */ + public function setZipCode($zipCode) + { + $this->zipCode = $zipCode; + return $this; + } + + /** + * @return string + */ + public function getCity() + { + return $this->city; + } + + /** + * @param string $city + * @return Address + */ + public function setCity($city) + { + $this->city = $city; + return $this; + } + + /** + * @return string + */ + public function getRegionCode() + { + return $this->regionCode; + } + + /** + * @param string $regionCode + * @return Address + */ + public function setRegionCode($regionCode) + { + $this->regionCode = $regionCode; + return $this; + } + + /** + * @param string $countryCode + * @return Address + */ + public function setCountryCode($countryCode) + { + $this->countryCode = $countryCode; + return $this; + } + + /** + * @return string + */ + public function getCountryCode() + { + return $this->countryCode; + } +} \ No newline at end of file diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Auth.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Auth.php new file mode 100644 index 0000000..d8970f3 --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Auth.php @@ -0,0 +1,52 @@ +payTdsTransactionId; + } + + /** + * @param string $payTdsTransactionId + * @return static + */ + public function setPayTdsTransactionId($payTdsTransactionId) + { + $this->payTdsTransactionId = $payTdsTransactionId; + return $this; + } + + /** + * @return string + */ + public function getPayTdsAcquirerId() + { + return $this->payTdsAcquirerId; + } + + /** + * @param string $payTdsAcquirerId + * @return static + */ + public function setPayTdsAcquirerId($payTdsAcquirerId) + { + $this->payTdsAcquirerId = $payTdsAcquirerId; + return $this; + } +} \ No newline at end of file diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Authenticate.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Authenticate.php new file mode 100644 index 0000000..338e471 --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Authenticate.php @@ -0,0 +1,144 @@ +transaction; + } + + /** + * @param Authenticate\Transaction $transaction + * @return static + */ + public function setTransaction($transaction) + { + $this->transaction = $transaction; + return $this; + } + + /** + * @return array + */ + public function getOptions() + { + return $this->options; + } + + /** + * @param array $options + * @return static + */ + public function setOptions($options) + { + $this->options = $options; + return $this; + } + + /** + * @return Customer + */ + public function getCustomer() + { + return $this->customer; + } + + /** + * @param Customer $customer + * @return static + */ + public function setCustomer($customer) + { + $this->customer = $customer; + return $this; + } + + /** + * @return array + */ + public function getOrder() + { + return $this->order; + } + + /** + * @param array $order + * @return static + */ + public function setOrder($order) + { + $this->order = $order; + return $this; + } + + /** + * @return array + */ + public function getStats() + { + return $this->stats; + } + + /** + * @param array $stats + * @return static + */ + public function setStats($stats) + { + $this->stats = $stats; + return $this; + } + + /** + * @return Payment + */ + public function getPayment() + { + return $this->payment; + } + + /** + * @param Payment $payment + * @return static + */ + public function setPayment($payment) + { + $this->payment = $payment; + return $this; + } +} \ No newline at end of file diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Authenticate/Transaction.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Authenticate/Transaction.php new file mode 100644 index 0000000..6f68c64 --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Authenticate/Transaction.php @@ -0,0 +1,238 @@ +type; + } + + /** + * @param string $type + * @return static + */ + public function setType($type) + { + $this->type = $type; + return $this; + } + + /** + * @return string + */ + public function getServiceId() + { + return $this->serviceId; + } + + /** + * @param string $serviceId + * @return static + */ + public function setServiceId($serviceId) + { + $this->serviceId = $serviceId; + return $this; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * @return static + */ + public function setDescription($description) + { + $this->description = $description; + return $this; + } + + /** + * @return string + */ + public function getReference() + { + return $this->reference; + } + + /** + * @param string $reference + * @return static + */ + public function setReference($reference) + { + $this->reference = $reference; + return $this; + } + + /** + * @return string + */ + public function getAmount() + { + return $this->amount; + } + + /** + * @param string $amount + * @return static + */ + public function setAmount($amount) + { + $this->amount = $amount; + return $this; + } + + /** + * @return string + */ + public function getCurrency() + { + return $this->currency; + } + + /** + * @param string $currency + * @return static + */ + public function setCurrency($currency) + { + $this->currency = $currency; + return $this; + } + + /** + * @return string + */ + public function getIpAddress() + { + return $this->ipAddress; + } + + /** + * @param string $ipAddress + * @return static + */ + public function setIpAddress($ipAddress) + { + $this->ipAddress = $ipAddress; + return $this; + } + + /** + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * @param string $language + * @return static + */ + public function setLanguage($language) + { + $this->language = $language; + return $this; + } + + /** + * @return string + */ + public function getExchangeUrl() + { + return $this->exchangeUrl; + } + + /** + * @param string $exchangeUrl + * @return static + */ + public function setExchangeUrl($exchangeUrl) + { + $this->exchangeUrl = $exchangeUrl; + return $this; + } + + /** + * @return string + */ + public function getFinishUrl() + { + return $this->finishUrl; + } + + /** + * @param string $finishUrl + * @return static + */ + public function setFinishUrl($finishUrl) + { + $this->finishUrl = $finishUrl; + return $this; + } +} \ No newline at end of file diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Authenticate/TransactionMethod.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Authenticate/TransactionMethod.php new file mode 100644 index 0000000..d5a3ae8 --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Authenticate/TransactionMethod.php @@ -0,0 +1,54 @@ +orderId; + } + + /** + * @param string $orderId + * @return static + */ + public function setOrderId($orderId) + { + $this->orderId = $orderId; + return $this; + } + + /** + * @return string + */ + public function getEntranceCode() + { + return $this->entranceCode; + } + + /** + * @param string $entranceCode + * @return static + */ + public function setEntranceCode($entranceCode) + { + $this->entranceCode = $entranceCode; + return $this; + } +} \ No newline at end of file diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/AuthenticateMethod.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/AuthenticateMethod.php new file mode 100644 index 0000000..717d819 --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/AuthenticateMethod.php @@ -0,0 +1,52 @@ +transaction; + } + + /** + * @param AbstractTransaction $transaction + * @return static + */ + public function setTransaction($transaction) + { + $this->transaction = $transaction; + return $this; + } + + /** + * @return Payment + */ + public function getPayment() + { + return $this->payment; + } + + /** + * @param Payment $payment + * @return static + */ + public function setPayment($payment) + { + $this->payment = $payment; + return $this; + } +} \ No newline at end of file diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Authorize.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Authorize.php new file mode 100644 index 0000000..f624813 --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Authorize.php @@ -0,0 +1,54 @@ +transaction; + } + + /** + * @param Authorize\Transaction $transaction + * @return static + */ + public function setTransaction($transaction) + { + $this->transaction = $transaction; + return $this; + } + + /** + * @return Payment + */ + public function getPayment() + { + return $this->payment; + } + + /** + * @param Payment $payment + * @return static + */ + public function setPayment($payment) + { + $this->payment = $payment; + return $this; + } +} \ No newline at end of file diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Authorize/Transaction.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Authorize/Transaction.php new file mode 100644 index 0000000..c716199 --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Authorize/Transaction.php @@ -0,0 +1,54 @@ +orderId; + } + + /** + * @param string $orderId + * @return static + */ + public function setOrderId($orderId) + { + $this->orderId = $orderId; + return $this; + } + + /** + * @return string + */ + public function getEntranceCode() + { + return $this->entranceCode; + } + + /** + * @param string $entranceCode + * @return static + */ + public function setEntranceCode($entranceCode) + { + $this->entranceCode = $entranceCode; + return $this; + } +} \ No newline at end of file diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Browser.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Browser.php new file mode 100644 index 0000000..49d461b --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Browser.php @@ -0,0 +1,169 @@ +javaEnabled; + } + + /** + * @param string $javaEnabled + * @return static + */ + public function setJavaEnabled($javaEnabled) + { + $this->javaEnabled = $javaEnabled; + return $this; + } + + /** + * @return string + */ + public function getJavascriptEnabled() + { + return $this->javascriptEnabled; + } + + /** + * @param string $javascriptEnabled + * @return static + */ + public function setJavascriptEnabled($javascriptEnabled) + { + $this->javascriptEnabled = $javascriptEnabled; + return $this; + } + + /** + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * @param string $language + * @return static + */ + public function setLanguage($language) + { + $this->language = $language; + return $this; + } + + /** + * @return string + */ + public function getColorDepth() + { + return $this->colorDepth; + } + + /** + * @param string $colorDepth + * @return static + */ + public function setColorDepth($colorDepth) + { + $this->colorDepth = $colorDepth; + return $this; + } + + /** + * @return string + */ + public function getScreenHeight() + { + return $this->screenHeight; + } + + /** + * @param string $screenHeight + * @return static + */ + public function setScreenHeight($screenHeight) + { + $this->screenHeight = $screenHeight; + return $this; + } + + /** + * @return string + */ + public function getScreenWidth() + { + return $this->screenWidth; + } + + /** + * @param string $screenWidth + * @return static + */ + public function setScreenWidth($screenWidth) + { + $this->screenWidth = $screenWidth; + return $this; + } + + /** + * Timezone + * @return string + */ + public function getTz() + { + return $this->tz; + } + + /** + * Timezone + * @param string $tz + * @return static + */ + public function setTz($tz) + { + $this->tz = $tz; + return $this; + } +} \ No newline at end of file diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/CSE.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/CSE.php new file mode 100644 index 0000000..a7b32b7 --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/CSE.php @@ -0,0 +1,52 @@ +identifier; + } + + /** + * @param string $identifier + * @return static + */ + public function setIdentifier($identifier) + { + $this->identifier = $identifier; + return $this; + } + + /** + * @return string + */ + public function getData() + { + return $this->data; + } + + /** + * @param string $data + * @return static + */ + public function setData($data) + { + $this->data = $data; + return $this; + } +} \ No newline at end of file diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Card.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Card.php new file mode 100644 index 0000000..3a48acf --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Card.php @@ -0,0 +1,144 @@ +expire_month; + } + + /** + * @param string $expire_month + * @return static + */ + public function setExpireMonth($expire_month) + { + $this->expire_month = $expire_month; + return $this; + } + + /** + * @return string + */ + public function getExpireYear() + { + return $this->expire_year; + } + + /** + * @param string $expire_year + * @return static + */ + public function setExpireYear($expire_year) + { + $this->expire_year = $expire_year; + return $this; + } + + /** + * @return string + */ + public function getCvc() + { + return $this->cvc; + } + + /** + * @param string $cvc + * @return static + */ + public function setCvc($cvc) + { + $this->cvc = $cvc; + return $this; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * @return static + */ + public function setName($name) + { + $this->name = $name; + return $this; + } + + /** + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * @param string $type + * @return static + */ + public function setType($type) + { + $this->type = $type; + return $this; + } + + /** + * @return string + */ + public function getNumber() + { + return $this->number; + } + + /** + * @param string $number + * @return static + */ + public function setNumber($number) + { + $this->number = $number; + return $this; + } +} \ No newline at end of file diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Company.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Company.php new file mode 100644 index 0000000..f67b48a --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Company.php @@ -0,0 +1,75 @@ +name; + } + + /** + * @param string $name + * @return static + */ + public function setName($name) + { + $this->name = $name; + return $this; + } + + /** + * @return string + */ + public function getCocNumber() + { + return $this->cocNumber; + } + + /** + * @param string $cocNumber + * @return static + */ + public function setCocNumber($cocNumber) + { + $this->cocNumber = $cocNumber; + return $this; + } + + /** + * @return string + */ + public function getVatNumber() + { + return $this->vatNumber; + } + + /** + * @param string $vatNumber + * @return static + */ + public function setVatNumber($vatNumber) + { + $this->vatNumber = $vatNumber; + return $this; + } +} \ No newline at end of file diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Customer.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Customer.php new file mode 100644 index 0000000..15d360c --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Customer.php @@ -0,0 +1,259 @@ +merchantReference; + } + + /** + * @param string $merchantReference + * @return static + */ + public function setMerchantReference($merchantReference) + { + $this->merchantReference = $merchantReference; + return $this; + } + + /** + * @return int + */ + public function getMerchantTrust() + { + return $this->merchantTrust; + } + + /** + * @param int $merchantTrust + * @return static + */ + public function setMerchantTrust($merchantTrust) + { + $this->merchantTrust = $merchantTrust; + return $this; + } + + /** + * @return string + */ + public function getFirstName() + { + return $this->firstName; + } + + /** + * @param string $firstName + * @return static + */ + public function setFirstName($firstName) + { + $this->firstName = $firstName; + return $this; + } + + /** + * @return string + */ + public function getLastName() + { + return $this->lastName; + } + + /** + * @param string $lastName + * @return static + */ + public function setLastName($lastName) + { + $this->lastName = $lastName; + return $this; + } + + /** + * @return string + */ + public function getGender() + { + return $this->gender; + } + + /** + * @param string $gender + * @return static + */ + public function setGender($gender) + { + $this->gender = $gender; + return $this; + } + + /** + * @return string + */ + public function getDob() + { + return $this->dob; + } + + /** + * @param string $dob + * @return static + */ + public function setDob($dob) + { + $this->dob = $dob; + return $this; + } + + /** + * @return string + */ + public function getPhoneNumber() + { + return $this->phoneNumber; + } + + /** + * @param string $phoneNumber + * @return static + */ + public function setPhoneNumber($phoneNumber) + { + $this->phoneNumber = $phoneNumber; + return $this; + } + + /** + * @return string + */ + public function getEmailAddress() + { + return $this->emailAddress; + } + + /** + * @param string $emailAddress + * @return static + */ + public function setEmailAddress($emailAddress) + { + $this->emailAddress = $emailAddress; + return $this; + } + + /** + * @return Company + */ + public function getCompany() + { + return $this->company; + } + + /** + * @param Company $company + * @return static + */ + public function setCompany($company) + { + $this->company = $company; + return $this; + } + + /** + * @return Address + */ + public function getAddress() + { + return $this->address; + } + + /** + * @param Address $address + * @return static + */ + public function setAddress($address) + { + $this->address = $address; + return $this; + } + + /** + * @return Invoice + */ + public function getInvoice() + { + return $this->invoice; + } + + /** + * @param Invoice $invoice + * @return static + */ + public function setInvoice($invoice) + { + $this->invoice = $invoice; + return $this; + } +} \ No newline at end of file diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Invoice.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Invoice.php new file mode 100644 index 0000000..242107b --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Invoice.php @@ -0,0 +1,121 @@ +firstName; + } + + /** + * @param string $firstName + * @return static + */ + public function setFirstName($firstName) + { + $this->firstName = $firstName; + return $this; + } + + /** + * @return string + */ + public function getLastName() + { + return $this->lastName; + } + + /** + * @param string $lastName + * @return static + */ + public function setLastName($lastName) + { + $this->lastName = $lastName; + return $this; + } + + /** + * @return string + */ + public function getGender() + { + return $this->gender; + } + + /** + * @param string $gender + * @return static + */ + public function setGender($gender) + { + $this->gender = $gender; + return $this; + } + + /** + * @return Company + */ + public function getCompany() + { + return $this->company; + } + + /** + * @param Company $company + * @return static + */ + public function setCompany($company) + { + $this->company = $company; + return $this; + } + + /** + * @return Address + */ + public function getAddress() + { + return $this->address; + } + + /** + * @param Address $address + * @return static + */ + public function setAddress($address) + { + $this->address = $address; + return $this; + } +} \ No newline at end of file diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Model.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Model.php new file mode 100644 index 0000000..ca9af37 --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Model.php @@ -0,0 +1,26 @@ + $subItem) { + if ($subItem === null) { + continue; + } + $key = trim(str_replace(get_class($this), '', $index)); + $result[$key] = $subItem instanceof Model + ? $subItem->toArray() + : $subItem; + } + + return $result; + } +} \ No newline at end of file diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Payment.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Payment.php new file mode 100644 index 0000000..f6285b9 --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Payment/Model/Payment.php @@ -0,0 +1,123 @@ +method; + } + + /** + * @param string $method + * @return static + */ + public function setMethod($method) + { + $this->method = $method; + return $this; + } + + /** + * @return CSE + */ + public function getCse() + { + return $this->cse; + } + + /** + * @param CSE $cse + * @return static + */ + public function setCse($cse) + { + $this->cse = $cse; + return $this; + } + + /** + * @return Card + */ + public function getCard() + { + return $this->card; + } + + /** + * @param Card $card + * @return static + */ + public function setCard($card) + { + $this->card = $card; + return $this; + } + + /** + * @return Browser + */ + public function getBrowser() + { + return $this->browser; + } + + /** + * @param Browser $browser + * @return static + */ + public function setBrowser($browser) + { + $this->browser = $browser; + return $this; + } + + /** + * @return Auth + */ + public function getAuth() + { + return $this->auth; + } + + /** + * @param Auth $auth + * @return static + */ + public function setAuth($auth) + { + $this->auth = $auth; + return $this; + } +} \ No newline at end of file diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/PaymentApi.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/PaymentApi.php new file mode 100644 index 0000000..0826c9f --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/PaymentApi.php @@ -0,0 +1,107 @@ + + */ +class PaymentApi extends Api +{ + /** + * @var int the version of the api + */ + protected $version = 1; + + /** + * @var array + */ + protected $data = array(); + + /** + * @var bool Is the ApiToken required for this API + */ + protected $apiTokenRequired = false; + + /** + * @var bool Is the serviceId required for this API + */ + protected $serviceIdRequired = false; + + /** + * @param $endpoint + * @param null|int $version + * + * @return array + * + * @throws Error\Api + * @throws Error\Error + * @throws Error\Required\ApiToken + */ + public function doRequest($endpoint, $version = null) + { + if ($version === null) { + $version = $this->version; + } + + $auth = $this->getAuth(); + $data = $this->getData(); + $uri = Config::getPaymentApiUrl($endpoint, (int) $version); + + /** @var Curl $curl */ + $curl = Config::getCurl(); + $curl->setHeader('Content-Type', 'application/json'); + + if (Config::getCAInfoLocation()) { + // set a custom CAInfo file + $curl->setOpt(CURLOPT_CAINFO, Config::getCAInfoLocation()); + } + + if (!empty($auth)) { + $curl->setBasicAuthentication($auth['username'], $auth['password']); + } + + $curl->setOpt(CURLOPT_SSL_VERIFYPEER, Config::getVerifyPeer()); + $result = $curl->post($uri, $data); + + if (isset($result->status) && $result->status === 'FALSE') { + throw new Error\Api($result->error); + } + + if ($curl->error) { + throw new Error\Error($curl->errorMessage); + } + + return $this->processResult($result); + } + + + /** + * @inheritDoc + */ + protected function processResult($result) + { + $output = Helper::objectToArray($result); + + if (! is_array($output)) { + throw new Error\Api($output); + } + + if (isset($output['result'])) { + return $output; + } + + if ( + isset($output['request']) && + $output['request']['result'] != 1 && + $output['request']['result'] !== 'TRUE') { + throw new Error\Api($output['request']['errorMessage']); + } + + return $output; + } +} diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/AddRecurring.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/AddRecurring.php index 5f616ba..4a38070 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/AddRecurring.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/AddRecurring.php @@ -12,7 +12,7 @@ class AddRecurring extends Transaction { protected $apiTokenRequired = true; - + protected $version = 12; /** * @var string */ diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Approve.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Approve.php index 4325eb5..f454250 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Approve.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Approve.php @@ -17,6 +17,7 @@ class Approve extends Transaction * @var string */ private $transactionId; + protected $version = 12; /** * Set the transactionId diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Capture.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Capture.php index d51c0df..2c09b50 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Capture.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Capture.php @@ -11,6 +11,7 @@ */ class Capture extends Transaction { + protected $version = 12; protected $apiTokenRequired = true; /** @@ -28,6 +29,11 @@ class Capture extends Transaction */ private $tracktrace; + /** + * @var array + */ + private $products; + /** * Set the transactionId * @@ -58,6 +64,16 @@ public function setTracktrace($tracktrace) $this->tracktrace = $tracktrace; } + /** + * Set the products + * + * @param array $products + */ + public function setProducts($products) + { + $this->products = $products; + } + /** * @inheritdoc * @throws Error\Required TransactionId is required @@ -78,6 +94,10 @@ protected function getData() $this->data['tracktrace'] = $this->tracktrace; } + if (!empty($this->products)) { + $this->data['products'] = $this->products; + } + return parent::getData(); } diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/ConfirmExternalPayment.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/ConfirmExternalPayment.php index c10ba7a..f143596 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/ConfirmExternalPayment.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/ConfirmExternalPayment.php @@ -11,6 +11,7 @@ */ class ConfirmExternalPayment extends Transaction { + protected $version = 12; protected $apiTokenRequired = true; /** diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Decline.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Decline.php index db7c932..7476b1b 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Decline.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Decline.php @@ -12,7 +12,7 @@ class Decline extends Transaction { protected $apiTokenRequired = true; - + protected $version = 12; /** * @var string */ diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/GetService.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/GetService.php index d036acd..91b2ed0 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/GetService.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/GetService.php @@ -8,7 +8,7 @@ /** * Description of GetService * - * @author Andy Pieters + * @author Andy Pieters */ class GetService extends Transaction { diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Info.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Info.php index 8d05384..54703f3 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Info.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Info.php @@ -13,6 +13,7 @@ class Info extends Transaction { protected $apiTokenRequired = true; + protected $version = 12; /** * @var string */ diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/QRPayment.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/QRPayment.php index fd97c2f..6be5a0f 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/QRPayment.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/QRPayment.php @@ -7,6 +7,7 @@ use Paynl\Error\Required; class QRPayment extends Transaction { + protected $version = 12; protected $apiTokenRequired = true; protected $serviceIdRequired = true; diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Status.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Status.php index 2fe7f77..9321ea4 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Status.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Status.php @@ -6,6 +6,7 @@ class Status extends Transaction { + protected $version = 12; protected $apiTokenRequired = true; /** diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Transaction.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Transaction.php index 5dd5b89..48df5ad 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Transaction.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/Transaction.php @@ -14,5 +14,5 @@ class Transaction extends Api /** * @var int the version of the api */ - protected $version = 12; + protected $version = 14; } diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/VoidTransaction.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/VoidTransaction.php index 5fe508a..a8e4c55 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/VoidTransaction.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Api/Transaction/VoidTransaction.php @@ -12,7 +12,7 @@ class VoidTransaction extends Transaction { protected $apiTokenRequired = true; - + protected $version = 12; /** * @var string */ diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Config.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Config.php index f408eaf..5ccc775 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Config.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Config.php @@ -7,10 +7,16 @@ /** * Description of Pay * - * @author Andy Pieters + * @author Andy Pieters */ class Config { + const CORE1 = 'https://rest-api.pay.nl'; + const CORE1_TEXT = 'Pay.nl (Default)'; + const CORE2 = 'https://rest.achterelkebetaling.nl'; + const CORE2_TEXT = 'Achterelkebetaling.nl'; + const CORE3 = 'https://rest.payments.nl'; + const CORE3_TEXT = 'Payments.nl'; /** * @var string The token code (AT-xxxx-xxxx) @@ -27,16 +33,31 @@ class Config */ private static $serviceId; + /** + * @var + */ + private static $ignoreOnPending = true; + /** * @var string The base URL for the Pay.nl API. */ private static $apiBase = 'https://rest-api.pay.nl'; + /** + * @var string The base URL for the Pay.nl API. + */ + private static $paymentApiBase = 'https://payment.pay.nl'; + /** * @var int The version of the Pay.nl API to use for requests. */ private static $apiVersion = 5; + /** + * @var bool Boolean to force using the API version set by this config. + */ + private static $forceApiVersion = false; + private static $curl; /** @@ -49,6 +70,17 @@ class Config */ private static $verifyPeer = true; + /** + * @return string[] + */ + public static function getCores() + { + return [ + self::CORE1 => self::CORE1_TEXT, + self::CORE2 => self::CORE2_TEXT, + self::CORE3 => self::CORE3_TEXT, + ]; + } /** * @return string @@ -82,6 +114,21 @@ public static function setVerifyPeer($verifyPeer) self::$verifyPeer = (boolean)$verifyPeer; } + /** + * @param bool $pending + */ + public static function setIgnoreOnPending($pending) + { + self::$ignoreOnPending = (boolean)$pending; + } + + /** + * @return bool + */ + public static function getIgnoreOnPending() + { + return self::$ignoreOnPending; + } /** * @param string $apiBase @@ -91,6 +138,23 @@ public static function setApiBase($apiBase) self::$apiBase = $apiBase; } + /** + * @param $core + * @return void + */ + public static function setCore($core) + { + self::setApiBase($core); + } + + /** + * @param string $paymentApiBase + */ + public static function setPaymentApiBase($paymentApiBase) + { + self::$paymentApiBase = $paymentApiBase; + } + /** * @return string */ @@ -149,14 +213,16 @@ public static function setServiceId($serviceId) public static function getApiVersion() { return self::$apiVersion; - } + } /** * @param string $apiVersion The API version to use for requests. + * @param bool $forceUse Set to true if you want to force using this version. */ - public static function setApiVersion($apiVersion) + public static function setApiVersion($apiVersion, $forceUse = false) { self::$apiVersion = (int) $apiVersion; + self::$forceApiVersion = $forceUse; } /** @@ -167,12 +233,27 @@ public static function setApiVersion($apiVersion) */ public static function getApiUrl($endpoint, $version = null) { - if ($version === null) { + if ($version === null || self::$forceApiVersion) { $version = self::$apiVersion; - } + } return self::$apiBase . '/v' . $version . '/' . $endpoint . '/json'; } + /** + * @param string $endpoint The endpoint of the payment API, for example Transaction/Start + * @param int|null $version + * + * @return string The url to the api + */ + public static function getPaymentApiUrl($endpoint, $version = null) + { + if ($version === null || self::$forceApiVersion) { + $version = self::$apiVersion; + } + + return self::$paymentApiBase . '/v' . $version . '/' . $endpoint . '/json'; + } + /** * @return \Paynl\Curl\CurlInterface */ diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Creditcard.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Creditcard.php deleted file mode 100644 index 9c0b91e..0000000 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Creditcard.php +++ /dev/null @@ -1,132 +0,0 @@ - - */ -class Creditcard -{ - /** - * Attempt to authorize a encrypted transaction. - * - * @param string $orderId - * - * @param string $payload - * - * @return array|Result\Details - * @throws Error\Api - * @throws Error\Error - * @throws Error\Required\ApiToken - */ - public static function cseAuthorize( - $orderId, - $threeDSTransactionId, - $payload - ) { - $api = new Api\CseAuthorize(); - - $api->setOrderId($orderId); - $api->setThreeDSTransactionId($threeDSTransactionId); - $api->setPayload($payload); - - try { - return $api->doRequest(); - } catch (\Exception $e) { - return array( - 'type' => 'error', - 'message' => $e->getMessage(), - 'file' => $e->getFile(), - 'line' => $e->getLine(), - 'trace' => $e->getTraceAsString() - ); - } - } - - /** - * Attempt to authenticate a encrypted transaction. - * - * @param string $orderId - * @param string $payload - * @param string|null $threeDSTransactionId - * - * @return array|Result\Details - * @throws Error\Api - * @throws Error\Error - * @throws Error\Required\ApiToken - */ - public static function cseAuthenticate( - $orderId, - $payload, - $threeDSTransactionId = null - ) { - $api = new Api\CseAuthenticate(); - - $api->setOrderId($orderId); - $api->setPayload($payload); - $api->setThreeDSTransactionId($threeDSTransactionId); - - try { - return $api->doRequest(); - } catch (\Exception $e) { - return array( - 'type' => 'error', - 'message' => $e->getMessage(), - 'file' => $e->getFile(), - 'line' => $e->getLine(), - 'trace' => $e->getTraceAsString() - ); - } - } - - - /** - * Attempt to authenticate a encrypted transaction. - * - * @param string $transactionId - * - * @return array|Result\Details - * @throws Error\Api - * @throws Error\Error - * @throws Error\Required\ApiToken - */ - public static function cseTdsStatus( - $transactionId - ) { - $api = new Api\CseTdsStatus(); - $api->setTransactionId($transactionId); - - try { - return $api->doRequest(); - } catch (\Exception $e) { - return array( - 'type' => 'error', - 'message' => $e->getMessage(), - 'file' => $e->getFile(), - 'line' => $e->getLine(), - 'trace' => $e->getTraceAsString() - ); - } - } - - - /** - * Obtain cryptographic keys to use. - * - * @return array - * @throws Error\Api - * @throws Error\Error - * @throws Error\Required\ApiToken - */ - public static function publicKeys() - { - $api = new Api\PublicKeys(); - - return $api->doRequest(); - } -} diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Error/Error.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Error/Error.php index beebdd1..7db4087 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Error/Error.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Error/Error.php @@ -5,7 +5,7 @@ /** * Description of Error * - * @author Andy Pieters + * @author Andy Pieters */ class Error extends \Exception { diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Error/Required.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Error/Required.php index e16f3a1..4b76f98 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Error/Required.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Error/Required.php @@ -5,7 +5,7 @@ /** * Description of Error * - * @author Andy Pieters + * @author Andy Pieters */ class Required extends Error { diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Error/Required/ApiToken.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Error/Required/ApiToken.php index a450ad5..b5d75f5 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Error/Required/ApiToken.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Error/Required/ApiToken.php @@ -7,7 +7,7 @@ /** * thrown when Apitoken is missing * - * @author Andy Pieters + * @author Andy Pieters */ class ApiToken extends Required { diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Error/Required/ServiceId.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Error/Required/ServiceId.php index d898d41..5187d86 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Error/Required/ServiceId.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Error/Required/ServiceId.php @@ -7,7 +7,7 @@ /** * Thrown when serviceId is missing * - * @author Andy Pieters + * @author Andy Pieters */ class ServiceId extends Required { diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Instore.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Instore.php index 5efb8aa..1b52caf 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Instore.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Instore.php @@ -8,7 +8,7 @@ /** * Description of Transaction * - * @author Andy Pieters + * @author Andy Pieters */ class Instore { diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Payment.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Payment.php new file mode 100644 index 0000000..5036158 --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Payment.php @@ -0,0 +1,121 @@ +setTransaction($transaction) + ->setPayment($payment); + + $api = new Api\Payment\Authorize($authorize); + return new Result\Payment\Authorize($api->doRequest()); + } + + /** + * Attempt to authenticate an encrypted transaction. + * + * @param Model\Authenticate\Transaction $transaction + * @param Model\Customer $customer + * @param Model\CSE $cse + * @param Model\Browser $browser + * @return Result\Payment\Authenticate + * @throws Error\Api + * @throws Error\Error + * @throws Error\Required\ApiToken + */ + public static function authenticate( + Model\Authenticate\Transaction $transaction, + Model\Customer $customer, + Model\CSE $cse, + Model\Browser $browser + ) { + $authenticate = new Model\Authenticate(); + + $payment = new Model\Payment(); + $payment + ->setMethod(Model\Payment::METHOD_CSE) + ->setCse($cse) + ->setBrowser($browser); + + $authenticate + ->setTransaction($transaction) + ->setOptions(array()) + ->setCustomer($customer) + ->setOrder(array()) + ->setStats(array()) + ->setPayment($payment); + + $api = new Api\Payment\Authenticate($authenticate); + return new Result\Payment\Authenticate($api->doRequest()); + } + + /** + * @param Model\AbstractTransaction $transaction + * @param Model\Payment $payment + * @return Result\Payment\AuthenticateMethod + * @throws Error\Api + * @throws Error\Error + * @throws Error\Required\ApiToken + */ + public static function authenticateMethod( + Model\AbstractTransaction $transaction, + Model\Payment $payment + ) { + $authenticateMethod = new Model\AuthenticateMethod(); + $authenticateMethod + ->setTransaction($transaction) + ->setPayment($payment); + + $api = new Api\Payment\AuthenticateMethod($authenticateMethod); + return new Result\Payment\AuthenticateMethod($api->doRequest()); + } + + /** + * Get the authentication status of a payment. + * + * @param string $transactionId + * + * @return Result\Payment\AuthenticationStatus + * @throws Error\Api + * @throws Error\Error + * @throws Error\Required\ApiToken + */ + public static function authenticationStatus( + $transactionId + ) { + $api = new Api\Payment\AuthenticationStatus($transactionId); + return new Result\Payment\AuthenticationStatus($api->doRequest()); + } + + /** + * Obtain cryptographic keys to use. + * + * @return Result\Payment\EncryptionKeys + * @throws Error\Api + * @throws Error\Error + * @throws Error\Required\ApiToken + */ + public static function paymentEncryptionKeys() + { + $api = new Api\Payment\EncryptionKeys(); + return new Result\Payment\EncryptionKeys($api->doRequest()); + } +} diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Paymentmethods.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Paymentmethods.php index 207f75d..b60311f 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Paymentmethods.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Paymentmethods.php @@ -7,7 +7,7 @@ /** * Description of Paymentmethods * - * @author Andy Pieters + * @author Andy Pieters */ class Paymentmethods { @@ -93,10 +93,13 @@ private static function filterCountry($paymentMethods, $country) public static function getList(array $options = array()) { $api = new Api\GetService(); + + # Always use default gateway for getService + \Paynl\Config::setApiBase('https://rest-api.pay.nl'); + $result = $api->doRequest(); $paymentMethods = self::reorderOutput($result); - if (isset($options['country'])) { $paymentMethods = self::filterCountry($paymentMethods, $options['country']); diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Result/Payment/Authenticate.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Result/Payment/Authenticate.php new file mode 100644 index 0000000..252fd8e --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Result/Payment/Authenticate.php @@ -0,0 +1,60 @@ +data; + + $result = array( + 'result' => !empty($arrResult['request']['result']) ? (int)$arrResult['request']['result'] : 0, + ); + + if (!empty($arrResult['request']['result']) && $arrResult['request']['result'] == 1) { + if (!empty($arrResult['payment']['bankCode']) && $arrResult['payment']['bankCode'] == "00") { + if (!empty($arrResult['transaction']['state']) && in_array($arrResult['transaction']['state'], array(85, 95, 100))) { + $result['result'] = 1; + $result['nextAction'] = !empty($arrResult['transaction']['stateName']) ? strtolower($arrResult['transaction']['stateName']) : ''; + $result['orderId'] = !empty($arrResult['transaction']['orderId']) ? $arrResult['transaction']['orderId'] : ""; + $result['entranceCode'] = !empty($arrResult['transaction']['entranceCode']) ? $arrResult['transaction']['entranceCode'] : ""; + } + } + } + + if ($result['result'] > 0) { + if (isset($arrResult['transaction']) && is_array($arrResult['transaction'])) { + $result['orderId'] = $arrResult['transaction']['orderId']; + $result['entranceCode'] = $arrResult['transaction']['entranceCode']; + $result['transaction']['transactionId'] = $arrResult['transaction']['orderId']; + $result['transaction']['entranceCode'] = $arrResult['transaction']['entranceCode']; + } + if (isset($arrResult['threeDs']) && is_array($arrResult['threeDs'])) { + $result = array_merge($result, $arrResult['threeDs']); + $result['transactionID'] = $arrResult['threeDs']['transactionID']; + $result['acquirerID'] = $arrResult['threeDs']['acquirerID']; + } + } else { + if (isset($arrResult['request'])) { + $result['errorId'] = ! empty($arrResult['request']['errorId']) + ? $arrResult['request']['errorId'] + : ''; + $result['errorMessage'] = ! empty($arrResult['request']['errorMessage']) + ? $arrResult['request']['errorMessage'] + : ''; + } else { + $result['errorMessage'] = isset($arrResult['message']) && ! empty($arrResult['message']) + ? $arrResult['message'] + : ''; + } + } + + return $result; + } +} \ No newline at end of file diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Result/Payment/AuthenticateMethod.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Result/Payment/AuthenticateMethod.php new file mode 100644 index 0000000..1369592 --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Result/Payment/AuthenticateMethod.php @@ -0,0 +1,47 @@ +data; + + $result = array( + 'result' => !empty($arrResult['request']['result']) ? (int)$arrResult['request']['result'] : 0, + ); + + if (!empty($arrResult['request']['result']) && $arrResult['request']['result'] == 1) { + if (!empty($arrResult['payment']['bankCode']) && $arrResult['payment']['bankCode'] == "00") { + if (!empty($arrResult['transaction']['state']) && in_array( + $arrResult['transaction']['state'], + array(85, 95, 100) + )) { + $result['result'] = 1; + $result['nextAction'] = !empty($arrResult['transaction']['stateName']) ? strtolower($arrResult['transaction']['stateName']) : ''; + $result['orderId'] = !empty($arrResult['transaction']['orderId']) ? $arrResult['transaction']['orderId'] : ""; + $result['entranceCode'] = !empty($arrResult['transaction']['entranceCode']) ? $arrResult['transaction']['entranceCode'] : ""; + } + } + } + + if ($result['result'] > 0) { + if (isset($arrResult['transaction']) && is_array($arrResult['transaction'])) { + $result['orderId'] = $arrResult['transaction']['orderId']; + $result['transaction']['transactionId'] = $arrResult['transaction']['orderId']; + $result['transaction']['entranceCode'] = $arrResult['transaction']['entranceCode']; + } + if (isset($arrResult['threeDs']) && is_array($arrResult['threeDs'])) { + $result = array_merge($result, $arrResult['threeDs']); + $result['transactionID'] = $arrResult['threeDs']['transactionID']; + $result['acquirerID'] = $arrResult['threeDs']['acquirerID']; + } + } else { + $result['errorId'] = !empty($arrResult['request']['errorId']) ? $arrResult['request']['errorId'] : ""; + $result['errorMessage'] = !empty($arrResult['request']['errorMessage']) ? $arrResult['request']['errorMessage'] : ""; + } + + return $result; + } +} diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Result/Payment/AuthenticationStatus.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Result/Payment/AuthenticationStatus.php new file mode 100644 index 0000000..6a68484 --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Result/Payment/AuthenticationStatus.php @@ -0,0 +1,27 @@ +data; + + $result = array( + 'result' => !empty($arrResult['request']['result']) ? (string)$arrResult['request']['result'] : "0" + ); + + if ($result['result'] > 0) { + $result['transactionID'] = $arrResult['threeDs']['transactionID']; + $result['transactionStatusCode'] = $arrResult['threeDs']['transactionStatusCode']; + } + + return $result; + } +} \ No newline at end of file diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Result/Payment/Authorize.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Result/Payment/Authorize.php new file mode 100644 index 0000000..3687a95 --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Result/Payment/Authorize.php @@ -0,0 +1,54 @@ +data; + + $result = array( + 'result' => 0, + ); + + if (!empty($arrResult['request']['result']) && $arrResult['request']['result'] == 1) { + if (!empty($arrResult['payment']['bankCode']) && $arrResult['payment']['bankCode'] == "00") { + if (!empty($arrResult['transaction']['state']) && in_array( + $arrResult['transaction']['state'], + array(85, 95, 100) + )) { + $result['result'] = 1; + } + } + } + + if ($result['result'] > 0) { + $result['nextAction'] = !empty($arrResult['transaction']['stateName']) ? strtolower( + $arrResult['transaction']['stateName'] + ) : ''; + $result['orderId'] = !empty($arrResult['transaction']['orderId']) ? $arrResult['transaction']['orderId'] : ""; + $result['entranceCode'] = !empty($arrResult['transaction']['entranceCode']) ? $arrResult['transaction']['entranceCode'] : ""; + } else { + if (isset($arrResult['request'])) { + $result['errorId'] = ! empty($arrResult['request']['errorId']) + ? $arrResult['request']['errorId'] + : ''; + $result['errorMessage'] = ! empty($arrResult['request']['errorMessage']) + ? $arrResult['request']['errorMessage'] + : ''; + } else { + $result['errorMessage'] = isset($arrResult['message']) && ! empty($arrResult['message']) + ? $arrResult['message'] + : ''; + } + } + + return $result; + } +} diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Result/Payment/EncryptionKeys.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Result/Payment/EncryptionKeys.php new file mode 100644 index 0000000..1c9ddf2 --- /dev/null +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Result/Payment/EncryptionKeys.php @@ -0,0 +1,16 @@ +data['keys']) ? $this->data['keys'] : array(); + } +} \ No newline at end of file diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Transaction.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Transaction.php index 8d4aaf4..43ced79 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Transaction.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Transaction.php @@ -8,7 +8,7 @@ /** * Description of Transaction * - * @author Andy Pieters + * @author Andy Pieters */ class Transaction { @@ -222,6 +222,9 @@ public static function start($options = array()) if (isset($options['invoiceAddress']['gender'])) { $invoiceAddress['gender'] = $options['invoiceAddress']['gender']; } + if (isset($options['invoiceAddress']['regionCode'])) { + $invoiceAddress['regionCode'] = $options['invoiceAddress']['regionCode']; + } $enduser['invoiceAddress'] = $invoiceAddress; } @@ -284,6 +287,15 @@ public static function get($transactionId) { $api = new Api\Info(); $api->setTransactionId($transactionId); + + $prefix = (string)substr($transactionId, 0, 2); + + if ($prefix == '51') { + \Paynl\Config::setApiBase('https://rest.achterelkebetaling.nl'); + } elseif ($prefix == '52') { + \Paynl\Config::setApiBase('https://rest.payments.nl'); + } + $result = $api->doRequest(); $result['transactionId'] = $transactionId; @@ -324,17 +336,14 @@ public static function details( $entranceCode = null ) { - $api = new Api\Details(); - $api->setTransactionId($transactionId); if ($entranceCode !== null) { $api->setEntranceCode($entranceCode); } - $result = $api->doRequest(); - return new Result\Details($result); + return new Result\Details($api->doRequest()); } /** @@ -509,13 +518,14 @@ public static function decline($transactionId) * @param string $transactionId * @param string|null $amount * @param string|null $tracktrace + * @param array|null $products * @return bool * @throws Error\Api * @throws Error\Error * @throws Error\Required\ApiToken * @throws Error\Required\ServiceId */ - public static function capture($transactionId, $amount = null , $tracktrace = null ) + public static function capture($transactionId, $amount = null , $tracktrace = null, $products = null) { $api = new Api\Capture(); @@ -527,6 +537,10 @@ public static function capture($transactionId, $amount = null , $tracktrace = nu $api->setTracktrace($tracktrace); } + if (!empty($products)) { + $api->setProducts($products); + } + $api->setTransactionId($transactionId); $result = $api->doRequest(); diff --git a/paynlpaymentmethods/vendor/paynl/sdk/src/Validate.php b/paynlpaymentmethods/vendor/paynl/sdk/src/Validate.php index 486bcc5..2181810 100644 --- a/paynlpaymentmethods/vendor/paynl/sdk/src/Validate.php +++ b/paynlpaymentmethods/vendor/paynl/sdk/src/Validate.php @@ -7,7 +7,7 @@ /** * Description of Paymentmethods * - * @author Andy Pieters + * @author Andy Pieters */ class Validate { diff --git a/paynlpaymentmethods/views/js/PAY.js b/paynlpaymentmethods/views/js/PAY.js index 5dcf0af..b91c716 100644 --- a/paynlpaymentmethods/views/js/PAY.js +++ b/paynlpaymentmethods/views/js/PAY.js @@ -1,4 +1,14 @@ jQuery(document).ready(function () { + var customFailoverGateway = jQuery("#PAYNL_CUSTOM_FAILOVER_GATEWAY").parents(":eq(1)"); + + if (jQuery("#PAYNL_FAILOVER_GATEWAY").val() !== 'custom') { + customFailoverGateway.css("display", "none"); + } + + jQuery("#PAYNL_FAILOVER_GATEWAY").on('change', function () { + customFailoverGateway.css("display", ($(this).val() == 'custom' ? "block" : "none")); + }); + jQuery("#PAY-info-button").click(function () { jQuery("#dialog-info-modal").dialog({ modal: true,