1.0.21 • Published 2 years ago

@govesb/connector v1.0.21

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

GovESB Connector - Node.js

Config connection

const config: GovESBConfig = {
    accessTokenUri: '',
    clientId: '',
    clientSecret: '',
    signatureKey: ''
}

Then connect

const esb = new GovESB(config);

You can now request NIDA question using NidaEsbBody

const esbBody: NidaEsbBody = {
   Payload: {
        NIN: "<nin>"
   }
}

Send a request

const respo = esb.esbRequest('<requestUrl>', {
    apiCode: '<apiCode>',
    esbBody,
    userId: '<userId>',
});

Work with data now

respo.then(data => {
    const res: NidaResponseQuestionBody = data.esbBody;
    console.log(res.NidaResponse); 
    console.log()
});

Now after getting question data above, You can now request NIDA info using NidaEsbBody

const esbBody: NidaEsbBody = {
   Payload: {
        NIN: "<nin>",
        RQCode: "<RQCode>",
        QNANSW: "<QNANSW>"
   }
}

Then you can get nida info data as shown below

respo.then(data => {
    const res: NidaResponseQuestion = data.esbBody;
    console.log(res.NidaResponse); 
    console.log()
});

Request Payload

interface NidaEsbBody {
    Payload: NidaPayload | NidaRequestQuestionPayload
}

interface NidaRequestQuestionPayload {
    NIN: string
}

interface NidaPayload {
    NIN: string,
    RQCode: number,
    QNANSW: string
}

Response Payload

interface NidaResponse {
    NATIONALITY: string
    SURNAME: string
    BIRTHCOUNTRY: string
    BIRTHREGION: string
    RESIDENTREGION: string
    BIRTHDISTRICT: string
    SEX: string
    FIRSTNAME: string
    RESIDENTVILLAGE: string
    RESIDENTPOSTCODE: string
    PLACEOFBIRTH: string
    SIGNATURE: string
    RESIDENTHOUSENO: string
    NIN: string
    RESIDENTWARD: string
    MIDDLENAME: string
    DATEOFBIRTH: string
    RESIDENTDISTRICT: string
    BIRTHWARD: string
    PHOTO: string
    RESIDENTSTREET: string
    RESIDENTPOSTALADDRESS: string
}

interface NidaResponseQuestion {
    NIN: string
    SW: string
    EN: string
    RQCode: number
}
1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago