2021-02-19 00:22:28 +01:00
|
|
|
# Pepettes, a donation form
|
2021-02-15 04:36:24 +01:00
|
|
|
|
2021-02-19 00:22:28 +01:00
|
|
|
A small form to donate money to a project. Support one-time or recuring payment.
|
2021-02-15 04:36:24 +01:00
|
|
|
|
|
|
|
**Demo**
|
|
|
|
|
|
|
|
The demo is running in test mode -- use `4242424242424242` as a test card number with any CVC + future expiration date.
|
|
|
|
|
|
|
|
Use the `4000002500003155` test card number to trigger a 3D Secure challenge flow.
|
|
|
|
|
2024-05-22 01:52:00 +02:00
|
|
|
Read more about testing on Stripe at <https://stripe.com/docs/testing>.
|
2021-02-15 04:36:24 +01:00
|
|
|
|
|
|
|
## How to run locally
|
|
|
|
|
|
|
|
Follow the steps below to run locally.
|
|
|
|
|
2024-05-22 01:52:00 +02:00
|
|
|
```bash
|
2024-05-22 01:54:25 +02:00
|
|
|
git clone https://github.com/YunoHost/pepettes
|
|
|
|
cd pepettes
|
2021-02-15 04:36:24 +01:00
|
|
|
python3 -m venv venv
|
|
|
|
source venv/bin/activate
|
2024-05-22 01:53:34 +02:00
|
|
|
python3 -m pip install -r requirements.txt
|
2021-02-15 04:41:39 +01:00
|
|
|
```
|
|
|
|
|
2021-02-19 00:14:04 +01:00
|
|
|
Create a settings.py file with :
|
2024-05-22 01:52:00 +02:00
|
|
|
|
|
|
|
```text
|
2021-02-19 00:14:04 +01:00
|
|
|
ENV = 'development'
|
|
|
|
PORT = 8000
|
|
|
|
DOMAIN = 'http://localhost:8000'
|
|
|
|
SECRET_KEY = '712AZPOC87HXD5SQSb12rd'
|
|
|
|
SECRET_CSRF_KEY = '712AZPOC87HXD5SQSb12'
|
|
|
|
LANGUAGES = ['en', 'fr']
|
|
|
|
BABEL_TRANSLATION_DIRECTORIES = 'locales'
|
|
|
|
|
|
|
|
# Customization
|
|
|
|
CUSTOM = {}
|
|
|
|
CUSTOM['name'] = 'YunoHost'
|
|
|
|
CUSTOM['contact_url'] = 'mailto:donate-6521@yunohost.org'
|
|
|
|
CUSTOM['logo'] = 'https://yunohost.org/user/images/logo.png'
|
|
|
|
CUSTOM['favicon'] = 'https://yunohost.org/user/themes/yunohost-docs/images/favicon.png'
|
|
|
|
CUSTOM['currencies'] = [
|
|
|
|
('EUR', '€'),
|
|
|
|
('USD', '$')
|
|
|
|
]
|
2021-02-15 04:41:39 +01:00
|
|
|
|
|
|
|
# Stripe keys
|
2021-02-19 00:14:04 +01:00
|
|
|
CUSTOM['stripe_publishable_key'] = 'pk_test_gOgGjacs9YfvDJY03BRZ576O'
|
|
|
|
STRIPE_SECRET_KEY = 'sk_test_'
|
2021-02-15 04:41:39 +01:00
|
|
|
|
|
|
|
# Stripe subscription data
|
2021-02-19 00:14:04 +01:00
|
|
|
DONATION={'one_time':{}, 'recuring': {}}
|
|
|
|
DONATION['one_time']['EUR'] = 'price_1IKuPVE7vOmTpJBiYMq7ztLH'
|
|
|
|
DONATION['one_time']['USD'] = 'price_1IKuQfE7vOmTpJBi0A3nRGCJ'
|
|
|
|
DONATION['recuring']['EUR'] = 'price_1IKumjE7vOmTpJBikyqS2NqD'
|
|
|
|
DONATION['recuring']['USD'] = 'price_1IKumAE7vOmTpJBiO4CEfa3Q'
|
2021-02-15 04:41:39 +01:00
|
|
|
```
|
|
|
|
|
2024-05-22 01:52:00 +02:00
|
|
|
```bash
|
2021-02-15 04:36:24 +01:00
|
|
|
export FLASK_APP=server.py
|
|
|
|
python3 -m flask run --port=8000
|
|
|
|
```
|
2024-05-22 02:51:59 +02:00
|
|
|
|
|
|
|
```bash
|
|
|
|
# extract new strings or update existing strings
|
|
|
|
pybabel extract -F babel.cfg -o messages.pot *.py assets/*.html
|
|
|
|
|
|
|
|
# then update the locale files, please translate into french any new string
|
|
|
|
pybabel update -i messages.pot -d locales
|
|
|
|
```
|