Exemplo n.º 1
0
    def request_tax1099(
        self,
        password: str,
        *taxyears: str,
        acctnum: str = None,
        recid: str = None,
        dryrun: bool = False,
        verify_ssl: bool = True,
        timeout: Optional[float] = None,
    ) -> BinaryIO:
        """
        Request US federal income tax form 1099 (TAX1099RQ)
        """
        logger.info("Creating tax 1099 request")
        signon = self.signon(password)

        rq = TAX1099RQ(*taxyears, recid=recid or None)
        msgs = TAX1099MSGSRQV1(TAX1099TRNRQ(trnuid=self.uuid, tax1099rq=rq))

        logger.debug(f"Wrapped tax 1099 request messages: {msgs}")

        ofx = OFX(signonmsgsrqv1=signon, tax1099msgsrqv1=msgs)
        return self.download(ofx,
                             dryrun=dryrun,
                             verify_ssl=verify_ssl,
                             timeout=timeout)
Exemplo n.º 2
0
    def request_tax1099(
        self,
        password: str,
        *taxyears: str,
        acctnum: str = None,
        recid: str = None,
        gen_newfileuid: bool = True,
        dryrun: bool = False,
        timeout: Optional[float] = None,
    ) -> BinaryIO:
        """
        Request US federal income tax form 1099 (TAX1099RQ)
        """
        if dryrun:
            url = ""
        else:
            RqCls2url = self._get_service_urls(
                timeout=timeout,
                gen_newfileuid=gen_newfileuid,
            )

            # HACK FIXME
            # As a simplification, we assume that FIs handle all classes
            # of statement request from a single URL.
            urls = set(RqCls2url.values())
            assert len(urls) == 1
            url = urls.pop()

        logger.info("Creating tax 1099 request")
        signon = self.signon(password)

        rq = TAX1099RQ(*taxyears, recid=recid or None)
        msgs = TAX1099MSGSRQV1(TAX1099TRNRQ(trnuid=self.uuid, tax1099rq=rq))

        logger.debug(f"Wrapped tax 1099 request messages: {msgs}")

        ofx = OFX(signonmsgsrqv1=signon, tax1099msgsrqv1=msgs)

        if gen_newfileuid:
            newfileuid = self.uuid
        else:
            newfileuid = None

        return self.download(
            ofx,
            newfileuid=newfileuid,
            dryrun=dryrun,
            timeout=timeout,
            url=url,
        )