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
8 changes: 8 additions & 0 deletions CHANGELOG_de-DE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 5.11.0
* Unzer Direkt-Überweisung als neue Zahlungsmethode hinzugefügt
* Update PHP-SDK

# 5.10.1
* Apple Pay Infotext in Backend
* Fix: Erneuter payment-Versuch nach Cancellation durch Unzer JS

# 5.10.0
* Updated Apple Pay Integration

Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG_en-GB.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 5.11.0
* Unzer Direct Bank Transfer added as new payment method
* Update PHP-SDK

# 5.10.1
* Apple Pay Infotext in backend
* Fix: Retry payment after being cancelled by Unzer JS

# 5.10.0
* Updated Apple Pay Integration

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Unzer payment integration for Shopware 6 including the following payment methods
* Apple Pay
* Bancontact
* Credit Card
* Direct Bank Transfer
* EPS
* Google Pay
* iDEAL
Expand Down
4 changes: 2 additions & 2 deletions 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.10.0",
"version": "5.11.0",
"type": "shopware-platform-plugin",
"license": "Apache-2.0",
"minimum-stability": "dev",
Expand All @@ -21,7 +21,7 @@
},
"require": {
"php": ">=7.4 || <=8.3",
"unzerdev/php-sdk": "~3.7.0",
"unzerdev/php-sdk": "~3.11.0",
"shopware/core": "~6.4.0 || ~6.5.0",
"shopware/administration": "~6.4.0 || ~6.5.0",
"shopware/storefront": "~6.4.0 || ~6.5.0"
Expand Down
67 changes: 67 additions & 0 deletions src/Components/PaymentHandler/UnzerOpenBankingPaymentHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

declare(strict_types=1);

namespace UnzerPayment6\Components\PaymentHandler;

use Shopware\Core\Checkout\Payment\Cart\AsyncPaymentTransactionStruct;
use Shopware\Core\Checkout\Payment\Exception\AsyncPaymentProcessException;
use Shopware\Core\Framework\Validation\DataBag\RequestDataBag;
use Shopware\Core\System\SalesChannel\SalesChannelContext;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Throwable;
use UnzerPayment6\Components\PaymentHandler\Exception\UnzerPaymentProcessException;
use UnzerPayment6\Components\PaymentHandler\Traits\CanCharge;
use UnzerSDK\Exceptions\UnzerApiException;
use UnzerSDK\Resources\PaymentTypes\OpenbankingPis;

class UnzerOpenBankingPaymentHandler extends AbstractUnzerPaymentHandler
{
use CanCharge;

/**
* {@inheritdoc}
*/
public function pay(
AsyncPaymentTransactionStruct $transaction,
RequestDataBag $dataBag,
SalesChannelContext $salesChannelContext
): RedirectResponse {
parent::pay($transaction, $dataBag, $salesChannelContext);

try {
$this->paymentType = $this->unzerClient->createPaymentType(new OpenbankingPis());

$returnUrl = $this->charge($transaction->getReturnUrl());

return new RedirectResponse($returnUrl);
} catch (UnzerApiException $apiException) {
$this->logger->error(
sprintf('Caught an API exception in %s of %s', __METHOD__, __CLASS__),
[
'dataBag' => $dataBag,
'transaction' => $transaction,
'exception' => $apiException,
]
);

$this->executeFailTransition(
$transaction->getOrderTransaction()->getId(),
$salesChannelContext->getContext()
);

throw new UnzerPaymentProcessException($transaction->getOrder()->getId(), $transaction->getOrderTransaction()->getId(), $apiException);
} catch (Throwable $exception) {
$this->logger->error(
sprintf('Caught a generic exception in %s of %s', __METHOD__, __CLASS__),
[
'dataBag' => $dataBag,
'transaction' => $transaction,
'exception' => $exception,
]
);

throw new AsyncPaymentProcessException($transaction->getOrderTransaction()->getId(), $exception->getMessage());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

namespace UnzerPayment6\Components\PaymentTransitionMapper;

use Shopware\Core\System\StateMachine\Aggregation\StateMachineTransition\StateMachineTransitionActions;
use UnzerPayment6\Components\PaymentTransitionMapper\Exception\TransitionMapperException;
use UnzerSDK\Resources\Payment;
use UnzerSDK\Resources\PaymentTypes\BasePaymentType;
use UnzerSDK\Resources\PaymentTypes\OpenbankingPis;

class OpenBankingTransitionMapper extends AbstractTransitionMapper
{
public function supports(BasePaymentType $paymentType): bool
{
return $paymentType instanceof OpenbankingPis;
}

public function getTargetPaymentStatus(Payment $paymentObject): string
{
try {
return parent::getTargetPaymentStatus($paymentObject);
} catch (TransitionMapperException $exception) {
if ($paymentObject->isPending()) {
return StateMachineTransitionActions::ACTION_REOPEN;
}

throw $exception;
}
}

protected function getResourceName(): string
{
return OpenbankingPis::getResourceName();
}
}
16 changes: 16 additions & 0 deletions src/DependencyInjection/payment_handlers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -366,5 +366,21 @@

<tag name="shopware.payment.method.async" />
</service>

<service id="UnzerPayment6\Components\PaymentHandler\UnzerOpenBankingPaymentHandler">
<argument type="service" id="UnzerPayment6\Components\ResourceHydrator\BasketResourceHydrator"/>
<argument type="service" id="UnzerPayment6\Components\ResourceHydrator\CustomerResourceHydrator\CustomerResourceHydrator"/>
<argument type="service" id="UnzerPayment6\Components\ResourceHydrator\MetadataResourceHydrator"/>
<argument type="service" id="order_transaction.repository" />
<argument type="service" id="UnzerPayment6\Components\ConfigReader\ConfigReader"/>
<argument type="service" id="UnzerPayment6\Components\TransactionStateHandler\TransactionStateHandler"/>
<argument type="service" id="UnzerPayment6\Components\ClientFactory\ClientFactory" />
<argument type="service" id="request_stack" />
<argument type="service" id="unzer_payment.logger"/>
<argument type="service" id="UnzerPayment6\Components\CustomFieldsHelper\CustomFieldsHelper"/>

<tag name="shopware.payment.method.async" />
</service>

</services>
</container>
4 changes: 4 additions & 0 deletions src/DependencyInjection/transition_mapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,9 @@
<tag name="unzer.transition_mapper"/>
</service>

<service id="UnzerPayment6\Components\PaymentTransitionMapper\OpenBankingTransitionMapper">
<tag name="unzer.transition_mapper"/>
</service>

</services>
</container>
19 changes: 19 additions & 0 deletions src/Installer/PaymentInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use UnzerPayment6\Components\PaymentHandler\UnzerInstallmentSecuredPaymentHandler;
use UnzerPayment6\Components\PaymentHandler\UnzerInvoicePaymentHandler;
use UnzerPayment6\Components\PaymentHandler\UnzerInvoiceSecuredPaymentHandler;
use UnzerPayment6\Components\PaymentHandler\UnzerOpenBankingPaymentHandler;
use UnzerPayment6\Components\PaymentHandler\UnzerPaylaterDirectDebitSecuredPaymentHandler;
use UnzerPayment6\Components\PaymentHandler\UnzerPaylaterInstallmentPaymentHandler;
use UnzerPayment6\Components\PaymentHandler\UnzerPaylaterInvoicePaymentHandler;
Expand Down Expand Up @@ -65,6 +66,7 @@ class PaymentInstaller implements InstallerInterface
public const PAYMENT_ID_PAYLATER_DIRECT_DEBIT_SECURED = '6d6adcd4b7bf40499873c294a85f32ed';
public const PAYMENT_ID_GOOGLE_PAY = '67b6d50c1ecd11ef9e21d7850819bc50';
public const PAYMENT_ID_TWINT = '6493b43244eb11efa900b7a80e209d6a';
public const PAYMENT_ID_OPEN_BANKING = '105932c2e56b11ef9cd003e762195b4d';

public const PAYMENT_METHOD_IDS = [
self::PAYMENT_ID_ALIPAY,
Expand All @@ -90,6 +92,7 @@ class PaymentInstaller implements InstallerInterface
self::PAYMENT_ID_PAYLATER_DIRECT_DEBIT_SECURED,
self::PAYMENT_ID_GOOGLE_PAY,
self::PAYMENT_ID_TWINT,
self::PAYMENT_ID_OPEN_BANKING,
];

public const DEPRECATED_PAYMENT_METHOD_IDS = [
Expand Down Expand Up @@ -472,6 +475,22 @@ class PaymentInstaller implements InstallerInterface
],
],
],
[
'id' => self::PAYMENT_ID_OPEN_BANKING,
'handlerIdentifier' => UnzerOpenBankingPaymentHandler::class,
'name' => 'TWINT',
'technicalName' => 'unzer_openbanking',
'translations' => [
'de-DE' => [
'name' => 'Direktüberweisung',
'description' => 'Direktüberweisung mit Unzer payments',
],
'en-GB' => [
'name' => 'Direct Bank Transfer',
'description' => 'Direct Bank Transfer with Unzer payments',
],
],
],
];
private const PLUGIN_VERSION_PAYLATER_INVOICE = '5.0.0';
private const PLUGIN_VERSION_PAYLATER_INSTALLMENT = '5.6.0';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@
class="unzer-payment-settings--apple-pay-certificates">
<template v-show="!isLoading">
{% block unzer_payment_apple_pay_certificates_form %}
<div v-if="parentConfigData['UnzerPayment6.settings.applePayPaymentProcessingCertificateId']">
<sw-alert
variant="info"
appearance="default"
:showIcon="true"
:closable="false">
<div v-html="$tc('unzer-payment-settings.apple-pay.certificates.textExisting')"></div>
</sw-alert>
</div>
<div>
<sw-alert
variant="info"
appearance="default"
:showIcon="true"
:closable="false">
<div v-html="$tc('unzer-payment-settings.apple-pay.certificates.textAll')"></div>
</sw-alert>
</div>
<sw-inherit-wrapper
ref="inheritWrapperPaymentProcessingCertificate"
:label="$tc('unzer-payment-settings.apple-pay.paymentProcessingCertificate.label')"
Expand Down
2 changes: 2 additions & 0 deletions src/Resources/app/administration/src/snippets/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@
"apple-pay": {
"certificates": {
"title": "Apple Pay Zertifikate (Veraltet)",
"textExisting": "Wir haben unsere Integration mit Apple Pay aktualisiert, aber da Sie sie bereits eingerichtet haben, brauchen Sie im Moment nichts zu tun.<br><br>Wenn Ihre Apple-Pay-Zertifikate jedoch bald ablaufen, können Sie auf die neue Integration umsteigen.<br><br>Sie können natürlich auch jetzt schon auf die neue Integration umsteigen, wenn Sie möchten, und müssen sich dann in Zukunft keine Gedanken mehr über ablaufende Zertifikate, einen Wechsel der Integration usw. machen.",
"textAll": "Bevor Sie Apple Pay aktivieren, stellen Sie bitte sicher, dass Sie unsere <a href='https://docs.unzer.com/payment-methods/applepay/applepay-prerequisites/#prerequisites-for-accepting-apple-pay-transactions' target='_blank'>Checkliste</a> gelesen haben.",
"check": {
"paymentProcessingValid": {
"true": "Das Payment Processing-Zertifikat ist vorhanden und gültig",
Expand Down
2 changes: 2 additions & 0 deletions src/Resources/app/administration/src/snippets/en-GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@
"apple-pay": {
"certificates": {
"title": "Apple Pay Certificates (Deprecated)",
"textExisting": "We have updated our integration with Apple Pay, but since you already have it set up, you don't need to do anything just now.<br><br>However, when your Apple Pay certificates are about to expire, you can change to the new integration.<br><br>You can of course change to the new integration now, if you want, and then you don't have to worry about expiring certificates, changing integration, etc. in the future.",
"textAll": "Before you activate Apple Pay, please make sure you have read our <a href='https://docs.unzer.com/payment-methods/applepay/applepay-prerequisites/#prerequisites-for-accepting-apple-pay-transactions' target='_blank'>checklist</a>.",
"check": {
"paymentProcessingValid": {
"true": "The Payment Processing certificate is present and valid",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export default class UnzerPaymentBasePlugin extends Plugin {
errorWrapper.scrollIntoView({ block: 'end', behavior: 'smooth' });

this.setSubmitButtonActive(true);
this.submitting = false;
}

/**
Expand Down Expand Up @@ -147,7 +148,6 @@ export default class UnzerPaymentBasePlugin extends Plugin {

if (!this._validateForm()) {
this.submitting = false;

this.setSubmitButtonActive(true);

return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,15 @@
{{ parent() }}
{% endif %}
{% endblock %}

{% block component_payment_method_description %}
{{ parent() }}
{% if payment and payment.id == constant("UnzerPayment6\\Installer\\PaymentInstaller::PAYMENT_ID_OPEN_BANKING") and page.extensions.unzerPaymentData.publicKey and payment.id is same as(selectedPaymentMethodId)%}
<unzer-payment
publicKey="{{ page.extensions.unzerPaymentData.publicKey }}"
locale="{{ page.extensions.unzerPaymentData.locale }}">
<unzer-open-banking></unzer-open-banking>
</unzer-payment>
{% endif %}

{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% block unzer_paymentbase_js_library %}
<script type="text/javascript" src="https://static.unzer.com/v1/unzer.js"></script>
<script type="module" src="https://static-v2.unzer.com/v2/ui-components/index.js" ></script>
{% endblock %}

{% block unzer_paymentbase_style_sheet %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,45 +34,50 @@
{% block page_checkout_confirm_product_table %}
{% set paymentDataExtensionName = constant("UnzerPayment6\\Components\\Struct\\PageExtension\\Checkout\\Confirm\\UnzerDataPageExtension::EXTENSION_NAME") %}
{% set paymentFrameExtensionName = constant("UnzerPayment6\\Components\\Struct\\PageExtension\\Checkout\\Confirm\\PaymentFramePageExtension::EXTENSION_NAME") %}
{% if page.extensions[paymentFrameExtensionName].paymentFrame and page.extensions[paymentDataExtensionName] %}
{% block unzer_payment_checkout_confirm_frame %}
{% if page.extensions[paymentDataExtensionName] %}
{% block unzer_payment_checkout_confirm_library %}
{% sw_include '@Storefront/storefront/component/unzer/base/unzer-library.html.twig' %}
{% endblock %}
{% if page.extensions[paymentFrameExtensionName].paymentFrame %}
{% block unzer_payment_checkout_confirm_frame %}

{% block page_checkout_unzer_payment_form_elements %}
<input type="hidden" id="unzerResourceId" name="unzerResourceId" form="confirmOrderForm">
{% endblock %}
{% block page_checkout_unzer_payment_form_elements %}
<input type="hidden" id="unzerResourceId" name="unzerResourceId" form="confirmOrderForm">
{% endblock %}

{% block unzer_payment_checkout_confirm_frame_card %}
<div class="unzer-payment-base"
id="unzer-payment-base"
data-unzer-payment-base="true"
data-unzer-payment-base-options='{
{% block unzer_payment_checkout_confirm_frame_card %}
<div class="unzer-payment-base"
id="unzer-payment-base"
data-unzer-payment-base="true"
data-unzer-payment-base-options='{
"publicKey": "{{ page.extensions[paymentDataExtensionName].publicKey }}",
"shopLocale": "{{ page.extensions[paymentDataExtensionName].locale }}",
"errorShouldNotBeEmpty": "{{ "error.VIOLATION::IS_BLANK_ERROR" | trans }}"
}'>
<div class="unzer-payment-base-body">
{% block unzer_payment_checkout_confirm_frame_card_body %}
{% block unzer_payment_checkout_confirm_frame_card_body_frame %}
<div class="unzer-payment-frame">
{% sw_include page.extensions[paymentFrameExtensionName].paymentFrame ignore missing %}
</div>
<div class="unzer-payment-base-body">
{% block unzer_payment_checkout_confirm_frame_card_body %}
{% block unzer_payment_checkout_confirm_frame_card_body_frame %}
<div class="unzer-payment-frame">
{% sw_include page.extensions[paymentFrameExtensionName].paymentFrame ignore missing %}
</div>
{% endblock %}
{% endblock %}
{% endblock %}
</div>
</div>
</div>
{% endblock %}
{% endblock %}
{% endblock %}

{% endif %}
{% endif %}

{% set fraudPreventionExtensionName = constant("UnzerPayment6\\Components\\Struct\\PageExtension\\Checkout\\Confirm\\FraudPreventionPageExtension::EXTENSION_NAME") %}

{% if page.extensions[fraudPreventionExtensionName] %}
<input
name="unzerPaymentFraudPreventionSessionId"
type="hidden"
value="{{ page.extensions[fraudPreventionExtensionName].fraudPreventionSessionId }}"
form="confirmOrderForm"
name="unzerPaymentFraudPreventionSessionId"
type="hidden"
value="{{ page.extensions[fraudPreventionExtensionName].fraudPreventionSessionId }}"
form="confirmOrderForm"
/>
{% endif %}

Expand Down