-
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
41c9ab7
commit 4fbfd36
Showing
14 changed files
with
134 additions
and
111 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 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,18 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Afterpay\Afterpay\Model\Spi; | ||
|
||
/** | ||
* Process source validation | ||
* | ||
* @api | ||
*/ | ||
interface SourceValidatorServiceInterface | ||
{ | ||
/** | ||
* @param SourceDeductionRequestInterface $sourceDeductionRequest | ||
* @return void | ||
*/ | ||
public function execute(\Magento\InventorySourceDeductionApi\Model\SourceDeductionRequestInterface $sourceDeductionRequest): void; | ||
} |
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,63 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Afterpay\Afterpay\Model\StockItemsValidator; | ||
|
||
use Magento\Framework\App\ObjectManager; | ||
|
||
class StockItemsValidatorProxy implements \Afterpay\Afterpay\Model\Spi\StockItemsValidatorInterface, \Magento\Framework\ObjectManager\NoninterceptableInterface | ||
{ | ||
private $subject = null; | ||
private $stockItemValidatorFactory; | ||
private $sourceValidatorServiceFactory; | ||
private $moduleManager; | ||
|
||
public function __construct( | ||
\Afterpay\Afterpay\Gateway\Validator\StockItemsValidatorFactory $stockItemsValidatorFactory, | ||
\Afterpay\Afterpay\Model\SourceValidatorServiceFactory $sourceValidatorServiceFactory, | ||
\Magento\Framework\Module\Manager $moduleManager | ||
) { | ||
$this->stockItemValidatorFactory = $stockItemsValidatorFactory; | ||
$this->sourceValidatorServiceFactory = $sourceValidatorServiceFactory; | ||
$this->moduleManager = $moduleManager; | ||
} | ||
|
||
/** | ||
* Check msi functionality existing if no then skip validation | ||
* @throws \Magento\Framework\Exception\LocalizedException | ||
* @throws \Magento\Framework\Exception\NoSuchEntityException | ||
* @throws \Magento\InventoryConfigurationApi\Exception\SkuIsNotAssignedToStockException | ||
*/ | ||
public function validate(\Magento\Sales\Model\Order\Shipment $shipment): void | ||
{ | ||
if (!$this->moduleManager->isEnabled('Magento_InventoryCatalogApi') || | ||
!$this->moduleManager->isEnabled('Magento_InventoryShipping') || | ||
!$this->moduleManager->isEnabled('Magento_InventorySourceDeductionApi') || | ||
!$this->moduleManager->isEnabled('Magento_InventoryConfigurationApi') || | ||
!$this->moduleManager->isEnabled('Magento_InventorySalesApi') | ||
) { | ||
return; | ||
} | ||
$stockItemsValidator = $this->getStockItemValidator(); | ||
$stockItemsValidator->validate($shipment); | ||
} | ||
|
||
private function getStockItemValidator(): \Afterpay\Afterpay\Model\Spi\StockItemsValidatorInterface | ||
{ | ||
if ($this->subject == null) { | ||
$objectManager = ObjectManager::getInstance(); | ||
$sourceValidatorService = $this->sourceValidatorServiceFactory->create([ | ||
'getSourceItemBySourceCodeAndSku' => $objectManager->create('\\Magento\\InventorySourceDeductionApi\\Model\\GetSourceItemBySourceCodeAndSku'), | ||
'getStockItemConfiguration' => $objectManager->create('\\Magento\\InventoryConfigurationApi\\Api\\GetStockItemConfigurationInterface'), | ||
'getStockBySalesChannel' => $objectManager->create('\\Magento\\InventorySalesApi\\Api\\GetStockBySalesChannelInterface'), | ||
]); | ||
$this->subject = $this->stockItemValidatorFactory->create([ | ||
'isSingleSourceMode' => $objectManager->create('\\Magento\\InventoryCatalogApi\\Model\\IsSingleSourceModeInterface'), | ||
'defaultSourceProvider' => $objectManager->create('\\Magento\\InventoryCatalogApi\\Api\\DefaultSourceProviderInterface'), | ||
'getItemsToDeductFromShipment' => $objectManager->create('\\Magento\\InventoryShipping\\Model\\GetItemsToDeductFromShipment'), | ||
'sourceDeductionRequestFromShipmentFactory' => $objectManager->create('\\Magento\\InventoryShipping\\Model\\SourceDeductionRequestFromShipmentFactory'), | ||
'sourceValidatorService' => $sourceValidatorService, | ||
]); | ||
} | ||
return $this->subject; | ||
} | ||
} |
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
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 |
---|---|---|
|
@@ -5,47 +5,6 @@ | |
color: #a0a0a0; | ||
text-align: center; | ||
} | ||
.afterpay-checkout-note-header { | ||
h3 { | ||
color: #00a4e4; | ||
text-align: left; | ||
} | ||
} | ||
ul { | ||
padding-left: 1rem; | ||
padding-right: 1rem; | ||
li { | ||
width: 24%; | ||
display: inline-block; | ||
} | ||
&.cost { | ||
li { | ||
font-size: 1.8rem; | ||
color: #153F72; | ||
} | ||
} | ||
&.icon { | ||
.afterpay_checkout_steps { | ||
background-size: 18px 18px; | ||
vertical-align: middle; | ||
display: inline-block; | ||
height: 18px; | ||
width: 18px; | ||
} | ||
.afterpay_checkout_steps_1 { | ||
background-image: url(https://static.afterpay.com/checkout/[email protected]); | ||
} | ||
.afterpay_checkout_steps_2 { | ||
background-image: url(https://static.afterpay.com/checkout/[email protected]); | ||
} | ||
.afterpay_checkout_steps_3 { | ||
background-image: url(https://static.afterpay.com/checkout/[email protected]); | ||
} | ||
.afterpay_checkout_steps_4 { | ||
background-image: url(https://static.afterpay.com/checkout/[email protected]); | ||
} | ||
} | ||
} | ||
} | ||
.payment-method-content { | ||
overflow: hidden; | ||
|