i am new to magento. please clarify me i want to do below task

if cart amount greater than (grand total)500 then charge 10% deposit at first and before product delivery user has to pay remaining amount. if cart amount(grand total<=500) then user has to pay total amount.

how can i do this any extension is there?