Skip to content

Commit

Permalink
Merge branch 'b-6.3.x' into UNZER-214_Dispay_Bank_Data
Browse files Browse the repository at this point in the history
  • Loading branch information
markusmichalski-fc authored Nov 28, 2023
2 parents f5a8ec0 + 067199c commit e1e751d
Show file tree
Hide file tree
Showing 12 changed files with 238 additions and 35 deletions.
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.1.3] - 2023-??-??
## [1.1.4] - 2023-??-??

- [0007553](https://bugs.oxid-esales.com/view.php?id=7553) revert this task because, it is possible to have different billing and delivery addresses for invoice purchases (Paylater)
- Discounts with time restrictions may not be invalidated directly in the checkout...
- provided additional Order-Number is searchable
- increase line spacing for the error messages

## [1.1.3] - 2023-11-14

- [0007526](https://bugs.oxid-esales.com/view.php?id=7526) Order would be saved only, if everything is correct. In all other cases redirect to checkout
- [0007509](https://bugs.oxid-esales.com/view.php?id=7509) Order would be saved only, if everything is correct. In all other cases redirect to checkout
Expand All @@ -13,9 +20,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- [0007544](https://bugs.oxid-esales.com/view.php?id=7544) Add Error handling When unsupported Credit Card is used (e.g. Amex)
- [0007553](https://bugs.oxid-esales.com/view.php?id=7553) The billing and delivery address must be identical for invoice purchases (Paylater)
- [0007546](https://bugs.oxid-esales.com/view.php?id=7546): We provide an additional Order Number to Unzer for identify the Order in OXID-Backend and Unzer-Insights

- Prepayment - Adjust payment date when the payment has been completed
- change information for Unzer-Metadata
- Unzer Invoice (Paylater): Display bank details for invoice

## [1.1.2] - 2023-08-18

Expand Down
9 changes: 7 additions & 2 deletions Tests/PhpStan/phpstan-bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ class_alias(
\OxidSolutionCatalysts\Unzer\Controller\Admin\OrderMain_parent::class
);

class_alias(
\OxidEsales\Eshop\Application\Controller\Admin\OrderList::class,
\OxidSolutionCatalysts\Unzer\Controller\Admin\OrderList_parent::class
);

class_alias(
\OxidEsales\Eshop\Application\Controller\OrderController::class,
\OxidSolutionCatalysts\Unzer\Controller\OrderController_parent::class
Expand Down Expand Up @@ -57,6 +62,6 @@ class_alias(
);

class_alias(
\OxidEsales\Eshop\Application\Model\PaymentGateway::class,
\OxidSolutionCatalysts\Unzer\Model\PaymentGateway_parent::class
\OxidEsales\Eshop\Application\Model\DiscountList::class,
\OxidSolutionCatalysts\Unzer\Model\DiscountList_parent::class
);
1 change: 1 addition & 0 deletions Tests/PhpStan/phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
parameters:
checkMissingIterableValueType: false
treatPhpDocTypesAsCertain: false
bootstrapFiles:
- phpstan-bootstrap.php
level: max
Expand Down
7 changes: 5 additions & 2 deletions metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
* Metadata version
*/

use OxidSolutionCatalysts\Unzer\Model\DiscountList;
use OxidSolutionCatalysts\Unzer\Controller\Admin\AdminOrderController;
use OxidSolutionCatalysts\Unzer\Controller\Admin\ModuleConfiguration;
use OxidSolutionCatalysts\Unzer\Controller\Admin\OrderMain;
use OxidSolutionCatalysts\Unzer\Controller\Admin\OrderList;
use OxidSolutionCatalysts\Unzer\Controller\ApplePayCallbackController;
use OxidSolutionCatalysts\Unzer\Controller\DispatcherController;
use OxidSolutionCatalysts\Unzer\Controller\InstallmentController;
Expand All @@ -20,7 +22,6 @@
use OxidSolutionCatalysts\Unzer\Core\Config;
use OxidSolutionCatalysts\Unzer\Core\ShopControl;
use OxidSolutionCatalysts\Unzer\Core\ViewConfig;
use OxidSolutionCatalysts\Unzer\Model\PaymentGateway;
use OxidSolutionCatalysts\Unzer\Model\Article;
use OxidSolutionCatalysts\Unzer\Model\Order;
use OxidSolutionCatalysts\Unzer\Model\Payment;
Expand Down Expand Up @@ -51,7 +52,7 @@
</ul>',
],
'thumbnail' => 'logo.svg',
'version' => '1.1.3-rc.3',
'version' => '1.1.4-rc.1',
'author' => 'OXID eSales AG',
'url' => 'https://www.oxid-esales.com',
'email' => 'info@oxid-esales.com',
Expand All @@ -60,11 +61,13 @@
\OxidEsales\Eshop\Core\ViewConfig::class => ViewConfig::class,
\OxidEsales\Eshop\Core\Config::class => Config::class,
\OxidEsales\Eshop\Application\Model\Payment::class => Payment::class,
\OxidEsales\Eshop\Application\Model\DiscountList::class => DiscountList::class,
\OxidEsales\Eshop\Application\Controller\OrderController::class => OrderController::class,
\OxidEsales\Eshop\Application\Model\Order::class => Order::class,
\OxidEsales\Eshop\Core\ShopControl::class => ShopControl::class,
\OxidEsales\Eshop\Application\Controller\Admin\ModuleConfiguration::class => ModuleConfiguration::class,
\OxidEsales\Eshop\Application\Controller\Admin\OrderMain::class => OrderMain::class,
\OxidEsales\Eshop\Application\Controller\Admin\OrderList::class => OrderList::class,
\OxidEsales\Eshop\Application\Model\Article::class => Article::class,
],
'controllers' => [
Expand Down
53 changes: 53 additions & 0 deletions src/Controller/Admin/OrderList.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

namespace OxidSolutionCatalysts\Unzer\Controller\Admin;

use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Registry;

class OrderList extends OrderList_parent
{
/**
* Adding folder check
* bi *
* @param array $whereQuery SQL condition array
* @param string $fullQuery SQL query string
*
* @SuppressWarnings(PHPMD.StaticAccess)
*
* @return string
*/
protected function _prepareWhereQuery($whereQuery, $fullQuery)
{
// seperate oxordernr
$orderNrSearch = '';
if (isset($whereQuery['oxorder.oxordernr'])) {
$orderNrSearch = $whereQuery['oxorder.oxordernr'];
unset($whereQuery['oxorder.oxordernr']);
}

$database = DatabaseProvider::getDb();
$query = parent::_prepareWhereQuery($whereQuery, $fullQuery);
$config = $this->getConfig();
$folders = $config->getConfigParam('aOrderfolder');
$folder = Registry::getConfig()->getRequestParameter('folder');
// Searching for empty oxfolder fields
if ($folder && $folder !== '-1') {
$query .= " and ( oxorder.oxfolder = " . $database->quote($folder) . " )";
} elseif (!$folder && is_array($folders)) {
$folderNames = array_keys($folders);
$query .= " and ( oxorder.oxfolder = " . $database->quote($folderNames[0]) . " )";
}

// glue oxordernr
if ($orderNrSearch) {
$oxOrderNr = $database->quoteIdentifier("oxorder.oxordernr");
$oxUnzerOrderNr = $database->quoteIdentifier("oxorder.oxunzerordernr");
$orderNrValue = $database->quote($orderNrSearch);
$query .= " and ({$oxOrderNr} like {$orderNrValue} or {$oxUnzerOrderNr} like {$orderNrValue}) ";
}

return $query;
}
}
1 change: 1 addition & 0 deletions src/Controller/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public function unzerExecuteAfterRedirect(): void
$nextStep = $this->_getNextStep($iSuccess);

$unzerService = $this->getServiceFromContainer(Unzer::class);
Registry::getSession()->setVariable('orderDisableSqlActiveSnippet', false);

if ('thankyou' === $nextStep) {
// commit transaction and proceeding to next view
Expand Down
6 changes: 0 additions & 6 deletions src/Controller/PaymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ public function getPaymentList()
continue;
}

$invAndDelAddrIdent = !Registry::getSession()->getVariable('blshowshipaddress');

if (
(
$payment->isUnzerPaymentHealthy()
Expand All @@ -77,10 +75,6 @@ public function getPaymentList()
(
empty($unzerDefinitions[$key]['countries']) ||
in_array($userCountryIso, $unzerDefinitions[$key]['countries'], true)
) &&
(
$key !== CoreUnzerDefinitions::INVOICE_UNZER_PAYMENT_ID ||
($key === CoreUnzerDefinitions::INVOICE_UNZER_PAYMENT_ID && $invAndDelAddrIdent)
)
) {
$paymentList[$key] = $payment;
Expand Down
129 changes: 129 additions & 0 deletions src/Model/DiscountList.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<?php

/**
* Copyright © OXID eSales AG. All rights reserved.
* See LICENSE file for license details.
*/

namespace OxidSolutionCatalysts\Unzer\Model;

use OxidEsales\Eshop\Application\Model\Article;
use OxidEsales\Eshop\Application\Model\Groups;
use OxidEsales\Eshop\Application\Model\User;
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Model\ListModel;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Application\Model\DiscountList as CoreDisCountList;

class DiscountList extends DiscountList_parent
{
/**
* Returns array of discounts that can be globally (transparently) applied
*
* @param Article $oArticle article object
* @param User $oUser oxuser object (optional)
*
* @return array
*/
public function getArticleDiscounts($oArticle, $oUser = null)
{
$aList = [];
$this->forceReload();
/** @var CoreDisCountList $oDiscList */
$oDiscList = $this->_getList($oUser);
$aDiscList = $oDiscList->getArray();
foreach ($aDiscList as $oDiscount) {
if ($oDiscount->isForArticle($oArticle)) {
$aList[$oDiscount->getId()] = $oDiscount;
}
}

return $aList;
}


/**
* Creates discount list filter SQL to load current state discount list
*
* @SuppressWarnings(PHPMD.StaticAccess)
*
* @inheritdoc
*/
protected function _getFilterSelect($oUser)
{
$oBaseObject = $this->getBaseObject();
$bDisableSqlActive = Registry::getSession()->getVariable('disableSqlActiveSnippet');
$sTable = $oBaseObject->getViewName();
$sSql = "select " . $oBaseObject->getSelectFields() . " from $sTable where 1 ";
$sSql .= false === $bDisableSqlActive ? $oBaseObject->getSqlActiveSnippet() . ' ' : '';

// defining initial filter parameters
$sUserId = null;
$sGroupIds = null;
$sCountryId = $this->getCountryId($oUser);
$oDb = DatabaseProvider::getDb();

// checking for current session user which gives additional restrictions for user itself,
// users group and country
if ($oUser) {
// user ID
$sUserId = $oUser->getId();

// user group ids
/** @var ListModel $userGroups */
$userGroups = $oUser->getUserGroups();
/** @var Groups $oGroup */
foreach ($userGroups as $oGroup) {
if ($sGroupIds) {
$sGroupIds .= ', ';
}
$sGroupIds .= $oDb->quote($oGroup->getId());
}
}

$sUserTable = getViewName('oxuser');
$sGroupTable = getViewName('oxgroups');
$sCountryTable = getViewName('oxcountry');

$sCountrySql = $sCountryId ?
"EXISTS(select oxobject2discount.oxid from oxobject2discount where
oxobject2discount.OXDISCOUNTID = $sTable.OXID and oxobject2discount.oxtype = 'oxcountry' and
oxobject2discount.OXOBJECTID = " . $oDb->quote($sCountryId) . ")" :
'0';
$sUserSql = $sUserId ?
"EXISTS(select oxo bject2discount.oxid from oxobject2discount where
oxobject2discount.OXDISCOUNTID = $sTable.OXID and oxobject2discount.oxtype = 'oxuser' and
oxobject2discount.OXOBJECTID = " . $oDb->quote($sUserId) . ")" :
'0';
$sGroupSql = $sGroupIds ?
"EXISTS(select oxobject2discount.oxid from oxobject2discount where
oxobject2discount.OXDISCOUNTID = $sTable.OXID and oxobject2discount.oxtype = 'oxgroups' and
oxobject2discount.OXOBJECTID in ($sGroupIds) )" :
'0';

$sSql .= "and (
if(EXISTS(select 1 from oxobject2discount, $sCountryTable where
$sCountryTable.oxid = oxobject2discount.oxobjectid and
oxobject2discount.OXDISCOUNTID = $sTable.OXID and
oxobject2discount.oxtype = 'oxcountry' LIMIT 1),
$sCountrySql,
1) &&
if(EXISTS(select 1 from oxobject2discount, $sUserTable where
$sUserTable.oxid = oxobject2discount.oxobjectid and
oxobject2discount.OXDISCOUNTID = $sTable.OXID and
oxobject2discount.oxtype = 'oxuser' LIMIT 1),
$sUserSql,
1) &&
if(EXISTS(select 1 from oxobject2discount, $sGroupTable where
$sGroupTable.oxid = oxobject2discount.oxobjectid and
oxobject2discount.OXDISCOUNTID = $sTable.OXID and
oxobject2discount.oxtype = 'oxgroups' LIMIT 1),
$sGroupSql,
1)
)";

$sSql .= " order by $sTable.oxsort ";

return $sSql;
}
}
6 changes: 5 additions & 1 deletion views/admin/de/oscunzer_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@
'OSCUNZER_CHARGE_COLLECT' => 'Einziehen',
'OSCUNZER_CHARGE_ID' => 'Charge-ID',
'OSCUNZER_CANCEL_ID' => 'Cancel-ID',
'OSCUNZER_BANK_HOLDER_DETAILS' => 'Bankdetails',
'OSCUNZER_BANK_HOLDER_DETAILS' => 'Bankinformationen',
'OSCUNZER_IBAN' => 'IBAN',
'OSCUNZER_BIC' => 'BIC',
'OSCUNZER_HOLDER' => 'Inhaber',
'OSCUNZER_DESCRIPTOR' => 'Beschreibung',
'OSCUNZER_AUTHORIZATION' => 'Autorisierung',
'OSCUNZER_NOSHIPINGYET' => 'Bestellung ist bei Unzer noch nicht als Versendet markiert',
'OSCUNZER_SHIPMENTS' => 'Auslieferungen',
Expand Down
4 changes: 4 additions & 0 deletions views/admin/en/oscunzer_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
'OSCUNZER_CHARGE_ID' => 'Charge-ID',
'OSCUNZER_CANCEL_ID' => 'Cancel-ID',
'OSCUNZER_BANK_HOLDER_DETAILS' => 'Bankdetails',
'OSCUNZER_IBAN' => 'IBAN',
'OSCUNZER_BIC' => 'BIC',
'OSCUNZER_HOLDER' => 'Holder',
'OSCUNZER_DESCRIPTOR' => 'Descriptor',
'OSCUNZER_AUTHORIZATION' => 'Authorization',
'OSCUNZER_NOSHIPINGYET' => 'order has not yet been marked as shipped',
'OSCUNZER_SHIPMENTS' => 'Shipments',
Expand Down
41 changes: 19 additions & 22 deletions views/admin/tpl/oscunzer_order.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -282,28 +282,25 @@
[{/if}]
[{/block}]
[{block name="unzer_holder"}]
[{if $holderData }]
<h3>[{oxmultilang ident="OSCUNZER_BANK_HOLDER_DETAILS"}]</h3>

<table style="width:50%">
<tbody>
<tr>
<td class="listheader">IBAN</td>
<td class="listheader">BIC</td>
<td class="listheader">Holder</td>
<td class="listheader">Descriptor</td>

</tr>
<tr>
<td>[{$holderData.iban}]</td>
<td>[{$holderData.bic}]</td>
<td>[{$holderData.holder}]</td>
<td>[{$holderData.descriptor}]</td>

</tr>
</tbody>
</table>
[{/if}]
[{if $holderData }]
<h3>[{oxmultilang ident="OSCUNZER_BANK_HOLDER_DETAILS"}]</h3>
<table style="width:50%">
<tbody>
<tr>
<td class="listheader">[{oxmultilang ident="OSCUNZER_IBAN"}]</td>
<td class="listheader">[{oxmultilang ident="OSCUNZER_BIC"}]</td>
<td class="listheader">[{oxmultilang ident="OSCUNZER_HOLDER"}]</td>
<td class="listheader">[{oxmultilang ident="OSCUNZER_DESCRIPTOR"}]</td>
</tr>
<tr>
<td>[{$holderData.iban}]</td>
<td>[{$holderData.bic}]</td>
<td>[{$holderData.holder}]</td>
<td>[{$holderData.descriptor}]</td>
</tr>
</tbody>
</table>
[{/if}]
[{/block}]
</div>
[{capture assign="cancelConfirm"}]
Expand Down
5 changes: 5 additions & 0 deletions views/frontend/tpl/order/unzer_card.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
</div>
</div>
</form>
<style>
.unzerUI.form .field.error .compact.error.message:not(:empty), .unzerUI.form .fields.error .field .compact.error.message:not(:empty){
line-height: 100%;
}
</style>
[{if false}]
<script>
Expand Down

0 comments on commit e1e751d

Please sign in to comment.