feat(weeztix): only list coupons with status enabled in admin
Made-with: Cursor
This commit is contained in:
@@ -68,6 +68,9 @@ class WeeztixApiController extends Controller
|
|||||||
if (! is_array($row)) {
|
if (! is_array($row)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (! $this->couponRowHasEnabledStatus($row)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$guid = data_get($row, 'guid') ?? data_get($row, 'id');
|
$guid = data_get($row, 'guid') ?? data_get($row, 'id');
|
||||||
if (! is_string($guid) || $guid === '') {
|
if (! is_string($guid) || $guid === '') {
|
||||||
continue;
|
continue;
|
||||||
@@ -81,4 +84,16 @@ class WeeztixApiController extends Controller
|
|||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Weeztix coupon list items expose a string status; only "enabled" should appear in the admin picker.
|
||||||
|
*
|
||||||
|
* @param array<string, mixed> $row
|
||||||
|
*/
|
||||||
|
private function couponRowHasEnabledStatus(array $row): bool
|
||||||
|
{
|
||||||
|
$status = data_get($row, 'status');
|
||||||
|
|
||||||
|
return is_string($status) && strcasecmp(trim($status), 'enabled') === 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user