Skip to content

Commit

Permalink
Merge pull request #19 from BRP-API/chore/sync-met-source-repo_603fb8f
Browse files Browse the repository at this point in the history
sync met 'BRP-API/brp-shared-dotnet' repo
  • Loading branch information
MelvLee authored Aug 29, 2024
2 parents 1d06ff0 + b9f4381 commit ac1539f
Show file tree
Hide file tree
Showing 4 changed files with 515 additions and 371 deletions.
2 changes: 2 additions & 0 deletions features/step_definitions/brp.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ const columnNameMap = new Map([
['land huwelijkssluiting/aangaan geregistreerd partnerschap (06.30)', 'relatie_start_land_code'],

['datum ontbinding huwelijk/geregistreerd partnerschap (07.10)', 'relatie_eind_datum'],
['plaats ontbinding huwelijk/geregistreerd partnerschap (07.20)', 'relatie_eind_plaats'],
['land ontbinding huwelijk/geregistreerd partnerschap (07.30)', 'relatie_eind_land_code'],
['reden ontbinding huwelijk/geregistreerd partnerschap (07.40)', 'relatie_eind_reden'],

['datum overlijden (08.10)', 'overlijden_datum'],
Expand Down
13 changes: 7 additions & 6 deletions features/step_definitions/requestHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ function isRaadpleegMetReisdocumentnummerAanroep(type, param) {
param.naam === 'reisdocumentnummer';
}

function isArrayParameter(type, param) {
function isArrayParameter(type, param, baseUrl = undefined) {
return isRaadpleegMetBurgerservicenummerAanroep(type, param) ||
isRaadpleegMetReisdocumentnummerAanroep(type, param) ||
param.naam === 'fields';
param.naam === 'fields' ||
(baseUrl !== undefined && baseUrl.toLowerCase().includes('gezag'));
}

function createRequestBody(dataTable) {
function createRequestBody(dataTable, baseUrl = undefined) {
if(dataTable === undefined) {
return undefined;
}
Expand All @@ -60,7 +61,7 @@ function createRequestBody(dataTable) {
if (param.naam === '' && param.waarde === '') {
// do nothing
}
else if (isArrayParameter(type, param)) {
else if (isArrayParameter(type, param, baseUrl)) {
requestBody[param.naam] = param.waarde === ''
? []
: param.waarde.split(',');
Expand Down Expand Up @@ -171,9 +172,9 @@ async function sendRequest(config) {
async function sendBevragenRequest(baseUrl, url, extraHeaders, dataTable, httpMethod) {
const config = {
method: httpMethod,
url: `/${url}`,
url: url ? `/${url}` : '',
baseURL: baseUrl,
data: createRequestBody(dataTable),
data: createRequestBody(dataTable, baseUrl),
headers: createHeaders(dataTable, extraHeaders)
};

Expand Down
Loading

0 comments on commit ac1539f

Please sign in to comment.