-
Notifications
You must be signed in to change notification settings - Fork 0
/
square-calculator.py
67 lines (64 loc) · 3.22 KB
/
square-calculator.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
#!/usr/bin/env python3
import datetime
timestamp = datetime.datetime.now().strftime("%Y-%m-%d hat %H:%M:%S")
print (timestamp)
self_employed_tax = .15
# grab the type of transaction
print()
payment_type = input('Is this an Invoice, Reader, or a Card On File? ')
if payment_type.lower() == 'invoice':
# squares invoice fee is 2.9% + .30
square_fee_percent = .029
square_fee_cents = .30
# the amount you want to actually be paid for your work
print()
amount_desired = input('How much do you want to be paid? $')
print()
# subtract the current tax rate from 1
amount_with_tax = float(amount_desired) / (1 - self_employed_tax)
# we'll add the cents and subtract the percent fee from 1
amount_to_charge = (amount_with_tax + square_fee_cents) / (1 - square_fee_percent)
irs_cut = amount_with_tax - float(amount_desired)
square_cut = amount_to_charge - amount_with_tax
print('If you want to be paid $' + amount_desired + ', you should charge: $' + ("{:0.2f}".format(amount_to_charge)))
print()
print('$' + ("{:0.2f}".format(irs_cut)) + ' goes to the IRS and $' + ("{:0.2f}".format(square_cut)) + ' goes to Square')
print()
elif payment_type.lower() in ('tap', 'chip', 'swipe', 'reader'):
# squares reader fee is 2.6% + .10
square_fee_percent = .026
square_fee_cents = .10
# the amount you want to actually be paid for your work
print()
amount_desired = input('How much do you want to be paid? $')
print()
# subtract the current tax rate from 1
amount_with_tax = float(amount_desired) / (1 - self_employed_tax)
# we'll add the cents and subtract the percent fee from 1
amount_to_charge = ((amount_with_tax + square_fee_cents) / (1 - square_fee_percent))
irs_cut = amount_with_tax - float(amount_desired)
square_cut = amount_to_charge - amount_with_tax
print('If you want to be paid $' + amount_desired + ', you should charge: $' + ("{:0.2f}".format(amount_to_charge)))
print()
print('$' + ("{:0.2f}".format(irs_cut)) + ' goes to the IRS and $' + ("{:0.2f}".format(square_cut)) + ' goes to Square')
print()
elif payment_type.lower() in ('card on file', 'on file', 'saved', 'stored', 'on-file', 'cof', 'c-o-f', 'card on', 'other'):
# squares invoice fee is 3.5% + .15
square_fee_percent = .035
square_fee_cents = .15
# the amount you want to actually be paid for your work
print()
amount_desired = input('How much do you want to be paid? $')
print()
# subtract the current tax rate from 1
amount_with_tax = float(amount_desired) / (1 - self_employed_tax)
# we'll add the cents and subtract the percent fee from 1
amount_to_charge = ((amount_with_tax + square_fee_cents) / (1 - square_fee_percent))
irs_cut = amount_with_tax - float(amount_desired)
square_cut = amount_to_charge - amount_with_tax
print('If you want to be paid $' + amount_desired + ', you should charge: $' + ("{:0.2f}".format(amount_to_charge)))
print()
print('$' + ("{:0.2f}".format(irs_cut)) + ' goes to the IRS and $' + ("{:0.2f}".format(square_cut)) + ' goes to Square')
print()
else:
print('\nSorry, transaction type ' + '"' + payment_type + '"' ' not found. \nPlease correct and try again.\n') #double quotes for emphasis