Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 8.7.0 #1750

Merged
merged 21 commits into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
94bf57a
Update getPaymentMethod annotation (#1726)
Morerice Sep 26, 2022
fab3b4d
[PW-6969] Fix External Platform Integrator to Adyen. (#1727)
raoulritter Sep 26, 2022
42b1fa1
PW-7197: Display merchant ID instead of name (#1728)
michaelpaul Sep 27, 2022
b46b2ef
[PW-7229] Do a clean install for E2E tests (#1725)
cenkiravul Sep 27, 2022
9c1835c
PW-7195 Add new e2e workflow for integration tests (#1730)
cenkiravul Sep 27, 2022
bf2c87b
[PW-7189] - Disable cross button and ESC key on action modal (#1731)
candemiralp Sep 28, 2022
c636a3a
[PW-7195] Add dynamic naming for E2E workflows (#1733)
cenkiravul Sep 28, 2022
2479621
[PW-7032] Add unit tests for Adyen Order Payment helper (#1732)
RokPopov Sep 28, 2022
05cad3d
fix comparison when handling capture webhook from CA (#1742)
RokPopov Sep 30, 2022
55c7235
Update ManagementHelper.php (#1738)
tigrensolutions Oct 3, 2022
8a76889
[PW-7261] Call to getAmount() failing in AdyenOrderPayment helper in …
RokPopov Oct 3, 2022
61f70f6
Recurring payments added functionality (#1729)
Morerice Oct 5, 2022
67b11c4
[PW-7268] Change the way we are comparing payment amounts in handleCa…
RokPopov Oct 5, 2022
13f94dd
[PW-7214] - Implement combo card funding source selection for POS pay…
candemiralp Oct 5, 2022
0c9358c
[PW-7275] - Add the hmac key field to the manual configuration mode (…
candemiralp Oct 6, 2022
0859ad4
PW-7278 Fix HPP Naming for Ratepay (#1757)
raoulritter Oct 6, 2022
8b899ac
[PW-7270] - Allow auto configuration on test environment without webh…
candemiralp Oct 6, 2022
6c711f6
Version bump
candemiralp Oct 6, 2022
1daaab0
[PW-7234] - Update regular expression for address parsing (#1753)
candemiralp Oct 6, 2022
736cb8b
Merge branch 'main' into develop
AlexandrosMor Oct 6, 2022
c133886
PW-7294 - Get brand only under the HPP scenario (#1758)
Morerice Oct 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/docker-compose.e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ services:
- PAYPAL_PASSWORD
volumes:
- ../../scripts/e2e.sh:/e2e.sh
- ../../../test-report:/tmp/test-report
- ../../../test-report:/tmp/test-report
3 changes: 2 additions & 1 deletion .github/scripts/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ cd adyen-integration-tools-tests;
git checkout $INTEGRATION_TESTS_BRANCH;

# Setup environment
npm ci;
rm -rf package-lock.json;
npm i;
npx playwright install --with-deps;

# Run tests
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: E2E Tests
run-name: Headless E2E test run for adyen-integration-tools-tests repo ${{inputs.testBranch}}

on:
workflow_dispatch:
inputs:
testBranch:
description: "Test Branch from Integration Tools Repo"
required: true
default: "develop"

jobs:
build:
runs-on: ubuntu-latest
env:
PHP_VERSION: "8.1"
MAGENTO_VERSION: "2.4.5"
ADMIN_USERNAME: ${{secrets.MAGENTO_ADMIN_USERNAME}}
ADMIN_PASSWORD: ${{secrets.MAGENTO_ADMIN_PASSWORD}}
steps:
- uses: actions/checkout@v2

- name: Install Magento
run: docker-compose -f .github/workflows/templates/docker-compose.yml run --rm web make magento

- name: Start web server in background
run: docker-compose -f .github/workflows/templates/docker-compose.yml up -d web
env:
DONATION_ACCOUNT: ${{secrets.DONATION_ACCOUNT}}
ADYEN_MERCHANT: ${{secrets.ADYEN_MERCHANT}}
ADYEN_API_KEY: ${{secrets.ADYEN_API_KEY}}
ADYEN_CLIENT_KEY: ${{secrets.ADYEN_CLIENT_KEY}}

- name: Setup permissions
run: docker exec magento2-container make fs

- name: Check install
run: docker exec magento2-container make sys-check

- name: Install plugin
run: docker exec -u www-data magento2-container make plugin

- name: Switch to production mode
run: docker exec -u www-data magento2-container make production

- name: Setup permissions
run: docker exec magento2-container make fs

- name: Run E2E tests
continue-on-error: true
run: docker-compose -f .github/workflows/templates/docker-compose.yml run --rm playwright /e2e.sh
env:
INTEGRATION_TESTS_BRANCH: ${{inputs.testBranch}}
MAGENTO_ADMIN_USERNAME: ${{secrets.MAGENTO_ADMIN_USERNAME}}
MAGENTO_ADMIN_PASSWORD: ${{secrets.MAGENTO_ADMIN_PASSWORD}}
MAGENTO_BASE_URL: ${{secrets.MAGENTO_BASE_URL}}
PAYPAL_USERNAME: ${{secrets.PLAYWRIGHT_PAYPAL_USERNAME}}
PAYPAL_PASSWORD: ${{secrets.PLAYWRIGHT_PAYPAL_PASSWORD}}

- name: Archive test result artifacts
uses: actions/upload-artifact@v3
with:
name: html-report
path: test-report
8 changes: 4 additions & 4 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ jobs:
build:
strategy:
matrix:
php-version: ['7.4']
magento-version: ['2.3.7', '2.4.2']
php-version: ["7.4"]
magento-version: ["2.3.7", "2.4.2"]
include:
- php-version: '8.1'
magento-version: '2.4.5'
- php-version: "8.1"
magento-version: "2.4.5"
runs-on: ubuntu-latest
env:
PHP_VERSION: ${{ matrix.php-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/templates/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ services:
aliases:
- magento2.test.com
playwright:
image: mcr.microsoft.com/playwright:v1.20.0-focal
image: mcr.microsoft.com/playwright:v1.25.0-focal
shm_size: 1gb
ipc: host
cap_add:
Expand Down
2 changes: 1 addition & 1 deletion Api/Data/OrderPaymentInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function setPaymentId($paymentId);
/**
* Gets the Paymentmethod for the payment.
*
* @return int|null PaymentMethod.
* @return string|null PaymentMethod.
*/
public function getPaymentMethod();

Expand Down
8 changes: 5 additions & 3 deletions Block/Customer/CardRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ public function __construct(
}

/**
* Can render specified token
* Returns true if methodCode = adyen_cc OR (methodCode = adyen_hpp AND maskedCC exists in details. For googlepay)
*
* @param PaymentTokenInterface $token
* @return boolean
*/
public function canRender(PaymentTokenInterface $token)
public function canRender(PaymentTokenInterface $token): bool
{
return $token->getPaymentMethodCode() === AdyenCcConfigProvider::CODE;
$details = json_decode($token->getTokenDetails() ?: '{}', true);
return $token->getPaymentMethodCode() === AdyenCcConfigProvider::CODE ||
($token->getPaymentMethodCode() === AdyenHppConfigProvider::CODE && array_key_exists('maskedCC', $details));
}

/**
Expand Down
74 changes: 74 additions & 0 deletions Block/Customer/PaymentMethodRenderer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?php
/**
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2019 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/

namespace Adyen\Payment\Block\Customer;

use Adyen\Payment\Exception\PaymentMethodException;
use Adyen\Payment\Helper\Data;
use Adyen\Payment\Helper\PaymentMethods\PaymentMethodFactory;
use Adyen\Payment\Helper\PaymentMethods\PaymentMethodInterface;
use Adyen\Payment\Model\Ui\AdyenHppConfigProvider;
use Magento\Framework\View\Element\Template\Context;
use Magento\Vault\Api\Data\PaymentTokenInterface;
use Magento\Vault\Block\AbstractTokenRenderer;

class PaymentMethodRenderer extends AbstractTokenRenderer
{
/** @var Data */
private $dataHelper;

/** @var PaymentMethodFactory */
private $paymentMethodFactory;


public function __construct(
Context $context,
Data $dataHelper,
PaymentMethodFactory $paymentMethodFactory,
array $data = []
) {
parent::__construct($context, $data);
$this->dataHelper = $dataHelper;
$this->paymentMethodFactory = $paymentMethodFactory;
}

public function getText(): string
{
try {
$paymentMethod = $this->paymentMethodFactory::createAdyenPaymentMethod($this->getTokenDetails()['type']);
$text = $paymentMethod->getPaymentMethodName();
} catch (PaymentMethodException $exception) {
$text = '';
}

return $text;
}

public function getIconUrl(): string
{
return $this->dataHelper->getVariantIcon($this->getTokenDetails()['type'])['url'];
}

public function getIconHeight(): int
{
return $this->dataHelper->getVariantIcon($this->getTokenDetails()['type'])['height'];
}

public function getIconWidth(): int
{
return $this->dataHelper->getVariantIcon($this->getTokenDetails()['type'])['width'];
}

public function canRender(PaymentTokenInterface $token): bool
{
return $token->getPaymentMethodCode() === AdyenHppConfigProvider::CODE;
}
}
26 changes: 10 additions & 16 deletions Block/Form/Cc.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Adyen\Payment\Helper\Config;
use Adyen\Payment\Helper\Data;
use Adyen\Payment\Helper\Installments;
use Adyen\Payment\Helper\PaymentMethods;
use Adyen\Payment\Helper\Recurring;
use Adyen\Payment\Helper\Vault;
use Adyen\Payment\Logger\AdyenLogger;
Expand Down Expand Up @@ -80,6 +81,9 @@ class Cc extends \Magento\Payment\Block\Form\Cc
*/
private $vaultHelper;

/** @var PaymentMethods */
private $paymentMethodsHelper;

/**
* Cc constructor.
*
Expand Down Expand Up @@ -108,6 +112,7 @@ public function __construct(
Config $configHelper,
Session $customerSession,
Vault $vaultHelper,
PaymentMethods $paymentMethodsHelper,
array $data = []
) {
parent::__construct($context, $paymentConfig);
Expand All @@ -121,6 +126,7 @@ public function __construct(
$this->configHelper = $configHelper;
$this->customerSession = $customerSession;
$this->vaultHelper = $vaultHelper;
$this->paymentMethodsHelper = $paymentMethodsHelper;
}

/**
Expand Down Expand Up @@ -163,26 +169,14 @@ public function getLocale()
}

/**
* Retrieve available credit card type codes by alt code
* Retrieve available credit card type codes by alt code. Function is required so that it can be called
* from block form
*
* @return array
*/
public function getCcAvailableTypesByAlt()
public function getCcAvailableTypesByAlt(): array
{
$types = [];
$ccTypes = $this->adyenHelper->getAdyenCcTypes();

$availableTypes = $this->adyenHelper->getAdyenCcConfigData('cctypes');
if ($availableTypes) {
$availableTypes = explode(',', $availableTypes);
foreach (array_keys($ccTypes) as $code) {
if (in_array($code, $availableTypes)) {
$types[$ccTypes[$code]['code_alt']] = $code;
}
}
}

return $types;
return $this->paymentMethodsHelper->getCcAvailableTypesByAlt();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Controller/Process/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,10 @@ protected function validateResponse($response)
if (!empty($response['additionalData']['recurring.recurringDetailReference']) &&
$this->payment->getMethodInstance()->getCode() !== \Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider::CODE) {
if ($this->vaultHelper->isCardVaultEnabled()) {
$this->vaultHelper->saveRecurringDetails($this->payment, $response['additionalData']);
$this->vaultHelper->saveRecurringCardDetails($this->payment, $response['additionalData']);
} else {
$order = $this->payment->getOrder();
$this->recurringHelper->createAdyenBillingAgreement($order, $response['additionalData'], $this->payment->getAdditionalInformation());
$this->recurringHelper->createAdyenBillingAgreement($order, $response['additionalData']);
}
$this->orderResourceModel->save($order);
}
Expand Down
18 changes: 18 additions & 0 deletions Exception/InvalidAdditionalDataException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
*
* Adyen Payment Module
*
* @author Adyen BV <support@adyen.com>
* @copyright (c) 2022 Adyen B.V.
* @license https://opensource.org/licenses/MIT MIT license
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/

namespace Adyen\Payment\Exception;

class InvalidAdditionalDataException extends AbstractAdyenException
{

}
18 changes: 18 additions & 0 deletions Exception/PaymentMethodException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
*
* Adyen Payment Module
*
* @author Adyen BV <support@adyen.com>
* @copyright (c) 2022 Adyen B.V.
* @license https://opensource.org/licenses/MIT MIT license
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/

namespace Adyen\Payment\Exception;

class PaymentMethodException extends AbstractAdyenException
{

}
65 changes: 0 additions & 65 deletions Gateway/Http/Client/TransactionAuthorization.php

This file was deleted.

Loading