• If order was made but was not paid, you can still pay it later on, but paysera does not load payment methods and countries, due to the fact that it is checking only for grand total in cart and no where else if cart is 0, no methods are displayed because no payment methods support 0 amount.

    Here is the hardcode that made it work:

        public function generatePaymentField(): string
        {
            $billingCountry = strtolower(WC()->customer->get_billing_country());
    
            $paymentField = '';
    
            if ($this->payseraPaymentSettings->isListOfPaymentsEnabled() === true) {
                $amount = round(WC()->cart->cart_contents_total * 100);
                if ($amount == 0 && isset($wp->query_vars['order-pay']) && absint($wp->query_vars['order-pay']) > 0) {
                    $order_id = absint($wp->query_vars['order-pay']); // The order ID
    
                    $order = wc_get_order($order_id); // Get the WC_Order Object instance
                    $amount = round($order->get_total() * 100);
                }
    
                $countries = $this->getCountries(
                    $this->payseraPaymentLibraryHelper->getPaymentMethodList(
                        $this->payseraPaymentSettings->getProjectId(),
                        $amount,
                        get_woocommerce_currency(),
                        $this->getLanguage()
                    )
                );
    
                if (count($countries) > 1) {
                    $paymentField .= $this->payseraPaymentFrontHtml->buildCountriesList($countries, $billingCountry)
                        . '<br/>'
                    ;
                }
    
                $paymentField .= $this->payseraPaymentFrontHtml->buildPaymentsList(
                    $countries,
                    $this->payseraPaymentSettings->isGridViewEnabled(),
                    $billingCountry
                );
            } else {
                $paymentField = $this->payseraPaymentSettings->getDescription() . '<br/>';
            }
    
            if ($this->payseraPaymentSettings->isBuyerConsentEnabled() === true) {
                $paymentField .= '<br/>' . $this->payseraPaymentFrontHtml->buildBuyerConsent();
            }
    
            return $paymentField;
        }
    

    in woo-payment-gateway-paysera/src/Generator/PayseraPaymentFieldGenerator.php

    The change is that I have moved: round(WC()->cart->cart_contents_total * 100) to variable $amount and then checked whether it is 0 and if true, whether there is order-pay query variable in context and if it is, retrieve order total amount and use it as $amount. This way it works.

    Can you make sure this change appears in upcoming release?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Paysera does not support order-pay screen’ is closed to new replies.