-
Notifications
You must be signed in to change notification settings - Fork 2
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
make Orderprocess more stable #194
Changes from all commits
2f2059b
78e48a1
6e69fe9
836a61e
c406b08
ad552ba
dedfc16
136914d
1884a7d
2b95a28
6d9beba
04308c9
981dfd4
f8a9aa1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,7 @@ | |
</ul>', | ||
], | ||
'thumbnail' => 'logo.svg', | ||
'version' => '1.1.2', | ||
'version' => '1.1.3-rc.1', | ||
'author' => 'OXID eSales AG', | ||
'url' => 'https://www.oxid-esales.com', | ||
'email' => '[email protected]', | ||
|
@@ -61,7 +61,6 @@ | |
\OxidEsales\Eshop\Core\Config::class => Config::class, | ||
\OxidEsales\Eshop\Application\Model\Payment::class => Payment::class, | ||
\OxidEsales\Eshop\Application\Controller\OrderController::class => OrderController::class, | ||
\OxidEsales\Eshop\Application\Model\PaymentGateway::class => PaymentGateway::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, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,13 +9,14 @@ | |
|
||
use OxidEsales\Eshop\Application\Model\Country; | ||
use OxidEsales\Eshop\Application\Model\Order; | ||
use OxidEsales\Eshop\Core\Exception\ArticleInputException; | ||
use OxidEsales\Eshop\Core\Exception\NoArticleException; | ||
use OxidEsales\Eshop\Core\Exception\OutOfStockException; | ||
use OxidEsales\Eshop\Core\DatabaseProvider; | ||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException; | ||
use OxidEsales\Eshop\Core\Registry; | ||
use OxidSolutionCatalysts\Unzer\Exception\Redirect; | ||
use OxidSolutionCatalysts\Unzer\Exception\RedirectWithMessage; | ||
use OxidSolutionCatalysts\Unzer\Model\Payment; | ||
use OxidSolutionCatalysts\Unzer\Service\ModuleSettings; | ||
use OxidSolutionCatalysts\Unzer\Service\Payment as PaymentService; | ||
use OxidSolutionCatalysts\Unzer\Service\ResponseHandler; | ||
use OxidSolutionCatalysts\Unzer\Service\Translator; | ||
use OxidSolutionCatalysts\Unzer\Service\Unzer; | ||
|
@@ -67,10 +68,6 @@ | |
*/ | ||
public function execute() | ||
{ | ||
if (!$this->isSepaConfirmed()) { | ||
return ''; | ||
} | ||
|
||
$ret = parent::execute(); | ||
|
||
if ($ret && str_starts_with($ret, 'thankyou')) { | ||
|
@@ -87,45 +84,52 @@ | |
$response->setData([ | ||
'redirectUrl' => $unzer->prepareRedirectUrl('thankyou') | ||
])->sendJson(); | ||
} elseif ($this->isSepaPayment()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. siehe oben: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s.o. |
||
/** @var \OxidSolutionCatalysts\Unzer\Model\Order $order */ | ||
$order = $this->getActualOrder(); | ||
$order->markUnzerOrderAsPaid(); | ||
} | ||
|
||
return $ret; | ||
} | ||
|
||
/** | ||
* @throws Redirect | ||
* @throws DatabaseErrorException | ||
* @SuppressWarnings(PHPMD.StaticAccess) | ||
* @SuppressWarnings(PHPMD.ElseExpression) | ||
*/ | ||
public function unzerExecuteAfterRedirect(): void | ||
{ | ||
// get basket contents | ||
$oUser = $this->getUser(); | ||
$oBasket = $this->getSession()->getBasket(); | ||
if ($oBasket->getProductsCount()) { | ||
try { | ||
/** @var \OxidSolutionCatalysts\Unzer\Model\Order $oOrder */ | ||
$oOrder = $this->getActualOrder(); | ||
$oDB = DatabaseProvider::getDb(); | ||
|
||
//finalizing ordering process (validating, storing order into DB, executing payment, setting status ...) | ||
$iSuccess = (int)$oOrder->finalizeUnzerOrderAfterRedirect($oBasket, $oUser); | ||
/** @var \OxidSolutionCatalysts\Unzer\Model\Order $oOrder */ | ||
$oOrder = $this->getActualOrder(); | ||
|
||
// performing special actions after user finishes order (assignment to special user groups) | ||
$oUser->onOrderExecute($oBasket, $iSuccess); | ||
$oDB->startTransaction(); | ||
|
||
$nextStep = $this->_getNextStep($iSuccess); | ||
//finalizing ordering process (validating, storing order into DB, executing payment, setting status ...) | ||
$iSuccess = (int)$oOrder->finalizeUnzerOrderAfterRedirect($oBasket, $oUser); | ||
|
||
// proceeding to next view | ||
$unzerService = $this->getServiceFromContainer(Unzer::class); | ||
// performing special actions after user finishes order (assignment to special user groups) | ||
$oUser->onOrderExecute($oBasket, $iSuccess); | ||
|
||
$nextStep = $this->_getNextStep($iSuccess); | ||
|
||
// commit transaction and proceeding to next view | ||
$unzerService = $this->getServiceFromContainer(Unzer::class); | ||
|
||
if ('thankyou' === $nextStep) { | ||
$oDB->commitTransaction(); | ||
throw new Redirect($unzerService->prepareRedirectUrl($nextStep)); | ||
} catch (OutOfStockException $oEx) { | ||
$oEx->setDestination('basket'); | ||
Registry::getUtilsView()->addErrorToDisplay($oEx, false, true, 'basket'); | ||
} catch (NoArticleException | ArticleInputException $oEx) { | ||
Registry::getUtilsView()->addErrorToDisplay($oEx); | ||
} | ||
|
||
$oDB->rollbackTransaction(); | ||
$translator = $this->getServiceFromContainer(Translator::class); | ||
throw new RedirectWithMessage( | ||
$unzerService->prepareRedirectUrl($nextStep), | ||
$translator->translate('OSCUNZER_ERROR_DURING_CHECKOUT') | ||
); | ||
} | ||
} | ||
|
||
|
@@ -247,4 +251,47 @@ | |
} | ||
return $this->companyTypes; | ||
} | ||
|
||
/** | ||
* execute Unzer defined via getExecuteFnc | ||
*/ | ||
public function executeoscunzer(): ?string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fände camel case lesbarer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm. Das ist eine Methode die als fnc gestartet wird. Im Core werden diese Methoden alle in "klein" geschrieben. Möglicherweise ist es egal. Ich habe mich hier an den Core gehalten. Könnte ich aber ausprobieren ... |
||
{ | ||
if (!$this->isSepaConfirmed()) { | ||
return null; | ||
} | ||
|
||
if (!$this->_validateTermsAndConditions()) { | ||
$this->_blConfirmAGBError = 1; | ||
Check failure on line 265 in src/Controller/OrderController.php GitHub Actions / styles (8.0)
|
||
return null; | ||
} | ||
|
||
$paymentService = $this->getServiceFromContainer(PaymentService::class); | ||
/** @var \OxidEsales\Eshop\Application\Model\Payment $payment */ | ||
$payment = $this->getPayment(); | ||
$paymentOk = $paymentService->executeUnzerPayment($payment); | ||
|
||
// all orders without redirect would be finalized now | ||
if ($paymentOk) { | ||
$this->unzerExecuteAfterRedirect(); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
/** | ||
* OXID-Core | ||
* @inheritDoc | ||
*/ | ||
public function getExecuteFnc() | ||
{ | ||
/** @var Payment $payment */ | ||
$payment = $this->getPayment(); | ||
if ( | ||
$payment->isUnzerPayment() | ||
) { | ||
return 'executeoscunzer'; | ||
} | ||
return parent::getExecuteFnc(); | ||
} | ||
} |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warum entfernst du diesen code, im ticket kann ich auf den ersten blick nicht über sepa finden
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alle Unzer-Bestellungen gehen über die neue "executeoscunzer". Da ist auch der SEPA-Check mit drin.
Einzig Apple-Pay nutzt aus meiner Sicht noch die "execute". Das kann ich leider nur nicht richtig testen ...