aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstuppie2026-08-21 11:10:06 -0600
committerstuppie2026-08-21 11:10:06 -0600
commitad11f6dcdaba6f01355cb54fd39ab65d1f781d0b (patch)
tree8659988703d5f88ba5a3da2b30b83163503b8910
parent65e06b343ed8ea55c526b7a8f6582e63bdab6f97 (diff)
downloadgeneralresearch-ad11f6dcdaba6f01355cb54fd39ab65d1f781d0b.tar.gz
generalresearch-ad11f6dcdaba6f01355cb54fd39ab65d1f781d0b.zip
put back a dummy create_bp_payout_event method so I dont break all these tests
-rw-r--r--generalresearch/managers/thl/payout.py48
-rw-r--r--generalresearch/models/thl/payout.py2
-rw-r--r--test_utils/models/conftest.py6
3 files changed, 50 insertions, 6 deletions
diff --git a/generalresearch/managers/thl/payout.py b/generalresearch/managers/thl/payout.py
index 551758f..c94065e 100644
--- a/generalresearch/managers/thl/payout.py
+++ b/generalresearch/managers/thl/payout.py
@@ -1139,6 +1139,54 @@ class BusinessPayoutEventManager(PostgresManagerWithRedis):
conn.commit()
return None
+ def create_bp_payout_event(
+ self,
+ thl_ledger_manager: ThlLedgerManager,
+ product: Product,
+ amount: USDCent,
+ ext_ref_id: str,
+ created: datetime | None = None,
+ ):
+ """
+ This should NOT be called directly normally. It is just a shortcut
+ for tests. However, instead of just making a naked BP payout,
+ it created the business payout also, but with just one BP Payout
+ """
+ created = created or datetime.now(tz=timezone.utc)
+ account = thl_ledger_manager.get_account(
+ f"{thl_ledger_manager.currency.value}:bp_wallet:{product.uuid}"
+ )
+ bpe = BusinessPayoutEvent(
+ id=None,
+ business_id=product.business_uuid,
+ payout_type=PayoutType.ACH,
+ amount=amount,
+ created=created,
+ ext_ref_id=ext_ref_id,
+ status=PayoutStatus.APPROVED,
+ bp_payouts=[
+ BrokerageProductPayoutEvent(
+ created=created,
+ payout_type=PayoutType.ACH,
+ status=PayoutStatus.PENDING,
+ uuid=uuid4().hex,
+ amount=amount,
+ ext_ref_id=ext_ref_id,
+ product_id=product.uuid,
+ cashout_method_uuid=self.bp_pe_manager.CASHOUT_METHOD_UUID,
+ debit_account_uuid=account.uuid,
+ )
+ ],
+ )
+ self.create_business_payout_event(bpe=bpe)
+ self.bp_pe_manager.create_tx_bp_payout_from_payout_event(
+ thl_ledger_manager=thl_ledger_manager,
+ bp_pe=bpe.bp_payouts[0],
+ product=product,
+ )
+ self.update_business_payout_event(pk=bpe.id, status=PayoutStatus.COMPLETE)
+ return bpe
+
# import duckdb
# conn = duckdb.connect()
diff --git a/generalresearch/models/thl/payout.py b/generalresearch/models/thl/payout.py
index 2ecc232..4accd49 100644
--- a/generalresearch/models/thl/payout.py
+++ b/generalresearch/models/thl/payout.py
@@ -228,7 +228,7 @@ class BusinessPayoutEvent(BaseModel):
model_config = ConfigDict(validate_assignment=True)
- id: SkipJsonSchema[PositiveInt | None] = Field(exclude=True)
+ id: SkipJsonSchema[PositiveInt | None] = Field(exclude=True, default=None)
# Used for holding a *unique*, external, payout-type-specific identifier.
ext_ref_id: str = Field(title="Unique external reference ID")
diff --git a/test_utils/models/conftest.py b/test_utils/models/conftest.py
index 64bdec6..6a8e4cf 100644
--- a/test_utils/models/conftest.py
+++ b/test_utils/models/conftest.py
@@ -390,8 +390,6 @@ def bp_payout_factory(
amount: Optional["USDCent"] = None,
ext_ref_id: Optional[str] = None,
created: Optional[AwareDatetime] = None,
- skip_wallet_balance_check: bool = False,
- skip_one_per_day_check: bool = False,
) -> "BrokerageProductPayoutEvent":
from generalresearch.currency import USDCent
@@ -402,10 +400,8 @@ def bp_payout_factory(
thl_ledger_manager=thl_lm,
product=product,
amount=amount,
- ext_ref_id=ext_ref_id,
+ ext_ref_id=ext_ref_id or uuid4().hex,
created=created,
- skip_wallet_balance_check=skip_wallet_balance_check,
- skip_one_per_day_check=skip_one_per_day_check,
)
return _inner