Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MyECLPay #611

Draft
wants to merge 68 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
970ddff
Allow to specify a nickname when creating test user
armanddidierjean Oct 27, 2024
a8aae0d
Add MyECLPay module
armanddidierjean Oct 27, 2024
44e5282
Create models
armanddidierjean Oct 27, 2024
6dbd817
Add register and get history endpoints
armanddidierjean Oct 27, 2024
1a7b221
Add scan endpoint
armanddidierjean Oct 30, 2024
071e140
Add database migration
armanddidierjean Oct 30, 2024
9e82167
Add store in the qrcode
armanddidierjean Oct 31, 2024
491d18c
Verify that the wallet is active and send notification
armanddidierjean Nov 4, 2024
4d9ef15
Add is_user_registered_and_latest_cgu_signed utils
armanddidierjean Nov 4, 2024
0df28c6
Register and sign CGU
armanddidierjean Nov 16, 2024
15fbbc3
Fix migration
armanddidierjean Nov 16, 2024
020337d
Change sign_cgu endpoint
armanddidierjean Nov 16, 2024
9a91a05
Test get and sign cgu and register
armanddidierjean Nov 16, 2024
8bd5e96
Check debited user CGU versions
armanddidierjean Nov 16, 2024
38c9885
fix: adding missing group type
maximeroucher Nov 17, 2024
af11b43
Get, create and activate devices
armanddidierjean Nov 16, 2024
fbcada5
Use existing availableassociationmembership
armanddidierjean Nov 16, 2024
7025e2b
Use postgresql.ENUM
armanddidierjean Nov 16, 2024
79641a5
Define Enum in migration file
armanddidierjean Nov 16, 2024
29e249d
Get device
armanddidierjean Nov 16, 2024
2f29974
Payment admin
armanddidierjean Nov 16, 2024
137518c
Fix get seller admins
armanddidierjean Nov 17, 2024
2496d18
Integrate dataclass
armanddidierjean Nov 17, 2024
74c9d58
Fix migration for postgresql
armanddidierjean Nov 17, 2024
a732319
fix(scan): use wallet id in transaction
armanddidierjean Nov 17, 2024
eac6da5
Precise store id when manipulating sellers
armanddidierjean Nov 17, 2024
b970365
Don't create an unregistered_ecl_user_access_token for each test
armanddidierjean Nov 17, 2024
3d11c30
Update store and add tests
armanddidierjean Nov 23, 2024
66b3719
Add CoreUser relationships in models
armanddidierjean Nov 24, 2024
acbbc56
Return UserSimple in GET store admins endpoint
armanddidierjean Nov 24, 2024
048867d
Rename permission can_see_history
armanddidierjean Nov 24, 2024
9889a6b
Rename Inactive
armanddidierjean Nov 24, 2024
a146fce
Fix typo can_see_history and inactive
armanddidierjean Nov 26, 2024
3254ec5
Test update_store
armanddidierjean Nov 26, 2024
4a30fb6
feat: adding get user wallet
maximeroucher Nov 30, 2024
66aa655
feat: adding user get stores
maximeroucher Nov 30, 2024
02be806
fix: core user import
armanddidierjean Nov 30, 2024
cb0db30
feat: admin get stores
maximeroucher Nov 30, 2024
38762c0
Add test and rename Disabled by Revoked
armanddidierjean Dec 1, 2024
db6ad7b
Lint
armanddidierjean Dec 1, 2024
1b44f40
Fix migration
armanddidierjean Dec 1, 2024
f4250eb
Fix: correct rebase
Rotheem Dec 18, 2024
e51558a
Add structures to stores management (#634)
Rotheem Jan 10, 2025
7f7fbe5
Fix: rename CGU as TOS
Rotheem Jan 10, 2025
8115600
Feat: sellers management
Rotheem Jan 10, 2025
f7e7116
Feat: store deletion and history
Rotheem Jan 13, 2025
65984ed
Fix: add structure in store schema
Rotheem Jan 15, 2025
b5e4097
Fix: change device activation mail template
Rotheem Jan 15, 2025
4627e5c
Feat: upgrade email template tester
Rotheem Jan 15, 2025
d815a53
Fix: add mail template for TOS signature
Rotheem Jan 15, 2025
a774e63
Fix: template name
Rotheem Jan 15, 2025
8726223
Fix: device activation
Rotheem Jan 15, 2025
704ce6e
Fix: simplify device activation url
Rotheem Jan 15, 2025
fc51084
Fix: device activation log
Rotheem Jan 15, 2025
e629886
Feat: add user simple schema in structure
Rotheem Jan 16, 2025
bb381e6
Fix: add manager user to structure schema
Rotheem Jan 19, 2025
9053e2e
Fix: tests
Rotheem Jan 19, 2025
4ba4918
Feat: add transfer endpoint
Rotheem Jan 24, 2025
46ae93f
Fix: use user from Depends as approver when transfer is not helloasso
Rotheem Jan 24, 2025
15bf02a
Fix: migration
Rotheem Jan 24, 2025
73b705c
Fix: endpoint rename
Rotheem Jan 24, 2025
43e283a
Fix: transfer endpoint
Rotheem Jan 25, 2025
1f50c9c
Fix: add response model to seller and admin creation
Rotheem Jan 25, 2025
f4ff412
Fix: correct sellers cruds and models
Rotheem Jan 26, 2025
4e5ff51
Fix: correct sellers cruds and models
Rotheem Jan 26, 2025
51f94e1
Feat: delete admin system as deprecated since structure management
Rotheem Jan 26, 2025
1036440
Feat: add test for sellers and transfer
Rotheem Jan 26, 2025
9a175f0
Fix: migration
Rotheem Jan 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ACCESS_TOKEN_SECRET_KEY = ""
RSA_PRIVATE_PEM_STRING = ""
AUTH_CLIENTS=[]

MYECLPAY_DATA_VERIFIER_ACCESS_TOKEN = ""
# Host or url of the instance of Hyperion
# This url will be especially used for oidc/oauth2 discovery endpoint and links send by email
# NOTE: A trailing / is required
Expand Down Expand Up @@ -57,7 +57,9 @@ USE_FIREBASE=false
#HELLOASSO_CLIENT_ID = ""
#HELLOASSO_CLIENT_SECRET = ""

CDR_PAYMENT_REDIRECTION_URL: str | None = None
CDR_PAYMENT_REDIRECTION_URL: str | None
MYECLPAY_PAYMENT_REDIRECTION_URL: str | None
MYECLPAY_MAXIMUM_WALLET_BALANCE: int | None

# Redis configuration #
REDIS_HOST = "hyperion-redis" #May be left at "" during dev if you don't have a redis server running, in production it should be set to the name of the redis container
Expand Down
2 changes: 2 additions & 0 deletions app/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from app.core.auth import endpoints_auth
from app.core.google_api import endpoints_google_api
from app.core.groups import endpoints_groups
from app.core.myeclpay import endpoints_myeclpay
from app.core.notification import endpoints_notification
from app.core.payment import endpoints_payment
from app.core.schools import endpoints_schools
Expand All @@ -22,6 +23,7 @@
api_router.include_router(endpoints_core.router)
api_router.include_router(endpoints_google_api.router)
api_router.include_router(endpoints_groups.router)
api_router.include_router(endpoints_myeclpay.module.router)
api_router.include_router(endpoints_notification.router)
api_router.include_router(endpoints_payment.router)
api_router.include_router(endpoints_users.router)
Expand Down
17 changes: 11 additions & 6 deletions app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,16 @@ class Settings(BaseSettings):
HELLOASSO_CLIENT_SECRET: str | None = None

CDR_PAYMENT_REDIRECTION_URL: str | None = None
RAID_PAYMENT_REDIRECTION_URL: str | None = None
MYECLPAY_PAYMENT_REDIRECTION_URL: str | None = None
MYECLPAY_MAXIMUM_WALLET_BALANCE: int = 1000

# Drive configuration for the raid registering app
RAID_DRIVE_REFRESH_TOKEN: str | None = None
RAID_DRIVE_API_KEY: str | None = None
RAID_DRIVE_CLIENT_ID: str | None = None
RAID_DRIVE_CLIENT_SECRET: str | None = None

RAID_PAYMENT_REDIRECTION_URL: str | None = None

############################
# PostgreSQL configuration #
############################
Expand Down Expand Up @@ -155,6 +156,7 @@ class Settings(BaseSettings):
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
REFRESH_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 14 # 14 days
AUTHORIZATION_CODE_EXPIRE_MINUTES: int = 7
MYECLPAY_MANAGER_TRANSFER_TOKEN_EXPIRES_MINUTES: int = 20

###############################################
# Authorization using OAuth or Openid connect #
Expand Down Expand Up @@ -186,6 +188,11 @@ class Settings(BaseSettings):
# NOTE: AUTH_CLIENTS property should never be used in the code. To get an auth client, use `KNOWN_AUTH_CLIENTS`
AUTH_CLIENTS: list[tuple[str, str | None, list[str], str]]

# MyECLPay requires an external service to recurrently check for transactions and state integrity, this service needs an access to all the data related to the transactions and the users involved
# This service will use a special token to access the data
# If this token is not set, the service will not be able to access the data and no integrity check will be performed
MYECLPAY_DATA_VERIFIER_ACCESS_TOKEN: str | None = None

#################################
# Hardcoded Hyperion parameters #
#################################
Expand All @@ -195,6 +202,8 @@ class Settings(BaseSettings):
HYPERION_VERSION: str = "4.0.0"
MINIMAL_TITAN_VERSION_CODE: int = 139

# Maximum wallet balance for MyECLPay in cents, we will prevent user from adding more money to their wallet if it will make their balance exceed this value

######################################
# Automatically generated parameters #
######################################
Expand Down Expand Up @@ -239,10 +248,6 @@ def RSA_PUBLIC_JWK(cls) -> dict[str, list[dict[str, Any]]]:
)
return {"keys": [jwk]}

# Tokens validity
USER_ACTIVATION_TOKEN_EXPIRES_HOURS: int = 24
PASSWORD_RESET_TOKEN_EXPIRES_HOURS: int = 12

# This property parse AUTH_CLIENTS to create a dictionary of auth clients:
# {"client_id": AuthClientClassInstance}
@computed_field # type: ignore[misc]
Expand Down
1 change: 1 addition & 0 deletions app/core/groups/groups_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class GroupType(str, Enum):
# Core groups
admin = "0a25cb76-4b63-4fd3-b939-da6d9feabf28"
AE = "45649735-866a-49df-b04b-a13c74fd5886"
# payment = "5571adfd-47fc-4dde-a44b-6e1289476499"

# Module related groups
amap = "70db65ee-d533-4f6b-9ffa-a4d70a17b7ef"
Expand Down
Empty file added app/core/myeclpay/__init__.py
Empty file.
Loading
Loading