forked from starkbank/febraban-python
-
Notifications
You must be signed in to change notification settings - Fork 3
/
sample-charge.py
62 lines (54 loc) · 1.36 KB
/
sample-charge.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
# coding: utf-8
from datetime import datetime
from febraban.cnab240.itau.charge import Slip, File
from febraban.cnab240.user import User, UserAddress, UserBank
myself = User(
name="YOUR COMPANY NAME",
identifier="123456789012345",
bank=UserBank(
bankId="341",
branchCode="1234",
accountNumber="33333",
accountVerifier="4",
bankName="BANCO ITAU SA"
),
address=UserAddress(
streetLine1="AV PAULISTA 1000",
streetLine2="CJ 601",
city="SAO PAULO",
stateCode="SP",
zipCode="01310000"
)
)
payer = User(
name="PAYER NAME",
identifier="12345678901",
address=UserAddress(
streetLine1="AV PAULISTA 1000",
district="BELA VISTA",
city="SAO PAULO",
stateCode="SP",
zipCode="01310000"
)
)
now = datetime.now()
file = File()
file.setSender(myself)
file.setIssueDate(now)
slip = Slip()
slip.setSender(myself)
slip.setAmountInCents("2000")
slip.setPayer(payer)
slip.setIssueDate(now)
slip.setExpirationDate(now)
slip.setBankIdentifier(
identifier="1",
branch=myself.bank.branchCode,
accountNumber=myself.bank.accountNumber,
wallet="109"
)
slip.setIdentifier("ID456")
slip.setFineAndInterest(datetime=now, fine="0", interest="0")
slip.setOverdueLimit("3")
file.add(register=slip)
file.output(fileName="output.REM", path="/../../")