Skip to content
Permalink
Browse files

Merge pull request #10384 from gabrielbazan7/fix/bpcard-erc20

[FIX] bpcard topup erc20 tokens
  • Loading branch information
cmgustavo committed Dec 2, 2019
2 parents 692b324 + ff38690 commit a845606989d3daad98ec71dc7776f8488f475449
@@ -14,7 +14,7 @@
<div class="amount-label">
<div class="amount">{{amountUnitStr}}</div>
<div class="alternative" *ngIf="wallet">
<span *ngIf="rate">
<span *ngIf="rate && !isERCToken">
@ {{rate | number:'1.2-2'}} {{currencyIsoCode}} per {{wallet.coin.toUpperCase()}}
</span>
<span *ngIf="!rate">...</span>
@@ -90,7 +90,7 @@
<ion-item>
<span translate>Total</span>
<ion-note item-end>
<span *ngIf="totalAmountStr">{{totalAmountStr}} ~ </span>
<span *ngIf="totalAmountStr && !isERCToken">{{totalAmountStr}} ~ </span>
<span *ngIf="totalAmount">{{totalAmount | number:'1.2-2'}} {{currencyIsoCode}}</span>
</ion-note>
</ion-item>
@@ -63,6 +63,7 @@ export class BitPayCardTopUpPage {
private countDown;
public paymentExpired: boolean;
public remainingTimeStr: string;
public isERCToken: boolean;

private bitcoreCash;
private createdTx;
@@ -245,18 +246,20 @@ export class BitPayCardTopUpPage {
networkFeeSat: number
) {
const chain = this.currencyProvider.getChain(wallet.coin).toLowerCase();
this.satToFiat(chain, amountSat).then((a: string) => {
this.amount = Number(a);
this.satToFiat(this.isERCToken ? wallet.coin : chain, amountSat).then(
(a: string) => {
this.amount = Number(a);

this.satToFiat(chain, invoiceFeeSat).then((i: string) => {
this.invoiceFee = Number(i);
this.satToFiat(chain, invoiceFeeSat).then((i: string) => {
this.invoiceFee = Number(i);

this.satToFiat(chain, networkFeeSat).then((n: string) => {
this.networkFee = Number(n);
this.totalAmount = this.amount + this.invoiceFee + this.networkFee;
this.satToFiat(chain, networkFeeSat).then((n: string) => {
this.networkFee = Number(n);
this.totalAmount = this.amount + this.invoiceFee + this.networkFee;
});
});
});
});
}
);
}

private isCryptoCurrencySupported(wallet, invoice) {
@@ -709,13 +712,15 @@ export class BitPayCardTopUpPage {

public onWalletSelect(wallet): void {
this.wallet = wallet;

this.isERCToken = this.currencyProvider.isERCToken(this.wallet.coin);
if (this.countDown) {
clearInterval(this.countDown);
}

// Update Rates
this.updateRates(wallet.coin);
if (!this.isERCToken) {
// Update Rates
this.updateRates(wallet.coin);
}

this.onGoingProcessProvider.set('retrievingInputs');
this.calculateAmount(wallet)

0 comments on commit a845606

Please sign in to comment.
You can’t perform that action at this time.