You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: gateway.rb
    path of file: ./repos/spree/core/app/models/spree
    
    the code of the file until where you have to start completion: module Spree
  class Gateway < PaymentMethod
    FROM_DOLLAR_TO_CENT_RATE = 100.0

    de
    
    def reusable_sources(order)
      if order.completed?
        sources_by_order order
      else
        if order.user_id
          credit_cards.where(user_id: order.user_id).with_payment_profile
        else
          []
        end