-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa76a3a
commit fd7c82c
Showing
24 changed files
with
454 additions
and
128 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
namespace Afterpay\Afterpay\Api\Data; | ||
|
||
interface TokenInterface | ||
{ | ||
public const LOG_ID_FIELD = 'log_id'; | ||
public const ORDER_ID_FIELD = 'order_id'; | ||
public const TOKEN_FIELD = 'token'; | ||
public const EXPIRATION_DATE_FIELD = 'expiration_date'; | ||
} |
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 |
---|---|---|
@@ -1,8 +1,12 @@ | ||
<?php | ||
|
||
namespace Afterpay\Afterpay\Model\Checks; | ||
|
||
interface PaymentMethodInterface | ||
{ | ||
public function isAfterPayMethod(\Magento\Sales\Model\Order\Payment $payment): bool; | ||
/** | ||
* @param \Magento\Sales\Api\Data\OrderPaymentInterface|\Magento\Quote\Api\Data\PaymentInterface $payment | ||
* | ||
* @return bool | ||
*/ | ||
public function isAfterPayMethod($payment): bool; | ||
} |
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,25 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Afterpay\Afterpay\Model\Order\Payment\Auth; | ||
|
||
use Afterpay\Afterpay\Model\ResourceModel\Token; | ||
use Magento\Framework\Stdlib\DateTime; | ||
|
||
class TokenSaver | ||
{ | ||
private $tokensResource; | ||
private $dateTime; | ||
|
||
public function __construct( | ||
Token $tokensResource, | ||
DateTime $dateTime | ||
) { | ||
$this->tokensResource = $tokensResource; | ||
$this->dateTime = $dateTime; | ||
} | ||
|
||
public function execute(int $orderId, string $token, ?string $expiryDate): bool | ||
{ | ||
return (bool)$this->tokensResource->insertNewToken($orderId, $token, $this->dateTime->formatDate($expiryDate)); | ||
} | ||
} |
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.