Compare commits
23
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c7b54c386 | ||
|
|
ca784314ec | ||
|
|
3f090c76b6 | ||
|
|
25788e0976 | ||
|
|
90bb7c11b5 | ||
|
|
0c23571085 | ||
|
|
f1a0850871 | ||
|
|
cc8881b9d5 | ||
|
|
d484acbc69 | ||
|
|
e5a0b52d1b | ||
|
|
89833680db | ||
|
|
ff225ea00c | ||
|
|
bd870d0fa8 | ||
|
|
531eaa2ff6 | ||
|
|
7173bd3727 | ||
|
|
a09ad1ad08 | ||
|
|
f198c1633b | ||
|
|
5f7893b057 | ||
|
|
383d43122b | ||
|
|
f8010560cc | ||
|
|
69908f58b0 | ||
|
|
9fb20a491f | ||
|
|
2fca37628e |
No files matched your search
@@ -243,7 +243,7 @@ paths:
|
||||
suffix: PhD
|
||||
dateOfBirth: "2002-10-29"
|
||||
emailAddresses: TEST@HTM.NL
|
||||
isEmailVerified: True
|
||||
isEmailVerified: false
|
||||
addresses:
|
||||
- addressId: 1
|
||||
street: mystreet
|
||||
@@ -332,14 +332,6 @@ paths:
|
||||
user: user
|
||||
timestamp: "2023-10-20T17:05:52.000+02:00"
|
||||
correlationId: 01c6d8b4-1cd3-4f9b-85ea-c9adca53ce95
|
||||
_links:
|
||||
{
|
||||
"self":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/abtcustomers/2.0/customers?customerProfileId=1",
|
||||
"method": "GET",
|
||||
},
|
||||
}
|
||||
- customerProfileId: 12
|
||||
customerNumber: 1000002
|
||||
debtorNumber: DB100121
|
||||
@@ -377,7 +369,7 @@ paths:
|
||||
suffix: PhD
|
||||
dateOfBirth: "2002-10-29"
|
||||
emailAddresses: TEST@HTM.NL
|
||||
isEmailVerified: False
|
||||
isEmailVerified: false
|
||||
address:
|
||||
- addressId: 1
|
||||
street: mystreet
|
||||
@@ -467,32 +459,7 @@ paths:
|
||||
user: user
|
||||
timestamp: "2023-10-20T17:05:52.000+02:00"
|
||||
correlationId: 01c6d8b4-1cd3-4f9b-85ea-c9adca53ce95
|
||||
_links:
|
||||
{
|
||||
"self":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/abtcustomers/2.0/customers?customerProfileId=12",
|
||||
"method": "GET",
|
||||
},
|
||||
}
|
||||
_links:
|
||||
{
|
||||
"self":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/abtcustomers/2.0/customers?offset=20",
|
||||
"method": "GET",
|
||||
},
|
||||
"prev":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/abtcustomers/2.0/customers",
|
||||
"method": "GET",
|
||||
},
|
||||
"next":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/abtcustomers/2.0/customers?offset=40",
|
||||
"method": "GET",
|
||||
},
|
||||
}
|
||||
href: "https://api.integratielaag.nl/abt/abtcustomers/2.0/customers?offset=20&limit=20"
|
||||
getCustomerActive:
|
||||
summary: getCustomerActive
|
||||
description: >-
|
||||
@@ -526,7 +493,7 @@ paths:
|
||||
suffix: PhD
|
||||
dateOfBirth: "2002-10-29"
|
||||
emailAddresses: TEST@HTM.NL
|
||||
isEmailVerified: False
|
||||
isEmailVerified: false
|
||||
addresses:
|
||||
- addressId: 1
|
||||
street: mystreet
|
||||
@@ -615,22 +582,7 @@ paths:
|
||||
user: user
|
||||
timestamp: "2023-10-20T17:05:52.000+02:00"
|
||||
correlationId: 01c6d8b4-1cd3-4f9b-85ea-c9adca53ce95
|
||||
_links:
|
||||
{
|
||||
"self":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/abtcustomers/2.0/customers?customerProfileId=1",
|
||||
"method": "GET",
|
||||
},
|
||||
}
|
||||
_links:
|
||||
{
|
||||
"self":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/abtcustomers/2.0/customers",
|
||||
"method": "GET",
|
||||
},
|
||||
}
|
||||
href: https://api.integratielaag.nl/abt/abtcustomers/2.0/customers?offset=20&limit=20
|
||||
getCustomerBlocked:
|
||||
summary: getCustomerBlocked
|
||||
description: >-
|
||||
@@ -669,7 +621,7 @@ paths:
|
||||
suffix: PhD
|
||||
dateOfBirth: "2002-10-29"
|
||||
emailAddresses: TEST@HTM.NL
|
||||
isEmailVerified: True
|
||||
isEmailVerified: false
|
||||
addresses:
|
||||
- addressId: 1
|
||||
street: mystreet
|
||||
@@ -758,22 +710,7 @@ paths:
|
||||
user: user
|
||||
timestamp: "2023-10-20T17:05:52.000+02:00"
|
||||
correlationId: 01c6d8b4-1cd3-4f9b-85ea-c9adca53ce95
|
||||
_links:
|
||||
{
|
||||
"self":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/abtcustomers/2.0/customers?customerProfileId=1",
|
||||
"method": "GET",
|
||||
},
|
||||
}
|
||||
_links:
|
||||
{
|
||||
"self":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/abtcustomers/2.0/customers",
|
||||
"method": "GET",
|
||||
},
|
||||
}
|
||||
href: https://api.integratielaag.nl/abt/abtcustomers/2.0/customers?offset=20&limit=20
|
||||
400:
|
||||
description: Bad Request
|
||||
content:
|
||||
@@ -835,7 +772,7 @@ paths:
|
||||
suffix: jr
|
||||
dateOfBirth: "1970-01-01"
|
||||
emailAddress: j.jansen@hatseflats.nl
|
||||
isEmailVerified: False
|
||||
isEmailVerified: false
|
||||
addresses:
|
||||
- street: Laan van Meerdervoort
|
||||
houseNumber: 5
|
||||
@@ -934,7 +871,7 @@ paths:
|
||||
suffix: "jr",
|
||||
dateOfBirth: "1970-01-01",
|
||||
emailAddress: "TEST@TEST1.NL",
|
||||
isEmailVerified: False
|
||||
isEmailVerified: false
|
||||
}
|
||||
updateCompleteEntity:
|
||||
value:
|
||||
@@ -946,7 +883,7 @@ paths:
|
||||
suffix: "jr",
|
||||
dateOfBirth: "1970-01-01",
|
||||
emailAddress: "TEST@TEST1.NL",
|
||||
isEmailVerified: True
|
||||
isEmailVerified: false
|
||||
}
|
||||
required: true
|
||||
responses:
|
||||
@@ -1438,13 +1375,7 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/getDevices"
|
||||
examples:
|
||||
updateDeviceResponse:
|
||||
value:
|
||||
deviceId: "5bedce29-af0c-4f3c-b182-2caa8a1f9377"
|
||||
externalDeviceId: "7122a988-a00a-417d-a5b4-da2d91354976"
|
||||
alias: "iPhone zakelijk"
|
||||
$ref: "#/components/schemas/patchDeviceResponse"
|
||||
|
||||
security:
|
||||
- default: []
|
||||
@@ -1607,24 +1538,7 @@ paths:
|
||||
"replacedByTokenId": 12,
|
||||
},
|
||||
],
|
||||
"_links":
|
||||
{
|
||||
"self":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/abtcustomers/2.0/ovPayTokens?offset=20",
|
||||
"method": "GET",
|
||||
},
|
||||
"prev":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/abtcustomers/2.0/ovPayTokens",
|
||||
"method": "GET",
|
||||
},
|
||||
"next":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/abtcustomers/2.0/ovPayTokens?offset=40",
|
||||
"method": "GET",
|
||||
},
|
||||
},
|
||||
"href": "https://api.integratielaag.nl/abt/abtcustomers/2.0/ovPayTokens?offset=20&limit=20"
|
||||
}
|
||||
/customers/{customerProfileId}/ovpaytokens:
|
||||
post:
|
||||
@@ -1943,9 +1857,10 @@ paths:
|
||||
"created": "2024-10-20T17:05:52.000",
|
||||
},
|
||||
],
|
||||
"href": "https://api.integratielaag.nl/abt/abtcustomers/2.0/billingInformations?offset=20&limit=20"
|
||||
}
|
||||
getBillingInformationSingleSpecificCustomer:
|
||||
summary: Get singel billing information entity for a specific customers
|
||||
summary: Get single billing information entity for a specific customers
|
||||
description: >-
|
||||
Found one billing information matching the search parameters
|
||||
value:
|
||||
@@ -2135,59 +2050,7 @@ paths:
|
||||
"updateTimestamp": "2024-03-22T08:55:00",
|
||||
},
|
||||
],
|
||||
"_links":
|
||||
{
|
||||
"self":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/abtcustomers/2.0/directdebitmandates",
|
||||
"method": "GET",
|
||||
},
|
||||
"next":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/abtcustomers/2.0/directdebitmandates?offset=20",
|
||||
"method": "GET",
|
||||
},
|
||||
},
|
||||
}
|
||||
getDirectDebitMandateWithNextPageandPreviousPage:
|
||||
value:
|
||||
{
|
||||
"directDebitMandates":
|
||||
[
|
||||
{
|
||||
"directDebitMandateId": 71,
|
||||
"customerProfileId": 12,
|
||||
"billingInformationId": 51,
|
||||
"directDebitMandateType":
|
||||
{
|
||||
"directDebitMandateTypeId": 1,
|
||||
"name": "import",
|
||||
"description": "import",
|
||||
},
|
||||
"created": "2024-03-22T08:55:00",
|
||||
"mandateReference": "CORE01",
|
||||
"mandateState": "SIGNED",
|
||||
"updateTimestamp": "2024-03-22T08:55:00",
|
||||
},
|
||||
],
|
||||
"_links":
|
||||
{
|
||||
"self":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/abtcustomers/2.0/directdebitmandates?offset=20",
|
||||
"method": "GET",
|
||||
},
|
||||
"prev":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/abtcustomers/2.0/directdebitmandates",
|
||||
"method": "GET",
|
||||
},
|
||||
"next":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/abtcustomers/2.0/directdebitmandates?offset=40",
|
||||
"method": "GET",
|
||||
},
|
||||
},
|
||||
"href": "https://api.integratielaag.nl/abt/abtcustomers/2.0/directdebitmandates?offset=20&limit=20"
|
||||
}
|
||||
/billingInformation/{billingInformationId}/directdebitmandates:
|
||||
post:
|
||||
@@ -2843,7 +2706,7 @@ components:
|
||||
emailAddress:
|
||||
type: string
|
||||
isEmailVerified:
|
||||
type: string
|
||||
type: boolean
|
||||
postOvPayTokenResponse:
|
||||
type: object
|
||||
properties:
|
||||
@@ -2857,6 +2720,14 @@ components:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/getDeviceEntity"
|
||||
patchDeviceResponse:
|
||||
type: object
|
||||
properties:
|
||||
deviceId:
|
||||
type: string
|
||||
format: uuid
|
||||
example: "b2c8a8c6-3d1c-4b6b-8f8d-3a6a1b6a1b6a"
|
||||
|
||||
getDeviceEntity:
|
||||
type: object
|
||||
properties:
|
||||
|
||||
@@ -46,6 +46,7 @@ paths:
|
||||
- occurredOn
|
||||
- type
|
||||
- articleNumber
|
||||
- paymentMethod
|
||||
- status
|
||||
- aggregationReference
|
||||
- accountingSystemReference
|
||||
@@ -76,6 +77,7 @@ paths:
|
||||
- occurredOn
|
||||
- type
|
||||
- articleNumber
|
||||
- paymentMethod
|
||||
- status
|
||||
- aggregationReference
|
||||
- accountingSystemReference
|
||||
@@ -115,6 +117,7 @@ paths:
|
||||
occurredOn: 2024-10-04T00:00:00Z
|
||||
type: debit
|
||||
articleNumber: "4031"
|
||||
paymentMethod: iDEAL
|
||||
status: created
|
||||
aggregationReference: null
|
||||
accountingSystemReference: null
|
||||
@@ -134,6 +137,7 @@ paths:
|
||||
occurredOn: 2024-10-04T00:00:00Z
|
||||
type: debit
|
||||
articleNumber: "4051"
|
||||
paymentMethod: iDEAL
|
||||
status: failed
|
||||
aggregationReference: null
|
||||
accountingSystemReference: null
|
||||
@@ -153,6 +157,7 @@ paths:
|
||||
occurredOn: 2024-10-04T00:00:00Z
|
||||
type: debit
|
||||
articleNumber: "4051"
|
||||
paymentMethod: iDEAL
|
||||
status: returned to src
|
||||
aggregationReference: FIKO-171f40609e
|
||||
accountingSystemReference: null
|
||||
@@ -172,6 +177,7 @@ paths:
|
||||
occurredOn: 2024-10-04T00:00:00Z
|
||||
type: debit
|
||||
articleNumber: "4051"
|
||||
paymentMethod: iDEAL
|
||||
status: returned to trx-db
|
||||
aggregationReference: null
|
||||
accountingSystemReference: null
|
||||
@@ -191,6 +197,7 @@ paths:
|
||||
occurredOn: 2024-10-04T00:00:00Z
|
||||
type: debit
|
||||
articleNumber: "4051"
|
||||
paymentMethod: iDEAL
|
||||
status: re-entered
|
||||
aggregationReference: null
|
||||
accountingSystemReference: null
|
||||
@@ -210,6 +217,7 @@ paths:
|
||||
occurredOn: 2024-10-04T00:00:00Z
|
||||
type: debit
|
||||
articleNumber: "1737"
|
||||
paymentMethod: iDEAL
|
||||
status: succeeded
|
||||
aggregationReference: FIKO-6a4fca8cd6
|
||||
accountingSystemReference: U4F-123456
|
||||
@@ -248,6 +256,7 @@ paths:
|
||||
occurredOn: 2024-10-04T00:00:00Z
|
||||
type: debit
|
||||
articleNumber: "4031"
|
||||
paymentMethod: iDEAL
|
||||
Add multiple transaction items:
|
||||
summary: Add multiple transaction items
|
||||
description: Add multiple transaction items of type sales.
|
||||
@@ -266,6 +275,7 @@ paths:
|
||||
occurredOn: 2024-10-04T00:00:00Z
|
||||
type: debit
|
||||
articleNumber: "4031"
|
||||
paymentMethod: iDEAL
|
||||
- transactionType: sales
|
||||
sourceName: HTM-website
|
||||
transactionId: "1001237"
|
||||
@@ -279,6 +289,7 @@ paths:
|
||||
occurredOn: 2024-10-04T00:00:00Z
|
||||
type: debit
|
||||
articleNumber: "4031"
|
||||
paymentMethod: iDEAL
|
||||
responses:
|
||||
"202":
|
||||
description: Accepted
|
||||
@@ -1447,6 +1458,7 @@ paths:
|
||||
identifyingFieldValue: null
|
||||
concessionId: null
|
||||
isContraAccount: false
|
||||
paymentMethod: null
|
||||
lineType: tax
|
||||
lineSense: credit
|
||||
department: 140
|
||||
@@ -1469,6 +1481,7 @@ paths:
|
||||
identifyingFieldValue: null
|
||||
concessionId: 1
|
||||
isContraAccount: false
|
||||
paymentMethod: null
|
||||
lineType: analysis
|
||||
lineSense: credit
|
||||
department: 900
|
||||
@@ -1491,6 +1504,7 @@ paths:
|
||||
identifyingFieldValue: null
|
||||
concessionId: null
|
||||
isContraAccount: true
|
||||
paymentMethod: iDEAL
|
||||
lineType: analysis
|
||||
lineSense: debet
|
||||
department: 140
|
||||
@@ -1726,6 +1740,7 @@ paths:
|
||||
- identifyingFieldValue
|
||||
- concessionId
|
||||
- isContraAccount
|
||||
- paymentMethod
|
||||
- lineType
|
||||
- lineSense
|
||||
- department
|
||||
@@ -1759,6 +1774,7 @@ paths:
|
||||
- identifyingFieldValue
|
||||
- concessionId
|
||||
- isContraAccount
|
||||
- paymentMethod
|
||||
- lineType
|
||||
- lineSense
|
||||
- department
|
||||
@@ -1810,6 +1826,7 @@ paths:
|
||||
identifyingFieldValue: null
|
||||
concessionId: 2
|
||||
isContraAccount: false
|
||||
paymentMethod: null
|
||||
lineType: summary
|
||||
lineSense: credit
|
||||
department: 900
|
||||
@@ -1832,6 +1849,7 @@ paths:
|
||||
identifyingFieldValue: null
|
||||
concessionId: 1
|
||||
isContraAccount: false
|
||||
paymentMethod: null
|
||||
lineType: summary
|
||||
lineSense: credit
|
||||
department: 900
|
||||
@@ -1863,6 +1881,7 @@ paths:
|
||||
identifyingFieldValue: null
|
||||
concessionId: 2
|
||||
isContraAccount: false
|
||||
paymentMethod: null
|
||||
lineType: summary
|
||||
lineSense: credit
|
||||
department: 900
|
||||
@@ -1884,6 +1903,8 @@ paths:
|
||||
sourceMetadataId: 2c55f374-8ef8-4615-bc0a-5c92184ff4b2
|
||||
identifyingFieldValue: null
|
||||
concessionId: 1
|
||||
isContraAccount: false
|
||||
paymentMethod: null
|
||||
lineType: summary
|
||||
lineSense: credit
|
||||
department: 900
|
||||
@@ -1906,6 +1927,7 @@ paths:
|
||||
identifyingFieldValue: null
|
||||
concessionId: 2
|
||||
isContraAccount: false
|
||||
paymentMethod: null
|
||||
lineType: summary
|
||||
lineSense: credit
|
||||
department: 900
|
||||
@@ -1928,6 +1950,7 @@ paths:
|
||||
identifyingFieldValue: null
|
||||
concessionId: 1
|
||||
isContraAccount: false
|
||||
paymentMethod: null
|
||||
lineType: summary
|
||||
lineSense: credit
|
||||
department: 900
|
||||
@@ -1950,6 +1973,7 @@ paths:
|
||||
identifyingFieldValue: null
|
||||
concessionId: null
|
||||
isContraAccount: false
|
||||
paymentMethod: null
|
||||
lineType: tax
|
||||
lineSense: credit
|
||||
department: 140
|
||||
@@ -1972,6 +1996,7 @@ paths:
|
||||
identifyingFieldValue: null
|
||||
concessionId: null
|
||||
isContraAccount: true
|
||||
paymentMethod: iDEAL
|
||||
lineType: analysis
|
||||
lineSense: credit
|
||||
department: 220
|
||||
@@ -2021,6 +2046,7 @@ paths:
|
||||
identifyingFieldValue: null
|
||||
concessionId: 1
|
||||
isContraAccount: false
|
||||
paymentMethod: null
|
||||
lineType: summary
|
||||
lineSense: credit
|
||||
department: 900
|
||||
@@ -3284,6 +3310,10 @@ components:
|
||||
type: string
|
||||
nullable: true
|
||||
example: "4031"
|
||||
paymentMethod:
|
||||
type: string
|
||||
nullable: true
|
||||
example: iDEAL
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
@@ -3375,6 +3405,10 @@ components:
|
||||
type: string
|
||||
nullable: true
|
||||
example: "4031"
|
||||
paymentMethod:
|
||||
type: string
|
||||
nullable: true
|
||||
example: iDEAL
|
||||
required:
|
||||
- sourceName
|
||||
- transactionType
|
||||
@@ -3458,46 +3492,6 @@ components:
|
||||
TransactionItemsPatchRequestBody:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
nullable: true
|
||||
example: HTM Maandkorting 20%
|
||||
quantity:
|
||||
type: integer
|
||||
nullable: true
|
||||
example: 1
|
||||
taxCode:
|
||||
type: string
|
||||
nullable: true
|
||||
example: V21
|
||||
amountExclTax:
|
||||
type: integer
|
||||
nullable: true
|
||||
example: 100
|
||||
amountInclTax:
|
||||
type: integer
|
||||
nullable: true
|
||||
example: 121
|
||||
amountTax:
|
||||
type: integer
|
||||
nullable: true
|
||||
example: 21
|
||||
occurredOn:
|
||||
type: string
|
||||
nullable: true
|
||||
format: date-time
|
||||
example: 2024-10-04T00:00:00Z
|
||||
type:
|
||||
type: string
|
||||
nullable: true
|
||||
enum:
|
||||
- debit
|
||||
- credit
|
||||
example: debit
|
||||
articleNumber:
|
||||
type: string
|
||||
nullable: true
|
||||
example: 4031
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
@@ -4098,6 +4092,10 @@ components:
|
||||
isContraAccount:
|
||||
type: boolean
|
||||
example: false
|
||||
paymentMethod:
|
||||
type: string
|
||||
example: iDEAL
|
||||
nullable: true
|
||||
lineType:
|
||||
type: string
|
||||
enum:
|
||||
@@ -4215,6 +4213,10 @@ components:
|
||||
isContraAccount:
|
||||
type: boolean
|
||||
example: false
|
||||
paymentMethod:
|
||||
type: string
|
||||
example: iDEAL
|
||||
nullable: true
|
||||
lineType:
|
||||
type: string
|
||||
enum:
|
||||
@@ -4304,6 +4306,10 @@ components:
|
||||
type: boolean
|
||||
example: false
|
||||
nullable: true
|
||||
paymentMethod:
|
||||
type: string
|
||||
example: iDEAL
|
||||
nullable: true
|
||||
lineType:
|
||||
type: string
|
||||
enum:
|
||||
|
||||
@@ -313,6 +313,7 @@ paths:
|
||||
{
|
||||
"productId": 24,
|
||||
"parentProductId": null,
|
||||
"needsVoucher": false,
|
||||
"layerInfo": null,
|
||||
"fikoArticleNumber": "1234",
|
||||
"gboPackageTemplateId": "30901",
|
||||
@@ -429,6 +430,7 @@ paths:
|
||||
{
|
||||
"productId": 126,
|
||||
"parentProductId": null,
|
||||
"needsVoucher": false,
|
||||
"layerInfo": {
|
||||
"layerInfoId": 1,
|
||||
"choiceKey": "isRenewable",
|
||||
@@ -537,6 +539,7 @@ paths:
|
||||
{
|
||||
"productId": 119,
|
||||
"parentProductId": 126,
|
||||
"needsVoucher": false,
|
||||
"layerInfo": null,
|
||||
"fikoArticleNumber": "1234",
|
||||
"gboPackageTemplateId": "30001",
|
||||
@@ -652,6 +655,7 @@ paths:
|
||||
{
|
||||
"productId": 120,
|
||||
"parentProductId": 126,
|
||||
"needsVoucher": false,
|
||||
"layerInfo": null,
|
||||
"fikoArticleNumber": "1234",
|
||||
"gboPackageTemplateId": "30001",
|
||||
@@ -779,6 +783,7 @@ paths:
|
||||
{
|
||||
"productId": 49,
|
||||
"parentProductId": null,
|
||||
"needsVoucher": false,
|
||||
"layerInfo": {
|
||||
"layerInfoId": 2,
|
||||
"choiceKey": "regio",
|
||||
@@ -926,6 +931,7 @@ paths:
|
||||
{
|
||||
"productId": 109,
|
||||
"parentProductId": 49,
|
||||
"needsVoucher": false,
|
||||
"layerInfo": {
|
||||
"layerInfoId": 3,
|
||||
"choiceKey": "allowedGboAgeProfiles",
|
||||
@@ -1076,6 +1082,7 @@ paths:
|
||||
{
|
||||
"productId": 114,
|
||||
"parentProductId": 109,
|
||||
"needsVoucher": false,
|
||||
"layerInfo": {
|
||||
"layerInfoId": 1,
|
||||
"choiceKey": "isRenewable",
|
||||
@@ -1226,6 +1233,7 @@ paths:
|
||||
{
|
||||
"productId": 115,
|
||||
"parentProductId": 109,
|
||||
"needsVoucher": false,
|
||||
"layerInfo": {
|
||||
"layerInfoId": 1,
|
||||
"choiceKey": "isRenewable",
|
||||
@@ -1377,6 +1385,7 @@ paths:
|
||||
{
|
||||
"productId": 116,
|
||||
"parentProductId": 115,
|
||||
"needsVoucher": false,
|
||||
"layerInfo": null,
|
||||
"fikoArticleNumber": "1234",
|
||||
"gboPackageTemplateId": "33615",
|
||||
@@ -1526,6 +1535,7 @@ paths:
|
||||
{
|
||||
"productId": 117,
|
||||
"parentProductId": 115,
|
||||
"needsVoucher": false,
|
||||
"layerInfo": null,
|
||||
"fikoArticleNumber": "1234",
|
||||
"gboPackageTemplateId": "33615",
|
||||
@@ -1679,6 +1689,7 @@ paths:
|
||||
{
|
||||
"productId": 112,
|
||||
"parentProductId": 49,
|
||||
"needsVoucher": false,
|
||||
"layerInfo": {
|
||||
"layerInfoId": 3,
|
||||
"choiceKey": "allowedGboAgeProfiles",
|
||||
@@ -2150,6 +2161,10 @@ components:
|
||||
parentProductId:
|
||||
type: integer
|
||||
example: 1
|
||||
needsVoucher:
|
||||
type: boolean
|
||||
description: Indicates if the product needs a voucher (with this productId as requiredProductId) to be bought - if false, this is optional, but still allowed
|
||||
example: false
|
||||
layerInfo:
|
||||
$ref: '#/components/schemas/LayerInfoResponse'
|
||||
fikoArticleNumber:
|
||||
|
||||
@@ -313,6 +313,7 @@ paths:
|
||||
{
|
||||
"productId": 24,
|
||||
"parentProductId": null,
|
||||
"needsVoucher": false,
|
||||
"layerInfo": null,
|
||||
"fikoArticleNumber": "1234",
|
||||
"gboPackageTemplateId": "30901",
|
||||
@@ -429,6 +430,7 @@ paths:
|
||||
{
|
||||
"productId": 126,
|
||||
"parentProductId": null,
|
||||
"needsVoucher": false,
|
||||
"layerInfo": {
|
||||
"layerInfoId": 1,
|
||||
"choiceKey": "isRenewable",
|
||||
@@ -537,6 +539,7 @@ paths:
|
||||
{
|
||||
"productId": 119,
|
||||
"parentProductId": 126,
|
||||
"needsVoucher": false,
|
||||
"layerInfo": null,
|
||||
"fikoArticleNumber": "1234",
|
||||
"gboPackageTemplateId": "30001",
|
||||
@@ -652,6 +655,7 @@ paths:
|
||||
{
|
||||
"productId": 120,
|
||||
"parentProductId": 126,
|
||||
"needsVoucher": false,
|
||||
"layerInfo": null,
|
||||
"fikoArticleNumber": "1234",
|
||||
"gboPackageTemplateId": "30001",
|
||||
@@ -779,6 +783,7 @@ paths:
|
||||
{
|
||||
"productId": 49,
|
||||
"parentProductId": null,
|
||||
"needsVoucher": false,
|
||||
"layerInfo": {
|
||||
"layerInfoId": 2,
|
||||
"choiceKey": "regio",
|
||||
@@ -926,6 +931,7 @@ paths:
|
||||
{
|
||||
"productId": 109,
|
||||
"parentProductId": 49,
|
||||
"needsVoucher": false,
|
||||
"layerInfo": {
|
||||
"layerInfoId": 3,
|
||||
"choiceKey": "allowedGboAgeProfiles",
|
||||
@@ -1076,6 +1082,7 @@ paths:
|
||||
{
|
||||
"productId": 114,
|
||||
"parentProductId": 109,
|
||||
"needsVoucher": false,
|
||||
"layerInfo": {
|
||||
"layerInfoId": 1,
|
||||
"choiceKey": "isRenewable",
|
||||
@@ -1226,6 +1233,7 @@ paths:
|
||||
{
|
||||
"productId": 115,
|
||||
"parentProductId": 109,
|
||||
"needsVoucher": false,
|
||||
"layerInfo": {
|
||||
"layerInfoId": 1,
|
||||
"choiceKey": "isRenewable",
|
||||
@@ -1377,6 +1385,7 @@ paths:
|
||||
{
|
||||
"productId": 116,
|
||||
"parentProductId": 115,
|
||||
"needsVoucher": false,
|
||||
"layerInfo": null,
|
||||
"fikoArticleNumber": "1234",
|
||||
"gboPackageTemplateId": "33615",
|
||||
@@ -1526,6 +1535,7 @@ paths:
|
||||
{
|
||||
"productId": 117,
|
||||
"parentProductId": 115,
|
||||
"needsVoucher": false,
|
||||
"layerInfo": null,
|
||||
"fikoArticleNumber": "1234",
|
||||
"gboPackageTemplateId": "33615",
|
||||
@@ -1679,6 +1689,7 @@ paths:
|
||||
{
|
||||
"productId": 112,
|
||||
"parentProductId": 49,
|
||||
"needsVoucher": false,
|
||||
"layerInfo": {
|
||||
"layerInfoId": 3,
|
||||
"choiceKey": "allowedGboAgeProfiles",
|
||||
@@ -2150,6 +2161,10 @@ components:
|
||||
parentProductId:
|
||||
type: integer
|
||||
example: 1
|
||||
needsVoucher:
|
||||
type: boolean
|
||||
description: Indicates if the product needs a voucher (with this productId as requiredProductId) to be bought - if false, this is optional, but still allowed
|
||||
example: false
|
||||
layerInfo:
|
||||
$ref: '#/components/schemas/LayerInfoResponse'
|
||||
fikoArticleNumber:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
openapi: 3.0.1
|
||||
info:
|
||||
title: Service Engine APIs for HTM voucher for sales Touchpint
|
||||
description: Service Engine APIs for HTM vouchers. These are NOT the CRUD APIs to the data hub. These ARE the api's for sales touchpoints.
|
||||
title: Service Engine APIs for HTM voucher for sales Touchpoint
|
||||
description: Service Engine APIs for HTM vouchers. These are NOT the CRUD APIs to the data hub. These ARE the APIs for sales touchpoints.
|
||||
version: "1.0"
|
||||
servers:
|
||||
- url: https://services.acc.api.htm.nl/abt/abtvouchersTouchpoint/1.0
|
||||
@@ -28,98 +28,132 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
$ref: "#/components/schemas/salesTouchpointIssuedVoucherResponse"
|
||||
examples:
|
||||
Voucher for a product with required attributes:
|
||||
summary: Voucher for a single product with required attributes
|
||||
Voucher that grants a voucher-only product for free:
|
||||
summary: Voucher that grants a voucher-only product for free
|
||||
description: |-
|
||||
Voucher that grants a product (that can only be acquired via a voucher) for free.
|
||||
In this case, the voucher has an amountInclTax of 0. If the requiredProduct has a
|
||||
non-zero sellingPrice (amountInclTax), the difference between sellingPrice and
|
||||
voucher amountInclTax represents the granted discount. If the requiredProduct has
|
||||
a sellingPrice of 0, no "discount" is shown; just the voucher's amountInclTax.
|
||||
value:
|
||||
{
|
||||
"issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
||||
"voucherCode": "VOUCHER123",
|
||||
"voucherCode": "HTM-A7J-128-PYT",
|
||||
"fromInclusive": "2024-10-04T00:00:00.000",
|
||||
"untilInclusive": "2024-11-04T00:00:00.000",
|
||||
"voucherStatus": { "voucherStatusId": 1, "name": "New" },
|
||||
"voucherStatus": { "voucherStatusId": 2, "name": "issued" },
|
||||
"product":
|
||||
{
|
||||
"productId": 263,
|
||||
"productName": "HTM-80001",
|
||||
"productDescription": "10 euro korting op Regiovrij maand.",
|
||||
"productCategory":
|
||||
{
|
||||
"productCategoryId": 9,
|
||||
"isTravelProduct": false,
|
||||
"name": "Voucher",
|
||||
},
|
||||
"amountInclTax": -1000,
|
||||
"productName": "Voucher Ooievaarspas-product AOW",
|
||||
"productDescription": "Voucher voor AOW-ers in Den Haag met een Ooievaarspas, die ingewisseld kan worden voor het product \"Ooievaarspas voor AOW-ers in Den Haag\"",
|
||||
"amountInclTax": 0,
|
||||
"requiredProducts":
|
||||
[
|
||||
{
|
||||
"productId": 126,
|
||||
"productName": "HTM-30001",
|
||||
"productDescription": "Regiovrij maand.",
|
||||
"productId": 982,
|
||||
"productName": "Ooievaarspas voor AOW-ers in Den Haag",
|
||||
"productDescription": "Vrij reizen bij HTM voor Haagse AOW-gerechtigden met een Ooievaarspas.",
|
||||
"productCategory":
|
||||
{
|
||||
"productCategoryId": 2,
|
||||
"isTravelProduct": true,
|
||||
"name": "Afgekocht reisrecht",
|
||||
},
|
||||
"amountInclTax": 0,
|
||||
"_links":
|
||||
{
|
||||
"get_details":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/products/126",
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/products/982",
|
||||
"method": "GET",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"_links":
|
||||
{
|
||||
"get_details":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/products/263",
|
||||
"method": "GET",
|
||||
},
|
||||
},
|
||||
]
|
||||
},
|
||||
"mandatoryCustomerDataItems":
|
||||
[
|
||||
{
|
||||
"mandatoryCustomerDataItemId": 8,
|
||||
"customerDataItem": "padBirthDate",
|
||||
},
|
||||
{
|
||||
"mandatoryCustomerDataItemId": 4,
|
||||
"customerDataItem": "emailAddress",
|
||||
},
|
||||
],
|
||||
"customerDataItem": "padBirthDate"
|
||||
}
|
||||
Voucher for a whole order:
|
||||
summary: Voucher for a whole order
|
||||
]
|
||||
}
|
||||
Voucher that grants a hybrid product for a reduced price:
|
||||
summary: Voucher that grants a hybrid product for a reduced price
|
||||
description: |-
|
||||
Voucher that grants a hybrid product (that can be acquired via voucher or via ordinary order flow)
|
||||
for a reduced price. In this case, the voucher has an amountInclTax > 0, which dictates the (modified)
|
||||
total amount that needs to be paid for said product. If the requiredProduct has a
|
||||
non-zero sellingPrice (amountInclTax), the difference between sellingPrice and
|
||||
voucher amountInclTax represents the granted discount. If the requiredProduct has
|
||||
a sellingPrice of 0, no "discount" is shown; just the voucher's amountInclTax./
|
||||
Specifically, in this example, the product "HTM 20% Korting" can be purchased for 1 euro instead of 5 euro.
|
||||
value:
|
||||
{
|
||||
"issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
||||
"voucherCode": "VOUCHER123",
|
||||
"voucherCode": "HTM-A7J-128-PYT",
|
||||
"fromInclusive": "2024-10-04T00:00:00.000",
|
||||
"untilInclusive": "2024-11-04T00:00:00.000",
|
||||
"voucherStatus": { "voucherStatusId": 1, "name": "New" },
|
||||
"voucherStatus": { "voucherStatusId": 2, "name": "issued" },
|
||||
"product":
|
||||
{
|
||||
"productId": 263,
|
||||
"productName": "HTM-80002",
|
||||
"productDescription": "10 euro korting op je gehele winkelmand.",
|
||||
"productId": 264,
|
||||
"productName": "Kortingsvoucher HTM 20% Korting ",
|
||||
"productDescription": "Voucher waarmee het product \"HTM 20% Korting\" voor een lagere prijs kan worden aangeschaft.",
|
||||
"amountInclTax": 100,
|
||||
"requiredProducts":
|
||||
[
|
||||
{
|
||||
"productId": 984,
|
||||
"productName": "HTM 20% Korting",
|
||||
"productDescription": "Reis met 20% korting op je betaalpas bij HTM.",
|
||||
"productCategory":
|
||||
{
|
||||
"productCategoryId": 9,
|
||||
"isTravelProduct": false,
|
||||
"name": "Voucher",
|
||||
"productCategoryId": 1,
|
||||
"isTravelProduct": true,
|
||||
"name": "Kortingsabonnement",
|
||||
},
|
||||
"amountInclTax": -1000,
|
||||
"requiredProducts": [],
|
||||
"amountInclTax": 500,
|
||||
"_links":
|
||||
{
|
||||
"get_details":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/products/263",
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/products/984",
|
||||
"method": "GET",
|
||||
},
|
||||
},
|
||||
},
|
||||
"mandatoryCustomerDataItems": [],
|
||||
]
|
||||
},
|
||||
"mandatoryCustomerDataItems": []
|
||||
}
|
||||
Voucher that grants a discount for a whole order:
|
||||
summary: Voucher that grants a discount for a whole order
|
||||
description: |-
|
||||
Voucher that grants a discount for a whole order. In this case, no requiredProduct is specified, and
|
||||
the voucher has an amountInclTax < 0. The (negative) amountInclTax dictates the value of the voucher,
|
||||
that is subtracted from the total order value as a discount (with a minimum order total of 0).
|
||||
value:
|
||||
{
|
||||
"issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
||||
"voucherCode": "HTM-A7J-128-PYT",
|
||||
"fromInclusive": "2024-10-04T00:00:00.000",
|
||||
"untilInclusive": "2024-11-04T00:00:00.000",
|
||||
"voucherStatus": { "voucherStatusId": 2, "name": "issued" },
|
||||
"product":
|
||||
{
|
||||
"productId": 265,
|
||||
"productName": "Voucher 10 euro korting",
|
||||
"productDescription": "Voucher die 10 euro korting geeft op je gehele winkelmand.",
|
||||
"amountInclTax": -1000,
|
||||
"requiredProducts": []
|
||||
},
|
||||
"mandatoryCustomerDataItems": []
|
||||
}
|
||||
"403":
|
||||
description: Forbidden
|
||||
@@ -137,20 +171,20 @@ paths:
|
||||
"detail": "You do not have permission to access this resource.",
|
||||
"instance": "/issuedvouchers",
|
||||
}
|
||||
"404":
|
||||
description: Not found
|
||||
"400":
|
||||
description: Bad request
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/rfc9457"
|
||||
examples:
|
||||
Voucher not found:
|
||||
summary: Voucher not found
|
||||
Invalid voucher code:
|
||||
summary: Invalid voucher code
|
||||
value:
|
||||
{
|
||||
"type": "https://example.com/probs/not-found",
|
||||
"title": "Voucher not found",
|
||||
"detail": "The voucher with code VOUCHER123 does not exist.",
|
||||
"type": "https://example.com/probs/bad-request",
|
||||
"title": "Invalid voucher code",
|
||||
"detail": "No valid voucher found for code VOUCHER123.",
|
||||
"instance": "/issuedvouchers",
|
||||
}
|
||||
"500":
|
||||
@@ -176,6 +210,166 @@ components:
|
||||
scheme: bearer
|
||||
bearerFormat: JWT
|
||||
schemas:
|
||||
salesTouchpointIssuedVoucherResponse:
|
||||
type: object
|
||||
required:
|
||||
- issuedVoucherId
|
||||
- voucherCode
|
||||
- fromInclusive
|
||||
- untilInclusive
|
||||
- voucherStatus
|
||||
- product
|
||||
- mandatoryCustomerDataItems
|
||||
properties:
|
||||
issuedVoucherId:
|
||||
type: string
|
||||
description: The unique (technical) identifier of the issued voucher instance.
|
||||
example: "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90"
|
||||
voucherCode:
|
||||
type: string
|
||||
description: The voucher code that is shared with the customer and uniquely identifies this voucher.
|
||||
example: "HTM-A7J-128-PYT"
|
||||
fromInclusive:
|
||||
type: string
|
||||
format: date-time-offset
|
||||
description: |-
|
||||
The date and time the voucher becomes valid for redemption. This has nothing to do with
|
||||
the allowed start date of a requiredProduct (for this, the existing order flow logic is applied).
|
||||
example: "2024-10-04T00:00:00.000+02:00"
|
||||
untilInclusive:
|
||||
type: string
|
||||
format: date-time-offset
|
||||
description: |-
|
||||
The date and time the voucher becomes invalid for redemption. This has nothing to do with
|
||||
the maximum allowed start date of a requiredProduct (for this, the existing order flow logic is applied).
|
||||
example: "2024-11-04T00:00:00.000+01:00"
|
||||
voucherStatus:
|
||||
type: object
|
||||
required:
|
||||
- voucherStatusId
|
||||
- name
|
||||
description: |-
|
||||
The current status of the voucher. Can be any of the following:
|
||||
- 1 = new
|
||||
- 2 = issued
|
||||
- 3 = redeemed
|
||||
- 4 = revoked
|
||||
- 5 = expired
|
||||
- 6 = pendingRedemption
|
||||
properties:
|
||||
voucherStatusId:
|
||||
type: integer
|
||||
example: 2
|
||||
name:
|
||||
type: string
|
||||
example: "issued"
|
||||
product:
|
||||
type: object
|
||||
description: The "product" referencing the voucher definition that this voucher instance is based on
|
||||
required:
|
||||
- productId
|
||||
- productName
|
||||
- productDescription
|
||||
- amountInclTax
|
||||
properties:
|
||||
productId:
|
||||
type: integer
|
||||
example: 263
|
||||
productName:
|
||||
type: string
|
||||
example: Voucher Ooievaarspas-product AOW
|
||||
productDescription:
|
||||
type: string
|
||||
example: |-
|
||||
Voucher voor AOW-ers in Den Haag met een Ooievaarspas, die ingewisseld kan worden
|
||||
voor het product "Ooievaarspas voor AOW-ers in Den Haag".
|
||||
amountInclTax:
|
||||
type: integer
|
||||
description: |-
|
||||
When combined with a requiredProduct, the (positive or zero) amountInclTax dictates
|
||||
the (modified) total amount that needs to be paid for said product. When the requiredProduct
|
||||
has a sellingPrice > 0, the difference between sellingPrice and voucher amountInclTax
|
||||
represents the granted discount.
|
||||
When not combined with a required product, the (negative) amountInclTax dictates
|
||||
the value of the voucher, that is subtracted from the total order value as a discount
|
||||
(with a minimum order total of 0).
|
||||
example: 0
|
||||
requiredProducts:
|
||||
type: array
|
||||
description: |-
|
||||
Currently, only one requiredProduct is supported and thus, this array can contain at
|
||||
most one element.
|
||||
items:
|
||||
type: object
|
||||
required:
|
||||
- productId
|
||||
properties:
|
||||
productId:
|
||||
type: integer
|
||||
example: 892
|
||||
productName:
|
||||
type: string
|
||||
example: "Ooievaarspas voor AOW-ers in Den Haag"
|
||||
productDescription:
|
||||
type: string
|
||||
example: "Vrij reizen bij HTM voor Haagse AOW-gerechtigden met een Ooievaarspas."
|
||||
productCategory:
|
||||
type: object
|
||||
required:
|
||||
- productCategoryId
|
||||
- isTravelProduct
|
||||
- name
|
||||
properties:
|
||||
productCategoryId:
|
||||
type: integer
|
||||
example: 2
|
||||
isTravelProduct:
|
||||
type: boolean
|
||||
example: true
|
||||
name:
|
||||
type: string
|
||||
example: "Afgekocht reisrecht"
|
||||
amountInclTax:
|
||||
type: integer
|
||||
description: |-
|
||||
Selling price of the product in cents (including tax, if applicable) that is
|
||||
currently active for the calling touchpoint. When 0, the product is free of charge.
|
||||
example: 0
|
||||
imageReference:
|
||||
type: string
|
||||
description: Can be a URL or a base64 encoded image
|
||||
example: https://www.htm.nl/nog-onbekende-productafbeelding
|
||||
_links:
|
||||
type: object
|
||||
properties:
|
||||
get_details:
|
||||
type: object
|
||||
description: Link to get more details for the product that this voucher instance applies to
|
||||
properties:
|
||||
href:
|
||||
type: string
|
||||
example: https://api.integratielaag.nl/abt/touchpoint/1.0/products/982
|
||||
method:
|
||||
type: string
|
||||
example: GET
|
||||
mandatoryCustomerDataItems:
|
||||
type: array
|
||||
description: |-
|
||||
List of mandatory customer data items that are required to redeem this voucher.\
|
||||
The values provided for these data items may be checked against allowed values as provided by the voucher issuer.
|
||||
items:
|
||||
type: object
|
||||
required:
|
||||
- mandatoryCustomerDataItemId
|
||||
- customerDataItem
|
||||
properties:
|
||||
mandatoryCustomerDataItemId:
|
||||
type: integer
|
||||
example: 8
|
||||
customerDataItem:
|
||||
type: string
|
||||
example: padBirthdate
|
||||
|
||||
unavailable:
|
||||
type: object
|
||||
rfc9457:
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1553,6 +1553,9 @@ components:
|
||||
- productCategoryId: 8
|
||||
name: Saldo
|
||||
isTravelProduct: true
|
||||
- productCategoryId: 9
|
||||
name: Voucher
|
||||
isTravelProduct: false
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/productCategoryGetEntity'
|
||||
@@ -1811,7 +1814,7 @@ components:
|
||||
- mandatoryCustomerDataItemId: 5
|
||||
customerDataItem: address
|
||||
- mandatoryCustomerDataItemId: 6
|
||||
customerDataItem: phone
|
||||
customerDataItem: voucher
|
||||
- mandatoryCustomerDataItemId: 7
|
||||
customerDataItem: ovPayToken
|
||||
- mandatoryCustomerDataItemId: 8
|
||||
|
||||
@@ -46,6 +46,13 @@ paths:
|
||||
when false, return only non-archived products (isArchived = false).
|
||||
schema:
|
||||
type: boolean
|
||||
- name: onlyVouchers
|
||||
in: query
|
||||
required: false
|
||||
description: |-
|
||||
When omitted, defaults to false (i.e. return all normal products that are NOT voucher definitions); when true, return only voucher definitions
|
||||
schema:
|
||||
type: boolean
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
@@ -387,6 +394,7 @@ paths:
|
||||
"fikoArticleNumber": "1234",
|
||||
"isValid": true,
|
||||
"isArchived": false,
|
||||
"needsVoucher": false,
|
||||
"gboPackageTemplateId": "30901",
|
||||
"productName": "HTM pilot 90% korting",
|
||||
"productDescription": "Reis met 90% korting gedurende de eerste F&F pilot!",
|
||||
@@ -474,6 +482,7 @@ paths:
|
||||
"fikoArticleNumber": "1234",
|
||||
"isValid": true,
|
||||
"isArchived": false,
|
||||
"needsVoucher": false,
|
||||
"gboPackageTemplateId": "30901",
|
||||
"productName": "HTM pilot 90% korting",
|
||||
"productDescription": "Reis met 90% korting gedurende de eerste F&F pilot!",
|
||||
@@ -560,6 +569,7 @@ paths:
|
||||
"fikoArticleNumber": "1234",
|
||||
"isValid": true,
|
||||
"isArchived": false,
|
||||
"needsVoucher": false,
|
||||
"gboPackageTemplateId": "30901",
|
||||
"productName": "HTM pilot 90% korting",
|
||||
"productDescription": "Reis met 90% korting gedurende de eerste F&F pilot!",
|
||||
@@ -680,6 +690,7 @@ paths:
|
||||
"fikoArticleNumber": "1234",
|
||||
"isValid": true,
|
||||
"isArchived": false,
|
||||
"needsVoucher": false,
|
||||
"gboPackageTemplateId": "33610",
|
||||
"productName": "HTM Regio Vrij DH73",
|
||||
"productDescription": "Voor een vast bedrag onbeperkt reizen met EBS, HTM en RET in het gekozen gebied in de regio Rotterdam Den Haag.",
|
||||
@@ -866,6 +877,7 @@ paths:
|
||||
"fikoArticleNumber": "1234",
|
||||
"isValid": true,
|
||||
"isArchived": false,
|
||||
"needsVoucher": false,
|
||||
"gboPackageTemplateId": "30901",
|
||||
"tapConnectProductCode": null,
|
||||
"productName": "HTM pilot 90% korting",
|
||||
@@ -1028,6 +1040,7 @@ paths:
|
||||
"fikoArticleNumber": "1234",
|
||||
"isValid": true,
|
||||
"isArchived": false,
|
||||
"needsVoucher": false,
|
||||
"gboPackageTemplateId": "30901",
|
||||
"tapConnectProductCode": null,
|
||||
"productName": "HTM pilot 90% korting",
|
||||
@@ -1270,6 +1283,7 @@ paths:
|
||||
"fikoArticleNumber": "1234",
|
||||
"isValid": true,
|
||||
"isArchived": false,
|
||||
"needsVoucher": false,
|
||||
"gboPackageTemplateId": "33610",
|
||||
"tapConnectProductCode": null,
|
||||
"productName": "HTM Regio Vrij DH73",
|
||||
@@ -1475,6 +1489,7 @@ paths:
|
||||
"fikoArticleNumber": "1234",
|
||||
"isValid": true,
|
||||
"isArchived": false,
|
||||
"needsVoucher": false,
|
||||
"gboPackageTemplateId": null,
|
||||
"tapConnectProductCode": null,
|
||||
"productName": "IBAN wijzigen functioneel product",
|
||||
@@ -1672,6 +1687,7 @@ paths:
|
||||
"fikoArticleNumber": "1234",
|
||||
"isValid": true,
|
||||
"isArchived": false,
|
||||
"needsVoucher": false,
|
||||
"gboPackageTemplateId": null,
|
||||
"tapConnectProductCode": null,
|
||||
"productName": "OV-pas saldo (1 eurocent)",
|
||||
@@ -2775,6 +2791,10 @@ components:
|
||||
type: boolean
|
||||
description: Indicates if the product is archived - if true, the Service Engine will prevent touchpoints from seeing this product
|
||||
example: false
|
||||
needsVoucher:
|
||||
type: boolean
|
||||
description: Indicates if the product needs a voucher (with this productId as requiredProductId) to be bought - if false, this is optional, but still allowed
|
||||
example: false
|
||||
gboPackageTemplateId:
|
||||
type: string
|
||||
example: '30901'
|
||||
@@ -3132,6 +3152,10 @@ components:
|
||||
type: boolean
|
||||
description: Indicates if the product is archived - if true, the Service Engine will prevent touchpoints from seeing this product
|
||||
example: false
|
||||
needsVoucher:
|
||||
type: boolean
|
||||
description: Indicates if the product needs a voucher (with this productId as requiredProductId) to be bought - if false, this is optional, but still allowed
|
||||
example: false
|
||||
gboPackageTemplateId:
|
||||
type: string
|
||||
description: >-
|
||||
@@ -3503,6 +3527,10 @@ components:
|
||||
type: boolean
|
||||
description: Indicates if the product is archived - if true, the Service Engine will prevent touchpoints from seeing this product
|
||||
example: false
|
||||
needsVoucher:
|
||||
type: boolean
|
||||
description: Indicates if the product needs a voucher (with this productId as requiredProductId) to be bought - if false, this is optional, but still allowed
|
||||
example: false
|
||||
gboPackageTemplateId:
|
||||
type: string
|
||||
description: >-
|
||||
|
||||
@@ -1102,6 +1102,12 @@ paths:
|
||||
format: uuid
|
||||
example: 058a1af7-897f-45d5-b691-9cc9161e387f
|
||||
description: The id of the purchased product.
|
||||
- in: query
|
||||
name: productId
|
||||
schema:
|
||||
type: integer
|
||||
example: 1
|
||||
description: The id of the product and the issuedVouchers related to it
|
||||
- in: query
|
||||
name: voucherCode
|
||||
schema:
|
||||
@@ -1117,6 +1123,14 @@ paths:
|
||||
explode: false
|
||||
required: false
|
||||
description: The moest recent status id of the voucher.
|
||||
- in: query
|
||||
name: orderBy
|
||||
schema:
|
||||
type: string
|
||||
enum: [PurchasedProductCreatedOn, PurchasedProductLastUpdatedOn]
|
||||
explode: false
|
||||
required: false
|
||||
description: The ordering of the issuedVouchers in the list
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
# Notification preferences transformation service - Python example
|
||||
|
||||
Reference implementation for the Service Engine `GET /customers/notificationpreferences` endpoint. It composes raw CRUD API data into the frontend-friendly response model from `SE-notifications.yaml`.
|
||||
|
||||
## Supplied contracts used
|
||||
|
||||
- `notifications-crud.yaml`
|
||||
- `GET /notificationsubscriptions?customerProfileId={id}&expand=eventTypeChannel`
|
||||
- `GET /notificationcategories?notificationCategoryId={id}&expand=eventTypeChannel`
|
||||
- `customers-crud-v2.yaml`
|
||||
- `GET /ovpaytokens?ovPayTokenId={id}`
|
||||
- `GET /devices?customerProfileId={id}`
|
||||
- `GET /customers?customerProfileId={id}` for person/email resource data
|
||||
- `SE-notifications.yaml`
|
||||
- `GET /customers/notificationpreferences`
|
||||
|
||||
## Runtime options
|
||||
|
||||
### Local FastAPI with real CRUD APIs
|
||||
|
||||
```powershell
|
||||
.\.venv\Scripts\python.exe -m pip install -r requirements.txt
|
||||
$env:NOTIFICATIONS_CRUD_BASE_URL="https://your-notifications-crud-api.example.nl"
|
||||
$env:CUSTOMERS_CRUD_BASE_URL="https://your-customers-crud-api.example.nl"
|
||||
.\.venv\Scripts\python.exe -m uvicorn app.entrypoints.fastapi_app:app --reload
|
||||
```
|
||||
|
||||
Call:
|
||||
|
||||
```powershell
|
||||
Invoke-RestMethod `
|
||||
-Uri "http://127.0.0.1:8000/customers/notificationpreferences?deviceId=device-1" `
|
||||
-Headers @{"X-HTM-CUSTOMER-PROFILE-ID-HEADER"="42"}
|
||||
```
|
||||
|
||||
### Local FastAPI with mock data
|
||||
|
||||
Use mock mode when you want to demo or test the transformation without live CRUD APIs.
|
||||
|
||||
```powershell
|
||||
$env:USE_MOCK_DATA="true"
|
||||
$env:MOCK_SCENARIO="mixed"
|
||||
.\.venv\Scripts\python.exe -m uvicorn app.entrypoints.fastapi_app:app --reload
|
||||
```
|
||||
|
||||
Open:
|
||||
|
||||
```text
|
||||
http://127.0.0.1:8000/docs
|
||||
```
|
||||
|
||||
Health check:
|
||||
|
||||
```text
|
||||
http://127.0.0.1:8000/health
|
||||
```
|
||||
|
||||
Available mock scenarios:
|
||||
|
||||
| Scenario | Purpose |
|
||||
|---|---|
|
||||
| `mixed` | Default-on push, default-off email, plus customer deviations |
|
||||
| `defaults_only` | No customer preferences, so only defaults are applied |
|
||||
| `global_override` | Preference with `resourceIdentifier = null` applies to all resources |
|
||||
| `inactive_subscription` | Subscription is returned but marked inactive |
|
||||
|
||||
### Azure Function
|
||||
|
||||
Use `app/entrypoints/azure_function.py` as the HTTP-trigger body. Keep the `app/services` and `app/domain` modules unchanged.
|
||||
|
||||
## Running automated tests
|
||||
|
||||
```powershell
|
||||
.\.venv\Scripts\python.exe -m pytest
|
||||
```
|
||||
|
||||
The tests cover:
|
||||
|
||||
- default-on channel without preference -> active
|
||||
- default-on channel with preference -> inactive deviation
|
||||
- default-off channel without preference -> inactive
|
||||
- default-off channel with preference -> active deviation
|
||||
- global preference where `resourceIdentifier = null`
|
||||
- device filtering via `deviceId`
|
||||
- inactive subscription still returned as inactive
|
||||
|
||||
## Design choice
|
||||
|
||||
The implementation deliberately separates:
|
||||
|
||||
- HTTP entrypoints: request/response only
|
||||
- CRUD client: raw REST calls only
|
||||
- Mock CRUD client: deterministic local/demo data
|
||||
- Service layer: composition and transformation logic
|
||||
- Domain models: frontend/SE response shape
|
||||
|
||||
This makes the same transformation reusable in Azure Functions, Container Apps, and tests.
|
||||
|
||||
## Business rule interpretation
|
||||
|
||||
For each customer subscription:
|
||||
|
||||
1. Load customer `NotificationSubscriptions` with `NotificationPreferences` expanded to `EventTypeChannel`.
|
||||
2. Load the default category definition with all `EventTypes` and `EventTypeChannels`.
|
||||
3. Load customer resources for each channel resource type:
|
||||
- `resourceNameId = 8` -> `GET /devices?customerProfileId={id}`
|
||||
- `resourceNameId = 4` -> `GET /customers?customerProfileId={id}` and use the embedded `person` email data
|
||||
4. For every default `EventTypeChannel`, write out resources explicitly.
|
||||
5. If the channel is default-on and no preference exists, resource is active.
|
||||
6. If the channel is default-off and no preference exists, resource is inactive.
|
||||
7. A `NotificationPreference` row is interpreted as a deviation:
|
||||
- default-on + preference -> inactive unless explicit `isActive` says otherwise
|
||||
- default-off + preference -> active unless explicit `isActive` says otherwise
|
||||
8. A null `resourceIdentifier` applies to all resources for that EventTypeChannel.
|
||||
|
||||
## Production hardening points
|
||||
|
||||
- Add authentication propagation from the SE API to both CRUD APIs.
|
||||
- Decide whether category defaults should be cached across requests.
|
||||
- Decide whether missing category defaults should become `502 Bad Gateway`, partial data, or an empty category.
|
||||
- Confirm whether the real `NotificationPreference` has explicit `isActive`; this example supports it, but also works when preference existence alone means deviation.
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
-89
@@ -1,89 +0,0 @@
|
||||
from __future__ import annotations
|
||||
from typing import Any, Optional
|
||||
import httpx
|
||||
|
||||
|
||||
class CrudApiClient:
|
||||
"""Thin async client around the ABT CRUD APIs.
|
||||
|
||||
Keep business/transformation logic out of this class. The client only knows how
|
||||
to call the source endpoints and unwrap the collection names from the CRUD
|
||||
contracts.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
notifications_base_url: str,
|
||||
customers_base_url: str,
|
||||
timeout_seconds: float = 10.0,
|
||||
):
|
||||
self.notifications_base_url = notifications_base_url.rstrip("/")
|
||||
self.customers_base_url = customers_base_url.rstrip("/")
|
||||
self.timeout_seconds = timeout_seconds
|
||||
|
||||
async def _get(
|
||||
self,
|
||||
base_url: str,
|
||||
path: str,
|
||||
params: Optional[dict[str, Any]] = None,
|
||||
) -> dict[str, Any]:
|
||||
async with httpx.AsyncClient(base_url=base_url, timeout=self.timeout_seconds) as client:
|
||||
response = await client.get(path, params=params)
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
|
||||
# notifications-crud.yaml
|
||||
async def get_notification_subscriptions(self, customer_profile_id: int) -> list[dict[str, Any]]:
|
||||
payload = await self._get(
|
||||
self.notifications_base_url,
|
||||
"/notificationsubscriptions",
|
||||
params={"customerProfileId": customer_profile_id, "expand": "eventTypeChannel"},
|
||||
)
|
||||
return payload.get("notificationSubscriptions", [])
|
||||
|
||||
async def get_notification_category_defaults(self, notification_category_id: int) -> Optional[dict[str, Any]]:
|
||||
payload = await self._get(
|
||||
self.notifications_base_url,
|
||||
"/notificationcategories",
|
||||
params={"notificationCategoryId": notification_category_id, "expand": "eventTypeChannel"},
|
||||
)
|
||||
categories = payload.get("notificationCategories", [])
|
||||
return categories[0] if categories else None
|
||||
|
||||
# customers-crud-v2.yaml
|
||||
async def get_ovpay_token(self, ovpay_token_id: Optional[int]) -> Optional[dict[str, Any]]:
|
||||
if ovpay_token_id is None:
|
||||
return None
|
||||
payload = await self._get(
|
||||
self.customers_base_url,
|
||||
"/ovpaytokens",
|
||||
params={"ovPayTokenId": ovpay_token_id},
|
||||
)
|
||||
tokens = payload.get("ovPayTokens", [])
|
||||
return tokens[0] if tokens else None
|
||||
|
||||
async def get_devices(self, customer_profile_id: int) -> list[dict[str, Any]]:
|
||||
payload = await self._get(
|
||||
self.customers_base_url,
|
||||
"/devices",
|
||||
params={"customerProfileId": customer_profile_id},
|
||||
)
|
||||
return payload.get("devices", [])
|
||||
|
||||
async def get_persons(self, customer_profile_id: int) -> list[dict[str, Any]]:
|
||||
"""Return customer/person resources used for email-like channels.
|
||||
|
||||
customers-crud-v2.yaml exposes person details through GET /customers,
|
||||
filtered by customerProfileId. For the transformation service we normalize
|
||||
the matching customer profile into one resource with the customer's email.
|
||||
"""
|
||||
payload = await self._get(
|
||||
self.customers_base_url,
|
||||
"/customers",
|
||||
params={"customerProfileId": customer_profile_id},
|
||||
)
|
||||
return payload.get("customers", [])
|
||||
|
||||
|
||||
# Backwards-compatible alias used by the service type hints.
|
||||
NotificationsCrudClient = CrudApiClient
|
||||
-162
@@ -1,162 +0,0 @@
|
||||
from __future__ import annotations
|
||||
from copy import deepcopy
|
||||
from typing import Any, Optional
|
||||
|
||||
|
||||
class MockCrudClient:
|
||||
"""Deterministic in-memory CRUD client for local demos and tests.
|
||||
|
||||
It implements the same methods as CrudApiClient, so the service layer does
|
||||
not know whether data comes from real CRUD APIs or from mock fixtures.
|
||||
"""
|
||||
|
||||
def __init__(self, scenario: str = "mixed"):
|
||||
self.scenario = scenario
|
||||
|
||||
async def get_notification_subscriptions(self, customer_profile_id: int) -> list[dict[str, Any]]:
|
||||
subscriptions = deepcopy(MOCK_SUBSCRIPTIONS.get(self.scenario, MOCK_SUBSCRIPTIONS["mixed"]))
|
||||
for subscription in subscriptions:
|
||||
subscription["customerProfileId"] = customer_profile_id
|
||||
return subscriptions
|
||||
|
||||
async def get_notification_category_defaults(self, notification_category_id: int) -> Optional[dict[str, Any]]:
|
||||
return deepcopy(MOCK_CATEGORIES.get(notification_category_id))
|
||||
|
||||
async def get_ovpay_token(self, ovpay_token_id: Optional[int]) -> Optional[dict[str, Any]]:
|
||||
if ovpay_token_id is None:
|
||||
return None
|
||||
return deepcopy(MOCK_OVPAY_TOKENS.get(ovpay_token_id, {"ovPayTokenId": ovpay_token_id, "alias": None}))
|
||||
|
||||
async def get_devices(self, customer_profile_id: int) -> list[dict[str, Any]]:
|
||||
return deepcopy(MOCK_DEVICES)
|
||||
|
||||
async def get_persons(self, customer_profile_id: int) -> list[dict[str, Any]]:
|
||||
return deepcopy(MOCK_CUSTOMERS)
|
||||
|
||||
|
||||
MOCK_CATEGORIES: dict[int, dict[str, Any]] = {
|
||||
1: {
|
||||
"notificationCategoryId": 1,
|
||||
"name": "Reizen",
|
||||
"groupName": "Mijn passen",
|
||||
"eventTypes": [
|
||||
{
|
||||
"eventTypeId": 10,
|
||||
"name": "OVPAY_CHECK_IN",
|
||||
"subName": "Check-in",
|
||||
"prettyName": "Check-in bevestiging",
|
||||
"eventTypeChannels": [
|
||||
{
|
||||
"eventTypeChannelId": "etc-push-default-on",
|
||||
"channel": {
|
||||
"channelId": 1,
|
||||
"name": "Push",
|
||||
"resourceName": {"resourceNameId": 8, "name": "devices"},
|
||||
},
|
||||
"isDefault": True,
|
||||
"isMandatory": False,
|
||||
},
|
||||
{
|
||||
"eventTypeChannelId": "etc-email-default-off",
|
||||
"channel": {
|
||||
"channelId": 2,
|
||||
"name": "E-mail",
|
||||
"resourceName": {"resourceNameId": 4, "name": "customers"},
|
||||
},
|
||||
"isDefault": False,
|
||||
"isMandatory": False,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"eventTypeId": 20,
|
||||
"name": "SERVICE_MESSAGE",
|
||||
"subName": "Service",
|
||||
"prettyName": "Servicebericht",
|
||||
"eventTypeChannels": [
|
||||
{
|
||||
"eventTypeChannelId": "etc-email-mandatory",
|
||||
"channel": {
|
||||
"channelId": 2,
|
||||
"name": "E-mail",
|
||||
"resourceName": {"resourceNameId": 4, "name": "customers"},
|
||||
},
|
||||
"isDefault": True,
|
||||
"isMandatory": True,
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
MOCK_SUBSCRIPTIONS: dict[str, list[dict[str, Any]]] = {
|
||||
# Mixed scenario demonstrates both default behavior and customer deviations.
|
||||
"mixed": [
|
||||
{
|
||||
"notificationSubscriptionId": "sub-mixed-1",
|
||||
"notificationCategoryId": 1,
|
||||
"notificationCategory": {"notificationCategoryId": 1, "name": "Reizen", "groupName": "Mijn passen"},
|
||||
"customerProfileId": 42,
|
||||
"ovPayTokenId": 112,
|
||||
"subscriptionActivities": [{"timestamp": "2026-04-01T10:00:00Z", "isActive": True}],
|
||||
"notificationPreferences": [
|
||||
# Default push=true: this row opts out only device-2.
|
||||
{"notificationPreferenceId": "pref-push-device-2-off", "eventTypeChannelId": "etc-push-default-on", "resourceIdentifier": "device-2"},
|
||||
# Default email=false: this row opts in the customer's email resource.
|
||||
{"notificationPreferenceId": "pref-email-on", "eventTypeChannelId": "etc-email-default-off", "resourceIdentifier": "42"},
|
||||
],
|
||||
}
|
||||
],
|
||||
# No preferences: output should be entirely based on category defaults.
|
||||
"defaults_only": [
|
||||
{
|
||||
"notificationSubscriptionId": "sub-defaults-1",
|
||||
"notificationCategoryId": 1,
|
||||
"notificationCategory": {"notificationCategoryId": 1, "name": "Reizen", "groupName": "Mijn passen"},
|
||||
"customerProfileId": 42,
|
||||
"ovPayTokenId": 112,
|
||||
"subscriptionActivities": [{"timestamp": "2026-04-01T10:00:00Z", "isActive": True}],
|
||||
"notificationPreferences": [],
|
||||
}
|
||||
],
|
||||
# Global preference: null resourceIdentifier applies the deviation to all resources.
|
||||
"global_override": [
|
||||
{
|
||||
"notificationSubscriptionId": "sub-global-1",
|
||||
"notificationCategoryId": 1,
|
||||
"notificationCategory": {"notificationCategoryId": 1, "name": "Reizen", "groupName": "Mijn passen"},
|
||||
"customerProfileId": 42,
|
||||
"ovPayTokenId": 112,
|
||||
"subscriptionActivities": [{"timestamp": "2026-04-01T10:00:00Z", "isActive": True}],
|
||||
"notificationPreferences": [
|
||||
{"notificationPreferenceId": "pref-all-push-off", "eventTypeChannelId": "etc-push-default-on", "resourceIdentifier": None}
|
||||
],
|
||||
}
|
||||
],
|
||||
# Subscription inactive while preferences are still written out for the frontend.
|
||||
"inactive_subscription": [
|
||||
{
|
||||
"notificationSubscriptionId": "sub-inactive-1",
|
||||
"notificationCategoryId": 1,
|
||||
"notificationCategory": {"notificationCategoryId": 1, "name": "Reizen", "groupName": "Mijn passen"},
|
||||
"customerProfileId": 42,
|
||||
"ovPayTokenId": 112,
|
||||
"subscriptionActivities": [{"timestamp": "2026-04-01T10:00:00Z", "isActive": False}],
|
||||
"notificationPreferences": [],
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
MOCK_OVPAY_TOKENS = {
|
||||
112: {"ovPayTokenId": 112, "alias": "Mijn betaalpas"},
|
||||
}
|
||||
|
||||
MOCK_DEVICES = [
|
||||
{"deviceId": "device-1", "alias": "Mijn iPhone"},
|
||||
{"deviceId": "device-2", "alias": "Werktelefoon"},
|
||||
]
|
||||
|
||||
MOCK_CUSTOMERS = [
|
||||
{"customerProfileId": 42, "person": {"emailAddress": "klant@example.nl"}},
|
||||
]
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -1,60 +0,0 @@
|
||||
from __future__ import annotations
|
||||
from typing import Any, Optional
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class Resource(BaseModel):
|
||||
resourceName: str
|
||||
resourceIdentifier: str
|
||||
alias: Optional[str] = None
|
||||
isActive: bool
|
||||
|
||||
|
||||
class EventTypeChannelPreference(BaseModel):
|
||||
eventTypeChannelId: str
|
||||
channelId: int
|
||||
name: str
|
||||
isMandatory: bool = False
|
||||
resources: list[Resource] = Field(default_factory=list)
|
||||
|
||||
|
||||
class EventTypePreference(BaseModel):
|
||||
eventTypeId: int
|
||||
name: str
|
||||
subName: Optional[str] = None
|
||||
prettyName: str
|
||||
eventTypeChannels: list[EventTypeChannelPreference] = Field(default_factory=list)
|
||||
|
||||
|
||||
class OvPayToken(BaseModel):
|
||||
ovPayTokenId: int
|
||||
alias: Optional[str] = None
|
||||
|
||||
|
||||
class NotificationSubscriptionPreference(BaseModel):
|
||||
notificationSubscriptionId: str
|
||||
customerProfileId: int
|
||||
ovPayToken: Optional[OvPayToken] = None
|
||||
isActive: bool
|
||||
eventTypes: list[EventTypePreference] = Field(default_factory=list)
|
||||
|
||||
|
||||
class NotificationCategoryPreference(BaseModel):
|
||||
notificationCategoryId: int
|
||||
name: str
|
||||
groupName: Optional[str] = None
|
||||
notificationSubscriptions: list[NotificationSubscriptionPreference] = Field(default_factory=list)
|
||||
|
||||
|
||||
class CustomerNotificationPreferencesResponse(BaseModel):
|
||||
notificationCategories: list[NotificationCategoryPreference] = Field(default_factory=list)
|
||||
|
||||
|
||||
def latest_activity_is_active(subscription: dict[str, Any]) -> bool:
|
||||
"""CRUD returns subscriptionActivities; the most recent/current one determines active state."""
|
||||
activities = subscription.get("subscriptionActivities") or []
|
||||
if not activities:
|
||||
return False
|
||||
# CRUD activityLimit defaults to 1; when more are supplied, sort defensively on timestamp.
|
||||
latest = sorted(activities, key=lambda a: a.get("timestamp", ""), reverse=True)[0]
|
||||
return bool(latest.get("isActive"))
|
||||
BIN
Binary file not shown.
-17
@@ -1,17 +0,0 @@
|
||||
from __future__ import annotations
|
||||
import azure.functions as func
|
||||
|
||||
from app.service_factory import create_notification_preferences_service
|
||||
|
||||
|
||||
async def main(req: func.HttpRequest) -> func.HttpResponse:
|
||||
customer_profile_id = req.headers.get("X-HTM-CUSTOMER-PROFILE-ID-HEADER")
|
||||
if not customer_profile_id:
|
||||
return func.HttpResponse("Missing X-HTM-CUSTOMER-PROFILE-ID-HEADER", status_code=400)
|
||||
|
||||
service = create_notification_preferences_service()
|
||||
result = await service.get_customer_notification_preferences(
|
||||
customer_profile_id=int(customer_profile_id),
|
||||
device_id=req.params.get("deviceId"),
|
||||
)
|
||||
return func.HttpResponse(result.model_dump_json(exclude_none=True), mimetype="application/json", status_code=200)
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
from __future__ import annotations
|
||||
from fastapi import FastAPI, Header, Query
|
||||
|
||||
from app.domain.models import CustomerNotificationPreferencesResponse
|
||||
from app.service_factory import create_notification_preferences_service
|
||||
from app.settings import settings
|
||||
|
||||
app = FastAPI(title="SE Notifications example")
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
async def health():
|
||||
return {"status": "ok", "useMockData": settings.use_mock_data, "mockScenario": settings.mock_scenario}
|
||||
|
||||
|
||||
@app.get("/customers/notificationpreferences", response_model=CustomerNotificationPreferencesResponse)
|
||||
async def get_customer_notification_preferences(
|
||||
x_htm_customer_profile_id_header: int = Header(..., alias="X-HTM-CUSTOMER-PROFILE-ID-HEADER"),
|
||||
device_id: str | None = Query(default=None, alias="deviceId"),
|
||||
):
|
||||
service = create_notification_preferences_service()
|
||||
return await service.get_customer_notification_preferences(
|
||||
customer_profile_id=x_htm_customer_profile_id_header,
|
||||
device_id=device_id,
|
||||
)
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from app.clients.crud_client import CrudApiClient
|
||||
from app.clients.mock_crud_client import MockCrudClient
|
||||
from app.services.notification_preferences_service import NotificationPreferencesService
|
||||
from app.settings import settings
|
||||
|
||||
|
||||
def create_notification_preferences_service() -> NotificationPreferencesService:
|
||||
if settings.use_mock_data:
|
||||
return NotificationPreferencesService(MockCrudClient(settings.mock_scenario))
|
||||
|
||||
return NotificationPreferencesService(
|
||||
CrudApiClient(
|
||||
notifications_base_url=settings.notifications_crud_base_url,
|
||||
customers_base_url=settings.customers_crud_base_url,
|
||||
)
|
||||
)
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
-228
@@ -1,228 +0,0 @@
|
||||
from __future__ import annotations
|
||||
from collections import defaultdict
|
||||
from typing import Any, Optional
|
||||
|
||||
from app.clients.crud_client import NotificationsCrudClient
|
||||
from app.domain.models import (
|
||||
CustomerNotificationPreferencesResponse,
|
||||
EventTypeChannelPreference,
|
||||
EventTypePreference,
|
||||
NotificationCategoryPreference,
|
||||
NotificationSubscriptionPreference,
|
||||
OvPayToken,
|
||||
Resource,
|
||||
latest_activity_is_active,
|
||||
)
|
||||
|
||||
RESOURCE_DEVICES_ID = 8
|
||||
RESOURCE_PERSONS_ID = 4
|
||||
|
||||
|
||||
class NotificationPreferencesService:
|
||||
def __init__(self, crud_client: NotificationsCrudClient):
|
||||
self.crud_client = crud_client
|
||||
|
||||
async def get_customer_notification_preferences(
|
||||
self,
|
||||
customer_profile_id: int,
|
||||
device_id: Optional[str] = None,
|
||||
) -> CustomerNotificationPreferencesResponse:
|
||||
subscriptions = await self.crud_client.get_notification_subscriptions(customer_profile_id)
|
||||
categories_by_id: dict[int, NotificationCategoryPreference] = {}
|
||||
|
||||
# Small in-request caches avoid repeated calls for the same category/resources.
|
||||
default_category_cache: dict[int, dict[str, Any]] = {}
|
||||
resource_cache: dict[int, list[dict[str, Any]]] = {}
|
||||
|
||||
for subscription in subscriptions:
|
||||
category_id = _extract_category_id(subscription)
|
||||
default_category = default_category_cache.get(category_id)
|
||||
if default_category is None:
|
||||
default_category = await self.crud_client.get_notification_category_defaults(category_id)
|
||||
if default_category is None:
|
||||
# Defensive choice: skip orphaned subscriptions rather than returning incomplete UI data.
|
||||
continue
|
||||
default_category_cache[category_id] = default_category
|
||||
|
||||
category_response = categories_by_id.setdefault(
|
||||
category_id,
|
||||
NotificationCategoryPreference(
|
||||
notificationCategoryId=category_id,
|
||||
name=default_category.get("name") or subscription.get("notificationCategory", {}).get("name"),
|
||||
groupName=default_category.get("groupName") or subscription.get("notificationCategory", {}).get("groupName"),
|
||||
),
|
||||
)
|
||||
|
||||
token_payload = await self.crud_client.get_ovpay_token(subscription.get("ovPayTokenId"))
|
||||
token = _to_ovpay_token(token_payload, subscription.get("ovPayTokenId"))
|
||||
|
||||
subscription_response = NotificationSubscriptionPreference(
|
||||
notificationSubscriptionId=subscription["notificationSubscriptionId"],
|
||||
customerProfileId=subscription["customerProfileId"],
|
||||
ovPayToken=token,
|
||||
isActive=latest_activity_is_active(subscription),
|
||||
)
|
||||
|
||||
preferences_by_event_type_channel = _index_preferences(subscription)
|
||||
|
||||
for event_type in default_category.get("eventTypes", []):
|
||||
event_type_response = EventTypePreference(
|
||||
eventTypeId=event_type["eventTypeId"],
|
||||
name=event_type["name"],
|
||||
subName=event_type.get("subName"),
|
||||
prettyName=event_type.get("prettyName") or event_type["name"],
|
||||
)
|
||||
|
||||
for event_type_channel in event_type.get("eventTypeChannels", []):
|
||||
channel = event_type_channel.get("channel", {})
|
||||
resource_name = channel.get("resourceName", {})
|
||||
resource_name_id = resource_name.get("resourceNameId")
|
||||
resource_name_text = resource_name.get("name") or channel.get("name")
|
||||
|
||||
if resource_name_id not in resource_cache:
|
||||
resource_cache[resource_name_id] = await self._load_resources(resource_name_id, customer_profile_id)
|
||||
source_resources = resource_cache[resource_name_id]
|
||||
|
||||
if device_id and resource_name_id == RESOURCE_DEVICES_ID:
|
||||
source_resources = [r for r in source_resources if str(_resource_identifier(r)) == str(device_id)]
|
||||
if not source_resources:
|
||||
# SE swagger states a deviceId filter returns only ETCs with resources for that device.
|
||||
continue
|
||||
|
||||
matching_preferences = preferences_by_event_type_channel.get(
|
||||
str(event_type_channel["eventTypeChannelId"]), []
|
||||
)
|
||||
|
||||
resources = self._normalize_resources(
|
||||
resource_name=resource_name_text,
|
||||
event_type_channel=event_type_channel,
|
||||
source_resources=source_resources,
|
||||
preferences=matching_preferences,
|
||||
)
|
||||
|
||||
event_type_response.eventTypeChannels.append(
|
||||
EventTypeChannelPreference(
|
||||
eventTypeChannelId=event_type_channel["eventTypeChannelId"],
|
||||
channelId=channel["channelId"],
|
||||
name=channel["name"],
|
||||
isMandatory=bool(event_type_channel.get("isMandatory")),
|
||||
resources=resources,
|
||||
)
|
||||
)
|
||||
|
||||
if event_type_response.eventTypeChannels:
|
||||
subscription_response.eventTypes.append(event_type_response)
|
||||
|
||||
category_response.notificationSubscriptions.append(subscription_response)
|
||||
|
||||
return CustomerNotificationPreferencesResponse(notificationCategories=list(categories_by_id.values()))
|
||||
|
||||
async def _load_resources(self, resource_name_id: int, customer_profile_id: int) -> list[dict[str, Any]]:
|
||||
if resource_name_id == RESOURCE_DEVICES_ID:
|
||||
return await self.crud_client.get_devices(customer_profile_id)
|
||||
if resource_name_id == RESOURCE_PERSONS_ID:
|
||||
return await self.crud_client.get_persons(customer_profile_id)
|
||||
return []
|
||||
|
||||
def _normalize_resources(
|
||||
self,
|
||||
resource_name: str,
|
||||
event_type_channel: dict[str, Any],
|
||||
source_resources: list[dict[str, Any]],
|
||||
preferences: list[dict[str, Any]],
|
||||
) -> list[Resource]:
|
||||
default_active = bool(event_type_channel.get("isDefault"))
|
||||
|
||||
if not preferences:
|
||||
return [
|
||||
Resource(
|
||||
resourceName=resource_name,
|
||||
resourceIdentifier=str(_resource_identifier(resource)),
|
||||
alias=_resource_alias(resource),
|
||||
isActive=default_active,
|
||||
)
|
||||
for resource in source_resources
|
||||
]
|
||||
|
||||
# Preference rows are exceptions/deviations. A null resourceIdentifier means the exception applies to all resources.
|
||||
preference_by_resource: dict[str, dict[str, Any]] = {}
|
||||
global_preference: Optional[dict[str, Any]] = None
|
||||
for preference in preferences:
|
||||
pref_resource_id = preference.get("resourceIdentifier")
|
||||
if pref_resource_id is None:
|
||||
global_preference = preference
|
||||
else:
|
||||
preference_by_resource[str(pref_resource_id)] = preference
|
||||
|
||||
normalized: list[Resource] = []
|
||||
for resource in source_resources:
|
||||
resource_id = str(_resource_identifier(resource))
|
||||
preference = preference_by_resource.get(resource_id) or global_preference
|
||||
if preference is None:
|
||||
is_active = default_active
|
||||
else:
|
||||
# The CRUD example only shows the existence of a preference row, no explicit isActive.
|
||||
# Therefore: for default-on channels a row means opted out; for default-off a row means opted in.
|
||||
is_active = bool(preference.get("isActive", not default_active))
|
||||
|
||||
normalized.append(
|
||||
Resource(
|
||||
resourceName=resource_name,
|
||||
resourceIdentifier=resource_id,
|
||||
alias=_resource_alias(resource),
|
||||
isActive=is_active,
|
||||
)
|
||||
)
|
||||
return normalized
|
||||
|
||||
|
||||
def _extract_category_id(subscription: dict[str, Any]) -> int:
|
||||
if subscription.get("notificationCategoryId") is not None:
|
||||
return int(subscription["notificationCategoryId"])
|
||||
return int(subscription["notificationCategory"]["notificationCategoryId"])
|
||||
|
||||
|
||||
def _index_preferences(subscription: dict[str, Any]) -> dict[str, list[dict[str, Any]]]:
|
||||
result: dict[str, list[dict[str, Any]]] = defaultdict(list)
|
||||
for preference in subscription.get("notificationPreferences", []) or []:
|
||||
event_type_channel_id = preference.get("eventTypeChannelId")
|
||||
if isinstance(event_type_channel_id, dict):
|
||||
event_type_channel_id = event_type_channel_id.get("eventTypeChannelId")
|
||||
if event_type_channel_id is None and isinstance(preference.get("eventTypeChannel"), dict):
|
||||
event_type_channel_id = preference["eventTypeChannel"].get("eventTypeChannelId")
|
||||
if event_type_channel_id is not None:
|
||||
result[str(event_type_channel_id)].append(preference)
|
||||
return result
|
||||
|
||||
|
||||
def _to_ovpay_token(payload: Optional[dict[str, Any]], fallback_id: Optional[int]) -> Optional[OvPayToken]:
|
||||
if fallback_id is None:
|
||||
return None
|
||||
# Support both {ovPayToken: {...}} and direct {...} shapes.
|
||||
token = (payload or {}).get("ovPayToken", payload or {})
|
||||
return OvPayToken(ovPayTokenId=token.get("ovPayTokenId", fallback_id), alias=token.get("alias"))
|
||||
|
||||
|
||||
def _resource_identifier(resource: dict[str, Any]) -> Any:
|
||||
# Device resources use deviceId. Customer/person email resources are normalized
|
||||
# to customerProfileId because customers-crud-v2 exposes person under /customers.
|
||||
return (
|
||||
resource.get("resourceIdentifier")
|
||||
or resource.get("deviceId")
|
||||
or resource.get("personId")
|
||||
or resource.get("customerProfileId")
|
||||
or resource.get("id")
|
||||
)
|
||||
|
||||
|
||||
def _resource_alias(resource: dict[str, Any]) -> Optional[str]:
|
||||
person = resource.get("person") or {}
|
||||
return (
|
||||
resource.get("alias")
|
||||
or resource.get("emailAddress")
|
||||
or resource.get("emailAddresses")
|
||||
or resource.get("email")
|
||||
or person.get("emailAddress")
|
||||
or person.get("emailAddresses")
|
||||
or resource.get("name")
|
||||
)
|
||||
@@ -1,13 +0,0 @@
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
notifications_crud_base_url: str = "http://localhost:8001"
|
||||
customers_crud_base_url: str = "http://localhost:8002"
|
||||
|
||||
# local development aid: set USE_MOCK_DATA=true to run without CRUD APIs
|
||||
use_mock_data: bool = False
|
||||
mock_scenario: str = "mixed"
|
||||
|
||||
|
||||
settings = Settings()
|
||||
@@ -1,8 +0,0 @@
|
||||
fastapi==0.115.6
|
||||
uvicorn[standard]==0.34.0
|
||||
httpx==0.28.1
|
||||
pydantic>=2.12.0
|
||||
pydantic-settings>=2.7.1
|
||||
azure-functions==1.21.3
|
||||
pytest==8.3.4
|
||||
pytest-asyncio==0.25.2
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
-69
@@ -1,69 +0,0 @@
|
||||
import pytest
|
||||
|
||||
from app.clients.mock_crud_client import MockCrudClient
|
||||
from app.services.notification_preferences_service import NotificationPreferencesService
|
||||
|
||||
|
||||
def _channels(result):
|
||||
subscription = result.notificationCategories[0].notificationSubscriptions[0]
|
||||
return {
|
||||
channel.eventTypeChannelId: channel
|
||||
for event_type in subscription.eventTypes
|
||||
for channel in event_type.eventTypeChannels
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_mixed_scenario_applies_default_on_and_default_off_deviations():
|
||||
service = NotificationPreferencesService(MockCrudClient("mixed"))
|
||||
result = await service.get_customer_notification_preferences(42)
|
||||
channels = _channels(result)
|
||||
|
||||
push_resources = channels["etc-push-default-on"].resources
|
||||
assert [(r.resourceIdentifier, r.isActive) for r in push_resources] == [
|
||||
("device-1", True),
|
||||
("device-2", False),
|
||||
]
|
||||
|
||||
email_resources = channels["etc-email-default-off"].resources
|
||||
assert [(r.resourceIdentifier, r.isActive) for r in email_resources] == [("42", True)]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_defaults_only_scenario_writes_all_resources_from_defaults():
|
||||
service = NotificationPreferencesService(MockCrudClient("defaults_only"))
|
||||
result = await service.get_customer_notification_preferences(42)
|
||||
channels = _channels(result)
|
||||
|
||||
assert [r.isActive for r in channels["etc-push-default-on"].resources] == [True, True]
|
||||
assert [r.isActive for r in channels["etc-email-default-off"].resources] == [False]
|
||||
assert channels["etc-email-mandatory"].isMandatory is True
|
||||
assert [r.isActive for r in channels["etc-email-mandatory"].resources] == [True]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_global_override_applies_to_all_resources_when_resource_identifier_is_null():
|
||||
service = NotificationPreferencesService(MockCrudClient("global_override"))
|
||||
result = await service.get_customer_notification_preferences(42)
|
||||
channels = _channels(result)
|
||||
|
||||
assert [r.isActive for r in channels["etc-push-default-on"].resources] == [False, False]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_device_filter_returns_only_requested_device_for_device_channels():
|
||||
service = NotificationPreferencesService(MockCrudClient("mixed"))
|
||||
result = await service.get_customer_notification_preferences(42, device_id="device-1")
|
||||
channels = _channels(result)
|
||||
|
||||
assert [(r.resourceIdentifier, r.isActive) for r in channels["etc-push-default-on"].resources] == [("device-1", True)]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_inactive_subscription_is_visible_but_marked_inactive():
|
||||
service = NotificationPreferencesService(MockCrudClient("inactive_subscription"))
|
||||
result = await service.get_customer_notification_preferences(42)
|
||||
subscription = result.notificationCategories[0].notificationSubscriptions[0]
|
||||
|
||||
assert subscription.isActive is False
|
||||
assert subscription.eventTypes
|
||||
-83
@@ -1,83 +0,0 @@
|
||||
import pytest
|
||||
|
||||
from app.services.notification_preferences_service import NotificationPreferencesService
|
||||
|
||||
|
||||
class FakeCrudClient:
|
||||
async def get_notification_subscriptions(self, customer_profile_id: int):
|
||||
return [
|
||||
{
|
||||
"notificationSubscriptionId": "sub-1",
|
||||
"notificationCategory": {"notificationCategoryId": 1, "name": "Reizen", "groupName": "Mijn passen"},
|
||||
"customerProfileId": customer_profile_id,
|
||||
"ovPayTokenId": 112,
|
||||
"subscriptionActivities": [{"timestamp": "2026-01-01T00:00:00Z", "isActive": True}],
|
||||
"notificationPreferences": [
|
||||
# Default push=true, this row switches device-2 off only.
|
||||
{"notificationPreferenceId": "pref-1", "eventTypeChannelId": "etc-push", "resourceIdentifier": "device-2"},
|
||||
# Default email=false, this row switches customer email on.
|
||||
{"notificationPreferenceId": "pref-2", "eventTypeChannelId": "etc-email", "resourceIdentifier": "42"},
|
||||
],
|
||||
}
|
||||
]
|
||||
|
||||
async def get_notification_category_defaults(self, notification_category_id: int):
|
||||
return {
|
||||
"notificationCategoryId": 1,
|
||||
"name": "Reizen",
|
||||
"groupName": "Mijn passen",
|
||||
"eventTypes": [
|
||||
{
|
||||
"eventTypeId": 2,
|
||||
"name": "GBO",
|
||||
"subName": "CI",
|
||||
"prettyName": "Normal Check-in",
|
||||
"eventTypeChannels": [
|
||||
{
|
||||
"eventTypeChannelId": "etc-push",
|
||||
"channel": {"channelId": 1, "name": "push", "resourceName": {"resourceNameId": 8, "name": "devices"}},
|
||||
"isDefault": True,
|
||||
"isMandatory": False,
|
||||
},
|
||||
{
|
||||
"eventTypeChannelId": "etc-email",
|
||||
"channel": {"channelId": 2, "name": "email", "resourceName": {"resourceNameId": 4, "name": "customers"}},
|
||||
"isDefault": False,
|
||||
"isMandatory": False,
|
||||
},
|
||||
],
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
async def get_ovpay_token(self, ovpay_token_id):
|
||||
return {"ovPayToken": {"ovPayTokenId": ovpay_token_id, "alias": "Mijn ING bankpas"}}
|
||||
|
||||
async def get_devices(self, customer_profile_id: int):
|
||||
return [
|
||||
{"deviceId": "device-1", "alias": "Mijn iPhone"},
|
||||
{"deviceId": "device-2", "alias": "Mijn Pixel"},
|
||||
]
|
||||
|
||||
async def get_persons(self, customer_profile_id: int):
|
||||
return [{"customerProfileId": 42, "emailAddress": "customer@example.nl"}]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_normalizes_defaults_and_customer_exceptions():
|
||||
result = await NotificationPreferencesService(FakeCrudClient()).get_customer_notification_preferences(42)
|
||||
event_type = result.notificationCategories[0].notificationSubscriptions[0].eventTypes[0]
|
||||
|
||||
push_resources = event_type.eventTypeChannels[0].resources
|
||||
assert [r.isActive for r in push_resources] == [True, False]
|
||||
|
||||
email_resources = event_type.eventTypeChannels[1].resources
|
||||
assert email_resources[0].isActive is True
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_device_filter_only_returns_that_device_resource():
|
||||
result = await NotificationPreferencesService(FakeCrudClient()).get_customer_notification_preferences(42, device_id="device-1")
|
||||
event_type = result.notificationCategories[0].notificationSubscriptions[0].eventTypes[0]
|
||||
assert len(event_type.eventTypeChannels[0].resources) == 1
|
||||
assert event_type.eventTypeChannels[0].resources[0].resourceIdentifier == "device-1"
|
||||
Whitespace-only changes.
Reference in new issue
Block a user