Пример #1
0
 /**
  * @param Order $order
  * @return OrderTransaction|null
  */
 public static function createForOrder(Order $order)
 {
     $order->calculate();
     $model = new static();
     $model->order_id = $order->id;
     $model->payment_type_id = $order->payment_type_id;
     $model->status = static::TRANSACTION_START;
     $model->total_sum = $order->total_price;
     return $model->save() ? $model : null;
 }