Properly sanitize and format "dp"
This commit is contained in:
parent
c6c8af9187
commit
5daf476dfa
|
@ -182,7 +182,7 @@ class WC_REST_Order_Refunds_Controller extends WC_REST_Orders_Controller {
|
|||
*/
|
||||
public function prepare_object_for_response( $object, $request ) {
|
||||
$this->request = $request;
|
||||
$this->request['dp'] = is_null( $this->request['dp'] ) ? wc_get_price_decimals() : $this->request['dp'];
|
||||
$this->request['dp'] = is_null( $this->request['dp'] ) ? wc_get_price_decimals() : absint( $this->request['dp'] );
|
||||
$order = wc_get_order( (int) $request['order_id'] );
|
||||
|
||||
if ( ! $order ) {
|
||||
|
|
|
@ -282,7 +282,7 @@ class WC_REST_Orders_Controller extends WC_REST_Legacy_Orders_Controller {
|
|||
*/
|
||||
public function prepare_object_for_response( $object, $request ) {
|
||||
$this->request = $request;
|
||||
$this->request['dp'] = is_null( $this->request['dp'] ) ? wc_get_price_decimals() : $this->request['dp'];
|
||||
$this->request['dp'] = is_null( $this->request['dp'] ) ? wc_get_price_decimals() : absint( $this->request['dp'] );
|
||||
$data = $this->get_formatted_item_data( $object );
|
||||
$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
|
||||
$data = $this->add_additional_fields_to_object( $data, $request );
|
||||
|
|
|
@ -99,7 +99,7 @@ class WC_REST_Legacy_Orders_Controller extends WC_REST_CRUD_Controller {
|
|||
*/
|
||||
public function prepare_item_for_response( $post, $request ) {
|
||||
$this->request = $request;
|
||||
$this->request['dp'] = is_null( $this->request['dp'] ) ? wc_get_price_decimals() : $this->request['dp'];
|
||||
$this->request['dp'] = is_null( $this->request['dp'] ) ? wc_get_price_decimals() : absint( $this->request['dp'] );
|
||||
$statuses = wc_get_order_statuses();
|
||||
$order = wc_get_order( $post );
|
||||
$data = array_merge( array( 'id' => $order->get_id() ), $order->get_data() );
|
||||
|
|
|
@ -133,7 +133,7 @@ class WC_REST_Order_Refunds_V1_Controller extends WC_REST_Orders_V1_Controller {
|
|||
return new WP_Error( 'woocommerce_rest_invalid_order_refund_id', __( 'Invalid order refund ID.', 'woocommerce' ), 404 );
|
||||
}
|
||||
|
||||
$dp = is_null( $request['dp'] ) ? wc_get_price_decimals() : $request['dp'];
|
||||
$dp = is_null( $request['dp'] ) ? wc_get_price_decimals() : absint( $request['dp'] );
|
||||
|
||||
$data = array(
|
||||
'id' => $refund->get_id(),
|
||||
|
|
|
@ -126,7 +126,7 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller {
|
|||
*/
|
||||
public function prepare_item_for_response( $post, $request ) {
|
||||
$order = wc_get_order( $post );
|
||||
$dp = is_null( $request['dp'] ) ? wc_get_price_decimals() : $request['dp'];
|
||||
$dp = is_null( $request['dp'] ) ? wc_get_price_decimals() : absint( $request['dp'] );
|
||||
|
||||
$data = array(
|
||||
'id' => $order->get_id(),
|
||||
|
|
Loading…
Reference in New Issue