Call Revenue /api/payments/search for the date window
2
Filter filter
Drop ignored course types, payments before the go-live date, and payments already evaluated
3
Access rules rules
Keep only real access payments; skip test records and invalid rows
4
Map to AP transform
Brand → AP instance, course type → bootcamp/course, verify id in AP listing
5
Duplicate guard guard
One enrollment per brand + student + course
6
Record enrollment record
Store the exact AP request; status depends on write mode
7
Human approval human
A team member approves or rejects (APPROVAL mode)
8
Create in AP external
POST create-enrollment-v2 to the brand's Assignment Portal
How this automation decides
Search Revenue for payments in the date range (today minus lookbackDays → today, IST). Each Revenue payment id is remembered, so a payment is evaluated once.
Ignore ignoredCourseTypes and anything before minPaymentDate.
Skip test records: email domains in skipEmailDomains, course names matching skipCourseNamePatterns.
Keep only access payments: installment type in accessInstallmentTypes or starting with one of accessInstallmentPrefixes.
Map brand → AP instance; offer → bootcamp with bootcamp_id = course_lid; course → standalone course (batch chosen by a human).
Duplicate guard: one enrollment per (brand, student email, course_lid).
Record the enrollment as DRY_RUN / PENDING_APPROVAL / QUEUED depending on write mode. Only QUEUED enrollments are sent to AP, and only when AP_WRITES_ENABLED=true.