Skip to content

Commit

Permalink
PosInterface added getSupportedPaymentModels()
Browse files Browse the repository at this point in the history
  • Loading branch information
nuryagdym committed Oct 17, 2023
1 parent 22fe724 commit 213c4a2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Gateways/AbstractGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -444,4 +444,26 @@ public static function isSupportedTransaction(string $txType, string $paymentMod

return in_array($paymentModel, static::$supportedTransactions[$txType], true);
}

/**
* @inheritDoc
*/
public static function getSupportedPaymentModels(): array
{
if (!isset(static::$supportedTransactions[PosInterface::TX_PAY])) {
return [];
}

if (is_bool(static::$supportedTransactions[PosInterface::TX_PAY])) {
return [
PosInterface::MODEL_NON_SECURE,
PosInterface::MODEL_3D_SECURE,
PosInterface::MODEL_3D_HOST,
PosInterface::MODEL_3D_PAY,
PosInterface::MODEL_3D_PAY_HOSTING,
];
}

return static::$supportedTransactions[PosInterface::TX_PAY];
}
}
5 changes: 5 additions & 0 deletions src/PosInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,4 +247,9 @@ public function getAccount(): AbstractPosAccount;
* @return bool
*/
public static function isSupportedTransaction(string $txType, string $paymentModel): bool;

/**
* @return array<int, PosInterface::MODEL_*>
*/
public static function getSupportedPaymentModels(): array;
}

0 comments on commit 213c4a2

Please sign in to comment.