Sha256: ad994ce87be96eb64395b19e635cc2a9828ace02ea5d8790f8e4be491499d53b
Contents?: true
Size: 813 Bytes
Versions: 40
Compression:
Stored size: 813 Bytes
Contents
module Pay module Billable module SyncCustomer # Syncs customer details to the payment processor. # This way they're kept in sync and email notifications are # always sent to the correct email address after an update. extend ActiveSupport::Concern included do after_update_commit :enqeue_customer_sync_job, if: :pay_should_sync_customer? end def pay_should_sync_customer? try(:saved_change_to_email?) end private def enqeue_customer_sync_job if pay_should_sync_customer? # Queue job to update each payment processor for this customer pay_customers.pluck(:id).each do |pay_customer_id| CustomerSyncJob.perform_later(pay_customer_id) end end end end end end
Version data entries
40 entries across 40 versions & 1 rubygems