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: subscription_charged_successfully.rb
    path of file: ./repos/pay/lib/pay/braintree/webhooks
    
    the code of the file until where you have to start completion: # A subscription successfully moves to the next billing cycle. This will also occur when either a new tran
    
        def call(event)
          subscription = event.subscription
          return if subscription.nil?

          pay_subscription = Pay::Subscription.find_by_processor_and_id(:braintree, subscription.id)
          return unless pay_subscription.present?

          charge = subscription.transactions.first
          pay_charge = Pay::Braintree::Charge.sync(charge.id, object: charge)

          if pay_charge && Pay.send_email?(:receipt, pay_charge)
            Pay.mailer.with(pay_customer: pay_subscription.customer, pay_charge: pay_charge).receipt.deliver_later
          end