-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/v6.0.0' into 'master'
CHECMAG2003-206: check if current currency is allowed on paypal option and... See merge request agence-dnd/marketplace/magento-2/external/module-checkout-magento2-plugin!198
- Loading branch information
Showing
47 changed files
with
3,208 additions
and
353 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,51 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Checkout.com | ||
* Authorized and regulated as an electronic money institution | ||
* by the UK Financial Conduct Authority (FCA) under number 900816. | ||
* | ||
* PHP version 7 | ||
* | ||
* @category Magento2 | ||
* @package Checkout.com | ||
* @author Platforms Development Team <[email protected]> | ||
* @copyright 2010-present Checkout.com | ||
* @license https://opensource.org/licenses/mit-license.html MIT License | ||
* @link https://docs.checkout.com/ | ||
*/ | ||
namespace CheckoutCom\Magento2\Block\Paypal\Review; | ||
|
||
use CheckoutCom\Magento2\Model\Methods\PaypalMethod; | ||
use Magento\Checkout\Model\Session; | ||
use Magento\Framework\View\Element\Template; | ||
use \Magento\Framework\View\Element\Template\Context as TemplateContext; | ||
|
||
class PaymentMethod extends Template | ||
{ | ||
protected Session $checkoutSession; | ||
protected PaypalMethod $paypalMethod; | ||
|
||
public function __construct( | ||
TemplateContext $context, | ||
Session $checkoutSession, | ||
PaypalMethod $paypalMethod, | ||
array $data = [] | ||
) { | ||
parent::__construct($context, $data); | ||
$this->checkoutSession = $checkoutSession; | ||
$this->paypalMethod = $paypalMethod; | ||
} | ||
|
||
public function getEmail(): string | ||
{ | ||
return (string)$this->checkoutSession->getQuote()->getCustomerEmail(); | ||
} | ||
|
||
public function getPaymentMethod(): string | ||
{ | ||
return (string)$this->paypalMethod->getTitle(); | ||
} | ||
} |
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,66 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Checkout.com | ||
* Authorized and regulated as an electronic money institution | ||
* by the UK Financial Conduct Authority (FCA) under number 900816. | ||
* | ||
* PHP version 7 | ||
* | ||
* @category Magento2 | ||
* @package Checkout.com | ||
* @author Platforms Development Team <[email protected]> | ||
* @copyright 2010-present Checkout.com | ||
* @license https://opensource.org/licenses/mit-license.html MIT License | ||
* @link https://docs.checkout.com/ | ||
*/ | ||
namespace CheckoutCom\Magento2\Block\Paypal\Review; | ||
|
||
use CheckoutCom\Magento2\Controller\Paypal\Review; | ||
use CheckoutCom\Magento2\Model\Methods\PaypalMethod; | ||
use Magento\Checkout\Model\Session; | ||
use Magento\Framework\App\RequestInterface; | ||
use Magento\Framework\View\Element\Template; | ||
use \Magento\Framework\View\Element\Template\Context as TemplateContext; | ||
|
||
class PlaceOrderButton extends Template | ||
{ | ||
protected Session $checkoutSession; | ||
protected RequestInterface $request; | ||
protected PaypalMethod $paypalMethod; | ||
|
||
public function __construct( | ||
TemplateContext $context, | ||
Session $checkoutSession, | ||
RequestInterface $request, | ||
PaypalMethod $paypalMethod, | ||
array $data = [] | ||
) { | ||
parent::__construct($context, $data); | ||
$this->checkoutSession = $checkoutSession; | ||
$this->request = $request; | ||
$this->paypalMethod = $paypalMethod; | ||
} | ||
|
||
public function getEmail(): string | ||
{ | ||
return (string)$this->checkoutSession->getQuote()->getCustomerEmail(); | ||
} | ||
|
||
public function canPlaceOrder(): bool | ||
{ | ||
return (bool)$this->checkoutSession->getQuote()->getShippingAddress()->getShippingMethod(); | ||
} | ||
|
||
public function getPaymentMethod(): string | ||
{ | ||
return (string)$this->paypalMethod->getCode(); | ||
} | ||
|
||
public function getContextId(): string | ||
{ | ||
return (string)$this->request->getParam(Review::PAYMENT_CONTEXT_ID_PARAMETER); | ||
} | ||
} |
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,163 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Checkout.com | ||
* Authorized and regulated as an electronic money institution | ||
* by the UK Financial Conduct Authority (FCA) under number 900816. | ||
* | ||
* PHP version 7 | ||
* | ||
* @category Magento2 | ||
* @package Checkout.com | ||
* @author Platforms Development Team <[email protected]> | ||
* @copyright 2010-present Checkout.com | ||
* @license https://opensource.org/licenses/mit-license.html MIT License | ||
* @link https://docs.checkout.com/ | ||
*/ | ||
|
||
namespace CheckoutCom\Magento2\Block\Paypal\Review; | ||
|
||
use CheckoutCom\Magento2\Controller\Paypal\Review; | ||
use Magento\Checkout\Model\Session as CheckoutSession; | ||
use Magento\Customer\Api\AddressMetadataInterface; | ||
use Magento\Customer\Api\AddressRepositoryInterface; | ||
use Magento\Customer\Api\Data\AddressInterfaceFactory; | ||
use Magento\Customer\Api\Data\CustomerInterface; | ||
use Magento\Customer\Api\Data\CustomerInterfaceFactory; | ||
use Magento\Customer\Block\Address\Edit as CustomerAddressEdit; | ||
use Magento\Customer\Helper\Address; | ||
use Magento\Customer\Helper\Session\CurrentCustomer; | ||
use Magento\Customer\Model\Address\Config as AddressConfig; | ||
use Magento\Customer\Model\Session; | ||
use Magento\Directory\Helper\Data; | ||
use Magento\Directory\Model\ResourceModel\Country\CollectionFactory as CountryCollectionFactory; | ||
use Magento\Directory\Model\ResourceModel\Region\CollectionFactory; | ||
use Magento\Framework\Api\DataObjectHelper; | ||
use Magento\Framework\App\Cache\Type\Config; | ||
use Magento\Framework\App\RequestInterface; | ||
use Magento\Framework\Exception\LocalizedException; | ||
use Magento\Framework\Exception\NoSuchEntityException; | ||
use Magento\Framework\Json\EncoderInterface; | ||
use Magento\Framework\Phrase; | ||
use Magento\Framework\UrlInterface; | ||
use Magento\Framework\View\Element\Template\Context; | ||
use Magento\Quote\Model\Quote\Address as QuoteAddress; | ||
|
||
class ShippingAddress extends CustomerAddressEdit | ||
{ | ||
protected CheckoutSession $checkoutSession; | ||
protected AddressConfig $addressConfig; | ||
protected CustomerInterfaceFactory $customerInterfaceFactory; | ||
protected UrlInterface $url; | ||
protected RequestInterface $request; | ||
|
||
public function __construct( | ||
Context $context, | ||
Data $directoryHelper, | ||
EncoderInterface $jsonEncoder, | ||
Config $configCacheType, | ||
CollectionFactory $regionCollectionFactory, | ||
CountryCollectionFactory $countryCollectionFactory, | ||
Session $customerSession, | ||
AddressRepositoryInterface $addressRepository, | ||
AddressInterfaceFactory $addressDataFactory, | ||
CurrentCustomer $currentCustomer, | ||
DataObjectHelper $dataObjectHelper, | ||
CheckoutSession $checkoutSession, | ||
AddressConfig $addressConfig, | ||
CustomerInterfaceFactory $customerInterfaceFactory, | ||
UrlInterface $url, | ||
RequestInterface $request, | ||
array $data = [], | ||
AddressMetadataInterface $addressMetadata = null, | ||
Address $addressHelper = null | ||
) { | ||
parent::__construct( | ||
$context, | ||
$directoryHelper, | ||
$jsonEncoder, | ||
$configCacheType, | ||
$regionCollectionFactory, | ||
$countryCollectionFactory, | ||
$customerSession, | ||
$addressRepository, | ||
$addressDataFactory, | ||
$currentCustomer, | ||
$dataObjectHelper, | ||
$data, | ||
$addressMetadata, | ||
$addressHelper | ||
); | ||
|
||
$this->addressConfig = $addressConfig; | ||
$this->checkoutSession = $checkoutSession; | ||
$this->customerInterfaceFactory = $customerInterfaceFactory; | ||
$this->url = $url; | ||
$this->request = $request; | ||
|
||
$this->_address = $this->checkoutSession->getQuote()->getShippingAddress(); | ||
} | ||
|
||
/** | ||
* @throws LocalizedException | ||
* @throws NoSuchEntityException | ||
*/ | ||
public function getAddress(): ?QuoteAddress | ||
{ | ||
return $this->checkoutSession->getQuote()->getShippingAddress(); | ||
} | ||
|
||
public function getCustomer(): CustomerInterface | ||
{ | ||
return $this->customerInterfaceFactory->create(); | ||
} | ||
|
||
public function isDefaultBilling(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function isDefaultShipping(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function canSetAsDefaultBilling(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function canSetAsDefaultShipping(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function getCustomerAddressCount(): int | ||
{ | ||
return 1; | ||
} | ||
|
||
public function getRegion(): string | ||
{ | ||
return (string)$this->getAddress()->getRegion(); | ||
} | ||
|
||
public function getRegionId() | ||
{ | ||
return $this->getAddress()->getRegionId() ?? 0; | ||
} | ||
|
||
public function getTitle(): Phrase | ||
{ | ||
return __('Review Order'); | ||
} | ||
|
||
public function getSaveUrl(): string | ||
{ | ||
return $this->url->getUrl('checkoutcom/paypal/saveExpressShippingAddress', [ | ||
Review::PAYMENT_CONTEXT_ID_PARAMETER => $this->request->getParam(Review::PAYMENT_CONTEXT_ID_PARAMETER) | ||
]); | ||
} | ||
} |
Oops, something went wrong.