Beispiel #1
0
    def test_test1 (self):
        trans = Transmission (data_sender='11223344',
                              transmission_number='1234567')
        order = PaymentClaim (order_account = 15035149098,
                              order_number = 7654321)

        # Note: All orders/transactions inside a PaymentClaim must
        # be to the same customer!
        order.add (due='200516', amount=250*100, kid='00010001')
        order.add (due='270616', amount=300*100, kid='00010002',
                   abbreviated_name = 'Abbr. name',
                   external_reference = 'External reference',
                   specification = 'Hello\nLine two\n\nLast line')
        order.add (due='140316', amount=500*100, kid='00010003')

        cancellation = CancellationRequest (account=15035149098, number=7654321)
        cancellation.add ('200516', 250*100, '00010001')
        cancellation.add ('140316', 500*100, '00010003')

        trans.add (order)
        trans.add (cancellation)

        from io import BytesIO
        buf = BytesIO()
        trans.render (buf)
        #with open('fixture/test1','wb') as fp: fp.write (buf.getvalue())

        self.assertEqual (buf.getvalue(), open('fixture/test1').read())
Beispiel #2
0
        specification = 'This is the specification line')

# @todo test multiple claims per order
# But note: Et oppdrag kan kun inneholde transaksjoner for 1 oppdragstype
# som gjelder 1 avtale.
#o1.add (date.today()+timedelta(days=20), 100*100, kidgen.member (123,0))

o2 = PaymentClaim (args.account, next_order_number())
o2.add (date.today()+timedelta(days=30), 500*100, kidgen.donor (321))

# Q: Must use same order number as the payment-claim we are canceling?
#c1 = CancellationRequest (args.account, next_order_number())
#c1.add (date.today()+timedelta(days=14), 250*100, kidgen.donor (123))
c1 = CancellationRequest (args.account, o1.order_number)
rec = o1.transactions[0]
c1.add (rec.due, rec.amount, rec.kid)

trans.add (o1)
trans.add (o2)
trans.add (c1)
trans.render (sys.stdout)

# @todo store transmission on permantent storage


# Q: If one order (PaymentClaim) have multiple claims. Is it possible
#    to cancel just one of them?


#o1 = PaymentClaim (order_account = args.account,
#                   order_number  = next_order_number())