How to use the schwifty.common.Base._get_component function in schwifty

To help you get started, we’ve selected a few schwifty examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mdomke / schwifty / schwifty / iban.py View on Github external
    @property
    def bic(self):
        """BIC: The BIC associated to the IBAN´s bank-code."""
        return BIC.from_bank_code(self.country_code, self.bank_code)

    @property
    def country(self):
        """Country: The country this IBAN is registered in."""
        return countries.get(alpha_2=self.country_code)

    def _get_code(self, code_type):
        start, end = self.spec["positions"][code_type]
        return self.bban[start:end]

    bban = property(partial(Base._get_component, start=4), doc="str: The BBAN part of the IBAN.")
    country_code = property(
        partial(Base._get_component, start=0, end=2), doc="str: ISO 3166 alpha-2 country code."
    )
    checksum_digits = property(
        partial(Base._get_component, start=2, end=4), doc="str: Two digit checksum of the IBAN."
    )
    bank_code = property(
        partial(_get_code, code_type="bank_code"), doc="str: The country specific bank-code."
    )
    branch_code = property(
        partial(_get_code, code_type="branch_code"),
        doc="str or None: The branch-code of the bank if available.",
    )
    account_code = property(
        partial(_get_code, code_type="account_code"), doc="str: The customer specific account-code"
    )
github mdomke / schwifty / schwifty / iban.py View on Github external
def bic(self):
        """BIC: The BIC associated to the IBAN´s bank-code."""
        return BIC.from_bank_code(self.country_code, self.bank_code)

    @property
    def country(self):
        """Country: The country this IBAN is registered in."""
        return countries.get(alpha_2=self.country_code)

    def _get_code(self, code_type):
        start, end = self.spec["positions"][code_type]
        return self.bban[start:end]

    bban = property(partial(Base._get_component, start=4), doc="str: The BBAN part of the IBAN.")
    country_code = property(
        partial(Base._get_component, start=0, end=2), doc="str: ISO 3166 alpha-2 country code."
    )
    checksum_digits = property(
        partial(Base._get_component, start=2, end=4), doc="str: Two digit checksum of the IBAN."
    )
    bank_code = property(
        partial(_get_code, code_type="bank_code"), doc="str: The country specific bank-code."
    )
    branch_code = property(
        partial(_get_code, code_type="branch_code"),
        doc="str or None: The branch-code of the bank if available.",
    )
    account_code = property(
        partial(_get_code, code_type="account_code"), doc="str: The customer specific account-code"
    )
github mdomke / schwifty / schwifty / bic.py View on Github external
if self.location_code[1] == "0":
            return "testing"
        elif self.location_code[1] == "1":
            return "passive"
        elif self.location_code[1] == "2":
            return "reverse billing"
        else:
            return "default"

    @property
    def country(self):
        """Country: The country this BIC is registered in."""
        return countries.get(alpha_2=self.country_code)

    bank_code = property(
        partial(Base._get_component, start=0, end=4), doc="str: The bank-code part of the BIC."
    )
    country_code = property(
        partial(Base._get_component, start=4, end=6), doc="str: The ISO 3166 alpha2 country-code."
    )
    location_code = property(
        partial(Base._get_component, start=6, end=8), doc="str: The location code of the BIC."
    )
    branch_code = property(
        partial(Base._get_component, start=8, end=11),
        doc="str or None: The branch-code part of the BIC (if available)",
    )


registry.build_index("bank", "bic", key="bic", accumulate=True)
registry.build_index("bank", "bank_code", key=("country_code", "bank_code"), primary=True)
github mdomke / schwifty / schwifty / bic.py View on Github external
return "passive"
        elif self.location_code[1] == "2":
            return "reverse billing"
        else:
            return "default"

    @property
    def country(self):
        """Country: The country this BIC is registered in."""
        return countries.get(alpha_2=self.country_code)

    bank_code = property(
        partial(Base._get_component, start=0, end=4), doc="str: The bank-code part of the BIC."
    )
    country_code = property(
        partial(Base._get_component, start=4, end=6), doc="str: The ISO 3166 alpha2 country-code."
    )
    location_code = property(
        partial(Base._get_component, start=6, end=8), doc="str: The location code of the BIC."
    )
    branch_code = property(
        partial(Base._get_component, start=8, end=11),
        doc="str or None: The branch-code part of the BIC (if available)",
    )


registry.build_index("bank", "bic", key="bic", accumulate=True)
registry.build_index("bank", "bank_code", key=("country_code", "bank_code"), primary=True)