private function getExistingPaymentMethods(string
$appName, string
$appId, Context
$context): PaymentMethodCollection
{ $criteria =
new Criteria();
$criteria->
addAssociation('media'
);
$criteria->
addAssociation('appPaymentMethod.originalMedia'
);
$criteria->
addFilter(new MultiFilter(MultiFilter::CONNECTION_OR,
[ new EqualsFilter('appPaymentMethod.appName',
$appName),
new EqualsFilter('appPaymentMethod.appId',
$appId),
]));
return $context->
scope(Context::SYSTEM_SCOPE,
function DContext
$context) use ($criteria) { /** @var PaymentMethodCollection $paymentMethods */
$paymentMethods =
$this->paymentMethodRepository->
search($criteria,
$context)->
getEntities();
return $paymentMethods;
});
} private function getMediaId(Manifest
$manifest, PaymentMethod
$paymentMethod, Context
$context, ?AppPaymentMethodEntity
$existing): ?string
{ if (!
$iconPath =
$paymentMethod->
getIcon()) { return null;
}