示例#1
0
def process(business: Business, filing: Dict):
    """Render the Alteration onto the model objects."""
    # Alter the corp type, if any
    with suppress(IndexError, KeyError, TypeError):
        business_json = dpath.util.get(filing, '/alteration/business')
        business_info.set_corp_type(business, business_json)

    # update name translations, if any
    with suppress(IndexError, KeyError, TypeError):
        business_json = dpath.util.get(filing, '/alteration/nameTranslations')
        aliases.update_aliases(business, business_json)

    # update share structure and resolutions, if any
    with suppress(IndexError, KeyError, TypeError):
        share_structure = dpath.util.get(filing, '/alteration/shareStructure')
        shares.update_share_structure(business, share_structure)
示例#2
0
def test_manage_share_structure__share_classes(app, session, test_name,
                                               share_structure,
                                               expected_error):
    """Assert that the corp share classes gets set."""
    business = Business()
    business.save()
    err = shares.update_share_structure(business,
                                        share_structure['shareStructure'])
    business.save()

    check_business = Business.find_by_internal_id(business.id)
    check_share_classes = check_business.share_classes.all()

    check_share_structure = {'shareStructure': {'shareClasses': []}}
    for s in check_share_classes:
        check_share_structure['shareStructure']['shareClasses'].append(s.json)

    stripped_dict = strip_keys_from_dict(check_share_structure, ['id'])
    assert stripped_dict == share_structure
    assert not err
示例#3
0
def test_manage_share_structure__resolution_dates(app, session, test_name,
                                                  resolution_dates,
                                                  expected_error):
    """Assert that the corp share resolution date gets set."""
    new_data = {'shareStructure': {'resolutionDates': resolution_dates}}

    business = Business()
    business.save()
    err = shares.update_share_structure(business, new_data['shareStructure'])
    business.save()

    check_business = Business.find_by_internal_id(business.id)
    check_resolution = check_business.resolutions.all()

    if err:
        assert err == expected_error
    else:
        assert len(check_resolution) == len(resolution_dates)
        assert set(resolution_dates) == \
            set([x.resolution_date.isoformat() for x in check_resolution])
示例#4
0
def process(business: Business, filing_rec: Filing, filing: Dict,
            filing_meta: FilingMeta):
    # pylint: disable=too-many-locals; 1 extra
    """Process the incoming transition filing."""
    # Extract the filing information for transition application
    if not (transition_filing := filing.get('transition')):  # pylint: disable=superfluous-parens;
        raise QueueException(
            f'legal_filing:transition data missing from {filing_rec.id}')
    if not business:
        raise QueueException(
            f'Business does not exist: legal_filing:transitionApplication {filing_rec.id}'
        )

    # Initial insert of the business record
    business.restriction_ind = transition_filing.get('hasProvisions')

    if offices := transition_filing['offices']:
        update_offices(business, offices)

    if parties := transition_filing.get('parties'):
        update_parties(business, parties)

    if share_structure := transition_filing['shareStructure']:
        shares.update_share_structure(business, share_structure)

    if name_translations := transition_filing.get('nameTranslations'):
        aliases.update_aliases(business, name_translations)

    return filing_rec