-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the
transactionHandler()
method to the Payment gateway interface
- Added experimental Transaction-related interfaces
- Loading branch information
1 parent
747219e
commit 4807022
Showing
10 changed files
with
147 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Contains the PaymentAware interface. | ||
* | ||
* @copyright Copyright (c) 2024 Vanilo UG | ||
* @author Attila Fulop | ||
* @license MIT | ||
* @since 2024-04-24 | ||
* | ||
*/ | ||
|
||
namespace Vanilo\Payment\Contracts; | ||
|
||
/** | ||
* @experimental | ||
*/ | ||
interface PaymentAware | ||
{ | ||
public function getPaymentId(): string; | ||
|
||
public function getPayment(): Payment; | ||
} |
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,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Contains the Transaction interface. | ||
* | ||
* @copyright Copyright (c) 2024 Vanilo UG | ||
* @author Attila Fulop | ||
* @license MIT | ||
* @since 2024-04-24 | ||
* | ||
*/ | ||
|
||
namespace Vanilo\Payment\Contracts; | ||
|
||
use StringBackedEnum; | ||
|
||
/** | ||
* @experimental is subject to change. don't use it yet! | ||
*/ | ||
interface Transaction extends PaymentAware | ||
{ | ||
public function wasSuccessful(): bool; | ||
|
||
public function message(): string; | ||
|
||
public function attemptedAmount(): float; | ||
|
||
public function transactedAmount(): float; | ||
|
||
public function isCharge(): bool; | ||
|
||
public function isCredit(): bool; | ||
|
||
public function getTransactionId(): ?string; | ||
|
||
public function getRemoteSubjectId(): ?string; | ||
|
||
public function getRemoteSubjectType(): ?string; | ||
|
||
public function getNativeStatus(): StringBackedEnum; | ||
} |
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,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Contains the TransactionHandler interface. | ||
* | ||
* @copyright Copyright (c) 2024 Vanilo UG | ||
* @author Attila Fulop | ||
* @license MIT | ||
* @since 2024-04-24 | ||
* | ||
*/ | ||
|
||
namespace Vanilo\Payment\Contracts; | ||
|
||
/** | ||
* @experimental don't use it yet, don't rely on it yet! | ||
*/ | ||
interface TransactionHandler | ||
{ | ||
public function supportsRefunds(): bool; | ||
|
||
public function issueRefund(Payment $payment, float $amount, array $options = []): Transaction|TransactionNotCreated; | ||
} |
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,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Contains the FailedOperation interface. | ||
* | ||
* @copyright Copyright (c) 2024 Vanilo UG | ||
* @author Attila Fulop | ||
* @license MIT | ||
* @since 2024-04-24 | ||
* | ||
*/ | ||
|
||
namespace Vanilo\Payment\Contracts; | ||
|
||
/** | ||
* @experimental | ||
*/ | ||
interface TransactionNotCreated extends PaymentAware | ||
{ | ||
public function reason(): ?string; | ||
|
||
public function shouldBeRetried(): bool; | ||
|
||
public function getDetails(); | ||
} |
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