Generalizing create/update validation on form and api
Monish, I think the problem is that if you use the api to change the total amount &amp; don't pass in other amount values the BAO should assume that net_amount has now changed similarly. I thought we had done something in the BAO - but maybe only on new contributions.

I think at the BAO level adding this logic makes sense

if (contributionTotalAmountHasChanged() &amp;&amp; empty($params['net_amount')) {
   $fee_amount = !isset($params['fee_amount'] ? 
     getFeeAmountFromDB() : $params['fee_amount'];

  $params['net_amount'] = $params['total_amount'] - $fee_amount;
}


Possibly some argy bargy around whether $params['fee_amount'] = '' vs $params['fee_amount'] = 0;

At the form level - if someone changes the total_amount then probably we should either 
1) update the other amounts using js or 
2) reset them sensibly on submission (e.g like above) &amp; present them with a notice that this has happened.

It's a bit of a pain having to change net_amount &amp; for most users the field is not relevant