Problem/Motivation

Heloo!
So, i've installed the module today. We are still testing the payment methods.
After the payment is done, there is a link to redirect to https://domain.pt/checkout/212/complete, however drupal automatically redirects to the payment page again "https://domain.pt/checkout/212/payment".

Also got an warning, not sure if it is related:

Deprecated function: Function money_format() is deprecated in Drupal\commerce_monetico\PluginForm\MoneticoPaymentForm->buildConfigurationForm() (line 74 of modules/commerce_monetico/src/PluginForm/MoneticoPaymentForm.php).

Drupal\commerce_monetico\PluginForm\MoneticoPaymentForm->buildConfigurationForm(Array, Object) (Line: 108)
Drupal\commerce_payment\Plugin\Commerce\InlineForm\PaymentGatewayForm->buildInlineForm(Array, Object) (Line: 218)
Drupal\commerce_payment\Plugin\Commerce\CheckoutPane\PaymentProcess->buildPaneForm(Array, Object, Array) (Line: 546)
Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowWithPanesBase->buildForm(Array, Object, 'payment')
call_user_func_array(Array, Array) (Line: 532)
Drupal\Core\Form\FormBuilder->retrieveForm('commerce_checkout_flow_multistep_default', Object) (Line: 278)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 219)
Drupal\Core\Form\FormBuilder->getForm(Object, 'payment') (Line: 143)
Drupal\commerce_checkout\Controller\CheckoutController->formPage(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 578)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 717)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

Not much, but please do tell me if you need more information.

Comments

filipetakanap created an issue. See original summary.

filipetakanap’s picture

Issue summary: View changes
filipetakanap’s picture

Issue summary: View changes
filipetakanap’s picture

ok, i found a fix for the bad redirections here on the forum. But it still shows that warning.

steveoriol’s picture

Inside "commerce_monetico/src/PluginForm/CmcicPaymentForm.php"

    // Amount : format  "xxxxx.yy" (no spaces).
    $s_amount = money_format('%.2n', $amount);

"money_format" has been DEPRECATED as of PHP 7.4.0, and REMOVED as of PHP 8.0.0 (here)

So, we need to find a way to replace this function soon ;-)

yom’s picture

Hi,
Since the deprecation of number_format() the module couldn't work with PHP 8.0.0,
the payment window/form doesn't show, just this error above.

I just managed to make it work by simply change this in src\PluginForm\MoneticoPaymentForm.php :

// Amount : format  "xxxxx.yy" (no spaces).
    $s_amount = money_format('%.2n', $amount);

by this :

// Amount : format  "xxxxx.yy" (no spaces).
    $s_amount = number_format($amount, 2, '.', '');

I wouldn't call myself a developer, it may be messy…

Anyway it works like a charme and the currency is well detected…

steveoriol’s picture

Status: Active » Fixed

Thank you yom, I commited your patch.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

yom’s picture

Hi,
I saw that the patch for the deprecated money format has been committed, it could be great to had the patch for "Order Completion redirects again to Payment" too.
thanks

steveoriol’s picture

Status: Closed (fixed) » Needs review
Related issues: +#3211010: Replace redirect and cancel URLs by PaymentProcess generated ones

OK, this needs review as well as the issue https://www.drupal.org/project/commerce_monetico/issues/3211010
The MR https://git.drupalcode.org/project/commerce_monetico/-/merge_requests/3 as the same changes that the patch #9
I will commit as soon as I have one or two positive feedback ;-)

steveoriol’s picture

Status: Needs review » Closed (outdated)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.