-
Notifications
You must be signed in to change notification settings - Fork 7
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
e7d9866
commit eba45cb
Showing
252 changed files
with
8,656 additions
and
9,038 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,40 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Clearpay\Clearpay\Api; | ||
|
||
/** | ||
* Interface for managing Clearpay Checkout | ||
* @api | ||
*/ | ||
interface CheckoutManagementInterface | ||
{ | ||
/** | ||
* @param string $cartId | ||
* @param \Clearpay\Clearpay\Api\Data\RedirectPathInterface $redirectPath | ||
* | ||
* @return \Clearpay\Clearpay\Api\Data\CheckoutInterface | ||
* | ||
* @throws \Magento\Framework\Validation\ValidationException | ||
* @throws \Magento\Framework\Exception\NoSuchEntityException | ||
* @throws \Magento\Payment\Gateway\Command\CommandException | ||
*/ | ||
public function create( | ||
string $cartId, | ||
\Clearpay\Clearpay\Api\Data\RedirectPathInterface $redirectPath | ||
): \Clearpay\Clearpay\Api\Data\CheckoutInterface; | ||
|
||
/** | ||
* @param string $cartId | ||
* @param string $popupOriginUrl | ||
* | ||
* @return \Clearpay\Clearpay\Api\Data\CheckoutInterface | ||
* | ||
* @throws \Magento\Framework\Validation\ValidationException | ||
* @throws \Magento\Framework\Exception\NoSuchEntityException | ||
* @throws \Magento\Payment\Gateway\Command\CommandException | ||
*/ | ||
public function createExpress( | ||
string $cartId, | ||
string $popupOriginUrl | ||
): \Clearpay\Clearpay\Api\Data\CheckoutInterface; | ||
} |
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); | ||
|
||
namespace Clearpay\Clearpay\Api\Data; | ||
|
||
/** | ||
* Interface CheckoutInterface | ||
* @api | ||
*/ | ||
interface CheckoutInterface | ||
{ | ||
/**#@+ | ||
* Checkout result keys | ||
*/ | ||
const CLEARPAY_TOKEN = 'clearpay_token'; | ||
const CLEARPAY_AUTH_TOKEN_EXPIRES = 'clearpay_expires'; | ||
const CLEARPAY_REDIRECT_CHECKOUT_URL = 'clearpay_redirectCheckoutUrl'; | ||
/**#@-*/ | ||
|
||
/** | ||
* @param string $token | ||
* @return static | ||
*/ | ||
public function setClearpayToken(string $token): self; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getClearpayToken(): string; | ||
|
||
/** | ||
* @param string $authTokenExpires | ||
* @return static | ||
*/ | ||
public function setClearpayAuthTokenExpires(string $authTokenExpires): self; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getClearpayAuthTokenExpires(): string; | ||
|
||
/** | ||
* @param string $redirectCheckoutUrl | ||
* @return static | ||
*/ | ||
public function setClearpayRedirectCheckoutUrl(string $redirectCheckoutUrl): self; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getClearpayRedirectCheckoutUrl(): string; | ||
} |
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,32 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Clearpay\Clearpay\Api\Data; | ||
|
||
/** | ||
* Interface RedirectPathInterface | ||
* @api | ||
*/ | ||
interface RedirectPathInterface | ||
{ | ||
/** | ||
* @param string $path | ||
* @return static | ||
*/ | ||
public function setConfirmPath(string $path): self; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getConfirmPath(): string; | ||
|
||
/** | ||
* @param string $path | ||
* @return static | ||
*/ | ||
public function setCancelPath(string $path): self; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getCancelPath(): string; | ||
} |
52 changes: 17 additions & 35 deletions
52
...Adminhtml/System/Config/Button/Update.php → ...html/System/Config/Button/LimitUpdate.php
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,46 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Clearpay\Clearpay\Block\Adminhtml\System\Config\Fieldset; | ||
|
||
class Payment extends \Magento\Config\Block\System\Config\Form\Fieldset | ||
{ | ||
private \Magento\Payment\Model\MethodInterface $clearpay; | ||
private \Clearpay\Clearpay\Model\Config $config; | ||
|
||
public function __construct( | ||
\Magento\Backend\Block\Context $context, | ||
\Magento\Backend\Model\Auth\Session $authSession, | ||
\Magento\Framework\View\Helper\Js $jsHelper, | ||
\Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer, | ||
\Magento\Payment\Model\MethodInterface $clearpay, | ||
\Clearpay\Clearpay\Model\Config $config, | ||
array $data = [] | ||
) { | ||
parent::__construct($context, $authSession, $jsHelper, $data, $secureRenderer); | ||
$this->clearpay = $clearpay; | ||
$this->config = $config; | ||
} | ||
|
||
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element): string | ||
{ | ||
$allowedMerchantCountries = explode(',', $this->clearpay->getConfigData('allowed_merchant_countries')); | ||
if (in_array($this->getMerchantCountry(), $allowedMerchantCountries)) { | ||
return parent::render($element); | ||
} | ||
return ''; | ||
} | ||
|
||
private function getMerchantCountry(): ?string | ||
{ | ||
/** @var \Magento\Config\Block\System\Config\Form $fieldSetForm */ | ||
$fieldSetForm = $this->getForm(); | ||
$scope = $fieldSetForm->getScope(); | ||
$scopeCode = $fieldSetForm->getScopeCode(); | ||
|
||
if ($countryCode = $this->getRequest()->getParam('paypal_country')) { | ||
return $countryCode; | ||
} | ||
|
||
return $this->config->getMerchantCountry($scope, (int)$scopeCode); | ||
} | ||
} |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Clearpay\Clearpay\Block\Adminhtml\System\Config\Form\Field; | ||
|
||
use Magento\Backend\Block\Template\Context; | ||
use Magento\Framework\View\Helper\SecureHtmlRenderer; | ||
|
||
class Version extends \Magento\Config\Block\System\Config\Form\Field | ||
{ | ||
const MODULE_NAME = "Clearpay_Clearpay"; | ||
|
||
private \Magento\Framework\Module\ResourceInterface $resource; | ||
|
||
public function __construct( | ||
\Magento\Framework\Module\ResourceInterface $resource, | ||
Context $context, | ||
array $data = [], | ||
?SecureHtmlRenderer $secureRenderer = null | ||
) { | ||
parent::__construct($context, $data, $secureRenderer); | ||
$this->resource = $resource; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element) | ||
{ | ||
return $this->resource->getDataVersion(self::MODULE_NAME) ?: ""; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.