-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added AccountService and CoreAuth * add temporary menu for tests * create HubAccount Class * add accountId in Concrete/Magento2CoreSetup * get accountId from Webhook * improving notifications * feat: adding dash account settings validation when access payment admin page * feat: adding debit dash validation * feat: adding debit dash validation * feat: add Dash validation messages * feat: dash settings validation translations * feat: added button to clear Dash validation messages * refactor: moving account validation to ecommerce module core (#265) * feat: gateway/psp/simulator config validator * fix: code smells * fix: code smells * fix: missing comment docs * fix: adding observer name * fix: integration button names * fix: adding back counter for softdescriptor --------- Co-authored-by: RafaMelazzo <[email protected]> Co-authored-by: Fabiano Mallmann <[email protected]> Co-authored-by: mauriciohaygert <[email protected]>
- Loading branch information
1 parent
2ef3440
commit 5e62117
Showing
60 changed files
with
1,789 additions
and
669 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,47 @@ | ||
<?php | ||
|
||
namespace Pagarme\Pagarme\Block\Adminhtml\Form\Field; | ||
|
||
use Magento\Backend\Block\Template\Context; | ||
use Magento\Config\Block\System\Config\Form\Field; | ||
use Magento\Framework\Data\Form\Element\AbstractElement; | ||
use Magento\Framework\View\Helper\SecureHtmlRenderer; | ||
use Pagarme\Pagarme\Model\Account; | ||
use Pagarme\Pagarme\Model\PagarmeConfigProvider; | ||
|
||
class CreditCardPspField extends Field | ||
{ | ||
/** | ||
* @var Account | ||
*/ | ||
protected $account; | ||
|
||
/** | ||
* @param Context $context | ||
* @param Account $account | ||
* @param array $data | ||
* @param SecureHtmlRenderer|null $secureRenderer | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
Account $account, | ||
array $data = [], | ||
?SecureHtmlRenderer $secureRenderer = null | ||
) { | ||
parent::__construct($context, $data, $secureRenderer); | ||
$this->account = $account; | ||
} | ||
|
||
/** | ||
* @param AbstractElement $element | ||
* @return string | ||
*/ | ||
public function render(AbstractElement $element) | ||
{ | ||
if ($this->account->isGateway(PagarmeConfigProvider::CREDIT_CARD_PAYMENT_CONFIG)) { | ||
return ''; | ||
} | ||
|
||
return parent::render($element); | ||
} | ||
} |
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,26 @@ | ||
<?php | ||
|
||
namespace Pagarme\Pagarme\Block\Adminhtml\Form\Field; | ||
|
||
use Exception; | ||
use Magento\Config\Block\System\Config\Form\Field; | ||
use Magento\Framework\Data\Form\Element\AbstractElement; | ||
use Pagarme\Pagarme\Concrete\Magento2CoreSetup; | ||
|
||
class EnableAdvanceSettings extends Field | ||
{ | ||
/** | ||
* @param AbstractElement $element | ||
* @return string | ||
* @throws Exception | ||
*/ | ||
public function render(AbstractElement $element) | ||
{ | ||
Magento2CoreSetup::bootstrap(); | ||
$config = Magento2CoreSetup::getModuleConfiguration(); | ||
if (!empty($config->getAccountId())) { | ||
return ''; | ||
} | ||
return parent::render($element); | ||
} | ||
} |
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,55 @@ | ||
<?php | ||
|
||
namespace Pagarme\Pagarme\Block\Adminhtml\Form\Field; | ||
|
||
use Magento\Backend\Block\Template\Context; | ||
use Magento\Config\Block\System\Config\Form\Field; | ||
use Magento\Framework\Data\Form\Element\AbstractElement; | ||
use Magento\Framework\View\Helper\SecureHtmlRenderer; | ||
use Pagarme\Pagarme\Model\Account; | ||
|
||
class GatewayField extends Field | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $paymentMethodName; | ||
|
||
/** | ||
* @var Account | ||
*/ | ||
protected $account; | ||
|
||
/** | ||
* @param Context $context | ||
* @param Account $account | ||
* @param string $paymentMethodName | ||
* @param array $data | ||
* @param SecureHtmlRenderer|null $secureRenderer | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
Account $account, | ||
string $paymentMethodName = '', | ||
array $data = [], | ||
?SecureHtmlRenderer $secureRenderer = null | ||
) { | ||
parent::__construct($context, $data, $secureRenderer); | ||
$this->account = $account; | ||
$this->paymentMethodName = $paymentMethodName; | ||
} | ||
|
||
/** | ||
* @param AbstractElement $element | ||
* @return string | ||
*/ | ||
public function render(AbstractElement $element) | ||
{ | ||
if (empty($this->paymentMethodName) || !$this->account->isGateway($this->paymentMethodName)) { | ||
return ''; | ||
} | ||
|
||
return parent::render($element); | ||
} | ||
|
||
} |
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,58 @@ | ||
<?php | ||
|
||
namespace Pagarme\Pagarme\Block\Adminhtml\Form\Field; | ||
|
||
use Magento\Backend\Block\Template\Context; | ||
use Magento\Config\Block\System\Config\Form\Field; | ||
use Magento\Config\Model\ResourceModel\Config\Data\CollectionFactory; | ||
use Magento\Framework\Data\Form\Element\AbstractElement; | ||
use Magento\Framework\View\Helper\SecureHtmlRenderer; | ||
use Pagarme\Pagarme\Model\Account; | ||
use Pagarme\Pagarme\Model\PagarmeConfigProvider; | ||
|
||
class InstallmentsNumber extends Field | ||
{ | ||
/** | ||
* @var Account | ||
*/ | ||
protected $account; | ||
|
||
/** | ||
* @param Context $context | ||
* @param CollectionFactory $configCollectionFactory | ||
* @param Account $account | ||
* @param array $data | ||
* @param SecureHtmlRenderer|null $secureRenderer | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
CollectionFactory $configCollectionFactory, | ||
Account $account, | ||
array $data = [], | ||
?SecureHtmlRenderer $secureRenderer = null | ||
) { | ||
parent::__construct($context, $data, $secureRenderer); | ||
$this->configCollectionFactory = $configCollectionFactory; | ||
$this->account = $account; | ||
} | ||
|
||
/** | ||
* @param AbstractElement $element | ||
* @return string | ||
*/ | ||
public function render(AbstractElement $element) | ||
{ | ||
$isGateway = $this->account->isGateway(PagarmeConfigProvider::CREDIT_CARD_PAYMENT_CONFIG); | ||
if ($isGateway) { | ||
$classes = $element->getClass(); | ||
$classes = str_replace('number-range-1-12', '', $classes); | ||
$classes .= ' number-range-1-24'; | ||
$element->setClass($classes); | ||
|
||
$comment = $element->getComment(); | ||
$comment = str_replace('12', '24', $comment); | ||
$element->setComment($comment); | ||
} | ||
return parent::render($element); | ||
} | ||
} |
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,64 @@ | ||
<?php | ||
|
||
namespace Pagarme\Pagarme\Block\Adminhtml\Form\Field; | ||
|
||
use Magento\Backend\Block\Template\Context; | ||
use Magento\Config\Block\System\Config\Form\Field; | ||
use Magento\Framework\Data\Form\Element\AbstractElement; | ||
use Magento\Framework\View\Helper\SecureHtmlRenderer; | ||
use Pagarme\Pagarme\Model\Account; | ||
|
||
class SoftDescriptor extends Field | ||
{ | ||
/** | ||
* @var Account | ||
*/ | ||
protected $account; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected $paymentMethodName; | ||
|
||
/** | ||
* @param Context $context | ||
* @param Account $account | ||
* @param string $paymentMethodName | ||
* @param array $data | ||
* @param SecureHtmlRenderer|null $secureRenderer | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
Account $account, | ||
string $paymentMethodName = '', | ||
array $data = [], | ||
?SecureHtmlRenderer $secureRenderer = null | ||
) { | ||
parent::__construct($context, $data, $secureRenderer); | ||
$this->account = $account; | ||
$this->paymentMethodName = $paymentMethodName; | ||
} | ||
|
||
/** | ||
* @param AbstractElement $element | ||
* @return string | ||
*/ | ||
public function render(AbstractElement $element) | ||
{ | ||
if (empty($this->paymentMethodName)) { | ||
return ''; | ||
} | ||
$isGateway = $this->account->isGateway($this->paymentMethodName); | ||
if ($isGateway) { | ||
$classes = $element->getClass(); | ||
$classes = str_replace('maximum-length-13', '', $classes); | ||
$classes .= ' maximum-length-22'; | ||
$element->setClass($classes); | ||
|
||
$comment = $element->getComment(); | ||
$comment = str_replace('13', '22', $comment); | ||
$element->setComment($comment); | ||
} | ||
return parent::render($element); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
Block/Adminhtml/Form/Fieldset/CreditCardGatewayFieldset.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace Pagarme\Pagarme\Block\Adminhtml\Form\Fieldset; | ||
|
||
use Magento\Backend\Block\Context; | ||
use Magento\Backend\Model\Auth\Session; | ||
use Magento\Config\Block\System\Config\Form\Fieldset; | ||
use Magento\Framework\Data\Form\Element\AbstractElement; | ||
use Magento\Framework\View\Helper\Js; | ||
use Magento\Framework\View\Helper\SecureHtmlRenderer; | ||
use Pagarme\Pagarme\Model\Account; | ||
use Pagarme\Pagarme\Model\PagarmeConfigProvider; | ||
|
||
class CreditCardGatewayFieldset extends Fieldset | ||
{ | ||
/** | ||
* @var Account | ||
*/ | ||
protected $account; | ||
|
||
/** | ||
* @param Context $context | ||
* @param Session $authSession | ||
* @param Js $jsHelper | ||
* @param Account $account | ||
* @param array $data | ||
* @param SecureHtmlRenderer|null $secureRenderer | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
Session $authSession, | ||
Js $jsHelper, | ||
Account $account, | ||
array $data = [], | ||
?SecureHtmlRenderer $secureRenderer = null | ||
) { | ||
parent::__construct($context, $authSession, $jsHelper, $data, $secureRenderer); | ||
$this->account = $account; | ||
} | ||
|
||
/** | ||
* @param AbstractElement $element | ||
* @return string | ||
*/ | ||
public function render(AbstractElement $element) | ||
{ | ||
if (!$this->account->isGateway(PagarmeConfigProvider::CREDIT_CARD_PAYMENT_CONFIG)) { | ||
return ''; | ||
} | ||
|
||
return parent::render($element); | ||
} | ||
} |
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,60 @@ | ||
<?php | ||
|
||
namespace Pagarme\Pagarme\Block\Adminhtml\Form\Fieldset; | ||
|
||
use Magento\Backend\Block\Context; | ||
use Magento\Backend\Model\Auth\Session; | ||
use Magento\Config\Block\System\Config\Form\Fieldset; | ||
use Magento\Framework\Data\Form\Element\AbstractElement; | ||
use Magento\Framework\View\Helper\Js; | ||
use Magento\Framework\View\Helper\SecureHtmlRenderer; | ||
use Pagarme\Pagarme\Model\Account; | ||
|
||
class CustomPaymentFieldset extends Fieldset | ||
{ | ||
/** | ||
* @var Account | ||
*/ | ||
protected $account; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected $paymentMethodName; | ||
|
||
/** | ||
* @param Context $context | ||
* @param Session $authSession | ||
* @param Js $jsHelper | ||
* @param Account $account | ||
* @param string $paymentMethodName | ||
* @param array $data | ||
* @param SecureHtmlRenderer|null $secureRenderer | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
Session $authSession, | ||
Js $jsHelper, | ||
Account $account, | ||
string $paymentMethodName = '', | ||
array $data = [], | ||
?SecureHtmlRenderer $secureRenderer = null | ||
) { | ||
parent::__construct($context, $authSession, $jsHelper, $data, $secureRenderer); | ||
$this->account = $account; | ||
$this->paymentMethodName = $paymentMethodName; | ||
} | ||
|
||
/** | ||
* @param AbstractElement $element | ||
* @return string | ||
*/ | ||
public function render(AbstractElement $element) | ||
{ | ||
if (empty($this->paymentMethodName) || $this->account->isPSP($this->paymentMethodName)) { | ||
return ''; | ||
} | ||
|
||
return parent::render($element); | ||
} | ||
} |
Oops, something went wrong.