[2.5] Round refund values.

Fixes #10456.
This commit is contained in:
Mike Jolley 2016-03-03 13:40:50 +00:00
parent 89e8404acb
commit 03872e953b
1 changed files with 2 additions and 2 deletions

View File

@ -2175,7 +2175,7 @@ class WC_AJAX {
}
$order_id = absint( $_POST['order_id'] );
$refund_amount = wc_format_decimal( sanitize_text_field( $_POST['refund_amount'] ) );
$refund_amount = wc_format_decimal( sanitize_text_field( $_POST['refund_amount'] ), wc_get_price_decimals() );
$refund_reason = sanitize_text_field( $_POST['refund_reason'] );
$line_item_qtys = json_decode( sanitize_text_field( stripslashes( $_POST['line_item_qtys'] ) ), true );
$line_item_totals = json_decode( sanitize_text_field( stripslashes( $_POST['line_item_totals'] ) ), true );
@ -2189,7 +2189,7 @@ class WC_AJAX {
// Validate that the refund can occur
$order = wc_get_order( $order_id );
$order_items = $order->get_items();
$max_refund = wc_format_decimal( $order->get_total() - $order->get_total_refunded() );
$max_refund = wc_format_decimal( $order->get_total() - $order->get_total_refunded(), wc_get_price_decimals() );
if ( ! $refund_amount || $max_refund < $refund_amount || 0 > $refund_amount ) {
throw new exception( __( 'Invalid refund amount', 'woocommerce' ) );