function uc_payment_uc_order_presave in Ubercart 8.4
Implements hook_uc_order_presave().
File
- payment/
uc_payment/ uc_payment.module, line 220 - Defines the payment API that lets payment modules interact with Ubercart.
Code
function uc_payment_uc_order_presave(OrderInterface $order) {
if ($order
->getPaymentMethodId()) {
\Drupal::service('plugin.manager.uc_payment.method')
->createFromOrder($order)
->orderSave($order);
}
// @todo Uncomment this if{} statement when Rules is working.
// Automatically move non-shippable orders from "payment received" to
// "completed" if Rules is not available.
//if (!\Drupal::moduleHandler()->moduleExists('rules')) {
if ($order
->getStatusId() == 'payment_received' && !$order
->isShippable()) {
$order
->setStatusId('completed');
}
//}
}