Subida del módulo y tema de PrestaShop

This commit is contained in:
Kaloyan
2026-04-09 18:31:51 +02:00
parent 12c253296f
commit 16b3ff9424
39262 changed files with 7418797 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
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,110 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\Cart;
use PsCheckout\Infrastructure\Adapter\AddressInterface;
use PsCheckout\Infrastructure\Adapter\ContextInterface;
use PsCheckout\Infrastructure\Adapter\CurrencyInterface;
use PsCheckout\Infrastructure\Repository\CustomerRepositoryInterface;
use PsCheckout\Infrastructure\Repository\LanguageRepository;
use PsCheckout\Infrastructure\Repository\LanguageRepositoryInterface;
use PsCheckout\Presentation\Presenter\PresenterInterface;
class CartPresenter implements PresenterInterface
{
/**
* @var ContextInterface|null
*/
private $context;
/**
* @var AddressInterface
*/
private $address;
/**
* @var CurrencyInterface
*/
private $currency;
/**
* @var LanguageRepository
*/
private $languageRepository;
/**
* @var LanguageRepository
*/
private $customerRepository;
public function __construct(
ContextInterface $context,
AddressInterface $address,
CurrencyInterface $currency,
LanguageRepositoryInterface $languageRepository,
CustomerRepositoryInterface $customerRepository
) {
$this->context = $context;
$this->address = $address;
$this->currency = $currency;
$this->languageRepository = $languageRepository;
$this->customerRepository = $customerRepository;
}
/**
* {@inheritDoc}
*/
public function present(): array
{
$productList = $this->context->getCart()->getProducts();
$shippingAddress = $this->address->initialize((int) $this->context->getCart()->id_address_delivery);
$invoiceAddress = $this->address->initialize((int) $this->context->getCart()->id_address_invoice);
$currency = $this->currency->getCurrencyInstance((int) $this->context->getCart()->id_currency);
return [
'cart' => [
'id' => $this->context->getCart()->id,
'shipping_cost' => $this->context->getCart()->getTotalShippingCost(null, true),
'is_virtual' => $this->context->getCart()->isVirtualCart(),
'totals' => [
'total_including_tax' => [
'amount' => $this->context->getCart()->getOrderTotal(true),
],
],
'subtotals' => [
'gift_wrapping' => [
'amount' => $this->context->getCart()->gift ? $this->context->getCart()->getGiftWrappingPrice(true) : 0,
],
],
],
'customer' => $this->customerRepository->getOneBy(['id_customer' => (int) $this->context->getCart()->id_customer]),
'language' => $this->languageRepository->getOneBy(['id_lang' => (int) $this->context->getCart()->id_lang]),
'products' => $productList,
'addresses' => [
'shipping' => $shippingAddress,
'invoice' => $invoiceAddress,
],
'currency' => [
'iso_code' => $currency->iso_code,
],
];
}
}

View File

@@ -0,0 +1,29 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
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,65 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\Date;
use DateTime;
use DateTimeZone;
use PsCheckout\Infrastructure\Adapter\ConfigurationInterface;
class DatePresenter implements DatePresenterInterface
{
/**
* @var ConfigurationInterface
*/
private $configuration;
/**
* @param ConfigurationInterface $configuration
*/
public function __construct(ConfigurationInterface $configuration)
{
$this->configuration = $configuration;
}
/** {@inheritdoc} */
public function present(string $timestamp, string $format): string
{
$date = new DateTime($timestamp);
$date->setTimezone($this->getTimeZone());
return $date->format($format);
}
/**
* @return DateTimeZone
*/
private function getTimeZone(): DateTimeZone
{
$psTimeZone = $this->configuration->get('PS_TIMEZONE');
if (empty($psTimeZone)) {
$psTimeZone = date_default_timezone_get();
}
return new DateTimeZone($psTimeZone);
}
}

View File

@@ -0,0 +1,32 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\Date;
interface DatePresenterInterface
{
/**
* @param string $timestamp
* @param string $format
*
* @return string
*/
public function present(string $timestamp, string $format): string;
}

View File

@@ -0,0 +1,29 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
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,113 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\FundingSource;
use PsCheckout\Core\FundingSource\Repository\FundingSourceRepositoryInterface;
use PsCheckout\Core\FundingSource\ValueObject\FundingSource;
class FundingSourcePresenter implements FundingSourcePresenterInterface
{
/**
* @var string
*/
private $modulePathUri;
/**
* @var FundingSourceRepositoryInterface
*/
private $fundingSourceRepository;
/**
* @var FundingSourceTranslationProviderInterface
*/
private $fundingSourceTranslationProvider;
/**
* @param string $modulePathUri
* @param FundingSourceRepositoryInterface $fundingSourceRepository
* @param FundingSourceTranslationProviderInterface $fundingSourceTranslationProvider
*/
public function __construct(
string $modulePathUri,
FundingSourceRepositoryInterface $fundingSourceRepository,
FundingSourceTranslationProviderInterface $fundingSourceTranslationProvider
) {
$this->modulePathUri = $modulePathUri;
$this->fundingSourceRepository = $fundingSourceRepository;
$this->fundingSourceTranslationProvider = $fundingSourceTranslationProvider;
}
/**
* {@inheritdoc}
*/
public function getOneBy(array $keyValueCriteria)
{
$fundingSource = $this->fundingSourceRepository->getOneBy($keyValueCriteria);
return $fundingSource ? $this->buildFundingSourceObject($fundingSource) : null;
}
/**
* {@inheritdoc}
*/
public function getAllForSpecificShop(int $shopId): array
{
$fundingSourceData = $this->fundingSourceRepository->getAllForSpecificShop($shopId);
$fundingSources = [];
foreach ($fundingSourceData as $fundingSource) {
$fundingSources[] = $this->buildFundingSourceObject($fundingSource);
}
return $fundingSources;
}
/**
* {@inheritdoc}
*/
public function getAllActiveForSpecificShop(int $shopId): array
{
$fundingSourceData = $this->fundingSourceRepository->getAllActiveForSpecificShop($shopId);
$fundingSources = [];
foreach ($fundingSourceData as $fundingSource) {
$fundingSources[] = $this->buildFundingSourceObject($fundingSource);
}
return $fundingSources;
}
/**
* @param array $fundingSource
*
* @return FundingSource
*/
private function buildFundingSourceObject(array $fundingSource): FundingSource
{
return new FundingSource(
$fundingSource['name'],
$this->fundingSourceTranslationProvider->getFundingSourceName($fundingSource['name']),
$fundingSource['position'],
(bool) $fundingSource['active'],
in_array($fundingSource['name'], ['google_pay', 'apple_pay']) ? $this->modulePathUri . 'views/img/' . $fundingSource['name'] . '.svg' : null
);
}
}

View File

@@ -0,0 +1,55 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\FundingSource;
use PsCheckout\Core\FundingSource\ValueObject\FundingSource;
interface FundingSourcePresenterInterface
{
/**
* Get one funding source by key value criteria
*
* @param array $keyValueCriteria an associative array of key-value pairs where
* the key represents the column name and the value
* represents the value to search for
*
* @return FundingSource|null
*/
public function getOneBy(array $keyValueCriteria);
/**
* Get all funding sources for specific shop
*
* @param int $shopId
*
* @return FundingSource[]
*/
public function getAllForSpecificShop(int $shopId): array;
/**
* Get all active funding sources for specific shop
*
* @param int $shopId
*
* @return FundingSource[]
*/
public function getAllActiveForSpecificShop(int $shopId): array;
}

View File

@@ -0,0 +1,76 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\FundingSource;
use PsCheckout\Core\FundingSource\Factory\FundingSourceTokenFactoryInterface;
use PsCheckout\Core\PaymentToken\Repository\PaymentTokenRepositoryInterface;
use PsCheckout\Core\PaymentToken\ValueObject\PaymentToken;
use PsCheckout\Core\Settings\Configuration\PayPalConfiguration;
use PsCheckout\Infrastructure\Adapter\ConfigurationInterface;
class FundingSourceTokenPresenter implements FundingSourceTokenPresenterInterface
{
/**
* @var PaymentTokenRepositoryInterface
*/
private $paymentTokenRepository;
/**
* @var ConfigurationInterface
*/
private $configuration;
/**
* @var FundingSourceTokenFactoryInterface
*/
private $fundingSourceTokenFactory;
public function __construct(PaymentTokenRepositoryInterface $paymentTokenRepository, ConfigurationInterface $configuration, FundingSourceTokenFactoryInterface $fundingSourceTokenFactory)
{
$this->paymentTokenRepository = $paymentTokenRepository;
$this->fundingSourceTokenFactory = $fundingSourceTokenFactory;
$this->configuration = $configuration;
}
/**
* {@inheritdoc}
*/
public function getFundingSourceTokens(int $customerId): array
{
if (!$customerId) {
return [];
}
$paymentTokens = $this->paymentTokenRepository->findVaultedTokensByCustomerAndMerchant(
$customerId,
$this->configuration->get(PayPalConfiguration::PS_CHECKOUT_PAYPAL_ID_MERCHANT)
);
$fundingSourceTokens = [];
foreach ($paymentTokens as $tokenData) {
$paymentToken = PaymentToken::createFromArray($tokenData);
$fundingSourceTokens[] = $this->fundingSourceTokenFactory->createFromPaymentToken($paymentToken);
}
return $fundingSourceTokens;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\FundingSource;
use PsCheckout\Core\Exception\PsCheckoutException;
use PsCheckout\Core\FundingSource\ValueObject\FundingSourceToken;
interface FundingSourceTokenPresenterInterface
{
/**
* @param int $customerId
*
* @return FundingSourceToken[]
*
* @throws PsCheckoutException
*/
public function getFundingSourceTokens(int $customerId): array;
}

View File

@@ -0,0 +1,117 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\FundingSource;
use PsCheckout\Presentation\TranslatorInterface;
class FundingSourceTranslationProvider implements FundingSourceTranslationProviderInterface
{
/**
* @var array
*/
private $fundingSourceNames;
/**
* @var TranslatorInterface
*/
private $translator;
/**
* @param TranslatorInterface $translator
*/
public function __construct(TranslatorInterface $translator)
{
$this->translator = $translator;
$this->initializeFundingSourceNames();
}
/**
* {@inheritdoc}
*/
public function getFundingSourceName(string $fundingSourceName): string
{
return $this->fundingSourceNames[$fundingSourceName] ?? '';
}
/**
* {@inheritdoc}
*/
public function getPaymentMethodName(string $fundingSourceName, string $fundingSourceLabel): string
{
$payByTranslation = $this->translator->trans('Pay by %s');
switch ($fundingSourceName) {
case 'card':
return $this->translator->trans('Pay by Card - 100% secure payments');
case 'paypal':
return $this->translator->trans('Pay with a PayPal account');
case 'paylater':
return $this->translator->trans('Pay in installments with PayPal Pay Later');
case 'pay_upon_invoice':
return $this->translator->trans('Pay later with invoice');
default:
return sprintf($payByTranslation, $fundingSourceLabel);
}
}
/**
* {@inheritdoc}
*/
public function getVaultedPaymentMethodName(string $identifier): string
{
return str_replace('%s', $identifier, $this->fundingSourceNames['token']);
}
/**
* Initializes funding source names.
*/
private function initializeFundingSourceNames()
{
$this->fundingSourceNames = [
'card' => $this->translator->trans('Card'),
'paypal' => 'PayPal',
'venmo' => 'Venmo',
'itau' => 'Itau',
'credit' => 'PayPal Credit',
'paylater' => 'PayPal Pay Later',
'ideal' => 'iDEAL',
'bancontact' => 'Bancontact',
'eps' => 'EPS',
'mybank' => 'MyBank',
'blik' => 'BLIK',
'p24' => 'Przelewy24',
'pay_upon_invoice' => $this->translator->trans('Pay upon Invoice'),
'zimpler' => 'Zimpler',
'wechatpay' => 'WeChat Pay',
'payu' => 'PayU',
'verkkopankki' => 'Verkkopankki',
'trustly' => 'Trustly',
'oxxo' => 'OXXO',
'boleto' => 'Boleto',
'maxima' => 'Maxima',
'mercadopago' => 'Mercado Pago',
'sepa' => 'SEPA',
'google_pay' => 'Google Pay',
'apple_pay' => 'Apple Pay',
'token' => $this->translator->trans('Pay with %s'),
];
}
}

View File

@@ -0,0 +1,46 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\FundingSource;
interface FundingSourceTranslationProviderInterface
{
/**
* @param string $fundingSourceName
*
* @return string
*/
public function getFundingSourceName(string $fundingSourceName): string;
/**
* @param string $fundingSourceName
* @param string $fundingSourceLabel
*
* @return string
*/
public function getPaymentMethodName(string $fundingSourceName, string $fundingSourceLabel): string;
/**
* @param string $identifier
*
* @return string
*/
public function getVaultedPaymentMethodName(string $identifier): string;
}

View File

@@ -0,0 +1,67 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\FundingSource;
class LogoPresenter implements LogoPresenterInterface
{
/**
* @var string
*/
private $modulePath;
public function __construct($modulePath)
{
$this->modulePath = $modulePath;
}
/**
* {@inheritdoc}
*/
public function getLogoByPaymentSource(array $paymentSource): string
{
$paymentSourceName = key($paymentSource);
if ($paymentSourceName === 'card' && isset($paymentSource['card']['brand'])) {
switch ($paymentSource['card']['brand']) {
case 'CB_NATIONALE':
return $this->modulePath . 'views/img/cb.svg';
case 'VISA':
return $this->modulePath . 'views/img/visa.svg';
case 'MASTERCARD':
return $this->modulePath . 'views/img/mastercard.svg';
case 'AMEX':
return $this->modulePath . 'views/img/amex.svg';
case 'DISCOVER':
return $this->modulePath . 'views/img/discover.svg';
case 'JCB':
return $this->modulePath . 'views/img/jcb.svg';
case 'DINERS':
return $this->modulePath . 'views/img/diners.svg';
case 'UNIONPAY':
return $this->modulePath . 'views/img/unionpay.svg';
case 'MAESTRO':
return $this->modulePath . 'views/img/maestro.svg';
}
}
return $this->modulePath . 'views/img/' . $paymentSourceName . '.svg';
}
}

View File

@@ -0,0 +1,31 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\FundingSource;
interface LogoPresenterInterface
{
/**
* @param array $paymentSource
*
* @return string
*/
public function getLogoByPaymentSource(array $paymentSource): string;
}

View File

@@ -0,0 +1,29 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
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
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\OrderSummary;
use Context;
use Currency;
use Order;
use PsCheckout\Api\ValueObject\PayPalOrderResponse;
use PsCheckout\Core\Exception\PsCheckoutException;
use PsCheckout\Core\PayPal\Order\Entity\PayPalOrder;
use PsCheckout\Core\PayPal\Order\Provider\PayPalOrderProviderInterface;
use PsCheckout\Core\PayPal\Order\Provider\PayPalOrderTranslationProviderInterface;
use PsCheckout\Core\PayPal\Order\Repository\PayPalOrderRepositoryInterface;
use PsCheckout\Infrastructure\Adapter\LinkInterface;
use PsCheckout\Presentation\Presenter\FundingSource\FundingSourceTranslationProviderInterface;
use PsCheckout\Presentation\TranslatorInterface;
use Tools;
class OrderSummaryPresenter implements OrderSummaryPresenterInterface
{
/**
* @var LinkInterface
*/
private $link;
/**
* @var TranslatorInterface
*/
private $translator;
/**
* @var PayPalOrderRepositoryInterface
*/
private $payPalOrderRepository;
/**
* @var PayPalOrderProviderInterface
*/
private $payPalOrderProvider;
/**
* @var FundingSourceTranslationProviderInterface
*/
private $fundingSourceTranslationProvider;
/**
* @var PayPalOrderTranslationProviderInterface
*/
private $payPalOrderTranslationProvider;
/**
* @param LinkInterface $link,
* @param TranslatorInterface $translator
* @param PayPalOrderRepositoryInterface $payPalOrderRepository
* @param PayPalOrderProviderInterface $payPalOrderProvider
* @param FundingSourceTranslationProviderInterface $fundingSourceTranslationProvider
* @param PayPalOrderTranslationProviderInterface $payPalOrderTranslationProvider
*/
public function __construct(
LinkInterface $link,
TranslatorInterface $translator,
PayPalOrderRepositoryInterface $payPalOrderRepository,
PayPalOrderProviderInterface $payPalOrderProvider,
FundingSourceTranslationProviderInterface $fundingSourceTranslationProvider,
PayPalOrderTranslationProviderInterface $payPalOrderTranslationProvider
) {
$this->link = $link;
$this->translator = $translator;
$this->payPalOrderRepository = $payPalOrderRepository;
$this->payPalOrderProvider = $payPalOrderProvider;
$this->fundingSourceTranslationProvider = $fundingSourceTranslationProvider;
$this->payPalOrderTranslationProvider = $payPalOrderTranslationProvider;
}
/** {@inheritdoc} */
public function present(Order $order): array
{
$payPalOrder = $this->payPalOrderRepository->getOneByCartId($order->id_cart);
if (!$payPalOrder) {
throw new PsCheckoutException('PayPal order not found', PsCheckoutException::PAYPAL_ORDER_NOT_FOUND);
}
try {
$payPalOrderResponse = $this->payPalOrderProvider->getById($payPalOrder->getId());
} catch (PsCheckoutException $exception) {
$payPalOrderResponse = null;
}
$orderTransactionStatus = $payPalOrderResponse ? $payPalOrderResponse->getTransactionStatus() : '';
return [
'orderPayPalId' => $payPalOrder->getId(),
'orderPayPalStatus' => $payPalOrderResponse ? $payPalOrderResponse->getStatus() : $payPalOrder->getStatus(),
'orderPayPalFundingSourceTranslated' => $this->fundingSourceTranslationProvider->getFundingSourceName($payPalOrder->getFundingSource()),
'orderPayPalTransactionId' => $payPalOrderResponse ? $payPalOrderResponse->getTransactionId() : '',
'orderPayPalTransactionStatus' => $orderTransactionStatus,
'orderPayPalTransactionStatusTranslated' => $this->payPalOrderTranslationProvider->getTransactionStatusTranslated($orderTransactionStatus),
'orderPayPalTransactionAmount' => $this->getTotalAmountFormatted($payPalOrderResponse),
'vault' => $payPalOrder->checkCustomerIntent(PayPalOrder::CUSTOMER_INTENT_VAULT),
'tokenIdentifier' => $this->getPaymentTokenIdentifier($payPalOrder),
'isTokenSaved' => $this->isTokenSaved($payPalOrder),
'approvalLink' => $payPalOrderResponse ? $payPalOrderResponse->getApprovalLink() : '',
'payerActionLink' => $payPalOrderResponse ? $payPalOrderResponse->getPayerActionLink() : '',
'contactUsLink' => $this->link->getPageLink('contact', ['id_order' => $order->id]),
'translations' => [
'blockTitle' => $this->translator->trans('Payment gateway information'),
'notificationFailed' => $this->translator->trans('Your payment has been declined by our payment gateway, please contact us via the link below.'),
'notificationPendingApproval' => $this->translator->trans('Your payment needs to be approved, please click the button below.'),
'notificationPayerActionRequired' => $this->translator->trans('Your payment needs to be authenticated, please click the button below.'),
'fundingSource' => $this->translator->trans('Funding source'),
'transactionIdentifier' => $this->translator->trans('Transaction identifier'),
'transactionStatus' => $this->translator->trans('Transaction status'),
'amountPaid' => $this->translator->trans('Amount paid'),
'orderIdentifier' => $this->translator->trans('Order identifier'),
'orderStatus' => $this->translator->trans('Order status'),
'externalRedirection' => $this->translator->trans('You will be redirected to an external secured page of our payment gateway.'),
'paymentMethodStatus' => $this->translator->trans('Payment method status'),
'paymentTokenSaved' => $this->translator->trans('was saved for future purchases'),
'paymentTokenNotSaved' => $this->translator->trans('was not saved for future purchases'),
'contactLink' => $this->translator->trans('If you have any question, please contact us.'),
'buttonApprove' => $this->translator->trans('Approve payment'),
'buttonPayerAction' => $this->translator->trans('Authenticate payment'),
],
];
}
/**
* @param PayPalOrderResponse|null $payPalOrderResponse
*
* @return string
*/
private function getTotalAmountFormatted($payPalOrderResponse): string
{
if (!$payPalOrderResponse || !$payPalOrderResponse->getTotalAmount() || !$payPalOrderResponse->getCurrencyCode()) {
return '';
}
if (is_callable(['Tools', 'getContextLocale'])) {
$locale = Tools::getContextLocale(Context::getContext());
return $locale->formatPrice((float) $payPalOrderResponse->getTotalAmount(), $payPalOrderResponse->getCurrencyCode());
} else {
return Tools::displayPrice(
(float) $payPalOrderResponse->getTotalAmount(),
Currency::getCurrencyInstance(Currency::getIdByIsoCode($payPalOrderResponse->getCurrencyCode()))
);
}
}
/**
* @param PayPalOrder $payPalOrder
*
* @return string
*/
private function getPaymentTokenIdentifier(PayPalOrder $payPalOrder): string
{
$fundingSource = $payPalOrder->getFundingSource();
$paymentSource = $payPalOrder->getPaymentSource()[$fundingSource] ?? null;
if (!$paymentSource) {
return '';
}
if ($fundingSource === 'card') {
return ($paymentSource['brand'] ?? '') . (isset($paymentSource['last_digits']) ? ' *' . $paymentSource['last_digits'] : '');
} else {
return $paymentSource['email_address'] ?? '';
}
}
/**
* @param PayPalOrder $payPalOrder
*
* @return bool
*/
private function isTokenSaved(PayPalOrder $payPalOrder): bool
{
$fundingSource = $payPalOrder->getFundingSource();
$paymentSource = $payPalOrder->getPaymentSource()[$fundingSource] ?? null;
if (!$paymentSource) {
return false;
}
return isset($paymentSource['attributes']['vault']['id']) &&
isset($paymentSource['attributes']['vault']['status']) &&
$paymentSource['attributes']['vault']['status'] === 'VAULTED';
}
}

View File

@@ -0,0 +1,37 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\OrderSummary;
use Order;
use PsCheckout\Core\Exception\PsCheckoutException;
interface OrderSummaryPresenterInterface
{
/**
* @param Order $order
*
* @return array
*
* @throws PsCheckoutException
* @throws \PrestaShopException
*/
public function present(Order $order): array;
}

View File

@@ -0,0 +1,29 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
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,162 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\PayPalOrder;
use PsCheckout\Api\ValueObject\PayPalOrderResponse;
use PsCheckout\Core\PayPal\Card3DSecure\Card3DSecureValidatorInterface;
use PsCheckout\Core\PayPal\Order\Configuration\PayPalOrderStatus;
use PsCheckout\Core\PayPal\Order\Entity\PayPalOrder;
use PsCheckout\Core\PayPal\Order\Repository\PayPalOrderRepositoryInterface;
use PsCheckout\Presentation\Presenter\FundingSource\FundingSourceTranslationProviderInterface;
use PsCheckout\Presentation\Presenter\FundingSource\LogoPresenterInterface;
use PsCheckout\Presentation\TranslatorInterface;
class PayPalOrderPresenter implements PayPalOrderPresenterInterface
{
/**
* @var PayPalOrderPresenterInterface
*/
private $payPalOrderTransactionPresenter;
/**
* @var PayPalOrderPresenterInterface
*/
private $payPalOrderTotalsPresenter;
/**
* @var Card3DSecureValidatorInterface
*/
private $card3DSecureValidator;
/**
* @var LogoPresenterInterface
*/
private $logoPresenter;
/**
* @var FundingSourceTranslationProviderInterface
*/
private $fundingSourceTranslationProvider;
/**
* @var TranslatorInterface
*/
private $translator;
/**
* @var PayPalOrderRepositoryInterface
*/
private $payPalOrderRepository;
/**
* @param PayPalOrderPresenterInterface $payPalOrderTransactionPresenter
* @param PayPalOrderPresenterInterface $payPalOrderTotalsPresenter
* @param Card3DSecureValidatorInterface $card3DSecureValidator
* @param LogoPresenterInterface $logoPresenter
* @param FundingSourceTranslationProviderInterface $fundingSourceTranslationProvider
* @param TranslatorInterface $translator
* @param PayPalOrderRepositoryInterface $payPalOrderRepository
*/
public function __construct(
PayPalOrderPresenterInterface $payPalOrderTransactionPresenter,
PayPalOrderPresenterInterface $payPalOrderTotalsPresenter,
Card3DSecureValidatorInterface $card3DSecureValidator,
LogoPresenterInterface $logoPresenter,
FundingSourceTranslationProviderInterface $fundingSourceTranslationProvider,
TranslatorInterface $translator,
PayPalOrderRepositoryInterface $payPalOrderRepository
) {
$this->payPalOrderTransactionPresenter = $payPalOrderTransactionPresenter;
$this->payPalOrderTotalsPresenter = $payPalOrderTotalsPresenter;
$this->card3DSecureValidator = $card3DSecureValidator;
$this->logoPresenter = $logoPresenter;
$this->fundingSourceTranslationProvider = $fundingSourceTranslationProvider;
$this->translator = $translator;
$this->payPalOrderRepository = $payPalOrderRepository;
}
/** {@inheritdoc} */
public function present(PaypalOrderResponse $paypalOrderResponse): array
{
$payPalOrder = $this->payPalOrderRepository->getOneBy(['id' => $paypalOrderResponse->getId()]);
$threeDSNotRequired = $payPalOrder && in_array(PayPalOrder::THREE_D_SECURE_NOT_REQUIRED, $payPalOrder->getTags());
return array_merge(
[
'id' => $paypalOrderResponse->getId(),
'intent' => $paypalOrderResponse->getIntent(),
'status' => $this->getOrderStatus($paypalOrderResponse),
'is3DSNotRequired' => $threeDSNotRequired,
'is3DSecureAvailable' => $this->card3DSecureValidator->is3DSecureAvailable($paypalOrderResponse),
'isLiabilityShifted' => $this->card3DSecureValidator->isLiabilityShifted($paypalOrderResponse),
'paymentSourceName' => $this->fundingSourceTranslationProvider->getFundingSourceName(key($paypalOrderResponse->getPaymentSource())),
'paymentSourceLogo' => $this->logoPresenter->getLogoByPaymentSource($paypalOrderResponse->getPaymentSource()),
],
$this->payPalOrderTransactionPresenter->present($paypalOrderResponse),
$this->payPalOrderTotalsPresenter->present($paypalOrderResponse)
);
}
/**
* @param PaypalOrderResponse $paypalOrderResponse
*
* @return array
*/
private function getOrderStatus(PaypalOrderResponse $paypalOrderResponse): array
{
switch ($paypalOrderResponse->getStatus()) {
case PayPalOrderStatus::CREATED:
$translated = $this->translator->trans('Created');
$class = 'info';
break;
case PayPalOrderStatus::SAVED:
$translated = $this->translator->trans('Saved');
$class = 'info';
break;
case PayPalOrderStatus::APPROVED:
$translated = $this->translator->trans('Approved');
$class = 'info';
break;
case PayPalOrderStatus::VOIDED:
$translated = $this->translator->trans('Voided');
$class = 'warning';
break;
case PayPalOrderStatus::COMPLETED:
$translated = $this->translator->trans('Completed');
$class = 'success';
break;
default:
$translated = '';
$class = '';
}
return [
'value' => $paypalOrderResponse->getStatus(),
'translated' => $translated,
'class' => $class,
];
}
}

View File

@@ -0,0 +1,33 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\PayPalOrder;
use PsCheckout\Api\ValueObject\PayPalOrderResponse;
interface PayPalOrderPresenterInterface
{
/**
* @param PaypalOrderResponse $paypalOrderResponse
*
* @return array
*/
public function present(PaypalOrderResponse $paypalOrderResponse): array;
}

View File

@@ -0,0 +1,65 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\PayPalOrder;
use PsCheckout\Api\ValueObject\PayPalOrderResponse;
class PayPalOrderTotalsPresenter implements PayPalOrderPresenterInterface
{
/** {@inheritdoc} */
public function present(PaypalOrderResponse $paypalOrderResponse): array
{
$total = 0.0;
$totalRefunded = 0.0;
$fees = 0.0;
$currency = '';
foreach ($paypalOrderResponse->getPurchaseUnits() as $purchase) {
if (empty($purchase['payments'])) {
continue;
}
$currency = $purchase['amount']['currency_code'];
if (!empty($purchase['payments']['refunds'])) {
foreach ($purchase['payments']['refunds'] as $refund) {
$totalRefunded += $refund['amount']['value'];
}
}
if (!empty($purchase['payments']['captures'])) {
foreach ($purchase['payments']['captures'] as $payment) {
$total += $payment['amount']['value'];
if (isset($payment['seller_receivable_breakdown']['paypal_fee']['value'])) {
$fees -= $payment['seller_receivable_breakdown']['paypal_fee']['value'];
}
}
}
}
return [
'total' => number_format($total, 2) . " $currency",
'fees' => number_format($fees, 2) . " $currency",
'balance' => number_format($total - $totalRefunded + $fees, 2) . " $currency",
];
}
}

View File

@@ -0,0 +1,297 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\PayPalOrder;
use PsCheckout\Api\ValueObject\PayPalOrderResponse;
use PsCheckout\Presentation\Presenter\Date\DatePresenterInterface;
use PsCheckout\Presentation\TranslatorInterface;
class PayPalOrderTransactionPresenter implements PayPalOrderPresenterInterface
{
/**
* @var DatePresenterInterface
*/
private $datePresenter;
/**
* @var TranslatorInterface
*/
private $translator;
/**
* @param DatePresenterInterface $datePresenter
* @param TranslatorInterface $translator
*/
public function __construct(
DatePresenterInterface $datePresenter,
TranslatorInterface $translator
) {
$this->datePresenter = $datePresenter;
$this->translator = $translator;
}
/** {@inheritdoc} */
public function present(PaypalOrderResponse $paypalOrderResponse): array
{
return [
'transactions' => $this->getTransactions($paypalOrderResponse),
];
}
/**
* @param PaypalOrderResponse $paypalOrderResponse
*
* @return array
*/
private function getTransactions(PaypalOrderResponse $paypalOrderResponse): array
{
$transactions = [];
foreach ($paypalOrderResponse->getPurchaseUnits() as $purchase) {
if (empty($purchase['payments'])) {
continue;
}
$totalRefunded = 0;
if (!empty($purchase['payments']['refunds'])) {
foreach ($purchase['payments']['refunds'] as $refund) {
$totalRefunded += $refund['amount']['value'];
$transactions[] = [
'type' => $this->getTransactionType('refund'),
'id' => $refund['id'],
'status' => $this->getTransactionStatus($refund['status']),
'amount' => $refund['amount']['value'],
'currency' => $refund['amount']['currency_code'],
'date' => $this->datePresenter->present($refund['create_time'], 'Y-m-d H:i:s'),
'isRefundable' => false,
'maxAmountRefundable' => 0,
'gross_amount' => $refund['seller_payable_breakdown']['gross_amount']['value'] ?? '',
'paypal_fee' => $refund['seller_payable_breakdown']['paypal_fee']['value'] ?? '',
'net_amount' => $refund['seller_payable_breakdown']['net_amount']['value'] ?? '',
];
}
}
if (!empty($purchase['payments']['captures'])) {
foreach ($purchase['payments']['captures'] as $payment) {
$maxAmountRefundable = $payment['amount']['value'] - $totalRefunded;
$transactions[] = [
'type' => $this->getTransactionType('capture'),
'id' => $payment['id'],
'status' => $this->getTransactionStatus($payment['status']),
'amount' => $payment['amount']['value'],
'currency' => $payment['amount']['currency_code'],
'date' => $this->datePresenter->present($payment['create_time'], 'Y-m-d H:i:s'),
'isRefundable' => in_array($payment['status'], ['COMPLETED', 'PARTIALLY_REFUNDED']),
'maxAmountRefundable' => $maxAmountRefundable > 0 ? $maxAmountRefundable : 0,
'gross_amount' => $payment['seller_receivable_breakdown']['gross_amount']['value'] ?? '',
'paypal_fee' => $payment['seller_receivable_breakdown']['paypal_fee']['value'] ?? '',
'net_amount' => $payment['seller_receivable_breakdown']['net_amount']['value'] ?? '',
'seller_protection' => $this->getSellerProtection($payment),
];
}
}
}
if (!empty($transactions)) {
uasort($transactions, function (array $transactionA, array $transactionB) {
return strtotime($transactionB['date']) - strtotime($transactionA['date']);
});
}
return $transactions;
}
/**
* @param string $type
*
* @return array
*/
private function getTransactionType(string $type): array
{
switch ($type) {
case 'capture':
$translated = $this->translator->trans('Payment');
$class = 'payment';
break;
case 'refund':
$translated = $this->translator->trans('Refund');
$class = 'refund';
break;
default:
$translated = '';
$class = '';
}
return [
'value' => $type,
'translated' => $translated,
'class' => $class,
];
}
/**
* @param string $status
*
* @return array
*/
private function getTransactionStatus(string $status): array
{
switch ($status) {
case 'COMPLETED':
$translated = $this->translator->trans('Completed');
$class = 'success';
break;
case 'PENDING':
$translated = $this->translator->trans('Pending');
$class = 'warning';
break;
case 'DECLINED':
$translated = $this->translator->trans('Declined');
$class = 'danger';
break;
case 'PARTIALLY_REFUNDED':
$translated = $this->translator->trans('Partially refunded');
$class = 'info';
break;
case 'REFUNDED':
$translated = $this->translator->trans('Refunded');
$class = 'info';
break;
default:
$translated = '';
$class = '';
}
return [
'value' => $status,
'translated' => $translated,
'class' => $class,
];
}
/**
* @param array $payment
*
* @return array
*/
private function getSellerProtection(array $payment): array
{
if (empty($payment['seller_protection'])) {
return [];
}
$help = [];
$status = isset($payment['seller_protection']['status']) ? $payment['seller_protection']['status'] : '';
$dispute_categories = isset($payment['seller_protection']['dispute_categories']) ? $this->getDisputeCategoriesValues($payment['seller_protection']['dispute_categories']) : [];
switch ($status) {
case 'ELIGIBLE':
$help[] = $this->translator->trans('Your PayPal balance remains intact if the customer claims that they did not receive an item or the account holder claims that they did not authorize the payment.');
if (!empty($dispute_categories)) {
$help[] = $this->translator->trans('Dispute categories covered:');
$help[] = implode(', ', $dispute_categories);
}
$help[] = $this->translator->trans('For more information, please go to the official PayPal website.');
return [
'value' => $status,
'translated' => $this->translator->trans('Eligible'),
'help' => implode(' ', $help),
'class' => 'success',
];
case 'PARTIALLY_ELIGIBLE':
$help[] = $this->translator->trans('Your PayPal balance remains intact if the customer claims that they did not receive an item.');
if (!empty($dispute_categories)) {
$help[] = $this->translator->trans('Dispute categories covered:');
$help[] = implode(', ', $dispute_categories);
}
$help[] = $this->translator->trans('For more information, please go to the official PayPal website.');
return [
'value' => $status,
'translated' => $this->translator->trans('Partially eligible'),
'help' => implode(' ', $help),
'class' => 'info',
];
case 'NOT_ELIGIBLE':
$help[] = $this->translator->trans('Your PayPal balance is not protected, the transaction is not eligible to the seller protection program.');
if (!empty($dispute_categories)) {
$help[] = $this->translator->trans('Dispute categories covered:');
$help[] = implode(', ', $dispute_categories);
}
$help[] = $this->translator->trans('For more information, please go to the official PayPal website.');
return [
'value' => $status,
'translated' => $this->translator->trans('Not eligible'),
'help' => implode(' ', $help),
'class' => 'warning',
];
default:
return [
'value' => $status,
'translated' => $status,
'help' => $status,
'class' => 'info',
];
}
}
/**
* @param array $dispute_categories
*
* @return array
*/
private function getDisputeCategoriesValues(array $dispute_categories): array
{
$disputeCategories = [];
foreach ($dispute_categories as $dispute_category) {
switch ($dispute_category) {
case 'ITEM_NOT_RECEIVED':
$disputeCategories['ITEM_NOT_RECEIVED'] = $this->translator->trans('The payer paid for an item that they did not receive.');
break;
case 'UNAUTHORIZED_TRANSACTION':
$disputeCategories['UNAUTHORIZED_TRANSACTION'] = $this->translator->trans('The payer did not authorize the payment.');
break;
}
}
return $disputeCategories;
}
}

View File

@@ -0,0 +1,29 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
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,29 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter;
interface PresenterInterface
{
/**
* @return array
*/
public function present(): array;
}

View File

@@ -0,0 +1,73 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\Settings\Admin;
use PsCheckout\Presentation\Presenter\PresenterInterface;
/**
* Present the store to the vuejs app (vuex)
*/
class AdminSettingsPresenter implements PresenterInterface
{
/**
* @var PresenterInterface[]
*/
private $presenters;
/**
* @var array
*/
private $store;
/**
* @param PresenterInterface[] $presenters
* @param array $store
*/
public function __construct(array $presenters, array $store = [])
{
// Allow to set a custom store for tests purpose
if (null !== $store) {
$this->store = $store;
}
$this->presenters = $presenters;
}
/**
* Build the store required by vuex
*
* @return array
*/
public function present(): array
{
if ([] !== $this->store) {
return $this->store;
}
foreach ($this->presenters as $presenter) {
if ($presenter instanceof PresenterInterface) {
$this->store = array_merge($this->store, $presenter->present());
}
}
return $this->store;
}
}

View File

@@ -0,0 +1,157 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\Settings\Admin\Modules;
use Monolog\Logger;
use PsCheckout\Core\Settings\Configuration\LoggerConfiguration;
use PsCheckout\Core\Settings\Configuration\PayPalConfiguration;
use PsCheckout\Core\Settings\Configuration\PayPalExpressCheckoutConfiguration;
use PsCheckout\Core\Settings\Configuration\PayPalPayLaterConfiguration;
use PsCheckout\Infrastructure\Adapter\ConfigurationInterface;
use PsCheckout\Presentation\Presenter\FundingSource\FundingSourcePresenterInterface;
use PsCheckout\Presentation\Presenter\PresenterInterface;
/**
* Construct the configuration module
*/
class ConfigurationModule implements PresenterInterface
{
/**
* @var int
*/
private $moduleId;
/**
* @var ConfigurationInterface
*/
private $configuration;
/**
* @var FundingSourcePresenterInterface
*/
private $fundingSourcePresenter;
/**
* @var int
*/
private $shopId;
/**
* @param int $moduleId
* @param ConfigurationInterface $configuration
* @param FundingSourcePresenterInterface $fundingSourcePresenter
* @param int $shopId
*/
public function __construct(
int $moduleId,
ConfigurationInterface $configuration,
FundingSourcePresenterInterface $fundingSourcePresenter,
int $shopId
) {
$this->moduleId = $moduleId;
$this->configuration = $configuration;
$this->fundingSourcePresenter = $fundingSourcePresenter;
$this->shopId = $shopId;
}
/**
* Present the paypal module (vuex)
*
* @return array
*/
public function present(): array
{
return [
'config' => [
'paymentMethods' => $this->fundingSourcePresenter->getAllForSpecificShop($this->shopId),
'nonDecimalCurrencies' => $this->checkNonDecimalCurrencies(),
'cardIsEnabled' => $this->configuration->getBoolean(PayPalConfiguration::PS_CHECKOUT_CARD_PAYMENT_ENABLED),
'paypalButton' => $this->configuration->getDeserializedRaw(PayPalConfiguration::PS_CHECKOUT_PAYPAL_BUTTON),
'expressCheckout' => [
'orderPage' => $this->configuration->getBoolean(PayPalExpressCheckoutConfiguration::PS_CHECKOUT_EC_ORDER_PAGE),
'checkoutPage' => $this->configuration->getBoolean(PayPalExpressCheckoutConfiguration::PS_CHECKOUT_EC_CHECKOUT_PAGE),
'productPage' => $this->configuration->getBoolean(PayPalExpressCheckoutConfiguration::PS_CHECKOUT_EC_PRODUCT_PAGE),
],
'payLater' => [
'orderPage' => [
'button' => $this->configuration->getBoolean(PayPalPayLaterConfiguration::PS_CHECKOUT_PAY_LATER_ORDER_PAGE_BUTTON),
],
'cartPage' => [
'button' => $this->configuration->getBoolean(PayPalPayLaterConfiguration::PS_CHECKOUT_PAY_LATER_CART_PAGE_BUTTON),
],
'productPage' => [
'button' => $this->configuration->getBoolean(PayPalPayLaterConfiguration::PS_CHECKOUT_PAY_LATER_PRODUCT_PAGE_BUTTON),
],
],
'logger' => [
'levels' => [
Logger::DEBUG => 'DEBUG : Detailed debug information',
// Logger::INFO => 'INFO : Interesting events',
// Logger::NOTICE => 'NOTICE : Normal but significant events',
// Logger::WARNING => 'WARNING : Exceptional occurrences that are not errors',
Logger::ERROR => 'ERROR : Runtime errors that do not require immediate action',
// Logger::CRITICAL => 'CRITICAL : Critical conditions',
// Logger::ALERT => 'ALERT : Action must be taken immediately',
// Logger::EMERGENCY => 'EMERGENCY : system is unusable',
],
'httpFormats' => [
'CLF' => 'Apache Common Log Format',
'DEBUG' => 'Debug format',
'SHORT' => 'Short format',
],
'level' => $this->configuration->getInteger(LoggerConfiguration::PS_CHECKOUT_LOGGER_LEVEL),
'maxFiles' => $this->configuration->getInteger(LoggerConfiguration::PS_CHECKOUT_LOGGER_MAX_FILES),
'http' => $this->configuration->getInteger(LoggerConfiguration::PS_CHECKOUT_LOGGER_HTTP),
'httpFormat' => $this->configuration->get(LoggerConfiguration::PS_CHECKOUT_LOGGER_HTTP_FORMAT),
],
],
];
}
/**
* Checks if any currencies are enabled for which PayPal doesn't support decimal values
* Returns error message with listed currencies that have to be configured correctly
*
* @return array
*/
private function checkNonDecimalCurrencies(): array
{
$nonDecimalCurrencies = ['HUF', 'JPY', 'TWD'];
// Enabled currencies for PrestaShop Checkout
$enabledCurrencies = \Currency::getPaymentCurrencies($this->moduleId);
$misConfiguredCurrencies = [];
foreach ($enabledCurrencies as $currency) {
if (in_array($currency['iso_code'], $nonDecimalCurrencies)) {
$misConfiguredCurrencies[] = $currency['iso_code'];
}
}
$implodedMisconfiguredCurrencies = implode(', ', $misConfiguredCurrencies);
return [
'showError' => !empty($misConfiguredCurrencies),
'currencies' => $implodedMisconfiguredCurrencies,
];
}
}

View File

@@ -0,0 +1,206 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\Settings\Admin\Modules;
use PsCheckout\Core\Settings\Configuration\PayPalConfiguration;
use PsCheckout\Infrastructure\Adapter\ConfigurationInterface;
use PsCheckout\Infrastructure\Adapter\ContextInterface;
use PsCheckout\Infrastructure\Adapter\LinkInterface;
use PsCheckout\Infrastructure\Environment\EnvInterface;
use PsCheckout\Presentation\Presenter\PresenterInterface;
/**
* Construct the context module
*/
class ContextModule implements PresenterInterface
{
/**
* @var string
*/
private $moduleName;
/**
* @var string
*/
private $moduleVersion;
/**
* @var ContextInterface
*/
private $context;
/**
* @var LinkInterface
*/
private $link;
/**
* @var ConfigurationInterface
*/
private $configuration;
/**
* @var EnvInterface
*/
private $env;
/**
* @param string $moduleName
* @param string $moduleVersion
* @param ContextInterface $context
* @param LinkInterface $link
* @param ConfigurationInterface $configuration
*/
public function __construct(
string $moduleName,
string $moduleVersion,
ContextInterface $context,
LinkInterface $link,
ConfigurationInterface $configuration,
EnvInterface $env
) {
$this->moduleName = $moduleName;
$this->moduleVersion = $moduleVersion;
$this->context = $context;
$this->link = $link;
$this->configuration = $configuration;
$this->env = $env;
}
/**
* Present the context module (vuex)
*
* @return array
*/
public function present(): array
{
$shopId = (int) \Context::getContext()->shop->id;
return [
'context' => [
'moduleVersion' => $this->moduleVersion,
'moduleIsEnabled' => (bool) \Module::isEnabled('ps_checkout'),
'psVersion' => _PS_VERSION_,
'phpVersion' => phpversion(),
'shopUri' => $this->getShopUri($shopId),
'isShopContext' => $this->isShopContext(),
'shopsTree' => $this->getShopsTree(),
'language' => $this->context->getLanguage(),
'roundingSettingsIsCorrect' => $this->isRoundingSettingsCorrect(),
'overridesExist' => $this->overridesExist(),
'prestashopCheckoutAjax' => $this->link->getAdminLink('AdminAjaxPrestashopCheckout'),
'paymentPreferencesLink' => $this->link->getAdminLink('AdminPaymentPreferences'),
'maintenanceLink' => $this->link->getAdminLink('AdminMaintenance'),
'callbackUrl' => $this->link->getAdminLink(
'AdminModules',
true,
[],
[
'configure' => $this->moduleName,
]
),
'clientId' => $this->env->getPaypalClientId(),
'bnCode' => $this->env->getBnCode(),
],
];
}
/**
* @param int $shopId
*
* @return bool|string
*/
private function getShopUri(int $shopId)
{
return (new \Shop($shopId))->getBaseURL();
}
/**
* @return bool
*/
private function isShopContext(): bool
{
if (\Shop::isFeatureActive() && \Shop::getContext() !== \Shop::CONTEXT_SHOP) {
return false;
}
return true;
}
/**
* @return array
*/
private function getShopsTree(): array
{
$shopList = [];
if (true === $this->isShopContext()) {
return $shopList;
}
foreach (\Shop::getTree() as $groupId => $groupData) {
$shops = [];
foreach ($groupData['shops'] as $shopId => $shopData) {
$shops[] = [
'id' => $shopId,
'name' => $shopData['name'],
'url' => $this->link->getAdminLink(
'AdminModules',
true,
[],
[
'configure' => $this->moduleName,
'setShopContext' => 's-' . $shopId,
]
),
];
}
$shopList[] = [
'id' => $groupId,
'name' => $groupData['name'],
'shops' => $shops,
];
}
return $shopList;
}
/**
* Get bool value if there are overrides for ps_checkout
*
* @return bool
*/
private function overridesExist(): bool
{
$moduleOverridePath = _PS_OVERRIDE_DIR_ . 'modules/' . $this->moduleName;
$themeModuleOverridePath = _PS_ALL_THEMES_DIR_ . $this->context->getCurrentThemeName() . '/modules/' . $this->moduleName;
return is_dir($moduleOverridePath) || is_dir($themeModuleOverridePath);
}
private function isRoundingSettingsCorrect(): bool
{
return $this->configuration->get(PayPalConfiguration::PS_ROUND_TYPE) === PayPalConfiguration::ROUND_ON_EACH_ITEM
&& $this->configuration->get(PayPalConfiguration::PS_PRICE_ROUND_MODE) === PayPalConfiguration::ROUND_UP_AWAY_FROM_ZERO;
}
}

View File

@@ -0,0 +1,59 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\Settings\Admin\Modules;
use PsCheckout\Core\Settings\Configuration\PayPalConfiguration;
use PsCheckout\Infrastructure\Adapter\ConfigurationInterface;
use PsCheckout\Presentation\Presenter\PresenterInterface;
/**
* Construct the PayPal module
*/
class PaypalModule implements PresenterInterface
{
/**
* @var ConfigurationInterface
*/
private $configuration;
/**
* @param ConfigurationInterface $configuration
*/
public function __construct(ConfigurationInterface $configuration)
{
$this->configuration = $configuration;
}
/**
* Present the paypal module (vuex)
*
* @return array
*/
public function present(): array
{
return [
'paypal' => [
'idMerchant' => $this->configuration->get(PayPalConfiguration::PS_CHECKOUT_PAYPAL_ID_MERCHANT),
'paypalIsActive' => $this->configuration->getBoolean(PayPalConfiguration::PS_CHECKOUT_PAYPAL_PAYMENT_STATUS),
],
];
}
}

View File

@@ -0,0 +1,29 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
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,29 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
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,57 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\Settings\Front;
use PsCheckout\Presentation\Presenter\PresenterInterface;
class FrontSettingsPresenter implements PresenterInterface
{
/**
* @var PresenterInterface[]
*/
private $presenters;
/**
* @param PresenterInterface[] $presenters
*/
public function __construct(array $presenters)
{
$this->presenters = $presenters;
}
/**
* Build the JS media required by Front SDK
*
* @return array
*/
public function present(): array
{
$settings = [];
foreach ($this->presenters as $presenter) {
if ($presenter instanceof PresenterInterface) {
$settings = array_merge($settings, $presenter->present());
}
}
return $settings;
}
}

View File

@@ -0,0 +1,139 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\Settings\Front\Modules;
use PsCheckout\Core\FundingSource\Constraint\FundingSourceConstraint;
use PsCheckout\Core\Settings\Configuration\PayPalConfiguration;
use PsCheckout\Core\Settings\Configuration\PayPalExpressCheckoutConfiguration;
use PsCheckout\Core\Settings\Configuration\PayPalPayLaterConfiguration;
use PsCheckout\Core\Settings\Configuration\PayPalSdkConfiguration;
use PsCheckout\Infrastructure\Adapter\ConfigurationInterface;
use PsCheckout\Infrastructure\Adapter\ContextInterface;
use PsCheckout\Infrastructure\Validator\PayLaterValidatorInterface;
use PsCheckout\Presentation\Presenter\FundingSource\FundingSourcePresenterInterface;
use PsCheckout\Presentation\Presenter\PresenterInterface;
class ConfigurationModule implements PresenterInterface
{
/**
* @var string
*/
private $moduleName;
/**
* @var ContextInterface
*/
private $context;
/**
* @var ConfigurationInterface
*/
private $configuration;
/**
* @var PayPalConfiguration
*/
private $payPalConfiguration;
/**
* @var FundingSourcePresenterInterface
*/
private $fundingSourcePresenter;
/**
* @var PayPalSdkConfiguration
*/
private $payPalSdkConfiguration;
/**
* @var PayPalPayLaterConfiguration
*/
private $payLaterConfiguration;
/**
* @var PayLaterValidatorInterface
*/
private $payLaterValidator;
/**
* @param string $moduleName
* @param ContextInterface $context
* @param ConfigurationInterface $configuration
* @param PayPalConfiguration $payPalConfiguration
* @param FundingSourcePresenterInterface $fundingSourcePresenter
* @param PayPalSdkConfiguration $payPalSdkConfiguration
* @param PayPalPayLaterConfiguration $payLaterConfiguration
* @param PayLaterValidatorInterface $payLaterValidator
*/
public function __construct(
string $moduleName,
ContextInterface $context,
ConfigurationInterface $configuration,
PayPalConfiguration $payPalConfiguration,
FundingSourcePresenterInterface $fundingSourcePresenter,
PayPalSdkConfiguration $payPalSdkConfiguration,
PayPalPayLaterConfiguration $payLaterConfiguration,
PayLaterValidatorInterface $payLaterValidator
) {
$this->moduleName = $moduleName;
$this->context = $context;
$this->configuration = $configuration;
$this->payPalConfiguration = $payPalConfiguration;
$this->fundingSourcePresenter = $fundingSourcePresenter;
$this->payPalSdkConfiguration = $payPalSdkConfiguration;
$this->payLaterConfiguration = $payLaterConfiguration;
$this->payLaterValidator = $payLaterValidator;
}
public function present(): array
{
$isCardAvailable = false;
foreach ($this->fundingSourcePresenter->getAllActiveForSpecificShop($this->context->getShop()->id) as $fundingSource) {
if ('card' === $fundingSource->getName()) {
$isCardAvailable = $fundingSource->getIsEnabled();
break;
}
}
$isPayPalPaymentsReceivable = $this->configuration->getBoolean(PayPalConfiguration::PS_CHECKOUT_PAYPAL_PAYMENT_STATUS);
$isPayLaterAvailable = $this->payLaterValidator->isPayLaterAvailable();
return [
$this->moduleName . 'PayPalSdkConfig' => $this->payPalSdkConfiguration->buildConfiguration(),
$this->moduleName . 'PayPalEnvironment' => $this->configuration->get(PayPalConfiguration::PS_CHECKOUT_PAYMENT_MODE),
$this->moduleName . 'PayPalButtonConfiguration' => $this->configuration->getDeserializedRaw(PayPalConfiguration::PS_CHECKOUT_PAYPAL_BUTTON),
$this->moduleName . 'AutoRenderDisabled' => $this->configuration->getBoolean('PS_CHECKOUT_AUTO_RENDER_DISABLED'),
$this->moduleName . 'HostedFieldsEnabled' => $isCardAvailable && $this->configuration->getBoolean(PayPalConfiguration::PS_CHECKOUT_CARD_HOSTED_FIELDS_ENABLED) && in_array($this->configuration->get(PayPalConfiguration::PS_CHECKOUT_CARD_HOSTED_FIELDS_STATUS), ['SUBSCRIBED', 'LIMITED'], true),
$this->moduleName . 'HostedFieldsContingencies' => $this->payPalConfiguration->getCardFieldsContingencies(),
$this->moduleName . 'ExpressCheckoutCartEnabled' => $this->configuration->getBoolean(PayPalExpressCheckoutConfiguration::PS_CHECKOUT_EC_ORDER_PAGE) && $isPayPalPaymentsReceivable,
$this->moduleName . 'ExpressCheckoutOrderEnabled' => $this->configuration->getBoolean(PayPalExpressCheckoutConfiguration::PS_CHECKOUT_EC_CHECKOUT_PAGE) && $isPayPalPaymentsReceivable,
$this->moduleName . 'ExpressCheckoutProductEnabled' => $this->configuration->getBoolean(PayPalExpressCheckoutConfiguration::PS_CHECKOUT_EC_PRODUCT_PAGE) && $isPayPalPaymentsReceivable,
$this->moduleName . 'PayLaterOrderPageButtonEnabled' => $this->configuration->getBoolean(PayPalPayLaterConfiguration::PS_CHECKOUT_PAY_LATER_ORDER_PAGE_BUTTON) && $isPayPalPaymentsReceivable,
$this->moduleName . 'PayLaterCartPageButtonEnabled' => $this->configuration->getBoolean(PayPalPayLaterConfiguration::PS_CHECKOUT_PAY_LATER_CART_PAGE_BUTTON) && $isPayPalPaymentsReceivable,
$this->moduleName . 'PayLaterProductPageButtonEnabled' => $this->configuration->getBoolean(PayPalPayLaterConfiguration::PS_CHECKOUT_PAY_LATER_PRODUCT_PAGE_BUTTON) && $isPayPalPaymentsReceivable,
$this->moduleName . 'PayLaterMessagingConfig' => $isPayPalPaymentsReceivable && $isPayLaterAvailable
? $this->payLaterConfiguration->getPayLaterMessagingConfiguration()
: $this->payLaterConfiguration->getPayLaterMessagingConfigurationDefault(),
];
}
}

View File

@@ -0,0 +1,74 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\Settings\Front\Modules;
use PsCheckout\Infrastructure\Adapter\LinkInterface;
use PsCheckout\Infrastructure\Adapter\ToolsInterface;
use PsCheckout\Presentation\Presenter\PresenterInterface;
class LinkModule implements PresenterInterface
{
/**
* @var string
*/
private $moduleName;
/**
* @var LinkInterface
*/
private $link;
/**
* @var ToolsInterface
*/
private $tools;
public function __construct(
string $moduleName,
LinkInterface $link,
ToolsInterface $tools
) {
$this->moduleName = $moduleName;
$this->link = $link;
$this->tools = $tools;
}
public function present(): array
{
$params = [
'token' => $this->tools->getToken(false),
];
return [
$this->moduleName . 'CreateUrl' => $this->link->getModuleLink('create', $params),
$this->moduleName . 'CheckUrl' => $this->link->getModuleLink('check', $params),
$this->moduleName . 'ValidateUrl' => $this->link->getModuleLink('validate', $params),
$this->moduleName . 'CancelUrl' => $this->link->getModuleLink('cancel', $params),
$this->moduleName . 'ExpressCheckoutUrl' => $this->link->getModuleLink('ExpressCheckout', $params),
$this->moduleName . 'VaultUrl' => $this->link->getModuleLink('vault', $params),
$this->moduleName . 'PaymentUrl' => $this->link->getModuleLink('payment', $params),
$this->moduleName . 'GooglePayUrl' => $this->link->getModuleLink('googlepay', $params),
$this->moduleName . 'ApplePayUrl' => $this->link->getModuleLink('applepay', $params),
$this->moduleName . 'CheckoutUrl' => $this->link->getPageLink('order'),
$this->moduleName . 'ConfirmUrl' => $this->link->getPageLink('order-confirmation'),
];
}
}

View File

@@ -0,0 +1,69 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\Settings\Front\Modules;
use PsCheckout\Presentation\Presenter\PresenterInterface;
class MediaModule implements PresenterInterface
{
/**
* @var string
*/
private $moduleName;
/**
* @var string
*/
private $modulePathUri;
/**
* @param string $moduleName
* @param string $modulePathUri
*/
public function __construct(
string $moduleName,
string $modulePathUri
) {
$this->moduleName = $moduleName;
$this->modulePathUri = $modulePathUri;
}
public function present(): array
{
return [
$this->moduleName . 'CardLogos' => [
'AMEX' => $this->modulePathUri . 'views/img/amex.svg',
'CB_NATIONALE' => $this->modulePathUri . 'views/img/cb.svg',
'DINERS' => $this->modulePathUri . 'views/img/diners.svg',
'DISCOVER' => $this->modulePathUri . 'views/img/discover.svg',
'JCB' => $this->modulePathUri . 'views/img/jcb.svg',
'MAESTRO' => $this->modulePathUri . 'views/img/maestro.svg',
'MASTERCARD' => $this->modulePathUri . 'views/img/mastercard.svg',
'UNIONPAY' => $this->modulePathUri . 'views/img/unionpay.svg',
'VISA' => $this->modulePathUri . 'views/img/visa.svg',
],
$this->moduleName . 'LoaderImage' => $this->modulePathUri . 'views/img/loader.svg',
$this->moduleName . 'CardFundingSourceImg' => $this->modulePathUri . 'views/img/payment-cards.png',
$this->moduleName . 'PaymentMethodLogosTitleImg' => $this->modulePathUri . 'views/img/icons/lock_checkout.svg',
$this->moduleName . 'IconsPath' => $this->modulePathUri . 'views/img/icons/',
];
}
}

View File

@@ -0,0 +1,153 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\Settings\Front\Modules;
use PsCheckout\Core\PayPal\Order\Repository\PayPalOrderRepositoryInterface;
use PsCheckout\Core\Settings\Configuration\PayPalCardConfiguration;
use PsCheckout\Infrastructure\Adapter\ContextInterface;
use PsCheckout\Infrastructure\Environment\EnvInterface;
use PsCheckout\Presentation\Presenter\FundingSource\FundingSourcePresenterInterface;
use PsCheckout\Presentation\Presenter\FundingSource\FundingSourceTokenPresenterInterface;
use PsCheckout\Presentation\Presenter\FundingSource\FundingSourceTranslationProviderInterface;
use PsCheckout\Presentation\Presenter\PresenterInterface;
class PayPalModule implements PresenterInterface
{
/**
* @var string
*/
private $moduleName;
/**
* @var string
*/
private $moduleVersion;
/**
* @var ContextInterface
*/
private $context;
/**
* @var EnvInterface
*/
private $env;
/**
* @var FundingSourcePresenterInterface
*/
private $fundingSourcePresenter;
/**
* @var FundingSourcePresenterInterface
*/
private $fundingSourceTokenPresenter;
/**
* @var PresenterInterface
*/
private $supportedCardBrandsPresenter;
/**
* @var PayPalOrderRepositoryInterface
*/
private $payPalOrderRepository;
/**
* @var FundingSourceTranslationProviderInterface
*/
private $fundingSourceTranslationProvider;
/**
* @param string $moduleName
* @param string $moduleVersion
* @param ContextInterface $context,
* @param EnvInterface $env
* @param FundingSourcePresenterInterface $fundingSourcePresenter
* @param FundingSourceTokenPresenterInterface $fundingSourceTokenPresenter
* @param PresenterInterface $supportedCardBrandsPresenter
* @param PayPalOrderRepositoryInterface $payPalOrderRepository
* @param FundingSourceTranslationProviderInterface $fundingSourceTranslationProvider
*/
public function __construct(
string $moduleName,
string $moduleVersion,
ContextInterface $context,
EnvInterface $env,
FundingSourcePresenterInterface $fundingSourcePresenter,
FundingSourceTokenPresenterInterface $fundingSourceTokenPresenter,
PresenterInterface $supportedCardBrandsPresenter,
PayPalOrderRepositoryInterface $payPalOrderRepository,
FundingSourceTranslationProviderInterface $fundingSourceTranslationProvider
) {
$this->moduleName = $moduleName;
$this->moduleVersion = $moduleVersion;
$this->context = $context;
$this->env = $env;
$this->fundingSourcePresenter = $fundingSourcePresenter;
$this->fundingSourceTokenPresenter = $fundingSourceTokenPresenter;
$this->supportedCardBrandsPresenter = $supportedCardBrandsPresenter;
$this->payPalOrderRepository = $payPalOrderRepository;
$this->fundingSourceTranslationProvider = $fundingSourceTranslationProvider;
}
public function present(): array
{
$fundingSourcesSorted = [];
$payWithTranslations = [];
$customMarks = [];
foreach ($this->fundingSourceTokenPresenter->getFundingSourceTokens($this->context->getCustomer()->id ?? 0) as $fundingSource) {
$fundingSourcesSorted[] = $fundingSource->getName();
$payWithTranslations[$fundingSource->getName()] = $fundingSource->getLabel();
$customMarks[$fundingSource->getName()] = $fundingSource->getCustomMark();
}
foreach ($this->fundingSourcePresenter->getAllActiveForSpecificShop($this->context->getShop()->id) as $fundingSource) {
$fundingSourcesSorted[] = $fundingSource->getName();
$payWithTranslations[$fundingSource->getName()] = $this->fundingSourceTranslationProvider->getPaymentMethodName(
$fundingSource->getName(),
$fundingSource->getLabel()
);
if ($fundingSource->getCustomMark()) {
$customMarks[$fundingSource->getName()] = $fundingSource->getCustomMark();
}
}
if (isset($this->context->getCart()->id)) {
$payPalOrder = $this->payPalOrderRepository->getOneByCartId($this->context->getCart()->id);
}
return [
$this->moduleName . 'Version' => $this->moduleVersion,
$this->moduleName . 'CustomMarks' => $customMarks,
$this->moduleName . 'CardBrands' => $this->supportedCardBrandsPresenter->present() ?: PayPalCardConfiguration::DEFAULT_SUPPORTED_CARDS,
$this->moduleName . 'PayPalOrderId' => isset($payPalOrder) ? $payPalOrder->getId() : '',
$this->moduleName . 'FundingSource' => isset($payPalOrder) ? $payPalOrder->getFundingSource() : 'paypal',
$this->moduleName . 'ExpressCheckoutSelected' => isset($payPalOrder) && $payPalOrder->isExpressCheckout(),
$this->moduleName . 'PartnerAttributionId' => $this->env->getBnCode(),
$this->moduleName . 'CartProductCount' => $this->context->getCart()->nbProducts(),
$this->moduleName . 'FundingSourcesSorted' => $fundingSourcesSorted,
$this->moduleName . 'PayWithTranslations' => $payWithTranslations,
];
}
}

View File

@@ -0,0 +1,104 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\Settings\Front\Modules;
use PsCheckout\Presentation\Presenter\PresenterInterface;
use PsCheckout\Presentation\TranslatorInterface;
class TranslationModule implements PresenterInterface
{
/**
* @var string
*/
private $moduleName;
/**
* @var TranslatorInterface
*/
private $translator;
/**
* @param string $moduleName
* @param TranslatorInterface $translator
*/
public function __construct(
string $moduleName,
TranslatorInterface $translator
) {
$this->moduleName = $moduleName;
$this->translator = $translator;
}
public function present(): array
{
return [
$this->moduleName . 'CheckoutTranslations' => [
'checkout.go.back.label' => $this->translator->trans('Checkout'),
'checkout.go.back.link.title' => $this->translator->trans('Go back to the Checkout'),
'checkout.card.payment' => $this->translator->trans('Card payment'),
'checkout.page.heading' => $this->translator->trans('Order summary'),
'checkout.cart.empty' => $this->translator->trans('Your shopping cart is empty.'),
'checkout.page.subheading.card' => $this->translator->trans('Card'),
'checkout.page.subheading.paypal' => $this->translator->trans('PayPal'),
'checkout.payment.by.card' => $this->translator->trans('You have chosen to pay by Card.'),
'checkout.payment.by.paypal' => $this->translator->trans('You have chosen to pay by PayPal.'),
'checkout.order.summary' => $this->translator->trans('Here is a short summary of your order:'),
'checkout.order.amount.total' => $this->translator->trans('The total amount of your order comes to'),
'checkout.order.included.tax' => $this->translator->trans('(tax incl.)'),
'checkout.order.confirm.label' => $this->translator->trans('Please confirm your order by clicking "I confirm my order".'),
'checkout.payment.token.delete.modal.header' => $this->translator->trans('Delete this payment method?'),
'checkout.payment.token.delete.modal.content' => $this->translator->trans('The following payment method will be deleted from your account:'),
'checkout.payment.token.delete.modal.confirm-button' => $this->translator->trans('Delete payment method'),
'checkout.payment.loader.processing-request' => $this->translator->trans('Please wait, we are processing your request'),
'checkout.payment.others.link.label' => $this->translator->trans('Other payment methods'),
'checkout.payment.others.confirm.button.label' => $this->translator->trans('I confirm my order'),
'checkout.form.error.label' => $this->translator->trans('There was an error during the payment. Please try again or contact the support.'),
'loader-component.label.header' => $this->translator->trans('Thanks for your purchase!'),
'loader-component.label.body' => $this->translator->trans('Please wait, we are processing your payment'),
'loader-component.label.body.longer' => $this->translator->trans('This is taking longer than expected. Please wait...'),
'payment-method-logos.title' => $this->translator->trans('100% secure payments'),
'express-button.cart.separator' => $this->translator->trans('or'),
'express-button.checkout.express-checkout' => $this->translator->trans('Express Checkout'),
'ok' => $this->translator->trans('Ok'),
'cancel' => $this->translator->trans('Cancel'),
'paypal.hosted-fields.label.card-name' => $this->translator->trans('Card holder name'),
'paypal.hosted-fields.placeholder.card-name' => $this->translator->trans('Card holder name'),
'paypal.hosted-fields.label.card-number' => $this->translator->trans('Card number'),
'paypal.hosted-fields.placeholder.card-number' => $this->translator->trans('Card number'),
'paypal.hosted-fields.label.expiration-date' => $this->translator->trans('Expiry date'),
'paypal.hosted-fields.placeholder.expiration-date' => $this->translator->trans('MM/YY'),
'paypal.hosted-fields.label.cvv' => $this->translator->trans('CVC'),
'paypal.hosted-fields.placeholder.cvv' => $this->translator->trans('XXX'),
'error.paypal-sdk' => $this->translator->trans('No PayPal Javascript SDK Instance'),
'error.google-pay-sdk' => $this->translator->trans('No Google Pay Javascript SDK Instance'),
'error.apple-pay-sdk' => $this->translator->trans('No Apple Pay Javascript SDK Instance'),
'error.google-pay.transaction-info' => $this->translator->trans('An error occurred fetching Google Pay transaction info'),
'error.apple-pay.payment-request' => $this->translator->trans('An error occurred fetching Apple Pay payment request'),
'error.paypal-sdk.contingency.cancel' => $this->translator->trans('Card holder authentication canceled, please choose another payment method or try again.'),
'error.paypal-sdk.contingency.error' => $this->translator->trans('An error occurred on card holder authentication, please choose another payment method or try again.'),
'error.paypal-sdk.contingency.failure' => $this->translator->trans('Card holder authentication failed, please choose another payment method or try again.'),
'error.paypal-sdk.contingency.unknown' => $this->translator->trans('Card holder authentication cannot be checked, please choose another payment method or try again.'),
'APPLE_PAY_MERCHANT_SESSION_VALIDATION_ERROR' => $this->translator->trans('Were unable to process your Apple Pay payment at the moment. This could be due to an issue verifying the payment setup for this website. Please try again later or choose a different payment method.'),
'APPROVE_APPLE_PAY_VALIDATION_ERROR' => $this->translator->trans('We encountered an issue while processing your Apple Pay payment. Please verify your order details and try again, or use a different payment method.')
],
];
}
}

View File

@@ -0,0 +1,29 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
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,122 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation\Presenter\Settings\Front;
use PsCheckout\Core\Settings\Configuration\PayPalCardConfiguration;
use PsCheckout\Infrastructure\Adapter\Context;
use PsCheckout\Presentation\Presenter\PresenterInterface;
class SupportedCardBrandsPresenter implements PresenterInterface
{
/**
* @var Context
*/
private $context;
public function __construct(Context $context)
{
$this->context = $context;
}
/**
* {@inheritdoc}
*/
public function present(): array
{
$country = $this->context->getCountry();
$currency = $this->context->getCurrency();
if (($country === null || !$country->id) || ($currency === null || !$currency->id)) {
return [];
}
$countryIso = $country->iso_code === 'GB' ? 'UK' : $country->iso_code;
$currencyIso = $currency->iso_code;
if ($this->hasSupportedCardBrandsByCountry($countryIso)) {
return array_values(array_intersect(
$this->getSupportedCardBrandsByCountry($countryIso),
$this->getSupportedCardBrandsByCurrency($currencyIso),
$this->getSupportedCardBrandsByCountryAndCurrency($countryIso, $currencyIso)
));
}
return array_values(array_intersect(
$this->getSupportedCardBrandsByCountry($countryIso),
$this->getSupportedCardBrandsByCurrency($currencyIso)
));
}
/**
* @param string $countryIso
* @param string $currencyIso
*
* @return array an array of card brands that are supported for the given country and currency
*/
private function getSupportedCardBrandsByCountryAndCurrency(string $countryIso, string $currencyIso): array
{
$supportedCardBrandsByCountryAndCurrency = PayPalCardConfiguration::SUPPORTED_CARD_BRANDS_BY_COUNTRY_AND_CURRENCY;
return isset($supportedCardBrandsByCountryAndCurrency[$countryIso][$currencyIso])
? $supportedCardBrandsByCountryAndCurrency[$countryIso][$currencyIso]
: ['MASTERCARD', 'VISA'];
}
/**
* @param string $countryIso
*
* @return array an array of card brands that are supported for the given country
*/
private function getSupportedCardBrandsByCountry(string $countryIso): array
{
$supportedCardBrandsByCountry = PayPalCardConfiguration::SUPPORTED_CARD_BRANDS_BY_COUNTRY;
return isset($supportedCardBrandsByCountry[$countryIso])
? $supportedCardBrandsByCountry[$countryIso]
: [];
}
/**
* @param string $currencyIso
*
* @return array an array of card brands that are supported for the given currency
*/
private function getSupportedCardBrandsByCurrency(string $currencyIso): array
{
$supportedCardBrandsByCurrency = PayPalCardConfiguration::SUPPORTED_CARD_BRANDS_BY_CURRENCY;
return isset($supportedCardBrandsByCurrency[$currencyIso])
? $supportedCardBrandsByCurrency[$currencyIso]
: [];
}
/**
* @param string $countryIso
*
* @return bool whether the given country has supported card brands by country and currency
*/
private function hasSupportedCardBrandsByCountry(string $countryIso): bool
{
$supportedCardBrandsByCountryAndCurrency = PayPalCardConfiguration::SUPPORTED_CARD_BRANDS_BY_COUNTRY_AND_CURRENCY;
return isset($supportedCardBrandsByCountryAndCurrency[$countryIso]);
}
}

View File

@@ -0,0 +1,29 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
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,29 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
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,29 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
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,32 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
namespace PsCheckout\Presentation;
interface TranslatorInterface
{
/**
* @param string $key
* @param array $parameters
*
* @return string
*/
public function trans(string $key, array $parameters = []): string;
}

View File

@@ -0,0 +1,29 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License version 3.0
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* 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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
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,24 @@
<?php
putenv('COMPOSER_VENDOR_DIR=' . __DIR__);
// 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;
}
}
throw new RuntimeException($err);
}
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit0d6a6856f5ea3293d1b509e2e764e066::getLoader();

View File

@@ -0,0 +1,579 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see 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|null */
private $vendorDir;
// PSR-4
/**
* @var array<string, array<string, int>>
*/
private $prefixLengthsPsr4 = array();
/**
* @var array<string, list<string>>
*/
private $prefixDirsPsr4 = array();
/**
* @var list<string>
*/
private $fallbackDirsPsr4 = array();
// PSR-0
/**
* List of PSR-0 prefixes
*
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
*
* @var array<string, array<string, list<string>>>
*/
private $prefixesPsr0 = array();
/**
* @var list<string>
*/
private $fallbackDirsPsr0 = array();
/** @var bool */
private $useIncludePath = false;
/**
* @var array<string, string>
*/
private $classMap = array();
/** @var bool */
private $classMapAuthoritative = false;
/**
* @var array<string, bool>
*/
private $missingClasses = array();
/** @var string|null */
private $apcuPrefix;
/**
* @var array<string, self>
*/
private static $registeredLoaders = array();
/**
* @param string|null $vendorDir
*/
public function __construct($vendorDir = null)
{
$this->vendorDir = $vendorDir;
self::initializeIncludeClosure();
}
/**
* @return array<string, list<string>>
*/
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
}
return array();
}
/**
* @return array<string, list<string>>
*/
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
/**
* @return list<string>
*/
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
/**
* @return list<string>
*/
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
/**
* @return array<string, string> Array of classname => path
*/
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array<string, string> $classMap Class to filename map
*
* @return void
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param list<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)
{
$paths = (array) $paths;
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
$paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
$paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
$paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<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)
{
$paths = (array) $paths;
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
$paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
$paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
$paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 base directories
*
* @return void
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*
* @return void
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*
* @return void
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*
* @return void
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*
* @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 true|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
$includeFile = self::$includeFile;
$includeFile($file);
return true;
}
return null;
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
}
/**
* Returns the currently registered loaders keyed by their corresponding vendor directories.
*
* @return array<string, 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
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
/**
* @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);
}
}

View File

@@ -0,0 +1,396 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer;
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 string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
* @internal
*/
private static $selfDir = null;
/**
* @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<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
*/
private static $installed;
/**
* @var bool
*/
private static $installedIsLocalDir;
/**
* @var bool|null
*/
private static $canGetVendors;
/**
* @var array[]
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
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<string>
*/
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<string>
*/
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<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
*/
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<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
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<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
*/
public static function reload($data)
{
self::$installed = $data;
self::$installedByVendor = array();
// when using reload, we disable the duplicate protection to ensure that self::$installed data is
// always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
// so we have to assume it does not, and that may result in duplicate data being returned when listing
// all installed packages for example
self::$installedIsLocalDir = false;
}
/**
* @return string
*/
private static function getSelfDir()
{
if (self::$selfDir === null) {
self::$selfDir = strtr(__DIR__, '\\', '/');
}
return self::$selfDir;
}
/**
* @return array[]
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
private static function getInstalled()
{
if (null === self::$canGetVendors) {
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
}
$installed = array();
$copiedLocalDir = false;
if (self::$canGetVendors) {
$selfDir = self::getSelfDir();
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
$vendorDir = strtr($vendorDir, '\\', '/');
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<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require $vendorDir.'/composer/installed.php';
self::$installedByVendor[$vendorDir] = $required;
$installed[] = $required;
if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
self::$installed = $required;
self::$installedIsLocalDir = true;
}
}
if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
$copiedLocalDir = true;
}
}
}
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<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require __DIR__ . '/installed.php';
self::$installed = $required;
} else {
self::$installed = array();
}
}
if (self::$installed !== array() && !$copiedLocalDir) {
$installed[] = self::$installed;
}
return $installed;
}
}

View File

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

View File

@@ -0,0 +1,40 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname(dirname($vendorDir));
return array(
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
'PsCheckout\\Presentation\\Presenter\\Cart\\CartPresenter' => $baseDir . '/presentation/src/Presenter/Cart/CartPresenter.php',
'PsCheckout\\Presentation\\Presenter\\Date\\DatePresenter' => $baseDir . '/presentation/src/Presenter/Date/DatePresenter.php',
'PsCheckout\\Presentation\\Presenter\\Date\\DatePresenterInterface' => $baseDir . '/presentation/src/Presenter/Date/DatePresenterInterface.php',
'PsCheckout\\Presentation\\Presenter\\FundingSource\\FundingSourcePresenter' => $baseDir . '/presentation/src/Presenter/FundingSource/FundingSourcePresenter.php',
'PsCheckout\\Presentation\\Presenter\\FundingSource\\FundingSourcePresenterInterface' => $baseDir . '/presentation/src/Presenter/FundingSource/FundingSourcePresenterInterface.php',
'PsCheckout\\Presentation\\Presenter\\FundingSource\\FundingSourceTokenPresenter' => $baseDir . '/presentation/src/Presenter/FundingSource/FundingSourceTokenPresenter.php',
'PsCheckout\\Presentation\\Presenter\\FundingSource\\FundingSourceTokenPresenterInterface' => $baseDir . '/presentation/src/Presenter/FundingSource/FundingSourceTokenPresenterInterface.php',
'PsCheckout\\Presentation\\Presenter\\FundingSource\\FundingSourceTranslationProvider' => $baseDir . '/presentation/src/Presenter/FundingSource/FundingSourceTranslationProvider.php',
'PsCheckout\\Presentation\\Presenter\\FundingSource\\FundingSourceTranslationProviderInterface' => $baseDir . '/presentation/src/Presenter/FundingSource/FundingSourceTranslationProviderInterface.php',
'PsCheckout\\Presentation\\Presenter\\FundingSource\\LogoPresenter' => $baseDir . '/presentation/src/Presenter/FundingSource/LogoPresenter.php',
'PsCheckout\\Presentation\\Presenter\\FundingSource\\LogoPresenterInterface' => $baseDir . '/presentation/src/Presenter/FundingSource/LogoPresenterInterface.php',
'PsCheckout\\Presentation\\Presenter\\OrderSummary\\OrderSummaryPresenter' => $baseDir . '/presentation/src/Presenter/OrderSummary/OrderSummaryPresenter.php',
'PsCheckout\\Presentation\\Presenter\\OrderSummary\\OrderSummaryPresenterInterface' => $baseDir . '/presentation/src/Presenter/OrderSummary/OrderSummaryPresenterInterface.php',
'PsCheckout\\Presentation\\Presenter\\PayPalOrder\\PayPalOrderPresenter' => $baseDir . '/presentation/src/Presenter/PayPalOrder/PayPalOrderPresenter.php',
'PsCheckout\\Presentation\\Presenter\\PayPalOrder\\PayPalOrderPresenterInterface' => $baseDir . '/presentation/src/Presenter/PayPalOrder/PayPalOrderPresenterInterface.php',
'PsCheckout\\Presentation\\Presenter\\PayPalOrder\\PayPalOrderTotalsPresenter' => $baseDir . '/presentation/src/Presenter/PayPalOrder/PayPalOrderTotalsPresenter.php',
'PsCheckout\\Presentation\\Presenter\\PayPalOrder\\PayPalOrderTransactionPresenter' => $baseDir . '/presentation/src/Presenter/PayPalOrder/PayPalOrderTransactionPresenter.php',
'PsCheckout\\Presentation\\Presenter\\PresenterInterface' => $baseDir . '/presentation/src/Presenter/PresenterInterface.php',
'PsCheckout\\Presentation\\Presenter\\Settings\\Admin\\AdminSettingsPresenter' => $baseDir . '/presentation/src/Presenter/Settings/Admin/AdminSettingsPresenter.php',
'PsCheckout\\Presentation\\Presenter\\Settings\\Admin\\Modules\\ConfigurationModule' => $baseDir . '/presentation/src/Presenter/Settings/Admin/Modules/ConfigurationModule.php',
'PsCheckout\\Presentation\\Presenter\\Settings\\Admin\\Modules\\ContextModule' => $baseDir . '/presentation/src/Presenter/Settings/Admin/Modules/ContextModule.php',
'PsCheckout\\Presentation\\Presenter\\Settings\\Admin\\Modules\\PaypalModule' => $baseDir . '/presentation/src/Presenter/Settings/Admin/Modules/PaypalModule.php',
'PsCheckout\\Presentation\\Presenter\\Settings\\Front\\FrontSettingsPresenter' => $baseDir . '/presentation/src/Presenter/Settings/Front/FrontSettingsPresenter.php',
'PsCheckout\\Presentation\\Presenter\\Settings\\Front\\Modules\\ConfigurationModule' => $baseDir . '/presentation/src/Presenter/Settings/Front/Modules/ConfigurationModule.php',
'PsCheckout\\Presentation\\Presenter\\Settings\\Front\\Modules\\LinkModule' => $baseDir . '/presentation/src/Presenter/Settings/Front/Modules/LinkModule.php',
'PsCheckout\\Presentation\\Presenter\\Settings\\Front\\Modules\\MediaModule' => $baseDir . '/presentation/src/Presenter/Settings/Front/Modules/MediaModule.php',
'PsCheckout\\Presentation\\Presenter\\Settings\\Front\\Modules\\PayPalModule' => $baseDir . '/presentation/src/Presenter/Settings/Front/Modules/PayPalModule.php',
'PsCheckout\\Presentation\\Presenter\\Settings\\Front\\Modules\\TranslationModule' => $baseDir . '/presentation/src/Presenter/Settings/Front/Modules/TranslationModule.php',
'PsCheckout\\Presentation\\Presenter\\Settings\\Front\\SupportedCardBrandsPresenter' => $baseDir . '/presentation/src/Presenter/Settings/Front/SupportedCardBrandsPresenter.php',
'PsCheckout\\Presentation\\TranslatorInterface' => $baseDir . '/presentation/src/TranslatorInterface.php',
);

View File

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

View File

@@ -0,0 +1,10 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname(dirname($vendorDir));
return array(
'PsCheckout\\Presentation\\' => array($baseDir . '/presentation/src'),
);

View File

@@ -0,0 +1,36 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit0d6a6856f5ea3293d1b509e2e764e066
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit0d6a6856f5ea3293d1b509e2e764e066', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit0d6a6856f5ea3293d1b509e2e764e066', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit0d6a6856f5ea3293d1b509e2e764e066::getInitializer($loader));
$loader->register(true);
return $loader;
}
}

View File

@@ -0,0 +1,66 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInit0d6a6856f5ea3293d1b509e2e764e066
{
public static $prefixLengthsPsr4 = array (
'P' =>
array (
'PsCheckout\\Presentation\\' => 24,
),
);
public static $prefixDirsPsr4 = array (
'PsCheckout\\Presentation\\' =>
array (
0 => __DIR__ . '/../../..' . '/presentation/src',
),
);
public static $classMap = array (
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
'PsCheckout\\Presentation\\Presenter\\Cart\\CartPresenter' => __DIR__ . '/../../..' . '/presentation/src/Presenter/Cart/CartPresenter.php',
'PsCheckout\\Presentation\\Presenter\\Date\\DatePresenter' => __DIR__ . '/../../..' . '/presentation/src/Presenter/Date/DatePresenter.php',
'PsCheckout\\Presentation\\Presenter\\Date\\DatePresenterInterface' => __DIR__ . '/../../..' . '/presentation/src/Presenter/Date/DatePresenterInterface.php',
'PsCheckout\\Presentation\\Presenter\\FundingSource\\FundingSourcePresenter' => __DIR__ . '/../../..' . '/presentation/src/Presenter/FundingSource/FundingSourcePresenter.php',
'PsCheckout\\Presentation\\Presenter\\FundingSource\\FundingSourcePresenterInterface' => __DIR__ . '/../../..' . '/presentation/src/Presenter/FundingSource/FundingSourcePresenterInterface.php',
'PsCheckout\\Presentation\\Presenter\\FundingSource\\FundingSourceTokenPresenter' => __DIR__ . '/../../..' . '/presentation/src/Presenter/FundingSource/FundingSourceTokenPresenter.php',
'PsCheckout\\Presentation\\Presenter\\FundingSource\\FundingSourceTokenPresenterInterface' => __DIR__ . '/../../..' . '/presentation/src/Presenter/FundingSource/FundingSourceTokenPresenterInterface.php',
'PsCheckout\\Presentation\\Presenter\\FundingSource\\FundingSourceTranslationProvider' => __DIR__ . '/../../..' . '/presentation/src/Presenter/FundingSource/FundingSourceTranslationProvider.php',
'PsCheckout\\Presentation\\Presenter\\FundingSource\\FundingSourceTranslationProviderInterface' => __DIR__ . '/../../..' . '/presentation/src/Presenter/FundingSource/FundingSourceTranslationProviderInterface.php',
'PsCheckout\\Presentation\\Presenter\\FundingSource\\LogoPresenter' => __DIR__ . '/../../..' . '/presentation/src/Presenter/FundingSource/LogoPresenter.php',
'PsCheckout\\Presentation\\Presenter\\FundingSource\\LogoPresenterInterface' => __DIR__ . '/../../..' . '/presentation/src/Presenter/FundingSource/LogoPresenterInterface.php',
'PsCheckout\\Presentation\\Presenter\\OrderSummary\\OrderSummaryPresenter' => __DIR__ . '/../../..' . '/presentation/src/Presenter/OrderSummary/OrderSummaryPresenter.php',
'PsCheckout\\Presentation\\Presenter\\OrderSummary\\OrderSummaryPresenterInterface' => __DIR__ . '/../../..' . '/presentation/src/Presenter/OrderSummary/OrderSummaryPresenterInterface.php',
'PsCheckout\\Presentation\\Presenter\\PayPalOrder\\PayPalOrderPresenter' => __DIR__ . '/../../..' . '/presentation/src/Presenter/PayPalOrder/PayPalOrderPresenter.php',
'PsCheckout\\Presentation\\Presenter\\PayPalOrder\\PayPalOrderPresenterInterface' => __DIR__ . '/../../..' . '/presentation/src/Presenter/PayPalOrder/PayPalOrderPresenterInterface.php',
'PsCheckout\\Presentation\\Presenter\\PayPalOrder\\PayPalOrderTotalsPresenter' => __DIR__ . '/../../..' . '/presentation/src/Presenter/PayPalOrder/PayPalOrderTotalsPresenter.php',
'PsCheckout\\Presentation\\Presenter\\PayPalOrder\\PayPalOrderTransactionPresenter' => __DIR__ . '/../../..' . '/presentation/src/Presenter/PayPalOrder/PayPalOrderTransactionPresenter.php',
'PsCheckout\\Presentation\\Presenter\\PresenterInterface' => __DIR__ . '/../../..' . '/presentation/src/Presenter/PresenterInterface.php',
'PsCheckout\\Presentation\\Presenter\\Settings\\Admin\\AdminSettingsPresenter' => __DIR__ . '/../../..' . '/presentation/src/Presenter/Settings/Admin/AdminSettingsPresenter.php',
'PsCheckout\\Presentation\\Presenter\\Settings\\Admin\\Modules\\ConfigurationModule' => __DIR__ . '/../../..' . '/presentation/src/Presenter/Settings/Admin/Modules/ConfigurationModule.php',
'PsCheckout\\Presentation\\Presenter\\Settings\\Admin\\Modules\\ContextModule' => __DIR__ . '/../../..' . '/presentation/src/Presenter/Settings/Admin/Modules/ContextModule.php',
'PsCheckout\\Presentation\\Presenter\\Settings\\Admin\\Modules\\PaypalModule' => __DIR__ . '/../../..' . '/presentation/src/Presenter/Settings/Admin/Modules/PaypalModule.php',
'PsCheckout\\Presentation\\Presenter\\Settings\\Front\\FrontSettingsPresenter' => __DIR__ . '/../../..' . '/presentation/src/Presenter/Settings/Front/FrontSettingsPresenter.php',
'PsCheckout\\Presentation\\Presenter\\Settings\\Front\\Modules\\ConfigurationModule' => __DIR__ . '/../../..' . '/presentation/src/Presenter/Settings/Front/Modules/ConfigurationModule.php',
'PsCheckout\\Presentation\\Presenter\\Settings\\Front\\Modules\\LinkModule' => __DIR__ . '/../../..' . '/presentation/src/Presenter/Settings/Front/Modules/LinkModule.php',
'PsCheckout\\Presentation\\Presenter\\Settings\\Front\\Modules\\MediaModule' => __DIR__ . '/../../..' . '/presentation/src/Presenter/Settings/Front/Modules/MediaModule.php',
'PsCheckout\\Presentation\\Presenter\\Settings\\Front\\Modules\\PayPalModule' => __DIR__ . '/../../..' . '/presentation/src/Presenter/Settings/Front/Modules/PayPalModule.php',
'PsCheckout\\Presentation\\Presenter\\Settings\\Front\\Modules\\TranslationModule' => __DIR__ . '/../../..' . '/presentation/src/Presenter/Settings/Front/Modules/TranslationModule.php',
'PsCheckout\\Presentation\\Presenter\\Settings\\Front\\SupportedCardBrandsPresenter' => __DIR__ . '/../../..' . '/presentation/src/Presenter/Settings/Front/SupportedCardBrandsPresenter.php',
'PsCheckout\\Presentation\\TranslatorInterface' => __DIR__ . '/../../..' . '/presentation/src/TranslatorInterface.php',
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit0d6a6856f5ea3293d1b509e2e764e066::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit0d6a6856f5ea3293d1b509e2e764e066::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit0d6a6856f5ea3293d1b509e2e764e066::$classMap;
}, null, ClassLoader::class);
}
}

View File

@@ -0,0 +1,34 @@
<?php return array(
'root' => array(
'name' => 'ps_checkout/prestashop',
'pretty_version' => 'v5.1.1',
'version' => '5.1.1.0',
'reference' => '5846da751d8542e6814651626eacd7fe5470c270',
'type' => 'prestashop-module',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev' => true,
),
'versions' => array(
'beberlei/composer-monorepo-plugin' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '47a2612a09e81d741b3eeb99852590b13b64eddd',
'type' => 'composer-plugin',
'install_path' => __DIR__ . '/../beberlei/composer-monorepo-plugin',
'aliases' => array(
0 => '9999999-dev',
),
'dev_requirement' => true,
),
'ps_checkout/prestashop' => array(
'pretty_version' => 'v5.1.1',
'version' => '5.1.1.0',
'reference' => '5846da751d8542e6814651626eacd7fe5470c270',
'type' => 'prestashop-module',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev_requirement' => false,
),
),
);