Skip to content
This repository was archived by the owner on Mar 2, 2021. It is now read-only.

Conversation

@4www
Copy link

@4www 4www commented Aug 13, 2017

Frontend handles Stripe payments, receives a token, and passes it tothe backend (firebase function with express).

  • create a route to handle POST from frontend
  • send charge to stripe
  • handle stripe response by updating, or not, the firebase channel model to isPremium: true

@4www 4www changed the title Feature/payments (handle stripe charges) WIP Feature/payments (handle stripe charges) Aug 13, 2017
@4www 4www changed the title WIP Feature/payments (handle stripe charges) Feature/payments (handle stripe charges) Aug 19, 2017
@4www
Copy link
Author

4www commented Aug 19, 2017

Ok this is almost ready.

Missing:

  • firebase tokens
  • test security rules channel.isPremium
  • environment variables for tokens

@4www 4www requested a review from oskarrough August 19, 2017 21:43
@4www
Copy link
Author

4www commented Aug 19, 2017

Rules seems to work, even when logged in

{
  "slug": "123",
  "title": "123",
  "created": {".sv":"timestamp"},
  "isPremium": true
}

src/app.js Outdated

admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://radio4000-staging.firebaseio.com"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make another file that exports the current databaseURL?

We can use it above ^ and here: https://github.com/internet4000/radio4000-api/blob/master/src/app.js#L27

package.json Outdated
"deploy-api": "firebase use api; firebase deploy --only functions",
"deploy-rules": "firebase use production; firebase deploy --only rules"
"deploy-rules": "firebase use staging; firebase deploy --only database",
"deploy-rules-production": "firebase use production; firebase deploy --only rules"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't both the rules scripts use --database? Seems --rules is the old way to do it.

https://firebase.google.com/docs/cli/#deployment

package.json Outdated
},
"dependencies": {
"cors": "^2.8.4",
"firebase": "^4.3.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since these deps are for our app they should be moved to src/package.json. Also, is firebase needed? there is already firebase-admin.

@4www 4www changed the title Feature/payments (handle stripe charges) WIP Feature/payments (handle stripe charges) Sep 1, 2017
@4www 4www merged commit 0137247 into master Sep 13, 2017
@4www 4www deleted the feature/payments branch September 13, 2017 11:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants