Skip to content

Commit

Permalink
Merge pull request #873 from PayButton/fix/csv-download-default-currency
Browse files Browse the repository at this point in the history
Fix/csv download default currency
  • Loading branch information
Klakurka authored Oct 2, 2024
2 parents 583a770 + 10417c9 commit d43cef5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pages/api/paybutton/download/transactions/[paybuttonId].ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
NetworkTickersType,
NETWORK_TICKERS,
NETWORK_IDS,
SUPPORTED_QUOTES_FROM_ID
SUPPORTED_QUOTES_FROM_ID,
USD_QUOTE_ID
} from 'constants/index'
import { TransactionWithAddressAndPrices, fetchTransactionsByPaybuttonId, getTransactionValueInCurrency } from 'services/transactionService'
import { PaybuttonWithAddresses, fetchPaybuttonById } from 'services/paybuttonService'
Expand Down Expand Up @@ -147,7 +148,12 @@ export default async (req: any, res: any): Promise<void> => {
const networkTickerReq = req.query.network as string

const networkTicker = (networkTickerReq !== '' && isNetworkValid(networkTickerReq as NetworkTickersType)) ? networkTickerReq.toUpperCase() as NetworkTickersType : undefined
const quoteId = req.query.currency as number
let quoteId: number
if (req.query.currency === undefined || req.query.currency === '' || Number.isNaN(req.query.currency)) {
quoteId = USD_QUOTE_ID
} else {
quoteId = req.query.currency as number
}
const quoteSlug = SUPPORTED_QUOTES_FROM_ID[quoteId]
const paybutton = await fetchPaybuttonById(paybuttonId)
if (paybutton.providerUserId !== userId) {
Expand Down

0 comments on commit d43cef5

Please sign in to comment.