Class: Privacy::ProcessorDetachWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Job
Defined in:
app/workers/privacy/processor_detach_worker.rb

Overview

Sidekiq worker: detaches payment-processor-side state (Stripe Customer,
PayPal vault customer) after the local scrub has already completed.

Split from DataDeletionWorker so a flaky outbound API call to
Stripe or PayPal cannot roll back the local-data scrub. If this worker
fails repeatedly, the local data is still anonymized; admin reviews the
failure and either retries or detaches manually in the processor's
dashboard.

The party row referenced by the deletion_request was retained
(anonymized, not destroyed) so we can still read its
stripe_customer_id / paypal_vault_customer_id after the local
scrub. ScrubService intentionally leaves those columns
alone for this reason — this worker clears them after the processor
acks.
Sidekiq worker: async processor-side payment detach.

Instance Method Summary collapse

Instance Method Details

#perform(deletion_request_id) ⇒ Object

Runs the job.

Parameters:

  • deletion_request_id (Integer)

    the deletion request id

Returns:

  • (Object)

    the result



29
30
31
32
33
34
35
36
37
38
# File 'app/workers/privacy/processor_detach_worker.rb', line 29

def perform(deletion_request_id)
  req = Privacy::DeletionRequest.find_by(id: deletion_request_id)
  return unless req

  party = req.party
  return unless party

  detach_stripe!(party)
  detach_paypal!(party)
end