-
Notifications
You must be signed in to change notification settings - Fork 0
/
payment-amount-calculation.txt
51 lines (37 loc) · 1.61 KB
/
payment-amount-calculation.txt
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
Payment Amount = p
Our Amount, we want to get = a
Payment gateway fee rate = 0.02
GST = 0.18
Payment gateway fee rate = pgfr
Fees charged by payment gateway = pgf
GST charged on payment gateway fees = gst_pgf
GST charged to FMES = gst_fmes
p = a + (p * 0.02) + (p * 0.02 * 0.18) + (a * 0.18)
p = a * 1.18 + p * 0.02 * (1 + 0.18)
p = a * 1.18 + p * 0.02 * 1.18
p = a * 1.18 + p * 0.0236
p - p * 0.0236 = a * 1.18
p * (1 - 0.0236) = a * 1.18
p = (a * 1.18) / (0.9764)
p = (100 * 1.18) / 0.9764
p = 120.85
p = a + (p * pgfr) + (p * pgfr * 0.18) + (a * 0.18)
p * (1 - pgfr * (1 + 0.18)) = a * 1.18
p * (1 - (pgfr * 1.18)) = a * 1.18
p = (a * 1.18) / (1 - (pgfr * 0.82));
pgf = p * pgfr;
gst_pgf = p * pgfr * 0.18;
gst_fmes = a * 0.18;
------------------------------------------
4757.34 = 4000 + (4757.34 * 0.02) + (4757.34 * 0.02 * 0.18) + (4000 + (4757.34 * 0.02) + (4757.34 * 0.02 * 0.18))*0.18
p = a + (p * pgfr) + (p * pgfr * 0.18) + ((a + (p * pgfr) + (p * pgfr * 0.18)) * 0.18);
p = a * (1 + 0.18) + p * (1 + (pgfr * 0.18) + ((pgfr + pgfr * 0.18) * 0.18));
p = a * (1.18) + p * pgfr * (1 + 0.18 + 0.18 + 0.0324);
p = a * (1.18) + (p * pgfr * 1.3924);
p * (1 - (pgfr * 1.3924)) = a * 1.18;
p = (a * 1.18) / (1 - (pgfr * 1.3924));
p = (4000 * 1.18) / (1 - 0.027848)
4855.21 = 4000 + (4855.21 * 0.02) + (4855.21 * 0.02 * 0.18) + (4000 + (4855.21 * 0.02) + (4855.21 * 0.02 * 0.18))*0.18
4854.61 = 4000 + (4854.61 * 0.02) + (4854.61 * 0.02 * 0.18) + (4000 + (4854.61 * 0.02) + (4854.61 * 0.02 * 0.18))*0.18
total = (expectedAmount * 1.18) / (1 - (txFeePercentage * 1.3924));
expectedAmount = total * (1 - (txFeePercentage * 1.3924)) / 1.18