Update amount, try using secrets
This commit is contained in:
parent
167aa1cd1b
commit
2490524477
|
@ -1,27 +1,27 @@
|
|||
import { APIError, newEndpoint } from './api'
|
||||
import { isProd, log } from './utils'
|
||||
import * as admin from 'firebase-admin'
|
||||
import { PrivateUser, User } from 'common/user'
|
||||
import { PrivateUser, User } from '../../common/user'
|
||||
import { runTxn, TxnData } from './transact'
|
||||
import {
|
||||
DEV_HOUSE_LIQUIDITY_PROVIDER_ID,
|
||||
HOUSE_LIQUIDITY_PROVIDER_ID,
|
||||
} from 'common/antes'
|
||||
} from '../../common/antes'
|
||||
|
||||
// sandbox
|
||||
const API_KEY = 'TEST_k-dOX64gXbmZgaaPgbb_7aP6jhI-iXae_mASnHedTvQ'
|
||||
const FUNDING_ID = 'Y46Z09MJBQXY'
|
||||
const CAMPAIGN_ID = 'DVFR42FR12KO'
|
||||
|
||||
// prod
|
||||
// const API_KEY = ''
|
||||
// const FUNDING_ID = ''
|
||||
// const CAMPAIGN_ID = 'T5436LGG2KP6'
|
||||
|
||||
const firestore = admin.firestore()
|
||||
const amount = 5000
|
||||
// Production environment
|
||||
// var client = new Tremendous("[PRODUCTION_ACCESS_TOKEN]", "https://www.tremendous.com/api/v2/");
|
||||
export const convertmana = newEndpoint({}, async (req, auth) => {
|
||||
const amount = 7500
|
||||
const opts = { secrets: ['TREMENDOUS_TEST_KEY'] }
|
||||
|
||||
export const convertmana = newEndpoint(opts, async (req, auth) => {
|
||||
const result = await firestore.runTransaction(async (trans) => {
|
||||
log('Inside main transaction.')
|
||||
const userDoc = firestore.doc(`users/${auth.uid}`)
|
||||
|
@ -60,9 +60,14 @@ export const convertmana = newEndpoint({}, async (req, auth) => {
|
|||
log('sending gift card to:', privateUser.email)
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const Tremendous = require('tremendous')
|
||||
// TODO: this isn't working
|
||||
// const apiKey = process.env.TREMENDOUS_TEST_KEY as string
|
||||
const apiKey = API_KEY
|
||||
log('apiKey:', apiKey)
|
||||
|
||||
// Sandbox environment
|
||||
const client = new Tremendous(
|
||||
API_KEY,
|
||||
apiKey,
|
||||
'https://testflight.tremendous.com/api/v2/'
|
||||
)
|
||||
const order_data = {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import * as admin from 'firebase-admin'
|
||||
import { onRequest } from 'firebase-functions/v2/https'
|
||||
import { EndpointDefinition } from './api'
|
||||
admin.initializeApp()
|
||||
// v2
|
||||
import { health } from './health'
|
||||
import { transact } from './transact'
|
||||
|
@ -21,8 +22,6 @@ import { unsubscribe } from './unsubscribe'
|
|||
import { createcheckoutsession, stripewebhook } from './stripe'
|
||||
import { convertmana } from './convert-mana-to-gift-card'
|
||||
|
||||
admin.initializeApp()
|
||||
|
||||
// v1
|
||||
export * from './on-create-bet'
|
||||
export * from './on-create-comment-on-contract'
|
||||
|
|
|
@ -23,7 +23,7 @@ export default function RedeemManaPage() {
|
|||
const user = useUser()
|
||||
const privateUser = usePrivateUser(user?.id)
|
||||
useTracking('view redeem mana page')
|
||||
const cost = 5000
|
||||
const cost = 7500
|
||||
useEffect(() => {
|
||||
if (open) setSuccess(false)
|
||||
setError('')
|
||||
|
|
Loading…
Reference in New Issue
Block a user