Skip to content

Commit 662e469

Browse files
committed
merge changes
2 parents 5647d7f + 1dc21fb commit 662e469

31 files changed

+2472
-1721
lines changed

.flake8

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[flake8]
2-
exclude = build,.git,.tox,./django/utils/six.py,./django/conf/app_template/*,./tests/.env,./env,./app/settings.py,./*/migrations,./app/hackathon_variables.py,./venv
3-
ignore = W601,F403,W504,F405,W605
2+
exclude = build,.git,.tox,./django/utils/six.py,./django/conf/app_template/*,./tests/.env,./env,./app/settings.py,./*/migrations,./app/hackathon_variables.py,./venv,./applications/models/*,./applications/forms/*
3+
ignore = W601,F403,W504,F405,W605,W503
44
max-line-length = 120

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ cache/
2727
*.sh
2828

2929
.env
30+
.google-service.account.json

README.md

Lines changed: 72 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,43 @@
1919
- Automatic control of confirmation, expiration and cancellation flows 🔄
2020
- Django Admin dashboard to manually edit applications, reimbursement and users 👓
2121
- Flexible email backend (SendGrid is the default and recommended supported backend) 📮
22+
- CAS server for other platforms
2223
- (Optional) Separate applications from dubious hackers to manually contact them 🧐
2324
- (Optional) Automated slack invites on confirm #️⃣
2425
- (Optional) MyMLH sign up 📥
25-
- CAS server for other platforms
26-
26+
- (Optional) Google Wallet Pass API Integration
2727

2828

2929
## Setup
3030

3131
Needs: Python 3.X, virtualenv
3232

33-
- `git clone https://github.com/hackupc/registration && cd registration`
33+
Stable at v. 3.8.10
34+
35+
- `git clone https://github.com/hackupc/myhackupc && cd myhackupc`
3436
- `virtualenv env --python=python3`
3537
- `source ./env/bin/activate`
3638
- `pip install -r requirements.txt`
3739
- (Optional) If using Postgres, set up the necessary environment variables for its usage before this step
3840
- `python manage.py migrate`
3941
- `python manage.py createsuperuser` (creates super user to manage all the app)
4042

43+
### FAQ
44+
**The library backports.zoneinfo fails to install**
45+
If you are experiencing an error similar to this one:
46+
47+
``
48+
ERROR: Could not build wheels for backports.zoneinfo, which is required to install pyproject.toml-based projects
49+
``
50+
51+
Plase make sure to use *Python **3.8.10***
52+
53+
54+
**The library Pillow fails to install**
55+
Ths did the trick (note the python and -m flag are placed in purpouse to make sure you install it using the correct virtualenv python version):
56+
```
57+
python -m pip install --upgrade Pillow
58+
```
4159

4260
### Dummy data
4361

@@ -62,6 +80,10 @@ You can replace the email backend easily. See more [here](https://djangopackages
6280
- **SL_BOT_DIRECTOR2**(optional): User ID of the other director.
6381
- **MLH_CLIENT_SECRET**(optional): Enables MyMLH as a sign up option. Format is `client_id@client_secret` (See "Set up MyMLH" below)
6482
- **CAS_SERVER**(optional): Enables login for other platforms
83+
- **GOOGLE_WALLET_APPLICATION_CREDENTIALS**(optional): The path to the json key file containing all google-related API credentials
84+
- **GOOGLE_WALLET_ISSUER_ID**(optional): The issuer ID of Google Wallet Pass API
85+
- **GOOGLE_WALLET_CLASS_SUFFIX**(optional): The name of the class created at the [Google Wallet Console](https://pay.google.com/business/console/passes/)
86+
6587

6688

6789
## Server
@@ -178,6 +200,50 @@ In that direction the approach taken is to extract fields and use them for the a
178200

179201
Note that to test locally you will need to add a line where `DOMAIN` is `localhost:8000`.
180202

203+
#### Set up Google Wallet Pass API
204+
1. Sign up for a Google Wallet API Issuer account. [Click here](https://pay.google.com/business/console)
205+
2. Enable the Wallet API
206+
- Sign into the [Google Cloud Platform](https://console.cloud.google.com/) and enable the Google Wallet API for your GCP project.
207+
- If you don’t already have a GCP project, create one.
208+
- Enable the [Google Wallet API](https://console.cloud.google.com/apis/library/walletobjects.googleapis.com).
209+
3. Create a service account and export its keys into a json file
210+
- Create a service account:
211+
212+
1. [Create a service account](https://console.cloud.google.com/iam-admin/serviceaccounts/create) in the Google Cloud Console, providing the following details:
213+
Service account name - example: Wallet Web Client
214+
Service account ID - example: my-service-account
215+
2. Click CREATE AND CONTINUE.
216+
3. Click DONE.
217+
218+
- Create a service account key:
219+
220+
1. Select your service account. For example: [email protected].
221+
2. Click on the **KEYS** menu item at the top of the page.
222+
3. Click **ADD KEY** and Create new key.
223+
4. Select key type **JSON**.
224+
5. Click **CREATE** to create and download the service account key.
225+
226+
> **Remember** to set the **GOOGLE_WALLET_APPLICATION_CREDENTIALS** enviroment variable as the correct path of this Json file, which is recommended to be set on the root of the hosted project to make sure read perms are ok
227+
228+
4. Authorize the service account
229+
230+
You must authorize the service account in order to call the API. To authorize it, grant the service account access to manage your Issuer Account.
231+
232+
Visit the Users page in the [Google Pay and Wallet Console](https://pay.google.com/business/console).
233+
1. Click Invite a **user**.
234+
2. Add the service account's email address. For example: ``[email protected]``.
235+
3. Select **Developer** for Access level.
236+
4. Click **Invite**.
237+
238+
5. Create a class
239+
Enter to the [Google Wallet Console](https://pay.google.com/business/console/passes/) and click on **create class** with type **GENERIC** (it is very important to be generic-type, otherwise it won't work).
240+
241+
>Fill the gaps and click on create, make sure to remember the **CLASS_ID** value since it is the **GOOGLE_WALLET_CLASS_SUFFIX** you'll need to set up on the enviroment variables.
242+
243+
>At this point you can also set the **GOOGLE_WALLET_ISSUER_ID** enviroment variable, which Google tells you when visiting the [Google Wallet Console](https://pay.google.com/business/console/passes/)
244+
245+
246+
181247
#### Set up nginx
182248

183249
Needs: Nginx
@@ -300,10 +366,12 @@ You can change the form, titles, texts in [applications/forms.py](applications/f
300366
#### Update application model
301367
If you need extra labels for your hackathon, you can change the model and add your own fields.
302368

303-
- Update model with specific fields: [applications/models.py](applications/models.py)
369+
- Create a file inside the application/models folder, and update the model with specific fields (see already created examples): [applications/models.py](applications/models/__init__.py)
304370
- `python manage.py makemigrations`
305371
- `python manage.py migrate`
306372

373+
374+
307375
# Want to Contribute?
308376
Read these [guidelines](.github/CONTRIBUTING.md) carefully.
309377

app/settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
'corsheaders',
5959
]
6060

61+
GOOGLE_WALLET_ENABLED=True #Set to false to disable google wallet
62+
6163
if BAGGAGE_ENABLED:
6264
INSTALLED_APPS.append('baggage')
6365

app/static/img/button.svg

Lines changed: 16 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)