From 0e60d93cf9dfff98bae4a459288c06c6fd7f2c07 Mon Sep 17 00:00:00 2001 From: stuppie Date: Wed, 19 Aug 2026 16:58:43 -0600 Subject: working on BusinessPayoutEvent. create_from_ach_or_wire -> stage payout events all at once. BusinessPayoutEvent standalone model instead of computed from bp_payouts --- tests/managers/thl/test_payout.py | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'tests/managers') diff --git a/tests/managers/thl/test_payout.py b/tests/managers/thl/test_payout.py index 31087b8..f118c71 100644 --- a/tests/managers/thl/test_payout.py +++ b/tests/managers/thl/test_payout.py @@ -5,6 +5,7 @@ from decimal import Decimal from random import choice as rand_choice, randint from typing import Optional from uuid import uuid4 +import io import pandas as pd import pytest @@ -16,7 +17,10 @@ from generalresearch.managers.thl.ledger_manager.exceptions import ( from generalresearch.managers.thl.payout import UserPayoutEventManager from generalresearch.models.thl.definitions import PayoutStatus from generalresearch.models.thl.ledger import LedgerEntry, Direction -from generalresearch.models.thl.payout import BusinessPayoutEvent +from generalresearch.models.thl.payout import ( + BusinessPayoutEvent, + BrokerageProductPayoutEvent, +) from generalresearch.models.thl.payout import UserPayoutEvent from generalresearch.models.thl.wallet import PayoutType from generalresearch.models.thl.ledger import LedgerAccount @@ -708,7 +712,6 @@ class TestBusinessPayoutEventManager: assert int(res.deduction.sum()) == 0 def test_distribute_amount(self, business_payout_event_manager): - import io df = pd.read_csv( io.StringIO( @@ -802,6 +805,28 @@ class TestBusinessPayoutEventManager: ) assert "Must issue Supplier Payouts at least $100 minimum." in str(cm) + bpe = BusinessPayoutEvent( + business_id=business.uuid, + amount=USDCent(100_00), + payout_type=PayoutType.ACH, + ) + bpe.bp_payouts = [ + BrokerageProductPayoutEvent( + product_id=uuid4().hex, + payout_type=PayoutType.ACH, + amount=USDCent(47_00), + cashout_method_uuid=uuid4().hex, + debit_account_uuid=uuid4().hex, + ), + BrokerageProductPayoutEvent( + product_id=uuid4().hex, + payout_type=PayoutType.ACH, + amount=USDCent(53_00), + cashout_method_uuid=uuid4().hex, + debit_account_uuid=uuid4().hex, + ), + ] + def test_ach_payment( self, product, -- cgit v1.2.3