[BUG] Maintain consistency between `PaymentIntent` and `PaymentAttempt` for `connector_id`
Context
Our payment records are split in 2 parts:-
- PaymentAttempt
- PaymentIntent
Payment Intent
This is similar to an order and represents the customer's intent to make a payment... It could be a single cart that the customer is trying to pay for or a single order that the customer is trying to pay for... These are built incrementally by collecting paymentMethodData, customer details, address etc until the customer/merchant confirms the intent at which point we make an attempt to actually charge the consumer for his order
Payment Attempt
This represents an individual payment attempt or transaction for which a user is paying for... There can be multiple payment attempts associated with a payment Intent (since the user can retry on a failed attempt)... Once a payment attempt is succeded we mark the payment intent as successful as well, In case of failures the consumer can retry by creating new attempts...
Bug
We update the PaymentIntent with the latest attempt_id each time an attempt is made or updated... Similarly we also update the status of PaymentIntent based on the underlying status of PaymentAttempt...
However we don't update the connector_id when the attempt is updated...
It seems currently we rely on PaymentIntentUpdate::PaymentAttemptUpdate & PaymentIntentUpdate::StatusAndAttemptUpdate
here
We should also be updating the connector ID when updating this attempt details