first commit

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

View File

@@ -0,0 +1,12 @@
# Change Log #
## [Zencard] - 2016-11-10 ##
- Has coupon field.
## [Przelewy24Product] - 2016-10-13 ##
- Init.
- Added descriptions, doc.

View File

@@ -0,0 +1,8 @@
# Zbiór wspólnych bibliotek/klas dla wszystkich wtyczek sklepowych Przelewy24 #
### Minimalne wymagania ###
- PHP 5.2+
- SOAP
- cURL

View File

@@ -0,0 +1,18 @@
<?php
/**
* @author Przelewy24
* @copyright Przelewy24
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html
*
*/
if (!defined('PRZELEWY24_LIB_ROOT')) {
define('PRZELEWY24_LIB_ROOT', dirname(__FILE__));
}
/**
* TODO: use autoload? It is possible in presta, magento, PHP5.2 ?
*/
require_once PRZELEWY24_LIB_ROOT . DIRECTORY_SEPARATOR . 'interfaces' . DIRECTORY_SEPARATOR . 'Przelewy24Interface.php';
require_once PRZELEWY24_LIB_ROOT . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'Przelewy24Product.php';
require_once PRZELEWY24_LIB_ROOT . DIRECTORY_SEPARATOR . 'installer' . DIRECTORY_SEPARATOR . 'Przelewy24Installer.php';

View File

@@ -0,0 +1,99 @@
<?php
/**
* @author Przelewy24
* @copyright Przelewy24
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html
*
*/
if (!class_exists('Przelewy24Product', false)) {
/**
* Class Przelewy24Product
*/
class Przelewy24Product implements Przelewy24Interface
{
/**
* Array with transations.
*
* @var array
*/
private $translations;
public function __construct(array $translations = array())
{
$this->setTranslations($translations);
}
/**
* Prepare cart items for form trnRegister.
*
* Read more: /docs/przelewy24product.md.
*/
public function prepareCartItems($amount, array $items = array(), $shipping = 0)
{
$cartItems = array();
if (empty($items)) {
return $cartItems;
}
$amount = (int)$amount;
$shipping = (int)$shipping;
$number = 0;
$sumProductsPrice = 0;
$joinName = '';
foreach ($items as $item) {
$number++;
$cartItems['p24_name_' . $number] = Tools::substr(strip_tags($item['name']), 0, 127);
$cartItems['p24_description_' . $number] = Tools::substr(strip_tags($item['description']), 0, 127);
$cartItems['p24_quantity_' . $number] = (int)$item['quantity'];
$cartItems['p24_price_' . $number] = (int)$item['price'];
$cartItems['p24_number_' . $number] = (int)$item['number'];
$joinName .= strip_tags($item['name']) . ', ';
$sumProductsPrice += ((int)$item['quantity'] * (int)$item['price']);
}
if ($amount > $shipping + $sumProductsPrice) {
$number++;
$cartItems['p24_name_' . $number] = $this->translations['virtual_product_name'];
$cartItems['p24_description_' . $number] = '';
$cartItems['p24_quantity_' . $number] = 1;
$cartItems['p24_price_' . $number] = $amount - ($shipping + $sumProductsPrice);
$cartItems['p24_number_' . $number] = 0;
} elseif ($amount < $shipping + $sumProductsPrice) {
$cartItems = array();
$number = 1;
$joinName = $this->translations['cart_as_product'] . ' [' . trim($joinName, ', ') . ']';
$cartItems['p24_name_' . $number] = Tools::substr($joinName, 0, 127);
$cartItems['p24_description_' . $number] = '';
$cartItems['p24_quantity_' . $number] = 1;
$cartItems['p24_price_' . $number] = $amount - $shipping;
$cartItems['p24_number_' . $number] = 0;
}
// when is correct
return $cartItems;
}
/**
* Set transactions.
*
* @param array $translations
*/
public function setTranslations(array $translations = array())
{
$this->translations = $translations;
// set default values
if (empty($this->translations['virtual_product_name'])) {
$this->translations['virtual_product_name'] = 'Różnica';
}
if (empty($this->translations['cart_as_product'])) {
$this->translations['cart_as_product'] = 'Zamówienie';
}
}
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2016 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -0,0 +1,36 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2016 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -0,0 +1,209 @@
<?php
/**
* @author Przelewy24
* @copyright Przelewy24
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html
*
*/
if (!class_exists('Przelewy24Installer', false)) {
/**
* Class Przelewy24Installer
*/
class Przelewy24Installer implements Przelewy24Interface
{
/**
* Array with transations.
*
* @var array
*/
private $translations;
/**
* Is slider enabled.
*
* @var bool
*/
private $sliderEnabled = true;
/**
* Installer pages.
*
* @var array
*/
private $pages = array();
/**
* Przelewy24Installer constructor.
*
* @param bool $sliderEnabled
* @param array $translations
*/
public function __construct($sliderEnabled = true, array $translations = array())
{
$this->sliderEnabled = $sliderEnabled;
$this->setTranslations($translations);
}
/**
* Set translations.
*
* @param array $translations
*/
public function setTranslations(array $translations = array())
{
$this->translations = $translations;
// set default values
if (empty($this->translations['php_version'])) {
$this->translations['php_version'] = 'Wersja PHP min. 5.2';
}
if (empty($this->translations['curl_version'])) {
$this->translations['curl_enabled'] = 'Włączone rozszerzenie PHP cURL (php_curl.dll)';
}
if (empty($this->translations['soap_enabled'])) {
$this->translations['soap_enabled'] = 'Włączone rozszerzenie PHP SOAP (php_soap.dll)';
}
if (empty($this->translations['merchant_id'])) {
$this->translations['merchant_id'] = 'ID sprzedawcy';
}
if (empty($this->translations['shop_id'])) {
$this->translations['shop_id'] = 'ID sklepu';
}
if (empty($this->translations['crc_key'])) {
$this->translations['crc_key'] = 'Klucz CRC';
}
if (empty($this->translations['api_key'])) {
$this->translations['api_key'] = 'Klucz API';
}
}
/**
* Add pages.
*
* @param array $pages
*/
public function addPages(array $pages = array())
{
$this->pages = array_values($pages);
}
/**
* Render installer steps.
*
* @return string
*
* @throws Exception
*/
public function renderInstallerSteps()
{
if (!$this->sliderEnabled || empty($this->pages) || !is_array($this->pages)) {
return '';
}
$requirements = $this->checkRequirements();
$params = array(
'requirements' => $requirements,
'translations' => $this->translations
);
$maxSteps = 0;
$data = array(
'steps' => array()
);
foreach ($this->pages as $page) {
$page = (int)$page;
if ($page > 0) {
$step = $this->loadStep($page, $params);
$data['steps'][$page] = $step;
$maxSteps++;
}
}
if (0 === $maxSteps) {
return '';
}
$data['maxSteps'] = $maxSteps;
return $this->loadTemplate('installer', $data);
}
/**
* Load step.
*
* @param int $number Step number.
* @param array|null $params
*
* @return string
*
* @throws Exception
*/
private function loadStep($number, $params = null)
{
$step = $this->loadTemplate('step' . $number, $params);
$step = $this->removeNewLines($step);
return $step;
}
/**
* Remove new lines ("\n", "\r") from string.
*
* @param string $string
*
* @return string
*/
private function removeNewLines($string)
{
return trim(str_replace(PHP_EOL, ' ', $string));
}
/**
* Loads template.
*
* @param string $view
* @param array|null $data
*
* @return string
*
* @throws Exception
*/
private function loadTemplate($view, $data = null)
{
extract(array("content" => $data));
ob_start();
$viewFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'theme' . DIRECTORY_SEPARATOR . "$view.tpl.php";
if (file_exists($viewFile)) {
include $viewFile;
} else {
throw new Exception('View not exist in ' . get_class($this));
}
$content = ob_get_clean();
return $content;
}
/**
* Check requirements.
*
* @return array
*/
private function checkRequirements()
{
$data = array(
'php' => array(
'test' => (version_compare(PHP_VERSION, '5.2.0') > 0),
'label' => $this->translations['php_version']
),
'curl' => array(
'test' => function_exists('curl_version'),
'label' => $this->translations['curl_enabled']
),
'soap' => array(
'test' => class_exists('SoapClient'),
'label' => $this->translations['soap_enabled']
)
);
return $data;
}
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2016 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -0,0 +1,36 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2016 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -0,0 +1,191 @@
<?php
/**
* @author Przelewy24
* @copyright Przelewy24
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html
*
*/
$content = array(); ?>
<style type="text/css">
.p24-admin-main-config {
display: none;
}
.p24-step {
height: 300px;
background: #eee;
}
.p24-step-1 {
}
.p24-inputs-group p {
display: inline-block;
width: 100%;
}
.p24-installer-container label.p24-required span::after {
color: red;
content: "*";
}
.p24-installer-container label.p24-required.p24-error input {
border: 1px solid red;
}
</style>
<script type="text/javascript">
(function ($) {
/**
* Global settings.
*/
var currentStep = 1;
var sliderSpeed = 300;
var stepsDiv = '.p24-installer-steps';
var maxSteps = <?php print $content['maxSteps']; ?>;
function contentStep(number) {
if (number === undefined || number < 1) {
number = 1
}
var html = '';
switch (number) {
<?php $i = 0; ?>
<?php foreach ($content['steps'] as $step) : ?>
case <?php print ++$i; ?>:
html = '<?php print $step; ?>';
break;
<?php endforeach; ?>
}
return html;
}
function loadStep(step) {
var content = contentStep(step);
jQuery(stepsDiv).fadeOut(sliderSpeed, function () {
jQuery(this).html(content);
jQuery(this).fadeIn(sliderSpeed);
updateStepCounter();
});
}
function skip() {
jQuery('.p24-installer-container').fadeOut(sliderSpeed, function () {
jQuery('.p24-admin-main-config').fadeIn(sliderSpeed);
});
}
function saveInputs() {
var validInputs = true;
jQuery('.p24-inputs-group input').each(function () {
var name = jQuery(this).attr('name');
var val = jQuery(this).val();
var valid = true;
if (jQuery(this).hasClass('p24-valid-crc')) {
valid = crcValidator(val);
}
if (jQuery(this).hasClass('p24-valid-number')) {
valid = numberValidator(val);
}
if (valid) {
jQuery('.p24-admin-main-config input.' + name).val(val);
jQuery(this).parents('label').removeClass('p24-error');
} else {
validInputs = false;
jQuery(this).parents('label').addClass('p24-error');
}
});
return validInputs;
}
function numberValidator(text) {
if ('' === text || undefined === text) {
return false;
}
if (!isNumeric(text)) {
return false;
}
var length = text.trim().length;
if (length < 4 || length > 6) {
return false;
}
return true;
}
function crcValidator(text) {
if ('' === text || undefined === text) {
return false;
}
return true;
}
function isNumeric(input) {
var parsed = parseInt(input);
return parsed + '' === input + '' && parsed === input - 0;
}
function updateStepCounter() {
var wrapper = '.p24-step-counter';
jQuery(wrapper).find('.p24-step-current').text(currentStep);
jQuery(wrapper).find('.p24-step-all').text(maxSteps);
}
$(document).ready(function () {
loadStep(currentStep);
jQuery('.p24-installer-container a.p24-a').click(function () {
if (jQuery(this).hasClass('p24-a-next')) {
var valid = saveInputs();
if (!valid) {
return false;
}
currentStep++;
} else if (jQuery(this).hasClass('p24-a-back')) {
currentStep--;
} else {
skip();
return false;
}
if (currentStep < 1) {
currentStep = 1;
return false;
}
if (currentStep > maxSteps) {
currentStep = maxSteps;
skip();
return false;
}
loadStep(currentStep);
return false;
});
});
})(jQuery);
</script>
<div class="p24-installer-container">
<?php $content = array(); ?>
<div class="p24-step-counter">
<span class="p24-step-current"></span>
<span class="p24-step-all"></span>
</div>
<div class="p24-installer-steps">
</div>
<div class="p24-installer-nav">
<a class="p24-a p24-a-back" href="#">
Back
</a>
<a class="p24-a p24-a-next" href="#">
Next
</a>
<a class="p24-a p24-a-skip" href="#">
Skip
</a>
</div>
</div>

View File

@@ -0,0 +1,31 @@
<?php
/**
* @author Przelewy24
* @copyright Przelewy24
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html
*
*/
$content = array(); ?>
<div class="p24-step p24-step-1">
<p>
Instalator - sprawdzenie wymagań wtyczki Przelewy24
</p>
<p>
Proin nibh augue, suscipit a, scelerisque sed, lacinia
in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus.
</p>
<div class="">
<?php foreach ($content['requirements'] as $key => $requirement) : ?>
<p>
<?php print $requirement['label']; ?>
-
<?php if ($requirement['test']) : ?>
<span class="">TAK</span>
<?php else : ?>
<span class="">NIE</span>
<?php endif; ?>
</p>
<?php endforeach; ?>
</div>
</div>

View File

@@ -0,0 +1,48 @@
<?php
/**
* @author Przelewy24
* @copyright Przelewy24
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html
*
*/
?>
<div class="p24-step p24-step-2">
<?php $content = array(); ?>
<p>
Autoryzacja
</p>
<p>
Proin nibh augue, suscipit a, scelerisque sed, lacinia
in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus. Phasellus pharetra nulla ac diam. Quisque semper
justo at risus. Donec venenatis, turpis vel hendrerit interdum, dui ligula ultricies purus, sed posuere libero
dui id orci. Nam congue, pede vitae dapibus aliquet, elit magna vulputate arcu, vel tempus metus leo non est.
Etiam sit amet lectus quis est congue mollis.
</p>
<div class="p24-inputs-group">
<p>
<label class="p24-required">
<span>
<?php print $content['translations']['merchant_id']; ?>
</span>
<input name="p24_merchant_id" value="12345" class="p24-valid-number" type="text"/>
</label>
</p>
<p>
<label class="p24-required">
<span>
<?php print $content['translations']['shop_id']; ?>
</span>
<input name="p24_shop_id" value="12345" class="p24-valid-number" type="text"/>
</label>
</p>
<p>
<label class="p24-required">
<span>
<?php print $content['translations']['crc_key']; ?>
</span>
<input name="p24_crc_key" value="testtest" class="p24-valid-crc" type="text"/>
</label>
</p>
</div>
</div>

View File

@@ -0,0 +1,54 @@
<?php
/**
* @author Przelewy24
* @copyright Przelewy24
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html
*
*/
?>
<div class="p24-step p24-step-3">
<?php $content = array(); ?>
<p>
Klucz API - dodatkowe funkcje
</p>
<p>
Jakie dodatkowe funkcje i korzyści daje nam wtyczka Przelewy24 po wprowadzeniu klucza API?
</p>
<b>Oneclick</b>
<p>
Najwygodniejszy dla klienta sposób zakupu produktów,
usług lub subskrypcji w Internecie za pomocą jednego
kliknięcia, bez konieczności zakładania konta w systemie
operatora i każdorazowego uzupełniania danych karty.
</p>
<b>
Wybór metody płatności w sklepie
</b>
<p>
Możliwość personalizacji procesu płatności, dowolność
ingerencji w kwestie graficzne i funkcjonalne modułu.
Wybór płatności bezpośrednio na stronie partnera.
</p>
<b>
IVR
</b>
<p>
Obsługa płatności przez telefon za pośrednictwem automatycznego
operatora. Usługa ma zastosowanie m.in w serwisach,
które posiadają własne CallCenter sprzedażowe lub doradcze.
Klient w procesie płatności bezpiecznie uzupełnia dane swojej
karty przy pomocy klawiatury własnego urządzenia.
</p>
<div class="p24-inputs-group">
<p>
<label class="">
<span>
<?php print $content['translations']['api_key']; ?>
</span>
<input name="p24_api_key" value="" class="" type="text"/>
</label>
</p>
</div>
</div>

View File

@@ -0,0 +1,20 @@
<?php
/**
* @author Przelewy24
* @copyright Przelewy24
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html
*
*/
?>
<div class="p24-step p24-step-4">
<p>
Dodatkowe informacje
</p>
<p>
Proin nibh augue, suscipit a, scelerisque sed, lacinia
in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus.
Proin nibh augue, suscipit a, scelerisque sed, lacinia
in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus.
</p>
</div>

View File

@@ -0,0 +1,29 @@
<?php
/**
* @author Przelewy24
* @copyright Przelewy24
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html
*
*/
?>
<div class="p24-step p24-step-5">
<p>
Podsumowanie
</p>
<p>
To już wszystko!
</p>
<p>
Phasellus ornare, ante vitae consectetuer consequat, purus sapien ultricies dolor, et mollis pede metus eget
nisi. Praesent sodales velit quis augue. Cras suscipit, urna at aliquam rhoncus, urna quam viverra nisi, in
interdum massa nibh nec erat.
Proin nibh augue, suscipit a, scelerisque sed, lacinia
in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus.
Proin nibh augue, suscipit a, scelerisque sed, lacinia
in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus.
Nam congue, pede vitae dapibus aliquet, elit magna vulputate arcu, vel tempus metus leo non est. Etiam sit amet
lectus quis est congue mollis. Phasellus congue lacus eget neque.
</p>
</div>

View File

@@ -0,0 +1,20 @@
<?php
/**
* @author Przelewy24
* @copyright Przelewy24
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html
*
*/
/**
* Interface Przelewy24Interface
*/
interface Przelewy24Interface
{
/**
* Set translations.
*
* @param array
*/
public function setTranslations(array $params = array());
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2016 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -0,0 +1,208 @@
<?php
/**
* @author Przelewy24
* @copyright Przelewy24
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html
*
*/
if (!class_exists('Transaction', false)) {
/**
* Class Transaction
*/
class Transaction
{
/**
* User email.
*
* @var string
*/
private $userEmail;
/**
* Is verified.
*
* @var bool
*/
private $verified;
/**
* Is confirmed.
*
* @var bool
*/
private $confirmed;
/**
* Is discount.
*
* @var bool
*/
private $discount;
/**
* Information.
*
* @var string
*/
private $info;
/**
* Amount.
*
* @var int
*/
private $amount;
/**
* Amount with discount.
*
* @var int
*/
private $amountWithDiscount;
/**
* Skip coupon.
*
* @var bool
*/
private $skipCoupon;
/**
* Has coupon.
*
* @var bool
*/
private $hasCoupon;
/**
* Transaction constructor.
*
* @param stdClass $data
*/
public function __construct($data)
{
$this->setData($data);
}
/**
* Get user email.
*
* @return string
*/
public function getUserEmail()
{
return $this->userEmail;
}
/**
* Is verified.
*
* @return boolean
*/
public function isVerified()
{
return $this->verified;
}
/**
* Is confirmed.
*
* @return bool
*/
public function isConfirmed()
{
return $this->confirmed;
}
/**
* Has discount.
*
* @return boolean
*/
public function hasDiscount()
{
return $this->discount;
}
/**
* Get information.
*
* @return string
*/
public function getInfo()
{
return $this->info;
}
/**
* Get amount.
*
* @return int
*/
public function getAmount()
{
return $this->amount;
}
/**
* Get amount with discount.
*
* @return int
*/
public function getAmountWithDiscount()
{
return $this->amountWithDiscount;
}
/**
* Get discount amount.
*
* @return float
*/
public function getDiscountAmountFloat()
{
return ($this->getAmount() - $this->getAmountWithDiscount()) / 100;
}
/**
* Is skip coupon.
*
* @return bool
*/
public function isSkipCoupon()
{
return $this->skipCoupon;
}
/**
* Set data.
*
* @param stdClass $data
*
* @return bool
*/
private function setData($data)
{
if (empty($data) || !is_object($data)) {
return false;
}
$this->userEmail =
(isset($data->_identity) && isset($data->_identity->_user)) ? (string)$data->_identity->_user : '';
$this->verified = isset($data->_verified) ? (bool)$data->_verified : false;
$this->confirmed = isset($data->_confirmed) ? (bool)$data->_confirmed : false;
$this->discount =
(isset($data->_discount) && $data->_discount instanceof \stdClass) ? (bool)$data->_discount : false;
$this->amount = isset($data->_amount) ? (int)$data->_amount : 0;
$this->amountWithDiscount = isset($data->_amountWithDiscount) ? (int)$data->_amountWithDiscount : 0;
$this->info =
isset($data->_info) && isset($data->_info->data) && isset($data->_info->data->info)
? (string)$data->_info->data->info : '';
$this->skipCoupon = isset($data->_skipCoupon) ? (bool)$data->_skipCoupon : false;
$this->hasCoupon =
isset($data->_info) && isset($data->_info->data) && isset($data->_info->data->hasCoupon)
? (bool)$data->_info->data->hasCoupon : false;
return true;
}
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* 2007-2017 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2016 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;