Skip to content

Commit 491d365

Browse files
committed
fix(worker): skip Discord Orb payments in total spend
A user reported "$297 spent" on an account that had spent €0 of real money. Their export's payments.json contained four status==1 entries, all with currency "discord_orb": Dark Roses Bundle 11 000 orbs Kitsune Dream Bundle 7 600 orbs Nevermore Bundle 11 000 orbs Orbs Apprentice Badge 120 orbs ------------ 29 720 orbs The status filter from #31 doesn't catch these — the orb purchases are genuinely SUCCESSFUL, just not denominated in fiat. The worker stored amount=29720 with currency="discord_orb", and the frontend sums payment_amount as cents regardless of currency, yielding $297.20. Orbs are a virtual currency Discord awards via Quests / events; users don't buy them, so cosmetic purchases settled in orbs shouldn't count toward "money spent on Discord." Skip these rows in the same loop as the status filter. After the fix, the same package yields $0 spent (the three real-money rows are USD "Temporary Authorization -- Nitro Monthly" entries with status 2/5, which were already excluded).
1 parent c558b90 commit 491d365

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/tasks.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,19 @@ def read_analytics_file(package_status_id, package_id, link, session):
257257
# 1 = SUCCESSFUL, 2 = FAILED, 3 = REFUNDED, 4 = REFUND_PENDING,
258258
# 5 = PARTIALLY_REFUNDED, 6 = PENDING. Without this filter, failed
259259
# and refunded charges inflate the "spent on Nitro" total.
260+
#
261+
# Also skip purchases settled in Discord Orbs (currency ==
262+
# "discord_orb"). Orbs are a virtual currency Discord hands out via
263+
# Quests / events — users do not pay real money to acquire them, and
264+
# the `amount` is denominated in orbs, not cents. Summing them with
265+
# fiat payments produced absurd totals (e.g. a user with €0 of real
266+
# spend but ~30k orbs of cosmetic purchases got billed as "$297
267+
# spent" because 29 720 orbs were treated as 29 720 cents).
260268
for payment in payment_records:
261269
if payment.get('status') != 1:
262270
continue
271+
if payment.get('currency') == 'discord_orb':
272+
continue
263273
payments.append({
264274
'id': payment['id'],
265275
'amount': payment['amount'],

0 commit comments

Comments
 (0)