| @@ 35-80 (lines=46) @@ | ||
| 32 | /** |
|
| 33 | * Plugin for Magentos BillingAddressManagement class |
|
| 34 | */ |
|
| 35 | class BillingAddressManagement |
|
| 36 | { |
|
| 37 | /** |
|
| 38 | * Quote repository. |
|
| 39 | * |
|
| 40 | * @var \Magento\Quote\Api\CartRepositoryInterface |
|
| 41 | */ |
|
| 42 | protected $quoteRepository; |
|
| 43 | ||
| 44 | /** |
|
| 45 | * PAYONE addresscheck request model |
|
| 46 | * |
|
| 47 | * @var \Payone\Core\Model\Risk\Addresscheck |
|
| 48 | */ |
|
| 49 | protected $addresscheck; |
|
| 50 | ||
| 51 | /** |
|
| 52 | * Constructor |
|
| 53 | * |
|
| 54 | * @param \Magento\Quote\Api\CartRepositoryInterface $quoteRepository |
|
| 55 | * @param \Payone\Core\Model\Risk\Addresscheck $addresscheck |
|
| 56 | */ |
|
| 57 | public function __construct( |
|
| 58 | \Magento\Quote\Api\CartRepositoryInterface $quoteRepository, |
|
| 59 | \Payone\Core\Model\Risk\Addresscheck $addresscheck |
|
| 60 | ) { |
|
| 61 | $this->quoteRepository = $quoteRepository; |
|
| 62 | $this->addresscheck = $addresscheck; |
|
| 63 | } |
|
| 64 | ||
| 65 | /** |
|
| 66 | * This writes the addresscheck score to the quote address |
|
| 67 | * |
|
| 68 | * @param BillingAddressManagementOrig $oSource |
|
| 69 | * @param int $sCartId |
|
| 70 | * @param AddressInterface $oAddress |
|
| 71 | * @param bool $useForShipping |
|
| 72 | * @return array |
|
| 73 | */ |
|
| 74 | public function beforeAssign(BillingAddressManagementOrig $oSource, $sCartId, AddressInterface $oAddress, $useForShipping = false) |
|
| 75 | { |
|
| 76 | $oQuote = $this->quoteRepository->getActive($sCartId); |
|
| 77 | $oAddress = $this->addresscheck->handleAddressManagement($oAddress, $oQuote); |
|
| 78 | return [$sCartId, $oAddress, $useForShipping]; |
|
| 79 | } |
|
| 80 | } |
|
| 81 | ||
| @@ 35-79 (lines=45) @@ | ||
| 32 | /** |
|
| 33 | * Plugin for Magentos ShippingAddressManagement class |
|
| 34 | */ |
|
| 35 | class ShippingAddressManagement |
|
| 36 | { |
|
| 37 | /** |
|
| 38 | * Quote repository. |
|
| 39 | * |
|
| 40 | * @var \Magento\Quote\Api\CartRepositoryInterface |
|
| 41 | */ |
|
| 42 | protected $quoteRepository; |
|
| 43 | ||
| 44 | /** |
|
| 45 | * PAYONE addresscheck request model |
|
| 46 | * |
|
| 47 | * @var \Payone\Core\Model\Risk\Addresscheck |
|
| 48 | */ |
|
| 49 | protected $addresscheck; |
|
| 50 | ||
| 51 | /** |
|
| 52 | * Constructor |
|
| 53 | * |
|
| 54 | * @param \Magento\Quote\Api\CartRepositoryInterface $quoteRepository |
|
| 55 | * @param \Payone\Core\Model\Risk\Addresscheck $addresscheck |
|
| 56 | */ |
|
| 57 | public function __construct( |
|
| 58 | \Magento\Quote\Api\CartRepositoryInterface $quoteRepository, |
|
| 59 | \Payone\Core\Model\Risk\Addresscheck $addresscheck |
|
| 60 | ) { |
|
| 61 | $this->quoteRepository = $quoteRepository; |
|
| 62 | $this->addresscheck = $addresscheck; |
|
| 63 | } |
|
| 64 | ||
| 65 | /** |
|
| 66 | * This writes the addresscheck score to the quote address |
|
| 67 | * |
|
| 68 | * @param ShippingAddressManagementOrig $oSource |
|
| 69 | * @param int $sCartId |
|
| 70 | * @param AddressInterface $oAddress |
|
| 71 | * @return array |
|
| 72 | */ |
|
| 73 | public function beforeAssign(ShippingAddressManagementOrig $oSource, $sCartId, AddressInterface $oAddress) |
|
| 74 | { |
|
| 75 | $oQuote = $this->quoteRepository->getActive($sCartId); |
|
| 76 | $oAddress = $this->addresscheck->handleAddressManagement($oAddress, $oQuote, false); |
|
| 77 | return [$sCartId, $oAddress]; |
|
| 78 | } |
|
| 79 | } |
|
| 80 | ||