Skip to content

Commit

Permalink
Merge pull request #100 from Adyen/develop
Browse files Browse the repository at this point in the history
Release v2.2.0
  • Loading branch information
khushboo-singhvi authored Aug 23, 2024
2 parents 8ba6e47 + ea2c096 commit d63b452
Show file tree
Hide file tree
Showing 54 changed files with 2,563 additions and 509 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release

on:
# Manual run from Github UI (e.g. for when a merged PR labels have changed)
workflow_dispatch:
inputs:
pre-release:
required: false
type: boolean
default: false
description: "This release will be labeled as non-production ready"
# Publish the current version now, useful if the automated run failed
github-release:
required: false
type: boolean
default: false
description: "Publish Github release for the current version"
# Monitor pull request events

pull_request:
types:
- closed
branches:
- main

jobs:
release:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prepare the next main release
uses: Adyen/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
develop-branch: main
version-files: composer.json
release-title: Adyen Magento 2 Express Checkout Module
pre-release: ${{ inputs.pre-release || false }}
# For a manual Github release
github-release: ${{ inputs.github-release || false }}
separator: .pre.beta
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 <[email protected]>
*/
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 <[email protected]>
*/
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 <[email protected]>
*/
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 <[email protected]>
*/
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 d63b452

Please sign in to comment.