I got the problem so all recurring orders don't have total_paid values. After debugging I've found that next code in closeOrder() method:

    $payment_gateway_plugin->createPayment($payment);

    $order->getState()->applyTransitionById('mark_paid');
    $order->save();

So it creates payment but payment entity has postSave() method which updates order entity with total_paid value.

But in closeOrder() method we don't reload order so we don't know about this update and override total_paid value with initial empty value.

Comments

nnevill created an issue. See original summary.

nnevill’s picture

Version: 8.x-1.0-beta4 » 8.x-1.x-dev
Status: Active » Needs review

Here is patch which reloads order to have updated total_paid value after payment creation. I don't like that solution a lot but it works :)

nnevill’s picture

bojanz’s picture

Are you sure you're running latest Commerce?

Cause Payment doesn't save orders on postSave since Commerce 2.14, to avoid the problem described here.

jonathanshaw’s picture

Status: Needs review » Closed (outdated)