Skip to content

Commit

Permalink
Merge pull request vindi#34 from cedran/master
Browse files Browse the repository at this point in the history
fix: error in billing_trigger_type when saving plan
  • Loading branch information
contardi authored May 23, 2024
2 parents 3b2a980 + c299289 commit 4c98160
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 18 deletions.
8 changes: 7 additions & 1 deletion Controller/Adminhtml/VindiPlan/Save.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ private function validatePostData($post)
{
$settings = $post['settings'] ?? [];

if (empty($settings['billing_trigger_type'])) {
return __('Billing method cannot be empty.');
}

if ($settings["billing_trigger_type"] == 'day_of_month' && !empty($settings["interval_count"]) && $settings["interval_count"] > 1) {
return __('This billing method only supports monthly plans, i.e., month-to-month.');
}
Expand Down Expand Up @@ -223,10 +227,12 @@ private function prepareData($post, $name, $code)
}

if (!empty($post["settings"]["billing_trigger_type"])) {
$data['billing_trigger_type'] = $post["settings"]["billing_trigger_type"];
if ($post["settings"]['billing_trigger_type'] == 'day_of_month') {
$data['billing_trigger_day'] = $post["settings"]["billing_trigger_day"] ?? null;
} elseif ($post["settings"]['billing_trigger_type'] == 'based_on_period') {
$data['billing_trigger_day'] = $post["settings"]["billing_trigger_day_type_on_period"] ?? null;
$data['billing_trigger_day'] = $post["settings"]["billing_trigger_day_type_on_period"] ?? null;
$data['billing_trigger_type'] = $post["settings"]['billing_trigger_day_based_on_period'] ?? null;
}
}

Expand Down
79 changes: 78 additions & 1 deletion i18n/pt_BR.csv
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@
"Can be used for recurring purchases?","Pode ser usado para compras recorrentes?"
"We are finalizing the processing of your payment via Pix.", "Estamos finalizando o processamento do seu pagamento via Pix."
"How does it work?", "Como funciona?"
"You will receive the QR Code to make the payment according to the scheduled date of your next recurrence, on the day <strong>...</strong>. This QR Code will be sent to your registered email and will also be available in your client area on our website.", "Você receberá o QR Code para efetuar o pagamento conforme a data programada de sua próxima recorrência, no dia <strong>...</strong>. Esse QR Code será enviado para o seu e-mail cadastrado e também estará disponível em sua área do cliente em nosso site."
"Why this wait?", "Por que essa espera?"
"This ensures that the charge is aligned with the cycle of your subscription and that you always have full control over the payments.", "Isso garante que a cobrança seja alinhada com o ciclo de sua assinatura e você tenha sempre o controle total sobre os pagamentos."
"What to do now?", "O que fazer agora?"
Expand All @@ -309,3 +308,81 @@
"You can access your order details and complete the payment by visiting the following link:", "Você pode acessar os detalhes do seu pedido e concluir o pagamento visitando o seguinte link:"
"Thank you for your trust in our services!", "Obrigado pela confiança em nossos serviços!"
"QR Code and/or Bank Slip Available for Payment","QR Code e/ou Boleto Disponível para Pagamento"
"You will receive the QRCode to make the payment according to the scheduled date of your next recurrence. This QRCode will be sent to your registered email and will also be available in your client area on our website.","Você receberá o QRCode para fazer o pagamento de acordo com a data agendada de sua próxima recorrência. Este QRCode será enviado para seu e-mail cadastrado e também estará disponível na sua área de cliente em nosso site."
"You will receive the QRCode to make the payment according to the scheduled date of your next recurrence, on the day","Você receberá o QRCode para fazer o pagamento de acordo com a data agendada de sua próxima recorrência, no dia"
"This QRCode will be sent to your registered email and will also be available in your client area on our website.","Este QRCode será enviado para seu e-mail cadastrado e também estará disponível na sua área de cliente em nosso site."
"You will receive the BankSlip to make the payment according to the scheduled date of your next recurrence, on the day","Você receberá o Boleto para fazer o pagamento de acordo com a data agendada de sua próxima recorrência, no dia"
"This BankSlip will be sent to your registered email and will also be available in your client area on our website.","Este Boleto será enviado para seu e-mail cadastrado e também estará disponível na sua área de cliente em nosso site."
"You will receive the BankSlip to make the payment according to the scheduled date of your next recurrence. This BankSlip will be sent to your registered email and will also be available in your client area on our website.","Você receberá o Boleto para fazer o pagamento de acordo com a data agendada de sua próxima recorrência. Este Boleto será enviado para seu e-mail cadastrado e também estará disponível na sua área de cliente em nosso site."
"Subscription Detail","Detalhes da Assinatura"
"Pedido","Order"
"Detalhes da assinatura","Subscription Details"
"Assinatura","Subscription"
"Item","Item"
"Valor","Amount"
"Próxima cobrança","Next Billing"
"Duração","Duration"
"Periodicidade","Frequency"
"Data de início","Start Date"
"Status","Status"
"Método de pagamento","Payment Method"
"Editar método","Edit Method"
"Cobranças","Billing"
"Período","Period"
"Cobrança","Billing Date"
"Valor","Amount"
"Aguardando pagamento","Awaiting Payment"
"Pagamento aprovado","Payment Approved"
"Ver cobrança","View Billing"
"Endereço de entrega","Shipping Address"
"Informações","Information"
"Editar endereço","Edit Address"
"Cancelar assinatura","Cancel Subscription"
"Esta assinatura não existe ou você não tem permissão para visualizá-la.","This subscription does not exist or you do not have permission to view it."
"Subscription Details","Detalhes da Assinatura"
"Next Billing","Próxima Cobrança"
"Billing Date","Data de Cobrança"
"Edit Method","Editar Método"
"View Billing","Ver Cobrança"
"1 day after the end","1 dia após o término"
"%1 days after the end","%1 dias após o término"
"%1 days before the end","%1 dias antes do término"
"Exactly on day %1 of each month","Exatamente no dia %1 de cada mês"
"Details","Detalhes"
"Customer","Cliente"
"Status","Status"
"Since","Desde"
"Plan","Plano"
"Frequency","Periodicidade"
"Billing","Cobrança"
"Next Billing","Próxima Cobrança"
"Payment Method","Método de pagamento"
"Products","Produtos"
"Product","Produto"
"Quantity","Quantidade"
"Duration","Duração"
"Price","Preço"
"No products found.","Nenhum produto encontrado."
"Periods","Períodos"
"Period","Período"
"Cycle","Ciclo"
"No periods found.","Nenhum período encontrado."
"Discounts","Descontos"
"Discount","Desconto"
"No discounts found.","Nenhum desconto encontrado."
"Payment Methods","Métodos de pagamento"
"Card","Cartão"
"Edit method","Editar método"
"No payment methods found.","Nenhum método de pagamento encontrado."
"Billings","Cobranças"
"ID","ID"
"Order ID","Order ID"
"Created at","Criado em"
"Total","Total"
"View","Visualizar"
"No orders found.","Nenhum pedido encontrado."
"Subscription canceled successfully.","Assinatura cancelada com sucesso."
"Something went wrong while cancel the Subscription.","Algo deu errado ao cancelar a assinatura."
"Are you sure you want to cancel your subscription?", "Tem certeza de que deseja cancelar sua assinatura?"
"Permanent","Permanente"
"Billing method cannot be empty.","O método de cobrança não pode estar vazio."
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</item>
</argument>
<settings>
<!-- <validateUrl path="customer/index/validate"/>-->
<!-- <validateUrl path="customer/index/validate"/> -->
<submitUrl path="vindi_payment/vindiplan/save"/>
</settings>
<dataProvider class="Vindi\Payment\Model\VindiPlan\DataProvider" name="vindi_payment_vindiplan_data_source">
Expand Down
15 changes: 7 additions & 8 deletions view/frontend/templates/onepage/bankslippix.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ use Vindi\Payment\Block\Onepage\Bankslippix;

<?php if ($this->canShowBankSlipPix()) : ?>
<div class="checkout-success qr-code">
<p>
<?= $block->getInfoMessageOnepageSuccess() ?>
</p>

<?php if ($block->getQrCodePix()) : ?>
<p>
<?= $block->getInfoMessageOnepageSuccess() ?>
</p>
<object data="<?= $block->getQrCodePix() ?>" type="image/svg+xml" class="qr-code" id="qrcode">
<button
id="vindi-pix-button-open"
Expand Down Expand Up @@ -46,14 +45,14 @@ use Vindi\Payment\Block\Onepage\Bankslippix;
</button>
</div>
<?php else: ?>
<div class="pix-subscription-info" style="text-align: center; display: flex; justify-content: center; flex-direction: column; align-items: center;">
<p><?= __('We are finalizing the processing of your payment via Bankslip.') ?></p>
<div class="pix-subscription-info" style="text-align: justify; display: flex; justify-content: center; flex-direction: column; align-items: center;">
<p><?= __('We are finalizing the processing of your payment via Pix.') ?></p>
<h2><?= __('How does it work?') ?></h2>
<?php $nextBillingDate = $block->getNextBillingDate(); ?>
<?php if ($nextBillingDate): ?>
<p><?= __('You will receive the Bankslip to make the payment according to the scheduled date of your next recurrence, on the day <strong>' . $nextBillingDate . '</strong>. This Bankslip will be sent to your registered email and will also be available in your client area on our website.') ?></p>
<p><?= __('You will receive the BankSlip to make the payment according to the scheduled date of your next recurrence, on the day'); ?>&nbsp;<?= "<strong>" . $nextBillingDate . ".</strong>" ?>&nbsp;<?= __('This BankSlip will be sent to your registered email and will also be available in your client area on our website.') ?></p>
<?php else: ?>
<p><?= __('You will receive the Bankslip to make the payment according to the scheduled date of your next recurrence. This Bankslip will be sent to your registered email and will also be available in your client area on our website.') ?></p>
<p><?= __('You will receive the BankSlip to make the payment according to the scheduled date of your next recurrence. This BankSlip will be sent to your registered email and will also be available in your client area on our website.') ?></p>
<?php endif; ?>
<h2><?= __('Why this wait?') ?></h2>
<p><?= __('This ensures that the charge is aligned with the cycle of your subscription and that you always have full control over the payments.') ?></p>
Expand Down
13 changes: 6 additions & 7 deletions view/frontend/templates/onepage/pix.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ use Vindi\Payment\Block\Onepage\Pix;

<?php if ($block->canShowPix()) : ?>
<div class="checkout-success qr-code">
<p>
<?= $block->getInfoMessageOnepageSuccess() ?>
</p>

<?php if ($block->getQrCodePix()) : ?>
<p>
<?= $block->getInfoMessageOnepageSuccess() ?>
</p>
<object data="<?= $block->getQrCodePix() ?>" type="image/svg+xml" class="qr-code" id="qrcode">
<p>
<?= $block->getQrCodeWarningMessage() ?>
Expand All @@ -34,14 +33,14 @@ use Vindi\Payment\Block\Onepage\Pix;
</div>
</div>
<?php else: ?>
<div class="pix-subscription-info" style="text-align: center; display: flex; justify-content: center; flex-direction: column; align-items: center;">
<div class="pix-subscription-info" style="text-align: justify; display: flex; justify-content: center; flex-direction: column; align-items: center;">
<p><?= __('We are finalizing the processing of your payment via Pix.') ?></p>
<h2><?= __('How does it work?') ?></h2>
<?php $nextBillingDate = $block->getNextBillingDate(); ?>
<?php if ($nextBillingDate): ?>
<p><?= __('You will receive the QR Code to make the payment according to the scheduled date of your next recurrence, on the day <strong>' . $nextBillingDate . '</strong>. This QR Code will be sent to your registered email and will also be available in your client area on our website.') ?></p>
<p><?= __('You will receive the QRCode to make the payment according to the scheduled date of your next recurrence, on the day'); ?>&nbsp;<?= "<strong>" . $nextBillingDate . ".</strong>" ?>&nbsp;<?= __('This QRCode will be sent to your registered email and will also be available in your client area on our website.') ?></p>
<?php else: ?>
<p><?= __('You will receive the QR Code to make the payment according to the scheduled date of your next recurrence. This QR Code will be sent to your registered email and will also be available in your client area on our website.') ?></p>
<p><?= __('You will receive the QRCode to make the payment according to the scheduled date of your next recurrence. This QRCode will be sent to your registered email and will also be available in your client area on our website.') ?></p>
<?php endif; ?>
<h2><?= __('Why this wait?') ?></h2>
<p><?= __('This ensures that the charge is aligned with the cycle of your subscription and that you always have full control over the payments.') ?></p>
Expand Down

0 comments on commit 4c98160

Please sign in to comment.