Skip to content

[ECP-10044][Bug]: Full order amount has not been authorized #3352

Closed

Description

@dronerdk

Description

After update to v 11 it is not possible to capture or create invoices in magneto

Steps to reproduce

update from v 10 to 11.
Try to create invoice for and order:
Full order amount has not been authorized
The invoice can't be saved at this time. Please try again later.

If we downgrade to v 10 it works fine.

Actual behavior

Full order amount has not been authorized The invoice can't be saved at this time. Please try again later.

Expected behavior

INvoce shoud be created and amount caputred

Code snippet or screenshots (if applicable)

Image

Adyen Magento Plugin version

11

Magento version

2.4.9

Operating System

None

Browser (if applicable)

No response

Additional context and logs

No response

Activity

  1. added
    Bug reportIndicates that issue has been marked as a possible bug
    on Sep 8, 2026
  2. self-assigned this
    on Sep 8, 2026
  3. shubhamk67 commented on Sep 8, 2026

    @shubhamk67
    Contributor

    Hi @dronerdk,

    Thanks for reporting this issue.
    We tried to reproduce the error on our end using the provided steps, but we were unable to do so.
    To help us investigate further, could you provide more concrete steps to reproduce the issue? Additionally, is this happening persistently for every invoice you try to capture, or is it intermittent?
    It would also be very helpful if you could share a bit more information, such as the specific payment method used, sanitized logs, and your plugin configuration.
    You can also reach out to our tech support team at [email protected] for further investigation.

    Best regards,
    Shubham

  4. dronerdk commented on Sep 17, 2026

    @dronerdk
    Author

    @shubhamk67
    I think you need to enable partial payments.
    I could be this from version 11 that makes the problems.
    [ECP-9923] Make invoicing and order status consistent on partial payments by @shubhamk67 in #3311

    I dont know if we see the effect of order from v 10 and then update to v11

  5. candemiralp commented on Sep 17, 2026

    @candemiralp
    Contributor

    Hello @dronerdk,

    Thanks for providing extra details. I've done an extended testing with the following test cases.

    1. Partial payments with single currency configuration
    2. Partial payments with multiple currency configuration (paying both with base and store currencies)
    3. Processing payments with base charged currency on multi-currency store

    Unfortunately, we are still unable to reproduce the issue. I have the following recommendations for further debugging on your side.

    • isFullAmountAuthorized() method is responsible for checking the authorized amounts. There is a change on v11 and now the plugin calculates the total authorized amount based on payment_authorization_amount field of sales_order table. This amount is updated while processing AUTHORIZATION webhook here. Please compare the amounts.
    • Could you please verify that the order state is adyen_authorized after processing all authorization webhooks of partial payments? Same method (isFullAmountAuthorized()) is used while setting the order as pre-payment-authorized here.

    Once you get more information, we would be happy to help you out.

    Best Regards,
    Can

  6. terminalstate commented on Oct 13, 2026

    @terminalstate

    This looks like the float comparison in isFullAmountAuthorized(). It fails only for some amounts, which would explain why it doesn't reproduce with every test order.

    Each partial AUTHORISATION is added to payment_authorization_amount (AuthorisationWebhookHandler.php#L100): the part already stored comes back from sales_order as a decimal string, the new part is a float, and the sum is compared with the grand total using === (AdyenOrderPayment.php#L185-L192). For a 29.99 order paid with a 25.00 gift card and 4.99 by card, "25.0000" + 4.99 is 29.990000000000002, so the last AUTHORISATION only adds a history comment, the order is not invoiced, and a manual capture then stops in CaptureDataBuilder with "Full order amount has not been authorized" (CaptureDataBuilder.php#L79-L90). 10.00 + 20.00 works, 10.10 + 20.20 doesn't; for a gift card plus card, roughly 10–15% of order totals fail in a quick check.

    A test in AuthorisationWebhookHandlerTest, with the real isFullAmountAuthorized() and originalAmount(), fails on current main for the first two cases:

    Test
    public static function partialPaymentsCoveringTheOrderProvider(): array
    {
        return [
            // order total, amount already authorised (as loaded from sales_order), last partial payment in minor units
            'gift card 25.00 + card 4.99' => ['29.9900', '25.0000', 499],
            'gift card 10.10 + card 20.20' => ['30.3000', '10.1000', 2020],
            'gift card 10.00 + card 20.00' => ['30.0000', '10.0000', 2000],
        ];
    }
    
    /**
     * The last AUTHORISATION of a partial (split) payment completes the order amount, so the order must leave the
     * "partially authorised" branch, whatever the amounts are.
     *
     * @throws ReflectionExceptionAlias
     */
    #[DataProvider('partialPaymentsCoveringTheOrderProvider')]
    public function testLastPartialAuthorisationCompletesTheOrderAmount(
        string $grandTotal,
        string $authorizedSoFar,
        int $lastPaymentMinorUnits
    ): void {
        $order = $this->createMockWithMethods(
            Order::class,
            ['getGrandTotal', 'getPaymentAuthorizationAmount', 'setPaymentAuthorizationAmount', 'getPayment',
                'getStoreId', 'getQuoteId'],
            ['getAdyenChargedCurrency']
        );
        $authorized = $authorizedSoFar;
        $order->method('getAdyenChargedCurrency')->willReturn(ChargedCurrency::DISPLAY);
        $order->method('getGrandTotal')->willReturn($grandTotal);
        $order->method('getPaymentAuthorizationAmount')->willReturnCallback(function () use (&$authorized) {
            return $authorized;
        });
        $order->method('setPaymentAuthorizationAmount')->willReturnCallback(
            function ($amount) use (&$authorized, $order) {
                $authorized = $amount;
                return $order;
            }
        );
        $order->method('getPayment')->willReturn($this->createMock(Order\Payment::class));
        $order->method('getQuoteId')->willReturn('123');
    
        $notification = $this->createConfiguredMock(Notification::class, [
            'getPspreference' => 'ABCD1234GHJK5678',
            'getMerchantReference' => 'TestMerchant',
            'getPaymentMethod' => 'scheme',
            'isSuccessful' => true,
            'getAmountValue' => $lastPaymentMinorUnits,
            'getAmountCurrency' => 'EUR'
        ]);
    
        // Real isFullAmountAuthorized() and real originalAmount(); only their collaborators are doubled.
        $adyenOrderPayment = $this->createPartialMock(
            AdyenOrderPayment::class,
            ['createAdyenOrderPayment', 'isAllAutoCaptured']
        );
        $adyenOrderPayment->method('isAllAutoCaptured')->willReturn(true);
        $adyenHelper = $this->createPartialMock(Data::class, []);
    
        $orderHelper = $this->createMock(OrderHelper::class);
        $orderHelper->expects($this->never())->method('addWebhookStatusHistoryComment');
        $orderHelper->expects($this->once())->method('setPrePaymentAuthorized')->willReturn($order);
        $orderHelper->method('finalizeOrder')->willReturn($order);
    
        $cartRepository = $this->createMock(CartRepositoryInterface::class);
        $cartRepository->method('get')->willReturn($this->quoteMock);
    
        $handler = $this->createAuthorisationWebhookHandler(
            $adyenOrderPayment,
            $orderHelper,
            null,
            null,
            null,
            null,
            null,
            $this->createConfiguredMock(PaymentMethods::class, ['isAutoCapture' => true]),
            $cartRepository,
            null,
            null,
            $adyenHelper
        );
    
        $method = $this->getPrivateMethod(AuthorisationWebhookHandler::class, 'handleSuccessfulAuthorisation');
        $method->invokeArgs($handler, [$order, $notification]);
    }

    Comparing at the column's precision makes it pass, and the rest of the class and AdyenOrderPaymentTest still pass:

    ChargedCurrency::BASE => $this->isSameAmount($order->getBaseGrandTotal(), $order->getPaymentAuthorizationAmount()),
    ChargedCurrency::DISPLAY => $this->isSameAmount($order->getGrandTotal(), $order->getPaymentAuthorizationAmount()),
    
    private function isSameAmount($expected, $actual): bool
    {
        return round(floatval($expected), 4) === round(floatval($actual), 4);
    }

    One more thing that would also fit "works again after downgrading to v10": only v11's AUTHORISATION handler writes payment_authorization_amount, and there is no data patch for it, so an order authorised under v10 and captured after the upgrade has it empty and fails the same check.

    I can open a PR with the test and the fix if that helps.

  7. dronerdk commented on Oct 14, 2026

    @dronerdk
    Author

    @terminalstate Thanks for investigating this. This matches exactly what we’re seeing.

    The issue only occurs on some orders after upgrading from v10 to v11, while downgrading to v10 immediately resolves it again.

    The float comparison explanation would also explain why we haven’t been able to reproduce it consistently across all test orders.

    A PR with the test and fix would definitely be helpful. Thanks!

  8. changed the title [-][Bug]: Full order amount has not been authorized[/-] [+][ECP-10044][Bug]: Full order amount has not been authorized[/+] on Oct 15, 2026
  9. candemiralp commented on Oct 15, 2026

    @candemiralp
    Contributor

    Hello @terminalstate,

    Thank you for the investigation and providing a potential solution to this. I've create a ticket and put this on our backlog.

    Best Regards,
    Can

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Bug reportIndicates that issue has been marked as a possible bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions