Skip to content

Commit

Permalink
BP-3148 Add a option to not show the iDEAL issuers selection in the c…
Browse files Browse the repository at this point in the history
…heckout
  • Loading branch information
Ivascu Madalin committed Nov 16, 2023
1 parent b4afb4d commit 8253987
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 14 deletions.
10 changes: 10 additions & 0 deletions Components/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,4 +289,14 @@ public function applepayMerchantGUID()
{
return $this->get('buckaroo_applepay_merchant_guid');
}

/**
* Can show ideal issuers
*
* @return boolean
*/
public function canShowIdealIssuers()
{
return $this->get('buckaroo_ideal_show_issuers', "yes") !== "no";
}
}
8 changes: 5 additions & 3 deletions Controllers/Frontend/BuckarooIdeal.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Shopware_Controllers_Frontend_BuckarooIdeal extends SimplePaymentControlle
public function indexActionPreHandler()
{
SimpleLog::log(__METHOD__ . "|1|" , $this->getPaymentMethodClass()->getSelectedIssuer());
if ($this->getPaymentMethodClass()->getSelectedIssuer()) {
if ($this->getPaymentMethodClass()->getSelectedIssuer() || !$this->getPaymentMethodClass()->canShowIdealIssuers()) {
return true;
} else {
$namespace = $this->container->get('snippets')->getNamespace('frontend/buckaroo/status_messages');
Expand Down Expand Up @@ -41,7 +41,9 @@ protected function fillRequest(AbstractPaymentMethod $paymentMethod, Request $re
{
parent::fillRequest($paymentMethod, $request);

// set ideal issuer
$request->setServiceParameter('issuer', $paymentMethod->getSelectedIssuer());
if ($paymentMethod->canShowIdealIssuers()) {
// set ideal issuer
$request->setServiceParameter('issuer', $paymentMethod->getSelectedIssuer());
}
}
}
8 changes: 8 additions & 0 deletions PaymentMethods/Ideal.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ public function getExtraFields($fields)
});

$fields['lists']['issuers'] = $issuers;
$fields['lists']['canShowIssuers'] = $this->canShowIdealIssuers();

return $fields;
}
Expand Down Expand Up @@ -256,8 +257,15 @@ public function validate($checkPayment) {
return $checkData;
}

public function canShowIdealIssuers() {
return Shopware()->Container()->get('buckaroo_payment.config')->canShowIdealIssuers();
}

public function getValidations()
{
if (!$this->canShowIdealIssuers()) {
return [];
}
$snippetManager = Shopware()->Container()->get('snippets');
$validationMessages = $snippetManager->getNamespace('frontend/buckaroo/validation');

Expand Down
25 changes: 25 additions & 0 deletions Resources/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,31 @@
</store>
</element>

<element type="select" scope="shop">
<name>buckaroo_ideal_show_issuers</name>
<label lang="de">Ideal - Bankauswahl im Checkout anzeigen</label>
<label lang="en">Ideal - Show Issuer Selection in the Checkout</label>
<label lang="nl">Ideal - Weergeef de bankkeuze in de checkout</label>
<value>yes</value>
<description lang="de"><![CDATA[Wenn die Option 'Deaktiviert' ausgewählt ist, wird die Bankauswahl für iDEAL nicht im Checkout angezeigt. Stattdessen werden Kunden auf eine separate Seite weitergeleitet, auf der sie ihre eigene Bank auswählen können. Auf der anderen Seite wird das Aktivieren dieser Funktion die Bankauswahl direkt im Checkout anzeigen. Es ist wichtig zu beachten, dass das Aktivieren dieser Option zusätzliche Kosten von Buckaroo verursachen wird, die auf ungefähr €0,002 pro Transaktion geschätzt werden. Für genaue Kostenangaben können Sie sich direkt an <a href="mailto:wecare@buckaroo.nl">Buckaroo</a> wenden.]]></description>
<description lang="en"><![CDATA[When the "NO" option is selected, the issuer selection for iDEAL will not be displayed in the checkout. Instead, customers will be redirected to a separate page where they can choose their iDEAL issuer (i.e., their bank). On the other hand, selecting the "Enable" option will display the issuer selection directly in the checkout. It's important to note that enabling this option will incur additional costs from Buckaroo, estimated at around €0.002 for each transaction. For precise cost details, please reach out to <a href="mailto:wecare@buckaroo.nl">Buckaroo</a> directly.]]></description>
<description lang="nl"><![CDATA[Wanneer de optie 'Uitgeschakeld' is geselecteerd, zal de bankkeuze voor iDEAL niet worden weergegeven in de checkout. In plaats daarvan worden klanten doorgestuurd naar een aparte pagina waar ze hun eigen bank kunnen kiezen. Aan de andere kant zal het aanzetten van deze functie de bankkeuze direct in de checkout weergeven. Het is belangrijk om te melden dat het inschakelen van deze optie extra kosten met zich mee zal brengen van Buckaroo, geschat op ongeveer €0.002 per transactie. Voor nauwkeurige kostendetails kunt u rechtstreeks contact opnemen met <a href="mailto:wecare@buckaroo.nl">Buckaroo</a>.]]></description>
<store>
<option>
<value>yes</value>
<label lang="de">Ja</label>
<label lang="en">Yes</label>
<label lang="nl">Ja</label>
</option>
<option>
<value>no</value>
<label lang="de">Nein</label>
<label lang="en">No</label>
<label lang="nl">Nee</label>
</option>
</store>
</element>

<element required="false" type="number" scope="shop">
<name>buckaroo_ideal_min_order_amount</name>
<label lang="de">Ideal min order amount</label>
Expand Down
24 changes: 13 additions & 11 deletions Views/frontend/plugins/payment/buckaroo_ideal.tpl
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
{namespace name='frontend/plugins/payment/buckaroo_ideal'}

{if $buckarooExtraFields.lists.canShowIssuers}
<h4>{s name="PluginsIdealHeadline" namespace="frontend/buckaroo/plugins"}Select iDEAL issuer{/s}</h4>
<div style="margin-bottom: 10px;">

<div style="margin-bottom: 10px;">
{include file='frontend/_includes/fields/user_id.tpl' name="ideal"}

{include file='frontend/_includes/fields/user_id.tpl' name="ideal"}
<label style="float: left; width: 40%; line-height: 40px;" for="buckaroo-ideal-issuer-select">{s name="PluginsIdealIssuer" namespace="frontend/buckaroo/plugins"}Issuer{/s}</label>

<label style="float: left; width: 40%; line-height: 40px;" for="buckaroo-ideal-issuer-select">{s name="PluginsIdealIssuer" namespace="frontend/buckaroo/plugins"}Issuer{/s}</label>
<div class="select-field">
<select id="buckaroo-ideal-issuer-select" name="buckaroo-extra-fields[ideal][user][buckaroo_payment_ideal_issuer]" class="buckaroo_auto_submit">
<option value="0">{s name="SelectOption" namespace="frontend/buckaroo/plugins"}Select your bank{/s}</option>
{foreach from=$buckarooExtraFields.lists.issuers item=issuer}
<option value="{$issuer->id}"{if $issuer->isSelected} selected{/if}>{$issuer->name}</option>
{/foreach}
</select>
</div>

<div class="select-field">
<select id="buckaroo-ideal-issuer-select" name="buckaroo-extra-fields[ideal][user][buckaroo_payment_ideal_issuer]" class="buckaroo_auto_submit">
<option value="0">{s name="SelectOption" namespace="frontend/buckaroo/plugins"}Select your bank{/s}</option>
{foreach from=$buckarooExtraFields.lists.issuers item=issuer}
<option value="{$issuer->id}"{if $issuer->isSelected} selected{/if}>{$issuer->name}</option>
{/foreach}
</select>
</div>
{/if}

</div>
<div style="display: none">
{include file='frontend/_includes/fields/parts/error_messages.tpl' name="ideal" entity="user" key="buckaroo_payment_ideal_issuer"}
</div>

0 comments on commit 8253987

Please sign in to comment.