satellite/{web,payments}: display correct stripe balance
This correctly displays the stripe balance in dollars, which was previously displayed in cents. Change-Id: Ifb14a63a90d3701201c616780cee466525c8be18
This commit is contained in:
parent
e0c3f66040
commit
bf45e53169
@ -13,7 +13,7 @@ type Balance struct {
|
||||
FreeCredits int64 `json:"freeCredits"`
|
||||
Coins decimal.Decimal `json:"coins"` // STORJ token balance from storjscan.
|
||||
Credits decimal.Decimal `json:"credits"`
|
||||
// Credits is the balance from stripe. This may include the following.
|
||||
// Credits is the balance (in cents) from stripe. This may include the following.
|
||||
// 1. legacy Coinpayments deposit.
|
||||
// 2. legacy credit for a manual STORJ deposit.
|
||||
// 4. bonus manually credited for a storjscan payment once a month before invoicing.
|
||||
|
@ -46,9 +46,9 @@
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div v-if="balance.credits" class="total-cost__card">
|
||||
<div v-if="balance.hasCredits()" class="total-cost__card">
|
||||
<AvailableBalanceIcon class="total-cost__card__main-icon" />
|
||||
<p class="total-cost__card__money-text">${{ balance.credits }}</p>
|
||||
<p class="total-cost__card__money-text">{{ balance.formattedCredits }}</p>
|
||||
<p class="total-cost__card__label-text">Legacy STORJ Payments and Bonuses</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,6 +1,8 @@
|
||||
// Copyright (C) 2019 Storj Labs, Inc.
|
||||
// See LICENSE for copying information.
|
||||
|
||||
import { formatPrice, decimalShift } from '@/utils/strings';
|
||||
|
||||
/**
|
||||
* Exposes all payments-related functionality
|
||||
*/
|
||||
@ -126,7 +128,7 @@ export class AccountBalance {
|
||||
public freeCredits: number = 0,
|
||||
// STORJ token balance from storjscan.
|
||||
private _coins: string = '0',
|
||||
// STORJ balance from stripe. This may include the following.
|
||||
// STORJ balance (in cents) from stripe. This may include the following.
|
||||
// 1. legacy Coinpayments deposit.
|
||||
// 2. legacy credit for a manual STORJ deposit.
|
||||
// 4. bonus manually credited for a storjscan payment once a month before invoicing.
|
||||
@ -138,13 +140,17 @@ export class AccountBalance {
|
||||
return parseFloat(this._coins);
|
||||
}
|
||||
|
||||
public get credits(): number {
|
||||
return parseFloat(this._credits);
|
||||
public get formattedCredits(): string {
|
||||
return formatPrice(decimalShift(this._credits, 2));
|
||||
}
|
||||
|
||||
public get sum(): number {
|
||||
return this.freeCredits + this.coins;
|
||||
}
|
||||
|
||||
public hasCredits(): boolean {
|
||||
return parseFloat(this._credits) !== 0;
|
||||
}
|
||||
}
|
||||
|
||||
export class CreditCard {
|
||||
|
Loading…
Reference in New Issue
Block a user