Skip to content

Commit

Permalink
Versão 2.2.0 (#140)
Browse files Browse the repository at this point in the history
* Versionamento da 2.1.0 (#134)

* Link de Pagamento - Cancelamento de Pedido (#136)

* fix: add 'view/base/web/images/cc' images

* feat: adding information message when deleting credit card

* feat: add translate payment

* feat: committing the features of the functionality in general

* fix: error with null

* fix: unify settings on menu

* fix: unify settings on menu

* feat: Adding validation on the card success page

* feat: add delete payment link cron

* fix: returning composer to version '1.4.0'

* fix: delete payment link argument

* fix: correction of method names in the template

* fix: adjusting BillPaid webhook flow for when it is subscription and when it is not

* fix: correction when searching for customer data in purchases with pix in Model/Payment/Customer.php

* fix: PLANOS (1)

* fix: PLANOS (1) - quantidade de periodos vazio

* fix: PLANOS (2) - correcao de labels e quantidade de ate 31 dias

* fix: PLANOS (3) e (4) - ajuste na edicao de planos importados

* fix: PRODUTOS (1) e (2) - ajuste de cadastro de planos ao salvar produtos

* fix: - PRODUTOS (3) - removendo cache do campo observacoes

* fix: ASSINATURAS (2) - ajuste ao refazer pedidos de assinatura

* fix: ASSINATURAS (1) - correcao na aplicacao de descontos

* fix 2: PLANOS (3) e (4) - ajuste na edicao de planos importados

* fix: PLANOS - ajustes ao salvar configuracao da cobranca

* fix 2: PLANOS (1) - quantidade de periodos vazio

* fix: METODOS DE PAGAMENTO - correcao ao habilitar/desabilitar compras com recorrencia

* fix: CHECKOUT - duplicacao de mensagens

* fix: PLANOS adicionando ID ao code

* fix: PRODUTO - adicionando filtro no preco para valores maiores que zero

* fix: PLANOS - ajuste no code

* fix: CHECKOUT - compra como convidado

* fix: ASSINATURAS - ajuste na exibicao dos detalhes da assinatura

* fix: LOGS - aplicacao de mascara no CVV e no registry_code

* fix: PRODUTOS - exibicao de mensagem no carrinho

* feat: show discount at checkout and redirect customer to home page if link expires

* fix: LOG - refatoracao nas expressoes regulares

* fix: CHECKOUT - ajuste na url do boleto na renovacao de ciclo de assinatura

* fix: ajuste da label do botao de criar e enviar novo link de pagamento

* refactor: ajustando codigo para validacao do PHPStan

* VINDI-158: estilizacao paginas link de pagamento e sucesso

* Retorna arquivos comitados por engano

* feat: vindi payment link module

* fix: remove delete payment link after first access

* feat: frontend development

* fix: fix error Block/InfoTrait.php

* fix: pay now color

* feat: login is required, columns in the grid in the admin and frontend

* feat: mass action send payment link email

* feat: create payment link status

* fix: add status validation in mass payment link send

* fix: change link payment expiration time for 20 days

* fix: update expired link

* fix: change paid to processed status

* fix: creating email trigger config

* fix: changing the instruction label on the payment link success page

* fix: setting a default template if none is selected

* fix: name in from customer template

* feat: add transtale

* feat: adding access to the payment link also within the order

* fix: change the link status if the order is canceled and it has not yet been changed

* refactor: readjusting features to test them better

* changing the version to 2.1.0

* feat: mass sending of emails in the order grid

* feat: cancel order if payment link not processed

* fix: save payment additionoal information in saved card

* fix: version

* refactor: change translate

* fix: remove version in composer.json

* feat: when invoicing orders, payments are processed

* refactor: line comment

* fix: plan form format

---------

Co-authored-by: Iago Cedran <[email protected]>
Co-authored-by: Thiago Contardi <[email protected]>
Co-authored-by: Caroline Esteves <[email protected]>

* Link de Pagamento - Template de Email (#137)

* feat: adding information message when deleting credit card

* feat: add translation

* feat: add translate payment

* feat: committing the features of the functionality in general

* fix: error with null

* fix: unify settings on menu

* fix: unify settings on menu

* feat: Adding validation on the card success page

* feat: add delete payment link cron

* fix: returning composer to version '1.4.0'

* fix: delete payment link argument

* fix: correction of method names in the template

* fix: adjusting BillPaid webhook flow for when it is subscription and when it is not

* fix: correction when searching for customer data in purchases with pix in Model/Payment/Customer.php

* fix: PLANOS (1)

* fix: PLANOS (1) - quantidade de periodos vazio

* fix: PLANOS (2) - correcao de labels e quantidade de ate 31 dias

* fix: PLANOS (3) e (4) - ajuste na edicao de planos importados

* fix: PRODUTOS (1) e (2) - ajuste de cadastro de planos ao salvar produtos

* fix: - PRODUTOS (3) - removendo cache do campo observacoes

* fix: ASSINATURAS (2) - ajuste ao refazer pedidos de assinatura

* fix: ASSINATURAS (1) - correcao na aplicacao de descontos

* fix 2: PLANOS (3) e (4) - ajuste na edicao de planos importados

* fix: PLANOS - ajustes ao salvar configuracao da cobranca

* fix 2: PLANOS (1) - quantidade de periodos vazio

* fix: METODOS DE PAGAMENTO - correcao ao habilitar/desabilitar compras com recorrencia

* fix: CHECKOUT - duplicacao de mensagens

* fix: PLANOS adicionando ID ao code

* fix: PRODUTO - adicionando filtro no preco para valores maiores que zero

* fix: PLANOS - ajuste no code

* fix: CHECKOUT - compra como convidado

* fix: ASSINATURAS - ajuste na exibicao dos detalhes da assinatura

* fix: LOGS - aplicacao de mascara no CVV e no registry_code

* fix: PRODUTOS - exibicao de mensagem no carrinho

* feat: show discount at checkout and redirect customer to home page if link expires

* fix: LOG - refatoracao nas expressoes regulares

* fix: CHECKOUT - ajuste na url do boleto na renovacao de ciclo de assinatura

* fix: ajuste da label do botao de criar e enviar novo link de pagamento

* refactor: ajustando codigo para validacao do PHPStan

* VINDI-158: estilizacao paginas link de pagamento e sucesso

* Retorna arquivos comitados por engano

* feat: vindi payment link module

* fix: remove delete payment link after first access

* feat: frontend development

* fix: fix error Block/InfoTrait.php

* fix: pay now color

* feat: login is required, columns in the grid in the admin and frontend

* feat: mass action send payment link email

* feat: create payment link status

* fix: add status validation in mass payment link send

* fix: change link payment expiration time for 20 days

* fix: update expired link

* fix: change paid to processed status

* fix: creating email trigger config

* fix: changing the instruction label on the payment link success page

* fix: setting a default template if none is selected

* fix: name in from customer template

* feat: add transtale

* feat: adding access to the payment link also within the order

* fix: change the link status if the order is canceled and it has not yet been changed

* refactor: readjusting features to test them better

* changing the version to 2.1.0

* feat: mass sending of emails in the order grid

* feat: cancel order if payment link not processed

* feat: add template email by config

* fix: save payment additionoal information in saved card

* fix: version

* fix: adjusting link access correction

* refactor: change translate

* fix: remove version in composer.json

* feat: when invoicing orders, payments are processed

* fix: correcting to pick up emails, either the default, or those created from the default

* feat: changing the display of labels in the admin

* feat: adding expiration validation to access payment link success page

* fix: only 'vindi_vr_payment_link_template' custom email template

* fix: change form with get status

* feat: implementing single view system on success page

* refactor: line comment

* fix: plan form format

---------

Co-authored-by: Iago Cedran <[email protected]>
Co-authored-by: Thiago Contardi <[email protected]>
Co-authored-by: Caroline Esteves <[email protected]>

* Novo layout do cartão de crédito na página de checkout (#138)

* feat: removed deprecated magento 2 classes

* feat: removed deprecated magento 2 classes

* fix: remove unused patch

* fix: call non existing class

* fix: return composer version

* Versionamento da 2.1.0

* feat: new card layout

* fix: same input id for different fields

* fix: cacheable false for product view

* fix: add cache key info product block

* feat: added all available brands

---------

Co-authored-by: Iago Cedran <[email protected]>
Co-authored-by: Thiago Contardi <[email protected]>
Co-authored-by: Thais Kusuki <[email protected]>
Co-authored-by: Thais Kusuki <[email protected]>

* inserindo as outras alterações no merge

---------

Co-authored-by: Thais Kusuki <[email protected]>
Co-authored-by: Iago Cedran <[email protected]>
Co-authored-by: Iago Cedran <[email protected]>
Co-authored-by: Thiago Contardi <[email protected]>
Co-authored-by: Caroline Esteves <[email protected]>
Co-authored-by: Contardi <[email protected]>
Co-authored-by: Thiago Contardi <[email protected]>
Co-authored-by: Thais Kusuki <[email protected]>
  • Loading branch information
9 people authored Jan 14, 2025
1 parent 62ae174 commit 97c699e
Show file tree
Hide file tree
Showing 42 changed files with 5,290 additions and 717 deletions.
42 changes: 31 additions & 11 deletions Api/Data/PaymentLinkInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@

declare(strict_types=1);

/**
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Vindi
* @package Vindi_Payment
*/

namespace Vindi\Payment\Api\Data;

use Magento\Framework\Api\ExtensibleDataInterface;
Expand All @@ -25,14 +15,16 @@ interface PaymentLinkInterface extends ExtensibleDataInterface
const CUSTOMER_ID = 'customer_id';
const CREATED_AT = 'created_at';
const STATUS = 'status';
const EXPIRED_AT = 'expired_at';
const SUCCESS_PAGE_ACCESSED = 'success_page_accessed';

/**
* @return int
*/
public function getEntityId();

/**
* @param int $id
* @param int $entityId
*/
public function setEntityId(int $entityId);

Expand Down Expand Up @@ -95,4 +87,32 @@ public function getStatus();
* @param string $status
*/
public function setStatus(string $status);

/**
* Get the expiration date of the payment link
*
* @return string|null
*/
public function getExpiredAt();

/**
* Set the expiration date of the payment link
*
* @param string|null $expiredAt
*/
public function setExpiredAt($expiredAt);

/**
* Check if the success page has been accessed
*
* @return bool
*/
public function getSuccessPageAccessed();

/**
* Set the success page accessed flag
*
* @param bool $successPageAccessed
*/
public function setSuccessPageAccessed(bool $successPageAccessed);
}
2 changes: 1 addition & 1 deletion Block/InfoTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function getCcValue($totalQtyCard = 1, $cardPosition = 1)
*/
public function getCcBrand()
{
$brands = $this->paymentMethod->getCreditCardTypes();
$brands = $this->paymentMethod->getCreditCardCodes();
$CardCode = $this->getOrder()->getPayment()->getCcType();

return isset($brands[$CardCode]) ? $brands[$CardCode] : null;
Expand Down
25 changes: 25 additions & 0 deletions Block/Product/ProductRecurrence.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,23 @@ public function __construct(
$this->_localeFormat = $localeFormat;
}

/**
* Get cache key informative items
*
* @return array
*/
public function getCacheKeyInfo()
{
return [
'BLOCK_TPL',
$this->_storeManager->getStore()->getCode(),
$this->getTemplateFile(),
'base_url' => $this->getBaseUrl(),
'template' => $this->getTemplate(),
'current_product' => $this->getCurrentProduct()->getId(),
];
}

/**
* Returns the current product from the registry.
*
Expand All @@ -82,6 +99,14 @@ public function getCurrentProduct()
return $this->_registry->registry('current_product');
}

public function getProductId(): int
{
try {
return $this->getCurrentProduct()->getId();
} catch (\Exception $e) {
return 0;
}
}
/**
* Returns the name of a plan by its ID.
*
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## [2.2.0 - 14/01/2025](https://github.com/vindi/vindi-magento2/releases/tag/2.2.0)

- Novo layout do cartão de crédito na página de checkout
- Nova Configuração de Templates Personalizados para Notificação de Link de Pagamento
- Novo Recurso de cancelamento de Pedidos com Link de Pagamento Expirado Após 30 Dias

## [2.1.0 - 30/10/2024](https://github.com/vindi/vindi-magento2/releases/tag/2.1.0)

Expand Down
67 changes: 67 additions & 0 deletions Console/Command/RunCancelOrdersWithExpiredLinks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

declare(strict_types=1);

namespace Vindi\Payment\Console\Command;

use Vindi\Payment\Cron\CancelOrdersWithExpiredLinks;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Psr\Log\LoggerInterface;

class RunCancelOrdersWithExpiredLinks extends Command
{
/**
* @var CancelOrdersWithExpiredLinks
*/
private CancelOrdersWithExpiredLinks $cancelOrdersWithExpiredLinks;

/**
* @var LoggerInterface
*/
private LoggerInterface $logger;

/**
* @param CancelOrdersWithExpiredLinks $cancelOrdersWithExpiredLinks
* @param LoggerInterface $logger
*/
public function __construct(
CancelOrdersWithExpiredLinks $cancelOrdersWithExpiredLinks,
LoggerInterface $logger
) {
$this->cancelOrdersWithExpiredLinks = $cancelOrdersWithExpiredLinks;
$this->logger = $logger;
parent::__construct();
}

/**
* Configure the command
*/
protected function configure()
{
$this->setName('vindi:payment:cancel-orders-with-expired-links');
$this->setDescription('Manually run the cron to cancel orders with expired payment links');
parent::configure();
}

/**
* Execute the command
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
try {
$this->cancelOrdersWithExpiredLinks->execute();
$output->writeln('<info>Orders with expired payment links have been canceled successfully.</info>');
return Command::SUCCESS;
} catch (\Exception $e) {
$this->logger->error('Error while canceling orders with expired payment links: ' . $e->getMessage());
$output->writeln('<error>An error occurred while canceling orders with expired payment links.</error>');
return Command::FAILURE;
}
}
}
26 changes: 24 additions & 2 deletions Controller/Checkout/Success.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
* @category Vindi
* @package Vindi_Payment
*
*
*/

namespace Vindi\Payment\Controller\Checkout;
Expand All @@ -24,6 +23,7 @@
use Magento\Framework\Message\ManagerInterface;
use Vindi\Payment\Helper\Data;
use Vindi\Payment\Model\PaymentLinkService;
use Magento\Sales\Model\OrderRepository;

class Success implements HttpGetActionInterface
{
Expand Down Expand Up @@ -57,21 +57,28 @@ class Success implements HttpGetActionInterface
*/
private ManagerInterface $messageManager;

/**
* @var OrderRepository
*/
private OrderRepository $orderRepository;

/**
* @param PageFactory $resultPageFactory
* @param PaymentLinkService $paymentLinkService
* @param RequestInterface $request
* @param RedirectFactory $redirectFactory
* @param Data $helperData
* @param ManagerInterface $messageManager
* @param OrderRepository $orderRepository
*/
public function __construct(
PageFactory $resultPageFactory,
PaymentLinkService $paymentLinkService,
RequestInterface $request,
RedirectFactory $redirectFactory,
Data $helperData,
ManagerInterface $messageManager
ManagerInterface $messageManager,
OrderRepository $orderRepository
)
{
$this->resultPageFactory = $resultPageFactory;
Expand All @@ -80,6 +87,7 @@ public function __construct(
$this->redirectFactory = $redirectFactory;
$this->helperData = $helperData;
$this->messageManager = $messageManager;
$this->orderRepository = $orderRepository;
}

/**
Expand All @@ -98,6 +106,20 @@ public function execute()

return $this->redirectFactory->create()->setPath('/');
}

$paymentLink = $this->paymentLinkService->getPaymentLinkByOrderId($orderId);

if ($paymentLink && $paymentLink->getSuccessPageAccessed()) {
$this->messageManager->addWarningMessage(
__('The payment success page has already been accessed.')
);

return $this->redirectFactory->create()->setPath('/');
}

$paymentLink->setSuccessPageAccessed(true);
$this->paymentLinkService->savePaymentLink($paymentLink);

} catch (\Exception $e) {
$this->messageManager->addErrorMessage(
__('An error occurred while processing your request. Please try again later.')
Expand Down
20 changes: 14 additions & 6 deletions Controller/PaymentProfile/Save.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Magento\Framework\App\ResponseInterface;
use Magento\Framework\Exception\NotFoundException;
use Magento\Framework\View\Result\PageFactory;
use Vindi\Payment\Model\Payment\PaymentMethod;
use Vindi\Payment\Model\Payment\Profile as PaymentProfileManager;
use Vindi\Payment\Model\PaymentProfileFactory;
use Vindi\Payment\Model\PaymentProfileRepository;
Expand Down Expand Up @@ -80,6 +81,11 @@ class Save extends Action
*/
protected $api;

/**
* @var PaymentMethod
*/
protected $paymentMethod;

/**
* @param Context $context
* @param PageFactory $resultPageFactory
Expand All @@ -93,6 +99,7 @@ class Save extends Action
* @param SubscriptionFactory $subscriptionFactory
* @param SubscriptionResource $subscriptionResource
* @param Api $api
* @param PaymentMethod $paymentMethod
*/
public function __construct(
Context $context,
Expand All @@ -106,7 +113,8 @@ public function __construct(
VindiCustomer $vindiCustomer,
SubscriptionFactory $subscriptionFactory,
SubscriptionResource $subscriptionResource,
Api $api
Api $api,
PaymentMethod $paymentMethod
) {
parent::__construct($context);
$this->resultPageFactory = $resultPageFactory;
Expand All @@ -120,6 +128,7 @@ public function __construct(
$this->subscriptionFactory = $subscriptionFactory;
$this->subscriptionResource = $subscriptionResource;
$this->api = $api;
$this->paymentMethod = $paymentMethod;
}

/**
Expand Down Expand Up @@ -210,7 +219,7 @@ public function execute()
* @param int $customerId
* @return array
*/
private function formatPaymentProfileData($data, $customerId)
private function formatPaymentProfileData(array $data, $customerId): array
{
$cardNumber = preg_replace('/\D/', '', $data['cc_number']);

Expand All @@ -219,17 +228,16 @@ private function formatPaymentProfileData($data, $customerId)
$cardExpiration = $expirationParts[0] . '/' . $expirationYear;
$paymentCompanyCode = $data['cc_type'];

$formattedData = [
$ccTypeCode = $this->paymentMethod->getCreditCardApiCode($paymentCompanyCode);
return [
'holder_name' => $data['cc_name'],
'card_expiration' => $cardExpiration,
'card_number' => $cardNumber,
'card_cvv' => $data['cc_cvv'],
'customer_id' => $customerId,
'payment_company_code' => $paymentCompanyCode,
'payment_company_code' => $ccTypeCode,
'payment_method_code' => 'credit_card',
];

return $formattedData;
}

/**
Expand Down
Loading

0 comments on commit 97c699e

Please sign in to comment.