Skip to content

Commit

Permalink
Merge pull request #434 from Adyen/develop
Browse files Browse the repository at this point in the history
Release 3.14.2
  • Loading branch information
khushboo-singhvi authored Nov 27, 2023
2 parents b620109 + e208e75 commit e583daa
Show file tree
Hide file tree
Showing 22 changed files with 290 additions and 103 deletions.
2 changes: 1 addition & 1 deletion 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.14.1",
"version": "3.14.2",
"type": "shopware-platform-plugin",
"license": "MIT",
"require": {
Expand Down
3 changes: 1 addition & 2 deletions src/Controller/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@
use Symfony\Component\Routing\Annotation\Route;

/**
* @Route(defaults={"_routeScope"={"administration"}})
*
* Class AdminController
* @package Adyen\Shopware\Controller
* @Route(defaults={"_routeScope"={"administration"}})
*/
class AdminController
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
<div v-if="showWidget">
<sw-card :title="$tc('adyen.notificationsTitle')">
<sw-data-grid
v-if="notifications.length"
:dataSource="notifications"
:columns="columns"
:showActions="true"
:showSelection="false"
:showSettings="true"
>
{% block sw_data_grid_body_columns %}
{% block sw_data_grid_column_actions %}
<template #actions="{ item }">
{% block sw_data_grid_column_actions_reschedule %}
<sw-context-menu-item
v-if="item.canBeRescheduled"
@click="onReschedule(item)"
>
{{ $tc('adyen.reprocessNotification') }}
</sw-context-menu-item>
{% endblock %}
</template>
{% block adyen_notifications %}
<div v-if="showWidget">
<sw-card :title="$tc('adyen.notificationsTitle')">
<sw-data-grid
v-if="notifications.length"
:dataSource="notifications"
:columns="columns"
:showActions="true"
:showSelection="false"
:showSettings="true"
>
{% block sw_data_grid_body_columns %}
{% block sw_data_grid_column_actions %}
<template #actions="{ item }">
{% block sw_data_grid_column_actions_reschedule %}
<sw-context-menu-item
v-if="item.canBeRescheduled"
@click="onReschedule(item)"
>
{{ $tc('adyen.reprocessNotification') }}
</sw-context-menu-item>
{% endblock %}
</template>
{% endblock %}
{% endblock %}
{% endblock %}
</sw-data-grid>
<p v-if="!notifications.length">{{ $tc('adyen.noNotificationsReceived') }}</p>
</sw-card>
</div>
</sw-data-grid>
<p v-if="!notifications.length">{{ $tc('adyen.noNotificationsReceived') }}</p>
</sw-card>
</div>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,9 +1,59 @@
<ul v-if="showWidget">
<dt>{{ $tc('adyen.authorisedPayments') }}</dt>
<dd v-for="payment in partialPayments">
<a v-bind:href="payment.caLink" target="_blank">{{ payment.pspReference }}</a> -
<span>{{ payment.method }}</span> -
<span>{{ payment.amount }}</span>
</dd>
<dd>{{ errorMessage }}</dd>
</ul>
<div v-if="showWidget">
<ul v-if="isVersionOlderThan65">
<dt>{{ $tc('adyen.authorisedPayments') }}</dt>
<dd v-for="payment in partialPayments">
<a v-bind:href="payment.caLink" target="_blank">{{ payment.pspReference }}</a> -
<span>{{ payment.method }}</span> -
<span>{{ payment.amount }}</span>
</dd>
<dd>{{ errorMessage }}</dd>
</ul>
<ul v-else>
<label>{{ $tc('adyen.authorisedPayments') }}</label>
<div class="sw-data-grid is--compact sw-data-grid--plain-appearance">
<div class="sw-data-grid__wrapper">
<table class="sw-data-grid__table">
<thead class="sw-data-grid__header">
<tr class="sw-data-grid__rx ow">
<th class="sw-data-grid__cell sw-data-grid__cell--header sw-data-grid__cell--property sw-data-grid__cell--sortable sw-data-grid__cell--align-left">
<div class="sw-data-grid__cell-content">
PSP Reference
</div>
</th>
<th class="sw-data-grid__cell sw-data-grid__cell--header sw-data-grid__cell--property sw-data-grid__cell--sortable sw-data-grid__cell--align-left">
<div class="sw-data-grid__cell-content">
Payment Method
</div>
</th>
<th class="sw-data-grid__cell sw-data-grid__cell--header sw-data-grid__cell--property sw-data-grid__cell--sortable sw-data-grid__cell--align-left">
<div class="sw-data-grid__cell-content">
Amount
</div>
</th>
</tr>
</thead>
<tbody class="sw-data-grid__body">
<tr v-for="payment in partialPayments" class="sw-data-grid__row">
<td class="sw-data-grid__cell sw-data-grid__cell--order sw-data-grid__cell--align-left">
<div class="sw-data-grid__cell-content">
<a v-bind:href="payment.caLink" target="_blank">{{ payment.pspReference }}</a>
</div>
</td>
<td class="sw-data-grid__cell sw-data-grid__cell--order sw-data-grid__cell--align-left">
<div class="sw-data-grid__cell-content">
{{ payment.method }}
</div>
</td>
<td class="sw-data-grid__cell sw-data-grid__cell--order sw-data-grid__cell--align-left">
<div class="sw-data-grid__cell-content">
{{ payment.amount }}
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<span>{{ errorMessage }}</span>
</ul>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

const { Component } = Shopware;
import template from './adyen-partial-payments.html.twig';
import VersionHelper from '../../helper/versionHelper';

Component.register('adyen-partial-payments', {
template,
Expand Down Expand Up @@ -52,11 +53,14 @@ Component.register('adyen-partial-payments', {
errorMessage: "",
partialPayments: [],
showWidget: false,
isVersionOlderThan65: false
}
},

beforeMount() {
this.isVersionOlderThan65 = VersionHelper.isVersionOlderThan65();
this.showWidget = this.adyenService.isAdyenOrder(this.order);

if (this.showWidget) {
this.fetchAdyenPartialPayments();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,44 +1,46 @@
<sw-card :isLoading="isLoading" :title="$tc('adyen.adyenPaymentCaptureTitle')" v-if="showWidget" :large="false" :hero="false">
<div v-if="!errorOccurred">
<div class="adyen-card-header">
<div class="adyen-card-header-first">
<span v-if="!captureRequests.length">{{ $tc('adyen.noCaptureRequests') }}</span>
</div>
<div id="modalButtonContainer">
<sw-button
:disabled="!allowCapture"
:square="false"
:block="false"
@click="openModal"
class="sw-button--small">
{{ $tc('adyen.sendCaptureRequest') }}
</sw-button>
</div>
<sw-modal v-if="showModal"
@modal-close="onCloseModal"
:title="$tc('adyen.captureConfirm') + ': ' + order.orderNumber"
variant="small">
<template #modal-footer>
<sw-button @click="onCloseModal" size="small">
{{ $tc('global.default.cancel') }}
</sw-button>

<sw-button @click="onSubmitCapture" variant="primary" size="small" :isLoading="isLoading">
{% block adyen_capture %}
<sw-card :isLoading="isLoading" :title="$tc('adyen.adyenPaymentCaptureTitle')" v-if="showWidget" :large="false" :hero="false">
<div v-if="!errorOccurred">
<div class="adyen-card-header">
<div class="adyen-card-header-first">
<span v-if="!captureRequests.length">{{ $tc('adyen.noCaptureRequests') }}</span>
</div>
<div id="modalButtonContainer">
<sw-button
:disabled="!allowCapture"
:square="false"
:block="false"
@click="openModal"
class="sw-button--small">
{{ $tc('adyen.sendCaptureRequest') }}
</sw-button>
</template>
</sw-modal>
</div>
<sw-modal v-if="showModal"
@modal-close="onCloseModal"
:title="$tc('adyen.captureConfirm') + ': ' + order.orderNumber"
variant="small">
<template #modal-footer>
<sw-button @click="onCloseModal" size="small">
{{ $tc('global.default.cancel') }}
</sw-button>

<sw-button @click="onSubmitCapture" variant="primary" size="small" :isLoading="isLoading">
{{ $tc('adyen.sendCaptureRequest') }}
</sw-button>
</template>
</sw-modal>
</div>
<sw-data-grid
v-if="captureRequests.length"
:dataSource="captureRequests"
:columns="columns"
:showSelection="false"
:showActions="false"
:isLoading="isLoading">
</sw-data-grid>
</div>
<div v-else>
{{ $tc('adyen.error') }}
</div>
<sw-data-grid
v-if="captureRequests.length"
:dataSource="captureRequests"
:columns="columns"
:showSelection="false"
:showActions="false"
:isLoading="isLoading">
</sw-data-grid>
</div>
<div v-else>
{{ $tc('adyen.error') }}
</div>
</sw-card>
</sw-card>
{% endblock %}
44 changes: 44 additions & 0 deletions src/Resources/app/administration/src/helper/versionHelper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen plugin for Shopware 6
*
* Copyright (c) 2023 Adyen N.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*
*/
let exports = {};

exports.isVersionOlderThan65 = () => {
function semverCompare(a, b) {
if (a.startsWith(b + "-")) {
return -1
} else if (b.startsWith(a + "-")) {
return 1
}

return a.localeCompare(b, undefined, { numeric: true, sensitivity: "case", caseFirst: "upper" })
};

const version = Shopware.Context.app.config.version;

if (semverCompare(version, "6.5.0.0") === -1) {
return true
} else {
return false;
}
};

export default exports;
2 changes: 2 additions & 0 deletions src/Resources/app/administration/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ import './component/adyen-payment-capture';
import './component/adyen-refund';
import './component/adyen-notifications';
import './component/adyen-partial-payments';
import './sw-order-detail-general-override/index';
import './sw-order-detail-base-override/index';
import './sw-order-user-card-override/index';
import './sw-order-detail-details-override/index';
import './component/entity/sw-entity-single-select-override';

import localeEnGb from './snippet/en_GB.json';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import template from './sw-order-detail-details.html.twig';

Shopware.Component.override('sw-order-detail-details', {
template
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% block sw_order_detail_details_payment_method_select %}
{% parent %}

<adyen-partial-payments :order="order"></adyen-partial-payments>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import template from './sw-order-detail-general.html.twig';

Shopware.Component.override('sw-order-detail-general', {
template
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% block sw_order_detail_general_line_items_card %}
{% parent %}
<adyen-payment-capture :order="order"></adyen-payment-capture>
<adyen-refund :order="order"></adyen-refund>
<adyen-notifications :order="order"></adyen-notifications>
{% endblock %}

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/Resources/config/services/subscribers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
<service id="Adyen\Shopware\Subscriber\ContextSubscriber">
<argument type="service" id="Adyen\Shopware\Service\ConfigurationService"/>
<argument type="service" id="Adyen\Shopware\Service\PaymentStateDataService"/>
<argument type="service" id="Shopware\Core\System\SalesChannel\SalesChannel\ContextSwitchRoute"/>
<argument type="service" id="Shopware\Core\Checkout\Cart\CartPersister"/>
<argument type="service" id="Shopware\Core\Checkout\Cart\CartCalculator"/>
<argument type="service" id="Adyen\Util\Currency"/>
<tag name="kernel.event_subscriber"/>
</service>
<service id="Adyen\Shopware\Subscriber\Response\PaymentMethodRouteResponseSubscriber">
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Service/PaymentMethodsFilterService.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public function getAvailableGiftcards(

public function filterAdyenPaymentMethodsByType(array $paymentMethodsResponse, string $type): array
{
return array_filter($paymentMethodsResponse['paymentMethods'], function ($item) use ($type) {
return array_filter($paymentMethodsResponse['paymentMethods'] ?? [], function ($item) use ($type) {
return $item['type'] === $type;
});
}
Expand Down
Loading

0 comments on commit e583daa

Please sign in to comment.