def pay!(payment_data = {})
      reset_errors!
      
      attributes = {
        amount: self.amount,
        date: Time.now.strftime('%Y-%m-%d')
      }.merge(payment_data)

      @last_response = Http.post("/invoices/#{uuid}/pay/", domain.token, MultiJson.encode(attributes), etag: self.etag)
      
      raise_last_response_unless 201
      
      reload_attributes!(uuid)
    ensure
      if $ERROR_INFO
        @last_response = $ERROR_INFO.last_response if $ERROR_INFO.kind_of?(Http::LastResponseError)
        @errors = [$ERROR_INFO.message]
      end
    end
def pay!(payment_data = {})
      reset_errors!
      
      attributes = {
        amount: self.amount,
        date: Time.now.strftime('%Y-%m-%d')
      }.merge(payment_data)

      @last_response = Http.post("/invoices/#{uuid}/pay/", domain.token, MultiJson.encode(attributes), etag: self.etag)
      
      raise_last_response_unless 201
      
      reload_attributes!(uuid)
    ensure
      if $ERROR_INFO
        @last_response = $ERROR_INFO.last_response if $ERROR_INFO.kind_of?(Http::LastResponseError)
        @errors = [$ERROR_INFO.message]
      end
    end
Pays current invoice at API. You can pass <tt>paid_amount</tt>,
 <tt>payment_date</tt> and <tt>note</tt> about payment.
 Default values:
 - <tt>amount</tt>: amount
 - <tt>date</tt>:  Time.now.strftime('%Y-%m-%d')

 API method: <tt>POST /invoices/:uuid/pay/</tt>

 API documentation: https://charging.financeconnect.com.br/static/docs/charges.html#post-invoices-uuid-pay