forked from travishathaway/python-ach
-
Notifications
You must be signed in to change notification settings - Fork 9
/
example.py
69 lines (59 loc) · 1.62 KB
/
example.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
64
65
66
67
68
69
from ach.builder import AchFile
settings = {
"immediate_dest": "123456780",
"immediate_org": "123456780",
"immediate_dest_name": "YOUR BANK",
"immediate_org_name": "YOUR COMPANY",
"company_id": "1234567890", # tax number
}
ach_file = AchFile("A", settings) # file Id mod
entries = [
{
"type": "22", # type of
"routing_number": "12345678",
"account_number": "11232132",
"amount": "10.00",
"name": "Alice Wanderdust",
"addenda": [
{
"payment_related_info": "Here is some additional information",
},
],
},
{
"type": "27",
"routing_number": "12345678",
"account_number": "234234234",
"amount": "150.00",
"name": "Billy Holiday",
},
{
"type": "22",
"routing_number": "123232318",
"account_number": "123123123",
"amount": "12.13",
"name": "Rachel Welch",
},
]
ach_file.add_batch("PPD", entries, credits=True, debits=True)
print ach_file.render_to_string()
# add_batch will skip failures and return them
ach_file = AchFile("B", settings) # file Id mod
entries = [
{
"type": "27",
"routing_number": "********", # invalid
"account_number": "********", # invalid
"amount": "150.00",
"name": "Billy Holiday",
},
{
"type": "22",
"routing_number": "123232318",
"account_number": "123123123",
"amount": "12.13",
"name": "Rachel Welch",
},
]
print ach_file.add_batch("PPD", entries, credits=True, debits=True)
print ach_file.render_to_string()