feat: extra log (#2360)

This commit is contained in:
Vlad Stan 2024-03-25 12:58:49 +02:00 committed by GitHub
parent 10fe113099
commit fe3b00292a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -30,7 +30,6 @@ from .core.crud import (
get_installed_extension,
get_installed_extensions,
get_payments,
get_standalone_payment,
remove_deleted_wallets,
update_payment_status,
)
@ -274,20 +273,13 @@ async def check_invalid_payments(
invalid_payments: List[Payment] = []
invalid_wallets = {}
for db_payment in settled_db_payments:
if db_payment.memo == "Admin top up":
continue
internal_payment = await get_standalone_payment(
checking_id_or_hash=f"internal_{db_payment.checking_id}"
)
if internal_payment:
continue
payment_status = await funding_source.get_invoice_status(db_payment.checking_id)
if verbose:
click.echo(
f"Checking Payment: '{db_payment.checking_id}' for wallet"
+ f" '{db_payment.wallet_id}'. Pending: '{payment_status.pending}'"
+ f" '{db_payment.wallet_id}'."
)
payment_status = await funding_source.get_invoice_status(db_payment.checking_id)
if payment_status.pending:
invalid_payments.append(db_payment)
if db_payment.wallet_id not in invalid_wallets:
@ -295,19 +287,20 @@ async def check_invalid_payments(
invalid_wallets[f"{db_payment.wallet_id}"][0] += 1
invalid_wallets[f"{db_payment.wallet_id}"][1] += db_payment.amount
invalid_payments_rows = [
" ".join(
[
i_p.checking_id,
i_p.wallet_id,
str(i_p.amount / 1000).ljust(10),
i_p.memo or "",
]
)
for i_p in invalid_payments
]
click.echo(
"Invalid Payment: '"
+ " ".join(
[
db_payment.checking_id,
db_payment.wallet_id,
str(db_payment.amount / 1000).ljust(10),
db_payment.memo or "",
]
)
+ "'"
)
click.echo("Invalid Payments: " + str(len(invalid_payments)))
click.echo("\n".join(invalid_payments_rows))
click.echo("\nInvalid Wallets: " + str(len(invalid_wallets)))
for w in invalid_wallets:
data = invalid_wallets[f"{w}"]