-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Milestone
Description
the process of verifying who has paid for sce membership is very inefficient. we can fix this by making a lot of the requirements automated using clark. let's start by making a mongodb database model for payments.
game plan
- create a new file in
/api/main_endpoints/models, let's call itMembershipPayment.js. this is where we'll define the schema for payments. you can refer toOfficeAccessCard.jsto see an example of how we create schemas in clark. - each payment requires:
- createdAt. this is simply a timestamp of when the entry is inserted into the database, which is useful for debugging and if we want to have these payments expire. this should be a
Date()object in javascript. - user id. we can use the user's
_idfield, which is already present in the database for any user with an account on clark. so every user who applies for membership obv has to have an account on clark. note: this field should be allowed to be nullable - status. we can use an enum to represent whether a payment is
pending,completed, orrejected. you can refer toAuditLog.jsto see how to use enums for a schema. - confirmation code. this is the key step of how we'll match venmo payments to clark accounts so we can authenticate membership.
- amount. this will represent how much money the user paid for membership. based on that we can verify their payment:
if (amount >= 30) {
member for a year
} else if (amount >= 20) {
member for a semester
} else {
no membership
}- venmo details. these will be used to store information in case something goes wrong with the automation. this will be a nested object with the following fields:
- transactionId
- payerEmail
- payerName
- ensure that this schema exists under a new collection in mongodb, we can call it
MembershipPayments. refer toOfficeAccessCard.jsto see how to specify collections. - export the schema and we're good to go 😁
Metadata
Metadata
Assignees
Labels
No labels