If a surety in any bond or other obligation for the payment of money or a promissory note, or the endorser of a protested draft, pays or tenders the money due on it in full, he is entitled to an assignment of it and, by virtue of the assignment, may maintain an action in his name against the principal debtor.