Skip to content

Commit

Permalink
Merge pull request #146 from ingindIsrael/employer_subscriptions
Browse files Browse the repository at this point in the history
Employer subscriptions
  • Loading branch information
ixaxtav authored Mar 19, 2022
2 parents dc3c89c + e61228d commit a6819ae
Show file tree
Hide file tree
Showing 18 changed files with 22,169 additions and 12,291 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"no-process-env": 0,
"no-console": 1,
"semi": ["error", "always"],
"allowImportExportEverywhere": false,
"allowImportExportEverywhere": true,
"comma-dangle": [
1,
{
Expand Down
Binary file added __pycache__/server.cpython-310.pyc
Binary file not shown.
Binary file added __pycache__/server.cpython-38.pyc
Binary file not shown.
33,090 changes: 21,372 additions & 11,718 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"build": "API_HOST=https://jobcore.herokuapp.com bash -c 'webpack --config webpack.prod.js'",
"build:dev": "API_HOST=https://jobcore-test.herokuapp.com bash -c 'webpack --config webpack.dev.js'",
"deploy:test": "now --target staging -b [API_HOST=https://jobcore-test.herokuapp.com]",
"deploy": "now --prod -b [API_HOST=https://jobcore.herokuapp.com]"
"deploy": "now --prod -b [API_HOST=https://jobcore.herokuapp.com]",
"start:isratest": "API_HOST=https://8000-lavender-alligator-jdqsikyc39p.ws-us38.gitpod.io bash -c 'webpack-dev-server --config webpack.dev.js --open'"
},
"author": "",
"license": "ISC",
Expand All @@ -34,7 +35,6 @@
"css-loader": "^0.28.11",
"dotenv-webpack": "^1.5.7",
"eslint": "^4.19.1",
"eslint-loader": "^2.0.0",
"eslint-plugin-react": "^7.7.0",
"file-loader": "^1.1.11",
"html-loader": "^0.5.5",
Expand Down Expand Up @@ -71,6 +71,8 @@
"@fortawesome/free-solid-svg-icons": "^5.15.3",
"@fortawesome/react-fontawesome": "^0.1.14",
"@react-pdf/renderer": "^1.6.8",
"@stripe/react-stripe-js": "^1.7.0",
"@stripe/stripe-js": "^1.23.0",
"babel-preset-es2015": "^6.24.1",
"bc-react-calendar": "^1.0.39",
"bc-react-notifier": "^1.1.6",
Expand All @@ -84,6 +86,7 @@
"google-map-react": "^1.0.6",
"interactjs": "^1.3.4",
"jquery": "^3.4.1",
"js-cookie": "^3.0.1",
"lodash": "^4.17.15",
"moment": "^2.22.2",
"pdf-lib": "^1.16.0",
Expand All @@ -110,6 +113,7 @@
"react-polyfills": "0.0.1",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-scripts": "^5.0.0",
"react-select": "^2.0.0",
"react-stripe-elements": "^6.1.2",
"react-svg-inline": "^2.1.1",
Expand Down
147 changes: 147 additions & 0 deletions packagejsonStripeSample.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
{
"name": "jobcore-employee-web",
"version": "0.0.4",
"description": "",
"main": "index.js",
"engines": {
"node": "14.x"
},
"homepage": "http://localhost:3000/checkout",
"proxy": "http://localhost:4242",
"scripts": {
"stripestart": "react-scripts start",
"stripebuild": "react-scripts build",
"stripetest": "react-scripts test",
"stripeeject": "react-scripts eject"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/core": "^7.4.3",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-proposal-object-rest-spread": "^7.5.5",
"@babel/plugin-transform-arrow-functions": "^7.2.0",
"@babel/plugin-transform-async-to-generator": "^7.5.0",
"@babel/plugin-transform-runtime": "^7.5.5",
"@babel/preset-env": "^7.4.3",
"@babel/preset-react": "^7.0.0",
"@babel/runtime": "^7.5.5",
"babel-cli": "^6.26.0",
"babel-eslint": "^8.2.2",
"babel-loader": "^8.0.0-beta.6",
"css-loader": "^0.28.11",
"dotenv-webpack": "^1.5.7",
"eslint": "^4.19.1",
// "eslint-loader": "^2.0.0",
"eslint-plugin-react": "^7.7.0",
"file-loader": "^1.1.11",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.2.0",
"node-sass": "^4.13.1",
"react-svg-loader": "^2.1.0",
"sass-loader": "^6.0.6",
"style-loader": "^0.19.1",
"svg-inline-loader": "^0.8.0",
"webpack": "^4.31.0",
"webpack-cli": "^3.0.3",
"webpack-dev-server": "^3.8.0",
"webpack-merge": "^4.1.3"
},
"babel": {
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-transform-arrow-functions",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-transform-runtime",
"@babel/plugin-transform-async-to-generator"
]
},
"dependencies": {
"@4geeksacademy/react-flux-dash": "^3.0.2",
"@fortawesome/fontawesome": "^1.1.4",
"@fortawesome/fontawesome-free-regular": "^5.0.8",
"@fortawesome/fontawesome-free-solid": "^5.0.13",
"@fortawesome/fontawesome-svg-core": "^1.2.35",
"@fortawesome/free-solid-svg-icons": "^5.15.3",
"@fortawesome/react-fontawesome": "^0.1.14",
"@react-pdf/renderer": "^1.6.8",
"@stripe/react-stripe-js": "^1.7.0",
"@stripe/stripe-js": "^1.23.0",
"babel-preset-es2015": "^6.24.1",
"bc-react-calendar": "^1.0.39",
"bc-react-notifier": "^1.1.6",
"bc-react-session": "^1.5.2",
"bootstrap": "^4.4.1",
"deepmerge": "^2.1.1",
"downloadjs": "^1.4.7",
"events": "^1.1.1",
"file-saver": "^2.0.5",
"flux": "^3.1.3",
"google-map-react": "^1.0.6",
"interactjs": "^1.3.4",
"jquery": "^3.4.1",
"lodash": "^4.17.15",
"moment": "^2.22.2",
"pdf-lib": "^1.16.0",
"popper.js": "^1.12.9",
"prop-types": "^15.7.2",
"query-string": "^5.1.1",
"rc-time-picker": "^3.4.0",
"rc-tooltip": "^3.7.3",
"react": "^16.8.6",
"react-ace": "^5.9.0",
"react-calendar-timeline": "^0.22.0",
"react-cropper": "^2.1.4",
"react-datetime": "^2.15.0",
"react-device-detect": "^1.6.2",
"react-dnd": "^9.3.4",
"react-dnd-html5-backend": "^9.3.4",
"react-dom": "^16.8.6",
"react-dropzone": "^10.1.5",
"react-joyride": "^2.2.1",
"react-loader-spinner": "^3.1.14",
"react-pdf": "^5.3.2",
"react-places-autocomplete": "^7.2.0",
"react-plaid-link": "^1.5.0",
"react-polyfills": "0.0.1",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-scripts": "^5.0.0",
"react-select": "^2.0.0",
"react-stripe-elements": "^6.1.2",
"react-svg-inline": "^2.1.1",
"react-textarea-autosize": "^7.1.2",
"react-transition-group": "^2.4.0",
"reactstrap": "^8.9.0",
"snake-case": "^3.0.3",
"underscore": "^1.9.1",
"url-loader": "^4.1.1",
"validator": "^10.4.0"
},
"scrip2": {
"start": "API_HOST=https://jobcore.herokuapp.com bash -c 'webpack-dev-server --config webpack.dev.js --open'",
"start:gitpod": "API_HOST=https://8000-c50c6f93-a9bc-4720-bd98-2493535a5067.ws-us17.gitpod.io bash -c 'webpack-dev-server --config webpack.dev.js --open'",
"start:dev": "API_HOST=https://jobcore-test.herokuapp.com bash -c 'webpack-dev-server --config webpack.dev.js --open'",
"start:prod": "API_HOST=https://jobcore.herokuapp.com bash -c 'webpack-dev-server --config webpack.dev.js --open'",
"build": "API_HOST=https://jobcore.herokuapp.com bash -c 'webpack --config webpack.prod.js'",
"build:dev": "API_HOST=https://jobcore-test.herokuapp.com bash -c 'webpack --config webpack.dev.js'",
"deploy:test": "now --target staging -b [API_HOST=https://jobcore-test.herokuapp.com]",
"deploy": "now --prod -b [API_HOST=https://jobcore.herokuapp.com]"
}
}
13 changes: 13 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
certifi==2021.5.30
chardet==4.0.0
Click==8.0.1
Flask==2.0.1
idna==3.2
itsdangerous==2.0.1
Jinja2==3.0.1
MarkupSafe==2.0.1
requests==2.26.0
stripe==2.60.0
toml==0.10.2
Werkzeug==2.0.1
Werkzeug==2.0.1
44 changes: 44 additions & 0 deletions server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#! /usr/bin/env python3.6
"""
Python 3.6 or newer required.
"""
import json
import os
import stripe

# This is your test secret API key.
stripe.api_key = 'sk_test_1TXcRvV5Nw6YkHAUV2pmZU2J00vnmMWTZu'

from flask import Flask, render_template, jsonify, request


app = Flask(__name__, static_folder='public',
static_url_path='', template_folder='public')


def calculate_order_amount(items):
# Replace this constant with a calculation of the order's amount
# Calculate the order total on the server to prevent
# people from directly manipulating the amount on the client
return 1400


@app.route('/create-payment-intent', methods=['POST'])
def create_payment():
try:
data = json.loads(request.data)
# Create a PaymentIntent with the order amount and currency
intent = stripe.PaymentIntent.create(
amount=calculate_order_amount(data['items']),
currency='eur',
automatic_payment_methods={
'enabled': True,
},
)
return jsonify({
'clientSecret': intent['client_secret']
})
except Exception as e:
return jsonify(error=str(e)), 403
if __name__ == '__main__':
app.run(port=4242)
Loading

1 comment on commit a6819ae

@vercel
Copy link

@vercel vercel bot commented on a6819ae Mar 19, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.