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: charge.rb
    path of file: ./repos/pay/lib/pay/braintree
    
    the code of the file until where you have to start completion: module Pay
  module Braintree
    class Charge
      attr_reader :pay_charge

      delegate :processor_id, to: :pay_charge

      def self.sync(charge_id, object: nil, try: 0, retries: 1)
        object ||= Pay.braintree_gateway.transaction.find(charge_id)

        pay_customer = Pay::Customer.find_by(processor: :braintree,
    
      def self.sync(charge_id, object: nil, try: 0, retries: 1)
        object ||= Pay.braintree_gateway.transaction.find(charge_id)

        pay_customer = Pay::Customer.find_by(processor: :braintree, processor_id: object.customer_details.id)
        return unless pay_customer

        pay_customer.save_transaction(object)
      rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique
        try += 1
        if try <= retries
          sleep 0.1
          retry
        else
          raise
        end