Skip to content

Commit

Permalink
allow disabling the financial institution selection
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubpolomsky committed Jan 18, 2018
1 parent beb3042 commit 7e4e82b
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 19 deletions.
19 changes: 18 additions & 1 deletion Frontend/WirecardCheckoutPage/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function getCapabilities()
*/
public function getVersion()
{
return '1.5.8';
return '1.5.9';
}

/**
Expand Down Expand Up @@ -526,6 +526,18 @@ protected function createForm()
'order' => ++$i
)
);

$form->setElement(
'checkbox',
'FINANCIAL_INSTITUTION_SELECTION_ENABLED',
array(
'label' => 'Auswahl des Finanzinstitutes erlauben.',
'value' => 1,
'description' => 'Bei Zahlungsmittel wie EPS und iDeal die Auswahl des Finanzinstitutes vor der Weiterleitung zum PSP erlauben.',
'scope' => \Shopware\Models\Config\Element::SCOPE_SHOP,
'required' => false,
'order' => ++$i
));
}

/**
Expand Down Expand Up @@ -626,6 +638,10 @@ public function createTranslations()
'label' => 'Accepted currencies for Installment',
'description' => 'Please select at least one currency to use Installment.'
),
'FINANCIAL_INSTITUTION_SELECTION_ENABLED' => Array(
'label' => 'Selection of financial institute allowed.',
'description' => 'Allow financial institute selection for payment methods like EPS or iDeal.'
)
)
);

Expand Down Expand Up @@ -931,6 +947,7 @@ public function onPostDispatch(Enlight_Event_EventArgs $args)
$view->paymentDesc = Shopware()->Session()->sOrderVariables['sUserData']['additional']['payment']['description'];
$view->paymentName = $paymentName;
$view->paymentLogo = 'frontend/_public/images/' . $paymentName . '.png';
$view->financialInstitutionSelectionEnabled = Shopware()->WirecardCheckoutPage()->getConfig()->FINANCIAL_INSTITUTION_SELECTION_ENABLED;

if(Shopware()->Session()->offsetGet('wcpConsumerDeviceId') != null) {
$consumerDeviceId = Shopware()->Session()->offsetGet('wcpConsumerDeviceId');
Expand Down
5 changes: 4 additions & 1 deletion Frontend/WirecardCheckoutPage/Models/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ protected function getFrontendClient(Shopware_Plugins_Frontend_WirecardCheckoutP
public function initiatePayment($paymentType, $amount, $currency, $returnUrl, $confimUrl, $params = array())
{
$oFrontendClient = $this->getFrontendClient(Shopware()->WirecardCheckoutPage()->getConfig());
if (in_array(strtolower($paymentType), Shopware()->WirecardCheckoutPage()->getConfig()->getPaymentsFinancialInstitution())) {
if (Shopware()->WirecardCheckoutPage()->getConfig()->FINANCIAL_INSTITUTION_SELECTION_ENABLED
&& in_array(strtolower($paymentType),
Shopware()->WirecardCheckoutPage()->getConfig()->getPaymentsFinancialInstitution())
) {
$oFrontendClient->setFinancialInstitution(Shopware()->WirecardCheckoutPage()->financialInstitution);
}
$email = (string) Shopware()->WirecardCheckoutPage()->getUser('user')->email;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,26 @@
}
};
{if $financialInstitutionSelectionEnabled}
function setFinancialInstitution() {
var paymentForm = $('#confirm--form');
console.log($('#financialInstitutions').val());
paymentForm.append('<input type="hidden" name="financialInstitution" value="' + $('#financialInstitutions').val() + '" />');
}
{/if}
window.onload = function() {
$(document).ready(function() {
if ( {$paymentName|json_encode} == 'wcp_invoice' || {$paymentName|json_encode} == 'wcp_installment')
{
checkbirthday();
}
{if $financialInstitutionSelectionEnabled}
else if ( {$paymentName|json_encode} == 'wcp_ideal' || {$paymentName|json_encode} == 'wcp_eps')
{
setFinancialInstitution();
}
{/if}
});
};
</script>
Expand All @@ -77,28 +82,30 @@

{block name='frontend_checkout_confirm_product_table' prepend}
{if $wcpAdditional eq 'financialInstitutions'}
<div class="panel has--border is--rounded" id="wd_payment_fields">
<div class="panel--title is--underline">
<img src="{link file={$paymentLogo}}"/>{$wirecardAdditionalHeadline}
</div>
{if $financialInstitutionSelectionEnabled}
<div class="panel has--border is--rounded" id="wd_payment_fields">
<div class="panel--title is--underline">
<img src="{link file={$paymentLogo}}"/>{$wirecardAdditionalHeadline}
</div>

<div class="panel--body is--wide">
<div class="wirecard--field">
<div class="panel--body is--wide">
<div class="wirecard--field">

{*<label for="ccard_cardholdername">{s name='WirecardFinancialInstitutions'}Finanzinstitut{/s}:</label>*}
<select name="financialInstitution" id="financialInstitutions" onchange="setFinancialInstitution()">
{*<label for="ccard_cardholdername">{s name='WirecardFinancialInstitutions'}Finanzinstitut{/s}:</label>*}
<select name="financialInstitution" id="financialInstitutions" onchange="setFinancialInstitution()">

{foreach from=$financialInstitutions item=bank key=short}
<option value="{$short}"
{if $short eq $financialInstitutionsSelected}selected="selected" {/if}>
{$bank}
</option>
{/foreach}
</select>
{foreach from=$financialInstitutions item=bank key=short}
<option value="{$short}"
{if $short eq $financialInstitutionsSelected}selected="selected" {/if}>
{$bank}
</option>
{/foreach}
</select>
</div>
<div class="wirecard--clearer"></div>
</div>
<div class="wirecard--clearer"></div>
</div>
</div>
{/if}
{elseif 'wcp_invoice' eq $paymentName || 'wcp_installment' eq $paymentName}
<div class="panel has--border is--rounded" id="wd_payment_fields">
<div class="panel--title is--underline">
Expand Down

0 comments on commit 7e4e82b

Please sign in to comment.