Skip to content
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

cast netki code to lower #93

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions apps/cdd-backend/src/cdd-worker/cdd.processor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,16 @@ describe('cddProcessor', () => {
expect(mockRedis.clearApplications).toHaveBeenCalledWith(address);
});

it('should convert client_guid to lower case', async () => {
const uppercaseIdJob = { ...mockNetkiCompletedJob };
uppercaseIdJob.data.value.identity.transaction_identity.client_guid =
'ABC';

await processor.generateCdd(mockNetkiCompletedJob);

expect(mockRedis.getNetkiAddress).toHaveBeenCalledWith('abc');
});

it('should throw if the address for the netki job is not found', async () => {
mockRedis.getNetkiAddress.mockRejectedValue(new Error('some error'));

Expand Down
3 changes: 2 additions & 1 deletion apps/cdd-backend/src/cdd-worker/cdd.processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ export class CddProcessor {
private async handleNetki({ value: netki }: NetkiCddJob): Promise<void> {
const {
identity: {
transaction_identity: { client_guid: id },
transaction_identity: { client_guid: guid },
state,
},
} = netki;
const id = guid.toLowerCase(); // netki codes are supposed to be lower case + digits. Sometimes clients cause them to be capitalized though
const jobId: JobIdentifier = { id, provider: 'netki' };

this.logger.info('starting netki job', { jobId, state });
Expand Down
Loading