Skip to content

Commit

Permalink
Merge branch 'main' into MIJN-9820-robots-txt
Browse files Browse the repository at this point in the history
  • Loading branch information
timvanoostrom authored Nov 28, 2024
2 parents a805284 + 60c21a1 commit bcad31c
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 10 deletions.
22 changes: 22 additions & 0 deletions mocks/fixtures/gpass-transacties.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,28 @@
"aanbieder": { "id": 222222, "naam": "Fietsenwinkel - B.V. 5" }
}
},
{
"id": 66,
"transactiedatum": "2020-10-05T04:01:01.0000",
"bedrag": -19,
"pashouder": { "id": 1, "hoofd_pashouder_id": 2 },
"pas": {
"id": 2,
"pasnummer": 6666666666666,
"pasnummer_volledig": "66666666666666",
"originele_pas": {
"id": 1,
"pasnummer": 66666666666666,
"pasnummer_volledig": "66666666666666"
}
},
"budget": {
"id": 44,
"code": "GPAS05_19",
"naam": "Schoolactiviteiten",
"aanbieder": { "id": 222222, "naam": "Fietsenwinkel - B.V. 5" }
}
},
{
"id": 7,
"transactiedatum": "2020-10-05T04:01:01.0000",
Expand Down
12 changes: 4 additions & 8 deletions mocks/routes/gpass.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const UID = require('uid-safe');

const settings = require('../settings');
const RESPONSES = {
PASHOUDER: require('../fixtures/gpass-pashouders.json'),
Expand Down Expand Up @@ -29,15 +30,10 @@ module.exports = [
variants: [
{
id: 'standard',
type: 'middleware',
type: 'json',
options: {
middleware(req, res, next) {
return res.send(
Object.assign(RESPONSES.STADSPAS, {
id: `stadspas-${UID.sync(18)}`,
})
);
},
status: 200,
body: RESPONSES.STADSPAS,
},
},
],
Expand Down
38 changes: 38 additions & 0 deletions src/server/services/hli/stadspas-gpass-service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,34 @@ describe('stadspas-gpass-service', () => {
},
},
},
{
id: 1,
budget: {
aanbieder: {
naam: 'Provider',
id: 0,
},
naam: 'Budget Name',
code: '123',
id: 0,
},
bedrag: 100,
transactiedatum: '2023-01-01',
pashouder: {
id: 0,
hoofd_pashouder_id: 0,
},
pas: {
id: 0,
pasnummer: 0,
pasnummer_volledig: '',
originele_pas: {
id: 0,
pasnummer: 0,
pasnummer_volledig: '',
},
},
},
],
number_of_items: 0,
total_items: 0,
Expand All @@ -240,6 +268,16 @@ describe('stadspas-gpass-service', () => {
id: '1',
title: 'Provider',
amount: -100,
amountFormatted: '+ €100,00',
datePublished: '2023-01-01',
datePublishedFormatted: '01 januari 2023',
budget: 'Budget Name',
budgetCode: '123',
},
{
id: '1',
title: 'Provider',
amount: 100,
amountFormatted: '- €100,00',
datePublished: '2023-01-01',
datePublishedFormatted: '01 januari 2023',
Expand Down
9 changes: 7 additions & 2 deletions src/server/services/hli/stadspas-gpass-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function transformStadspasResponse(
balanceFormatted: `€${displayAmount(balance)}`,
passNumber: gpassStadspasResonseData.pasnummer,
passNumberComplete: gpassStadspasResonseData.pasnummer_volledig,
securityCode
securityCode,
};

return stadspasTransformed;
Expand Down Expand Up @@ -217,11 +217,16 @@ function transformGpassTransactionsResponse(
if (Array.isArray(responseSource.transacties)) {
return responseSource.transacties.map(
(transactie: StadspasTransactieSource) => {
const isCredited = transactie.bedrag < 0;
const amountFormatted = isCredited
? `+ €${displayAmount(Math.abs(transactie.bedrag))}`
: `- €${displayAmount(transactie.bedrag)}`;

const transaction: StadspasBudgetTransaction = {
id: String(transactie.id),
title: transactie.budget.aanbieder.naam,
amount: transactie.bedrag,
amountFormatted: `- €${displayAmount(Math.abs(transactie.bedrag))}`,
amountFormatted,
datePublished: transactie.transactiedatum,
datePublishedFormatted: defaultDateFormat(transactie.transactiedatum),
budget: transactie.budget.naam,
Expand Down

0 comments on commit bcad31c

Please sign in to comment.