Skip to content

Commit

Permalink
MAG2-333 - Removed Paydirekt
Browse files Browse the repository at this point in the history
  • Loading branch information
FatchipRobert committed Jan 27, 2025
1 parent 5aee586 commit 7483767
Show file tree
Hide file tree
Showing 27 changed files with 15 additions and 558 deletions.
13 changes: 0 additions & 13 deletions Block/Onepage/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,19 +309,6 @@ public function isPayPalExpress()
return false;
}

/**
* Check if paypal express is used
*
* @return bool
*/
public function isPaydirekt()
{
if ($this->_quote->getPayment()->getMethod() == PayoneConfig::METHOD_PAYDIREKT) {
return true;
}
return false;
}

/**
* Generate URL to the fingerprint.js Javascript file
*
Expand Down
1 change: 0 additions & 1 deletion Controller/Onepage/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ class Review extends \Magento\Framework\App\Action\Action
protected $availableReviewMethods = [
PayoneConfig::METHOD_PAYPAL,
PayoneConfig::METHOD_PAYPALV2,
PayoneConfig::METHOD_PAYDIREKT,
PayoneConfig::METHOD_AMAZONPAYV2,
];

Expand Down
15 changes: 0 additions & 15 deletions Helper/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,19 +374,4 @@ public function getSubstituteOrderIncrementId($sIncrementId)
->where("payone_cancel_substitute_increment_id = :incrementId");
return $this->getDb()->fetchOne($oSelect, ['incrementId' => $sIncrementId]);
}

/**
* Writes the registered flag to the customer entity
* I'm sure there is a way to do this correctly with the entity object, but Mage2 did everything to prevent this
*
* @param int $iCustomerId
* @return int
*/
public function markUserAsRegisteredWithPaydirekt($iCustomerId)
{
$table = $this->databaseResource->getTableName('customer_entity');
$data = ['payone_paydirekt_registered' => 1];
$where = ['entity_id = ?' => $iCustomerId];
return $this->getDb()->update($table, $data, $where);
}
}
2 changes: 0 additions & 2 deletions Helper/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class Payment extends \Payone\Core\Helper\Base
PayoneConfig::METHOD_OBT_POSTFINANCE_CARD,
PayoneConfig::METHOD_OBT_IDEAL,
PayoneConfig::METHOD_OBT_PRZELEWY,
PayoneConfig::METHOD_PAYDIREKT,
PayoneConfig::METHOD_SAFE_INVOICE,
PayoneConfig::METHOD_PAYOLUTION_INVOICE,
PayoneConfig::METHOD_PAYOLUTION_DEBIT,
Expand Down Expand Up @@ -94,7 +93,6 @@ class Payment extends \Payone\Core\Helper\Base
PayoneConfig::METHOD_OBT_PRZELEWY => 'sb',
PayoneConfig::METHOD_PAYPAL => 'wlt',
PayoneConfig::METHOD_PAYPALV2 => 'wlt',
PayoneConfig::METHOD_PAYDIREKT => 'wlt',
PayoneConfig::METHOD_SAFE_INVOICE => 'rec',
PayoneConfig::METHOD_PAYOLUTION_INVOICE => 'fnc',
PayoneConfig::METHOD_PAYOLUTION_DEBIT => 'fnc',
Expand Down
2 changes: 1 addition & 1 deletion Model/Api/Request/Authorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ protected function setUserParameters(PayoneMethod $oPayment, Order $oOrder)
$oShipping = $oOrder->getShippingAddress(); // get shipping address from order
if ($oShipping) {// shipping address existing?
$this->addAddress($oShipping, true); // add regular shipping address
} elseif ($oPayment->getCode() == PayoneConfig::METHOD_PAYDIREKT || ($oPayment->getCode() == PayoneConfig::METHOD_PAYPAL && $this->shopHelper->getConfigParam('bill_as_del_address', PayoneConfig::METHOD_PAYPAL, 'payone_payment', $this->storeCode))) {
} elseif ($oPayment->getCode() == PayoneConfig::METHOD_PAYPAL && $this->shopHelper->getConfigParam('bill_as_del_address', PayoneConfig::METHOD_PAYPAL, 'payone_payment', $this->storeCode)) {
$this->addAddress($oOrder->getBillingAddress(), true); // add billing address as shipping address
}
}
Expand Down
104 changes: 0 additions & 104 deletions Model/Methods/Paydirekt.php

This file was deleted.

1 change: 0 additions & 1 deletion Model/Methods/PayoneMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,6 @@ public function getSubTypeSpecificParameters(Order $oOrder)

/**
* Formats the reference number if needed for this payment method
* Needed for Paydirekt
*
* @param string $sRefNr
* @return string
Expand Down
1 change: 0 additions & 1 deletion Model/PayoneConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ abstract class PayoneConfig
const METHOD_OBT_IDEAL = 'payone_obt_ideal';
const METHOD_OBT_PRZELEWY = 'payone_obt_przelewy';
const METHOD_KLARNA = 'payone_klarna'; // method was deleted but constant is still useful for unit tests
const METHOD_PAYDIREKT = 'payone_paydirekt';
const METHOD_SAFE_INVOICE = 'payone_safe_invoice';
const METHOD_PAYOLUTION_INVOICE = 'payone_payolution_invoice';
const METHOD_PAYOLUTION_DEBIT = 'payone_payolution_debit';
Expand Down
19 changes: 0 additions & 19 deletions Setup/UpgradeData.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,25 +253,6 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
);
}

$customerInstaller = $this->customerSetupFactory->create(['setup' => $setup]);
if (!$customerInstaller->getAttribute(\Magento\Customer\Model\Customer::ENTITY, 'payone_paydirekt_registered', 'attribute_id')) {
$customerInstaller->addAttribute(
'customer',
'payone_paydirekt_registered',
[
'type' => 'int',
'label' => 'Payone paydirekt OneClick is registered',
'input' => 'text',
'required' => false,
'visible' => false,
'user_defined' => true,
'sort_order' => 999,
'position' => 999,
'system' => 0,
]
);
}

if (!$setup->getConnection()->tableColumnExists($setup->getTable('sales_order'), 'payone_ratepay_shop_id')) {
$salesInstaller = $this->salesSetupFactory->create(['resourceName' => 'sales_setup', 'setup' => $setup]);
$salesInstaller->addAttribute(
Expand Down
14 changes: 0 additions & 14 deletions Setup/UpgradeSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,6 @@ protected function addNewColumns(SchemaSetupInterface $setup, ModuleContextInter
);
}

if (!$setup->getConnection()->tableColumnExists($setup->getTable('customer_entity'), 'payone_paydirekt_registered')) {
$setup->getConnection()->addColumn(
$setup->getTable('customer_entity'),
'payone_paydirekt_registered',
[
'type' => Table::TYPE_INTEGER,
'length' => 1,
'nullable' => false,
'default' => 0,
'comment' => 'Payone paydirekt OneClick is registered'
]
);
}

if (!$setup->getConnection()->tableColumnExists($setup->getTable(CheckedAddresses::TABLE_CHECKED_ADDRESSES), 'score')) {
$setup->getConnection()->addColumn(
$setup->getTable(CheckedAddresses::TABLE_CHECKED_ADDRESSES),
Expand Down
16 changes: 1 addition & 15 deletions Test/Unit/Block/Onepage/ReviewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,25 +324,11 @@ public function testIsPayPalExpressTrue()

public function testIsPayPalExpressFalse()
{
$this->payment->method('getMethod')->willReturn(PayoneConfig::METHOD_PAYDIREKT);
$this->payment->method('getMethod')->willReturn(PayoneConfig::METHOD_DEBIT);
$result = $this->classToTest->isPayPalExpress();
$this->assertFalse($result);
}

public function testIsPaydirektTrue()
{
$this->payment->method('getMethod')->willReturn(PayoneConfig::METHOD_PAYDIREKT);
$result = $this->classToTest->isPaydirekt();
$this->assertTrue($result);
}

public function testIsPaydirektFalse()
{
$this->payment->method('getMethod')->willReturn(PayoneConfig::METHOD_PAYPAL);
$result = $this->classToTest->isPaydirekt();
$this->assertFalse($result);
}

public function testGetFingerprintJsUrl()
{
$expected = 'expected';
Expand Down
10 changes: 0 additions & 10 deletions Test/Unit/Helper/DatabaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,14 +311,4 @@ public function testGetSubstituteOrderIncrementId()
$result = $this->database->getSubstituteOrderIncrementId('12345');
$this->assertEquals($expected, $result);
}

public function testMarkUserAsRegisteredWithPaydirekt()
{
$expected = 1;

$this->connection->method('update')->willReturn($expected);

$result = $this->database->markUserAsRegisteredWithPaydirekt(12345);
$this->assertEquals($expected, $result);
}
}
2 changes: 0 additions & 2 deletions Test/Unit/Model/ConfigProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ protected function setUp(): void

$customer = $this->getMockBuilder(CustomerModel::class)
->disableOriginalConstructor()
->setMethods(['getPayonePaydirektRegistered'])
->getMock();
$customer->method('getPayonePaydirektRegistered')->willReturn('0');

$this->customerSession = $this->getMockBuilder(CustomerSession::class)->disableOriginalConstructor()->getMock();
$this->customerSession->method('getCustomer')->willReturn($customer);
Expand Down
17 changes: 8 additions & 9 deletions Test/Unit/Model/Methods/BaseMethodTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@
use Magento\Payment\Model\Method\AbstractMethod;
use Magento\Sales\Model\Order;
use Magento\Store\Model\Store;
use Payone\Core\Model\Methods\Paydirekt as ClassToTest;
use Payone\Core\Model\Methods\Paypal as ClassToTest;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use Payone\Core\Helper\Shop;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Payone\Core\Model\Methods\Paydirekt;
use Payone\Core\Model\PayoneConfig;
use Magento\Payment\Model\Info;
use Payone\Core\Model\Api\Request\Authorization;
Expand Down Expand Up @@ -163,7 +162,7 @@ public function testAuthorize()
$this->authorizationRequest->method('sendRequest')->willReturn($aResponse);

$result = $this->classToTest->authorize($paymentInfo, 100);
$this->assertInstanceOf(Paydirekt::class, $result);
$this->assertInstanceOf(ClassToTest::class, $result);
}

public function testAuthorizeError()
Expand Down Expand Up @@ -225,7 +224,7 @@ public function testRefund()
$this->debitRequest->method('sendRequest')->willReturn($aResponse);

$result = $this->classToTest->refund($paymentInfo, 100);
$this->assertInstanceOf(Paydirekt::class, $result);
$this->assertInstanceOf(ClassToTest::class, $result);
}

public function testRefundError()
Expand Down Expand Up @@ -292,7 +291,7 @@ public function testCapture()
$this->captureRequest->method('sendRequest')->willReturn($aResponse);

$result = $this->classToTest->capture($paymentInfo, 100);
$this->assertInstanceOf(Paydirekt::class, $result);
$this->assertInstanceOf(ClassToTest::class, $result);
}

public function testCaptureError()
Expand Down Expand Up @@ -361,7 +360,7 @@ public function testCaptureAuth()
$this->authorizationRequest->method('sendRequest')->willReturn($aResponse);

$result = $this->classToTest->capture($paymentInfo, 100);
$this->assertInstanceOf(Paydirekt::class, $result);
$this->assertInstanceOf(ClassToTest::class, $result);
}

public function testCanUseForCountryFalse()
Expand All @@ -372,9 +371,9 @@ public function testCanUseForCountryFalse()
[
['allowspecific', 'global', 'payone_general', null, 0],
['specificcountry', 'global', 'payone_general', null, 'DE,AT'],
['use_global', PayoneConfig::METHOD_PAYDIREKT, 'payone_payment', null, '0'],
['allowspecific', PayoneConfig::METHOD_PAYDIREKT, 'payone_payment', null, '1'],
['specificcountry', PayoneConfig::METHOD_PAYDIREKT, 'payone_payment', null, 'NL,AT'],
['use_global', PayoneConfig::METHOD_PAYPAL, 'payone_payment', null, '0'],
['allowspecific', PayoneConfig::METHOD_PAYPAL, 'payone_payment', null, '1'],
['specificcountry', PayoneConfig::METHOD_PAYPAL, 'payone_payment', null, 'NL,AT'],
]
);
$result = $this->classToTest->canUseForCountry('DE');
Expand Down
Loading

0 comments on commit 7483767

Please sign in to comment.