PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 All 49 releases
← All changes | app/Modules/MCP/Tools/TransactionTools.php +6 -2 1.5.3 → 1.6.5 View file →
@@ -255,10 +255,14 @@
255 255 }
256 256
257 257 return [
258 258 'matching_count' => $count,
259 - 'by_type' => self::countBy((clone $query), 'transaction_type'),
260 - 'by_status' => self::countBy((clone $query), 'status'),
259 + // Cast to object: the output_schema types these as 'object', but a
260 + // dynamically-built PHP map is an empty array [] when nothing matches,
261 + // which json_encodes to [] and fails structured-output validation.
262 + // (object) forces {} when empty and a JSON object otherwise.
263 + 'by_type' => (object) self::countBy((clone $query), 'transaction_type'),
264 + 'by_status' => (object) self::countBy((clone $query), 'status'),
261 265 'amount_by_currency' => $amountByCurrency,
262 266 'note' => 'amount_by_currency sums transaction total within each currency; charges and refunds are both stored as positive amounts, so filter by type for a single-sided figure.',
263 267 ];
264 268 }