Skip to content

Commit

Permalink
feat: added kyc status refused
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaMelazzo committed Jun 12, 2024
1 parent b320f89 commit f29b4ff
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 35 deletions.
81 changes: 47 additions & 34 deletions Setup/UpgradeSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Pagarme\Pagarme\Setup;

use Magento\Framework\DB\Ddl\Table;
use Magento\Framework\Setup\UpgradeSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\Setup\UpgradeSchemaInterface;

class UpgradeSchema implements UpgradeSchemaInterface
{
Expand All @@ -14,9 +14,10 @@ class UpgradeSchema implements UpgradeSchemaInterface
* {@inheritdoc}
*/
public function upgrade(
SchemaSetupInterface $setup,
SchemaSetupInterface $setup,
ModuleContextInterface $context
) {
)
{
$setup->startSetup();
$version = $context->getVersion();
$installSchema = new InstallSchema();
Expand All @@ -27,41 +28,53 @@ public function upgrade(

if (version_compare($version, '2.2.5', '<')) {
$connection = $setup->getConnection();
$connection->addColumn(
$setup->getTable('pagarme_module_core_recurrence_products_plan'),
'apply_discount_in_all_product_cycles',
[
'type' => Table::TYPE_SMALLINT,
'length' => 1,
'nullable' => true,
'comment' => 'Apply products cycle to discount'
]
);
if ($connection->tableColumnExists(
'pagarme_module_core_recurrence_products_plan',
'apply_discount_in_all_product_cycles'
) === false) {
$connection->addColumn(
$setup->getTable('pagarme_module_core_recurrence_products_plan'),
'apply_discount_in_all_product_cycles',
[
'type' => Table::TYPE_SMALLINT,
'length' => 1,
'nullable' => true,
'comment' => 'Apply products cycle to discount'
]
);
}

$connection->addColumn(
$setup->getTable('pagarme_module_core_recurrence_products_subscription'),
'apply_discount_in_all_product_cycles',
[
'type' => Table::TYPE_SMALLINT,
'length' => 1,
'nullable' => true,
'comment' => 'Apply products cycle to discount'
]
);
if ($connection->tableColumnExists(
'pagarme_module_core_recurrence_products_subscription',
'apply_discount_in_all_product_cycles'
) === false) {
$connection->addColumn(
$setup->getTable('pagarme_module_core_recurrence_products_subscription'),
'apply_discount_in_all_product_cycles',
[
'type' => Table::TYPE_SMALLINT,
'length' => 1,
'nullable' => true,
'comment' => 'Apply products cycle to discount'
]
);
}
}

if (version_compare($context->getVersion(), '2.5.0', '<')) {
$setup->getConnection()->changeColumn(
$setup->getTable('pagarme_module_core_recipients'),
'document_type',
'type',
[
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
'length' => 11,
'nullable' => 'false',
'comment' => 'Recipient document type: individual (CPF) or corporation (CNPJ)'
]
);
if ($setup->getConnection()->tableColumnExists('pagarme_module_core_recipients', 'type') === false) {
$setup->getConnection()->changeColumn(
$setup->getTable('pagarme_module_core_recipients'),
'document_type',
'type',
[
'type' => Table::TYPE_TEXT,
'length' => 11,
'nullable' => 'false',
'comment' => 'Recipient document type: individual (CPF) or corporation (CNPJ)'
]
);
}
}

$setup->endSetup();
Expand Down
3 changes: 2 additions & 1 deletion view/adminhtml/web/css/pagarme_style.css
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ table.table-cycles {
.data-grid td .recipient-status-disapproved,
.data-grid td .recipient-status-suspended,
.data-grid td .recipient-status-blocked,
.data-grid td .recipient-status-inactive {
.data-grid td .recipient-status-inactive,
.data-grid td .recipient-status-refused {
background-color: #f9d4d4;
border-color: #e22626;
color: #e22626;
Expand Down
3 changes: 3 additions & 0 deletions view/adminhtml/web/js/grid/columns/recipientStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ define([
case 'blocked':
statusLabel = 'Bloqueado'
break;
case 'refused':
statusLabel = 'Recusado'
break;
case 'inactive':
statusLabel = 'Inativo'
break;
Expand Down

0 comments on commit f29b4ff

Please sign in to comment.