|| user.default_address, :store => order.store, :tax => tax, :days => 14, :buyout => false }) ! creator = options[:creator] return process_extension_without_charge!(options) if options[:no_charge] ! response = Payment::Gateway.charge!( extension_price.cents.to_f/100, options[:credit_card].ext_cc_id, self.user.id, options[:store].try(:address).try(:country) ) ! # payment failed unless response[:ext_transaction_id].present? self.order.order_responses.create(:message => response[:error]) self.errors.add(:base, response[:error]) return false end ! data = { :ext_transaction_id => response[:ext_transaction_id], :parent_order_id => self.order.id, :parent_order_item_id => self.id, :ccauth_reply_authorization_code => response[:ccauth_reply_authorization_code] } ! if options[:buyout] # it's a buyout OrderTransaction.buyout!( self.order.currency, extension_price.cents - options[:tax].cents, self, data, creator ) ! OrderTransaction.tax_charged!( self.order.currency, options[:tax].cents, self, data, creator ) ! process_convert_to_purchase! ! else # it's a regular extension begin OrderTransaction.extension!( "#{options[:days]} days", self.order.currency, extension_price.cents - options[:tax].cents, self, data, creator ) OrderTransaction.tax_charged!( self.order.currency, options[:tax].cents, self, data, creator ) # Increment extension days for current Item self.increment(:extension_days, options[:days]) self.update_attribute(:state, 'shipped_with_customer_extended') OrderItemMailer.rental_extended(self).deliver rescue Net::SMTPSyntaxError => exception Airbrake.notify( :error_class => exception.class.to_s, :error_message => "Bad Email Address Format. Order Item: #{self.id}. Email: #{self.order.user.email}", :parameters => self.attributes, :backtrace => caller) end end ! return true end 100+ LoC Real Code™