Duplicate payments created for non paypal payment methods.

We recently noticed a duplicate payment were being created when using a credit card payment method on a site we have updated. I tracked it down to the checkout controller decorator for paypal express, specifically updating attributes on the order object before checking if the payment type is paypal...
Updating the order object uses accepts_nested_attributes_for the payment details, so when called on in the checkout controller decorator it creates a payment for the order. The code then continues, checks if the payment method is paypal, which is isnt, and bails out of the filter continuing to update action. The update action then updates the order object again, and due to the nested attributes not being associated with the payment object's id that was created in the checkout controller decorator, it goes ahead and creates a whole new payment for the order, which of course is a duplicate.

The fix is very simple, I have just modified the controller filter to check the type of payment method before the order is updated, if it isn't paypal the method bails out and allows the update action to create the payment instead.