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
5 changes: 4 additions & 1 deletion CHANGELOG_de-DE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 7.1.5
* Aktualisierung iDEAL Payment Naming

# 7.1.4
* **Wichtiger Hotfix**
* Dieser Hotfix behebt ein Problem, bei dem einige Webhooks in Shopware 6.7 nicht korrekt registriert wurden.
Expand Down Expand Up @@ -78,7 +81,7 @@
* EPS: Entfernung Bank Feld

# 6.2.1
* Cardholder Name in Kreditkarten-Checkout hinzugefügt
* Cardholder Name in Kreditkarten-Checkout hinzugefügt

# 6.2.0
* TWINT als weitere Zahlungsart hinzugefügt
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG_en-GB.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 7.1.5
* Updated iDEAL Payment naming

# 7.1.4
* **Important hotfix**
* This hotfix will fix an issue where some webhooks were not correctly registered in Shopware 6.7.
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": "7.1.4",
"version": "7.1.5",
"type": "shopware-platform-plugin",
"license": "Apache-2.0",
"minimum-stability": "dev",
Expand Down
34 changes: 15 additions & 19 deletions src/Components/PaymentHandler/UnzerPayPalPaymentHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@ class UnzerPayPalPaymentHandler extends AbstractUnzerPaymentHandler
* {@inheritdoc}
*/
public function pay(
Request $request,
Request $request,
PaymentTransactionStruct $transaction,
Context $context,
?Struct $validateStruct
): RedirectResponse
{
Context $context,
?Struct $validateStruct
): RedirectResponse {
$orderTransaction = $this->transactionUtil->getOrderTransaction($transaction->getOrderTransactionId(), $context);
if ($request->getSession()->get(ExpressCheckoutService::SESSION_PAYPAL_PAYMENT_ID)) {
try {
Expand Down Expand Up @@ -122,11 +121,10 @@ public function pay(
}

public function finalize(
Request $request,
Request $request,
PaymentTransactionStruct $transaction,
Context $context
): void
{
Context $context
): void {
$orderTransaction = $this->transactionUtil->getOrderTransaction($transaction->getOrderTransactionId(), $context);
$this->pluginConfig = $this->configReader->read($orderTransaction->getOrder()->getSalesChannelId());

Expand Down Expand Up @@ -208,11 +206,10 @@ public function finalize(
}

protected function handleRecurringPayment(
Request $request,
Request $request,
PaymentTransactionStruct $transaction,
Context $context
): RedirectResponse
{
Context $context
): RedirectResponse {
try {
$bookingMode = $this->pluginConfig->get(ConfigReader::CONFIG_KEY_BOOKING_MODE_PAYPAL, BookingMode::CHARGE);

Expand All @@ -237,13 +234,12 @@ protected function handleRecurringPayment(
}

private function payExpress(
string $unzerPaymentId,
string $unzerPaymentId,
PaymentTransactionStruct $transaction,
OrderTransactionEntity $orderTransaction,
Request $currentRequest,
Context $context
)
{
OrderTransactionEntity $orderTransaction,
Request $currentRequest,
Context $context
) {
$unzerClient = $this->unzerClient = $this->clientFactory->createClientFromSalesChannelId($orderTransaction->getOrder()->getSalesChannelId(), $currentRequest);
$payment = $unzerClient->fetchPayment($unzerPaymentId);
$unzerBasket = $this->basketHydrator->hydrateObject($orderTransaction);
Expand Down
2 changes: 1 addition & 1 deletion src/Components/PaymentHandler/UnzerWeroPaymentHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ protected function getUnzerPaymentTypeObject(): Wero
protected function setBookingMode(): void
{
$this->bookingMode = BookingMode::CHARGE;
#$this->bookingMode = $this->pluginConfig->get(ConfigReader::CONFIG_KEY_BOOKING_MODE_WERO, BookingMode::CHARGE);
// $this->bookingMode = $this->pluginConfig->get(ConfigReader::CONFIG_KEY_BOOKING_MODE_WERO, BookingMode::CHARGE);
}
}
3 changes: 1 addition & 2 deletions src/Components/UnzerUtil/UnzerTransactionUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,7 @@ public function updateOrderTransactionStatus(Unzer $client, OrderTransactionEnti
$context
);
} catch (\Throwable $e) {
$this->logger->error('error updating transaction state from util: ' . $e->getMessage(), ['trace'=>$e->getTraceAsString()]);
$this->logger->error('error updating transaction state from util: ' . $e->getMessage(), ['trace' => $e->getTraceAsString()]);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,3 @@ private function getOrderTransaction(?string $orderId, Context $context): ?Order
}
}
}

50 changes: 50 additions & 0 deletions src/Installer/PaymentInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace UnzerPayment6\Installer;

use League\Flysystem\Filesystem;
use Shopware\Core\Checkout\Payment\Aggregate\PaymentMethodTranslation\PaymentMethodTranslationEntity;
use Shopware\Core\Checkout\Payment\PaymentMethodEntity;
use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
Expand Down Expand Up @@ -512,6 +513,55 @@ private function upsertPaymentMethods(InstallContext $context): void
}
$this->removeOldPaymentMethods($context);
$this->deprecatePaymentMethods($context);
$this->renameIdeal($context->getContext());
}

private function renameIdeal(Context $context): void
{
$criteria = new Criteria([self::PAYMENT_ID_IDEAL]);
$criteria->addAssociation('translations.language.locale');
/** @var PaymentMethodEntity $existingPaymentMethod */
$existingPaymentMethod = $this->paymentMethodRepository->search($criteria, $context)->first();
if ($existingPaymentMethod === null) {
return;
}
$translations = [];
/** @var PaymentMethodTranslationEntity $translation */
foreach ($existingPaymentMethod->getTranslations()->getElements() as $uniqueId => $translation) {
$newName = null;
$newDescription = null;
if (stripos($translation->getName(), 'wero') === false) {
$newName = str_replace('iDEAL', 'iDEAL | Wero', $translation->getName());
}
if (stripos($translation->getDescription(), 'wero') === false) {
$newDescription = str_replace('iDEAL', 'iDEAL | Wero', $translation->getDescription());
}

if ($newName === null && $newDescription === null) {
continue;
}

$localeCode = $translation->getLanguage()->getLocale()->getCode();

$translations[$localeCode] = [
'languageId' => $translation->getLanguageId(),
];
if ($newName !== null) {
$translations[$localeCode]['name'] = $newName;
}
if ($newDescription !== null) {
$translations[$localeCode]['description'] = $newDescription;
}
}

if (empty($translations)) {
return;
}

$this->paymentMethodRepository->update([[
'id' => $existingPaymentMethod->getId(),
'translations' => $translations,
]], $context);
}

private function deprecatePaymentMethods(InstallContext $context): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@
size="16px"
:class="{'unzer-additional-keys__title-icon': true, 'is-expanded': isAdditionalKeysExpanded}"
></mt-icon>
<sw-help-text :text="$t('unzer-payment-settings.form.additionalKeysHelpText')" />
<sw-help-text
:text="$t('unzer-payment-settings.form.additionalKeysHelpText')"
/>
</div>
<div
:class="{'unzer-additional-keys__content': true, 'is-expanded': isAdditionalKeysExpanded}"
Expand Down Expand Up @@ -182,4 +184,4 @@
</template>
{% endblock %}
</sw-page>
{% endblock %}
{% endblock %}
Loading