You are here

public function Other::orderSave in Ubercart 8.4

Called when an order is being saved with this payment method.

Parameters

\Drupal\uc_order\OrderInterface $order: The order that is being saved.

Overrides PaymentMethodPluginBase::orderSave

File

payment/uc_payment_pack/src/Plugin/Ubercart/PaymentMethod/Other.php, line 61

Class

Other
Defines a generic payment method.

Namespace

Drupal\uc_payment_pack\Plugin\Ubercart\PaymentMethod

Code

public function orderSave(OrderInterface $order) {
  if (empty($order->payment_details['description'])) {
    $this->database
      ->delete('uc_payment_other')
      ->condition('order_id', $order
      ->id())
      ->execute();
  }
  else {
    $this->database
      ->merge('uc_payment_other')
      ->key([
      'order_id' => $order
        ->id(),
    ])
      ->fields([
      'description' => $order->payment_details['description'],
    ])
      ->execute();
  }
}