// just used a global one or anything else, so just quit in this case.
if (!
($individualCode instanceof PromotionIndividualCodeEntity
)) { return;
} /** @var OrderCustomerEntity $customer */
$customer =
$event->
getOrder()->
getOrderCustomer();
// set the code to be redeemed
// and assign all required meta data
// for later needs
$individualCode->
setRedeemed( $item->
getOrderId(),
$customer->
getCustomerId() ?? '',
$customer->
getFirstName() . ' ' .
$customer->
getLastName() );
// save in database
$this->codesRepository->
update( [ [ 'id' =>
$individualCode->
getId(),
'payload' =>
$individualCode->
getPayload(),
],