File tree Expand file tree Collapse file tree
pages/api/paybutton/download/transactions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ import {
1010 NetworkTickersType ,
1111 NETWORK_TICKERS ,
1212 NETWORK_IDS ,
13- SUPPORTED_QUOTES_FROM_ID
13+ SUPPORTED_QUOTES_FROM_ID ,
14+ USD_QUOTE_ID
1415} from 'constants/index'
1516import { TransactionWithAddressAndPrices , fetchTransactionsByPaybuttonId , getTransactionValueInCurrency } from 'services/transactionService'
1617import { PaybuttonWithAddresses , fetchPaybuttonById } from 'services/paybuttonService'
@@ -147,7 +148,12 @@ export default async (req: any, res: any): Promise<void> => {
147148 const networkTickerReq = req . query . network as string
148149
149150 const networkTicker = ( networkTickerReq !== '' && isNetworkValid ( networkTickerReq as NetworkTickersType ) ) ? networkTickerReq . toUpperCase ( ) as NetworkTickersType : undefined
150- const quoteId = req . query . currency as number
151+ let quoteId : number
152+ if ( req . query . currency === undefined || req . query . currency === '' || Number . isNaN ( req . query . currency ) ) {
153+ quoteId = USD_QUOTE_ID
154+ } else {
155+ quoteId = req . query . currency as number
156+ }
151157 const quoteSlug = SUPPORTED_QUOTES_FROM_ID [ quoteId ]
152158 const paybutton = await fetchPaybuttonById ( paybuttonId )
153159 if ( paybutton . providerUserId !== userId ) {
You can’t perform that action at this time.
0 commit comments