Automattic\WooCommerce\Internal\RestApi\Routes\V4\Refunds

DataUtils::convert_proportional_taxes_to_schema_formatprivateWC 1.0

Convert calculated taxes (internal format) to schema format.

Method of the class: DataUtils{}

No Hooks.

Returns

Array. Schema format with id and refund_total keys.

Usage

// private - for code of main (parent) class only
$result = $this->convert_proportional_taxes_to_schema_format( $calculated_taxes ): array;
$calculated_taxes(array) (required)
Taxes keyed by tax ID with amounts.

DataUtils::convert_proportional_taxes_to_schema_format() code WC 10.9.4

private function convert_proportional_taxes_to_schema_format( array $calculated_taxes ): array {
	$result = array();
	foreach ( $calculated_taxes as $tax_id => $amount ) {
		$result[] = array(
			'id'           => (int) $tax_id,
			'refund_total' => $amount,
		);
	}
	return $result;
}