Thanks for your answer.
As I said, I put plenty of $order object trace in the order class file to follow the way its content may change.
After the start of the function, the object contains the right values of the custom fields to set.
Indeed, around the lines you mention, I have :
if($recalculate)
$this->recalculateFullPrice($order);
echo "<br />apres recalculate :<pre>";print_r($order);echo "</pre>";
if(!empty($order->cart->products))
$this->recalculateDimensions($order, $order->cart->products);
elseif($recalculate_dimensions)
$this->recalculateDimensions($order);
$do = true;
if($new) {
$app->triggerEvent('onBeforeOrderCreate', array(&$order, &$do) );
} else {
$app->triggerEvent('onBeforeOrderUpdate', array(&$order, &$do) );
}
if(!$do)
return false;
echo "<br />après trigger 2 :<pre>";print_r($order);echo "</pre>";
$unsets = array('value', 'order_current_lgid', 'order_current_locale', 'mail_status', 'total_number_of_products');
foreach($unsets as $unset) {
unset($order->$unset);
}
Both dump, before and after, show the right value inside the $order object.
Around the save it self I have :
$old = $order->old;
unset($order->old);
unset($order->order_url);
unset($order->mail_params);
echo "<br />avant save :<pre>";print_r($order);echo "</pre>";
$order->order_id = parent::save($order);
echo "<br />après :<pre>";print_r($order);echo "</pre>";
$order->old = $old;
And both object (before and after) show the right content.
And lines I have mentionned near history->addRecord are the final ones. Just before it returns. At this time also, the object contains the right values.
I don't see what could be triggered between the return from the save function inside the order class (where the object is correct) and the exit in my onPaymentNotification wich stops and shows the output.
In my script, I have added the modifyOrder between the call to $updateOrder->save and the exit. This last function triggers itself again the order.class function. And, at this point, I can see that the object retrieved (old) does not contain the expected values.
What could occur between the end of the hika.order.save function where the object is right and the beginning of the hika.order.save function from the modifyOrder where the object is wrong (and order_id remain the same everywhere) ?
I am not saying something is wrong with the Hika code. I'am suspecting my own code. But something has changed between Hika 4.2.2 under Joomla 3.9.28 / Php 7.3.26 which was our previous config where this plugin where able to store data in the custom fields and our current environment (Hika 4.7.5 under J! 4.3.4 / Php 8.1.23). Except the change to the J!Framework class (\use ... Factory instead of JFactory ...), I don't see what I could have change in my plugin.
That the reason why I suspected some new constraint somewhere wich prevent the values to be stored in DB.
I ran a lot of debug tests. I'll try to hack a working payment plugin to see if it save....
I'm not expecting you to debug my code. I'm just trying to exchange with the hika code experts in order to make my mind going toward the solution.