Skip to content

Commit

Permalink
MOL-1278: fix ideal issuer reset leads to wrong url
Browse files Browse the repository at this point in the history
  • Loading branch information
boxblinkracer committed Nov 28, 2023
1 parent 9dc38d8 commit d5c7848
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
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';
}

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

0 comments on commit d5c7848

Please sign in to comment.