-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from Affirm/feature-split-capture
Partial Capture
- Loading branch information
Showing
12 changed files
with
145 additions
and
12 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
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,48 @@ | ||
<?php | ||
/** | ||
* | ||
* @category Affirm | ||
* @package Astound_Affirm | ||
* @copyright Copyright (c) 2021 Affirm, Inc. | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
*/ | ||
|
||
namespace Astound\Affirm\Model\Plugin\Payment; | ||
|
||
use Magento\Sales\Model\Order\Payment; | ||
use Astound\Affirm\Model\Config; | ||
|
||
/** | ||
* Class CanCapturePartial | ||
* | ||
* @package Astound\Affirm\Model\Plugin\Payment | ||
*/ | ||
class CanCapturePartial | ||
{ | ||
/** | ||
* Constructor | ||
* | ||
* @param Config $configAffirm | ||
*/ | ||
public function __construct( | ||
Config $configAffirm | ||
) | ||
{ | ||
$this->affirmPaymentConfig = $configAffirm; | ||
} | ||
|
||
/** | ||
* Plugin to verify if Partial Capture is enabled in config | ||
* | ||
* @param Magento\Sales\Model\Order\Payment $subject | ||
* @param callable $result | ||
* @return bool | ||
*/ | ||
public function afterCanCapturePartial(Payment $subject, $result) | ||
{ | ||
if (!$this->affirmPaymentConfig->getPartialCapture()) { | ||
return false; | ||
} | ||
return $result; | ||
} | ||
} |
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
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