->
addFilter(new EqualsFilter('active', true
)) ->
addFilter(new EqualsFilter('availabilityRuleId', null
));
if ($salesChannelId) { $criteria->
addFilter(new EqualsFilter('salesChannels.id',
$salesChannelId));
} /** @var PaymentMethodEntity|null $paymentMethod */
$paymentMethod =
$repository->
search($criteria, Context::
createDefaultContext())->
getEntities()->
first();
if ($paymentMethod === null
) { throw new \
LogicException('No available Payment method configured'
);
} return $paymentMethod;
} protected function getValidShippingMethodId(?string
$salesChannelId = null
): string
{ /** @var EntityRepository $repository */
$repository =
$this->
getContainer()->
get('shipping_method.repository'
);
$criteria =
(new Criteria())