Skip to content

Commit

Permalink
Merge pull request #2460 from Adyen/develop-8
Browse files Browse the repository at this point in the history
Release 8.22.7
  • Loading branch information
khushboo-singhvi authored Jan 26, 2024
2 parents f597689 + 68f549f commit 858ee87
Show file tree
Hide file tree
Showing 9 changed files with 102 additions and 48 deletions.
15 changes: 0 additions & 15 deletions .github/scripts/e2e-all.sh

This file was deleted.

35 changes: 24 additions & 11 deletions .github/scripts/e2e.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
#!/bin/bash
set -euo pipefail

# Checkout E2E tests
cd /tmp;
git clone https://github.com/Adyen/adyen-integration-tools-tests.git;
cd adyen-integration-tools-tests;
git checkout $INTEGRATION_TESTS_BRANCH;
# Base configuration and installation
set -euo pipefail
cd /tmp
git clone https://github.com/Adyen/adyen-integration-tools-tests.git
cd adyen-integration-tools-tests
git checkout $INTEGRATION_TESTS_BRANCH
rm -rf package-lock.json
npm i

# Setup environment
rm -rf package-lock.json;
npm i;
option="$1"

# Run tests
npm run test:ci:magento
# Run the desired group of tests
case $option in
"standard")
echo "Running Standard Set of E2E Tests."
npm run test:ci:magento
;;
"express-checkout")
echo "Running Express Checkout E2E Tests."
npm run test:ci:magento:express-checkout
;;
"all")
echo "Running All Magento E2E Tests"
npm run test:ci:magento:all
;;
esac
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Adyen Payment Plugin V8 Integration Test Dispatch Pipeline
run-name: --V8-- E2E tests against Test Repository ${{inputs.testBranch}} with Express Checkout ${{inputs.expressBranch}}
name: Integration Test Repository Dispatch Pipeline for V8
run-name: --V8-- E2E tests against Test Repository ${{inputs.testBranch}} with Express Checkout ${{inputs.expressBranch}} with test group ${{inputs.testGroup}}

on:
workflow_dispatch:
Expand All @@ -12,14 +12,18 @@ on:
description: "Express Checkout Repository Pipeline"
required: true
default: "develop-1"
testGroup:
description: "Test group"
required: true
default: "all"
type: choice
options:
- all
- standard
- express-checkout

jobs:
build:
if: |
${{
github.event.pull_request.draft == false &&
(github.actor != 'renovate' || github.actor != 'lgtm-com')
}}
runs-on:
group: larger-runners
labels: ubuntu-latest-8-cores
Expand Down Expand Up @@ -52,10 +56,35 @@ jobs:
- name: Install plugin
run: docker exec -u www-data magento2-container make plugin

- name: Kill Cron Jobs
run: docker exec magento2-container /etc/init.d/cron stop

- name: Checkout developer module
uses: actions/checkout@v3
with:
repository: Adyen/adyen-magento2-dev
ref: 'main'
token: ${{ secrets.ADYEN_AUTOMATION_BOT_TEST_ACCESS_TOKEN }}
path: Developer

- name: Make the folder for dev module
run: docker exec -u www-data magento2-container mkdir -p /var/www/html/app/code/Adyen

- name: Copy dev module into Docker container
run: docker cp ./Developer magento2-container:/var/www/html/app/code/Adyen

- name: Change ownership of developer module folder
run: docker exec magento2-container chown -R www-data:www-data /var/www/html/app/code/Adyen/Developer

- name: Enable developer module
run: docker exec -u www-data magento2-container make dev-module

- name: Install Express module
if: ${{inputs.expressBranch != 'disable'}}
run: docker exec -u www-data magento2-container composer require adyen/adyen-magento2-expresscheckout:dev-${{inputs.expressBranch}}

- name: Enable Express module
if: ${{inputs.expressBranch != 'disable'}}
run: docker exec -u www-data magento2-container make enable-express

- name: Switch to production mode
Expand All @@ -65,7 +94,7 @@ jobs:
run: docker exec magento2-container make fs

- name: Run E2E tests
run: docker-compose -f .github/workflows/templates/docker-compose.yml run --rm playwright /e2e-all.sh
run: docker-compose -f .github/workflows/templates/docker-compose.yml run --rm playwright /e2e.sh ${{inputs.testGroup}}
env:
INTEGRATION_TESTS_BRANCH: ${{inputs.testBranch}}
MAGENTO_ADMIN_USERNAME: ${{secrets.MAGENTO_ADMIN_USERNAME}}
Expand All @@ -78,8 +107,8 @@ jobs:
ADYEN_MERCHANT: ${{secrets.ADYEN_MERCHANT}}
GOOGLE_USERNAME: ${{secrets.GOOGLE_USERNAME}}
GOOGLE_PASSWORD: ${{secrets.GOOGLE_PASSWORD}}
WEBHOOK_USERNAME: ${{secrets.WEBHOOK_USERNAME}}
WEBHOOK_PASSWORD: ${{secrets.WEBHOOK_PASSWORD}}
WEBHOOK_USERNAME: admin
WEBHOOK_PASSWORD: 1234

- name: Archive test result artifacts
if: always()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Magento 2 V8 Release E2E Pipeline
run-name: --V8-- E2E tests against Test Repository with Express Checkout
name: Magento 2 V8 Express Checkout E2E Pipeline
run-name: --V8-- Adyen Magento 2 Express Checkout Plugin E2E tests

on:
pull_request:
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
run: docker exec magento2-container make fs

- name: Run E2E tests
run: docker-compose -f .github/workflows/templates/docker-compose.yml run --rm playwright /e2e-all.sh
run: docker-compose -f .github/workflows/templates/docker-compose.yml run --rm playwright /e2e.sh express-checkout
env:
INTEGRATION_TESTS_BRANCH: develop-8
MAGENTO_ADMIN_USERNAME: ${{secrets.MAGENTO_ADMIN_USERNAME}}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ run-name: --V8-- E2E tests for Adyen Magento2 Plugin
on:
pull_request:
types: [opened, synchronize]
branches-ignore: [main, main-8]

jobs:
build:
Expand Down Expand Up @@ -54,7 +53,7 @@ jobs:
run: docker exec magento2-container make fs

- name: Run E2E tests
run: docker-compose -f .github/workflows/templates/docker-compose.yml run --rm playwright /e2e.sh
run: docker-compose -f .github/workflows/templates/docker-compose.yml run --rm playwright /e2e.sh standard
env:
INTEGRATION_TESTS_BRANCH: develop-8
MAGENTO_ADMIN_USERNAME: ${{secrets.MAGENTO_ADMIN_USERNAME}}
Expand Down
26 changes: 23 additions & 3 deletions Gateway/Request/RecurringVaultDataBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@

namespace Adyen\Payment\Gateway\Request;

use Adyen\Payment\Helper\Config;
use Adyen\Payment\Helper\StateData;
use Adyen\Payment\Helper\Vault;
use Adyen\Payment\Model\Ui\AdyenCcConfigProvider;
use Adyen\Payment\Model\Ui\AdyenHppConfigProvider;
use Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider;
use Magento\Framework\Exception\LocalizedException;
use Magento\Payment\Gateway\Data\PaymentDataObject;
use Magento\Payment\Gateway\Helper\SubjectReader;
use Magento\Payment\Gateway\Request\BuilderInterface;
Expand All @@ -26,18 +29,26 @@ class RecurringVaultDataBuilder implements BuilderInterface
*/
private $stateData;

public function __construct(StateData $stateData)
{
/**
* @var Config
*/
private $configHelper;

public function __construct(
StateData $stateData,
Config $configHelper
) {
$this->stateData = $stateData;
$this->configHelper = $configHelper;
}

/**
* @param array $buildSubject
* @return array
* @throws LocalizedException
*/
public function build(array $buildSubject)
{
$requestBody = [];
/** @var PaymentDataObject $paymentDataObject */
$paymentDataObject = SubjectReader::readPayment($buildSubject);
$payment = $paymentDataObject->getPayment();
Expand All @@ -53,6 +64,15 @@ public function build(array $buildSubject)
// For now this will only be used by tokens created trough adyen_hpp payment methods
if (array_key_exists(Vault::TOKEN_TYPE, $details)) {
$requestBody['recurringProcessingModel'] = $details[Vault::TOKEN_TYPE];
} else if ($paymentMethod->getCode() === AdyenCcConfigProvider::CC_VAULT_CODE ||
$paymentMethod->getCode() === AdyenOneclickConfigProvider::CODE) {
$requestBody['recurringProcessingModel'] = $this->configHelper->getCardRecurringType(
$order->getStoreId()
);
} else if ($paymentMethod->getCode() === AdyenHppConfigProvider::class ) {
$requestBody['recurringProcessingModel'] = $this->configHelper->getAlternativePaymentMethodTokenType(
$order->getStoreId()
);
}

/*
Expand Down
12 changes: 10 additions & 2 deletions Helper/Creditmemo.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,16 @@ public function linkAndUpdateAdyenCreditmemos(
$adyenCreditmemo[CreditmemoInterface::ENTITY_ID],
CreditmemoInterface::ENTITY_ID
);
$currAdyenCreditmemo->setCreditmemoId($magentoCreditmemo->getEntityId());
$this->adyenCreditmemoResourceModel->save($currAdyenCreditmemo);

if ($currAdyenCreditmemo->getCreditmemoId() !== null) {
continue;
}

if ($currAdyenCreditmemo->getAmount() == $magentoCreditmemo->getGrandTotal()) {
$currAdyenCreditmemo->setCreditmemoId($magentoCreditmemo->getEntityId());
$this->adyenCreditmemoResourceModel->save($currAdyenCreditmemo);
break;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "adyen/module-payment",
"description": "Official Magento2 Plugin to connect to Payment Service Provider Adyen.",
"type": "magento2-module",
"version": "8.22.6",
"version": "8.22.7",
"license": "MIT",
"repositories": [
{
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Adyen_Payment" setup_version="8.22.6">
<module name="Adyen_Payment" setup_version="8.22.7">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Quote"/>
Expand Down

0 comments on commit 858ee87

Please sign in to comment.