-
Notifications
You must be signed in to change notification settings - Fork 13
/
sample-charge-payment.py
64 lines (51 loc) · 1.39 KB
/
sample-charge-payment.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# coding: utf-8
from febraban.cnab240.itau.sispag import ChargePayment, File
from febraban.cnab240.itau.sispag.file.lot import Lot
from febraban.cnab240.libs.barCode import BarCodeJ
from febraban.cnab240.user import User, UserAddress, UserBank
sender = User(
name="YOUR COMPANY NAME HERE",
identifier="12345678901234",
bank=UserBank(
bankId="341",
branchCode="4321",
accountNumber="12345678",
accountVerifier="9"
),
address=UserAddress(
streetLine1="AV PAULISTA 1000",
city="SAO PAULO",
stateCode="SP",
zipCode="01310000"
)
)
barCodes = [
"34112318100000000011090027345767456112367000",
"34112318100000000021090027345687456112367000",
"34112318100000000031090027345507456112367000",
]
taxIds = [
"12345678901234",
"12345678901234",
"12345678901234",
]
file = File()
file.setSender(sender)
lot = Lot()
sender.name = "SENDER NAME"
lot.setSender(sender)
lot.setHeaderLotType(
kind="98",
method="30"
)
for barCodeString, taxId in zip(barCodes, taxIds):
barCode = BarCodeJ(barCodeString)
payment = ChargePayment()
payment.setSender(sender)
payment.setScheduleDate("26022020")
payment.setIdentifier("ID1234567890")
payment.setBarCode(barCode)
payment.setReceiverTaxId(taxId)
lot.add(register=payment)
file.addLot(lot)
file.output(fileName="output.REM", path="/../../")