示例#1
0
    def get_items(self, resp):
        """This method parses the given response and returns items list object.

        Args:
            resp(dict): Response containing json object for items list.

        Returns:
            instance: Items list object.

        """
        items_list = ItemList()
        for value in resp['items']:
            item = Item()
            item.set_item_id(value['item_id'])
            item.set_name(value['name'])
            item.set_status(value['status'])
            item.set_description(value['description'])
            item.set_rate(value['rate'])
            item.set_tax_id(value['tax_id'])
            item.set_tax_name(value['tax_name'])
            item.set_tax_percentage(value['tax_percentage'])
            for tp in value['item_tax_preferences']:
                item.set_item_tax_preferences(tp)
            items_list.set_items(item)
        page_context_obj = PageContext()
        page_context = resp['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_applied_filter(page_context['applied_filter'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        items_list.set_page_context(page_context_obj)
        return items_list
    def get_expense_history(self, resp):
        """This method parses the json object and returns expense history list.

        Args:
            resp(dict): Response containing json object for expense history.

        Returns:
            instance: Expenses list object.

        """
        expenses_list = ExpenseList()
        for value in resp['expensehistory']:
            expense = Expense()
            expense.set_expense_id(value['expense_id'])
            expense.set_date(value['date'])
            expense.set_account_name(value['account_name'])
            expense.set_vendor_name(value['vendor_name'])
            expense.set_paid_through_account_name(\
            value['paid_through_account_name'])
            expense.set_customer_name(value['customer_name'])
            expense.set_total(value['total'])
            expense.set_status(value['status'])
            expenses_list.set_expenses(expense)
        page_context_obj = PageContext()
        page_context = resp['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        expenses_list.set_page_context(page_context_obj)
        return expenses_list
    def get_tasks_list(self, resp):
        """This method parses the given response and returns tasks list object.

        Args:
            resp(dict): Response containing json object for tasks list.


        Returns:
            instance: Task list object.

        """
        task_list = TaskList()
        for value in resp['task']:
            task = Task()
            task.set_project_id(value['project_id'])
            task.set_task_id(value['task_id'])
            task.set_currency_id(value['currency_id'])  
            task.set_customer_id(value['customer_id'])
            task.set_task_name(value['task_name'])
            task.set_project_name(value['project_name'])
            task.set_customer_name(value['customer_name'])
            task.set_billed_hours(value['billed_hours'])
            task.set_log_time(value['log_time'])
            task.set_un_billed_hours(value['un_billed_hours'])
            task_list.set_tasks(task)     
        page_context_obj = PageContext()
        page_context = resp['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        task_list.set_page_context(page_context_obj)
        return task_list
    def get_list(self, resp):
        """This method parses the given response for journals list.

        Args:
            journals(dict): Response containing json object for journals list.

        Returns:
            instance: Journals list object.

        """
        journals_list = JournalList()
        for value in resp['journals']:
            journal = Journal()
            journal.set_journal_id(value['journal_id'])
            journal.set_journal_date(value['journal_date'])
            journal.set_entry_number(value['entry_number'])
            journal.set_reference_number(value['reference_number'])
            journal.set_notes(value['notes'])
            journal.set_total(value['total'])
            journals_list.set_journals(journal)
        page_context = resp['page_context']
        page_context_obj = PageContext()
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_applied_filter(page_context['applied_filter'])
        if 'from_date' in page_context:
            page_context_obj.set_from_date(page_context['from_date'])
        if 'to_date' in page_context:
            page_context_obj.set_to_date(page_context['to_date'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        journals_list.set_page_context(page_context_obj)
        return journals_list
示例#5
0
    def get_users(self, resp):
        """This method parses the given response and returns USers list object.

        Args:
            resp(dict): Response containing json object for users list.

        Returns:
            instance: Users list object.

        """
        users_list = UserList()
        for value in resp['users']:
            user = User()
            user.set_user_id(value['user_id'])
            user.set_role_id(value['role_id'])
            user.set_name(value['name'])
            user.set_email(value['email'])
            user.set_user_role(value['user_role'])
            user.set_status(value['status'])
            user.set_is_current_user(value['is_current_user'])
            user.set_photo_url(value['photo_url'])
            users_list.set_users(user)
        page_context_obj = PageContext()
        page_context = resp['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_applied_filter(page_context['applied_filter'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        users_list.set_page_context(page_context_obj)
        return users_list
    def get_projects_list(self, resp):
        """This method parses the given response and returns projects list 
            object.

        Args:
            resp(dict): Response containing json object for projects.

        Returns:
            instance: Projects list object.

        """
        projects_list = ProjectList()
        for value in resp['projects']:
            project = Project()
            project.set_project_id(value['project_id'])
            project.set_project_name(value['project_name'])
            project.set_customer_id(value['customer_id'])
            project.set_customer_name(value['customer_name'])
            project.set_description(value['description'])
            project.set_status(value['status'])
            project.set_billing_type(value['billing_type'])
            #project.set_rate(value['rate'])
            project.set_created_time(value['created_time'])
            projects_list.set_projects(project)
        page_context_obj = PageContext()
        page_context = resp['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        projects_list.set_page_context(page_context_obj)
        return projects_list
示例#7
0
    def get_contact_persons(self, response):
        """This method parses the given repsonse and creates contact persons
            list object.

        Args:
            response(dict): Response containing json object for contact
                                persons list.

        Returns:
            instance: Contact person list object.

        """
        resp = response['contact_persons']
        contact_person_list = ContactPersonList()
        for value in resp:
            contact_person = ContactPerson()
            contact_person.set_contact_person_id(value['contact_person_id'])
            contact_person.set_salutation(value['salutation'])
            contact_person.set_first_name(value['first_name'])
            contact_person.set_last_name(value['last_name'])
            contact_person.set_email(value['email'])
            contact_person.set_phone(value['phone'])
            contact_person.set_mobile(value['mobile'])
            contact_person.set_is_primary_contact(value['is_primary_contact'])
            contact_person_list.set_contact_persons(contact_person)
        page_context_object = PageContext()
        page_context = response['page_context']
        page_context_object.set_page(page_context['page'])
        page_context_object.set_per_page(page_context['per_page'])
        page_context_object.set_has_more_page(page_context['has_more_page'])
        page_context_object.set_sort_column(page_context['sort_column'])
        page_context_object.set_sort_order(page_context['sort_order'])

        contact_person_list.set_page_context(page_context_object)
        return contact_person_list
    def get_list(self, resp):
        """This method parses the given response and returns chart of accounts 
            list.

        Args:
            resp(dict): Dictionary containing json object for chart of accounts 
                list.

        Returns: 
            instance: Chart of accounts list object.

        """
        chart_of_accounts_list = ChartOfAccountList()
        for value in resp['chartofaccounts']:
            chart_of_accounts = ChartOfAccount()
            chart_of_accounts.set_account_id(value['account_id'])
            chart_of_accounts.set_account_name(value['account_name'])
            chart_of_accounts.set_account_type(value['account_type'])
            chart_of_accounts.set_is_active(value['is_active'])
            chart_of_accounts.set_is_user_created(value['is_user_created'])
            chart_of_accounts.set_is_involved_in_transaction(value[\
            'is_involved_in_transaction'])
            chart_of_accounts.set_is_system_account(value['is_system_account'])
            chart_of_accounts_list.set_chartofaccounts(chart_of_accounts)
        page_context = resp['page_context']
        page_context_obj = PageContext()
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_applied_filter(page_context['applied_filter'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        chart_of_accounts_list.set_page_context(page_context_obj)
        return chart_of_accounts_list
    def get_projects_list(self, resp):
        """This method parses the given response and returns projects list 
            object.

        Args:
            resp(dict): Response containing json object for projects.

        Returns:
            instance: Projects list object.

        """
        projects_list = ProjectList()
        for value in resp['projects']:
            project = Project()
            project.set_project_id(value['project_id'])
            project.set_project_name(value['project_name'])
            project.set_customer_id(value['customer_id'])
            project.set_customer_name(value['customer_name'])
            project.set_description(value['description'])
            project.set_status(value['status'])
            project.set_billing_type(value['billing_type'])
            #project.set_rate(value['rate'])
            project.set_created_time(value['created_time'])
            projects_list.set_projects(project)
        page_context_obj = PageContext()
        page_context = resp['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        projects_list.set_page_context(page_context_obj)
        return projects_list
示例#10
0
    def get_contact_persons(self, response):
        """This method parses the given repsonse and creates contact persons 
            list object.

        Args: 
            response(dict): Response containing json object for contact 
                                persons list.

        Returns: 
            instance: Contact person list object.

        """
        resp = response['contact_persons']
        contact_person_list = ContactPersonList()
        for value in resp:
            contact_person = ContactPerson()
            contact_person.set_contact_person_id(value['contact_person_id'])
            contact_person.set_salutation(value['salutation'])
            contact_person.set_first_name(value['first_name'])
            contact_person.set_last_name(value['last_name'])
            contact_person.set_email(value['email'])
            contact_person.set_phone(value['phone'])
            contact_person.set_mobile(value['mobile'])
            contact_person.set_is_primary_contact(value['is_primary_contact'])    
            contact_person_list.set_contact_persons(contact_person)
        page_context_object = PageContext()
        page_context = response['page_context']
        page_context_object.set_page(page_context['page'])
        page_context_object.set_per_page(page_context['per_page'])
        page_context_object.set_has_more_page(page_context['has_more_page'])
        page_context_object.set_sort_column(page_context['sort_column'])
        page_context_object.set_sort_order(page_context['sort_order'])
    
        contact_person_list.set_page_context(page_context_object)
        return contact_person_list
    def get_tasks_list(self, resp):
        """This method parses the given response and returns tasks list object.

        Args:
            resp(dict): Response containing json object for tasks list.


        Returns:
            instance: Task list object.

        """
        task_list = TaskList()
        for value in resp['task']:
            task = Task()
            task.set_project_id(value['project_id'])
            task.set_task_id(value['task_id'])
            task.set_currency_id(value['currency_id'])
            task.set_customer_id(value['customer_id'])
            task.set_task_name(value['task_name'])
            task.set_project_name(value['project_name'])
            task.set_customer_name(value['customer_name'])
            task.set_billed_hours(value['billed_hours'])
            task.set_log_time(value['log_time'])
            task.set_un_billed_hours(value['un_billed_hours'])
            task_list.set_tasks(task)
        page_context_obj = PageContext()
        page_context = resp['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        task_list.set_page_context(page_context_obj)
        return task_list
示例#12
0
    def get_currencies(self, resp):
        """This method parses the given response and returns currency list 
            object.

        Args:
            resp(dict): Response containing json object for list of currencies.

        Returns:
            instance: Currency list object.

        """
        currency_list = CurrencyList()
        for value in resp['currencies']:
            currency = Currency()
            currency.set_currency_id(value['currency_id'])
            currency.set_currency_code(value['currency_code'])
            currency.set_currency_name(value['currency_name'])
            currency.set_currency_symbol(value['currency_symbol'])
            currency.set_price_precision(value['price_precision'])
            currency.set_currency_format(value['currency_format'])
            currency.set_is_base_currency(value['is_base_currency'])
            currency.set_exchange_rate(value['exchange_rate'])
            currency.set_effective_date(value['effective_date'])
            currency_list.set_currencies(currency)
        page_context_obj = PageContext()
        page_context = resp['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        currency_list.set_page_context(page_context_obj)
        return currency_list
    def get_list(self, resp):
        """This method parses the given response and returns chart of accounts 
            list.

        Args:
            resp(dict): Dictionary containing json object for chart of accounts 
                list.

        Returns: 
            instance: Chart of accounts list object.

        """
        chart_of_accounts_list = ChartOfAccountList()
        for value in resp['chartofaccounts']:
            chart_of_accounts = ChartOfAccount()
            chart_of_accounts.set_account_id(value['account_id'])
            chart_of_accounts.set_account_name(value['account_name'])
            chart_of_accounts.set_account_type(value['account_type'])
            chart_of_accounts.set_is_active(value['is_active'])
            chart_of_accounts.set_is_user_created(value['is_user_created'])
            chart_of_accounts.set_is_involved_in_transaction(value[\
            'is_involved_in_transaction'])
            chart_of_accounts.set_is_system_account(value['is_system_account'])
            chart_of_accounts_list.set_chartofaccounts(chart_of_accounts)
        page_context = resp['page_context']
        page_context_obj = PageContext()
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_applied_filter(page_context['applied_filter'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        chart_of_accounts_list.set_page_context(page_context_obj)
        return chart_of_accounts_list
示例#14
0
    def get_expense_history(self, resp):
        """This method parses the json object and returns expense history list.

        Args:
            resp(dict): Response containing json object for expense history.

        Returns:
            instance: Expenses list object.

        """
        expenses_list = ExpenseList()
        for value in resp['expensehistory']:
            expense = Expense()
            expense.set_expense_id(value['expense_id'])
            expense.set_date(value['date'])
            expense.set_account_name(value['account_name'])
            expense.set_vendor_name(value['vendor_name'])
            expense.set_paid_through_account_name(\
            value['paid_through_account_name'])
            expense.set_customer_name(value['customer_name'])
            expense.set_total(value['total'])
            expense.set_status(value['status'])
            expenses_list.set_expenses(expense)
        page_context_obj = PageContext()
        page_context = resp['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        expenses_list.set_page_context(page_context_obj)
        return expenses_list
示例#15
0
    def get_taxes(self, resp):
        """This method parses the given response and returns tax list object.

        Args:
            resp(dict): Response containing json object for taxes.

        Returns:
            instance: Tax list object.

        """
        tax_list = TaxList()
        for value in resp['taxes']:
            tax = Tax()
            tax.set_tax_id(value['tax_id'])
            tax.set_tax_name(value['tax_name'])
            tax.set_tax_percentage(value['tax_percentage'])
            tax.set_tax_type(value['tax_type'])
            tax_list.set_taxes(tax)
        page_context = resp['page_context']
        page_context_obj = PageContext()
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        tax_list.set_page_context(page_context_obj)
        return tax_list
示例#16
0
    def get_matching_transaction(self, resp): 
        """This method parses the given response and returns matching 
            transactions list.
  
        Args: 
            resp(dict): Response containing json object for matching 
                transactions.

        Returns:
            instance: Transaction list object.

        """
        transaction_list = TransactionList()
        for value in resp['matching_transactions']:
            transaction = Transaction()
            transaction.set_transaction_id(value['transaction_id'])
            transaction.set_date(value['date'])
            transaction.set_date_formatted(value['date_formatted'] if 'date_formatted' in value else None)
            transaction.set_transaction_type(value['transaction_type'])
            transaction.set_transaction_type_formatted(value[\
            'transaction_type_formatted'] if 'transaction_type_formatted' in value else None)
            transaction.set_reference_number(value['reference_number'])
            transaction.set_amount(value['amount'])
            transaction.set_amount_formatted(value['amount_formatted'] if 'amount_formatted' in value else None)
            transaction.set_debit_or_credit(value['debit_or_credit'])
            transaction.is_best_match = value['is_best_match'] if 'is_best_match' in value else None
            transaction.offset_account_name = value['offset_account_name'] if 'offset_account_name' in value else None
            transaction_list.set_transactions(transaction)
        page_context_obj = PageContext()
        page_context = resp['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        for value in page_context['search_criteria']:
            criteria = SearchCriteria()
            criteria.set_column_name(value['column_name'])
            if value['comparator'] != 'range':
                criteria.set_search_text(value['search_text'])
            else:
                criteria.set_search_text('{} -- {}'.format(value['search_text_0'], value['search_text_0']))
            criteria.set_comparator(value['comparator'])
            page_context_obj.set_search_criteria(criteria)
        transaction_list.set_page_context(page_context_obj)
        '''instrumentation_obj = Instrumentation()
        instrumentation = resp['instrumentation']
        instrumentation_obj.set_query_execution_time(instrumentation[\
        'query_execution_time'])
        instrumentation_obj.set_request_handling_time(instrumentation[\
        'request_handling_time'])
        instrumentation_obj.set_response_write_time(instrumentation[\
        'response_write_time'])
        instrumentation_obj.set_page_context_write_time(instrumentation[\
        'page_context_write_time'])
        transaction_list.set_instrumentation(instrumentation_obj)'''
        return transaction_list
    def get_matching_transaction(self, resp): 
        """This method parses the given response and returns matching 
            transactions list.
  
        Args: 
            resp(dict): Response containing json object for matching 
                transactions.

        Returns:
            instance: Transaction list object.

        """
        transaction_list = TransactionList()
        for value in resp['matching_transactions']:
            transaction = Transaction()
            transaction.set_transaction_id(value['transaction_id'])
            transaction.set_date(value['date'])
            transaction.set_date_formatted(value['date_formatted'])
            transaction.set_transaction_type(value['transaction_type'])
            transaction.set_transaction_type_formatted(value[\
            'transaction_type_formatted'])
            transaction.set_reference_number(value['reference_number'])
            transaction.set_amount(value['amount'])
            transaction.set_amount_formatted(value['amount_formatted'])
            transaction.set_debit_or_credit(value['debit_or_credit'])
            transaction_list.set_transactions(transaction)
        page_context_obj = PageContext()
        page_context = resp['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        for value in page_context['search_criteria']:
            criteria = SearchCriteria()
            criteria.set_column_name(value['column_name'])
            criteria.set_search_text(value['search_text'])
            criteria.set_comparator(value['comparator'])
            page_context_obj.set_search_criteria(criteria)
        transaction_list.set_page_context(page_context_obj)
        '''instrumentation_obj = Instrumentation()
        instrumentation = resp['instrumentation']
        instrumentation_obj.set_query_execution_time(instrumentation[\
        'query_execution_time'])
        instrumentation_obj.set_request_handling_time(instrumentation[\
        'request_handling_time'])
        instrumentation_obj.set_response_write_time(instrumentation[\
        'response_write_time'])
        instrumentation_obj.set_page_context_write_time(instrumentation[\
        'page_context_write_time'])
        transaction_list.set_instrumentation(instrumentation_obj)'''
        return transaction_list
示例#18
0
    def get_contacts(self, resp):
        """This method parses the given response and creates a contact 
            list object.
  
        Args:
            resp(dict): Response containing json object for contact list.

        Returns:
            instance: Contact list object.
 
        """
        contacts_list = ContactList()
        response = resp['contacts']
        for value in resp['contacts']:
            contact = Contact()
            contact.set_contact_id(value['contact_id'])
            contact.set_contact_name(value['contact_name'])
            contact.set_company_name(value['company_name'])
            contact.set_contact_type(value['contact_type'])
            contact.set_status(value['status'])
            contact.set_payment_terms(value['payment_terms'])
            contact.set_payment_terms_label(value['payment_terms_label'])
            contact.set_currency_id(value['currency_id'])
            contact.set_currency_code(value['currency_code'])
            contact.set_outstanding_receivable_amount(value[\
                'outstanding_receivable_amount'])
            contact.set_outstanding_payable_amount(value[\
                'outstanding_payable_amount'])
            contact.set_unused_credits_receivable_amount(value[\
                'unused_credits_receivable_amount'])
            contact.set_unused_credits_payable_amount(value[\
                'unused_credits_payable_amount'])
            contact.set_first_name(value['first_name'])
            contact.set_last_name(value['last_name'])
            contact.set_email(value['email'])
            contact.set_phone(value['phone'])
            contact.set_mobile(value['mobile'])
            contact.set_created_time(value['created_time'])
            contact.set_last_modified_time(value['last_modified_time'])
            contacts_list.set_contacts(contact)
        page_context_object = PageContext()
        page_context = resp['page_context']
        page_context_object.set_page(page_context['page'])
        page_context_object.set_per_page(page_context['per_page'])
        page_context_object.set_has_more_page(page_context['has_more_page'])
        page_context_object.set_applied_filter(page_context['applied_filter'])
        page_context_object.set_sort_column(page_context['sort_column']) 
        page_context_object.set_sort_order(page_context['sort_order']) 
    
        contacts_list.set_page_context(page_context_object)
        return contacts_list
示例#19
0
    def get_contacts(self, resp):
        """This method parses the given response and creates a contact
            list object.

        Args:
            resp(dict): Response containing json object for contact list.

        Returns:
            instance: Contact list object.

        """
        contacts_list = ContactList()
        response = resp['contacts']
        for value in resp['contacts']:
            contact = Contact()
            contact.set_contact_id(value['contact_id'])
            contact.set_contact_name(value['contact_name'])
            contact.set_company_name(value['company_name'])
            contact.set_contact_type(value['contact_type'])
            contact.set_status(value['status'])
            contact.set_payment_terms(value['payment_terms'])
            contact.set_payment_terms_label(value['payment_terms_label'])
            contact.set_currency_id(value['currency_id'])
            contact.set_currency_code(value['currency_code'])
            contact.set_outstanding_receivable_amount(value[\
                'outstanding_receivable_amount'])
            contact.set_outstanding_payable_amount(value[\
                'outstanding_payable_amount'])
            contact.set_unused_credits_receivable_amount(value[\
                'unused_credits_receivable_amount'])
            contact.set_unused_credits_payable_amount(value[\
                'unused_credits_payable_amount'])
            contact.set_first_name(value['first_name'])
            contact.set_last_name(value['last_name'])
            contact.set_email(value['email'])
            contact.set_phone(value['phone'])
            contact.set_mobile(value['mobile'])
            contact.set_created_time(value['created_time'])
            contact.set_last_modified_time(value['last_modified_time'])
            contacts_list.set_contacts(contact)
        page_context_object = PageContext()
        page_context = resp['page_context']
        page_context_object.set_page(page_context['page'])
        page_context_object.set_per_page(page_context['per_page'])
        page_context_object.set_has_more_page(page_context['has_more_page'])
        page_context_object.set_applied_filter(page_context['applied_filter'])
        page_context_object.set_sort_column(page_context['sort_column'])
        page_context_object.set_sort_order(page_context['sort_order'])

        contacts_list.set_page_context(page_context_object)
        return contacts_list
    def get_associated_transaction(self, resp):
        """This method parses the given response and returns associated 
            transactions list.

        Args:
            resp(dict): Response containing json object for associated 
                transactions.

        Returns:
            instance: Transaction object.

        """
        transaction = resp['transaction']
        transaction_obj = Transaction()
        transaction_obj.set_imported_transaction_id(transaction[\
        'imported_transaction_id'])
        transaction_obj.set_date(transaction['date'])
        transaction_obj.set_amount(transaction['amount'])
        transaction_obj.set_payee(transaction['payee'])
        transaction_obj.set_reference_number(transaction['reference_number'])
        transaction_obj.set_description(transaction['description'])
        transaction_obj.set_status(transaction['status'])
        transaction_obj.set_status_formatted(transaction['status_formatted'])
        for value in transaction['associated_transactions']:
            transaction = Transaction() 
            transaction.set_transaction_id(value['transaction_id'])
            transaction.set_date(value['date'])
            transaction.set_debit_or_credit(value['debit_or_credit'])
            transaction.set_transaction_type(value['transaction_type'])
            transaction.set_amount(value['amount'])
            transaction.set_customer_id(value['customer_id'])
            transaction.set_customer_name(value['customer_name'])
            transaction_obj.set_associated_transaction(transaction)
        page_context_obj = PageContext()
        page_context = resp['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        '''instrumentation_obj = Instrumentation()
        instrumentation = resp['instrumentation']
        instrumentation_obj.set_query_execution_time(instrumentation[\
        'query_execution_time'])
        instrumentation_obj.set_request_handling_time(instrumentation[\
        'request_handling_time'])
        instrumentation_obj.set_response_write_time(instrumentation[\
        'response_write_time'])
        instrumentation_obj.set_page_context_write_time(instrumentation[\
        'page_context_write_time'])
        transaction_obj.set_instrumentation(instrumentation_obj)'''
        return transaction_obj
    def get_associated_transaction(self, resp):
        """This method parses the given response and returns associated 
            transactions list.

        Args:
            resp(dict): Response containing json object for associated 
                transactions.

        Returns:
            instance: Transaction object.

        """
        transaction = resp['transaction']
        transaction_obj = Transaction()
        transaction_obj.set_imported_transaction_id(transaction[\
        'imported_transaction_id'])
        transaction_obj.set_date(transaction['date'])
        transaction_obj.set_amount(transaction['amount'])
        transaction_obj.set_payee(transaction['payee'])
        transaction_obj.set_reference_number(transaction['reference_number'])
        transaction_obj.set_description(transaction['description'])
        transaction_obj.set_status(transaction['status'])
        transaction_obj.set_status_formatted(transaction['status_formatted'])
        for value in transaction['associated_transactions']:
            transaction = Transaction()
            transaction.set_transaction_id(value['transaction_id'])
            transaction.set_date(value['date'])
            transaction.set_debit_or_credit(value['debit_or_credit'])
            transaction.set_transaction_type(value['transaction_type'])
            transaction.set_amount(value['amount'])
            transaction.set_customer_id(value['customer_id'])
            transaction.set_customer_name(value['customer_name'])
            transaction_obj.set_associated_transaction(transaction)
        page_context_obj = PageContext()
        page_context = resp['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        '''instrumentation_obj = Instrumentation()
        instrumentation = resp['instrumentation']
        instrumentation_obj.set_query_execution_time(instrumentation[\
        'query_execution_time'])
        instrumentation_obj.set_request_handling_time(instrumentation[\
        'request_handling_time'])
        instrumentation_obj.set_response_write_time(instrumentation[\
        'response_write_time'])
        instrumentation_obj.set_page_context_write_time(instrumentation[\
        'page_context_write_time'])
        transaction_obj.set_instrumentation(instrumentation_obj)'''
        return transaction_obj
示例#22
0
    def get_list(self, resp):
        """This method parses the given response and returns recurring 
            expenses list object.

        Args:
            resp(dict): Response containing json object for recurring expenses 
                list.

        Returns:
            instance: Recurring expenses list object.

        """
        recurring_expenses_list = RecurringExpenseList()
        for value in resp['recurring_expenses']:
            recurring_expenses = RecurringExpense()
            recurring_expenses.set_recurring_expense_id(\
            value['recurring_expense_id'])
            recurring_expenses.set_recurrence_name(value['recurrence_name'])
            recurring_expenses.set_recurrence_frequency(\
            value['recurrence_frequency'])
            recurring_expenses.set_repeat_every(value['repeat_every'])
            recurring_expenses.set_last_created_date(\
            value['last_created_date'])
            recurring_expenses.set_next_expense_date(\
            value['next_expense_date'])
            recurring_expenses.set_account_name(value['account_name'])
            recurring_expenses.set_paid_through_account_name(\
            value['paid_through_account_name'])
            recurring_expenses.set_description(value['description'])
            recurring_expenses.set_currency_id(value['currency_id'])
            recurring_expenses.set_currency_code(value['currency_code'])
            recurring_expenses.set_total(value['total'])
            recurring_expenses.set_is_billable(value['is_billable'])
            recurring_expenses.set_customer_name(value['customer_name'])
            recurring_expenses.set_vendor_name(value['vendor_name'])
            recurring_expenses.set_status(value['status'])
            recurring_expenses.set_created_time(value['created_time'])
            recurring_expenses_list.set_recurring_expenses(recurring_expenses)
        page_context = resp['page_context']
        page_context_obj = PageContext()
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_applied_filter(page_context['applied_filter'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        recurring_expenses_list.set_page_context(page_context_obj)
        return recurring_expenses_list
    def get_list(self, resp):
        """This method parses the given response and returns recurring 
            expenses list object.

        Args:
            resp(dict): Response containing json object for recurring expenses 
                list.

        Returns:
            instance: Recurring expenses list object.

        """
        recurring_expenses_list = RecurringExpenseList()
        for value in resp['recurring_expenses']:
            recurring_expenses = RecurringExpense()
            recurring_expenses.set_recurring_expense_id(\
            value['recurring_expense_id'])
            recurring_expenses.set_recurrence_name(value['recurrence_name'])
            recurring_expenses.set_recurrence_frequency(\
            value['recurrence_frequency'])
            recurring_expenses.set_repeat_every(value['repeat_every'])
            recurring_expenses.set_last_created_date(\
            value['last_created_date'])
            recurring_expenses.set_next_expense_date(\
            value['next_expense_date'])
            recurring_expenses.set_account_name(value['account_name'])
            recurring_expenses.set_paid_through_account_name(\
            value['paid_through_account_name'])
            recurring_expenses.set_description(value['description'])
            recurring_expenses.set_currency_id(value['currency_id'])
            recurring_expenses.set_currency_code(value['currency_code'])
            recurring_expenses.set_total(value['total'])
            recurring_expenses.set_is_billable(value['is_billable'])
            recurring_expenses.set_customer_name(value['customer_name'])
            recurring_expenses.set_vendor_name(value['vendor_name'])
            recurring_expenses.set_status(value['status'])
            recurring_expenses.set_created_time(value['created_time'])
            recurring_expenses_list.set_recurring_expenses(recurring_expenses)
        page_context = resp['page_context']
        page_context_obj = PageContext()
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_applied_filter(page_context['applied_filter'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        recurring_expenses_list.set_page_context(page_context_obj)
        return recurring_expenses_list
    def recurring_invoices(self, response):
        """This method parses the given response and creates recurring 
            invoices list object.
      
        Args:
            response(dict): Response containing json object for recurring 
                invoice list.
 
        Returns:
            instance: Recurring invoice list object.

        """
        recurring_invoices_list = RecurringInvoiceList()
        recurring_invoices = []
        for value in response['recurring_invoices']:
            recurring_invoice = RecurringInvoice()
            recurring_invoice.set_recurring_invoice_id(\
            value['recurring_invoice_id'])
            recurring_invoice.set_recurrence_name(value['recurrence_name'])
            recurring_invoice.set_status(value['status'])
            recurring_invoice.set_total(value['total'])
            recurring_invoice.set_customer_id(value['customer_id'])
            recurring_invoice.set_customer_name(value['customer_name'])
            recurring_invoice.set_start_date(value['start_date'])
            recurring_invoice.set_end_date(value['end_date'])
            recurring_invoice.set_last_sent_date(value['last_sent_date'])
            recurring_invoice.set_next_invoice_date(value['next_invoice_date'])
            recurring_invoice.set_recurrence_frequency(\
            value['recurrence_frequency'])
            recurring_invoice.set_repeat_every(value['repeat_every'])
            recurring_invoice.set_created_time(value['created_time'])
            recurring_invoice.set_last_modified_time(\
            value['last_modified_time'])
            recurring_invoices.append(recurring_invoice)
        recurring_invoices_list.set_recurring_invoices(recurring_invoices)

        page_context = response['page_context']
        page_context_obj = PageContext()
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_applied_filter(page_context['applied_filter'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        recurring_invoices_list.set_page_context(page_context_obj)

        return recurring_invoices_list
    def recurring_invoices(self, response):
        """This method parses the given response and creates recurring 
            invoices list object.
      
        Args:
            response(dict): Response containing json object for recurring 
                invoice list.
 
        Returns:
            instance: Recurring invoice list object.

        """
        recurring_invoices_list = RecurringInvoiceList()
        recurring_invoices = []
        for value in response['recurring_invoices']:
            recurring_invoice = RecurringInvoice()
            recurring_invoice.set_recurring_invoice_id(\
            value['recurring_invoice_id'])
            recurring_invoice.set_recurrence_name(value['recurrence_name'])
            recurring_invoice.set_status(value['status'])
            recurring_invoice.set_total(value['total'])
            recurring_invoice.set_customer_id(value['customer_id'])
            recurring_invoice.set_customer_name(value['customer_name'])
            recurring_invoice.set_start_date(value['start_date'])
            recurring_invoice.set_end_date(value['end_date'])
            recurring_invoice.set_last_sent_date(value['last_sent_date'])
            recurring_invoice.set_next_invoice_date(value['next_invoice_date'])
            recurring_invoice.set_recurrence_frequency(\
            value['recurrence_frequency'])
            recurring_invoice.set_repeat_every(value['repeat_every'])
            recurring_invoice.set_created_time(value['created_time'])
            recurring_invoice.set_last_modified_time(\
            value['last_modified_time'])
            recurring_invoices.append(recurring_invoice)
        recurring_invoices_list.set_recurring_invoices(recurring_invoices)

        page_context = response['page_context']
        page_context_obj = PageContext()
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_applied_filter(page_context['applied_filter'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        recurring_invoices_list.set_page_context(page_context_obj)

        return recurring_invoices_list
    def get_list(self, resp):
        """This method parses the given response and returns Expense list 
            object.

        Args:
            resp(dict): Response containing json object for Expenses list.
        
        Returns:
            instance: Expenses list object.

        """
        expenses = resp['expenses']
        expense_list = ExpenseList()
        for value in expenses:
            expense = Expense()
            expense.set_expense_id(value['expense_id'])
            expense.set_date(value['date'])
            expense.set_account_name(value['account_name'])
            expense.set_paid_through_account_name(value[\
            'paid_through_account_name'])
            expense.set_description(value['description'])
            expense.set_currency_id(value['currency_id'])
            expense.set_currency_code(value['currency_code'])
            expense.set_bcy_total(value['bcy_total'])
            expense.set_total(value['total'])
            expense.set_is_billable(value['is_billable'])
            expense.set_reference_number(value['reference_number'])
            expense.set_customer_id(value['customer_id'])
            expense.set_customer_name(value['customer_name'])
            expense.set_vendor_id(value['vendor_id'])
            expense.set_vendor_name(value['vendor_name'])
            expense.set_status(value['status'])
            expense.set_created_time(value['created_time'])
            expense.set_expense_receipt_name(value['expense_receipt_name'])
            expense_list.set_expenses(expense)
        page_context_obj = PageContext()
        page_context = resp['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_applied_filter(page_context['applied_filter'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        expense_list.set_page_context(page_context)

        return expense_list
    def get_list(self, resp): 
        """This method parses the given response and returns Expense list 
            object.

        Args:
            resp(dict): Response containing json object for Expenses list.
        
        Returns:
            instance: Expenses list object.

        """
        expenses = resp['expenses']
        expense_list = ExpenseList()
        for value in expenses:
            expense = Expense()
            expense.set_expense_id(value['expense_id'])
            expense.set_date(value['date'])
            expense.set_account_name(value['account_name'])
            expense.set_paid_through_account_name(value[\
            'paid_through_account_name'])
            expense.set_description(value['description'])
            expense.set_currency_id(value['currency_id'])
            expense.set_currency_code(value['currency_code'])
            expense.set_bcy_total(value['bcy_total'])
            expense.set_total(value['total'])
            expense.set_is_billable(value['is_billable'])
            expense.set_reference_number(value['reference_number'])
            expense.set_customer_id(value['customer_id'])
            expense.set_customer_name(value['customer_name'])
            expense.set_vendor_id(value['vendor_id'])
            expense.set_vendor_name(value['vendor_name'])
            expense.set_status(value['status'])
            expense.set_created_time(value['created_time'])
            expense.set_expense_receipt_name(value['expense_receipt_name'])
            expense_list.set_expenses(expense)
        page_context_obj = PageContext()
        page_context = resp['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_applied_filter(page_context['applied_filter'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        expense_list.set_page_context(page_context)

        return expense_list
    def get_list(self, response):
        """This method parses the given resonse and creates invoice list 
            object.
       
        Args:
            response(dict): Response containing json object for invoice list.

        Returns:
            instance: Invoice list object.

        """
        invoice = response['invoices']
        invoice_list = InvoiceList()
        for value in invoice:
            invoice_object = Invoice()
            invoice_object.set_invoice_id(value['invoice_id'])
            invoice_object.set_customer_name(value['customer_name'])
            invoice_object.set_customer_id(value['customer_id'])
            invoice_object.set_status(value['status'])
            invoice_object.set_invoice_number(value['invoice_number'])
            invoice_object.set_reference_number(value['reference_number'])
            invoice_object.set_date(value['date'])
            invoice_object.set_due_date(value['due_date'])
            invoice_object.set_due_days(value['due_days'])
            invoice_object.set_currency_id(value['currency_id'])
            invoice_object.set_currency_code(value['currency_code'])
            invoice_object.set_total(value['total'])
            invoice_object.set_balance(value['balance'])
            invoice_object.set_created_time(value['created_time'])
            invoice_object.set_is_emailed(value['is_emailed'])
            invoice_object.set_reminders_sent(value['reminders_sent'])
            invoice_object.set_payment_expected_date(value[\
            'payment_expected_date'])
            invoice_object.set_last_payment_date(value['last_payment_date'])
            invoice_list.set_invoices(invoice_object)
        page_context_object = PageContext()
        page_context = response['page_context']
        page_context_object.set_page(page_context['page'])
        page_context_object.set_per_page(page_context['per_page'])
        page_context_object.set_has_more_page(page_context['has_more_page'])
        page_context_object.set_report_name(page_context['report_name'])
        page_context_object.set_applied_filter(page_context['applied_filter'])
        page_context_object.set_sort_column(page_context['sort_column'])
        page_context_object.set_sort_order(page_context['sort_order'])
        invoice_list.set_page_context(page_context_object)

        return invoice_list
    def get_list(self,response):
        """This method parses the given resonse and creates invoice list 
            object.
       
        Args:
            response(dict): Response containing json object for invoice list.

        Returns:
            instance: Invoice list object.

        """
        invoice = response['invoices']
        invoice_list = InvoiceList()
        for value in invoice: 
            invoice_object = Invoice()
            invoice_object.set_invoice_id(value['invoice_id'])
            invoice_object.set_customer_name(value['customer_name'])
            invoice_object.set_customer_id(value['customer_id'])
            invoice_object.set_status(value['status'])
            invoice_object.set_invoice_number(value['invoice_number'])
            invoice_object.set_reference_number(value['reference_number'])
            invoice_object.set_date(value['date'])
            invoice_object.set_due_date(value['due_date'])
            invoice_object.set_due_days(value['due_days'])
            invoice_object.set_currency_id(value['currency_id'])
            invoice_object.set_currency_code(value['currency_code'])
            invoice_object.set_total(value['total'])
            invoice_object.set_balance(value['balance'])
            invoice_object.set_created_time(value['created_time'])
            invoice_object.set_is_emailed(value['is_emailed'])
            invoice_object.set_reminders_sent(value['reminders_sent'])
            invoice_object.set_payment_expected_date(value[\
            'payment_expected_date'])
            invoice_object.set_last_payment_date(value['last_payment_date'])
            invoice_list.set_invoices(invoice_object)
        page_context_object = PageContext()
        page_context = response['page_context']
        page_context_object.set_page(page_context['page'])
        page_context_object.set_per_page(page_context['per_page'])
        page_context_object.set_has_more_page(page_context['has_more_page'])
        page_context_object.set_report_name(page_context['report_name'])
        page_context_object.set_applied_filter(page_context['applied_filter'])
        page_context_object.set_sort_column(page_context['sort_column'])
        page_context_object.set_sort_order(page_context['sort_order'])
        invoice_list.set_page_context(page_context_object)
  
        return invoice_list
    def get_time_entries_list(self, resp):
        """This method parses the given response and returns time entries list 
            object.

        Args:
            resp(dict): Response containing json object for time entries.

        Returns:
            instance: Time entries list object.

        """
        time_entries_list = TimeEntryList()
        for value in resp['time_entries']:
            time_entry = TimeEntry()
            time_entry.set_time_entry_id(value['time_entry_id'])
            time_entry.set_project_id(value['project_id'])
            time_entry.set_project_name(value['project_name'])
            time_entry.set_customer_id(value['customer_id'])
            time_entry.set_customer_name(value['customer_name'])
            time_entry.set_task_id(value['task_id'])
            time_entry.set_task_name(value['task_name'])
            time_entry.set_user_id(value['user_id'])
            time_entry.set_is_current_user(value['is_current_user'])
            time_entry.set_user_name(value['user_name'])
            time_entry.set_log_date(value['log_date'])
            time_entry.set_begin_time(value['begin_time'])
            time_entry.set_end_time(value['end_time'])
            time_entry.set_log_time(value['log_time'])
            time_entry.set_billed_status(value['billed_status'])
            time_entry.set_notes(value['notes'])
            time_entry.set_timer_started_at(value['timer_started_at'])
            time_entry.set_timer_duration_in_minutes(value[\
            'timer_duration_in_minutes'])
            time_entry.set_created_time(value['created_time'])
            time_entries_list.set_time_entries(time_entry)
        page_context_obj = PageContext()
        page_context = resp['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_applied_filter(page_context['applied_filter'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        time_entries_list.set_page_context(page_context_obj)
        return time_entries_list
    def get_time_entries_list(self, resp):
        """This method parses the given response and returns time entries list 
            object.

        Args:
            resp(dict): Response containing json object for time entries.

        Returns:
            instance: Time entries list object.

        """
        time_entries_list = TimeEntryList()
        for value in resp['time_entries']:
            time_entry = TimeEntry()
            time_entry.set_time_entry_id(value['time_entry_id'])
            time_entry.set_project_id(value['project_id'])
            time_entry.set_project_name(value['project_name'])
            time_entry.set_customer_id(value['customer_id'])
            time_entry.set_customer_name(value['customer_name'])
            time_entry.set_task_id(value['task_id'])
            time_entry.set_task_name(value['task_name'])
            time_entry.set_user_id(value['user_id'])
            time_entry.set_is_current_user(value['is_current_user'])
            time_entry.set_user_name(value['user_name'])
            time_entry.set_log_date(value['log_date'])
            time_entry.set_begin_time(value['begin_time'])
            time_entry.set_end_time(value['end_time'])
            time_entry.set_log_time(value['log_time'])
            time_entry.set_billed_status(value['billed_status'])
            time_entry.set_notes(value['notes'])
            time_entry.set_timer_started_at(value['timer_started_at'])
            time_entry.set_timer_duration_in_minutes(value[\
            'timer_duration_in_minutes'])
            time_entry.set_created_time(value['created_time'])
            time_entries_list.set_time_entries(time_entry)
        page_context_obj = PageContext()
        page_context = resp['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name']) 
        page_context_obj.set_applied_filter(page_context['applied_filter'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        time_entries_list.set_page_context(page_context_obj)
        return time_entries_list
    def customer_payments(self,response):
        """This method parses the given response and returns customer payments 
            list object.

        Args:
            response(dict): Response containing json object for customer 
                payments list.
      
        Returns:
            instance: Customer payments list object.
        
        """
        customer_payment_list=CustomerPaymentList()
        for value in response['customerpayments']:
            customer_payment=CustomerPayment()
            customer_payment.set_payment_id(value['payment_id'])
            customer_payment.set_payment_number(value['payment_number'])
            customer_payment.set_invoice_numbers(value['invoice_numbers'])
            customer_payment.set_date(value['date'])
            customer_payment.set_payment_mode(value['payment_mode'])
            customer_payment.set_amount(value['amount'])
            customer_payment.set_bcy_amount(value['bcy_amount'])
            customer_payment.set_unused_amount(value['unused_amount'])
            customer_payment.set_bcy_unused_amount(value['bcy_unused_amount'])
            customer_payment.set_account_id(value['account_id'])
            customer_payment.set_account_name(value['account_name'])
            customer_payment.set_description(value['description'])
            customer_payment.set_reference_number(value['reference_number'])
            customer_payment.set_customer_id(value['customer_id'])
            customer_payment.set_customer_name(value['customer_name'])
            customer_payment.set_created_time(value['created_time'])
            customer_payment.set_last_modified_time(\
            value['last_modified_time'])
            customer_payment_list.set_customer_payments(customer_payment)
        page_context=response['page_context']
        page_context_obj=PageContext()
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_applied_filter(page_context['applied_filter'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        customer_payment_list.set_page_context(page_context_obj)
        return customer_payment_list
    def get_transactions_list(self, resp):
        """This method parses the given response and returns transactions list.

        Args:
            resp(dict): Dictionary containing json object for transactions list.

        Returns:
            instance: Transaction list object.

        """
        transactions_list = TransactionList()
        for value in resp['transactions']:
            transactions = Transaction()
            transactions.set_categorized_transaction_id(value[\
            'categorized_transaction_id'])
            transactions.set_transaction_type(value['transaction_type'])
            transactions.set_transaction_id(value['transaction_id'])
            transactions.set_transaction_date(value['transaction_date'])
            transactions.set_transaction_type_formatted(value[\
            'transaction_type_formatted'])
            transactions.set_account_id(value['account_id'])
            transactions.set_customer_id(value['customer_id'])
            transactions.set_payee(value['payee'])
            transactions.set_description(value['description'])
            transactions.set_entry_number(value['entry_number'])
            transactions.set_currency_id(value['currency_id'])
            transactions.set_currency_code(value['currency_code'])
            transactions.set_debit_or_credit(value['debit_or_credit'])
            transactions.set_offset_account_name(value['offset_account_name'])
            transactions.set_reference_number(value['reference_number'])
            transactions.set_reconcile_status(value['reconcile_status'])
            transactions.set_debit_amount(value['debit_amount'])
            transactions.set_credit_amount(value['credit_amount'])
            transactions_list.set_transactions(transactions)
        page_context = resp['page_context']
        page_context_obj = PageContext()
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        transactions_list.set_page_context(page_context_obj)
        return transactions_list
    def get_list(self, resp):
        """This method parses the given response and returns bank transaction 
            list.

        Args: 
            resp(dict): Response containing json object for Bank transaction 
                list.

        Returns:
            instance: Bank transaction list object.

        """
        bank_transaction_list = TransactionList()
        for value in resp['banktransactions']:
            bank_transaction = Transaction()
            bank_transaction.set_transaction_id(value['transaction_id'])
            bank_transaction.set_date(value['date'])
            bank_transaction.set_amount(value['amount'])
            bank_transaction.set_transaction_type(value['transaction_type'])
            bank_transaction.set_status(value['status'])
            bank_transaction.set_source(value['source'])
            bank_transaction.set_account_id(value['account_id'])
            bank_transaction.set_customer_id(value['customer_id'])
            bank_transaction.set_payee(value['payee'])
            bank_transaction.set_currency_id(value['currency_id'])
            bank_transaction.set_currency_code(value['currency_code'])
            bank_transaction.set_debit_or_credit(value['debit_or_credit'])
            bank_transaction.set_offset_account_name(
                value['offset_account_name'])
            bank_transaction.set_reference_number(value['reference_number'])
            bank_transaction.set_imported_transaction_id(value[\
            'imported_transaction_id'])
            bank_transaction_list.set_transactions(bank_transaction)
        page_context_obj = PageContext()
        page_context = resp['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_applied_filter(page_context['applied_filter'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        bank_transaction_list.set_page_context(page_context_obj)
        return bank_transaction_list
    def get_list(self, resp):
        """This method parses the given response and returns bank account list 
            object.

        Args:
            resp(dict): Response containing json object for Bank account list.

        Returns:
            instance: Bank account list object.

        """
        bank_account_list = BankAccountList()
        for value in resp['bankaccounts']:
            bank_accounts = BankAccount()
            bank_accounts.set_account_id(value['account_id'])
            bank_accounts.set_account_name(value['account_name'])
            bank_accounts.set_account_code(value['account_code'])
            bank_accounts.set_currency_id(value['currency_id'])
            bank_accounts.set_currency_code(value['currency_code'])
            bank_accounts.set_account_type(value['account_type'])
            bank_accounts.set_uncategorized_transactions(
                value['uncategorized_transactions'])
            bank_accounts.set_is_active(value['is_active'])
            bank_accounts.set_balance(value['balance'])
            bank_accounts.set_bank_name(value['bank_name'])
            bank_accounts.set_routing_number(value.get('routing_number', ''))
            bank_accounts.set_is_primary_account(
                value.get('is_primary_account', None))
            bank_accounts.set_is_paypal_account(
                value.get('is_paypal_account', None))
            bank_accounts.set_paypal_email_address(
                value.get('paypal_email_address', ''))
            bank_account_list.set_bank_accounts(bank_accounts)
        page_context_obj = PageContext()
        page_context = resp['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_applied_filter(page_context['applied_filter'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        bank_account_list.set_page_context(page_context_obj)
        return bank_account_list
    def get_transactions_list(self, resp):
        """This method parses the given response and returns transactions list.

        Args:
            resp(dict): Dictionary containing json object for transactions list.

        Returns:
            instance: Transaction list object.

        """
        transactions_list = TransactionList()
        for value in resp['transactions']:
            transactions = Transaction()
            transactions.set_categorized_transaction_id(value[\
            'categorized_transaction_id'])
            transactions.set_transaction_type(value['transaction_type'])
            transactions.set_transaction_id(value['transaction_id'])
            transactions.set_transaction_date(value['transaction_date'])
            transactions.set_transaction_type_formatted(value[\
            'transaction_type_formatted'])
            transactions.set_account_id(value['account_id']) 
            transactions.set_customer_id(value['customer_id'])
            transactions.set_payee(value['payee'])
            transactions.set_description(value['description'])
            transactions.set_entry_number(value['entry_number'])
            transactions.set_currency_id(value['currency_id'])
            transactions.set_currency_code(value['currency_code'])
            transactions.set_debit_or_credit(value['debit_or_credit'])
            transactions.set_offset_account_name(value['offset_account_name'])
            transactions.set_reference_number(value['reference_number'])
            transactions.set_reconcile_status(value['reconcile_status'])
            transactions.set_debit_amount(value['debit_amount'])
            transactions.set_credit_amount(value['credit_amount'])
            transactions_list.set_transactions(transactions)
        page_context = resp['page_context']
        page_context_obj = PageContext()
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        transactions_list.set_page_context(page_context_obj)
        return transactions_list
    def get_list(self, resp):
        """This method parses the given response and returns bank transaction 
            list.

        Args: 
            resp(dict): Response containing json object for Bank transaction 
                list.

        Returns:
            instance: Bank transaction list object.

        """
        bank_transaction_list = TransactionList()
        for value in resp['banktransactions']:
            bank_transaction = Transaction()
            bank_transaction.set_transaction_id(value['transaction_id'])
            bank_transaction.set_date(value['date'])
            bank_transaction.set_amount(value['amount']) 
            bank_transaction.set_transaction_type(value['transaction_type'])
            bank_transaction.set_status(value['status'])
            bank_transaction.set_source(value['source'])
            bank_transaction.set_account_id(value['account_id'])
            bank_transaction.set_customer_id(value['customer_id'])
            bank_transaction.set_payee(value['payee'])
            bank_transaction.set_currency_id(value['currency_id'])
            bank_transaction.set_currency_code(value['currency_code'])
            bank_transaction.set_debit_or_credit(value['debit_or_credit'])
            bank_transaction.set_offset_account_name(value['offset_account_name'])
            bank_transaction.set_reference_number(value['reference_number'])
            bank_transaction.set_imported_transaction_id(value[\
            'imported_transaction_id'])
            bank_transaction_list.set_transactions(bank_transaction)
        page_context_obj = PageContext()
        page_context = resp['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_applied_filter(page_context['applied_filter'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        bank_transaction_list.set_page_context(page_context_obj)
        return bank_transaction_list
    def creditnotes_list(self,response):
        """This method parses the given response and creates a creditnotes 
            list object.

        Args:
            response(dict):Response containing json object for credit notes 
                list.

        Returns:
            instance: Creditnotes list object.

        """
        credit_notes_list=CreditNoteList()
        credit_notes=[]
        for value in response['creditnotes']:
            credit_note=CreditNote()
            credit_note.set_creditnote_id(value['creditnote_id'])
            credit_note.set_creditnote_number(value['creditnote_number'])
            credit_note.set_status(value['status'])
            credit_note.set_reference_number(value['reference_number'])
            credit_note.set_date(value['date'])
            credit_note.set_total(value['total'])
            credit_note.set_balance(value['balance'])
            credit_note.set_customer_id(value['customer_id'])
            credit_note.set_customer_name(value['customer_name'])
            credit_note.set_currency_id(value['currency_id'])
            credit_note.set_currency_code(value['currency_code'])
            credit_note.set_created_time(value['created_time'])
            credit_note.set_last_modified_time(value['last_modified_time'])
            credit_note.set_is_emailed(value['is_emailed'])
            credit_notes.append(credit_note)
        credit_notes_list.set_creditnotes(credit_notes)
        page_context_obj=PageContext()
        page_context=response['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_applied_filter(page_context['applied_filter'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        credit_notes_list.set_page_context(page_context_obj)
        return credit_notes_list
    def get_list(self, resp):
        """This method parses the given response and returns bank account list 
            object.

        Args:
            resp(dict): Response containing json object for Bank account list.

        Returns:
            instance: Bank account list object.

        """
        bank_account_list = BankAccountList()
        for value in resp['bankaccounts']:
            bank_accounts = BankAccount()
            bank_accounts.set_account_id(value['account_id'])
            bank_accounts.set_account_name(value['account_name'])
            bank_accounts.set_currency_id(value['currency_id'])
            bank_accounts.set_currency_code(value['currency_code'])
            bank_accounts.set_account_type(value['account_type'])
            bank_accounts.set_uncategorized_transactions(\
            value['uncategorized_transactions'])
            bank_accounts.set_is_active(value['is_active'])
            bank_accounts.set_balance(value['balance'])
            bank_accounts.set_bank_name(value['bank_name'])
            bank_accounts.set_routing_number(value['routing_number'])
            bank_accounts.set_is_primary_account(value['is_primary_account'])
            bank_accounts.set_is_paypal_account(value['is_paypal_account'])
            if value['is_paypal_account']:
                bank_accounts.set_paypal_email_address(\
                value['paypal_email_address'])
            bank_account_list.set_bank_accounts(bank_accounts)
        page_context_obj = PageContext()
        page_context = resp['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_applied_filter(page_context['applied_filter'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        bank_account_list.set_page_context(page_context_obj)
        return bank_account_list
    def get_list(self, response):
        """This method parses the given response and returns estimates list 
            object.
  
        Args:
            response(dict): Response containing json object for estimates.

        Returns:
            instance: Estimates list object.

        """
        resp = response['estimates']
        estimate_list = EstimateList()
        for value in resp:
            estimates = Estimate()
            estimates.set_estimate_id(value['estimate_id'])
            estimates.set_customer_name(value['customer_name'])
            estimates.set_customer_id(value['customer_id'])
            estimates.set_status(value['status'])
            estimates.set_estimate_number(value['estimate_number'])
            estimates.set_reference_number(value['reference_number'])
            estimates.set_date(value['date'])
            estimates.set_currency_id(value['currency_id'])
            estimates.set_currency_code(value['currency_code'])
            estimates.set_total(value['total'])
            estimates.set_created_time(value['created_time'])
            estimates.set_accepted_date(value['accepted_date'])
            estimates.set_declined_date(value['declined_date'])
            estimates.set_expiry_date(value['expiry_date'])
            estimate_list.set_estimates(estimates)
        page_context_object = PageContext()
        page_context = response['page_context']
        page_context_object.set_page(page_context['page'])
        page_context_object.set_per_page(page_context['per_page'])
        page_context_object.set_has_more_page(page_context['has_more_page'])
        page_context_object.set_report_name(page_context['report_name'])
        page_context_object.set_applied_filter(page_context['applied_filter'])
        page_context_object.set_sort_column(page_context['sort_column'])
        page_context_object.set_sort_order(page_context['sort_order'])
        estimate_list.set_page_context(page_context_object)
        return estimate_list
示例#41
0
    def get_list(self, response):
        """This method parses the given response and returns estimates list 
            object.
  
        Args:
            response(dict): Response containing json object for estimates.

        Returns:
            instance: Estimates list object.

        """
        resp = response['estimates']
        estimate_list = EstimateList()
        for value in resp:
            estimates = Estimate()
            estimates.set_estimate_id(value['estimate_id'])
            estimates.set_customer_name(value['customer_name'])
            estimates.set_customer_id(value['customer_id'])
            estimates.set_status(value['status'])
            estimates.set_estimate_number(value['estimate_number'])
            estimates.set_reference_number(value['reference_number'])
            estimates.set_date(value['date'])
            estimates.set_currency_id(value['currency_id'])
            estimates.set_currency_code(value['currency_code'])
            estimates.set_total(value['total'])
            estimates.set_created_time(value['created_time'])
            estimates.set_accepted_date(value['accepted_date'])
            estimates.set_declined_date(value['declined_date'])
            estimates.set_expiry_date(value['expiry_date'])
            estimate_list.set_estimates(estimates)
        page_context_object = PageContext()
        page_context = response['page_context']
        page_context_object.set_page(page_context['page'])
        page_context_object.set_per_page(page_context['per_page'])
        page_context_object.set_has_more_page(page_context['has_more_page'])
        page_context_object.set_report_name(page_context['report_name'])
        page_context_object.set_applied_filter(page_context['applied_filter'])
        page_context_object.set_sort_column(page_context['sort_column'])
        page_context_object.set_sort_order(page_context['sort_order'])
        estimate_list.set_page_context(page_context_object)
        return estimate_list
示例#42
0
    def get_comment_list(self, response):
        """This method parses the given response and creates object for
            comments list.

        Args:
            response(dict): Response containing json object for comments list.

        Returns:
            instance: cComments list object.

        """
        comment_list = CommentList()
        contact_comments = response['contact_comments']
        for value in contact_comments:
            contact_comment = Comment()
            contact_comment.set_comment_id(value['comment_id'])
            contact_comment.set_contact_id(value['contact_id'])
            contact_comment.set_contact_name(value['contact_name'])
            contact_comment.set_description(value['description'])
            contact_comment.set_commented_by_id(value['commented_by_id'])
            contact_comment.set_commented_by(value['commented_by'])
            contact_comment.set_date(value['date'])
            contact_comment.set_date_description(value['date_description'])
            contact_comment.set_time(value['time'])
            contact_comment.set_transaction_id(value['transaction_id'])
            contact_comment.set_transaction_type(value['transaction_type'])
            contact_comment.set_is_entity_deleted(value['is_entity_deleted'])
            contact_comment.set_operation_type(value['operation_type'])
            comment_list.set_comments(contact_comment)
        page_context = response['page_context']
        page_context_object = PageContext()
        page_context_object.set_page(page_context['page'])
        page_context_object.set_per_page(page_context['per_page'])
        page_context_object.set_has_more_page(page_context['has_more_page'])
        page_context_object.set_applied_filter(page_context['applied_filter'])
        page_context_object.set_sort_column(page_context['sort_column'])
        page_context_object.set_sort_order(page_context['sort_order'])
        comment_list.set_page_context(page_context_object)

        return comment_list
示例#43
0
    def get_comment_list(self, response):
        """This method parses the given response and creates object for 
            comments list.

        Args:
            response(dict): Response containing json object for comments list.

        Returns:
            instance: cComments list object.

        """
        comment_list = CommentList()
        contact_comments = response['contact_comments']
        for value in contact_comments:
            contact_comment = Comment() 
            contact_comment.set_comment_id(value['comment_id'])
            contact_comment.set_contact_id(value['contact_id'])
            contact_comment.set_contact_name(value['contact_name'])
            contact_comment.set_description(value['description'])
            contact_comment.set_commented_by_id(value['commented_by_id'])
            contact_comment.set_commented_by(value['commented_by'])
            contact_comment.set_date(value['date'])
            contact_comment.set_date_description(value['date_description'])
            contact_comment.set_time(value['time'])
            contact_comment.set_transaction_id(value['transaction_id'])
            contact_comment.set_transaction_type(value['transaction_type'])
            contact_comment.set_is_entity_deleted(value['is_entity_deleted'])
            contact_comment.set_operation_type(value['operation_type'])
            comment_list.set_comments(contact_comment)
        page_context = response['page_context']
        page_context_object = PageContext()
        page_context_object.set_page(page_context['page'])
        page_context_object.set_per_page(page_context['per_page'])
        page_context_object.set_has_more_page(page_context['has_more_page'])
        page_context_object.set_applied_filter(page_context['applied_filter'])
        page_context_object.set_sort_column(page_context['sort_column'])
        page_context_object.set_sort_order(page_context['sort_order'])
        comment_list.set_page_context(page_context_object)
    
        return comment_list
    def get_list(self, resp):
        """This method parses the given response and returns  bill list object.

        Args:
            resp(dict): Response containing json object for bill list.

        Returns: 
            instance: Bill list object.

        """
        bill_list = BillList()
        for value in resp['bills']:
            bill = Bill()
            bill.set_bill_id(value['bill_id'])
            bill.set_vendor_id(value['vendor_id'])
            bill.set_vendor_name(value['vendor_name'])
            bill.set_status(value['status'])
            bill.set_bill_number(value['bill_number'])
            bill.set_reference_number(value['reference_number'])
            bill.set_date(value['date'])
            bill.set_due_date(value['due_date'])
            bill.set_due_days(value['due_days'])
            bill.set_currency_id(value['currency_id'])
            bill.set_currency_code(value['currency_code'])
            bill.set_total(value['total'])
            bill.set_balance(value['balance'])
            bill.set_created_time(value['created_time'])
            bill_list.set_bills(bill)
        page_context_obj = PageContext()
        page_context = resp['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_applied_filter(page_context['applied_filter'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        bill_list.set_page_context(page_context_obj)
        return bill_list
示例#45
0
    def get_list(self, resp):
        """This method parses the given response and returns  bill list object.

        Args:
            resp(dict): Response containing json object for bill list.

        Returns: 
            instance: Bill list object.

        """
        bill_list = BillList()
        for value in resp['bills']:
            bill = Bill()
            bill.set_bill_id(value['bill_id'])
            bill.set_vendor_id(value['vendor_id'])
            bill.set_vendor_name(value['vendor_name'])
            bill.set_status(value['status'])
            bill.set_bill_number(value['bill_number'])
            bill.set_reference_number(value['reference_number'])
            bill.set_date(value['date'])
            bill.set_due_date(value['due_date'])
            bill.set_due_days(value['due_days'])
            bill.set_currency_id(value['currency_id'])
            bill.set_currency_code(value['currency_code'])
            bill.set_total(value['total'])
            bill.set_balance(value['balance'])
            bill.set_created_time(value['created_time'])
            bill_list.set_bills(bill)
        page_context_obj = PageContext()
        page_context = resp['page_context']
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page']) 
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_applied_filter(page_context['applied_filter'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        bill_list.set_page_context(page_context_obj)
        return bill_list
示例#46
0
    def get_refund_list(self, response):
        """This method parses the given response and creates refund list
            object.

        Args:
            response(dict): Response containing json object for refund list.

        Returns:
            instance: Refund list object.

        """
        list_refund = CreditNoteRefundList()
        creditnote_refunds = response['creditnote_refunds']
        for value in creditnote_refunds:
            creditnote_refund = CreditNoteRefund()
            creditnote_refund.set_creditnote_refund_id(value[\
                'creditnote_refund_id'])
            creditnote_refund.set_creditnote_id(value['creditnote_id'])
            creditnote_refund.set_date(value['date'])
            creditnote_refund.set_refund_mode(value['refund_mode'])
            creditnote_refund.set_reference_number(value['reference_number'])
            creditnote_refund.set_creditnote_number(value['creditnote_number'])
            creditnote_refund.set_customer_name(value['customer_name'])
            creditnote_refund.set_description(value['description'])
            creditnote_refund.set_amount_bcy(value['amount_bcy'])
            creditnote_refund.set_amount_fcy(value['amount_fcy'])
            list_refund.set_creditnote_refunds(creditnote_refund)
        page_context = response['page_context']
        page_context_object = PageContext()
        page_context_object.set_page(page_context['page'])
        page_context_object.set_per_page(page_context['per_page'])
        page_context_object.set_has_more_page(page_context['has_more_page'])
        page_context_object.set_report_name(page_context['report_name'])
        page_context_object.set_sort_column(page_context['sort_column'])
        page_context_object.set_sort_order(page_context['sort_order'])
        list_refund.set_page_context(page_context_object)

        return list_refund
示例#47
0
    def get_refund_list(self, response):
        """This method parses the given response and creates refund list 
            object.

        Args:
            response(dict): Response containing json object for refund list.

        Returns:
            instance: Refund list object.

        """
        list_refund = CreditNoteRefundList()
        creditnote_refunds = response['creditnote_refunds']
        for value in creditnote_refunds:
            creditnote_refund = CreditNoteRefund()
            creditnote_refund.set_creditnote_refund_id(value[\
                'creditnote_refund_id'])
            creditnote_refund.set_creditnote_id(value['creditnote_id'])
            creditnote_refund.set_date(value['date'])
            creditnote_refund.set_refund_mode(value['refund_mode'])
            creditnote_refund.set_reference_number(value['reference_number'])
            creditnote_refund.set_creditnote_number(value['creditnote_number'])
            creditnote_refund.set_customer_name(value['customer_name'])
            creditnote_refund.set_description(value['description'])
            creditnote_refund.set_amount_bcy(value['amount_bcy'])
            creditnote_refund.set_amount_fcy(value['amount_fcy'])
            list_refund.set_creditnote_refunds(creditnote_refund)
        page_context = response['page_context']
        page_context_object = PageContext()
        page_context_object.set_page(page_context['page'])
        page_context_object.set_per_page(page_context['per_page'])
        page_context_object.set_has_more_page(page_context['has_more_page'])
        page_context_object.set_report_name(page_context['report_name'])
        page_context_object.set_sort_column(page_context['sort_column'])
        page_context_object.set_sort_order(page_context['sort_order'])    
        list_refund.set_page_context(page_context_object)

        return list_refund
    def get_invoice_list(self, resp):
        """This method parses the given response and returns invoice list 
            object.

        Args:
            resp(dict): Response containing json object for invoice list 
                object.

        Returns:
            instance: Invoice list object.

        """
        invoices = InvoiceList()
        for value in resp['invoices']:
            invoice = Invoice()
            invoice.set_invoice_id(value['invoice_id'])
            invoice.set_customer_name(value['customer_name'])
            invoice.set_customer_id(value['customer_id'])
            invoice.set_status(value['status'])
            invoice.set_invoice_number(value['invoice_number'])
            invoice.set_reference_number(value['reference_number'])
            invoice.set_date(value['date'])
            invoice.set_due_date(value['due_date'])
            invoice.set_total(value['total'])
            invoice.set_balance(value['balance'])
            invoice.set_created_time(value['created_time'])
            invoices.set_invoices(invoice)
        page_context = resp['page_context']
        page_context_obj = PageContext()
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        invoices.set_page_context(page_context)
        return invoices
    def get_invoice_list(self, resp):
        """This method parses the given response and returns invoice list 
            object.

        Args:
            resp(dict): Response containing json object for invoice list 
                object.

        Returns:
            instance: Invoice list object.

        """
        invoices = InvoiceList()
        for value in resp['invoices']:
            invoice = Invoice()
            invoice.set_invoice_id(value['invoice_id'])
            invoice.set_customer_name(value['customer_name'])
            invoice.set_customer_id(value['customer_id'])
            invoice.set_status(value['status'])
            invoice.set_invoice_number(value['invoice_number'])
            invoice.set_reference_number(value['reference_number'])
            invoice.set_date(value['date'])
            invoice.set_due_date(value['due_date'])
            invoice.set_total(value['total'])
            invoice.set_balance(value['balance'])
            invoice.set_created_time(value['created_time'])
            invoices.set_invoices(invoice)
        page_context = resp['page_context']
        page_context_obj = PageContext()
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        invoices.set_page_context(page_context)
        return invoices
    def get_list(self, resp):
        """This method parses the given response and returns base currency 
            adjustment list object.

        Args:
            resp(dict): Response containing json for base currency adjustments 
                list.

        Returns:
            instance: Base currency list object.

        """
        base_currency_adjustment_list = BaseCurrencyAdjustmentList()
        for value in resp['base_currency_adjustments']:
            base_currency_adjustment = BaseCurrencyAdjustment()
            base_currency_adjustment.set_base_currency_adjustment_id(\
            value['base_currency_adjustment_id'])
            base_currency_adjustment.set_adjustment_date(value[\
            'adjustment_date'])
            base_currency_adjustment.set_exchange_rate(value['exchange_rate'])
            base_currency_adjustment.set_currency_id(value['currency_id'])
            base_currency_adjustment.set_currency_code(value['currency_code'])
            base_currency_adjustment.set_notes(value['notes'])
            base_currency_adjustment.set_gain_or_loss(value['gain_or_loss'])
            base_currency_adjustment_list.set_base_currency_adjustments(\
            base_currency_adjustment)
        page_context = resp['page_context']
        page_context_obj = PageContext()
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_applied_filter(page_context['applied_filter'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        base_currency_adjustment_list.set_page_context(page_context_obj)
        return base_currency_adjustment_list
    def get_list(self, resp):
        """This method parses the given response and returns base currency 
            adjustment list object.

        Args:
            resp(dict): Response containing json for base currency adjustments 
                list.

        Returns:
            instance: Base currency list object.

        """
        base_currency_adjustment_list = BaseCurrencyAdjustmentList()
        for value in resp['base_currency_adjustments']:
            base_currency_adjustment = BaseCurrencyAdjustment()
            base_currency_adjustment.set_base_currency_adjustment_id(\
            value['base_currency_adjustment_id'])
            base_currency_adjustment.set_adjustment_date(value[\
            'adjustment_date'])
            base_currency_adjustment.set_exchange_rate(value['exchange_rate'])
            base_currency_adjustment.set_currency_id(value['currency_id'])
            base_currency_adjustment.set_currency_code(value['currency_code'])
            base_currency_adjustment.set_notes(value['notes'])
            base_currency_adjustment.set_gain_or_loss(value['gain_or_loss'])
            base_currency_adjustment_list.set_base_currency_adjustments(\
            base_currency_adjustment)
        page_context = resp['page_context']
        page_context_obj = PageContext()
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_report_name(page_context['report_name'])
        page_context_obj.set_applied_filter(page_context['applied_filter'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        base_currency_adjustment_list.set_page_context(page_context_obj)
        return base_currency_adjustment_list
    def payment_refunds(self, response):
        """This method parses the given response and returns credit notes
            refund list.

        Args:
            response(dict): Repsonse containing json object for credit notes
                list.

        Returns:
            instance: Creditnote list object.

        """
        payment_refunds_list = CreditNoteRefundList()
        if 'payment_refunds' not in response:
            response['payment_refunds'] = [response['payment_refund']]
        for value in response['payment_refunds']:
            payment_refund = CreditNoteRefund()
            payment_refund.set_creditnote_refund_id(value['payment_refund_id'])
            payment_refund.set_creditnote_id(value['payment_id'])
            payment_refund.set_date(value['date'])
            payment_refund.set_refund_mode(value['refund_mode'])
            payment_refund.set_reference_number(value['reference_number'])
            payment_refund.set_description(value['description'])
            payment_refund.set_amount(value['amount'])
            payment_refunds_list.set_creditnote_refunds(payment_refund)
        if 'page_context' in response:
            page_context = response['page_context']
            page_context_obj = PageContext()
            page_context_obj.set_page(page_context['page'])
            page_context_obj.set_per_page(page_context['per_page'])
            page_context_obj.set_has_more_page(page_context['has_more_page'])
            page_context_obj.set_report_name(page_context['report_name'])
            page_context_obj.set_sort_column(page_context['sort_column'])
            page_context_obj.set_sort_order(page_context['sort_order'])
            payment_refunds_list.set_page_context(page_context_obj)
        return payment_refunds_list
    def get_statement(self, resp):
        """This method parses the given response and returns statement object.

        Args:
            resp(dict): Response containing json onbject for statement.

        Returns: 
            instance: Statement object.

        """
        statement = resp['statement']
        statement_obj = Statement()
        statement_obj.set_statement_id(statement['statement_id'])
        statement_obj.set_from_date(statement['from_date'])
        statement_obj.set_to_date(statement['to_date'])
        statement_obj.set_source(statement['source'])
        for value in statement['transactions']:
            transactions = Transaction()
            transactions.set_transaction_id(value['transaction_id'])
            transactions.set_debit_or_credit(value['debit_or_credit'])
            transactions.set_date(value['date'])
            transactions.set_customer_id(value['customer_id'])
            transactions.set_payee(value['payee'])
            transactions.set_reference_number(value['reference_number'])
            transactions.set_amount(value['amount'])
            transactions.set_status(value['status'])
            statement_obj.set_transactions(transactions)
        page_context = resp['page_context']
        page_context_obj = PageContext()
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        statement_obj.set_page_context(page_context_obj)
        return statement_obj
    def get_statement(self, resp):
        """This method parses the given response and returns statement object.

        Args:
            resp(dict): Response containing json onbject for statement.

        Returns: 
            instance: Statement object.

        """
        statement = resp['statement']
        statement_obj = Statement()
        statement_obj.set_statement_id(statement['statement_id'])
        statement_obj.set_from_date(statement['from_date'])
        statement_obj.set_to_date(statement['to_date'])
        statement_obj.set_source(statement['source'])
        for value in statement['transactions']:
            transactions = Transaction()
            transactions.set_transaction_id(value['transaction_id'])
            transactions.set_debit_or_credit(value['debit_or_credit'])
            transactions.set_date(value['date'])
            transactions.set_customer_id(value['customer_id'])
            transactions.set_payee(value['payee'])
            transactions.set_reference_number(value['reference_number'])
            transactions.set_amount(value['amount'])
            transactions.set_status(value['status'])
            statement_obj.set_transactions(transactions)
        page_context = resp['page_context']
        page_context_obj = PageContext()
        page_context_obj.set_page(page_context['page'])
        page_context_obj.set_per_page(page_context['per_page'])
        page_context_obj.set_has_more_page(page_context['has_more_page'])
        page_context_obj.set_sort_column(page_context['sort_column'])
        page_context_obj.set_sort_order(page_context['sort_order'])
        statement_obj.set_page_context(page_context_obj)
        return statement_obj