*/ protected function input_properties(): array { return array( 'country' => array( 'type' => 'string', 'description' => __( 'Two-letter country code, for example GB.', 'acrossai-abilities-manager' ) ), 'rate' => array( 'type' => 'string', 'description' => __( 'The percentage, for example 20 for twenty per cent.', 'acrossai-abilities-manager' ) ), 'state' => array( 'type' => 'string', 'description' => __( 'State or county code. Optional.', 'acrossai-abilities-manager' ) ), 'name' => array( 'type' => 'string', 'description' => __( 'Label shown at checkout, for example VAT.', 'acrossai-abilities-manager' ) ), 'class' => array( 'type' => 'string', 'description' => __( 'Tax class. Defaults to standard.', 'acrossai-abilities-manager' ) ), 'priority' => array( 'type' => 'integer', 'description' => __( 'Priority; only one rate per priority applies.', 'acrossai-abilities-manager' ) ), 'shipping' => array( 'type' => 'boolean', 'description' => __( 'Whether the rate also applies to shipping.', 'acrossai-abilities-manager' ) ), ); } /** * @since 0.0.34 * @return array */ protected function required_input(): array { return array( 'country', 'rate' ); } /** * @since 0.0.34 * @return array */ protected function output_properties(): array { return array( 'tax_rate_id' => array( 'type' => 'integer' ), 'taxes' => array( 'type' => 'object', 'additionalProperties' => true ), 'note' => array( 'type' => 'string' ), ); } /** * @since 0.0.34 * @return array */ protected function annotations(): array { return array( 'readonly' => false, 'destructive' => false, 'idempotent' => false, ); } /** * @since 0.0.34 * @return bool */ protected function requires_confirmation(): bool { return true; } /** * @since 0.0.34 * @return string */ protected function confirmation_message(): string { return __( 'A tax rate changes what customers are charged at checkout. Confirm that this rate is correct for the business before adding it.', 'acrossai-abilities-manager' ); } /** * @since 0.0.34 * @param array $input Input. * @return array|WP_Error */ protected function run( array $input ) { return Config_Repository::add_tax_rate( $input ); } }