Skip to content

Commit

Permalink
Merge pull request #608 from Adyen/prepare-release-3
Browse files Browse the repository at this point in the history
Prepare release 3.17.5
  • Loading branch information
goran-stamenkovski-logeecom authored Jan 30, 2025
2 parents d128df3 + fc514d4 commit 8804d14
Show file tree
Hide file tree
Showing 15 changed files with 68 additions and 64 deletions.
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
2 changes: 1 addition & 1 deletion .github/workflows/templates/docker-compose.playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'

services:
playwright:
image: mcr.microsoft.com/playwright:v1.49.1-noble
image: mcr.microsoft.com/playwright:v1.50.0-noble
networks:
- localnetwork
shm_size: 1gb
Expand Down
10 changes: 1 addition & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}
],
"description": "Official Shopware 6 Plugin to connect to Payment Service Provider Adyen",
"version": "3.17.4",
"version": "3.17.5",
"type": "shopware-platform-plugin",
"license": "MIT",
"require": {
Expand Down 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.

2 changes: 1 addition & 1 deletion src/Resources/app/storefront/build/storefront/js/adyen-payment-shopware65.js.dist
100644 → 100755

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Resources/app/storefront/dist/storefront/js/adyen-payment-shopware6.js
100644 → 100755

Large diffs are not rendered by default.

25 changes: 9 additions & 16 deletions src/Resources/app/storefront/src/checkout/confirm-order.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,9 @@ 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 +145,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,17 +357,20 @@ 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) {
// Bootstrap v4 support
$('[data-adyen-payment-action-modal]').modal({show: true});
} else {
// Bootstrap v5 support
var adyenPaymentModal = new bootstrap.Modal(document.getElementById('adyen-payment-action-modal'), {
if (typeof bootstrap !== 'undefined' && typeof bootstrap.Modal === 'function') {
// Bootstrap 5 modal support
const adyenPaymentModal = new bootstrap.Modal(document.getElementById('adyen-payment-action-modal'), {
keyboard: false
});
adyenPaymentModal.show();
} else if (window.jQuery && typeof $.fn.modal === 'function') {
// Bootstrap 4 modal support
$('[data-adyen-payment-action-modal]').modal({ show: true });
} else {
console.error("No modal implementation found. Please check your setup.");
}
}

}
} catch (e) {
console.log(e);
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 @@ -167,6 +168,7 @@ public function run(): void
$logContext = ['eventCode' => $notification->getEventCode()];

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

Expand All @@ -192,6 +194,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 @@ -164,7 +164,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 @@ -116,4 +116,19 @@ public function getWithId(string $orderTransactionId): ?OrderTransactionEntity

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

/**
* @param OrderTransactionEntity $orderTransactionEntity
*
* @return void
*
* @throws \JsonException
*/
public function updateCustomFields(OrderTransactionEntity $orderTransactionEntity): void
{
$this->repository->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

0 comments on commit 8804d14

Please sign in to comment.