charging contest owner when selecting winner and fix hardcode creater…#121
Open
charging contest owner when selecting winner and fix hardcode creater…#121
Conversation
Collaborator
banh0006
commented
Feb 4, 2021
- Check user stripe id before letting they select a contest winner
- When they select a winner, it will charge their credit card
- Mark contest is over when contest has already had winner
- fix hardcode createId in create contest page
… id in create contest page
Collaborator
Author
bonnieli
reviewed
Feb 5, 2021
client/src/pages/ContestDetails.js
Outdated
| import { makeStyles } from '@material-ui/core/styles' | ||
| import TabPanel from '../components/TabPanel' | ||
| import CheckoutForm from '../components/CheckoutForm' | ||
| // import CreditCardForm from '../components/CreditCardForm' |
client/src/pages/ContestDetails.js
Outdated
| intentSecret = data["intent_id"] | ||
| console.log(intentSecret) | ||
| if (intentSecret != null){ | ||
| let amount = contest.prize_contest |
Contributor
There was a problem hiding this comment.
since amount never changes, turn this into a const
client/src/pages/ContestDetails.js
Outdated
| console.log(intentSecret) | ||
| if (intentSecret != null){ | ||
| let amount = contest.prize_contest | ||
| let currency = 'usd' |
client/src/pages/ContestDetails.js
Outdated
| let currency = 'usd' | ||
|
|
||
| createPayment(amount, currency, data => { | ||
| console.log(data.msg) |
Contributor
There was a problem hiding this comment.
remove these if done using
client/src/pages/ContestDetails.js
Outdated
| } else { | ||
| console.log("unexpected error") | ||
| const onWinnerSubmit = async(e) => { | ||
| var intentSecret = null |
Contributor
There was a problem hiding this comment.
avoid using var as much as possible. do you need this variable to be at this level? can you call it and initilize it on line 176?
|
|
||
| useEffect(() => { | ||
| //when payment dialog close, should fetch new data | ||
| getContestInfo(contestId) |
Contributor
There was a problem hiding this comment.
are you getting a warning that contestId needs to be part of this dependency ?
Collaborator
Author
There was a problem hiding this comment.
Yep, there was a warning, I just add contestId into the dependency array
bonnieli
reviewed
Feb 5, 2021
| import RequestError, { getContestDetails, setContestWinner } from '../apiCalls' | ||
| import RequestError, { getContestDetails, checkStripeIDExists, createPayment } from '../apiCalls' | ||
|
|
||
| const stripePromise = loadStripe("pk_test_51IH8tAGt0nFBLozrVPDB6mwr6yEw9QOAVWhTQK0hErAcLv7F278Dz2f3P637jEaboOp7lJbAVnZNbQTxQUoqD91z00VxrG6s3T") |
Contributor
There was a problem hiding this comment.
need to change this to a config var so that @edyhtan can replace accordingly
# Conflicts: # client/src/components/CreateContestForm.js # client/src/pages/ContestDetails.js # server/api/contest_handler.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


