Conditional Cash on delivery payment

Hello,



Is it possible to modify a little bit “cash on delivery payment method”?



The idea is to charge for example 2 % extra for this payment method (this is standard option)



and if the total amount is over let us say 400 $ then the surcharge is 0%



Thanks in advance