Skip to content

[payment project] create mongodb model for pending payments #1965

@adarshm11

Description

@adarshm11

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

  1. create a new file in /api/main_endpoints/models, let's call it MembershipPayment.js. this is where we'll define the schema for payments. you can refer to OfficeAccessCard.js to see an example of how we create schemas in clark.
  2. 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 _id field, 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, or rejected. you can refer to AuditLog.js to 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
  1. ensure that this schema exists under a new collection in mongodb, we can call it MembershipPayments. refer to OfficeAccessCard.js to see how to specify collections.
  2. export the schema and we're good to go 😁

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions