class Threoze::PayAccountService < Threoze::ApplicationService
  def call
    response = RestClient.get(url, { params: params, headers: headers })
    JSON.parse(response).first.merge({ 'CCID' => customer_contact_id })
  end

  private
    def endpoint
      'AcctPayAccount'
    end

    def customer_contact_id
      @customer_contact_id ||= Threoze::ContactCompanyService.call(@school)['CCID']
    end

    def params
      {
        key: threoze_secrets[:params_key],
        CCID: customer_contact_id,
        PaymentType: 2
      }
    end
end
