-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Store Payment details directly in notify action without any async mes…
…sage
- Loading branch information
Showing
13 changed files
with
157 additions
and
176 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Webgriffe\SyliusKlarnaPlugin\Helper; | ||
|
||
use Webgriffe\SyliusKlarnaPlugin\Model\PaymentDetails; | ||
use Webmozart\Assert\Assert; | ||
use Webmozart\Assert\InvalidArgumentException; | ||
|
||
/** | ||
* @psalm-import-type StoredPaymentDetails from PaymentDetails | ||
*/ | ||
final class PaymentDetailsHelper | ||
{ | ||
/** | ||
* @phpstan-assert-if-true StoredPaymentDetails $storedPaymentDetails | ||
*/ | ||
public static function areValid(array $storedPaymentDetails): bool | ||
{ | ||
try { | ||
self::assertStoredPaymentDetailsAreValid($storedPaymentDetails); | ||
} catch (InvalidArgumentException) { | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
/** | ||
* @TODO Da fare ancora | ||
* | ||
* @phpstan-assert StoredPaymentDetails $storedPaymentDetails | ||
* | ||
* @throws InvalidArgumentException | ||
*/ | ||
public static function assertStoredPaymentDetailsAreValid(array $storedPaymentDetails): void | ||
{ | ||
Assert::keyExists($storedPaymentDetails, PaymentDetails::PAYMENT_SESSION_ID_KEY); | ||
Assert::stringNotEmpty($storedPaymentDetails[PaymentDetails::PAYMENT_SESSION_ID_KEY]); | ||
Assert::keyExists($storedPaymentDetails, PaymentDetails::PAYMENT_CLIENT_TOKEN_KEY); | ||
Assert::stringNotEmpty($storedPaymentDetails[PaymentDetails::PAYMENT_CLIENT_TOKEN_KEY]); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.