Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions CHANGELOG_de-DE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# 5.12.2
* Fehler behoben, bei dem die AGB nicht bis zum Akzeptieren-Häkchen gescrollt wurden
* Falsche UI-Komponente für B2B-Rechnung korrigiert
* Fehlerhafte Kundendaten für UPL behoben
* Fehlerbehebung für Apple Pay in Nicht-Safari-Browsern
* Apple-Pay-Button wird nun immer angezeigt, wenn Apple Pay aktiv ist
* Problem behoben, bei dem Apple Pay nicht immer funktioniert hat
* Buchungsmodus-Fix für Wero

# 5.12.1
* Minor Fix am Customer-Objekt für besseren PayPal-B2B-Support

Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG_en-GB.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# 5.12.2
* Fix for Terms and Conditions no scroll to accept checkmark
* Fix incorrect UI Comp. for B2B invoice
* Fix for incorrect customer data for UPL
* Fix for Apple Pay in Non-Safari browsers
* Fix to always show Apple Pay button when Apple Pay is active
* Fix for Apple Pay not always working
* Booking mode fix for Wero

# 5.12.1
* Minor fix to customer object for better Paypal B2B support

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "unzerdev/shopware6",
"description": "Unzer payment integration for Shopware 6",
"version": "5.12.1",
"version": "5.12.2",
"type": "shopware-platform-plugin",
"license": "Apache-2.0",
"minimum-stability": "dev",
Expand Down
3 changes: 2 additions & 1 deletion src/Components/PaymentHandler/UnzerWeroPaymentHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ protected function getUnzerPaymentTypeObject(): Wero

protected function setBookingMode(): void
{
$this->bookingMode = $this->pluginConfig->get(ConfigReader::CONFIG_KEY_BOOKING_MODE_WERO, BookingMode::CHARGE);
$this->bookingMode = BookingMode::CHARGE;
#$this->bookingMode = $this->pluginConfig->get(ConfigReader::CONFIG_KEY_BOOKING_MODE_WERO, BookingMode::CHARGE);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Shopware\Core\Framework\Validation\DataBag\RequestDataBag;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use UnzerPayment6\Components\ClientFactory\ClientFactoryInterface;
Expand Down Expand Up @@ -90,10 +91,10 @@ public function validateCredentials(RequestDataBag $dataBag): JsonResponse
* @Route("/api/_action/unzer-payment/get-google-pay-gateway-merchant-id", name="api.action.unzer.get.google.pay.gateway.merchant.id", methods={"GET"})
* @Route("/api/v{version}/_action/unzer-payment/get-google-pay-gateway-merchant-id", name="api.action.unzer.get.google.pay.gateway.merchant.id.version", methods={"GET"})
*/
public function getGooglePayGatewayMerchantId(RequestDataBag $dataBag): JsonResponse
public function getGooglePayGatewayMerchantId(Request $request): JsonResponse
{
try {
$salesChannelId = $dataBag->get('salesChannelId', '');
$salesChannelId = $request->get('salesChannelId', '');

/** @var ConfigReader $configReader */
$configReader = $this->container->get(ConfigReader::class);
Expand Down
35 changes: 30 additions & 5 deletions src/EventListeners/ExpressButtons/ExpressButtonsEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@

namespace UnzerPayment6\EventListeners\ExpressButtons;

use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\MultiFilter;
use Shopware\Core\Framework\Struct\ArrayStruct;
use Shopware\Core\System\SalesChannel\SalesChannelContext;
use Shopware\Storefront\Page\Checkout\Cart\CheckoutCartPageLoadedEvent;
use Shopware\Storefront\Page\Checkout\Offcanvas\OffcanvasCartPageLoadedEvent;
use Shopware\Storefront\Page\PageLoadedEvent;
Expand All @@ -14,12 +19,14 @@
use UnzerPayment6\Components\Storefront\ExtensionFactory;
use UnzerPayment6\Components\Struct\PageExtension\Checkout\Confirm\ApplePayV2PageExtension;
use UnzerPayment6\Components\Struct\PageExtension\Checkout\Confirm\GooglePayPageExtension;
use UnzerPayment6\Installer\PaymentInstaller;

class ExpressButtonsEventListener implements EventSubscriberInterface
{
public function __construct(
private ConfigReaderInterface $configReader,
private ExtensionFactory $extensionFactory,
private EntityRepository $salesChannelRepository
) {
}

Expand All @@ -36,21 +43,39 @@ public function addExpressButtons(PageLoadedEvent $event): void
$config = $this->configReader->read($event->getSalesChannelContext()->getSalesChannel()->getId());

if (!$config->get(ConfigReader::CONFIG_KEY_USE_EXPRESS_PAYPAL)
&& !$config->get(ConfigReader::CONFIG_KEY_USE_EXPRESS_GOOGLE)
&& !$config->get(ConfigReader::CONFIG_KEY_USE_EXPRESS_APPLEPAY)) {
&& !$config->get(ConfigReader::CONFIG_KEY_USE_EXPRESS_GOOGLE)
&& !$config->get(ConfigReader::CONFIG_KEY_USE_EXPRESS_APPLEPAY)) {
return;
}

$event->getPage()->addExtension('UnzerExpressButtons', new ArrayStruct([
'publicKey' => $config->get(ConfigReader::CONFIG_KEY_PUBLIC_KEY),
'usePaypal' => $config->get(ConfigReader::CONFIG_KEY_USE_EXPRESS_PAYPAL),
'useGooglePay' => $config->get(ConfigReader::CONFIG_KEY_USE_EXPRESS_GOOGLE),
'useApplePay' => $config->get(ConfigReader::CONFIG_KEY_USE_EXPRESS_APPLEPAY),
'usePaypal' => $config->get(ConfigReader::CONFIG_KEY_USE_EXPRESS_PAYPAL) && $this->isPaymentMethodActive(PaymentInstaller::PAYMENT_ID_PAYPAL, $event->getSalesChannelContext()),
'useGooglePay' => $config->get(ConfigReader::CONFIG_KEY_USE_EXPRESS_GOOGLE) && $this->isPaymentMethodActive(PaymentInstaller::PAYMENT_ID_GOOGLE_PAY, $event->getSalesChannelContext()),
'useApplePay' => $config->get(ConfigReader::CONFIG_KEY_USE_EXPRESS_APPLEPAY) && $this->isPaymentMethodActive(PaymentInstaller::PAYMENT_ID_APPLE_PAY_V2, $event->getSalesChannelContext()),
]));
$googlePayExtension = $this->extensionFactory->getGooglePayExtension($event->getSalesChannelContext()->getSalesChannelId());
$event->getPage()->addExtension(GooglePayPageExtension::EXTENSION_NAME, $googlePayExtension);

$applePayExtension = $this->extensionFactory->getApplePayExtension($event->getSalesChannelContext()->getSalesChannelId());
$event->getPage()->addExtension(ApplePayV2PageExtension::EXTENSION_NAME, $applePayExtension);
}

public function isPaymentMethodActive(string $paymentMethodId, SalesChannelContext $context): bool
{
$criteria = new Criteria();
$criteria->setLimit(1);
$criteria->addFilter(
new MultiFilter(
MultiFilter::CONNECTION_AND,
[
new EqualsFilter('id', $context->getSalesChannel()->getId()),
new EqualsFilter('paymentMethods.id', $paymentMethodId),
new EqualsFilter('paymentMethods.active', true),
]
)
);

return $this->salesChannelRepository->searchIds($criteria, $context->getContext())->firstId() !== null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
size="16px"
:class="{'unzer-additional-keys__title-icon': true, 'is-expanded': isAdditionalKeysExpanded}"
></sw-icon>
<sw-help-text :text="$t('unzer-payment-settings.form.additionalKeysHelpText')" />
</div>
<div
:class="{'unzer-additional-keys__content': true, 'is-expanded': isAdditionalKeysExpanded}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,12 @@
}
}
}

.unzer-additional-keys__title{
.unzer-additional-keys__title-content{
flex-basis:100%;
}
.unzer-additional-keys__title-icon{
flex-basis: 32px;
}
}
3 changes: 2 additions & 1 deletion src/Resources/app/administration/src/snippets/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@
"webhookButton": "Webhooks registrieren",
"privateKey": "Private Key",
"publicKey": "Public Key",
"additionalKeys": "API Keys für weitere Zahlungsarten"
"additionalKeys": "API Keys für weitere Zahlungsarten",
"additionalKeysHelpText": "Wenn die Felder für zusätzliche Schlüsselpaare leer sind, werden standardmäßig die Hauptschlüsselpaare übernommen."
},
"modal": {
"close": "Schließen",
Expand Down
3 changes: 2 additions & 1 deletion src/Resources/app/administration/src/snippets/en-GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@
"webhookButton": "Register webhooks",
"privateKey": "Private Key",
"publicKey": "Public Key",
"additionalKeys": "API Keys for additional payment methods"
"additionalKeys": "API Keys for additional payment methods",
"additionalKeysHelpText": "If additional keypairs fields are empty, main keypairs will be inherited by default."
},
"modal": {
"close": "Close",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,7 @@ export default class UnzerPaymentExpressButtonsPlugin extends Plugin {
}

if (unzerApplePay) {
if (
window.ApplePaySession &&
window.ApplePaySession.canMakePayments() &&
window.ApplePaySession.supportsVersion(6)
) {
this.registerApplePay(unzerApplePay, unzerExpressPayment);
} else {
document.querySelector(
'.unzer-applepay-express-container'
).style.display = 'none';
}
this.registerApplePay(unzerApplePay, unzerExpressPayment);
}
});
}
Expand Down Expand Up @@ -124,7 +114,7 @@ export default class UnzerPaymentExpressButtonsPlugin extends Plugin {
allowedCardNetworks: this.options.googlePay.allowedCardNetworks,
allowCreditCards: this.options.googlePay.allowCreditCards,
allowPrepaidCards: this.options.googlePay.allowPrepaidCards,
billingAddressParameters: { format: 'MIN' },
billingAddressParameters: {format: 'MIN'},
billingAddressRequired: true,
emailRequired: true,
onPaymentDataChangedCallback: () => {
Expand Down Expand Up @@ -194,7 +184,8 @@ export default class UnzerPaymentExpressButtonsPlugin extends Plugin {
onPaymentAuthorizedCallback: async (
paymentData,
approve,
reject
reject,
event
) => {
console.log('paymentData:', paymentData);
let shippingContact = event.payment.shippingContact; // Store the shipping contact data for express checkout
Expand All @@ -205,6 +196,11 @@ export default class UnzerPaymentExpressButtonsPlugin extends Plugin {

// You can create customer here based on paymentData
const response = await unzerExpressPayment.submit();
if (response.submitResponse.success) {
approve();
} else {
reject();
}
const paymentTypeId = response.submitResponse.data.id;
console.log(
response,
Expand Down
1 change: 1 addition & 0 deletions src/Resources/config/dependencies/event_listeners.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
<service id="UnzerPayment6\EventListeners\ExpressButtons\ExpressButtonsEventListener">
<argument type="service" id="UnzerPayment6\Components\ConfigReader\ConfigReader"/>
<argument type="service" id="UnzerPayment6\Components\Storefront\ExtensionFactory"/>
<argument type="service" id="sales_channel.repository" />

<tag name="kernel.event_subscriber"/>
</service>
Expand Down
2 changes: 2 additions & 0 deletions src/Resources/config/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
</option>
</options>
</input-field>
<!--
<input-field type="single-select">
<name>bookingModeWero</name>
<label>Booking mode Wero</label>
Expand All @@ -136,6 +137,7 @@
</option>
</options>
</input-field>
//-->
<component name="unzer-settings-subheading">
<name>paymentSettingsSaveDevices</name>
</component>
Expand Down