It seems there could be some serious errors for customer remote IDs.
It could happen when the "provider" is not properly set and it could be used by different Gateways with different API credentials (different merchand accounts)

For example #2859424: Braintree customer IDs are reused when the environment changes, this is for Braintree Payments integration
So there could be similar issues on other integrations, as Commerce Stripe and Commerce paymill

And maybe others.

1. So we need to help the existing issues, but updating the data there.
- Use payment gateway ids instead of module names for provider column.
- Clean-up the orphaned remote_ids, some remote_ids that were not usable anymore.

2. Provide API for the payments integrations that could help avoiding this issue

Comments

vasike created an issue. See original summary.

vasike’s picture

Title: Better handling of customer remote IDs » Better handling of customer remote IDs for payments.
Status: Active » Needs review

and there is a PR for this
https://github.com/drupalcommerce/commerce/pull/676

- Update script for updating the exising data (@see 1. in description).

- New methods for PaymentMethod entity to help Integrations: getOwnerRemoteId() & setOwnerRemoteId()
It uses the payment gateway id for the provider value.

- Update the PaymentMethodTest with new methods.

Questions:
- Do we need something else here?
- Why the user field is called : "commerce_remote_id", it looks too generic.
maybe a more specific name would be better: payment_method_remote_id or commerce_payment_remote_id?

ToDo:
Update other modules to use the new API, if approved.

waiting for feedback

vasike’s picture

PR updated: Move the helper methods to PaymentGatewayBase from PaymentMethod.

bojanz’s picture

Title: Better handling of customer remote IDs for payments. » Rework the handling of customer remote IDs for payments
Assigned: vasike » bojanz
Priority: Normal » Major

Wrapping this up.

  • bojanz committed 14786dd on 8.x-2.x
    Issue #2861181 by vasike, bojanz: Rework the handling of customer remote...
bojanz’s picture

Status: Needs review » Fixed

Rewrote the method to be self-healing, removing the need for an update hook.

Thank you vasike for getting this started.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.