コード例 #1
0
 def test_parseExampleReconciliation(self):
     # Reconciliation report
     # Avstämningsrapport
     self.parser = LBReconciliationParser()
     fname = os.path.join(
         here, 'leverantorsbetalning_exempelfil_betalningsbevakning_sv.txt')
     with open(fname, 'rb') as fp:
         self.lines = fp.readlines()
     for line in self.lines:
         self.parser.parse(line)
     sections = self.parser.sections
     for r in sections:
         pass
コード例 #2
0
 def test_parseRequest(self):
     self.parser = LBRequestParser()
     fname = os.path.join(
         here, 'bankgirolink_leverantorsbetalning_lb_exempelfil_sv.txt')
     with open(fname, 'rb') as fp:
         self.lines = fp.readlines()
     for line in self.lines:
         self.parser.parse(line)
     sections = self.parser.sections
コード例 #3
0
 def test_parseExampleRejected(self):
     # Payment instructions containing errors and therefore not processed.
     # Avvisade betalningar
     self.parser = LBRejectedParser()
     fname = os.path.join(
         here, 'leverantorsbetalning_exempelfil_avvisade_sv.txt')
     with open(fname, 'rb') as fp:
         self.lines = fp.readlines()
     for line in self.lines:
         self.parser.parse(line)
     sections = self.parser.sections
     for r in sections:
         t = r.rejected_transactions
         e = r.rejection_errors
         assert t == [u'', u'VERIF 20', u'VERIF 29', u'']
コード例 #4
0
 def test_parseResponse1(self):
     self.parser = LBParser()
     fname = os.path.join(here, 'LB-response-1.txt')
     with open(fname, 'rb') as fp:
         self.lines = fp.readlines()
     for line in self.lines:
         self.parser.parse(line)
     sections = self.parser.sections
     for r in sections:
         t = r.completed_transactions
         assert t == [u'LEKGFNUQPYJUBYH7XVNA', u'LEKGFNUQPYJUBYH7XVPA']
         toids = [decode_toid20(tt) for tt in t]
         assert toids == [
             '591462b6907e1340e0ffbd5a', '591462b6907e1340e0ffbd5e'
         ]
コード例 #5
0
 def test_parseExampleStoppedPayments(self):
     # Stopped payments report
     # Bankgirot did not provide an example file for this report so this one is home baked/faked.
     self.parser = LBStoppedPaymentsParser()
     fname = os.path.join(here, 'leverantorsbetalning_stoppade.txt')
     with open(fname, 'rb') as fp:
         self.lines = fp.readlines()
     for line in self.lines:
         self.parser.parse(line)
     sections = self.parser.sections
     for r in sections:
         s = r.stopped_payments
         assert s == [
             u'VERIF 12', u'VERIF 13', u'VERIF 14', u'VERIF 16',
             u'VERIF 19', u'VERIF 32', u'VERIF 25'
         ]
コード例 #6
0
 def test_parseExampleRespons(self):
     # Payments specification with payment types
     # Betalningsspecifikation med Betaltyper
     self.parser = LBParser()
     fname = os.path.join(
         here,
         'leverantorsbetalning_exempelfil_betalningsspecifikation-med-lonedetaljer.txt'
     )
     with open(fname, 'rb') as fp:
         self.lines = fp.readlines()
     for line in self.lines:
         self.parser.parse(line)
     sections = self.parser.sections
     for r in sections:
         t = r.completed_transactions
         assert len(t) == 13
コード例 #7
0
class TestLBParser(object):
    def test_parseRequest(self):
        self.parser = LBRequestParser()
        fname = os.path.join(
            here, 'bankgirolink_leverantorsbetalning_lb_exempelfil_sv.txt')
        with open(fname, 'rb') as fp:
            self.lines = fp.readlines()
        for line in self.lines:
            self.parser.parse(line)
        sections = self.parser.sections
        # for r in sections:
        #     print r.sender_bankgiro_number
        #     for p in r.payments:
        #         print p

        # TODO: test

    def test_parseResponse1(self):
        self.parser = LBParser()
        fname = os.path.join(here, 'LB-response-1.txt')
        with open(fname, 'rb') as fp:
            self.lines = fp.readlines()
        for line in self.lines:
            self.parser.parse(line)
        sections = self.parser.sections
        for r in sections:
            t = r.completed_transactions
            assert t == [u'LEKGFNUQPYJUBYH7XVNA', u'LEKGFNUQPYJUBYH7XVPA']
            toids = [decode_toid20(tt) for tt in t]
            assert toids == [
                '591462b6907e1340e0ffbd5a', '591462b6907e1340e0ffbd5e'
            ]

    def test_parseExampleRespons(self):
        # Payments specification with payment types
        # Betalningsspecifikation med Betaltyper
        self.parser = LBParser()
        fname = os.path.join(
            here,
            'leverantorsbetalning_exempelfil_betalningsspecifikation-med-lonedetaljer.txt'
        )
        with open(fname, 'rb') as fp:
            self.lines = fp.readlines()
        for line in self.lines:
            self.parser.parse(line)
        sections = self.parser.sections
        for r in sections:
            t = r.completed_transactions
            assert len(t) == 13
            #print t

    def test_parseExampleRejected(self):
        # Payment instructions containing errors and therefore not processed.
        # Avvisade betalningar
        self.parser = LBRejectedParser()
        fname = os.path.join(
            here, 'leverantorsbetalning_exempelfil_avvisade_sv.txt')
        with open(fname, 'rb') as fp:
            self.lines = fp.readlines()
        for line in self.lines:
            self.parser.parse(line)
        sections = self.parser.sections
        for r in sections:
            t = r.rejected_transactions
            e = r.rejection_errors
            assert t == [u'', u'VERIF 20', u'VERIF 29', u'']

    def test_parseExampleStoppedPayments(self):
        # Stopped payments report
        # Bankgirot did not provide an example file for this report so this one is home baked/faked.
        self.parser = LBStoppedPaymentsParser()
        fname = os.path.join(here, 'leverantorsbetalning_stoppade.txt')
        with open(fname, 'rb') as fp:
            self.lines = fp.readlines()
        for line in self.lines:
            self.parser.parse(line)
        sections = self.parser.sections
        for r in sections:
            s = r.stopped_payments
            assert s == [
                u'VERIF 12', u'VERIF 13', u'VERIF 14', u'VERIF 16',
                u'VERIF 19', u'VERIF 32', u'VERIF 25'
            ]

    def test_parseExampleReconciliation(self):
        # Reconciliation report
        # Avstämningsrapport
        self.parser = LBReconciliationParser()
        fname = os.path.join(
            here, 'leverantorsbetalning_exempelfil_betalningsbevakning_sv.txt')
        with open(fname, 'rb') as fp:
            self.lines = fp.readlines()
        for line in self.lines:
            self.parser.parse(line)
        sections = self.parser.sections
        for r in sections:
            pass