Пример #1
0
    def get_organizations(self, resp):
        """This message parses the given response and returns organizations 
            list.

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

        """
        organizations_list = []
        for value in resp['organizations']:
            organization = Organization()
            organization.set_organization_id(value['organization_id'])
            organization.set_name(value['name'])
            organization.set_contact_name(value['contact_name'])
            organization.set_email(value['email'])
            organization.set_is_default_org(value['is_default_org'])
            organization.set_version(value['version'])
            organization.set_plan_type(value['plan_type'])
            organization.set_tax_group_enabled(value['tax_group_enabled'])
            organization.set_plan_name(value['plan_name'])
            organization.set_plan_period(value['plan_period'])
            organization.set_language_code(value['language_code'])
            organization.set_fiscal_year_start_month(value[\
            'fiscal_year_start_month'])
            organization.set_account_created_date(value[\
            'account_created_date'])
            organization.set_account_created_date_formatted(value[\
            'account_created_date_formatted'])
            organization.set_time_zone(value['time_zone'])
            organization.set_is_org_active(value['is_org_active'])
            organization.set_currency_id(value['currency_id'])
            organization.set_currency_code(value['currency_code'])
            organization.set_currency_symbol(value['currency_symbol'])
            organization.set_currency_format(value['currency_format'])
            organization.set_price_precision(value['price_precision'])
            organizations_list.append(organization)
        return organizations_list
Пример #2
0
    def get_organization(self, resp):
        """This method parses the given response and returns organization 
            object.

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

        """
        organization = resp['organization']
        organization_obj = Organization()
        organization_obj.set_organization_id(organization['organization_id'])
        organization_obj.set_name(organization['name'])
        organization_obj.set_is_default_org(organization['is_default_org'])
        organization_obj.set_user_role(organization['user_role'])
        organization_obj.set_account_created_date(organization[\
        'account_created_date'])
        organization_obj.set_time_zone(organization['time_zone'])
        organization_obj.set_language_code(organization['language_code'])
        organization_obj.set_date_format(organization['date_format'])
        organization_obj.set_field_separator(organization['field_separator'])
        organization_obj.set_fiscal_year_start_month(organization[\
        'fiscal_year_start_month'])
        organization_obj.set_contact_name(organization['contact_name'])
        organization_obj.set_industry_type(organization['industry_type'])
        organization_obj.set_industry_size(organization['industry_size'])
        organization_obj.set_company_id_label(organization['company_id_label'])
        organization_obj.set_company_id_value(organization['company_id_value'])
        organization_obj.set_tax_id_label(organization['tax_id_label'])
        organization_obj.set_tax_id_value(organization['tax_id_value'])
        organization_obj.set_currency_id(organization['currency_id'])
        organization_obj.set_currency_code(organization['currency_code'])
        organization_obj.set_currency_symbol(organization['currency_symbol'])
        organization_obj.set_currency_format(organization['currency_format'])
        organization_obj.set_price_precision(organization['price_precision'])
        address = organization['address']
        address_obj = Address()
        address_obj.set_street_address1(address['street_address1'])
        address_obj.set_street_address2(address['street_address2'])
        address_obj.set_city(address['city'])
        address_obj.set_state(address['state'])
        address_obj.set_country(address['country'])
        address_obj.set_zip(address['zip'])
        organization_obj.set_address(address_obj)
        organization_obj.set_org_address(organization['org_address'])
        organization_obj.set_remit_to_address(organization['remit_to_address'])
        organization_obj.set_phone(organization['phone'])
        organization_obj.set_fax(organization['fax'])
        organization_obj.set_website(organization['website'])
        organization_obj.set_email(organization['email'])
        organization_obj.set_tax_basis(organization['tax_basis'])
        for value in organization['custom_fields']:
            custom_field = CustomField()
            custom_field.set_value(value['value'])
            custom_field.set_index(value['index'])
            custom_field.set_label(value['label'])
            organization_obj.set_custom_fields(custom_field)
        organization_obj.set_is_org_active(organization['is_org_active'])
        organization_obj.set_is_new_customer_custom_fields(organization[\
        'is_new_customer_custom_fields'])
        organization_obj.set_is_portal_enabled(
            organization['is_portal_enabled'])
        organization_obj.set_portal_name(organization['portal_name'])
        return organization_obj
Пример #3
0
#Create organization

organization = Organization()
organization.set_name("Jony and co")
address = Address()
address.set_street_address1("2/65")
address.set_street_address2("vignesh plaza")
address.set_city("MDU")
address.set_state("TN")
address.set_country("India")
address.set_zip("322")
organization.set_address(address)
organization.set_industry_type("")
organization.set_industry_size("")
organization.set_fiscal_year_start_month("january")
organization.set_currency_code("USD")
organization.set_time_zone("Asia/Calcutta")
organization.set_date_format("dd MMM yyyy")
organization.set_field_separator("")
organization.set_language_code("en")
organization.set_tax_basis("accrual")
organization.set_tax_type("tax")
organization.set_org_address("")
organization.set_remit_to_address("")
print organizations_api.create(organization)

#Update organization

organization = Organization()
organization.set_name("Jony and co")