Skip to content

Conversation

@RubenGeo
Copy link
Contributor

AB#XXXX

Describe your changes

Checklist before requesting a code review

  • I have performed a self-review of my code
  • I have added tests for my changes, or: Adding tests is unnecessary/irrelevant
  • I have asked the design team to review these changes, or: The changes do not touch the UI/UX
  • I have made sure that all automated checks pass before requesting a review
  • I do not need any deviation from our PR guidelines
  • I have updated all documentation where necessary

Portal preview-deployment

This PR does not have any preview deployments yet.

Ruben and others added 30 commits May 13, 2025 15:27
* 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
Copilot AI review requested due to automatic review settings December 16, 2025 15:17
@RubenGeo RubenGeo marked this pull request as draft December 16, 2025 15:17
@RubenGeo RubenGeo changed the title Kobo prototype backend code Kobo prototype backend code (used as example, to write kobo backend code) Dec 16, 2025
Copy link
Contributor

Copilot AI left a 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
Copy link

Copilot AI Dec 16, 2025

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'.

Suggested change
// Delete existing hooks from kobo for convience in this prototype
// Delete existing hooks from kobo for convenience in this prototype

Copilot uses AI. Check for mistakes.
});

const hooks = hooksReponse.body.results;
console.log('🚀 ~ it.only ~ hooks:', hooks);
Copy link

Copilot AI Dec 16, 2025

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.

Suggested change
console.log('🚀 ~ it.only ~ hooks:', hooks);

Copilot uses AI. Check for mistakes.
accessToken,
});

console.log('🚀 ~ it ~ postFspConfigResponse:', postFspConfigResponse.body);
Copy link

Copilot AI Dec 16, 2025

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.

Suggested change
console.log('🚀 ~ it ~ postFspConfigResponse:', postFspConfigResponse.body);

Copilot uses AI. Check for mistakes.
koboAssetId: process.env.KOBO_ASSET_ID,
koboUrl: process.env.KOBO_URL,
};
console.log('🚀 ~ it ~ koboLinkDto:', koboLinkDto);
Copy link

Copilot AI Dec 16, 2025

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.

Suggested change
console.log('🚀 ~ it ~ koboLinkDto:', koboLinkDto);

Copilot uses AI. Check for mistakes.
accessToken,
dryRun: true,
});
console.log('🚀 ~ it ~ linkKoboResponse:', linkKoboResponseDryRun.body);
Copy link

Copilot AI Dec 16, 2025

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.

Suggested change
console.log('🚀 ~ it ~ linkKoboResponse:', linkKoboResponseDryRun.body);

Copilot uses AI. Check for mistakes.
);
}

// XXX: should be in a separate registration-attribute api.service
Copy link

Copilot AI Dec 16, 2025

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.

Copilot uses AI. Check for mistakes.
);

if (!fspSettings) {
throw new Error('FSP settings not found'); // Should never happen
Copy link

Copilot AI Dec 16, 2025

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
>
@if (property.name === 'columnsToExport') {
<p-multiselect
[options]="projectAttributes.data()"
Copy link

Copilot AI Dec 16, 2025

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.

Copilot uses AI. Check for mistakes.
/>
} @else if (property.name === 'columnToMatch') {
<p-select
[options]="projectAttributes.data()"
Copy link

Copilot AI Dec 16, 2025

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants