Skip to content

Commit

Permalink
feat: add ticket brand to voucher payment #330
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaMelazzo authored Oct 7, 2024
2 parents 6293e3f + fb5e397 commit d8046f2
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 20 deletions.
4 changes: 2 additions & 2 deletions Model/Source/Vouchertype.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
*
* @link https://pagar.me
*/

class Vouchertype extends \Magento\Payment\Model\Source\Cctype
{
/**
Expand All @@ -22,7 +21,8 @@ public function getAllowedTypes()
return [
'VR',
'Alelo',
'Sodexo'
'Sodexo',
'Ticket'
];
}
}
40 changes: 23 additions & 17 deletions Model/Ui/Base/GenericInstallmentsConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@

namespace Pagarme\Pagarme\Model\Ui\Base;

use Magento\Checkout\Model\ConfigProviderInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\View\Asset\Repository;
use Pagarme\Pagarme\Model\Installments\Config\ConfigInterface;
use Magento\Store\Model\StoreManagerInterface;
use Pagarme\Pagarme\Gateway\Transaction\Base\Config\ConfigInterface as BaseConfig;
use Magento\Checkout\Model\ConfigProviderInterface;
use \Magento\Store\Model\StoreManagerInterface;
use Pagarme\Pagarme\Model\Installments\Config\ConfigInterface;

abstract class GenericInstallmentsConfigProvider implements ConfigProviderInterface
{
Expand Down Expand Up @@ -48,11 +49,12 @@ abstract class GenericInstallmentsConfigProvider implements ConfigProviderInterf
protected $storageManager;

public function __construct(
Repository $assetRepo,
ConfigInterface $config,
BaseConfig $baseConfig,
Repository $assetRepo,
ConfigInterface $config,
BaseConfig $baseConfig,
StoreManagerInterface $storeManager
) {
)
{
$this->assetRepo = $assetRepo;
$this->baseConfig = $baseConfig;
$this->storageManager = $storeManager;
Expand Down Expand Up @@ -176,6 +178,11 @@ public function getConfig()
'width' => 46,
'url' => $this->assetRepo->getUrl("Pagarme_Pagarme::images/cc/Banese.png")
],
'Ticket' => [
'height' => 30,
'width' => 46,
'url' => $this->assetRepo->getUrl("Pagarme_Pagarme::images/cc/Ticket.png")
],
],
]
],
Expand All @@ -184,6 +191,13 @@ public function getConfig()
];
}

/**
* @return ConfigInterface
*/
protected function _getConfig()
{
return $this->config;
}

/**
* @param ConfigInterface $config
Expand All @@ -195,18 +209,10 @@ protected function setConfig(ConfigInterface $config)
return $this;
}

/**
* @return ConfigInterface
*/
protected function _getConfig()
{
return $this->config;
}

protected function getRegionStates()
{
/** @fixme Get current country **/
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
/** @fixme Get current country * */
$objectManager = ObjectManager::getInstance();
$states = $objectManager
->create('Magento\Directory\Model\RegionFactory')
->create()->getCollection()->addFieldToFilter('country_id', 'BR');
Expand Down
6 changes: 5 additions & 1 deletion etc/payment.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" ?>
<payment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Payment:etc/payment.xsd">
<payment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Payment:etc/payment.xsd">

<methods>
<method name="pagarme_billet">
Expand Down Expand Up @@ -95,6 +96,9 @@
<type id="Sodexo" order="20">
<label>Sodexo</label>
</type>
<type id="Ticket" order="21">
<label>Ticket</label>
</type>

<!-- Billet -->
<type id="Itau" order="28">
Expand Down
Binary file added view/base/web/images/cc/Ticket.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d8046f2

Please sign in to comment.