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

Prepare release 4.2.4 #607

Merged
merged 21 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
24 changes: 1 addition & 23 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,4 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: html-report
path: test-report

- name: Copy Adyen api logs from container if available
if: always()
run: |
# Create a local directory for logs
mkdir -p logs

# Check if the log file exists in the container
if docker exec shopware6 test -f /var/www/html/var/log/adyen/api.log; then
echo "Log file exists. Copying..."
docker cp shopware6:/var/www/html/var/log/adyen/api.log logs
else
echo "Log file does not exist. Skipping copy."
fi
shell: bash

- name: Upload Adyen api Logs
if: always()
uses: actions/upload-artifact@v3
with:
name: adyen-api-logs
path: logs/*
path: test-report
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ test.describe.parallel("Payment via Klarna", () => {
await verifySuccessfulPayment(page, true, 25000);
});

test("Pay Now should fail gracefully when cancelled", async ({ page }) => {
test.skip("Pay Now should fail gracefully when cancelled", async ({ page }) => {
const klarnaPaymentPage = await proceedToKlarnaPayNow(page);
await klarnaPaymentPage.cancelKlarnaPayment();
await verifyFailedPayment(page, false);
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/scripts/prepare-release-asset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ rm -rf AdyenPaymentShopware6/vendor
# Install dependencies
composer install --no-dev --working-dir=./AdyenPaymentShopware6

# Overwrite installed.php with an empty array
echo "<?php return array();" > AdyenPaymentShopware6/vendor/composer/installed.php

# Copy original the composer.json file
cp adyen-shopware6/composer.json AdyenPaymentShopware6/.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
volumes:
- ../scripts/e2e.sh:/e2e.sh
- ../e2e/adyen-integration-tools-tests/:/tmp/adyen-integration-tools-tests/
- ../../test-report:/tmp/test-report
- ../../../test-report:/tmp/test-report

networks:
localnetwork:
Expand Down
8 changes: 0 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,5 @@
"allow-plugins": {
"symfony/*": true
}
},
"scripts": {
"post-install-cmd": [
"rm -f vendor/composer/installed.php"
],
"post-update-cmd": [
"rm -f vendor/composer/installed.php"
]
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,10 @@ export default class ConfirmOrderPlugin extends Plugin {

if (this.selectedAdyenPaymentMethod === "klarna_b2b") {
const companyNameElement = DomAccess.querySelector(document, '#adyen-company-name');
const registrationNumberElement = DomAccess.querySelector(document, '#adyen-registration-number');

const companyName = companyNameElement ? companyNameElement.value.trim() : '';
const registrationNumber = registrationNumberElement ? registrationNumberElement.value.trim() : '';
const companyNameError = DomAccess.querySelector(document, '#adyen-company-name-error');
const registrationNumberError = DomAccess.querySelector(document, '#adyen-registration-number-error');
companyNameError.style.display = 'none';
registrationNumberError.style.display = 'none';

let hasError = false;

Expand All @@ -150,11 +146,6 @@ export default class ConfirmOrderPlugin extends Plugin {
hasError = true;
}

if (!registrationNumber) {
registrationNumberError.style.display = 'block';
hasError = true;
}

if (hasError) {
event.preventDefault();
return;
Expand Down Expand Up @@ -367,7 +358,9 @@ export default class ConfirmOrderPlugin extends Plugin {
.mount('[data-adyen-payment-action-container]');
const modalActionTypes = ['threeDS2', 'qrCode']
if (modalActionTypes.includes(paymentResponse.action.type)) {
if (window.jQuery) {
const bootstrapVersion = window.jQuery && $.fn.tooltip && $.fn.tooltip.Constructor && $.fn.tooltip.Constructor.VERSION;
const isBootstrap4 = bootstrapVersion && bootstrapVersion.startsWith('4');
if (window.jQuery && isBootstrap4) {
// Bootstrap v4 support
$('[data-adyen-payment-action-modal]').modal({show: true});
} else {
Expand Down
8 changes: 8 additions & 0 deletions src/Resources/snippet/de_DE/messages.de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
"remainingBalance": "Verbleibendes guthaben der geschenkkarte",
"remainingAmount": "Restbetrag",
"discount": "Geschenkkarten-Rabatt"
},
"billie": {
"companyName": "Firmenname*",
"companyNamePlaceholder": "Firmenname eingeben",
"companyNumber": "Registernummer",
"companyNumberPlaceholder": "Registernummer eingeben",
"requiredFields": "Die mit einem Stern (*) markierten Felder sind Pflichtfelder.",
"companyNameRequired": "Firmenname ist erforderlich."
}
}
}
8 changes: 8 additions & 0 deletions src/Resources/snippet/en_GB/messages.en-GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
"deductedAmount": "Deducted Amount",
"remainingAmount": "Remaining amount",
"discount": "Giftcard discount"
},
"billie": {
"companyName": "Company Name*",
"companyNamePlaceholder": "Enter your company name",
"companyNumber": "Company Registration Number",
"companyNumberPlaceholder": "Enter your registration number",
"requiredFields": "Fields marked with asterisks (*) are required.",
"companyNameRequired": "Company name is required."
}
}
}
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
{% if payment.formattedHandlerIdentifier == 'handler_adyen_billiepaymentmethodhandler' %}
<div id="billie-payment-fields" class="billie-fields">
<p class="text-muted mt-2">
All fields are required unless marked otherwise.
{{ "adyen.billie.requiredFields"|trans }}
</p>
<div class="form-group" style="margin-bottom: 10px">
<label for="adyen-company-name">Company Name</label>
<label for="adyen-company-name">{{ "adyen.billie.companyName"|trans }}</label>
<input
type="text"
id="adyen-company-name"
name="companyName"
value="{{ adyenFrontendData.companyName }}"
placeholder="Enter your company name"
placeholder="{{ "adyen.billie.companyNamePlaceholder"|trans }}"
class="form-control"
required
/>
</div>
<span id="adyen-company-name-error" class="text-danger" style="display: none; margin-bottom: 15px">Company name is required.</span>
<span id="adyen-company-name-error" class="text-danger" style="display: none; margin-bottom: 15px">{{ "adyen.billie.companyNameRequired"|trans }}</span>
<div class="form-group" style="margin-bottom: 10px">
<label for="adyen-registration-number">Company Registration Number</label>
<label for="adyen-registration-number">{{ "adyen.billie.companyNumber"|trans }}</label>
<input
type="text"
id="adyen-registration-number"
name="registrationNumber"
placeholder="Enter your registration number"
placeholder="{{ "adyen.billie.companyNumberPlaceholder"|trans }}"
class="form-control"
required
/>
</div>
<span id="adyen-registration-number-error" class="text-danger" style="display: none; margin-bottom: 10px">Registration number is required.</span>
</div>
{% endif %}
11 changes: 11 additions & 0 deletions src/ScheduledTask/ProcessNotificationsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

use Adyen\Shopware\Entity\Notification\NotificationEntity;
use Adyen\Shopware\Exception\CaptureException;
use Adyen\Shopware\Handlers\PaymentResponseHandler;
use Adyen\Shopware\ScheduledTask\Webhook\WebhookHandlerFactory;
use Adyen\Shopware\Service\AdyenPaymentService;
use Adyen\Shopware\Service\CaptureService;
Expand Down Expand Up @@ -172,6 +173,7 @@ public function run(): void
$logContext = ['eventCode' => $notification->getEventCode()];

if (is_null($notification->getMerchantReference())) {
$this->markAsDone($notification->getId(), '');
continue;
}

Expand All @@ -197,6 +199,15 @@ public function run(): void
continue;
}

$customFields = $orderTransaction->getCustomFields();

if (empty($customFields[PaymentResponseHandler::ORIGINAL_PSP_REFERENCE])) {
$customFields[PaymentResponseHandler::ORIGINAL_PSP_REFERENCE] =
$notification->getOriginalReference();
$orderTransaction->setCustomFields($customFields);
$this->orderTransactionRepository->updateCustomFields($orderTransaction);
}

$currentTransactionState = $this->getCurrentTransactionState($orderTransaction, $notification);
if (is_null($currentTransactionState)) {
continue;
Expand Down
3 changes: 2 additions & 1 deletion src/Service/NotificationReceiverService.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ private function processNotificationItem($notificationItem, $salesChannelId): bo
print_r($notificationItem, true));

// check if notification already exists
if (!$this->notificationService->isDuplicateNotification($notificationItem)) {
if (!$this->notificationService->isDuplicateNotification($notificationItem)
&& !empty($notificationItem['merchantReference'])) {
try {
$this->notificationService->insertNotification($notificationItem);
return true;
Expand Down
15 changes: 15 additions & 0 deletions src/Service/Repository/OrderTransactionRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,19 @@ public function getWithId(string $orderTransactionId): ?OrderTransactionEntity

return $this->orderTransactionRepository->search($criteria, Context::createDefaultContext())->first();
}

/**
* @param OrderTransactionEntity $orderTransactionEntity
*
* @return void
*
* @throws \JsonException
*/
public function updateCustomFields(OrderTransactionEntity $orderTransactionEntity): void
{
$this->orderTransactionRepository->update([
'id' => $orderTransactionEntity->getId(),
'customFields' => json_encode($orderTransactionEntity->getCustomFields(), JSON_THROW_ON_ERROR)
], Context::createDefaultContext());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,15 @@ private function extendPaymentMethodsData(SalesChannelContext $context, PaymentM
}
}

private function getPaymentMethodConfigByType(SalesChannelContext $context, string $type)
private function getPaymentMethodConfigByType(SalesChannelContext $context, string $type): ?array
{
$paymentMethodsResponse = $this->getPaymentMethodsResponse($context);
if (empty($paymentMethodsResponse->getPaymentMethods())) {
return null;
}
foreach ($paymentMethodsResponse->getPaymentMethods() as $paymentMethodConfig) {
if (($paymentMethodConfig->getType() ?? null) == $type) {
return $paymentMethodConfig;
return $paymentMethodConfig->toArray();
}
}

Expand Down