Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
Update to module version 16.12.14+174
Browse files Browse the repository at this point in the history
  • Loading branch information
Lmbrtz committed Mar 23, 2017
1 parent a2e8438 commit 7930767
Show file tree
Hide file tree
Showing 17 changed files with 227 additions and 184 deletions.
21 changes: 21 additions & 0 deletions .idea/deployment.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions .idea/magento1_netresearch_ops.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/magicento.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion app/code/community/Netresearch/OPS/Model/Payment/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,14 @@ public function getEncoding()

/**
* @param string $encoding
*
* @return $this
*/
public function setEncoding($encoding)
{
$this->encoding = $encoding;

return $this;
}

/**
Expand Down Expand Up @@ -496,10 +500,14 @@ function ($acc, $item) {
if (!$item->getParentItem()) {
$acc .= ($acc != '' ? ', ' : '') . $item->getName();
}

return $acc;
}, ''
);

list($description) = $this->transliterateParams(array($description));
$description = mb_substr($description, 0, 100);

return $description;
}

Expand Down Expand Up @@ -843,7 +851,7 @@ public function void(Varien_Object $payment)
);
}


/** @var Netresearch_OPS_Model_Response_Handler $handler */
$handler = Mage::getModel('ops/response_handler');
$handler->processResponse($response, $this, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function assignData($data)
}
$pm = $brand = trim('Bank transfer' . (('*' == $countryId) ? '' : ' ' . $countryId));

$payment = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
$payment = $this->getInfoInstance();
$payment->setAdditionalInformation('PM', $pm);
$payment->setAdditionalInformation('BRAND', $brand);

Expand Down
35 changes: 18 additions & 17 deletions app/code/community/Netresearch/OPS/Model/Payment/Cc.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,24 +276,25 @@ public function getMethodDependendFormFields($order, $requestParams = null)
$formFields['CREDITDEBIT'] = "C";
}

$alias = $order->getPayment()->getAdditionalInformation('alias');

if ($alias) {
$formFields['ALIAS'] = $alias;
$formFields['ALIASOPERATION'] = "BYPSP";
$formFields['ECI'] = 9;
$formFields['ALIASUSAGE'] = $this->getConfig()->getAliasUsageForExistingAlias(
$order->getPayment()->getMethodInstance()->getCode(),
$order->getStoreId()
);
} else {
$formFields['ALIAS'] = "";
$formFields['ALIASOPERATION'] = "BYPSP";
$formFields['ALIASUSAGE'] = $this->getConfig()->getAliasUsageForNewAlias(
$order->getPayment()->getMethodInstance()->getCode(),
$order->getStoreId()
);
$alias = $order->getPayment()->getAdditionalInformation('alias') ?: '';
$formFields['ALIAS'] = $alias;

if ($this->getConfigData('active_alias')) {
if ($alias) {
$formFields['ALIASOPERATION'] = "BYPSP";
$formFields['ECI'] = 9;
$formFields['ALIASUSAGE'] = $this->getConfig()->getAliasUsageForExistingAlias(
$order->getPayment()->getMethodInstance()->getCode(),
$order->getStoreId()
);
} else {
$formFields['ALIASOPERATION'] = "BYPSP";
$formFields['ALIASUSAGE'] = $this->getConfig()->getAliasUsageForNewAlias(
$order->getPayment()->getMethodInstance()->getCode(),
$order->getStoreId()
);

}
}

return $formFields;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
class Netresearch_OPS_Test_Model_Payment_AbstractTest extends EcomDev_PHPUnit_Test_Case_Controller
class Netresearch_OPS_Test_Model_Payment_AbstractTest extends EcomDev_PHPUnit_Test_Case
{
protected $model = null;

Expand Down Expand Up @@ -62,11 +62,17 @@ public function _getOrderDescriptionShorterThen100Chars()
->method('getAllItems')
->will($this->returnValue($items));

$result = Mage::getModel('ops/payment_abstract')->_getOrderDescription($order);
$result = Mage::getModel('ops/payment_abstract')->setEncoding('utf-8')->_getOrderDescription($order);
$this->assertEquals(
'abc, ghi, Dubbelwerkende cilinder Boring ø70 Stang ø40 3/8, 0123456789012345678901234567890123456789',
$result
);

$result = Mage::getModel('ops/payment_abstract')->setEncoding('foobar')->_getOrderDescription($order);
$this->assertEquals(
'abc, ghi, Dubbelwerkende cilinder Boring oe70 Stang oe40 3/8, 01234567890123456789012345678901234567',
$result
);
}

/**
Expand Down Expand Up @@ -248,14 +254,18 @@ public function testGetCloseTransactionFromCreditMemoData()
public function testGetMethodDependendFormFields()
{
$order = Mage::getModel('sales/order')->load(11);
$sessionMock = $this->getModelMock('checkout/session', array('getQuote'));
$sessionMock = $this->getModelMockBuilder('checkout/session')
->setMethods(array('getQuote'))
->disableOriginalConstructor();
$sessionMock->expects($this->any())
->method('getQuote')
->will($this->returnValue($order));
$this->replaceByMock('model', 'checkout/session', $sessionMock);


$sessionMock = $this->getModelMock('customer/session', array('isLoggedIn'));
$sessionMock = $this->getModelMockBuilder('customer/session')
->setMethods(array('isLoggedIn'))
->disableOriginalConstructor();
$sessionMock->expects($this->any())
->method('isLoggedIn')
->will($this->returnValue(1));
Expand Down Expand Up @@ -602,9 +612,16 @@ public function testVoidFailsWhenStatusIsUnknown()
->will($this->returnValue(false));
$this->replaceByMock('helper', 'ops/directlink', $helperMock);

$statusMock = $this->getModelMock('ops/status_update', array('updateStatusFor'));
$statusMock->expects($this->once())
->method('updateStatusFor')
->will($this->returnSelf());
$this->replaceByMock('model', 'ops/status_update', $statusMock);

$apiClientMock = $this->getModelMock(
'ops/api_directlink', array('performRequest')
);

$apiClientMock->expects($this->any())
->method('performRequest')
->will(
Expand Down
76 changes: 76 additions & 0 deletions app/code/community/Netresearch/OPS/Test/Model/Payment/CcTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,5 +209,81 @@ public function testIsAvailable()
$quote->setItemsCount(500);
$this->assertFalse($this->_model->isAvailable($quote));
}

/**
* @loadFixture ../../../../var/fixtures/orders.yaml
*/
public function testGetMethodDependendFormFields()
{
$order = Mage::getModel('sales/order')->load(11);

$sessionMock = $this->getModelMockBuilder('core/session')
->disableOriginalConstructor()
->setMethods(null)
->getMock();
$this->replaceByMock('singleton', 'core/session', $sessionMock);

$sessionMock = $this->getModelMockBuilder('customer/session')
->disableOriginalConstructor()
->setMethods(null)
->getMock();
$this->replaceByMock('singleton', 'customer/session', $sessionMock);

$configMock = $this->getModelMock('ops/config',
array(
'getCreditDebitSplit',
'getAliasUsageForExistingAlias',
'getAliasUsageForNewAlias'
)
);

$configMock
->expects($this->any())
->method('getCreditDebitSplit')
->will($this->returnValue(true));

$configMock
->expects($this->any())
->method('getAliasUsageForExistingAlias')
->will($this->returnValue('foo'));

$configMock
->expects($this->any())
->method('getAliasUsageForNewAlias')
->will($this->returnValue('bar'));

$this->replaceByMock('model', 'ops/config', $configMock);

$ccModelMock = $this->getModelMock('ops/payment_cc', array('getConfigData'));
$ccModelMock
->expects($this->any())
->method('getConfigData')
->will($this->returnValue(true));

$this->replaceByMock('model', 'ops/payment_cc', $ccModelMock);


$formFields = $ccModelMock->getMethodDependendFormFields($order, null);
$this->assertEquals('041907169941', $formFields['ALIAS']);
$this->assertEquals('BYPSP', $formFields['ALIASOPERATION']);
$this->assertEquals('9', $formFields['ECI']);
$this->assertEquals('foo', $formFields['ALIASUSAGE']);

$order = Mage::getModel('sales/order')->load(32);

$ccModelMock
->expects($this->any())
->method('getConfigData')
->will($this->returnValue(false));

$this->replaceByMock('model', 'ops/payment_cc', $ccModelMock);

$formFields = $ccModelMock->getMethodDependendFormFields($order, null);
$this->assertEquals('', $formFields['ALIAS']);
$this->assertEquals('BYPSP', $formFields['ALIASOPERATION']);
$this->assertEquals('bar', $formFields['ALIASUSAGE']);

}

}

2 changes: 1 addition & 1 deletion app/code/community/Netresearch/OPS/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<config>
<modules>
<Netresearch_OPS>
<version>16.12.14</version>
<version>16.12.14+174</version>
</Netresearch_OPS>
</modules>
<global>
Expand Down
Loading

0 comments on commit 7930767

Please sign in to comment.