-
Notifications
You must be signed in to change notification settings - Fork 20
Kobo prototype backend code (used as example, to write kobo backend code) #7666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
* enable defaultMaxPayments if not defined * remove console logging * Update services/121-service/src/registration/services/registrations-import.service.ts --------- Co-authored-by: RubenGeo <[email protected]>
* get form definition from /deployed or handle error * error copy updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a prototype Kobo integration for the 121 platform, enabling programs to be created and managed with Kobo form data. The implementation includes backend services for processing Kobo forms, mapping their data to program attributes, and validating form structures against Financial Service Provider requirements.
Key Changes:
- Kobo integration backend services with form validation, webhook handling, and submission import
- Updated program creation flow to support optional attributes and automatic attribute generation
- New Angular frontend pages for project settings, FSP configuration, and Kobo integration management
Reviewed changes
Copilot reviewed 92 out of 92 changed files in this pull request and generated 35 comments.
Show a summary per file
| File | Description |
|---|---|
services/121-service/src/programs/kobo/*.ts |
New Kobo integration services for API communication, form processing, and validation |
services/121-service/src/programs/programs.service.ts |
Updated program creation to make attributes optional and add auto-generation logic |
services/121-service/src/registration/*.ts |
Enhanced registration import to handle missing attributes and default FSP configuration |
services/121-service/src/migration/*.ts |
Database migrations for Kobo entity and program schema updates |
interfaces/portal/src/app/pages/project-settings-*/*.ts |
New frontend pages for project settings, FSP configuration, and Kobo integration |
services/121-service/test/program/create-kobo-program.test.ts |
Comprehensive integration tests for Kobo program creation flow |
| it('should go through program creation flow', async () => { | ||
| // Arrange | ||
|
|
||
| // Delete existing hooks from kobo for convience in this prototype |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'convience' to 'convenience'.
| // Delete existing hooks from kobo for convience in this prototype | |
| // Delete existing hooks from kobo for convenience in this prototype |
| }); | ||
|
|
||
| const hooks = hooksReponse.body.results; | ||
| console.log('🚀 ~ it.only ~ hooks:', hooks); |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove debug console.log statement before merging to production. This appears to be debugging code that should not be committed.
| console.log('🚀 ~ it.only ~ hooks:', hooks); |
| accessToken, | ||
| }); | ||
|
|
||
| console.log('🚀 ~ it ~ postFspConfigResponse:', postFspConfigResponse.body); |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove debug console.log statement before merging to production. This appears to be debugging code that should not be committed.
| console.log('🚀 ~ it ~ postFspConfigResponse:', postFspConfigResponse.body); |
| koboAssetId: process.env.KOBO_ASSET_ID, | ||
| koboUrl: process.env.KOBO_URL, | ||
| }; | ||
| console.log('🚀 ~ it ~ koboLinkDto:', koboLinkDto); |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove debug console.log statement before merging to production. This appears to be debugging code that should not be committed.
| console.log('🚀 ~ it ~ koboLinkDto:', koboLinkDto); |
| accessToken, | ||
| dryRun: true, | ||
| }); | ||
| console.log('🚀 ~ it ~ linkKoboResponse:', linkKoboResponseDryRun.body); |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove debug console.log statement before merging to production. This appears to be debugging code that should not be committed.
| console.log('🚀 ~ it ~ linkKoboResponse:', linkKoboResponseDryRun.body); |
| ); | ||
| } | ||
|
|
||
| // XXX: should be in a separate registration-attribute api.service |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method is in the wrong service. Consider moving to a dedicated registration-attribute API service for better code organization.
| ); | ||
|
|
||
| if (!fspSettings) { | ||
| throw new Error('FSP settings not found'); // Should never happen |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error message 'FSP settings not found' is too generic. Include the FSP name that was being searched for to aid debugging.
| throw new Error('FSP settings not found'); // Should never happen | |
| throw new Error(`FSP settings not found for FSP name: ${this.currentlyEditedFsp()}`); // Should never happen |
| > | ||
| @if (property.name === 'columnsToExport') { | ||
| <p-multiselect | ||
| [options]="projectAttributes.data()" |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using projectAttributes.data() without checking if the query is successful could cause runtime errors if the data is undefined or the query failed.
| /> | ||
| } @else if (property.name === 'columnToMatch') { | ||
| <p-select | ||
| [options]="projectAttributes.data()" |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using projectAttributes.data() without checking if the query is successful could cause runtime errors if the data is undefined or the query failed.
AB#XXXX
Describe your changes
Checklist before requesting a code review
Portal preview-deployment
This PR does not have any preview deployments yet.