-
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the
PaymentMethodSelected
checkout event
- Loading branch information
1 parent
4fa1512
commit b0734ce
Showing
4 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
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
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,41 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Contains the PaymentMethodSelected event class. | ||
* | ||
* @copyright Copyright (c) 2024 Vanilo UG | ||
* @author Attila Fulop | ||
* @license MIT | ||
* @since 2024-11-11 | ||
* | ||
*/ | ||
|
||
namespace Vanilo\Checkout\Events; | ||
|
||
use Vanilo\Checkout\Contracts\Checkout; | ||
|
||
class PaymentMethodSelected extends BaseCheckoutEvent | ||
{ | ||
protected null|int|string $oldPaymentMethodId; | ||
|
||
protected null|int|string $newPaymentMethodId; | ||
|
||
public function __construct(Checkout $checkout, null|int|string $oldPaymentMethodId) | ||
{ | ||
parent::__construct($checkout); | ||
$this->oldPaymentMethodId = $oldPaymentMethodId; | ||
$this->newPaymentMethodId = $checkout->getPaymentMethodId(); | ||
} | ||
|
||
public function selectedPaymentMethodId(): null|int|string | ||
{ | ||
return $this->newPaymentMethodId; | ||
} | ||
|
||
public function oldPaymentMethodId(): null|int|string | ||
{ | ||
return $this->oldPaymentMethodId; | ||
} | ||
} |