This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Used when a practice's patients have been transferred to Stripe from | |
# another payment processing platform and we need to associate their Stripe | |
# customers with their Hint patients. This is done by matching credit card name | |
# to patient name or to email, or to address, or hint hid. | |
def get_customers(practice, params = nil) | |
response = Stripe::Customer.all(params, practice.stripe_token) | |
response.data.each do |customer| | |
stripe_customer_id = customer.id | |
source_with_name = customer.sources.data.find { |source| source.try(:name) } |