mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Refactor code style
This commit is contained in:
parent
ec22aad35b
commit
ccb528ba2a
1 changed files with 5 additions and 11 deletions
|
@ -124,22 +124,16 @@ class ItemFactory {
|
|||
* @return Item
|
||||
*/
|
||||
private function from_wc_order_line_item( \WC_Order_Item_Product $item, \WC_Order $order ): Item {
|
||||
$currency = $order->get_currency();
|
||||
$product = $item->get_product();
|
||||
$shipping_tax = round( (float) $order->get_shipping_tax(), 2 );
|
||||
|
||||
/**
|
||||
* The WooCommerce product.
|
||||
*
|
||||
* @var \WC_Product $product
|
||||
*/
|
||||
$quantity = (int) $item->get_quantity();
|
||||
|
||||
$currency = $order->get_currency();
|
||||
$product = $item->get_product();
|
||||
$shipping_tax = round( (float) $order->get_shipping_tax(), 2 );
|
||||
$quantity = (int) $item->get_quantity();
|
||||
$price = (float) $order->get_item_subtotal( $item, true );
|
||||
$price_without_tax = (float) $order->get_item_subtotal( $item, false );
|
||||
$price_without_tax_rounded = round( $price_without_tax, 2 );
|
||||
$tax = round( $price - $price_without_tax_rounded, 2 );
|
||||
$tax = new Money( $tax + $shipping_tax, $currency );
|
||||
|
||||
return new Item(
|
||||
mb_substr( $product->get_name(), 0, 127 ),
|
||||
new Money( $price_without_tax_rounded, $currency ),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue