Safe mode·APQA·workflow DRY RUN·AP_WRITES_ENABLED LIVE

Settings · Revenue access payment → Assignment Portal enrollment

Settings

Rules

Steps in this pipeline

  1. 1
    Fetch payments source
    Call Revenue /api/payments/search for the date window
  2. 2
    Filter filter
    Drop ignored course types, payments before the go-live date, and payments already evaluated
  3. 3
    Access rules rules
    Keep only real access payments; skip test records and invalid rows
  4. 4
    Map to AP transform
    Brand → AP instance, course type → bootcamp/course, verify id in AP listing
  5. 5
    Duplicate guard guard
    One enrollment per brand + student + course
  6. 6
    Record enrollment record
    Store the exact AP request; status depends on write mode
  7. 7
    Human approval human
    A team member approves or rejects (APPROVAL mode)
  8. 8
    Create in AP external
    POST create-enrollment-v2 to the brand's Assignment Portal

How this automation decides

  1. 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.
  2. Ignore ignoredCourseTypes and anything before minPaymentDate.
  3. Skip test records: email domains in skipEmailDomains, course names matching skipCourseNamePatterns.
  4. Keep only access payments: installment type in accessInstallmentTypes or starting with one of accessInstallmentPrefixes.
  5. Map brand → AP instance; offer → bootcamp with bootcamp_id = course_lid; course → standalone course (batch chosen by a human).
  6. Duplicate guard: one enrollment per (brand, student email, course_lid).
  7. 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.