Skip to content

Commit

Permalink
PosFactory - throw error if wrong gateway class is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
nuryagdym committed May 17, 2024
1 parent cb04d26 commit cf4b2ae
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Factory/PosFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ public static function createPosGateway(
throw new BankClassNullException();
}

if (!\in_array(PosInterface::class, \class_implements($class), true)) {
throw new \InvalidArgumentException(
\sprintf('gateway class must be implementation of %s', PosInterface::class)
);
}

$currencies = [];
if (isset($config['currencies'])) {
$currencies = $config['currencies'];
Expand Down

0 comments on commit cf4b2ae

Please sign in to comment.