Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
khushboo-singhvi committed Aug 21, 2024
2 parents a5e912c + 59ec4cc commit ea2c096
Show file tree
Hide file tree
Showing 51 changed files with 2,491 additions and 564 deletions.
31 changes: 31 additions & 0 deletions Api/AdyenInitPaymentsInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
/**
*
* Adyen ExpressCheckout Module
*
* Copyright (c) 2024 Adyen N.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*
* Author: Adyen <magento@adyen.com>
*/
declare(strict_types=1);

namespace Adyen\ExpressCheckout\Api;

interface AdyenInitPaymentsInterface
{
const PAYMENT_CHANNEL_WEB = 'web';

/**
* @param string $stateData
* @param int|null $adyenCartId
* @param string|null $adyenMaskedQuoteId
* @return string
*/
public function execute(
string $stateData,
?int $adyenCartId = null,
?string $adyenMaskedQuoteId = null
): string;
}
31 changes: 31 additions & 0 deletions Api/AdyenPaypalUpdateOrderInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
/**
*
* Adyen ExpressCheckout Module
*
* Copyright (c) 2024 Adyen N.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*
* Author: Adyen <magento@adyen.com>
*/
declare(strict_types=1);

namespace Adyen\ExpressCheckout\Api;

interface AdyenPaypalUpdateOrderInterface
{
/**
* @param string $paymentData
* @param int|null $adyenCartId
* @param string|null $adyenMaskedQuoteId
* @param string $deliveryMethods
* @return mixed
*/
public function execute(
string $paymentData,
?int $adyenCartId = null,
?string $adyenMaskedQuoteId = null,
string $deliveryMethods = ''
): string;
}
29 changes: 29 additions & 0 deletions Api/GuestAdyenInitPaymentsInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/**
*
* Adyen ExpressCheckout Module
*
* Copyright (c) 2024 Adyen N.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*
* Author: Adyen <magento@adyen.com>
*/
declare(strict_types=1);

namespace Adyen\ExpressCheckout\Api;

interface GuestAdyenInitPaymentsInterface
{
/**
* @param string $stateData
* @param string|null $guestMaskedId
* @param string|null $adyenMaskedQuoteId
* @return string
*/
public function execute(
string $stateData,
?string $guestMaskedId = null,
?string $adyenMaskedQuoteId = null
): string;
}
31 changes: 31 additions & 0 deletions Api/GuestAdyenPaypalUpdateOrderInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
/**
*
* Adyen ExpressCheckout Module
*
* Copyright (c) 2024 Adyen N.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*
* Author: Adyen <magento@adyen.com>
*/
declare(strict_types=1);

namespace Adyen\ExpressCheckout\Api;

interface GuestAdyenPaypalUpdateOrderInterface
{
/**
* @param string $paymentData
* @param string|null $guestMaskedId
* @param string|null $adyenMaskedQuoteId
* @param string $deliveryMethods
* @return mixed
*/
public function execute(
string $paymentData,
?string $guestMaskedId = null,
?string $adyenMaskedQuoteId = null,
string $deliveryMethods = ''
): string;
}
66 changes: 13 additions & 53 deletions Block/ApplePay/Shortcut/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,52 +14,26 @@
namespace Adyen\ExpressCheckout\Block\ApplePay\Shortcut;

use Adyen\Payment\Helper\Data as AdyenHelper;
use Adyen\Payment\Helper\Config as AdyenConfigHelper;
use Adyen\ExpressCheckout\Block\Buttons\AbstractButton;
use Adyen\ExpressCheckout\Model\ConfigurationInterface;
use Magento\Checkout\Model\Session;
use Magento\Catalog\Block\ShortcutInterface;
use Magento\Checkout\Model\DefaultConfigProvider;
use Magento\Customer\Model\Session as CustomerSession;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\UrlInterface;
use Magento\Framework\View\Element\Template\Context;
use Magento\Payment\Model\MethodInterface;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Store\Model\StoreManagerInterface;

class Button extends AbstractButton implements ShortcutInterface
{
/**
* @var DefaultConfigProvider $defaultConfigProvider
*/
private $defaultConfigProvider;

/**
* @var UrlInterface $url
*/
private $url;

/**
* @var CustomerSession $customerSession
*/
private $customerSession;

/**
* @var StoreManagerInterface $storeManager
*/
private $storeManager;

/**
* @var ScopeConfigInterface $scopeConfig
*/
private $scopeConfig;
const PAYMENT_METHOD_VARIANT = 'applepay';

/**
* @var ConfigurationInterface $configuration
*/
private $configuration;
private ConfigurationInterface $configuration;

/**
* Button Constructor
Expand All @@ -73,7 +47,6 @@ class Button extends AbstractButton implements ShortcutInterface
* @param DefaultConfigProvider $defaultConfigProvider
* @param ScopeConfigInterface $scopeConfig
* @param AdyenHelper $adyenHelper
* @param AdyenConfigHelper $adyenConfigHelper
* @param ConfigurationInterface $configuration
* @param array $data
*/
Expand All @@ -87,7 +60,6 @@ public function __construct(
DefaultConfigProvider $defaultConfigProvider,
ScopeConfigInterface $scopeConfig,
AdyenHelper $adyenHelper,
AdyenConfigHelper $adyenConfigHelper,
ConfigurationInterface $configuration,
array $data = []
) {
Expand All @@ -100,40 +72,28 @@ public function __construct(
$storeManagerInterface,
$scopeConfig,
$adyenHelper,
$adyenConfigHelper,
$defaultConfigProvider,
$data
);
$this->defaultConfigProvider = $defaultConfigProvider;

$this->configuration = $configuration;
}

/**
* Current Quote ID for guests
*
* @return string
* @throws LocalizedException
* @throws NoSuchEntityException
*/
public function getQuoteId(): string
public function getButtonColor(): string
{
try {
$config = $this->defaultConfigProvider->getConfig();
if (!empty($config['quoteData']['entity_id'])) {
return $config['quoteData']['entity_id'];
}
} catch (NoSuchEntityException $e) {
if ($e->getMessage() !== 'No such entity with cartId = ') {
throw $e;
}
}
return '';
return $this->configuration->getApplePayButtonColor();
}

/**
* @return string
*/
public function getButtonColor(): string
public function buildConfiguration(): array
{
return $this->configuration->getApplePayButtonColor();
$baseConfiguration = parent::buildConfiguration();
$variant = $this->getPaymentMethodVariant();

$baseConfiguration["Adyen_ExpressCheckout/js/$variant/button"]['buttonColor'] = $this->getButtonColor();

return $baseConfiguration;
}
}
Loading

0 comments on commit ea2c096

Please sign in to comment.