$fileName =
sprintf('payment_app_%s_%s',
$manifest->
getMetadata()->
getName(),
$paymentMethod->
getIdentifier());
$extension =
pathinfo($paymentMethod->
getIcon() ?? '', \PATHINFO_EXTENSION
);
$mimeType =
$this->mimeDetector->
detectMimeTypeFromBuffer($icon);
$mediaId =
$existing !== null ?
$existing->
getOriginalMediaId() : null;
if (!
$mimeType) { return null;
} return $this->mediaService->
saveFile( $icon,
$extension,
$mimeType,
$fileName,
$context,
PaymentMethodDefinition::ENTITY_NAME,
$mediaId,
false
);
}}