fix payment addy bug

This commit is contained in:
jwinterm
2025-12-24 16:45:35 -05:00
parent 4bf7ac2a15
commit 3589406bac
2 changed files with 40 additions and 8 deletions
+13 -2
View File
@@ -333,6 +333,17 @@ class GameModeManager {
return result.rows[0] || null;
}
/**
* Convert package info to JSON-safe format (BigInt price -> Number)
*/
_serializePackageInfo(packageInfo) {
if (!packageInfo) return null;
return {
...packageInfo,
price: typeof packageInfo.price === 'bigint' ? Number(packageInfo.price) : packageInfo.price
};
}
_mapPaymentRowToRequest(row, paymentType, packageInfo) {
if (!row) return null;
const amount = Number(row.expected_amount);
@@ -345,7 +356,7 @@ class GameModeManager {
expiresAt: row.expires_at,
paymentType,
description: row.description,
package: packageInfo || null,
package: this._serializePackageInfo(packageInfo),
reused: true
};
}
@@ -876,7 +887,7 @@ class GameModeManager {
amountFormatted: this.formatAtomicHuman(amount, 4),
currency: this.cryptoType,
expiresAt: insertedRow?.expires_at || expiresAt,
package: packageInfo,
package: this._serializePackageInfo(packageInfo),
paymentType,
description,
reused: false