Skip to content

RELEASE: OpenCRVS integration & Form schema updates#62

Merged
phrogwrld merged 67 commits intoproductionfrom
develop
Jan 30, 2026
Merged

RELEASE: OpenCRVS integration & Form schema updates#62
phrogwrld merged 67 commits intoproductionfrom
develop

Conversation

@sajclarke
Copy link
Contributor

@sajclarke sajclarke commented Jan 20, 2026

Description

This PR introduces comprehensive OpenCRVS (Open Civil Registry Vital Statistics) integration for birth registration processing, along with multiple form schema improvements, payment processing enhancements, and validation updates. The release includes major new features enabling automated birth event registration with OpenCRVS and payment integration for certificate forms.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Changes Made

OpenCRVS Integration (Major Feature)

  • New OpenCRVS Module with complete civil registry integration
    • opencrvs.service.ts - Core service for OpenCRVS API communication
    • birth-registration.mapper.ts - Data mapping from form to OpenCRVS format
    • opencrvs.processor.ts - Processor implementation for birth registration pipeline
    • Complete type definitions for OpenCRVS data structures
  • Add OpenCRVS processor to processor pipeline
  • Implement location resolution (office, parish, health facility)
  • Support for multiple birth types (single, twins, triplets, more-than-triplets)
  • Automatic age calculation from national ID number
  • Annotation support for additional birth information
  • NEW: Token caching with node-cache - Auto-retry on 401 with TTL-based caching (feat(opencrvs): use node-cache for token management with auto-retry on 401 #84)

Payment Integration (Major Feature)

Form Schema Updates

Post Office Redirection Forms

Certificate Forms

Other Forms

Core Service Enhancements

  • Update forms.service.ts to support OpenCRVS and payment processor integration
  • Add form submission response DTO enhancements for processor results
  • Extend form-schema.interface.ts with processor configuration support
  • Update configuration.ts with OpenCRVS and payment settings
  • Enhance processor-pipeline.service.ts to handle new processors
  • Register OpenCRVS and payment processors in processors.module.ts
  • Complete email template audit and add applicant confirmation emails (fix: complete email template audit and add applicant confirmation emails #60)
  • Added titleCase helper and currentDate helper for email templates

Bug Fixes

Related PRs Included

Testing

  • OpenCRVS API connectivity and authentication tested
  • Birth registration mapping tested with sample data
  • Token caching and auto-retry on 401 verified
  • Location resolution tested for all location types
  • Multiple birth type handling verified
  • Payment processor integration tested
  • Payment confirmation emails tested (admin and customer)
  • Payment reconciliation endpoints tested
  • Form submission to OpenCRVS integration tested end-to-end
  • All Post Office redirection forms validated with new schemas
  • Birth and marriage certificate request forms validated with new fields
  • All email templates tested with new structure
  • All forms tested on responsive device sizes

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Unit tests added for OpenCRVS mapper and service
  • Integration tests added for OpenCRVS processor
  • Payment processor tests completed
  • Documentation updated with OpenCRVS setup and configuration
  • API documentation updated with new processor types
  • Environment variables/secrets documented
  • Type definitions complete and exported
  • Error handling comprehensive for API failures
  • All form schema changes verified against design specs
  • Database migrations executed if needed
  • Backward compatibility verified

IsaiahSama and others added 14 commits January 15, 2026 16:47
* fix: update schema to match figma

* fix: update form schema and validations for empty strings
* fix: update schema for deceased form to match figma

* fix: gracefully fail if unable to connect to smtp server
…sell-goods-services

fix (forms): Added missing schema validations for Sell Goods and Services on Beach
fix: add missing form field to form schema
…amme-schema

chore: Update schema for "YDP community sports programme" to use nested values
…tificate-forms

Fix (forms): Add contact info fields to certificate forms
* feat: add opencrvs integration

* Updated Keys For Birth Form Submission

* Added birth place address for Open CRVS submission

* Fixed Validations + Updated Mapping

* Added Informant Info + Fixed Alive Stats

* Made Email Dynamic

---------

Co-authored-by: ihtishamtanveer <ihtishamtanveer992@gmail.com>
Co-authored-by: = <=>
@sajclarke sajclarke changed the title RELEASE: OpenCRVS integration RELEASE: OpenCRVS integration & Form schema updates Jan 20, 2026
sajclarke and others added 14 commits January 20, 2026 15:41
…ange

Revert changes to schemas/register-birth-form.json from commit 4ab1178
Send confirmation emails when payment is successfully processed via webhook:

- Admin emails: sent to addresses configured in `confirmationEmailTo[]` array
- Customer email: sent to address configured in `customerEmail` field

Changes:
- Add `confirmationEmailTo` (string[]) and `customerEmail` fields to PaymentProcessorConfig
- Store email config in payment metadata for use during webhook processing
- Inject EmailService into PaymentWebhookService
- Send emails in processSuccessfulPayment() with submission ID in subject
- Create payment-confirmation.hbs template for admin notifications
- Create payment-confirmation-customer.hbs template for customer receipts
opencrvs: opencrvsResult.success
? {
success: true,
message: 'Birth registration submitted successfully',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not hardcode this message even if only Birth registration is supported at the moment
this will become hard to manage when we need to support other forms

We should make it dymanic

const isLocalhost = this.configService.get<boolean>('opencrvs.localhost');

if (isLocalhost) {
this.authBaseUrl = 'http://localhost:4040';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not need to hardcode these here
The localhost url can go in the env for opencrvs.authBaseUrl, opencrvs.eventsBaseUrl and opencrvs.locationsBaseUrl

We do not need to check for localhost specifically.

IsaiahSama and others added 25 commits January 27, 2026 18:08
Fix (form): Fixed issue causing declaration page to not render correctly
* Update email template to match physical form structure

* Added helper to get current date when sending an email

* Updated structure to better match new figma design

* Added missing `.` in title

* Increased line height for info box

* Updated Birth certificate admin email to match the updated structure

* Added header to marriage certificate

* Updated template for marriage certificate

* Updated styling and typography

* Added titleCase helper, and applied it to applicant.title

* Fixed missing closing if statements

* Fixed issue with incorrect if statement

* Fixed issue where h2 tag was not closed

* Removed unneeded message about multiple emails

* Now sanitzes input better for titleCase helper

* Cleaned up content to match suggestions

---------

Co-authored-by: Akinola Raphael <54055273+Ethical-Ralph@users.noreply.github.com>
* Update email template to match physical form structure

* Added helper to get current date when sending an email

* Updated structure to better match new figma design

* Added missing `.` in title

* Increased line height for info box

* Updated Birth certificate admin email to match the updated structure

* Added header to marriage certificate

* Updated template for marriage certificate

* Updated styling and typography

* Added titleCase helper, and applied it to applicant.title

* Fixed missing closing if statements

* Fixed issue with incorrect if statement

* Fixed issue where h2 tag was not closed

* Removed unneeded message about multiple emails

* Now sanitzes input better for titleCase helper

* Cleaned up content to match suggestions

---------

Co-authored-by: IsaiahSama <isaiahcarrington46@gmail.com>
Fix (Forms): JobStartPlus - 'Willing to work at night' is now optional
…ion-from-po-forms

Update (Temporary): Removed payment integration for the PO forms
…hanges

Update (Form): Updated schema and email template to match changes for redirect-individual-mail
…n 401 (#84)

- Add OpenCRVSCacheService using node-cache for TTL-based caching
- Implement automatic token refresh with 5-minute buffer before expiry
- Add authenticatedFetch helper that retries once on 401 expired token
- Replace manual token/location caching with node-cache service
…hanges

Chore (Form): Update Redirect-Deceased-Mail to match Figma
…hanges

Update (Form): Updated schema and email template to match changes for redirect-business-mail
chore: remove uploadDocumentUrls field from post-office-redirection-d…
@phrogwrld phrogwrld merged commit 254d231 into production Jan 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants