Loading modules/order/src/Entity/Order.php +7 Changes for modules/order/src/Entity/Order.php: 7 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -305,6 +305,13 @@ class Order extends ContentEntityBase implements OrderInterface { return $this; } /** * {@inheritdoc} */ public function getTotalPrice() { return $this->get('total_price')->first()->toPrice(); } /** * {@inheritdoc} */ Loading modules/order/src/Entity/OrderInterface.php +8 Changes for modules/order/src/Entity/OrderInterface.php: 8 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -161,6 +161,14 @@ interface OrderInterface extends AdjustableInterface, ContentEntityInterface, En */ public function hasLineItem(LineItemInterface $line_item); /** * Gets the total price. * * @return \Drupal\commerce_price\Price * The total price. */ public function getTotalPrice(); /** * Gets the order state. * Loading modules/payment/src/PluginForm/PaymentAddForm.php +2 −4 Changes for modules/payment/src/PluginForm/PaymentAddForm.php: 2 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -17,14 +17,12 @@ class PaymentAddForm extends PaymentGatewayFormBase { if (!$order) { throw new \InvalidArgumentException('Payment entity with no order reference given to PaymentAddForm.'); } // @todo The order needs a getter for total_price. // @todo Implement a balance method (unpaid portion of the total). $order_total = $order->get('total_price')->first()->toPrice(); // @todo Implement a balance method (unpaid portion of the total). $form['amount'] = [ '#type' => 'commerce_price', '#title' => t('Amount'), '#default_value' => $order_total, '#default_value' => $order->getTotalPrice(), '#required' => TRUE, ]; $form['transaction_type'] = [ Loading Loading
modules/order/src/Entity/Order.php +7 Changes for modules/order/src/Entity/Order.php: 7 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -305,6 +305,13 @@ class Order extends ContentEntityBase implements OrderInterface { return $this; } /** * {@inheritdoc} */ public function getTotalPrice() { return $this->get('total_price')->first()->toPrice(); } /** * {@inheritdoc} */ Loading
modules/order/src/Entity/OrderInterface.php +8 Changes for modules/order/src/Entity/OrderInterface.php: 8 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -161,6 +161,14 @@ interface OrderInterface extends AdjustableInterface, ContentEntityInterface, En */ public function hasLineItem(LineItemInterface $line_item); /** * Gets the total price. * * @return \Drupal\commerce_price\Price * The total price. */ public function getTotalPrice(); /** * Gets the order state. * Loading
modules/payment/src/PluginForm/PaymentAddForm.php +2 −4 Changes for modules/payment/src/PluginForm/PaymentAddForm.php: 2 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -17,14 +17,12 @@ class PaymentAddForm extends PaymentGatewayFormBase { if (!$order) { throw new \InvalidArgumentException('Payment entity with no order reference given to PaymentAddForm.'); } // @todo The order needs a getter for total_price. // @todo Implement a balance method (unpaid portion of the total). $order_total = $order->get('total_price')->first()->toPrice(); // @todo Implement a balance method (unpaid portion of the total). $form['amount'] = [ '#type' => 'commerce_price', '#title' => t('Amount'), '#default_value' => $order_total, '#default_value' => $order->getTotalPrice(), '#required' => TRUE, ]; $form['transaction_type'] = [ Loading