Skip to content

Commit

Permalink
Merge pull request #322 from OXID-eSales/TakeOver_StornoInsteadDelete
Browse files Browse the repository at this point in the history
automatic cancel orders instead of delete
  • Loading branch information
mariolorenz authored Aug 16, 2024
2 parents 17bcd49 + 8d273ea commit fa2d214
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 22 deletions.
6 changes: 2 additions & 4 deletions src/Service/OrderRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ public function cleanUpNotFinishedOrders()
and oxtransstatus = :oxtransstatus
and oxpaymenttype LIKE :oxpaymenttype
and oxshopid = :oxshopid
and oxorderdate < now() - interval :sessiontime MINUTE";
and oxorderdate + interval :sessiontime MINUTE > now()";

/** @var \OxidEsales\Eshop\Core\Database\Adapter\Doctrine\ResultSet $result */
$result = $this->db->select($query, [
':oxordernr' => '0',
':oxtransstatus' => 'NOT_FINISHED',
':oxpaymenttype' => '%oscpaypal%',
':oxshopid' => $shopId,
Expand All @@ -150,8 +150,6 @@ public function cleanUpNotFinishedOrders()
if ($order->load($id)) {
// storno
$order->cancelOrder();
// delete
$order->delete();
}
$result->fetchRow();
}
Expand Down
17 changes: 10 additions & 7 deletions src/Service/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,13 +439,16 @@ public function removeTemporaryOrder()
$orderModel = oxNew(EshopModelOrder::class);
$orderModel->load($sessionOrderId);

if ($orderModel->isLoaded()) {
if ($orderModel->hasOrderNumber()) {
$logger = new PayPalLogger();
$logger->info('Cannot delete valid order with id ' . $sessionOrderId);
} else {
$orderModel->delete();
}
if (
$orderModel->isLoaded() &&
!$orderModel->hasOrderNumber()
) {
$orderModel->delete();
$logger = new PayPalLogger();
$logger->info(sprintf(
'Temporary order without Order number and with id %s was deleted',
$sessionOrderId
));
}

PayPalSession::unsetPayPalOrderId();
Expand Down
12 changes: 6 additions & 6 deletions views/admin/de/admin_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,13 @@
Die Einstellung "3D Secure Abfrage für jede ACDC Transaktion" erzwingt die 3D Prüfung für jede ACDC Transaktion.',

'OSC_PAYPAL_HANDLING_NOT_FINISHED_ORDERS_TITLE' => 'Behandlung nicht beendeter Bestellungen',
'OSC_PAYPAL_HANDLING_NOT_FINISHED_ORDERS' => 'Nicht beendete Bestellungen automatisch löschen?',
'OSC_PAYPAL_HANDLING_NOT_FINISHED_ORDERS' => 'Nicht beendete Bestellungen automatisch stornieren?',
'HELP_OSC_PAYPAL_HANDLING_NOT_FINISHED_ORDERS' => 'Bei einigen PayPal-Zahlungsarten muss frühzeitig eine Bestellung angelegt werden, damit sie mit PayPal verwendet werden kann.
Es kann passieren, das Kunden während des Bezahlvorgangs den Prozess abbrechen und nicht wieder in den Shop zurück kehren. In dem Fall bleiben
nicht beendete Bestellungen übrig, die automatisch gelöscht werden können. Sie können alternaitv diese Bestellungen gern selbst kontrollieren und
händisch löschen.',
'OSC_PAYPAL_STARTTIME_CLEANUP_ORDERS' => 'Startzeit für automatisches Löschen',
'HELP_OSC_PAYPAL_STARTTIME_CLEANUP_ORDERS' => 'Wie alt müssen nicht beendete Bestellungen sein, damit sie frühestens automatisch gelöscht werden (in Minuten)?',
Es kann passieren, dass Kunden während des Bezahlvorgangs den Prozess abbrechen und nicht wieder in den Shop zurück kehren. In dem Fall bleiben
nicht beendete Bestellungen übrig, die automatisch storniert werden können. Sie können alternaitv diese Bestellungen gern selbst kontrollieren und
händisch stornieren.',
'OSC_PAYPAL_STARTTIME_CLEANUP_ORDERS' => 'Startzeit für automatisches Stornieren',
'HELP_OSC_PAYPAL_STARTTIME_CLEANUP_ORDERS' => 'Wie alt müssen nicht beendete Bestellungen sein, damit sie frühestens automatisch storniert werden (in Minuten)?',

'OSC_PAYPAL_ORDER_MAIN_TRACKCARRIER_COUNTRY' => 'Versanddienstleister (Land)',
'OSC_PAYPAL_ORDER_MAIN_TRACKCARRIER_PROVIDER' => 'Versanddienstleister (Anbieter)',
Expand Down
10 changes: 5 additions & 5 deletions views/admin/en/admin_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,13 @@
With setting "3D Secure for each ACDC transaction" 3D check will be enforced for each transaction.',

'OSC_PAYPAL_HANDLING_NOT_FINISHED_ORDERS_TITLE' => 'Handling not finished orders',
'OSC_PAYPAL_HANDLING_NOT_FINISHED_ORDERS' => 'Automatically delete not finished orders?',
'OSC_PAYPAL_HANDLING_NOT_FINISHED_ORDERS' => 'Automatically cancel not finished orders?',
'HELP_OSC_PAYPAL_HANDLING_NOT_FINISHED_ORDERS' => 'For some PayPal payment methods, an order must be created in advance so that it can be used with PayPal.
It can happen that customers cancel the process during the payment process and do not return to the shop. In that case stay
unfinished orders left that can be automatically deleted. Alternatively, you are welcome to check these orders yourself
delete manually.',
'OSC_PAYPAL_STARTTIME_CLEANUP_ORDERS' => 'Start time for automatic deletion',
'HELP_OSC_PAYPAL_STARTTIME_CLEANUP_ORDERS' => 'How old do not finished orders have to be before they are automatically deleted (in minutes)?',
unfinished orders left that can be automatically canceled. Alternatively, you are welcome to check these orders yourself
cancel manually.',
'OSC_PAYPAL_STARTTIME_CLEANUP_ORDERS' => 'Start time for automatic cancellation',
'HELP_OSC_PAYPAL_STARTTIME_CLEANUP_ORDERS' => 'How old do not finished orders have to be before they are automatically canceled (in minutes)?',

'OSC_PAYPAL_ORDER_MAIN_TRACKCARRIER_COUNTRY' => 'Tracking Carrier (Country)',
'OSC_PAYPAL_ORDER_MAIN_TRACKCARRIER_PROVIDER' => 'Tracking Carrier (Provider)',
Expand Down

0 comments on commit fa2d214

Please sign in to comment.