From f2ccb910dfed1e74c1ff7faab8575e16cb69bc5e Mon Sep 17 00:00:00 2001 From: Vitalii Date: Fri, 10 Nov 2023 17:04:23 +0200 Subject: [PATCH] web/satellite: fix low token balance banner's show condition Fixed the condition when low token balance is shown. The bug was related to account balance being returned in dollars instead of cents and this was not handled by 'sum' method. Change-Id: I35f642302d877c9b1ed9f6f1d03d6091f2942a0b --- web/satellite/src/types/payments.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/satellite/src/types/payments.ts b/web/satellite/src/types/payments.ts index cde4ecd78..4597d19f2 100644 --- a/web/satellite/src/types/payments.ts +++ b/web/satellite/src/types/payments.ts @@ -151,7 +151,7 @@ export interface PaymentsApi { export class AccountBalance { constructor( public freeCredits: number = 0, - // STORJ token balance from storjscan. + // STORJ token balance (in dollars) from storjscan. private _coins: string = '0', // STORJ balance (in cents) from stripe. This may include the following. // 1. legacy Coinpayments deposit. @@ -177,8 +177,9 @@ export class AccountBalance { return formatPrice(this._coins); } + // Returns sum of storjscan and legacy (stripe) balances in cents. public get sum(): number { - return this.credits + this.coins; + return this.credits + (this.coins * 100); } public hasCredits(): boolean {