Beispiel #1
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
Beispiel #2
0
# List organizations.

print organizations_api.get_organizations()

#Get organization

print organizations_api.get(organization_id)

#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")