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

Mag2 313 remove i deal bank groups #553

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
1 change: 0 additions & 1 deletion Model/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ protected function getPayoneConfig()
'bankCodeValidatedAndValid' => false,
'blockedMessage' => $this->paymentHelper->getBankaccountCheckBlockedMessage(),
'epsBankGroups' => Eps::getBankGroups(),
'idealBankGroups' => Ideal::getBankGroups(),
'customerBirthday' => $this->customerHelper->getCustomerBirthday(),
'addresscheckEnabled' => (int)$this->requestHelper->getConfigParam('enabled', 'address_check', 'payone_protect'),
'addresscheckBillingEnabled' => $this->requestHelper->getConfigParam('check_billing', 'address_check', 'payone_protect') == 'NO' ? 0 : 1,
Expand Down
60 changes: 0 additions & 60 deletions Model/Methods/OnlineBankTransfer/Ideal.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,28 +56,6 @@ class Ideal extends OnlineBankTransferBase
*/
protected $sSubType = self::METHOD_OBT_SUBTYPE_IDEAL;

/**
* Array of all available bank groups
*
* @var array
*/
protected static $aBankGroups = [
'ABN_AMRO_BANK' => 'ABN Amro Bank',
'ASN_BANK' => 'ASN Bank',
'ING_BANK' => 'ING Bank',
'RABOBANK' => 'Rabobank',
'SNS_BANK' => 'SNS Bank',
'SNS_REGIO_BANK' => 'SNS Regio Bank',
'TRIODOS_BANK' => 'Triodos Bank',
'VAN_LANSCHOT_BANKIERS' => 'Van Lanschot Kempen',
'KNAB_BANK' => 'Knab Bank',
'BUNQ_BANK' => 'Bunq Bank',
'REVOLUT' => 'Revolut',
'YOURSAFE' => 'Yoursafe',
'NATIONALE_NEDERLANDEN' => 'Nationale-Nederlanden',
'N26' => 'N26',
];

/**
* Return parameters specific to this payment sub type
*
Expand All @@ -86,48 +64,10 @@ class Ideal extends OnlineBankTransferBase
*/
public function getSubTypeSpecificParameters(Order $oOrder)
{
$oInfoInstance = $this->getInfoInstance();

$aParams = [
'bankcountry' => 'NL',
'bankgrouptype' => $oInfoInstance->getAdditionalInformation('bank_group'),
];

return $aParams;
}

/**
* Add the checkout-form-data to the checkout session
*
* @param DataObject $data
* @return $this
*/
public function assignData(DataObject $data)
{
parent::assignData($data);

$oInfoInstance = $this->getInfoInstance();
$oInfoInstance->setAdditionalInformation('bank_group', $this->toolkitHelper->getAdditionalDataEntry($data, 'bank_group'));

return $this;
}

/**
* Return available bank groups
*
* @return array
*/
public static function getBankGroups()
{
$aReturn = [];

foreach (self::$aBankGroups as $sKey => $sTitle) {
$aReturn[] = [
'id' => $sKey,
'title' => mb_convert_encoding($sTitle, 'UTF-8'),
];
}

return $aReturn;
}
}
21 changes: 2 additions & 19 deletions Test/Unit/Model/Methods/OnlineBankTransfer/IdealTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,32 +51,15 @@ protected function setUp(): void
{
$this->objectManager = $this->getObjectManager();

$info = $this->getMockBuilder(InfoInterface::class)->disableOriginalConstructor()->getMock();
$info->method('getAdditionalInformation')->willReturn('info');

$toolkitHelper = $this->getMockBuilder(Toolkit::class)->disableOriginalConstructor()->getMock();
$toolkitHelper->method('getAdditionalDataEntry')->willReturn('info');

$this->classToTest = $this->objectManager->getObject(ClassToTest::class, [
'toolkitHelper' => $toolkitHelper
]);
$this->classToTest->setInfoInstance($info);
$this->classToTest = $this->objectManager->getObject(ClassToTest::class);
}

public function testGetSubTypeSpecificParameters()
{
$order = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock();

$result = $this->classToTest->getSubTypeSpecificParameters($order);
$expected = ['bankcountry' => 'NL', 'bankgrouptype' => 'info'];
$expected = ['bankcountry' => 'NL'];
$this->assertEquals($expected, $result);
}

public function testAssignData()
{
$data = $this->getMockBuilder(DataObject::class)->disableOriginalConstructor()->getMock();

$result = $this->classToTest->assignData($data);
$this->assertInstanceOf(ClassToTest::class, $result);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,12 @@ define(
'use strict';
return Component.extend({
defaults: {
template: 'Payone_Core/payment/obt_ideal',
bankGroup: ''
},

initObservable: function () {
this._super()
.observe([
'bankGroup'
]);
return this;
},

getData: function () {
var parentReturn = this._super();
if (parentReturn.additional_data === null) {
parentReturn.additional_data = {};
}
parentReturn.additional_data.bank_group = this.bankGroup();
return parentReturn;
template: 'Payone_Core/payment/obt_ideal'
},

/** Returns payment method instructions */
getInstructions: function () {
return window.checkoutConfig.payment.instructions[this.item.method];
},
getBankGroups: function () {
return window.checkoutConfig.payment.payone.idealBankGroups;
}
});
}
Expand Down
22 changes: 0 additions & 22 deletions view/frontend/web/template/payment/obt_ideal.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,6 @@
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>

<form class="debit_form" action="#" method="post" data-bind="attr: {id: getCode() + '_form'}">
<fieldset data-bind="attr: {class: 'fieldset payment items ' + getCode()}">
<div class="field">
<label data-bind="attr: {for: getCode() + '_bank_group'}" class="label">
<span><!-- ko i18n: 'Bank group'--><!-- /ko --></span>
</label>
<div class='control'>
<select style="width:200px;" name="payment[bank_group]" class="select"
data-bind=" attr: {id: getCode() + '_bank_group', 'data-container': getCode() + '_bank_group'},
enable: true,
options: getBankGroups(),
optionsValue: 'id',
optionsText: 'title',
optionsCaption: $t('--Please Select--'),
value: bankGroup">
</select>
</div>
</div>
</fieldset>
</form>

<p data-bind="html: getInstructions()"></p>
<div class="checkout-agreements-block">
<!-- ko foreach: $parent.getRegion('before-place-order') -->
Expand Down
Loading