diff --git a/src/coinify/payment-method.js b/src/coinify/payment-method.js index 11fa68bc9..d2f9cc61f 100644 --- a/src/coinify/payment-method.js +++ b/src/coinify/payment-method.js @@ -122,6 +122,7 @@ PaymentMethod.fetchAll = function (inCurrency, outCurrency, api) { }; PaymentMethod.prototype.calculateFee = function (quote) { - this._fee = Math.round(this.inFixedFee + -quote.baseAmount * (this.inPercentageFee / 100)); - this._total = -quote.baseAmount + this._fee; + let amt = quote.baseCurrency === 'BTC' ? quote.quoteAmount : quote.baseAmount; + this._fee = Math.round(this.inFixedFee + -amt * (this.inPercentageFee / 100)); + this._total = -amt + this._fee; }; diff --git a/src/coinify/quote.js b/src/coinify/quote.js index f7a1571b0..f4011cf66 100644 --- a/src/coinify/quote.js +++ b/src/coinify/quote.js @@ -135,10 +135,17 @@ Quote.prototype.getPaymentMethods = function () { return self.paymentMethods; }; + let inCurrency = this.baseCurrency; + let outCurrency = this.quoteCurrency; + if (this.baseCurrency === 'BTC' && this.baseAmount > 0) { + inCurrency = this.quoteCurrency; + outCurrency = this.baseCurrency; + } + if (this.paymentMethods) { return Promise.resolve(this.paymentMethods); } else { - return PaymentMethod.fetchAll(this.baseCurrency, this.quoteCurrency, this._api) + return PaymentMethod.fetchAll(inCurrency, outCurrency, this._api) .then(setPaymentMethods); } };