1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
<?php
class DFW_Manage_Order_Items {
public static function dfw_is_deposit( $item ) {
return 'line_item' === $item['type'] && ! empty( $item['has_deposit'] );
}
public static function dfw_get_payment_plan( $item ) {
$payment_plan = ! empty( $item['payment_plan'] ) ? absint( $item['payment_plan'] ) : 0;
return $payment_plan ? DFW_Manage_Plans::get_plan( $payment_plan ) : false;
}
public static function dfw_check_fully_paid( $item, $parent = NULL ) {
$remaining_balance_order_id = ! empty( $item['remaining_balance_order_id'] ) ? absint( $item['remaining_balance_order_id'] ) : 0;
$remaining_balance_paid = ! empty( $item['remaining_balance_paid'] );
$payment_plan = ! empty( $item['payment_plan'] ) ? absint( $item['payment_plan'] ) : 0;
if( $remaining_balance_order_id ) {
$remaining_balance_order = wc_get_order( $remaining_balance_order_id );
return $remaining_balance_order->has_status( array( 'processing', 'completed' ) );
} else {
return $remaining_balance_paid;
}
}
}