Skip to content

Commit 656d042

Browse files
committed
OpenPix fees are negative!
1 parent 06f4d1f commit 656d042

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

thebook/webhooks/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
def calculate_openpix_fee(amount):
2424
"""OpenPix doesn't provide the fee in the Webhook payload so we need to calculate it based on the amount received and the active account plan"""
2525
if settings.OPENPIX_PLAN == "FIXO":
26-
return 0.85
27-
return round(min(max(0.008 * amount, 0.5), 5), 2)
26+
return -0.85
27+
return -1 * round(min(max(0.008 * amount, 0.5), 5), 2)
2828

2929

3030
class ProcessingStatus:

thebook/webhooks/tests/openpix/test_calculate_openpix_fee.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
@pytest.mark.parametrize(
77
"openpix_plan,amount,expected_fee",
88
[
9-
("PERCENTUAL", 20, 0.5),
10-
("PERCENTUAL", 62.5, 0.5),
11-
("PERCENTUAL", 64, 0.51),
12-
("PERCENTUAL", 100, 0.8),
13-
("PERCENTUAL", 625, 5),
14-
("PERCENTUAL", 630, 5),
15-
("FIXO", 20, 0.85),
16-
("FIXO", 62.50, 0.85),
17-
("FIXO", 64, 0.85),
18-
("FIXO", 100, 0.85),
19-
("FIXO", 625, 0.85),
20-
("FIXO", 630, 0.85),
9+
("PERCENTUAL", 20, -0.5),
10+
("PERCENTUAL", 62.5, -0.5),
11+
("PERCENTUAL", 64, -0.51),
12+
("PERCENTUAL", 100, -0.8),
13+
("PERCENTUAL", 625, -5),
14+
("PERCENTUAL", 630, -5),
15+
("FIXO", 20, -0.85),
16+
("FIXO", 62.50, -0.85),
17+
("FIXO", 64, -0.85),
18+
("FIXO", 100, -0.85),
19+
("FIXO", 625, -0.85),
20+
("FIXO", 630, -0.85),
2121
],
2222
)
2323
def test_calculate_openpix_fee_based_on_selected_plan(

0 commit comments

Comments
 (0)