Skip to content

Commit

Permalink
Fix rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt75 committed Apr 24, 2024
1 parent 04981df commit 6ead436
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 248 deletions.
2 changes: 1 addition & 1 deletion config/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ services:
class: 'PrestaShop\Module\PrestashopCheckout\ShopContext'
public: true
arguments:
- '@PrestaShop\Module\PrestashopCheckout\Environment\PaymentEnv'
- '@PrestaShop\Module\PrestashopCheckout\Environment\Env'

PrestaShop\Module\PrestashopCheckout\Shop\ShopProvider:
class: 'PrestaShop\Module\PrestashopCheckout\Shop\ShopProvider'
Expand Down
8 changes: 4 additions & 4 deletions controllers/admin/AdminAjaxPrestashopCheckoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,10 @@ private function updateExpressCheckoutSettings()

$maaslandHttpClient->updateSettings([
'settings' => [
'cb' => (bool)$configuration->get('PS_CHECKOUT_CARD_PAYMENT_ENABLED'),
'express_in_product' => (bool)$ecConfiguration->isProductPageEnabled(),
'express_in_cart' => (bool)$ecConfiguration->isOrderPageEnabled(),
'express_in_checkout' => (bool)$ecConfiguration->isCheckoutPageEnabled(),
'cb' => (bool) $configuration->get('PS_CHECKOUT_CARD_PAYMENT_ENABLED'),
'express_in_product' => (bool) $ecConfiguration->isProductPageEnabled(),
'express_in_cart' => (bool) $ecConfiguration->isOrderPageEnabled(),
'express_in_checkout' => (bool) $ecConfiguration->isCheckoutPageEnabled(),
],
]);
}
Expand Down
7 changes: 1 addition & 6 deletions src/Adapter/LinkAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@

namespace PrestaShop\Module\PrestashopCheckout\Adapter;

use PrestaShop\Module\PrestashopCheckout\Environment\PaymentEnv;
use PrestaShop\Module\PrestashopCheckout\ShopContext;

/**
* Link adapter
*/
Expand Down Expand Up @@ -53,14 +50,12 @@ public function __construct(\Link $link = null)
* @param array $params
*
* @return string
*
* @throws \PrestaShopException
*/
public function getAdminLink($controller, $withToken = true, $sfRouteParams = [], $params = [])
{
$shop = \Context::getContext()->shop;

if ((new ShopContext(new PaymentEnv()))->isShop17()) {
if (version_compare(_PS_VERSION_, '1.7.0.0', '>=')) {
$adminLink = $this->link->getAdminLink($controller, $withToken, $sfRouteParams, $params);

if ($shop->virtual_uri !== '') {
Expand Down
45 changes: 0 additions & 45 deletions src/Cart/CartInterface.php

This file was deleted.

36 changes: 0 additions & 36 deletions src/Cart/CartRepositoryInterface.php

This file was deleted.

1 change: 0 additions & 1 deletion src/Checkout/EventSubscriber/CheckoutEventSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@

class CheckoutEventSubscriber implements EventSubscriberInterface
{

/**
* @var CommandBusInterface
*/
Expand Down
3 changes: 0 additions & 3 deletions src/Dispatcher/OrderDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@

namespace PrestaShop\Module\PrestashopCheckout\Dispatcher;

use Module;
use PrestaShop\Module\PrestashopCheckout\Event\EventDispatcherInterface;
use PrestaShop\Module\PrestashopCheckout\Event\SymfonyEventDispatcherAdapter;
use PrestaShop\Module\PrestashopCheckout\Exception\PsCheckoutException;
use PrestaShop\Module\PrestashopCheckout\PayPal\Order\Event\PayPalOrderApprovalReversedEvent;
use PrestaShop\Module\PrestashopCheckout\PayPal\Order\Event\PayPalOrderApprovedEvent;
Expand All @@ -38,7 +36,6 @@
use PrestaShop\Module\PrestashopCheckout\PayPal\PaymentToken\Event\PaymentTokenDeletedEvent;
use PrestaShop\Module\PrestashopCheckout\PayPal\PaymentToken\Event\PaymentTokenDeletionInitiatedEvent;
use PrestaShop\Module\PrestashopCheckout\PayPal\PayPalConfiguration;
use Ps_checkout;
use Psr\Log\LoggerInterface;

class OrderDispatcher implements DispatcherInterface
Expand Down
16 changes: 14 additions & 2 deletions src/Environment/Env.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

use PrestaShop\Module\PrestashopCheckout\PayPal\Mode;
use PrestaShop\Module\PrestashopCheckout\PayPal\PayPalConfiguration;
use Ps_checkout;

/**
* Get the current environment used: prod or test // sandbox or live
Expand Down Expand Up @@ -140,7 +139,6 @@ public function getPaymentApiUrl()
return $this->getEnv('PAYMENT_API_URL_LIVE');
}


/**
* @return string
*/
Expand All @@ -164,4 +162,18 @@ public function getPaypalClientId()

return $this->getEnv('PAYPAL_CLIENT_ID_LIVE');
}

/**
* @return string
*/
public function getBnCode()
{
$bnCode = $this->getEnv('PAYPAL_BN_CODE');

if (empty($bnCode)) {
$bnCode = 'PrestaShop_Cart_PSXO_PSDownload';
}

return $bnCode;
}
}
3 changes: 1 addition & 2 deletions src/Http/MaaslandHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
use Http\Client\Exception\NetworkException;
use Http\Client\Exception\RequestException;
use Http\Client\Exception\TransferException;
use PrestaShop\Module\PrestashopCheckout\Configuration\PrestaShopConfiguration;
use PrestaShop\Module\PrestashopCheckout\Exception\PayPalException;
use PrestaShop\Module\PrestashopCheckout\ExpressCheckout\ExpressCheckoutConfiguration;
use PrestaShop\Module\PrestashopCheckout\PayPalError;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
Expand Down Expand Up @@ -147,6 +145,7 @@ public function getShopSignature(array $payload, array $options = [])
* Used to notify PSL on settings update
*
* @return array
*
* @throws PayPalException
*/
public function updateSettings(array $payload)
Expand Down
38 changes: 0 additions & 38 deletions src/PayPal/Order/CreatePayPalOrderPayloadBuilderInterface.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Presenter/Order/OrderPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ private function getTotal()
continue;
}

$total += (float)$purchase['amount']['value'];
$total += (float) $purchase['amount']['value'];
$currency = $purchase['amount']['currency_code'];
}

Expand Down
2 changes: 0 additions & 2 deletions src/Provider/PaymentMethodLogoProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

namespace PrestaShop\Module\PrestashopCheckout\Provider;

use Ps_checkout;

class PaymentMethodLogoProvider
{
/**
Expand Down
1 change: 0 additions & 1 deletion src/Repository/PsAccountRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
namespace PrestaShop\Module\PrestashopCheckout\Repository;

use Exception;
use PrestaShop\Module\PrestashopCheckout\Configuration\PrestaShopConfiguration;
use PrestaShop\Module\PrestashopCheckout\Entity\PsAccount;
use PrestaShop\PsAccountsInstaller\Installer\Facade\PsAccounts;

Expand Down
16 changes: 6 additions & 10 deletions src/ShopContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@

namespace PrestaShop\Module\PrestashopCheckout;

use PrestaShop\Module\PrestashopCheckout\Environment\PaymentEnv;
use PrestaShop\Module\PrestashopCheckout\Environment\Env;

/**
* Get the shop context
*/
class ShopContext
{
/**
* @var PaymentEnv
* @var Env
*/
private $paymentEnv;
private $env;

public function __construct(PaymentEnv $paymentEnv)
public function __construct(Env $env)
{
$this->paymentEnv = $paymentEnv;
$this->env = $env;
}

/**
Expand All @@ -55,11 +55,7 @@ public function isReady()
*/
public function getBnCode()
{
if ($this->isReady()) { // if on ready send an empty bn-code
return '';
}

return $this->paymentEnv->getBnCode();
return $this->env->getBnCode();
}

public function isShop17()
Expand Down
Loading

0 comments on commit 6ead436

Please sign in to comment.