Customer code to mark_as_confirmed is not used at the moment
Problem
In the Customer model, there is a before_create
callback that sets the Customer as confirmed if the zuora_account_id
is set. This was introduced about 4 years ago in https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/322+.
I found when removing the account_data_structure
feature flag, that this code may not be working as originally intended anymore. This code requires the zuora_accound_id
is set when the customer is being created to automatically set it as confirmed. However, the zuora_account_id
method is overwritten in Customer so when this callback is executed, it may be using the overwritten method that pulls the zuora_account_id
from the related billing_account, rather than the zuora_account_id
column the Customer object. This column will eventually be removed anyway so either way this will need to be revisited.
Proposal
Instead of using a callback, we could explore updating the FindOrCreateCustomerService
with logic that sets the object as confirmed (using mark_as_confirmed
) if the account_id
exists on create.