#[Route(path: '/api/_action/promotion/codes/generate-fixed', name: 'api.action.promotion.codes.generate-fixed', methods: ['GET'], defaults: ['_acl' => ['promotion.editor']])]
public function generateFixedCode(): Response
{ return new JsonResponse($this->codeService->
getFixedCode());
} #[Route(path: '/api/_action/promotion/codes/generate-individual', name: 'api.action.promotion.codes.generate-individual', methods: ['GET'], defaults: ['_acl' => ['promotion.editor']])]
public function generateIndividualCodes(Request
$request): Response
{ $codePattern =
(string) $request->query->
get('codePattern'
);
if ($codePattern === ''
) { throw RoutingException::
missingRequestParameter('codePattern'
);
} $amount =
$request->query->
getInt('amount'
);
return new JsonResponse($this->codeService->
generateIndividualCodes($codePattern,
$amount));
} #[Route(path: '/api/_action/promotion/codes/replace-individual', name: 'api.action.promotion.codes.replace-individual', methods: ['PATCH'], defaults: ['_acl' => ['promotion.editor']])]
public function replaceIndividualCodes(Request
$request, Context
$context): Response
{ $promotionId =
(string) $request->request->
get('promotionId'
);
$codePattern =
(string) $request->request->
get('codePattern'
);