BitBagCommerce /
SyliusMolliePlugin
| 1 | <?php |
||
| 2 | |||
| 3 | /* |
||
| 4 | * This file has been created by developers from BitBag. |
||
| 5 | * Feel free to contact us once you face any issues or want to start |
||
| 6 | * You can find more information about us on https://bitbag.io and write us |
||
| 7 | * an email on [email protected]. |
||
| 8 | */ |
||
| 9 | |||
| 10 | declare(strict_types=1); |
||
| 11 | |||
| 12 | namespace BitBag\SyliusMolliePlugin\Resolver; |
||
| 13 | |||
| 14 | use BitBag\SyliusMolliePlugin\Entity\MollieGatewayConfigInterface; |
||
| 15 | use Sylius\Component\Resource\Repository\RepositoryInterface; |
||
| 16 | use Webmozart\Assert\Assert; |
||
| 17 | |||
| 18 | final class PaymentMethodConfigResolver implements PaymentMethodConfigResolverInterface |
||
| 19 | { |
||
| 20 | /** @var RepositoryInterface */ |
||
| 21 | private $mollieMethodRepository; |
||
| 22 | |||
| 23 | public function __construct(RepositoryInterface $mollieMethodRepository) |
||
| 24 | { |
||
| 25 | $this->mollieMethodRepository = $mollieMethodRepository; |
||
| 26 | } |
||
| 27 | |||
| 28 | public function getConfigFromMethodId(string $methodId): MollieGatewayConfigInterface |
||
| 29 | { |
||
| 30 | $paymentMethod = $this->mollieMethodRepository->findOneBy(['methodId' => $methodId]); |
||
| 31 | |||
| 32 | Assert::notNull($paymentMethod, sprintf('Cannot find payment method config with method id %s', $methodId)); |
||
| 33 | |||
| 34 | return $paymentMethod; |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 35 | } |
||
| 36 | } |
||
| 37 |