Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOL-1278: fix ideal issuer reset leads to wrong url #662

Merged
merged 1 commit into from
Nov 29, 2023
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
6 changes: 6 additions & 0 deletions src/Controller/StoreApi/iDEAL/iDealControllerBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Kiener\MolliePayments\Controller\StoreApi\iDEAL\Response\IssuersResponse;
use Kiener\MolliePayments\Controller\StoreApi\iDEAL\Response\StoreIssuerResponse;
use Kiener\MolliePayments\Gateway\MollieGatewayInterface;
use Kiener\MolliePayments\Handler\Method\iDealPayment;
use Kiener\MolliePayments\Service\CustomerService;
use Shopware\Core\Checkout\Customer\CustomerEntity;
use Shopware\Core\Framework\Routing\Annotation\RouteScope;
Expand Down Expand Up @@ -83,6 +84,11 @@ public function saveIssuer(string $customerId, string $issuerId, SalesChannelCon
throw new \Exception('Customer with ID ' . $customerId . ' not found in Shopware');
}

# if we have a "reset" value, then empty our stored issuer
if ($issuerId === iDealPayment::ISSUER_RESET_VALUE) {
$issuerId = '';
}

$result = $this->customerService->setIDealIssuer(
$customer,
$issuerId,
Expand Down
6 changes: 6 additions & 0 deletions src/Controller/Storefront/iDEAL/iDealControllerBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Kiener\MolliePayments\Controller\Storefront\iDEAL;

use Kiener\MolliePayments\Handler\Method\iDealPayment;
use Kiener\MolliePayments\Service\CustomerService;
use Kiener\MolliePayments\Service\SettingsService;
use Kiener\MolliePayments\Setting\MollieSettingStruct;
Expand Down Expand Up @@ -45,6 +46,11 @@ public function storeIssuer(SalesChannelContext $context, string $customerId, st
{
$result = null;

# if we have a "reset" value, then empty our stored issuer
if ($issuerId === iDealPayment::ISSUER_RESET_VALUE) {
$issuerId = '';
}

$customer = $this->customerService->getCustomer($customerId, $context->getContext());

if ($customer instanceof CustomerEntity) {
Expand Down
1 change: 1 addition & 0 deletions src/Handler/Method/iDealPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class iDealPayment extends PaymentHandler
/** @var string */
protected $paymentMethod = self::PAYMENT_METHOD_NAME;

public const ISSUER_RESET_VALUE = 'ideal_reset';

/**
* @param array<mixed> $orderData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,14 @@ export default class MollieIDealIssuer extends Plugin {

const client = new HttpClient();

var selectedIssuer = issuersDropdown.value;

if (selectedIssuer === undefined || selectedIssuer === null || selectedIssuer === '') {
selectedIssuer = 'ideal_reset';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there the part missing where you reset the issues from custom fields if the rest value is given?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that happens in php

}

client.get(
shopUrl + '/mollie/ideal/store-issuer/' + customerId + '/' + issuersDropdown.value,
shopUrl + '/mollie/ideal/store-issuer/' + customerId + '/' + selectedIssuer,
function () {
onCompleted('issuer updated successfully');
},
Expand Down
Loading