Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27e2572ded | ||
|
|
67ab05055c | ||
|
|
8a10320c26 | ||
|
|
e13b643c99 | ||
|
|
7954e8012d | ||
|
|
7d84691c4b | ||
|
|
354a8bf75d | ||
|
|
534ee3f8fd | ||
|
|
3e4a59bdcc | ||
|
|
4f54aaf027 | ||
|
|
8dd6f7211b | ||
|
|
b59b8ca32b | ||
|
|
c35c44a1cf | ||
|
|
8fc5d3b55e | ||
|
|
50bff1d3f7 | ||
|
|
b1fb842046 | ||
|
|
a621b1f06c | ||
|
|
6a4b1a1d58 | ||
|
|
c4d99bb8d6 | ||
|
|
db5d2ac324 | ||
|
|
175c81f5cd | ||
|
|
4f183fe4ab | ||
|
|
e295a570f0 | ||
|
|
2094ef46e4 | ||
|
|
cf7dcc8dd4 | ||
|
|
f033ab6bbe | ||
|
|
58ca9326dc | ||
|
|
d3c9e3d36b | ||
|
|
38094e7b29 | ||
|
|
974f737777 | ||
|
|
868ac3e6bd | ||
|
|
5c950701e0 | ||
|
|
f193a1204b | ||
|
|
dc21af3cef | ||
|
|
c45f2059f4 | ||
|
|
53185d10b1 | ||
|
|
f237f677e3 | ||
|
|
9bb7320299 | ||
|
|
1bf9fa2fd0 | ||
|
|
903adbe238 | ||
|
|
b6586891fc | ||
|
|
8b148b22ac | ||
|
|
44dae159b8 | ||
|
|
a7e32f6122 | ||
|
|
513045c146 | ||
|
|
8c4542a151 | ||
|
|
0749e927dc | ||
|
|
2b02e52c22 | ||
|
|
2cb6f910df | ||
|
|
1269f8916f | ||
|
|
c3af1e9adf | ||
|
|
5d307d9808 | ||
|
|
105e81b5c4 | ||
|
|
24b4832c69 | ||
|
|
03372074d9 | ||
|
|
bf0ebee435 | ||
|
|
541b0662f1 | ||
|
|
594475331f | ||
|
|
42c49693f1 | ||
|
|
62f001c902 | ||
|
|
a71aa2e4df | ||
|
|
5e2b646a30 | ||
|
|
7ab0de07c4 | ||
|
|
39e5042350 | ||
|
|
2d742ca3f1 | ||
|
|
97c58dc3fe | ||
|
|
d06da1401e | ||
|
|
04d46e0891 | ||
|
|
c31554a526 | ||
|
|
9d9039d732 | ||
|
|
93efb6b8f7 | ||
|
|
77953a726a | ||
|
|
bbf21e61f7 | ||
|
|
681e9f7671 | ||
|
|
c9b54a095d | ||
|
|
e3139fdd6d | ||
|
|
4b932a0628 | ||
|
|
43bf7bfff3 | ||
|
|
007cf4bdef | ||
|
|
baee1e8622 | ||
|
|
ba314674a3 | ||
|
|
1f51eaadc6 | ||
|
|
5838b14ac5 | ||
|
|
14817cc621 | ||
|
|
c1fbc0dc90 | ||
|
|
9b8cf65525 | ||
|
|
8f907896be | ||
|
|
591347e080 | ||
|
|
da7afd63fc | ||
|
|
2c88fac238 | ||
|
|
6a24636d50 | ||
|
|
c7fa48b554 | ||
|
|
5133903efb | ||
|
|
447912e081 | ||
|
|
e2d78ec969 | ||
|
|
c6facc5a70 | ||
|
|
cf0d24632f | ||
|
|
aa4721c651 | ||
|
|
46bf7874d9 | ||
|
|
1a14918f4a | ||
|
|
7147318900 | ||
|
|
e0f78d2e38 | ||
|
|
ab57e27c1d | ||
|
|
68c7ccc279 | ||
|
|
80c9fe7599 | ||
|
|
8946026860 | ||
|
|
e6b2146706 | ||
|
|
fb8723124a | ||
|
|
6d7c260e9e | ||
|
|
292588b7ba | ||
|
|
4bd216bd37 | ||
|
|
bfaa1ddcb1 | ||
|
|
55bac27561 | ||
|
|
715a9668fc | ||
|
|
b4f20a9758 |
No files matched your search
+1
-1
@@ -8,7 +8,7 @@
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="temurin-21" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
Binary file not shown.
@@ -1,7 +1,9 @@
|
||||
# ABTProducts PUT request body generator
|
||||
Simple tool to quickly edit HTM products via ABTProducts REST API.
|
||||
|
||||
- Requires JRE 21
|
||||
- Requires JRE 17
|
||||
|
||||
## Generating a PUT output (that you need to supply to PUT API yourself):
|
||||
- Run via: `java -jar ABTProductsPUTGenerator.jar`
|
||||
- Specify custom input/output path via: `java -jar ABTProductsPUTGenerator.jar <inputPath> <outputPath>`
|
||||
- Takes a ABTProducts GET response body in JSON format (product details)
|
||||
@@ -10,3 +12,14 @@ Simple tool to quickly edit HTM products via ABTProducts REST API.
|
||||
- `curl -X PUT -H 'Content-Type: application/json' {baseUrl}/abt/abtproducts/1.0/38 --data @output.json`
|
||||
- Default input path: /input.json
|
||||
- Default output path: /output.json (output is overwritten if it exists)
|
||||
|
||||
## Bulk clearing (set to null) of a certain product attribute for all productIds in a product-tree (SE product reponse)
|
||||
- Run via: `java -jar ABTProductsPUTGenerator.jar clearAttribute <inputPath> <attributeToClear> <environment> <wso2BearerToken>`
|
||||
- Takes a SE GET product tree response body or ABTProducts GET response body in JSON format
|
||||
- Also needs the attribute to clear and the WSO2 environment and valid WSO2 bearer token for that environment
|
||||
- Performs the following operations:
|
||||
- Finds all productId's in the given product(tree) and for each productId found:
|
||||
- GETs productdetails via ABTProducts API
|
||||
- Converts it to PUT request body using the functionality in the previous section
|
||||
- Replaces <attributeToClear> with `null`
|
||||
- Actually sends the modified PUT request body to ABTProducts PUT API
|
||||
@@ -58,8 +58,8 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>21</source>
|
||||
<target>21</target>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
+55
@@ -3,8 +3,11 @@ package nl.htm.ovpay.abt;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Scanner;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -19,6 +22,15 @@ public class ABTProductsPUTGenerator {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ABTProductsPUTGenerator.class);
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
LOGGER.info("Starting ABTProductsPUTGenerator with arguments {}", Arrays.stream(args).toList());
|
||||
if (args.length > 0 && args[0].equalsIgnoreCase("clearAttribute")) {
|
||||
clearAttribute(args);
|
||||
} else {
|
||||
generateOutput(args);
|
||||
}
|
||||
}
|
||||
|
||||
private static void generateOutput(String[] args) throws Exception {
|
||||
if (args.length != 2) {
|
||||
LOGGER.info("To modify input/output path, use: java -jar ABTProductsPUTGenerator.jar <inputPath> <outputPath>");
|
||||
}
|
||||
@@ -40,6 +52,49 @@ public class ABTProductsPUTGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
private static void clearAttribute(String[] args) throws Exception {
|
||||
if (args.length != 5) {
|
||||
LOGGER.error("Incorrect input parameters!");
|
||||
LOGGER.error("To clear attribute, use: java -jar ABTProductsPUTGenerator.jar clearAttribute <inputPath> <attributeToClear> <environment> <wso2BearerToken>");
|
||||
return;
|
||||
}
|
||||
|
||||
var inputFile = args[1];
|
||||
var attributeToClear = args[2];
|
||||
var environment = args[3];
|
||||
var wso2BearerToken = args[4];
|
||||
|
||||
try (InputStream is = getInputStream(inputFile)) {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
JsonNode jsonNode = mapper.readTree(is);
|
||||
var productIds = jsonNode.findValues("productId").stream().filter(JsonNode::isValueNode).map(JsonNode::asText).toList();
|
||||
|
||||
LOGGER.info("Found productIds to process: {}", productIds);
|
||||
LOGGER.warn("Are you SURE you want to set attribute \"{}\" for all these productIds on environment {} to NULL?", attributeToClear, environment);
|
||||
LOGGER.warn("Type 'yes' to continue...");
|
||||
var input = new Scanner(System.in).nextLine();
|
||||
if (!input.equalsIgnoreCase("yes")) {
|
||||
LOGGER.info("Aborting...");
|
||||
return;
|
||||
}
|
||||
|
||||
for (var productId : productIds) {
|
||||
LOGGER.info("Getting product details for product {}...", productId);
|
||||
var productJsonString = APIHelper.getProductDetails(environment, productId, wso2BearerToken);
|
||||
var productJsonNode = mapper.readTree(productJsonString);
|
||||
var putJsonNode = processJsonNode(productJsonNode);
|
||||
LOGGER.info("Clearing attribute \"{}\" from product with productId {}...", attributeToClear, productId);
|
||||
((ObjectNode)putJsonNode).putRawValue(attributeToClear, null);
|
||||
|
||||
LOGGER.info("PUT product details for product with productId {} with cleared attribute \"{}\"...", productId, attributeToClear);
|
||||
LOGGER.info("PUT product details with JSON body: {}", putJsonNode.toPrettyString());
|
||||
APIHelper.putProductDetails(environment, productId, putJsonNode.toString(), wso2BearerToken);
|
||||
}
|
||||
|
||||
LOGGER.info("DONE clearing attribute \"{}\" for productIds {}!", attributeToClear, productIds);
|
||||
}
|
||||
}
|
||||
|
||||
private static InputStream getInputStream(String filePath) throws IOException {
|
||||
var externalResource = new File(filePath);
|
||||
if (externalResource.exists()) {
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
package nl.htm.ovpay.abt;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.StringJoiner;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLContext;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class APIHelper {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(APIHelper.class);
|
||||
private static final String PRODUCT_DETAILS_URI = "https://services.<ENV>.api.htm.nl/abt/abtproducts/1.0/products/<PRODUCTID>";
|
||||
|
||||
|
||||
public static String envToUriPart(String environment) {
|
||||
return switch (environment) {
|
||||
case "DEV" -> "dev";
|
||||
case "ACC" -> "acc";
|
||||
case "PRD" -> "";
|
||||
default -> throw new IllegalArgumentException("Invalid environment: " + environment);
|
||||
};
|
||||
}
|
||||
|
||||
public static String getProductDetails(String environment, String productId, String wso2BearerToken) throws Exception {
|
||||
var envUriPart = envToUriPart(environment);
|
||||
var getProductDetailsUri = PRODUCT_DETAILS_URI.replace("<ENV>", envUriPart).replace("<PRODUCTID>", productId);
|
||||
|
||||
SSLContext sc = SSLContext.getInstance("SSL");
|
||||
sc.init(null, DummyX509TrustManager.getDummyArray(), new java.security.SecureRandom());
|
||||
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
|
||||
|
||||
URL url = new URL(getProductDetailsUri);
|
||||
URLConnection con = url.openConnection();
|
||||
HttpURLConnection http = (HttpURLConnection)con;
|
||||
http.setRequestMethod("GET");
|
||||
http.setDoOutput(false);
|
||||
http.setRequestProperty("Authorization", "Bearer " + wso2BearerToken);
|
||||
http.connect();
|
||||
|
||||
try(InputStream is = http.getInputStream()) {
|
||||
return new String(is.readAllBytes(), StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
|
||||
public static void putProductDetails(String environment, String productId, String jsonBody, String wso2BearerToken) throws Exception {
|
||||
var envUriPart = envToUriPart(environment);
|
||||
var putProductDetailsUri = PRODUCT_DETAILS_URI.replace("<ENV>", envUriPart).replace("<PRODUCTID>", productId);
|
||||
|
||||
LOGGER.info("PUT product details to URI: {}", putProductDetailsUri);
|
||||
|
||||
SSLContext sc = SSLContext.getInstance("SSL");
|
||||
sc.init(null, DummyX509TrustManager.getDummyArray(), new java.security.SecureRandom());
|
||||
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
|
||||
|
||||
URL url = new URL(putProductDetailsUri);
|
||||
URLConnection con = url.openConnection();
|
||||
HttpURLConnection http = (HttpURLConnection)con;
|
||||
http.setRequestMethod("PUT");
|
||||
http.setDoOutput(true);
|
||||
http.setRequestProperty("Authorization", "Bearer " + wso2BearerToken);
|
||||
http.setRequestProperty("Content-Type", "application/json");
|
||||
|
||||
byte[] out = jsonBody.getBytes(StandardCharsets.UTF_8);
|
||||
int length = out.length;
|
||||
http.setFixedLengthStreamingMode(length);
|
||||
http.connect();
|
||||
|
||||
try(OutputStream os = http.getOutputStream()) {
|
||||
os.write(out);
|
||||
}
|
||||
|
||||
try(InputStream is = http.getInputStream()) {
|
||||
LOGGER.info("Got response from PUT API: {}", new String(is.readAllBytes(), StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package nl.htm.ovpay.abt;
|
||||
|
||||
import java.security.cert.X509Certificate;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
public final class DummyX509TrustManager implements X509TrustManager {
|
||||
|
||||
private static DummyX509TrustManager INSTANCE;
|
||||
|
||||
private DummyX509TrustManager() {
|
||||
// prevent instantiation
|
||||
}
|
||||
|
||||
public static DummyX509TrustManager getInstance() {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = new DummyX509TrustManager();
|
||||
}
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public static TrustManager[] getDummyArray() {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = new DummyX509TrustManager();
|
||||
}
|
||||
return new TrustManager[] { INSTANCE };
|
||||
}
|
||||
|
||||
public X509Certificate[] getAcceptedIssuers() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void checkClientTrusted(X509Certificate[] certs, String authType) {
|
||||
}
|
||||
|
||||
public void checkServerTrusted(X509Certificate[] certs, String authType) {
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,33 @@
|
||||
{
|
||||
"productId": 251,
|
||||
"fikoArticleNumber": null,
|
||||
"productId": 663,
|
||||
"parentProductId": null,
|
||||
"gboPackageTemplateId": "30901",
|
||||
"layerInfo": {
|
||||
"layerInfoId": 7,
|
||||
"choiceKey": "isRenewable",
|
||||
"choiceLabel": "Kies voor een doorlopend abonnement of een enkele termijn",
|
||||
"isCustomChoice": false
|
||||
},
|
||||
"fikoArticleNumber": null,
|
||||
"gboPackageTemplateId": "30001",
|
||||
"tapConnectProductCode": null,
|
||||
"productName": "MaxTestPOST-21-okt-test-1 edited PUT",
|
||||
"productDescription": "21-okt-test-1 edited PUT - reis met 90% korting gedurende de eerste F&F pilot!",
|
||||
"validityPeriod": null,
|
||||
"productTranslations": null,
|
||||
"productName": "Test OVPAY-2306",
|
||||
"productDescription": "Test OVPAY-2306 (sellingPeriods in kindje verwijderen en later opnieuw weer kunnen toevoegen)",
|
||||
"validityPeriod": {
|
||||
"validityPeriodId": 782,
|
||||
"fromInclusive": "2025-12-31T23:00:00.000Z",
|
||||
"toInclusive": "2026-03-30T22:00:00.000Z"
|
||||
},
|
||||
"productTranslations": [],
|
||||
"allowedGboAgeProfiles": [],
|
||||
"productOwner": {
|
||||
"productOwnerId": 1,
|
||||
"name": "Corneel Verstoep",
|
||||
"organization": "HTM"
|
||||
"name": "Wie dit leest",
|
||||
"organization": "... is een aap."
|
||||
},
|
||||
"marketSegments": null,
|
||||
"customerSegments": null,
|
||||
"allowedGboAgeProfiles": null,
|
||||
"marketSegments": [],
|
||||
"customerSegments": [],
|
||||
"productCategory": {
|
||||
"productCategoryId": 9,
|
||||
"productCategoryId": 1,
|
||||
"isTravelProduct": true,
|
||||
"name": "Kortingsabonnement"
|
||||
},
|
||||
@@ -25,32 +35,10 @@
|
||||
"requiredCustomerLevelId": 1,
|
||||
"name": "guest"
|
||||
},
|
||||
"requiredProducts": null,
|
||||
"incompatibleProducts": null,
|
||||
"mandatoryCustomerDataItems": [
|
||||
{
|
||||
"mandatoryCustomerDataItemId": 4,
|
||||
"customerDataItem": "emailAddress"
|
||||
},
|
||||
{
|
||||
"mandatoryCustomerDataItemId": 5,
|
||||
"customerDataItem": "address"
|
||||
}
|
||||
],
|
||||
"requiredGboPersonalAttributes": [
|
||||
{
|
||||
"requiredGboPersonalAttributeId": 1,
|
||||
"name": "NAME"
|
||||
},
|
||||
{
|
||||
"requiredGboPersonalAttributeId": 2,
|
||||
"name": "BIRTHDATE"
|
||||
},
|
||||
{
|
||||
"requiredGboPersonalAttributeId": 3,
|
||||
"name": "PHOTO"
|
||||
}
|
||||
],
|
||||
"requiredProducts": [],
|
||||
"incompatibleProducts": [],
|
||||
"mandatoryCustomerDataItems": [],
|
||||
"requiredGboPersonalAttributes": [],
|
||||
"tokenTypes": [
|
||||
{
|
||||
"tokenTypeId": 1,
|
||||
@@ -61,72 +49,36 @@
|
||||
"paymentMomentId": 1,
|
||||
"name": "prepaid"
|
||||
},
|
||||
"serviceOptions": null,
|
||||
"validityDuration": "P7D",
|
||||
"maxStartInFutureDuration": "P6W",
|
||||
"isRenewable": false,
|
||||
"serviceOptions": [
|
||||
{
|
||||
"serviceOptionId": 4,
|
||||
"action": "cancel_notAllowed",
|
||||
"description": "Stopzetting is niet toegestaan (doorgaans in combinatie met refund_notAllowed)"
|
||||
},
|
||||
{
|
||||
"serviceOptionId": 10,
|
||||
"action": "refund_notAllowed",
|
||||
"description": "Terugbetaling niet toegestaan (doorgaans in combinatie met cancel_notAllowed)"
|
||||
}
|
||||
],
|
||||
"validityDuration": "P1W",
|
||||
"maxStartInFutureDuration": "P1W",
|
||||
"isRenewable": null,
|
||||
"sendInvoice": false,
|
||||
"imageReference": "https://www.htm.nl/media/leif2leu/htm-logo-mobile.svg",
|
||||
"productPageUrl": "https://www.htm.nl/nog-onbekende-product-pagina",
|
||||
"termsUrl": "https://www.htm.nl/nog-onbekende-productvoorwaarden-pagina",
|
||||
"imageReference": null,
|
||||
"productPageUrl": null,
|
||||
"termsUrl": null,
|
||||
"isSellableAtHtm": true,
|
||||
"needsSolvencyCheckConsumer": false,
|
||||
"needsSolvencyCheckBusiness": false,
|
||||
"sellingPeriods": [
|
||||
{
|
||||
"sellingPeriodId": 240,
|
||||
"fromInclusive": "2024-09-06T00:00:00.000+00:00",
|
||||
"toInclusive": "2024-12-29T23:59:59.000+00:00",
|
||||
"sellingPeriodId": 1382,
|
||||
"fromInclusive": "2025-12-31T23:00:00.000Z",
|
||||
"toInclusive": "2026-03-30T22:00:00.000Z",
|
||||
"salesTouchpoint": {
|
||||
"salesTouchpointId": 6,
|
||||
"name": "Service-engine",
|
||||
"isActive": true,
|
||||
"retailer": {
|
||||
"retailerId": 1000,
|
||||
"name": "HTM intern beheer",
|
||||
"street": "Koningin Julianaplein",
|
||||
"number": 10,
|
||||
"numberAddition": null,
|
||||
"postalCode": "2595 AA",
|
||||
"city": "Den Haag",
|
||||
"country": "Nederland",
|
||||
"emailAddress": "info@htm.nl",
|
||||
"phoneNumber": "070 374 9002",
|
||||
"taxId": null,
|
||||
"imageReference": "https://www.htm.nl/typo3conf/ext/htm_template/Resources/Public/img/logo.svg"
|
||||
}
|
||||
},
|
||||
"forbiddenPaymentMethods": null,
|
||||
"sellingPrices": [
|
||||
{
|
||||
"sellingPriceId": 318,
|
||||
"taxCode": "V21",
|
||||
"taxPercentage": 21.0000,
|
||||
"amountExclTax": 94,
|
||||
"amountInclTax": 100,
|
||||
"fromInclusive": "2024-09-06T00:00:00.000+00:00",
|
||||
"toInclusive": "2024-12-18T23:59:59.000+00:00",
|
||||
"internalPrice": 92.0000
|
||||
},
|
||||
{
|
||||
"sellingPriceId": 319,
|
||||
"taxCode": "V21",
|
||||
"taxPercentage": 21.0000,
|
||||
"amountExclTax": 98,
|
||||
"amountInclTax": 102,
|
||||
"fromInclusive": "2024-12-19T00:00:00.000+00:00",
|
||||
"toInclusive": "2024-12-29T23:59:59.000+00:00",
|
||||
"internalPrice": 0.0000
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"sellingPeriodId": 241,
|
||||
"fromInclusive": "2024-09-06T00:00:00.000+00:00",
|
||||
"toInclusive": "2024-12-29T23:59:59.000+00:00",
|
||||
"salesTouchpoint": {
|
||||
"salesTouchpointId": 5,
|
||||
"name": "Servicewinkel (Team Incident Masters)",
|
||||
"salesTouchpointId": 3,
|
||||
"name": "Website",
|
||||
"isActive": true,
|
||||
"retailer": {
|
||||
"retailerId": 1001,
|
||||
@@ -139,64 +91,196 @@
|
||||
"country": "Nederland",
|
||||
"emailAddress": "info@htm.nl",
|
||||
"phoneNumber": "070 374 9002",
|
||||
"taxId": null,
|
||||
"imageReference": "https://www.htm.nl/typo3conf/ext/htm_template/Resources/Public/img/logo.svg"
|
||||
"taxId": 572309345923,
|
||||
"imageReference": "https://www.htm.nl/media/leif2leu/htm-logo-mobile.svg"
|
||||
}
|
||||
},
|
||||
"forbiddenPaymentMethods": [
|
||||
{
|
||||
"forbiddenPaymentMethodId": 2,
|
||||
"name": "creditcard",
|
||||
"issuer": "Visa"
|
||||
"forbiddenPaymentMethods": [],
|
||||
"sellingPrices": []
|
||||
}
|
||||
],
|
||||
"sellingPrices": [
|
||||
"purchasePrices": [],
|
||||
"productVariants": [
|
||||
{
|
||||
"sellingPriceId": 320,
|
||||
"taxCode": "V21",
|
||||
"taxPercentage": 21.0000,
|
||||
"amountExclTax": 94,
|
||||
"amountInclTax": 100,
|
||||
"fromInclusive": "2024-09-06T00:00:00.000+00:00",
|
||||
"toInclusive": "2024-12-18T23:59:59.000+00:00",
|
||||
"internalPrice": 92.0000
|
||||
"productId": 664,
|
||||
"parentProductId": 663,
|
||||
"layerInfo": {
|
||||
"layerInfoId": null,
|
||||
"choiceKey": null,
|
||||
"choiceLabel": null,
|
||||
"isCustomChoice": false
|
||||
},
|
||||
"fikoArticleNumber": null,
|
||||
"gboPackageTemplateId": "30001",
|
||||
"tapConnectProductCode": null,
|
||||
"productName": "Losse week - Test OVPAY-2306",
|
||||
"productDescription": "Test OVPAY-2306 (sellingPeriods in kindje verwijderen en later opnieuw weer kunnen toevoegen)",
|
||||
"validityPeriod": {
|
||||
"validityPeriodId": 783,
|
||||
"fromInclusive": "2025-12-31T23:00:00.000Z",
|
||||
"toInclusive": "2026-03-30T22:00:00.000Z"
|
||||
},
|
||||
"productTranslations": [],
|
||||
"allowedGboAgeProfiles": [],
|
||||
"productOwner": {
|
||||
"productOwnerId": 1,
|
||||
"name": "Wie dit leest",
|
||||
"organization": "... is een aap."
|
||||
},
|
||||
"marketSegments": [],
|
||||
"customerSegments": [],
|
||||
"productCategory": {
|
||||
"productCategoryId": 1,
|
||||
"isTravelProduct": true,
|
||||
"name": "Kortingsabonnement"
|
||||
},
|
||||
"requiredCustomerLevel": {
|
||||
"requiredCustomerLevelId": 1,
|
||||
"name": "guest"
|
||||
},
|
||||
"requiredProducts": [],
|
||||
"incompatibleProducts": [],
|
||||
"mandatoryCustomerDataItems": [],
|
||||
"requiredGboPersonalAttributes": [],
|
||||
"tokenTypes": [
|
||||
{
|
||||
"tokenTypeId": 1,
|
||||
"name": "EMV"
|
||||
}
|
||||
],
|
||||
"paymentMoment": {
|
||||
"paymentMomentId": 1,
|
||||
"name": "prepaid"
|
||||
},
|
||||
"serviceOptions": [
|
||||
{
|
||||
"serviceOptionId": 4,
|
||||
"action": "cancel_notAllowed",
|
||||
"description": "Stopzetting is niet toegestaan (doorgaans in combinatie met refund_notAllowed)"
|
||||
},
|
||||
{
|
||||
"sellingPriceId": 321,
|
||||
"taxCode": "V21",
|
||||
"taxPercentage": 21.0000,
|
||||
"amountExclTax": 98,
|
||||
"amountInclTax": 102,
|
||||
"fromInclusive": "2024-12-19T00:00:00.000+00:00",
|
||||
"toInclusive": "2024-12-29T23:59:59.000+00:00",
|
||||
"internalPrice": 0.0000
|
||||
}
|
||||
]
|
||||
"serviceOptionId": 10,
|
||||
"action": "refund_notAllowed",
|
||||
"description": "Terugbetaling niet toegestaan (doorgaans in combinatie met cancel_notAllowed)"
|
||||
}
|
||||
],
|
||||
"purchasePrices": [
|
||||
"validityDuration": "P1W",
|
||||
"maxStartInFutureDuration": "P1W",
|
||||
"isRenewable": false,
|
||||
"sendInvoice": false,
|
||||
"imageReference": null,
|
||||
"productPageUrl": null,
|
||||
"termsUrl": null,
|
||||
"isSellableAtHtm": true,
|
||||
"needsSolvencyCheckConsumer": false,
|
||||
"needsSolvencyCheckBusiness": false,
|
||||
"sellingPeriods": [
|
||||
{
|
||||
"purchasePriceId": 184,
|
||||
"taxCode": "V21",
|
||||
"taxPercentage": 21.0000,
|
||||
"amountExclTax": 0,
|
||||
"amountInclTax": 0,
|
||||
"fromInclusive": "2024-09-01T00:00:00.000+00:00",
|
||||
"toInclusive": "2024-12-31T23:59:59.000+00:00"
|
||||
"sellingPeriodId": 1384,
|
||||
"fromInclusive": "2025-12-31T23:00:00.000Z",
|
||||
"toInclusive": "2026-03-30T22:00:00.000Z",
|
||||
"salesTouchpoint": {
|
||||
"salesTouchpointId": 3,
|
||||
"name": "Website",
|
||||
"isActive": true,
|
||||
"retailer": {
|
||||
"retailerId": 1001,
|
||||
"name": "HTM externe touchpoints",
|
||||
"street": "Koningin Julianaplein",
|
||||
"number": 10,
|
||||
"numberAddition": null,
|
||||
"postalCode": "2595 AA",
|
||||
"city": "Den Haag",
|
||||
"country": "Nederland",
|
||||
"emailAddress": "info@htm.nl",
|
||||
"phoneNumber": "070 374 9002",
|
||||
"taxId": 572309345923,
|
||||
"imageReference": "https://www.htm.nl/media/leif2leu/htm-logo-mobile.svg"
|
||||
}
|
||||
},
|
||||
"forbiddenPaymentMethods": [],
|
||||
"sellingPrices": []
|
||||
}
|
||||
],
|
||||
"auditTrail": [
|
||||
{
|
||||
"auditTrailId": 228,
|
||||
"action": "update",
|
||||
"user": "api",
|
||||
"timestamp": "2024-10-21T09:00:30.410+00:00"
|
||||
"purchasePrices": [],
|
||||
"productVariants": []
|
||||
},
|
||||
{
|
||||
"auditTrailId": 227,
|
||||
"action": "insert",
|
||||
"user": "api",
|
||||
"timestamp": "2024-10-21T08:58:39.237+00:00"
|
||||
"productId": 665,
|
||||
"parentProductId": 663,
|
||||
"layerInfo": {
|
||||
"layerInfoId": null,
|
||||
"choiceKey": null,
|
||||
"choiceLabel": null,
|
||||
"isCustomChoice": false
|
||||
},
|
||||
"fikoArticleNumber": null,
|
||||
"gboPackageTemplateId": "30001",
|
||||
"tapConnectProductCode": null,
|
||||
"productName": "Doorlopend - Test OVPAY-2306",
|
||||
"productDescription": "Test OVPAY-2306 (sellingPeriods in kindje verwijderen en later opnieuw weer kunnen toevoegen)",
|
||||
"validityPeriod": {
|
||||
"validityPeriodId": 784,
|
||||
"fromInclusive": "2025-12-31T23:00:00.000Z",
|
||||
"toInclusive": "2026-03-30T22:00:00.000Z"
|
||||
},
|
||||
"productTranslations": [],
|
||||
"allowedGboAgeProfiles": [],
|
||||
"productOwner": {
|
||||
"productOwnerId": 1,
|
||||
"name": "Wie dit leest",
|
||||
"organization": "... is een aap."
|
||||
},
|
||||
"marketSegments": [],
|
||||
"customerSegments": [],
|
||||
"productCategory": {
|
||||
"productCategoryId": 1,
|
||||
"isTravelProduct": true,
|
||||
"name": "Kortingsabonnement"
|
||||
},
|
||||
"requiredCustomerLevel": {
|
||||
"requiredCustomerLevelId": 1,
|
||||
"name": "guest"
|
||||
},
|
||||
"requiredProducts": [],
|
||||
"incompatibleProducts": [],
|
||||
"mandatoryCustomerDataItems": [],
|
||||
"requiredGboPersonalAttributes": [],
|
||||
"tokenTypes": [
|
||||
{
|
||||
"tokenTypeId": 1,
|
||||
"name": "EMV"
|
||||
}
|
||||
],
|
||||
"paymentMoment": {
|
||||
"paymentMomentId": 1,
|
||||
"name": "prepaid"
|
||||
},
|
||||
"serviceOptions": [
|
||||
{
|
||||
"serviceOptionId": 4,
|
||||
"action": "cancel_notAllowed",
|
||||
"description": "Stopzetting is niet toegestaan (doorgaans in combinatie met refund_notAllowed)"
|
||||
},
|
||||
{
|
||||
"serviceOptionId": 10,
|
||||
"action": "refund_notAllowed",
|
||||
"description": "Terugbetaling niet toegestaan (doorgaans in combinatie met cancel_notAllowed)"
|
||||
}
|
||||
],
|
||||
"validityDuration": "P1W",
|
||||
"maxStartInFutureDuration": "P1W",
|
||||
"isRenewable": true,
|
||||
"sendInvoice": false,
|
||||
"imageReference": null,
|
||||
"productPageUrl": null,
|
||||
"termsUrl": null,
|
||||
"isSellableAtHtm": true,
|
||||
"needsSolvencyCheckConsumer": false,
|
||||
"needsSolvencyCheckBusiness": false,
|
||||
"sellingPeriods": [],
|
||||
"purchasePrices": [],
|
||||
"productVariants": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -17,10 +17,10 @@ paths:
|
||||
description: >
|
||||
Create a claim by sending a JSON as specified in the schema. By
|
||||
specifying the chipcardnumber under 'chipkaart',
|
||||
|
||||
a claim for OV chipcard will be send to the OVC API. If no
|
||||
chipcardnumber is specified under 'chipkaart', a claim for EMV is send
|
||||
to mendix.
|
||||
a claim for OV chipcard will be sent to the OVC API. If no
|
||||
chipcardnumber is specified under 'chipkaart', a claim for EMV/OV-pas is sent
|
||||
to Mendix, where it can be handled according to the fields present
|
||||
(serviceRefId + totaalbedrag or ovPasNumber + verificationCode)
|
||||
parameters: []
|
||||
requestBody:
|
||||
content:
|
||||
@@ -47,8 +47,6 @@ paths:
|
||||
toelichting: string
|
||||
lijn: '1'
|
||||
vervoertype: '1'
|
||||
serviceRefId: '1'
|
||||
Totaalbedrag: 0
|
||||
EMV:
|
||||
value:
|
||||
aankomsthalte: '1'
|
||||
@@ -67,8 +65,28 @@ paths:
|
||||
toelichting: string
|
||||
lijn: '1'
|
||||
vervoertype: '1'
|
||||
serviceRefId: '1'
|
||||
Totaalbedrag: 0
|
||||
serviceRefId: 'NLOV1234567ABCDEFG'
|
||||
totaalbedrag: 3.14
|
||||
OV-pas:
|
||||
value:
|
||||
aankomsthalte: '1'
|
||||
instapdatum: '2024-03-06T15:20:44.549Z'
|
||||
instaptijd: '2024-03-06T15:20:44.549Z'
|
||||
ingecheckt: true
|
||||
uitgecheckt: true
|
||||
afgeschrevenbedrag: 0
|
||||
vertrekhalte: string
|
||||
korting: true
|
||||
iban: '1234123412341234'
|
||||
naam: string
|
||||
emailadres: user@example.com
|
||||
uitstaptijd: '2024-03-06T15:20:44.549Z'
|
||||
verwachtbedrag: 0
|
||||
toelichting: string
|
||||
lijn: '1'
|
||||
vervoertype: '1'
|
||||
ovPasNumber: '63AW974'
|
||||
verificationCode: '2FQ8'
|
||||
responses:
|
||||
'200':
|
||||
description: ok
|
||||
@@ -103,18 +121,19 @@ paths:
|
||||
examples:
|
||||
EMV:
|
||||
value:
|
||||
emailAddress: 'j.beek@htm.nl'
|
||||
emailAddress: 'stasjo@htm.nl'
|
||||
orderNumber: 'ORD1000046'
|
||||
serviceReferenceId: 'NLOVA5BCD124H3Z21X'
|
||||
amount: 2305
|
||||
iban: 'NL98INGB0003856625'
|
||||
orderDate: '2025-01-13'
|
||||
productName: 'HTM 20% korting'
|
||||
OVpas:
|
||||
OV-pas:
|
||||
value:
|
||||
emailAddress: 'j.beek@htm.nl'
|
||||
emailAddress: 'stasjo@htm.nl'
|
||||
orderNumber: 'ORD1000046'
|
||||
ovpasNumber: '63AW974'
|
||||
verificationCode: '2FQ8'
|
||||
iban: 'NL98INGB0003856625'
|
||||
orderDate: '2025-01-13'
|
||||
productName: 'HTM 20% korting'
|
||||
@@ -181,7 +200,7 @@ components:
|
||||
iban:
|
||||
type: string
|
||||
description: String of length between 15 en 32 characters
|
||||
example: '1234123412341234'
|
||||
example: NL98INGB0003856625
|
||||
naam:
|
||||
type: string
|
||||
emailadres:
|
||||
@@ -201,9 +220,16 @@ components:
|
||||
type: string
|
||||
serviceRefId:
|
||||
type: string
|
||||
Totaalbedrag:
|
||||
example: NLOV1234567ABCDEFG
|
||||
totaalbedrag:
|
||||
type: number
|
||||
format: float
|
||||
ovPasNumber:
|
||||
type: string
|
||||
example: 63AW974
|
||||
verificationCode:
|
||||
type: string
|
||||
example: 2FQ8
|
||||
refundsEntity:
|
||||
required:
|
||||
- emailAddress
|
||||
@@ -213,7 +239,7 @@ components:
|
||||
emailAddress:
|
||||
type: string
|
||||
format: email
|
||||
example: j.beek@htm.nl
|
||||
example: stasjo@htm.nl
|
||||
orderNumber:
|
||||
type: string
|
||||
example: ORD1000046
|
||||
@@ -226,6 +252,9 @@ components:
|
||||
ovpasNumber:
|
||||
type: string
|
||||
example: 63AW974
|
||||
verificationCode:
|
||||
type: string
|
||||
example: 2FQ8
|
||||
iban:
|
||||
type: string
|
||||
example: NL00RABO000001337
|
||||
|
||||
@@ -386,10 +386,10 @@ paths:
|
||||
"refundAmount": 2489,
|
||||
"refundMethods": ["creditInvoice", "iDeal"],
|
||||
}
|
||||
Unsuccesful validation:
|
||||
summary: Unsuccesful validation
|
||||
Unsuccessful validation:
|
||||
summary: Unsuccessful validation
|
||||
description: |
|
||||
Unsuccesful validation. The response contains the error message.
|
||||
Unsuccessful validation. The response contains the error message.
|
||||
value:
|
||||
{
|
||||
"validationResult": false,
|
||||
@@ -574,6 +574,267 @@ paths:
|
||||
},
|
||||
},
|
||||
}
|
||||
/contracts/{uuid}/changemoments:
|
||||
parameters:
|
||||
- in: header
|
||||
name: X-HTM-JWT-AUTH-HEADER
|
||||
schema:
|
||||
type: string
|
||||
example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
|
||||
required: true
|
||||
description: The JWT of the logged in customer.
|
||||
- in: path
|
||||
name: uuid
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
example: 9e224750-3065-471d-af57-85b9cffa7c89
|
||||
required: true
|
||||
description: The id of the contract to process.
|
||||
get:
|
||||
summary: Get all change moments for a given contract.
|
||||
description: Get all change moments for a given contract.
|
||||
tags:
|
||||
- SE Contract Changes v2
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
examples:
|
||||
All change moments of a contract:
|
||||
summary: All change moments of a contract
|
||||
description: |
|
||||
All change moments of a contract. The response contains the
|
||||
allowed change moments for the current contract term.
|
||||
value:
|
||||
{
|
||||
"changeMoment": "termBound",
|
||||
"termDuration": "P1M",
|
||||
"billingDay": 18,
|
||||
"changeFrom": "2024-08-10T00:00:00",
|
||||
"changeUntil": "2024-08-10T03:59:59",
|
||||
}
|
||||
/contracts/{uuid}/changevalidation:
|
||||
parameters:
|
||||
- in: header
|
||||
name: X-HTM-JWT-AUTH-HEADER
|
||||
schema:
|
||||
type: string
|
||||
example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
|
||||
required: true
|
||||
description: The JWT of the logged in customer.
|
||||
- in: path
|
||||
name: uuid
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
example: 9e224750-3065-471d-af57-85b9cffa7c89
|
||||
required: true
|
||||
description: The id of the contract to process.
|
||||
post:
|
||||
summary: Validate a change for a given contract.
|
||||
description: Validate a change for a given contract.
|
||||
tags:
|
||||
- SE Contract Changes v2
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
examples:
|
||||
Validate a change to another product:
|
||||
summary: Validate a change to another product
|
||||
description: |
|
||||
Validate a change to another product. The response contains the allowed change moments for the current contract term.
|
||||
value: { "productId": 124, "startDate": "2025-10-08" }
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
examples:
|
||||
Successfully validated change:
|
||||
summary: Successfully validated change
|
||||
description: |
|
||||
Successfully validated a change. The response contains the allowed change moments for the current contract term.
|
||||
value:
|
||||
{
|
||||
"validationResult": true,
|
||||
"validationMessage": "",
|
||||
"contract":
|
||||
{
|
||||
"contractId": "15b43d9b-367a-4952-87f6-3e0fa902486f",
|
||||
"contractNumber": "D123456",
|
||||
"customerProfileId": 42,
|
||||
"orderId": "eb3d08f7-7feb-4f31-9f5b-daa634e51f48",
|
||||
"orderLineId": "52efbbfc-8c28-4016-9ece-dc3ef9a70bd8",
|
||||
"touchpointId": 2,
|
||||
"contractStatus":
|
||||
{ "contractStatusId": 2, "name": "active" },
|
||||
"productId": 1,
|
||||
"productName": "HTM Maand 20% korting",
|
||||
"termDuration": "P0Y1M0D",
|
||||
"billingDay": 15,
|
||||
"highestInvoiceTerm": 1,
|
||||
"created": "2024-08-01 15:01:00.000",
|
||||
"ovPayTokenId": 1337,
|
||||
"contractVersions":
|
||||
[
|
||||
{
|
||||
"contractVersionId": 2,
|
||||
"termsAndConditions": "https://www.htm.nl",
|
||||
"productId": 124,
|
||||
"productName": "Regiovrij Regio Centrum",
|
||||
"taxCode": "V9",
|
||||
"taxPercentage": 9.0,
|
||||
"termAmountInclTax": 12,
|
||||
"start": "2025-10-08",
|
||||
},
|
||||
{
|
||||
"contractVersionId": 1,
|
||||
"termsAndConditions": "https://www.htm.nl",
|
||||
"productId": 123,
|
||||
"productName": "Regiovrij Regio Zuid",
|
||||
"taxCode": "V9",
|
||||
"taxPercentage": 9.0,
|
||||
"termAmountInclTax": 10,
|
||||
"start": "2025-01-08",
|
||||
"end": "2025-10-07",
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
Unsuccessful validation:
|
||||
summary: Unsuccessful validation
|
||||
description: |
|
||||
Unsuccessful validation. The response contains the error message.
|
||||
value:
|
||||
{
|
||||
"validationResult": false,
|
||||
"validationMessage": "Contract status is not ACTIVE",
|
||||
"contract": null,
|
||||
}
|
||||
/contracts/{uuid}/change:
|
||||
parameters:
|
||||
- in: header
|
||||
name: X-HTM-JWT-AUTH-HEADER
|
||||
schema:
|
||||
type: string
|
||||
example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
|
||||
required: true
|
||||
description: The JWT of the logged in customer.
|
||||
- in: path
|
||||
name: uuid
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
example: 9e224750-3065-471d-af57-85b9cffa7c89
|
||||
required: true
|
||||
description: The id of the contract to process.
|
||||
post:
|
||||
summary: Change a contract.
|
||||
description: Change a contract.
|
||||
tags:
|
||||
- SE Contract Changes v2
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
examples:
|
||||
Change to another product:
|
||||
summary: Change to another product
|
||||
description: |
|
||||
Change to another product. The response contains the details of the changed contract.
|
||||
value: { "productId": 124, "startDate": "2025-10-08" }
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
examples:
|
||||
Successfully changed contract:
|
||||
summary: Successfully changed contract
|
||||
description: |
|
||||
Successfully changed a contract. The response contains the details of the changed contract.
|
||||
value:
|
||||
{
|
||||
"contractId": "15b43d9b-367a-4952-87f6-3e0fa902486f",
|
||||
"contractNumber": "D123456",
|
||||
"customerProfileId": 42,
|
||||
"orderId": "eb3d08f7-7feb-4f31-9f5b-daa634e51f48",
|
||||
"orderLineId": "52efbbfc-8c28-4016-9ece-dc3ef9a70bd8",
|
||||
"touchpointId": 2,
|
||||
"contractStatus":
|
||||
{ "contractStatusId": 2, "name": "active" },
|
||||
"productId": 1,
|
||||
"productName": "HTM Maand 20% korting",
|
||||
"termDuration": "P0Y1M0D",
|
||||
"billingDay": 15,
|
||||
"highestInvoiceTerm": 1,
|
||||
"created": "2024-08-01 15:01:00.000",
|
||||
"ovPayTokenId": 1337,
|
||||
"contractVersions":
|
||||
[
|
||||
{
|
||||
"contractVersionId": 2,
|
||||
"termsAndConditions": "https://www.htm.nl",
|
||||
"productId": 124,
|
||||
"productName": "Regiovrij Regio Centrum",
|
||||
"taxCode": "V9",
|
||||
"taxPercentage": 9.0,
|
||||
"termAmountInclTax": 12,
|
||||
"start": "2025-10-08",
|
||||
},
|
||||
{
|
||||
"contractVersionId": 1,
|
||||
"termsAndConditions": "https://www.htm.nl",
|
||||
"productId": 123,
|
||||
"productName": "Regiovrij Regio Zuid",
|
||||
"taxCode": "V9",
|
||||
"taxPercentage": 9.0,
|
||||
"termAmountInclTax": 10,
|
||||
"start": "2025-01-08",
|
||||
"end": "2025-10-07",
|
||||
},
|
||||
],
|
||||
}
|
||||
"400":
|
||||
description: Bad Request
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
examples:
|
||||
Unsuccessful change due to invalid productId:
|
||||
summary: Unsuccessful change due to invalid productId
|
||||
description: |
|
||||
Unsuccessful change due to invalid productId. The response contains the error message.
|
||||
value:
|
||||
{
|
||||
"type": "https://htm.nl/api/v1/probs/validationerror",
|
||||
"title": "Your request is not valid.",
|
||||
"detail": "The chosen parameters for this contract change are not valid.",
|
||||
"instance": "urn:uuid:4017fabc-1b28-11e8-accf-0ed5f89f718b",
|
||||
"errors":
|
||||
[
|
||||
{
|
||||
"code": "CHANGE_DATE_IN_THE_PAST",
|
||||
"detail": "Chosen date of contract change is in the past. This is not alllowed.",
|
||||
"path": "$.startDate",
|
||||
"parameter": null,
|
||||
},
|
||||
],
|
||||
}
|
||||
/contractpayments:
|
||||
parameters:
|
||||
- in: header
|
||||
@@ -597,9 +858,13 @@ paths:
|
||||
schema:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
examples:
|
||||
List all contract payments for a single debtor:
|
||||
summary: List all contract payments for a single debtor
|
||||
description: List all contract payments for single debtor with debtor number 'D123456'.
|
||||
Empty list:
|
||||
summary: Empty list
|
||||
description: List all contract payments for a debtor with no payments.
|
||||
value: { "contractPayments": [] }
|
||||
Successful direct debit:
|
||||
summary: Successful direct debit
|
||||
description: One payment for a debtor with a successful direct debit.
|
||||
value:
|
||||
{
|
||||
"contractPayments":
|
||||
@@ -607,8 +872,133 @@ paths:
|
||||
{
|
||||
"paymentId": "151845776",
|
||||
"totalAmount": "26.62",
|
||||
"paymentMethod": "Twikey",
|
||||
"paymentMethod": "Automatische incasso",
|
||||
"paymentDate": "2024-09-12",
|
||||
"iban": "NL25INGB******1337",
|
||||
"invoice":
|
||||
{
|
||||
"invoiceId": "147722263",
|
||||
"invoiceNumber": "F2024-0001",
|
||||
"description": "HTM Maandkorting 20%",
|
||||
"publicLink": "https://factuurinzien.nl/d/b0aac3f42f325f5dd6abc172f723caab5956524d/i/ddb245d6df67999eca48c4a71b5661b93038e20a",
|
||||
},
|
||||
"_links":
|
||||
{
|
||||
"get_contractdetails":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/customers/contracts/5ca46c1a-cb9d-4c2d-960e-4471e8e28b6a",
|
||||
"method": "GET",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
Direct debit reversal:
|
||||
summary: Direct debit reversal
|
||||
description: One payment for a debtor with a reversed direct debit.
|
||||
value:
|
||||
{
|
||||
"contractPayments":
|
||||
[
|
||||
{
|
||||
"paymentId": "151845776",
|
||||
"totalAmount": "-26.62",
|
||||
"paymentMethod": "Stornering",
|
||||
"paymentDate": "2024-09-12",
|
||||
"iban": "NL25INGB******1337",
|
||||
"invoice":
|
||||
{
|
||||
"invoiceId": "147722263",
|
||||
"invoiceNumber": "F2024-0001",
|
||||
"description": "HTM Maandkorting 20%",
|
||||
"publicLink": "https://factuurinzien.nl/d/b0aac3f42f325f5dd6abc172f723caab5956524d/i/ddb245d6df67999eca48c4a71b5661b93038e20a",
|
||||
},
|
||||
"_links":
|
||||
{
|
||||
"get_contractdetails":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/customers/contracts/5ca46c1a-cb9d-4c2d-960e-4471e8e28b6a",
|
||||
"method": "GET",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
iDEAL payment:
|
||||
summary: iDEAL payment
|
||||
description: One payment for a debtor with an iDEAL payment.
|
||||
value:
|
||||
{
|
||||
"contractPayments":
|
||||
[
|
||||
{
|
||||
"paymentId": "151845776",
|
||||
"totalAmount": "26.62",
|
||||
"paymentMethod": "iDEAL",
|
||||
"paymentDate": "2024-09-12",
|
||||
"iban": "NL25INGB******1337",
|
||||
"invoice":
|
||||
{
|
||||
"invoiceId": "147722263",
|
||||
"invoiceNumber": "F2024-0001",
|
||||
"description": "HTM Maandkorting 20%",
|
||||
"publicLink": "https://factuurinzien.nl/d/b0aac3f42f325f5dd6abc172f723caab5956524d/i/ddb245d6df67999eca48c4a71b5661b93038e20a",
|
||||
},
|
||||
"_links":
|
||||
{
|
||||
"get_contractdetails":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/customers/contracts/5ca46c1a-cb9d-4c2d-960e-4471e8e28b6a",
|
||||
"method": "GET",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
Bank transfer:
|
||||
summary: Bank transfer
|
||||
description: One payment for a debtor with a bank transfer.
|
||||
value:
|
||||
{
|
||||
"contractPayments":
|
||||
[
|
||||
{
|
||||
"paymentId": "151845776",
|
||||
"totalAmount": "26.62",
|
||||
"paymentMethod": "Overboeking",
|
||||
"paymentDate": "2024-09-12",
|
||||
"iban": "NL25INGB******1337",
|
||||
"invoice":
|
||||
{
|
||||
"invoiceId": "147722263",
|
||||
"invoiceNumber": "F2024-0001",
|
||||
"description": "HTM Maandkorting 20%",
|
||||
"publicLink": "https://factuurinzien.nl/d/b0aac3f42f325f5dd6abc172f723caab5956524d/i/ddb245d6df67999eca48c4a71b5661b93038e20a",
|
||||
},
|
||||
"_links":
|
||||
{
|
||||
"get_contractdetails":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/customers/contracts/5ca46c1a-cb9d-4c2d-960e-4471e8e28b6a",
|
||||
"method": "GET",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
List of four payments for one invoice:
|
||||
summary: List of four payments for one invoice
|
||||
description: Four payments for a debtor for one invoice; a direct debit, a direct debit reversal, a bank transfer and an iDEAL payment.
|
||||
value:
|
||||
{
|
||||
"contractPayments":
|
||||
[
|
||||
{
|
||||
"paymentId": "151845776",
|
||||
"totalAmount": "26.62",
|
||||
"paymentMethod": "Automatische incasso",
|
||||
"paymentDate": "2024-09-12",
|
||||
"iban": "NL25INGB******1337",
|
||||
"invoice":
|
||||
{
|
||||
"invoiceId": "147722263",
|
||||
@@ -626,22 +1016,67 @@ paths:
|
||||
},
|
||||
},
|
||||
{
|
||||
"paymentId": "151845851",
|
||||
"totalAmount": "45.21",
|
||||
"paymentMethod": "Twikey",
|
||||
"paymentId": "151845776",
|
||||
"totalAmount": "-26.62",
|
||||
"paymentMethod": "Stornering",
|
||||
"paymentDate": "2024-09-12",
|
||||
"iban": "NL25INGB******1337",
|
||||
"invoice":
|
||||
{
|
||||
"invoiceId": "147722266",
|
||||
"invoiceNumber": "F2024-0002",
|
||||
"invoiceId": "147722263",
|
||||
"invoiceNumber": "F2024-0001",
|
||||
"description": "HTM Maandkorting 20%",
|
||||
"publicLink": "https://factuurinzien.nl/d/ddb245d6df67999eca48c4a71b5661b93038e20a/i/dp5h1i5cuu94nopiolkdst3u17vkmzo",
|
||||
"publicLink": "https://factuurinzien.nl/d/b0aac3f42f325f5dd6abc172f723caab5956524d/i/ddb245d6df67999eca48c4a71b5661b93038e20a",
|
||||
},
|
||||
"_links":
|
||||
{
|
||||
"get_contractdetails":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/customers/contracts/7b2f8c1a-3d9d-4c2d-960e-4471e8e28b6a",
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/customers/contracts/5ca46c1a-cb9d-4c2d-960e-4471e8e28b6a",
|
||||
"method": "GET",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"paymentId": "151845777",
|
||||
"totalAmount": "10.00",
|
||||
"paymentMethod": "Overboeking",
|
||||
"paymentDate": "2024-09-13",
|
||||
"iban": "NL25INGB******1337",
|
||||
"invoice":
|
||||
{
|
||||
"invoiceId": "147722263",
|
||||
"invoiceNumber": "F2024-0001",
|
||||
"description": "HTM Maandkorting 20%",
|
||||
"publicLink": "https://factuurinzien.nl/d/b0aac3f42f325f5dd6abc172f723caab5956524d/i/ddb245d6df67999eca48c4a71b5661b93038e20a",
|
||||
},
|
||||
"_links":
|
||||
{
|
||||
"get_contractdetails":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/customers/contracts/5ca46c1a-cb9d-4c2d-960e-4471e8e28b6a",
|
||||
"method": "GET",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"paymentId": "151845778",
|
||||
"totalAmount": "16.62",
|
||||
"paymentMethod": "iDEAL",
|
||||
"paymentDate": "2024-09-14",
|
||||
"iban": "NL25INGB******1337",
|
||||
"invoice":
|
||||
{
|
||||
"invoiceId": "147722263",
|
||||
"invoiceNumber": "F2024-0001",
|
||||
"description": "HTM Maandkorting 20%",
|
||||
"publicLink": "https://factuurinzien.nl/d/b0aac3f42f325f5dd6abc172f723caab5956524d/i/ddb245d6df67999eca48c4a71b5661b93038e20a",
|
||||
},
|
||||
"_links":
|
||||
{
|
||||
"get_contractdetails":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/customers/contracts/5ca46c1a-cb9d-4c2d-960e-4471e8e28b6a",
|
||||
"method": "GET",
|
||||
},
|
||||
},
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -187,21 +187,25 @@ paths:
|
||||
examples:
|
||||
minimalCustomerProfile:
|
||||
value:
|
||||
{ "person": { "emailAddress": "j.jansen@hatseflats.nl" } }
|
||||
{
|
||||
"person": {
|
||||
"emailAddress": "j.jansen@hatseflats.nl"
|
||||
}
|
||||
}
|
||||
fullCustomerProfile:
|
||||
value:
|
||||
{
|
||||
"customerPreference": { "languageId": 1 },
|
||||
"person":
|
||||
{
|
||||
"customerPreference": {
|
||||
"languageId": 1
|
||||
},
|
||||
"person": {
|
||||
"birthname": "Jan",
|
||||
"surname": "Jansen",
|
||||
"prefix": "dhr",
|
||||
"suffix": "jr",
|
||||
"dateOfBirth": "1970-01-01",
|
||||
"emailAddress": "j.jansen@hatseflats.nl",
|
||||
"addresses":
|
||||
[
|
||||
"addresses": [
|
||||
{
|
||||
"street": "Laan van Meerdervoort",
|
||||
"houseNumber": 5,
|
||||
@@ -210,7 +214,7 @@ paths:
|
||||
"city": "Den Haag",
|
||||
"country": "NL",
|
||||
"isPreferred": true,
|
||||
"addressTypeId": 1,
|
||||
"addressTypeId": 1
|
||||
},
|
||||
{
|
||||
"street": "Beeklaan",
|
||||
@@ -220,26 +224,24 @@ paths:
|
||||
"city": "Den Haag",
|
||||
"country": "NL",
|
||||
"isPreferred": false,
|
||||
"addressTypeId": 2,
|
||||
},
|
||||
"addressTypeId": 2
|
||||
}
|
||||
],
|
||||
"phones":
|
||||
[
|
||||
"phones": [
|
||||
{
|
||||
"number": "6123456789",
|
||||
"countryCode": "0031",
|
||||
"phoneTypeId": 1,
|
||||
"isPreferred": true,
|
||||
"isPreferred": true
|
||||
},
|
||||
{
|
||||
"number": "7012345678",
|
||||
"countryCode": "0031",
|
||||
"phoneTypeId": 2,
|
||||
"isPreferred": false,
|
||||
},
|
||||
"isPreferred": false
|
||||
}
|
||||
],
|
||||
"devices":
|
||||
[
|
||||
"devices": [
|
||||
{
|
||||
"externalDeviceId": "123e4567-e89b-12d3-a456-426614174000",
|
||||
"alias": "My iPhone",
|
||||
@@ -247,9 +249,9 @@ paths:
|
||||
{
|
||||
"externalDeviceId": "987e6543-e21b-12d3-a456-426614174999",
|
||||
"alias": "My iPad",
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
responses:
|
||||
"201":
|
||||
@@ -294,22 +296,20 @@ paths:
|
||||
patchCustomer:
|
||||
value:
|
||||
{
|
||||
"person":
|
||||
{
|
||||
"person": {
|
||||
"birthname": "Jan",
|
||||
"surname": "Jansen",
|
||||
"prefix": "dhr",
|
||||
"suffix": "jr",
|
||||
"dateOfBirth": "1970-01-01",
|
||||
"addresses":
|
||||
[
|
||||
"addresses": [
|
||||
{
|
||||
"addressId": 2,
|
||||
"street": "Laan van Meerdervoort",
|
||||
"houseNumber": 5,
|
||||
"postalCode": "2500AA",
|
||||
"city": "Den Haag",
|
||||
"country": "NL",
|
||||
"country": "NL"
|
||||
},
|
||||
{
|
||||
"addressId": 1,
|
||||
@@ -319,28 +319,26 @@ paths:
|
||||
"postalCode": "2500AA",
|
||||
"city": "Den Haag",
|
||||
"country": "NL",
|
||||
"addressTypeId": 2,
|
||||
},
|
||||
"addressTypeId": 2
|
||||
}
|
||||
],
|
||||
"phones":
|
||||
[
|
||||
"phones": [
|
||||
{
|
||||
"phoneId": 1,
|
||||
"number": "6123456789",
|
||||
"countryCode": "0031",
|
||||
"phoneTypeId": 1,
|
||||
"isPreferred": true,
|
||||
"isPreferred": true
|
||||
},
|
||||
{
|
||||
"phoneId": 2,
|
||||
"number": "7012345678",
|
||||
"countryCode": "0031",
|
||||
"phoneTypeId": 2,
|
||||
"isPreferred": false,
|
||||
},
|
||||
"isPreferred": false
|
||||
}
|
||||
],
|
||||
"devices":
|
||||
[
|
||||
"devices": [
|
||||
{
|
||||
"deviceId": "813afdd8-bf8c-4e26-bfda-4da79552bd38",
|
||||
"externalDeviceId": "123e4567-e89b-12d3-a456-426614174000",
|
||||
@@ -350,9 +348,9 @@ paths:
|
||||
"deviceId": "4f4249a2-ac6c-44f9-b740-66e66b6f3c28",
|
||||
"externalDeviceId": "987e6543-e21b-12d3-a456-426614174999",
|
||||
"alias": "My iPad",
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
responses:
|
||||
"200":
|
||||
@@ -361,7 +359,6 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/CustomersResponse"
|
||||
|
||||
/customers/tokens:
|
||||
get:
|
||||
tags:
|
||||
@@ -492,9 +489,9 @@ paths:
|
||||
"customerProfileId": 1,
|
||||
"ovPayTokenId": 1,
|
||||
"xTat": "32089cc8-d187-47ff-a3a9-5c2558def811",
|
||||
"ovpasNumber": "",
|
||||
"alias": "Mijn EMV pas",
|
||||
"tokenType": { "tokenTypeId": 1, "name": "EMV" },
|
||||
"ovpasNumber": "",
|
||||
"alias": "MyToken",
|
||||
"tokenStatus":
|
||||
{ "tokenStatusId": 2, "name": "Active" },
|
||||
"expirationDate": "2028-02-01",
|
||||
@@ -712,7 +709,7 @@ paths:
|
||||
"gboAgeProfileId": 1,
|
||||
"name": "Kind (4 t/m 11 jaar)",
|
||||
"ageFromInclusive": 4,
|
||||
"ageToInclusive": 11,
|
||||
"ageToInclusive": 11
|
||||
},
|
||||
"_links":
|
||||
{
|
||||
@@ -810,7 +807,7 @@ paths:
|
||||
"gboAgeProfileId": 1,
|
||||
"name": "Kind (4 t/m 11 jaar)",
|
||||
"ageFromInclusive": 4,
|
||||
"ageToInclusive": 11,
|
||||
"ageToInclusive": 11
|
||||
},
|
||||
"_links":
|
||||
{
|
||||
@@ -926,7 +923,7 @@ paths:
|
||||
"gboAgeProfileId": 1,
|
||||
"name": "Kind (4 t/m 11 jaar)",
|
||||
"ageFromInclusive": 4,
|
||||
"ageToInclusive": 11,
|
||||
"ageToInclusive": 11
|
||||
},
|
||||
"_links":
|
||||
{
|
||||
@@ -1011,7 +1008,7 @@ paths:
|
||||
"xTat": "e7fa3392-646b-40e2-95a6-c417dc0b0969",
|
||||
"tokenType":
|
||||
{ "tokenTypeId": 2, "name": "OV-pas physical" },
|
||||
"ovpasNumber": "OV54567",
|
||||
"ovpasNumber": "OV31236",
|
||||
"alias": "MyToken",
|
||||
"tokenStatus":
|
||||
{ "tokenStatusId": 3, "name": "Replaced (*)" },
|
||||
@@ -1033,7 +1030,7 @@ paths:
|
||||
"xTat": "e7fa3392-646b-40e2-95a6-c417dc0b0969",
|
||||
"tokenType":
|
||||
{ "tokenTypeId": 2, "name": "OV-pas physical" },
|
||||
"ovpasNumber": "OV34547",
|
||||
"ovpasNumber": "OV36897",
|
||||
"alias": "MyToken",
|
||||
"tokenStatus":
|
||||
{ "tokenStatusId": 4, "name": "On stock" },
|
||||
@@ -1047,7 +1044,7 @@ paths:
|
||||
"birthdate": null,
|
||||
"photo": null,
|
||||
},
|
||||
"gboAgeProfile": null,
|
||||
"gboAgeProfile": null
|
||||
},
|
||||
{
|
||||
"customerProfileId": 132,
|
||||
@@ -1055,7 +1052,7 @@ paths:
|
||||
"xTat": "e7fa3392-646b-40e2-95a6-c417dc0b0969",
|
||||
"tokenType":
|
||||
{ "tokenTypeId": 2, "name": "OV-pas physical" },
|
||||
"ovpasNumber": "OV34831",
|
||||
"ovpasNumber": "OV33489",
|
||||
"alias": "Mijn OV Pas",
|
||||
"tokenStatus":
|
||||
{ "tokenStatusId": 5, "name": "Suspended" },
|
||||
@@ -1069,7 +1066,7 @@ paths:
|
||||
"birthdate": null,
|
||||
"photo": null,
|
||||
},
|
||||
"gboAgeProfile": null,
|
||||
"gboAgeProfile": null
|
||||
},
|
||||
{
|
||||
"customerProfileId": 166,
|
||||
@@ -1077,7 +1074,7 @@ paths:
|
||||
"xTat": "e7fa3392-646b-40e2-95a6-c417dc0b0969",
|
||||
"tokenType":
|
||||
{ "tokenTypeId": 2, "name": "OV-pas physical" },
|
||||
"ovpasNumber": "OV34984",
|
||||
"ovpasNumber": "OV48965",
|
||||
"alias": "Mijn OV Pas",
|
||||
"tokenStatus":
|
||||
{
|
||||
@@ -1094,7 +1091,7 @@ paths:
|
||||
"birthdate": null,
|
||||
"photo": null,
|
||||
},
|
||||
"gboAgeProfile": null,
|
||||
"gboAgeProfile": null
|
||||
},
|
||||
{
|
||||
"customerProfileId": 166,
|
||||
@@ -1102,7 +1099,6 @@ paths:
|
||||
"xTat": "e7fa3392-646b-40e2-95a6-c417dc0b0969",
|
||||
"tokenType":
|
||||
{ "tokenTypeId": 2, "name": "OV-pas physical" },
|
||||
"ovpasNumber": "OV54368",
|
||||
"alias": "My retired token",
|
||||
"tokenStatus":
|
||||
{ "tokenStatusId": 1, "name": "Retired" },
|
||||
@@ -1116,7 +1112,7 @@ paths:
|
||||
"birthdate": null,
|
||||
"photo": null,
|
||||
},
|
||||
"gboAgeProfile": null,
|
||||
"gboAgeProfile": null
|
||||
},
|
||||
{
|
||||
"customerProfileId": 1,
|
||||
@@ -1124,7 +1120,7 @@ paths:
|
||||
"xTat": "e7fa3392-646b-40e2-95a6-c417dc0b0969",
|
||||
"tokenType":
|
||||
{ "tokenTypeId": 2, "name": "OV-pas physical" },
|
||||
"ovpasNumber": "OV98263",
|
||||
"ovpasNumber": "OV13458",
|
||||
"alias": "My found token",
|
||||
"tokenStatus":
|
||||
{ "tokenStatusId": 7, "name": "Renewed Active" },
|
||||
@@ -1138,7 +1134,7 @@ paths:
|
||||
"birthdate": null,
|
||||
"photo": null,
|
||||
},
|
||||
"gboAgeProfile": null,
|
||||
"gboAgeProfile": null
|
||||
},
|
||||
],
|
||||
_links:
|
||||
@@ -1228,7 +1224,7 @@ paths:
|
||||
"xTat": "32089cc8-d187-47ff-a3a9-5c2558def811",
|
||||
"tokenType": { "tokenTypeId": 1, "name": "EMV" },
|
||||
"lastDigits": null,
|
||||
"ovpasNumber": null,
|
||||
"ovPasNumber": null,
|
||||
"alias": "Mijn token",
|
||||
"tokenStatus":
|
||||
{ "tokenStatusId": 2, "name": "Active" },
|
||||
@@ -1964,7 +1960,7 @@ paths:
|
||||
type: integer
|
||||
example: 1
|
||||
required: true
|
||||
summary: Replace an OVpay token with another (+ transfer products) - V2 (for Integratielaag)
|
||||
summary: "**INTERNAL USE ONLY** Replace an OVpay token with another (+ transfer products) - V2"
|
||||
description: |
|
||||
Transfer products from one OVpay token to another, and replace the tokens in the database.
|
||||
This endpoint is for usage by integratielaag only. Touch points should use
|
||||
@@ -2253,11 +2249,6 @@ paths:
|
||||
"contractId": "56B17EF-C436-9043-B76C-481797WEB464F",
|
||||
"_links":
|
||||
{
|
||||
"self":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/customers/tokens/1/productinstances/1",
|
||||
"method": "GET",
|
||||
},
|
||||
"get_order":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/orders/501B17EF-36C4-4039-B92C-6517969B464E",
|
||||
@@ -2383,7 +2374,7 @@ paths:
|
||||
"ePurse": null,
|
||||
"personalAccountData":
|
||||
{ "name": null, "birthdate": null, "photo": null },
|
||||
"gboAgeProfile": null,
|
||||
"gboAgeProfile": null
|
||||
},
|
||||
"newOvPayToken":
|
||||
{
|
||||
@@ -2400,7 +2391,7 @@ paths:
|
||||
"ePurse": null,
|
||||
"personalAccountData":
|
||||
{ "name": null, "birthdate": null, "photo": null },
|
||||
"gboAgeProfile": null,
|
||||
"gboAgeProfile": null
|
||||
},
|
||||
"isTransferable": true,
|
||||
"transferableObjects":
|
||||
@@ -2413,11 +2404,11 @@ paths:
|
||||
"ePurse": true,
|
||||
"personalAccountData":
|
||||
{ "name": true, "birthdate": true, "photo": true },
|
||||
"gboAgeProfile": true,
|
||||
"gboAgeProfile": true
|
||||
},
|
||||
"_links":
|
||||
{
|
||||
"transfer_token":
|
||||
"transfer":
|
||||
{
|
||||
"href": "https://services.dev.api.htm.nl/abt/touchpoint/1.0/customers/tokens/1/transfer",
|
||||
"method": "POST",
|
||||
@@ -2437,57 +2428,50 @@ paths:
|
||||
"tokenStatus":
|
||||
{ "tokenStatusId": 2, "name": "Active" },
|
||||
"expirationDate": "2028-02-01",
|
||||
"productInstances":
|
||||
[
|
||||
"productInstances": [
|
||||
{
|
||||
"productId": 1,
|
||||
"name": "HTM 90% Korting EMV",
|
||||
"status": "Active",
|
||||
"isRenewable": true,
|
||||
"productCategory":
|
||||
{
|
||||
"productCategory": {
|
||||
"productCategoryId": 1,
|
||||
"name": "Kortingsabonnement",
|
||||
"name": "Kortingsabonnement"
|
||||
},
|
||||
"fromInclusive": "2025-11-25T13:25:00+01:00",
|
||||
"untilInclusive": "2025-12-25T03:59:59+01:00",
|
||||
"orderId": "501B17EF-36C4-4039-B92C-6517969B464E",
|
||||
"orderLineId": "38B17EF-36C4-4039-B92C-4817969B464E",
|
||||
"contractId": "56B17EF-C436-9043-B76C-481797WEB464F",
|
||||
"_links":
|
||||
{
|
||||
"self":
|
||||
{
|
||||
"_links": {
|
||||
"self": {
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/customers/tokens/1/productinstances/1",
|
||||
"method": "GET",
|
||||
"method": "GET"
|
||||
},
|
||||
"get_order":
|
||||
{
|
||||
"get_order": {
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/orders/501B17EF-36C4-4039-B92C-6517969B464E",
|
||||
"method": "GET",
|
||||
"method": "GET"
|
||||
},
|
||||
"get_contract":
|
||||
{
|
||||
"get_contract": {
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/customers/contracts/56B17EF-C436-9043-B76C-481797WEB464F",
|
||||
"method": "GET",
|
||||
},
|
||||
},
|
||||
},
|
||||
"method": "GET"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"replacedByTokenId": null,
|
||||
"autoReloadRegistration": null,
|
||||
"ePurse": null,
|
||||
"personalAccountData":
|
||||
{ "name": null, "birthdate": null, "photo": null },
|
||||
"gboAgeProfile": null,
|
||||
"gboAgeProfile": null
|
||||
},
|
||||
"newOvPayToken":
|
||||
{
|
||||
"customerProfileId": null,
|
||||
"ovPayTokenId": null,
|
||||
"xTat": "32089cc8-d187-47ff-a3a9-5c2558def811",
|
||||
"tokenType":
|
||||
{ "tokenTypeId": 2, "name": "OV-pas physical" },
|
||||
"tokenType": { "tokenTypeId": 2, "name": "OV-pas physical" },
|
||||
"alias": null,
|
||||
"tokenStatus": null,
|
||||
"expirationDate": "2028-02-01",
|
||||
@@ -2497,7 +2481,7 @@ paths:
|
||||
"ePurse": null,
|
||||
"personalAccountData":
|
||||
{ "name": null, "birthdate": null, "photo": null },
|
||||
"gboAgeProfile": null,
|
||||
"gboAgeProfile": null
|
||||
},
|
||||
"isTransferable": false,
|
||||
"transferableObjects":
|
||||
@@ -2534,7 +2518,7 @@ paths:
|
||||
"ePurse": null,
|
||||
"personalAccountData":
|
||||
{ "name": null, "birthdate": null, "photo": null },
|
||||
"gboAgeProfile": null,
|
||||
"gboAgeProfile": null
|
||||
},
|
||||
"newOvPayToken":
|
||||
{
|
||||
@@ -2551,7 +2535,7 @@ paths:
|
||||
"ePurse": null,
|
||||
"personalAccountData":
|
||||
{ "name": null, "birthdate": null, "photo": null },
|
||||
"gboAgeProfile": null,
|
||||
"gboAgeProfile": null
|
||||
},
|
||||
"isTransferable": false,
|
||||
"transferableObjects":
|
||||
@@ -2623,8 +2607,8 @@ paths:
|
||||
"gboAgeProfileId": 1,
|
||||
"name": "Kind (4 t/m 11 jaar)",
|
||||
"ageFromInclusive": 4,
|
||||
"ageToInclusive": 11,
|
||||
},
|
||||
"ageToInclusive": 11
|
||||
}
|
||||
},
|
||||
"newOvPayToken":
|
||||
{
|
||||
@@ -2641,7 +2625,7 @@ paths:
|
||||
"ePurse": null,
|
||||
"personalAccountData":
|
||||
{ "name": null, "birthdate": null, "photo": null },
|
||||
"gboAgeProfile": null,
|
||||
"gboAgeProfile": null
|
||||
},
|
||||
"isTransferable": false,
|
||||
"transferableObjects":
|
||||
@@ -2699,8 +2683,8 @@ paths:
|
||||
"gboAgeProfileId": 1,
|
||||
"name": "Kind (4 t/m 11 jaar)",
|
||||
"ageFromInclusive": 4,
|
||||
"ageToInclusive": 11,
|
||||
},
|
||||
"ageToInclusive": 11
|
||||
}
|
||||
},
|
||||
"newOvPayToken":
|
||||
{
|
||||
@@ -2735,8 +2719,8 @@ paths:
|
||||
"gboAgeProfileId": 4,
|
||||
"name": "Kind (19 t/m 65 jaar)",
|
||||
"ageFromInclusive": 19,
|
||||
"ageToInclusive": 65,
|
||||
},
|
||||
"ageToInclusive": 65
|
||||
}
|
||||
},
|
||||
"isTransferable": false,
|
||||
"transferableObjects":
|
||||
@@ -3099,7 +3083,7 @@ paths:
|
||||
"gboAgeProfileId": 1,
|
||||
"name": "Kind (4 t/m 11 jaar)",
|
||||
"ageFromInclusive": 4,
|
||||
"ageToInclusive": 11,
|
||||
"ageToInclusive": 11
|
||||
},
|
||||
"_links":
|
||||
{
|
||||
@@ -3140,22 +3124,60 @@ paths:
|
||||
},
|
||||
},
|
||||
}
|
||||
"202":
|
||||
description: Accepted
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
examples:
|
||||
Token transfer in progress:
|
||||
description: |
|
||||
The transfer of the token is still in progress. The response body shows the details of the
|
||||
processing status.
|
||||
value:
|
||||
{
|
||||
"startTime": "2025-02-14T05:32:47.067Z",
|
||||
"properties":
|
||||
{
|
||||
"waitEndTime": "2025-06-04T09:29:21.9641991Z",
|
||||
"startTime": "2025-06-04T09:29:21.9641991Z",
|
||||
"status": "Running",
|
||||
"clientTrackingId": "08584620957189579629541919368CU00",
|
||||
"correlation":
|
||||
{
|
||||
"clientTrackingId": "08584525775244808022011782750CU00",
|
||||
},
|
||||
"workflow":
|
||||
{
|
||||
"id": "/workflows/9cd96b77c0b94b31832778569f8ef2f9/versions/08584532480062676349",
|
||||
"name": "08584532480062676349",
|
||||
"type": "workflows/versions",
|
||||
},
|
||||
"trigger":
|
||||
{
|
||||
"name": "token_transfer",
|
||||
"inputsLink":
|
||||
{
|
||||
"uri": "https://htm-abt-logicapp-acc.azurewebsites.net:443/runtime/webhooks/workflow/scaleUnits/prod-00/workflows/9cd96b77c0b94b31832778569f8ef2f9/runs/08584525775235278538475939776CU00/contents/TriggerInputs?api-version=2022-05-01&code=C6PDQGl3MGwt8KyA9BjWDdQbzBwm-01gEmZaTp-hPJ5UAzFuPU-thg%3d%3d&se=2025-06-04T13%3A00%3A00.0000000Z&sp=%2Fruns%2F08584525775235278538475939776CU00%2Fcontents%2FTriggerInputs%2Fread&sv=1.0&sig=6Uxs33K7cQ7jONWzhv9XFPzx4RRHZ6smzfM6wNPk5Mc",
|
||||
"contentSize": 298,
|
||||
},
|
||||
"outputsLink":
|
||||
{
|
||||
"uri": "https://htm-abt-logicapp-acc.azurewebsites.net:443/runtime/webhooks/workflow/scaleUnits/prod-00/workflows/9cd96b77c0b94b31832778569f8ef2f9/runs/08584525775235278538475939776CU00/contents/TriggerOutputs?api-version=2022-05-01&code=C6PDQGl3MGwt8KyA9BjWDdQbzBwm-01gEmZaTp-hPJ5UAzFuPU-thg%3d%3d&se=2025-06-04T13%3A00%3A00.0000000Z&sp=%2Fruns%2F08584525775235278538475939776CU00%2Fcontents%2FTriggerOutputs%2Fread&sv=1.0&sig=vJ6pmCsmz2aP7f73MVOmCTes3YvC1e2w0ZLqdypLXrM",
|
||||
"contentSize": 6110,
|
||||
},
|
||||
"startTime": "2025-06-04T09:29:21.9497457Z",
|
||||
"endTime": "2025-06-04T09:29:21.9497457Z",
|
||||
"originHistoryName": "08584525775235278538475939776CU00",
|
||||
"correlation":
|
||||
{
|
||||
"clientTrackingId": "08584525775244808022011782750CU00",
|
||||
},
|
||||
"status": "Succeeded",
|
||||
},
|
||||
"outputs": {},
|
||||
"response":
|
||||
{
|
||||
"startTime": "2025-06-04T09:29:21.9642901Z",
|
||||
"correlation": {},
|
||||
"status": "Waiting",
|
||||
},
|
||||
},
|
||||
"id": "/workflows/9cd96b77c0b94b31832778569f8ef2f9/runs/08584525775235278538475939776CU00",
|
||||
"name": "08584525775235278538475939776CU00",
|
||||
"type": "workflows/runs",
|
||||
}
|
||||
"404":
|
||||
description: Not found
|
||||
@@ -3354,7 +3376,10 @@ paths:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
examples:
|
||||
Update alias of a device:
|
||||
value: { "alias": "My old iPhone 13" }
|
||||
value:
|
||||
{
|
||||
"alias": "My old iPhone 13",
|
||||
}
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
@@ -3768,11 +3793,23 @@ components:
|
||||
example: GET
|
||||
OvPayTokenProductInstancesResponse:
|
||||
type: object
|
||||
required:
|
||||
- productInstances
|
||||
properties:
|
||||
productInstances:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
required:
|
||||
- productId
|
||||
- name
|
||||
- status
|
||||
- isRenewable
|
||||
- productCategory
|
||||
- fromInclusive
|
||||
- orderId
|
||||
- orderLineId
|
||||
- _links
|
||||
properties:
|
||||
productId:
|
||||
type: integer
|
||||
@@ -3834,20 +3871,20 @@ components:
|
||||
example: GET
|
||||
get_order:
|
||||
type: object
|
||||
description: Always present for any HTM product-instance
|
||||
properties:
|
||||
href:
|
||||
type: string
|
||||
description: Always present for any HTM product-instance
|
||||
example: https://api.integratielaag.nl/abt/touchpoint/1.0/orders/501B17EF-36C4-4039-B92C-6517969B464E
|
||||
method:
|
||||
type: string
|
||||
example: GET
|
||||
get_contract:
|
||||
type: object
|
||||
description: Only present for subscriptions/contracts
|
||||
properties:
|
||||
href:
|
||||
type: string
|
||||
description: Only present for subscriptions/contracts
|
||||
example: https://api.integratielaag.nl/abt/touchpoint/1.0/customers/contracts/56B17EF-C436-9043-B76C-481797WEB464F
|
||||
method:
|
||||
type: string
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1303,7 +1303,6 @@ paths:
|
||||
name: externalDeviceId
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
example: c5545584-04af-4c60-a955-d6a70baab848
|
||||
required: false
|
||||
description: The external id of the device.
|
||||
@@ -2480,7 +2479,6 @@ components:
|
||||
format: uuid
|
||||
externalDeviceId:
|
||||
type: string
|
||||
format: uuid
|
||||
alias:
|
||||
type: string
|
||||
required:
|
||||
@@ -2599,7 +2597,6 @@ components:
|
||||
properties:
|
||||
externalDeviceId:
|
||||
type: string
|
||||
format: uuid
|
||||
alias:
|
||||
type: string
|
||||
defaultCustomerProfileResponse:
|
||||
@@ -2870,7 +2867,6 @@ components:
|
||||
type: integer
|
||||
externalDeviceId:
|
||||
type: string
|
||||
format: uuid
|
||||
alias:
|
||||
type: string
|
||||
required:
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -417,38 +417,56 @@ paths:
|
||||
example:
|
||||
Entries:
|
||||
phoneTypes:
|
||||
- name: mobile
|
||||
- name: Mobiel
|
||||
id: 1
|
||||
- name: fixed line
|
||||
- name: Thuis
|
||||
id: 2
|
||||
- name: Ouders
|
||||
id: 3
|
||||
- name: Bewindvoerder
|
||||
id: 4
|
||||
- name: Home
|
||||
id: 5
|
||||
- name: Mobile
|
||||
id: 6
|
||||
- name: Work
|
||||
id: 7
|
||||
- name: Noodtelefoon
|
||||
id: 8
|
||||
addressTypes:
|
||||
- name: home
|
||||
- name: Shipping
|
||||
id: 1
|
||||
- name: office
|
||||
- name: Billing
|
||||
id: 2
|
||||
customerStatuses:
|
||||
- name: active
|
||||
- name: Inactive
|
||||
id: 1
|
||||
- name: blocked
|
||||
- name: Active
|
||||
id: 2
|
||||
- name: inactive
|
||||
- name: Blocked
|
||||
id: 3
|
||||
- name: new
|
||||
- name: Frozen
|
||||
id: 4
|
||||
- name: Cleared
|
||||
id: 5
|
||||
tokenTypes:
|
||||
- name: Debit card
|
||||
- name: EMV
|
||||
id: 1
|
||||
- name: Credit card
|
||||
id: 2
|
||||
- name: OVPas physical
|
||||
id: 3
|
||||
id: 2
|
||||
- name: OVPas digital
|
||||
id: 4
|
||||
id: 3
|
||||
directDebitMandateTypes:
|
||||
- name: Paper Contract
|
||||
id: 1
|
||||
- name: PIN transaction
|
||||
id: 2
|
||||
- name: SEPA eMandate
|
||||
id: 3
|
||||
- name: Digital signature
|
||||
id: 4
|
||||
- name: IDEAL transaction
|
||||
id: 5
|
||||
tokenStatuses:
|
||||
- name: Expired
|
||||
id: 1
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -57,12 +57,12 @@ paths:
|
||||
required: false
|
||||
description: The id of the touch point where the order was initiated.
|
||||
- in: query
|
||||
name: deviceId
|
||||
name: externalDeviceId
|
||||
schema:
|
||||
type: string
|
||||
example: "7a28bd54-7ca9-499a-a722-d15ab858ab99"
|
||||
required: false
|
||||
description: The id of the device used to place the order.
|
||||
description: The external id of the device used to place the order.
|
||||
- in: query
|
||||
name: languageId
|
||||
schema:
|
||||
@@ -140,7 +140,7 @@ paths:
|
||||
"touchPointId": 1,
|
||||
"name": "Perplex"
|
||||
},
|
||||
"deviceId": "42e77532-d831-41da-b07a-7edb9bb7f004",
|
||||
"externalDeviceId": "42e77532-d831-41da-b07a-7edb9bb7f004",
|
||||
"language":
|
||||
{
|
||||
"languageId": 1,
|
||||
@@ -170,46 +170,24 @@ paths:
|
||||
"description": "Betaling in behandeling",
|
||||
},
|
||||
],
|
||||
"order_OrderVouchers": [
|
||||
"orderVouchers": [
|
||||
{
|
||||
"order_OrderVoucherId": "399bd3b3-9721-4f09-a936-d64637de1621",
|
||||
"orderVoucherId": "399bd3b3-9721-4f09-a936-d64637de1621",
|
||||
"issuedVoucher":{
|
||||
"issuedVoucherId": "a0996218-bc5e-4826-9020-cda98a32838d",
|
||||
"voucherCode": "Voucher1234",
|
||||
"voucherStatusInstances":
|
||||
[
|
||||
{
|
||||
"voucherStatus":
|
||||
{
|
||||
"voucherStatusId": 2,
|
||||
"name": "issued"
|
||||
},
|
||||
"createdOn": "2025-11-22T13:00:00"
|
||||
}
|
||||
],
|
||||
"productId": 31,
|
||||
"purchasedProductId": 31,
|
||||
"fromInclusive": "2025-03-22T08:55:00",
|
||||
"untillInclusive": "2026-03-22T08:55:00"
|
||||
},
|
||||
"orderLineId": null
|
||||
},
|
||||
{
|
||||
"order_OrderVoucherId": "f6c7ac42-1811-4e4d-82af-53e18fe16110",
|
||||
"orderVoucherId": "f6c7ac42-1811-4e4d-82af-53e18fe16110",
|
||||
"issuedVoucher":{
|
||||
"issuedVoucherId": "54668baf-4905-4e9a-af02-09c170f295ed",
|
||||
"voucherCode": "Voucher124",
|
||||
"voucherStatusInstances":
|
||||
[
|
||||
{
|
||||
"voucherStatus":
|
||||
{
|
||||
"voucherStatusId": 2,
|
||||
"name": "issued"
|
||||
},
|
||||
"createdOn": "2025-11-22T13:00:00"
|
||||
}
|
||||
],
|
||||
"productId": 35,
|
||||
"purchasedProductId": 35,
|
||||
"fromInclusive": "2025-03-22T08:55:00",
|
||||
"untillInclusive": "2026-03-22T08:55:00"
|
||||
},
|
||||
@@ -345,7 +323,7 @@ paths:
|
||||
{
|
||||
"orderCustomerAddressId": "aa50047c-58ac-4f15-9448-ee000dfc6893",
|
||||
"addressType":
|
||||
{ "addressTypeId": 3, "name": "Billing" },
|
||||
{ "addressTypeId": 2, "name": "Billing" },
|
||||
"street": "Kon. Julianaplein",
|
||||
"houseNumber": 10,
|
||||
"houseNumberSuffix": "a",
|
||||
@@ -395,7 +373,7 @@ paths:
|
||||
"customerProfileId": 1337,
|
||||
"totalAmount": 121,
|
||||
"touchPointId": 1,
|
||||
"deviceId": "b8ca9fdf-0bb9-4e49-b48d-41e395563377",
|
||||
"externalDeviceId": "b8ca9fdf-0bb9-4e49-b48d-41e395563377",
|
||||
"languageId": 1,
|
||||
"createdOn": "2024-03-22T09:00:00",
|
||||
"order_OrderStatus":
|
||||
@@ -406,7 +384,7 @@ paths:
|
||||
"description": "Concept order",
|
||||
},
|
||||
],
|
||||
"order_OrderVouchers":
|
||||
"orderVouchers":
|
||||
[
|
||||
{
|
||||
"issuedVoucherId": "e81b2197-a6c2-45b6-9560-8ce8442e8604",
|
||||
@@ -507,7 +485,7 @@ paths:
|
||||
"touchPointId": 1,
|
||||
"name": "Perplex"
|
||||
},
|
||||
"deviceId": null,
|
||||
"externalDeviceId": null,
|
||||
"language":
|
||||
{
|
||||
"languageId": 1,
|
||||
@@ -533,7 +511,7 @@ paths:
|
||||
"description": "Betaling in behandeling",
|
||||
},
|
||||
],
|
||||
"order_OrderVouchers": null,
|
||||
"orderVouchers": null,
|
||||
"orderLines":
|
||||
[
|
||||
{
|
||||
@@ -656,7 +634,7 @@ paths:
|
||||
{
|
||||
"orderCustomerAddressId": "aa50047c-58ac-4f15-9448-ee000dfc6893",
|
||||
"addressType":
|
||||
{ "addressTypeId": 3, "name": "Billing" },
|
||||
{ "addressTypeId": 2, "name": "Billing" },
|
||||
"street": "Kon. Julianaplein",
|
||||
"houseNumber": 10,
|
||||
"houseNumberSuffix": "a",
|
||||
@@ -680,7 +658,7 @@ paths:
|
||||
example:
|
||||
{
|
||||
"customerProfileId": 1337,
|
||||
"deviceId": "fe68e624-b75f-48ca-a179-d5f86a8ab7d5",
|
||||
"externalDeviceId": "fe68e624-b75f-48ca-a179-d5f86a8ab7d5",
|
||||
"totalAmount": 121,
|
||||
"languageId": 1,
|
||||
"lastUpdatedOn": "2024-03-22T09:00:00",
|
||||
@@ -773,12 +751,12 @@ paths:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
example:
|
||||
{
|
||||
"order_orderVoucherId": "b9cf0096-4211-4be6-ac21-7bc34bc8e066",
|
||||
"orderVoucherId": "b9cf0096-4211-4be6-ac21-7bc34bc8e066",
|
||||
}
|
||||
/ordervouchers:
|
||||
parameters:
|
||||
- in: query
|
||||
name: order_OrderVoucherId
|
||||
name: orderVoucherId
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
@@ -814,15 +792,22 @@ paths:
|
||||
example:
|
||||
[
|
||||
{
|
||||
"order_OrderVoucherId": "19ef6882-8eda-43bf-b48e-9b4ff8745a50",
|
||||
"orderVoucherId": "19ef6882-8eda-43bf-b48e-9b4ff8745a50",
|
||||
"issuedVoucher":{
|
||||
"issuedVoucherId": "54668baf-4905-4e9a-af02-09c170f295ed",
|
||||
"voucherCode": "Voucher124",
|
||||
"purchasedProductId": 35,
|
||||
"fromInclusive": "2025-03-22T08:55:00",
|
||||
"untillInclusive": "2026-03-22T08:55:00"
|
||||
},
|
||||
"orderId": "f59e4769-53a0-4156-8991-6f9119ba629f",
|
||||
"orderLineId": "eeb86071-4f59-405d-b2be-7d7a77044bfa"
|
||||
}
|
||||
]
|
||||
/ordervouchers/{order_ordervoucherId}:
|
||||
/ordervouchers/{ordervoucherId}:
|
||||
parameters:
|
||||
- in: path
|
||||
name: order_ordervoucherId
|
||||
name: ordervoucherId
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
@@ -853,7 +838,7 @@ paths:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
example:
|
||||
{
|
||||
"order_orderVoucherId": "b9cf0096-4211-4be6-ac21-7bc34bc8e066",
|
||||
"orderVoucherId": "b9cf0096-4211-4be6-ac21-7bc34bc8e066",
|
||||
}
|
||||
delete:
|
||||
summary: Delete an order voucher.
|
||||
@@ -974,7 +959,7 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
example:
|
||||
examples:
|
||||
Minimum orderline requestBody:
|
||||
value:
|
||||
{
|
||||
@@ -1060,7 +1045,7 @@ paths:
|
||||
"orderCustomerAddresses":
|
||||
[
|
||||
{
|
||||
"addressTypeId": 3,
|
||||
"addressTypeId": 2,
|
||||
"street": "Kon. Julianaplein",
|
||||
"houseNumber": 10,
|
||||
"houseNumberSuffix": "a",
|
||||
@@ -1998,7 +1983,6 @@ paths:
|
||||
"touchPointId": 1,
|
||||
"name": "Perplex"
|
||||
},
|
||||
"deviceId": null,
|
||||
"isRefund": false,
|
||||
"htmPaymentReference": "HTM-1234",
|
||||
"pspPaymentReference": "Buckaroo-1234",
|
||||
@@ -2342,7 +2326,7 @@ paths:
|
||||
{
|
||||
"orderCustomerAddressId": "aa50047c-58ac-4f15-9448-ee000dfc6893",
|
||||
"addressType":
|
||||
{ "addressTypeId": 3, "name": "Billing" },
|
||||
{ "addressTypeId": 2, "name": "Billing" },
|
||||
"street": "Kon. Julianaplein",
|
||||
"houseNumber": 10,
|
||||
"houseNumberSuffix": "a",
|
||||
@@ -2412,7 +2396,7 @@ paths:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
example:
|
||||
{
|
||||
"addressTypeId": 3,
|
||||
"addressTypeId": 2,
|
||||
"street": "Kon. Julianaplein",
|
||||
"houseNumber": 10,
|
||||
"houseNumberSuffix": "a",
|
||||
@@ -2462,7 +2446,7 @@ paths:
|
||||
type: integer
|
||||
explode: false
|
||||
required: false
|
||||
description: Filter on possible types of addresses. 1 = Shipping, 3 = Billing.
|
||||
description: Filter on possible types of addresses. 1 = Shipping, 2 = Billing.
|
||||
- in: query
|
||||
name: street
|
||||
schema:
|
||||
@@ -2518,7 +2502,7 @@ paths:
|
||||
"orderCustomerAddressId": "aa50047c-58ac-4f15-9448-ee000dfc6893",
|
||||
"orderCustomerId": "540d8b7a-d626-443f-8f99-c24398604d7a",
|
||||
"orderId": "73cca95a-81d1-468f-a8bf-99b36367001a",
|
||||
"addressType": { "addressTypeId": 3, "name": "Billing" },
|
||||
"addressType": { "addressTypeId": 2, "name": "Billing" },
|
||||
"street": "Kon. Julianaplein",
|
||||
"houseNumber": 10,
|
||||
"houseNumberSuffix": "a",
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,206 @@
|
||||
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.
|
||||
version: "1.0"
|
||||
servers:
|
||||
- url: https://services.acc.api.htm.nl/abt/abtvouchersTouchpoint/1.0
|
||||
paths:
|
||||
/issuedvouchers/{voucherCode}:
|
||||
get:
|
||||
summary: Get details of a voucher, that was issued for a specific touch point
|
||||
description:
|
||||
Get details of an issued voucher for a specific touch point. This means that only products that the calling touch point is allowed to see or sell
|
||||
(i.e. has active sellingPeriods for touchPointId of the calling touch point) are returned.
|
||||
parameters:
|
||||
- name: voucherCode
|
||||
in: path
|
||||
required: true
|
||||
description: The unique code of the issued voucher to retrieve.
|
||||
schema:
|
||||
type: string
|
||||
example: VOUCHER123
|
||||
tags:
|
||||
- Vouchers
|
||||
responses:
|
||||
"200":
|
||||
description: Successful retrieval of voucher instance
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
examples:
|
||||
Voucher for a product with required attributes:
|
||||
summary: Voucher for a single product with required attributes
|
||||
value:
|
||||
{
|
||||
"issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
||||
"voucherCode": "VOUCHER123",
|
||||
"fromInclusive": "2024-10-04T00:00:00.000",
|
||||
"untilInclusive": "2024-11-04T00:00:00.000",
|
||||
"voucherStatus": { "voucherStatusId": 1, "name": "New" },
|
||||
"product":
|
||||
{
|
||||
"productId": 263,
|
||||
"productName": "HTM-80001",
|
||||
"productDescription": "10 euro korting op Regiovrij maand.",
|
||||
"productCategory":
|
||||
{
|
||||
"productCategoryId": 9,
|
||||
"isTravelProduct": false,
|
||||
"name": "Voucher",
|
||||
},
|
||||
"amountInclTax": -1000,
|
||||
"requiredProducts":
|
||||
[
|
||||
{
|
||||
"productId": 126,
|
||||
"productName": "HTM-30001",
|
||||
"productDescription": "Regiovrij maand.",
|
||||
"_links":
|
||||
{
|
||||
"get_details":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/products/126",
|
||||
"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",
|
||||
},
|
||||
],
|
||||
}
|
||||
Voucher for a whole order:
|
||||
summary: Voucher for a whole order
|
||||
value:
|
||||
{
|
||||
"issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
||||
"voucherCode": "VOUCHER123",
|
||||
"fromInclusive": "2024-10-04T00:00:00.000",
|
||||
"untilInclusive": "2024-11-04T00:00:00.000",
|
||||
"voucherStatus": { "voucherStatusId": 1, "name": "New" },
|
||||
"product":
|
||||
{
|
||||
"productId": 263,
|
||||
"productName": "HTM-80002",
|
||||
"productDescription": "10 euro korting op je gehele winkelmand.",
|
||||
"productCategory":
|
||||
{
|
||||
"productCategoryId": 9,
|
||||
"isTravelProduct": false,
|
||||
"name": "Voucher",
|
||||
},
|
||||
"amountInclTax": -1000,
|
||||
"requiredProducts": [],
|
||||
"_links":
|
||||
{
|
||||
"get_details":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/products/263",
|
||||
"method": "GET",
|
||||
},
|
||||
},
|
||||
},
|
||||
"mandatoryCustomerDataItems": [],
|
||||
}
|
||||
"403":
|
||||
description: Forbidden
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/rfc9457"
|
||||
examples:
|
||||
Access denied due to insufficient permissions:
|
||||
summary: Access denied due to insufficient permissions
|
||||
value:
|
||||
{
|
||||
"type": "https://example.com/probs/forbidden",
|
||||
"title": "Access denied",
|
||||
"detail": "You do not have permission to access this resource.",
|
||||
"instance": "/issuedvouchers",
|
||||
}
|
||||
"404":
|
||||
description: Not found
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/rfc9457"
|
||||
examples:
|
||||
Voucher not found:
|
||||
summary: Voucher not found
|
||||
value:
|
||||
{
|
||||
"type": "https://example.com/probs/not-found",
|
||||
"title": "Voucher not found",
|
||||
"detail": "The voucher with code VOUCHER123 does not exist.",
|
||||
"instance": "/issuedvouchers",
|
||||
}
|
||||
"500":
|
||||
description: Internal server error
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/rfc9457"
|
||||
examples:
|
||||
Unexpected server error:
|
||||
summary: Unexpected server error
|
||||
value:
|
||||
{
|
||||
"type": "https://example.com/probs/internal-server-error",
|
||||
"title": "Internal Server Error",
|
||||
"detail": "An unexpected error occurred while processing your request.",
|
||||
"instance": "/issuedvouchers",
|
||||
}
|
||||
components:
|
||||
securitySchemes:
|
||||
bearerToken:
|
||||
type: http
|
||||
scheme: bearer
|
||||
bearerFormat: JWT
|
||||
schemas:
|
||||
unavailable:
|
||||
type: object
|
||||
rfc9457:
|
||||
type: object
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
format: url
|
||||
example: https://example.com/probs/out-of-credit
|
||||
title:
|
||||
type: string
|
||||
example: You do not have enough credit.
|
||||
detail:
|
||||
type: string
|
||||
example: Your current balance is 30, but that costs 50.
|
||||
instance:
|
||||
type: string
|
||||
example: /account/12345/msgs/abc
|
||||
balance:
|
||||
type: string
|
||||
example: 30
|
||||
accounts:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
example:
|
||||
- /account/12345
|
||||
- /account/67890
|
||||
@@ -0,0 +1,617 @@
|
||||
openapi: 3.0.1
|
||||
info:
|
||||
title: Service Engine APIs for HTM voucher suppliers
|
||||
description: Service Engine APIs for HTM vouchers suppliers, this means all instances responsible for supplying vouchers. These are NOT the CRUD APIs to the data hub. These are ALSO NOT the api's for sales touchpoints.
|
||||
version: "1.0"
|
||||
servers:
|
||||
- url: https://services.acc.api.htm.nl/abt/abtvouchers/1.0
|
||||
paths:
|
||||
/voucherdefinitions:
|
||||
get:
|
||||
tags:
|
||||
- Vouchers
|
||||
summary: Get a list of all voucher definitions that a touch point is allowed to issue
|
||||
description: |-
|
||||
Get a list of all voucher definitions that the calling touch point is allowed to issue.
|
||||
Essentially, this means that only products that have active sellingPeriods for touch points within the same
|
||||
retailer as the calling touch point are returned.
|
||||
parameters:
|
||||
- name: touchpointId
|
||||
in: query
|
||||
required: false
|
||||
description: |
|
||||
Filter the voucher definitions on a specific touch point id. This means that only voucher definitions with active selling periods for the specified touch point are returned.
|
||||
This query parameter is only intended for administrative purposes, since the touch point associated with the access token used in the request is used to determine which voucher definitions are returned. This query parameter can be used to retrieve voucher definitions for other touch points within the same retailer, for example to retrieve voucher definitions for a specific sales touch point that is different from the calling touch point.
|
||||
schema:
|
||||
type: integer
|
||||
example: 1001
|
||||
- name: productId
|
||||
in: query
|
||||
required: false
|
||||
description: Filter the voucher definitions on a specific product id.
|
||||
schema:
|
||||
type: integer
|
||||
example: 263
|
||||
- name: requiredProductId
|
||||
in: query
|
||||
required: false
|
||||
description: Filter the voucher definitions on a specific required product id. This means that only voucher definitions that have the specified product id in their requiredProducts list are returned.
|
||||
schema:
|
||||
type: integer
|
||||
example: 126
|
||||
- name: showOnlyActive
|
||||
in: query
|
||||
required: false
|
||||
description: Filter the voucher definitions on active selling periods. If true, only voucher definitions with at least one active selling period are returned. If false, all voucher definitions are returned regardless of their selling periods.
|
||||
schema:
|
||||
type: boolean
|
||||
example: true
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
examples:
|
||||
No products / Empty list:
|
||||
summary: No products / Empty list
|
||||
description: No products
|
||||
value: { "voucherDefinitions": [] }
|
||||
List containing one voucher definition (called by touchpointId 1001):
|
||||
summary: List containing one voucher definition (called by touchpointId 10010011)
|
||||
description: TODO
|
||||
value:
|
||||
{
|
||||
"voucherDefinitions":
|
||||
[
|
||||
{
|
||||
"productId": 1002,
|
||||
"productName": "Korting Ooievaarspas",
|
||||
"productDescription": "Kortingsvoucher voor houders van een Ooievaarspas",
|
||||
"validityPeriod":
|
||||
{
|
||||
"validityPeriodId": 144,
|
||||
"fromInclusive": "2023-12-31T23:00:00.000+00:00",
|
||||
"toInclusive": "2028-11-25T04:00:00.000+00:00",
|
||||
},
|
||||
"productCategory":
|
||||
{
|
||||
"productCategoryId": 9,
|
||||
"isTravelProduct": false,
|
||||
"name": "Voucher",
|
||||
},
|
||||
"requiredProducts":
|
||||
[
|
||||
{
|
||||
"productId": 126,
|
||||
"productName": "HTM-30001",
|
||||
"productDescription": "Reis met 20% korting op je betaalpas bij HTM.",
|
||||
},
|
||||
],
|
||||
"mandatoryCustomerDataItems":
|
||||
[
|
||||
{
|
||||
"mandatoryCustomerDataItemId": 8,
|
||||
"customerDataItem": "padBirthDate",
|
||||
},
|
||||
{
|
||||
"mandatoryCustomerDataItemId": 4,
|
||||
"customerDataItem": "emailAddress",
|
||||
},
|
||||
],
|
||||
"imageReference": "https://www.htm.nl/media/leif2leu/htm-logo-mobile.svg",
|
||||
"productPageUrl": "https://www.htm.nl/nog-onbekende-product-pagina",
|
||||
"sellingPeriods":
|
||||
[
|
||||
{
|
||||
"sellingPeriodId": 78,
|
||||
"fromInclusive": "2024-09-30T23:00:00.000+00:00",
|
||||
"toInclusive": "2028-11-17T23:00:00.000+00:00",
|
||||
"salesTouchpoint":
|
||||
{
|
||||
"salesTouchpointId": 1001,
|
||||
"name": "Gemeente Den Haag",
|
||||
"isActive": true,
|
||||
"retailer":
|
||||
{
|
||||
"retailerId": 1001,
|
||||
"name": "Gemeente Den Haag",
|
||||
"street": "Koningin Julianaplein",
|
||||
"number": "10",
|
||||
"numberAddition": null,
|
||||
"postalCode": "2595 AA",
|
||||
"city": "Den Haag",
|
||||
"country": "Nederland",
|
||||
"emailAddress": "info@denhaag.nl",
|
||||
"phoneNumber": "070 374 9002",
|
||||
"taxId": "572309345923",
|
||||
"imageReference": "https://www.htm.nl/media/leif2leu/htm-logo-mobile.svg",
|
||||
},
|
||||
},
|
||||
"forbiddenPaymentMethods": [],
|
||||
"sellingPrices":
|
||||
[
|
||||
{
|
||||
"sellingPriceId": 78,
|
||||
"amountExclTax": null,
|
||||
"amountInclTax": -100,
|
||||
"fromInclusive": "2024-09-30T23:00:00.000+00:00",
|
||||
"toInclusive": "2028-11-17T23:00:00.000+00:00",
|
||||
"internalPrice": 0.0000,
|
||||
"taxCode": "V09",
|
||||
"taxPercentage": 9.0000,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
"403":
|
||||
description: Forbidden
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/rfc9457"
|
||||
examples:
|
||||
Access denied due to insufficient permissions:
|
||||
summary: Access denied due to insufficient permissions
|
||||
value:
|
||||
{
|
||||
"type": "https://example.com/probs/forbidden",
|
||||
"title": "Access denied",
|
||||
"detail": "You do not have permission to access this resource.",
|
||||
"instance": "/voucherdefinitions",
|
||||
}
|
||||
"404":
|
||||
description: Not found
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/rfc9457"
|
||||
examples:
|
||||
Voucher not found:
|
||||
summary: Voucher not found
|
||||
value:
|
||||
{
|
||||
"type": "https://example.com/probs/not-found",
|
||||
"title": "Voucher not found",
|
||||
"detail": "The voucher definition does not exist.",
|
||||
"instance": "/voucherdefinitions",
|
||||
}
|
||||
"500":
|
||||
description: Internal server error
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/rfc9457"
|
||||
examples:
|
||||
Unexpected server error:
|
||||
summary: Unexpected server error
|
||||
value:
|
||||
{
|
||||
"type": "https://example.com/probs/internal-server-error",
|
||||
"title": "Internal Server Error",
|
||||
"detail": "An unexpected error occurred while processing your request.",
|
||||
"instance": "/voucherdefinitions",
|
||||
}
|
||||
/issuedvouchers:
|
||||
get:
|
||||
summary: Get a list of issued vouchers that were issued for a specific touch point
|
||||
description:
|
||||
Retrieve all issued vouchers for a specific touch point. This means that only products that have active sellingPeriods for touch points within the same
|
||||
retailer as the calling touch point are returned.
|
||||
parameters:
|
||||
- name: touchpointId
|
||||
in: query
|
||||
required: false
|
||||
description: |
|
||||
Filter the issued vouchers on a specific touch point id. This means that only issued vouchers for products with active selling periods for the specified touch point are returned.
|
||||
This query parameter is only intended for administrative purposes, since the touch point associated with the access token used in the request is used to determine which issued vouchers are returned. This query parameter can be used to retrieve issued vouchers for other touch points within the same retailer, for example to retrieve issued vouchers for a specific sales touch point that is different from the calling touch point.
|
||||
schema:
|
||||
type: integer
|
||||
example: 1001
|
||||
- name: issuedVoucherId
|
||||
in: query
|
||||
required: false
|
||||
description: The unique identifier of the issued voucher instance to retrieve.
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
example: d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90
|
||||
- name: voucherCode
|
||||
in: query
|
||||
required: false
|
||||
description: The unique code of the issued voucher to retrieve.
|
||||
schema:
|
||||
type: string
|
||||
example: VOUCHER123
|
||||
- name: productId
|
||||
in: query
|
||||
required: false
|
||||
description: The unique identifier of the product for which to retrieve all issued vouchers.
|
||||
schema:
|
||||
type: integer
|
||||
example: 263
|
||||
- name: highestVoucherStatusId
|
||||
in: query
|
||||
required: false
|
||||
explode: false
|
||||
description: |-
|
||||
The highest voucher status id to filter the issued vouchers on.
|
||||
- 1 = new
|
||||
- 2 = issued
|
||||
- 3 = redeemed
|
||||
- 4 = revoked
|
||||
- 5 = expired
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: integer
|
||||
example: [1, 2]
|
||||
tags:
|
||||
- Vouchers
|
||||
responses:
|
||||
"200":
|
||||
description: Successful retrieval of voucher instance
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
examples:
|
||||
Voucher for a product with required attributes:
|
||||
summary: Voucher for a single product with required attributes
|
||||
value:
|
||||
{
|
||||
"issuedVouchers":
|
||||
[
|
||||
{
|
||||
"issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
||||
"voucherCode": "VOUCHER123",
|
||||
"fromInclusive": "2024-10-04T00:00:00.000",
|
||||
"untilInclusive": "2024-11-04T00:00:00.000",
|
||||
"voucherStatus":
|
||||
{ "voucherStatusId": 1, "name": "New" },
|
||||
"product":
|
||||
{
|
||||
"productId": 263,
|
||||
"productName": "HTM-80001",
|
||||
"productDescription": "10 euro korting op Regiovrij maand.",
|
||||
"productCategory":
|
||||
{
|
||||
"productCategoryId": 9,
|
||||
"isTravelProduct": false,
|
||||
"name": "Voucher",
|
||||
},
|
||||
"amountInclTax": -1000,
|
||||
"requiredProducts":
|
||||
[
|
||||
{
|
||||
"productId": 126,
|
||||
"productName": "HTM-30001",
|
||||
"productDescription": "Regiovrij maand.",
|
||||
"_links":
|
||||
{
|
||||
"get_details":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/products/126",
|
||||
"method": "GET",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"_links":
|
||||
{
|
||||
"get_details":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/products/263",
|
||||
"method": "GET",
|
||||
},
|
||||
},
|
||||
},
|
||||
"claims":
|
||||
[
|
||||
{
|
||||
"mandatoryCustomerDataItem":
|
||||
{
|
||||
"mandatoryCustomerDataItemId": 8,
|
||||
"customerDataItem": "padBirthDate",
|
||||
},
|
||||
"value": "1980-06-31",
|
||||
},
|
||||
{
|
||||
"mandatoryCustomerDataItem":
|
||||
{
|
||||
"mandatoryCustomerDataItemId": 4,
|
||||
"customerDataItem": "emailAddress",
|
||||
},
|
||||
"value": "harry@griffindor.co.uk",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
Voucher for a whole order:
|
||||
summary: Voucher for a whole order
|
||||
value:
|
||||
{
|
||||
"issuedVouchers":
|
||||
[
|
||||
{
|
||||
"issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
||||
"voucherCode": "VOUCHER123",
|
||||
"fromInclusive": "2024-10-04T00:00:00.000",
|
||||
"untilInclusive": "2024-11-04T00:00:00.000",
|
||||
"voucherStatus":
|
||||
{ "voucherStatusId": 1, "name": "New" },
|
||||
"product":
|
||||
{
|
||||
"productId": 263,
|
||||
"productName": "HTM-80002",
|
||||
"productDescription": "10 euro korting op je gehele winkelmand.",
|
||||
"productCategory":
|
||||
{
|
||||
"productCategoryId": 9,
|
||||
"isTravelProduct": false,
|
||||
"name": "Voucher",
|
||||
},
|
||||
"amountInclTax": -1000,
|
||||
"requiredProducts": [],
|
||||
"_links":
|
||||
{
|
||||
"get_details":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/products/263",
|
||||
"method": "GET",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"claims": [],
|
||||
],
|
||||
}
|
||||
"403":
|
||||
description: Forbidden
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/rfc9457"
|
||||
examples:
|
||||
Access denied due to insufficient permissions:
|
||||
summary: Access denied due to insufficient permissions
|
||||
value:
|
||||
{
|
||||
"type": "https://example.com/probs/forbidden",
|
||||
"title": "Access denied",
|
||||
"detail": "You do not have permission to access this resource.",
|
||||
"instance": "/issuedvouchers",
|
||||
}
|
||||
"404":
|
||||
description: Not found
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/rfc9457"
|
||||
examples:
|
||||
Voucher not found:
|
||||
summary: Voucher not found
|
||||
value:
|
||||
{
|
||||
"type": "https://example.com/probs/not-found",
|
||||
"title": "Voucher not found",
|
||||
"detail": "The voucher with code VOUCHER123 does not exist.",
|
||||
"instance": "/issuedvouchers",
|
||||
}
|
||||
"500":
|
||||
description: Internal server error
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/rfc9457"
|
||||
examples:
|
||||
Unexpected server error:
|
||||
summary: Unexpected server error
|
||||
value:
|
||||
{
|
||||
"type": "https://example.com/probs/internal-server-error",
|
||||
"title": "Internal Server Error",
|
||||
"detail": "An unexpected error occurred while processing your request.",
|
||||
"instance": "/issuedvouchers",
|
||||
}
|
||||
post:
|
||||
summary: Issue a voucher for a specific product
|
||||
description: |
|
||||
Issue a voucher for a specific product. The voucher will be issued for the touch point that is associated with the access token used in the request.
|
||||
The product for which the voucher should be issued must have active selling periods for touch points within the same retailer as the calling touch point.
|
||||
tags:
|
||||
- Vouchers
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
examples:
|
||||
Issue a voucher with prefilled voucher code:
|
||||
summary: Issue a voucher with prefilled voucher code
|
||||
value:
|
||||
{
|
||||
"voucherCode": "VOUCHER123",
|
||||
"fromInclusive": "2024-10-04T00:00:00.000",
|
||||
"untilInclusive": "2024-11-04T00:00:00.000",
|
||||
"productId": 263,
|
||||
"voucherClaims":
|
||||
[
|
||||
{
|
||||
"mandatoryCustomerDataItemId": 8,
|
||||
"value": "1970-01-01",
|
||||
},
|
||||
{
|
||||
"mandatoryCustomerDataItemId": 4,
|
||||
"value": "stasjo@html.nl",
|
||||
},
|
||||
],
|
||||
}
|
||||
Issue a voucher without prefilled voucher code:
|
||||
summary: Issue a voucher without prefilled voucher code
|
||||
value:
|
||||
{
|
||||
"fromInclusive": "2024-10-04T00:00:00.000",
|
||||
"untilInclusive": "2024-11-04T00:00:00.000",
|
||||
"productId": 263,
|
||||
"voucherClaims":
|
||||
[
|
||||
{
|
||||
"mandatoryCustomerDataItemId": 8,
|
||||
"value": "1970-01-01",
|
||||
},
|
||||
{
|
||||
"mandatoryCustomerDataItemId": 4,
|
||||
"value": "stasjo@html.nl",
|
||||
},
|
||||
],
|
||||
}
|
||||
responses:
|
||||
"201":
|
||||
description: Created
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
examples:
|
||||
Successfully issued a voucher:
|
||||
summary: Successfully issued a voucher
|
||||
value:
|
||||
{
|
||||
"issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
||||
"voucherCode": "HKV-A7J-128-PYT",
|
||||
"fromInclusive": "2024-10-04T00:00:00.000",
|
||||
"untilInclusive": "2024-11-04T00:00:00.000",
|
||||
"voucherStatus": { "voucherStatusId": 1, "name": "New" },
|
||||
"product":
|
||||
{
|
||||
"productId": 263,
|
||||
"productName": "HTM-80002",
|
||||
"productDescription": "10 euro korting op je gehele winkelmand.",
|
||||
"productCategory":
|
||||
{
|
||||
"productCategoryId": 9,
|
||||
"isTravelProduct": false,
|
||||
"name": "Voucher",
|
||||
},
|
||||
"amountInclTax": -1000,
|
||||
"requiredProducts": [],
|
||||
"_links":
|
||||
{
|
||||
"get_details":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/products/263",
|
||||
"method": "GET",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
/issuedvouchers/{issuedVoucherId}:
|
||||
parameters:
|
||||
- name: issuedVoucherId
|
||||
in: path
|
||||
required: true
|
||||
description: The unique identifier of the issued voucher instance to update the status for.
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
example: d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90
|
||||
patch:
|
||||
summary: Update the status of an issued voucher
|
||||
description: Update the status of an issued voucher. This can be used to mark a voucher as redeemed, revoked or expired.
|
||||
tags:
|
||||
- Vouchers
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
examples:
|
||||
Mark a voucher as expired:
|
||||
summary: Mark a voucher as expired
|
||||
value:
|
||||
{
|
||||
"voucherStatusId": 5,
|
||||
}
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
examples:
|
||||
Successfully updated the status of a voucher:
|
||||
summary: Successfully updated the status of a voucher
|
||||
value:
|
||||
{
|
||||
"issuedVoucherId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
||||
"voucherCode": "HKV-A7J-128-PYT",
|
||||
"fromInclusive": "2024-10-04T00:00:00.000",
|
||||
"untilInclusive": "2024-11-04T00:00:00.000",
|
||||
"voucherStatus": { "voucherStatusId": 5, "name": "Expired" },
|
||||
"product":
|
||||
{
|
||||
"productId": 263,
|
||||
"productName": "HTM-80002",
|
||||
"productDescription": "10 euro korting op je gehele winkelmand.",
|
||||
"productCategory":
|
||||
{
|
||||
"productCategoryId": 9,
|
||||
"isTravelProduct": false,
|
||||
"name": "Voucher",
|
||||
},
|
||||
"amountInclTax": -1000,
|
||||
"requiredProducts": [],
|
||||
"_links":
|
||||
{
|
||||
"get_details":
|
||||
{
|
||||
"href": "https://api.integratielaag.nl/abt/touchpoint/1.0/products/263",
|
||||
"method": "GET",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
components:
|
||||
securitySchemes:
|
||||
bearerToken:
|
||||
type: http
|
||||
scheme: bearer
|
||||
bearerFormat: JWT
|
||||
schemas:
|
||||
unavailable:
|
||||
type: object
|
||||
rfc9457:
|
||||
type: object
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
format: url
|
||||
example: https://example.com/probs/out-of-credit
|
||||
title:
|
||||
type: string
|
||||
example: You do not have enough credit.
|
||||
detail:
|
||||
type: string
|
||||
example: Your current balance is 30, but that costs 50.
|
||||
instance:
|
||||
type: string
|
||||
example: /account/12345/msgs/abc
|
||||
balance:
|
||||
type: string
|
||||
example: 30
|
||||
accounts:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
example:
|
||||
- /account/12345
|
||||
- /account/67890
|
||||
@@ -1820,6 +1820,8 @@ components:
|
||||
customerDataItem: shippingAddress
|
||||
- mandatoryCustomerDataItemId: 10
|
||||
customerDataItem: billingAddress
|
||||
- mandatoryCustomerDataItemId: 11
|
||||
customerDataItem: startDate
|
||||
items:
|
||||
$ref: '#/components/schemas/mandatoryCustomerDataItemGetEntity'
|
||||
type: array
|
||||
|
||||
@@ -128,7 +128,7 @@ paths:
|
||||
"createdOn": "2024-10-04T12:34:56.000",
|
||||
"lastUpdatedOn": "2024-10-04T12:34:56.000",
|
||||
"createdBy": "someuser",
|
||||
"lastUpdatedBy": null,
|
||||
"lastUpdatedBy": null
|
||||
},
|
||||
],
|
||||
"purchasedTapconnectTickets": [],
|
||||
@@ -154,7 +154,7 @@ paths:
|
||||
"purchasedProductResourceId": "06dae996-cdfe-45f1-833a-720201c35114",
|
||||
"resourceName":
|
||||
{ "resourceNameId": 2, "name": "orders" },
|
||||
"resourceIdentifier": "f809a6e1-1c8d-4f8e-8a6e-0d0b1e1e1e1e",
|
||||
"resourceIdentifier": "f809a6e1-1c8d-4f8e-8a6e-0d0b1e1e1e1e"
|
||||
},
|
||||
],
|
||||
"purchasedGboProducts": [],
|
||||
@@ -170,6 +170,11 @@ paths:
|
||||
"lastUpdatedOn": "2024-10-04T12:34:56.000",
|
||||
"createdBy": "user",
|
||||
"lastUpdatedBy": "user",
|
||||
"externalDeviceId": "c5545584-04af-4c60-a955-d6a70baab848",
|
||||
"serviceId": "HTM-1234-7654-8945",
|
||||
"activateBefore": "2024-10-08",
|
||||
"validityStart": "2024-10-05T12:34:56.000",
|
||||
"validityEnd": "2024-10-06T12:34:56.000"
|
||||
},
|
||||
],
|
||||
"issuedVouchers": [],
|
||||
@@ -341,6 +346,11 @@ paths:
|
||||
"lastUpdatedOn": "2024-10-04T12:34:56.000",
|
||||
"createdBy": "user",
|
||||
"lastUpdatedBy": "user",
|
||||
"externalDeviceId": "c5545584-04af-4c60-a955-d6a70baab848",
|
||||
"serviceId": "HTM-1234-7654-8945",
|
||||
"activateBefore": "2024-10-08",
|
||||
"validityStart": "2024-10-05T12:34:56.000",
|
||||
"validityEnd": "2024-10-06T12:34:56.000"
|
||||
},
|
||||
],
|
||||
"issuedVouchers": [],
|
||||
@@ -775,18 +785,7 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
example:
|
||||
{
|
||||
"issuedAt": "2024-10-04T12:34:56.000",
|
||||
"activatedAt": "2024-10-04T12:34:56.000",
|
||||
"cancelledAt": null,
|
||||
"ticketReference": "KJj43nejhbTxhr897287",
|
||||
"createdOn": "2024-10-04T12:34:56.000",
|
||||
"lastUpdatedOn": "2024-10-04T12:34:56.000",
|
||||
"createdBy": "user",
|
||||
"lastUpdatedBy": "user",
|
||||
}
|
||||
$ref: "#/components/schemas/PostPurchasedTapConnectTicketRequest"
|
||||
responses:
|
||||
"201":
|
||||
description: Created
|
||||
@@ -907,6 +906,60 @@ paths:
|
||||
type: string
|
||||
example: user
|
||||
description: The user that last updated the purchased Tapconnect ticket.
|
||||
- in: query
|
||||
name: externalDeviceId
|
||||
schema:
|
||||
type: string
|
||||
example: c5545584-04af-4c60-a955-d6a70baab848
|
||||
description: The external id of the device.
|
||||
- in: query
|
||||
name: serviceId
|
||||
schema:
|
||||
type: string
|
||||
example: HTM-1234-7654-8945
|
||||
description: A printable id that needs to be next to the printed barcode on the ticket, which is used when the customer contacts the service desk.
|
||||
- in: query
|
||||
name: activateBeforeBefore
|
||||
schema:
|
||||
type: string
|
||||
format: date
|
||||
example: 2024-10-04
|
||||
description: Return only PurchasedTapConnectTickets that have `activateBefore` before this date.
|
||||
- in: query
|
||||
name: activateBeforeAfter
|
||||
schema:
|
||||
type: string
|
||||
format: date-time
|
||||
example: 2024-10-04
|
||||
description: Return only PurchasedTapConnectTickets that have `activateBefore` after this date.
|
||||
- in: query
|
||||
name: validityStartBefore
|
||||
schema:
|
||||
type: string
|
||||
format: date-time
|
||||
example: 2024-10-04T12:34:56.000
|
||||
description: Return only PurchasedTapConnectTickets that have `validityStart` before this timestamp.
|
||||
- in: query
|
||||
name: validityStartAfter
|
||||
schema:
|
||||
type: string
|
||||
format: date-time
|
||||
example: 2024-10-04T12:34:56.000
|
||||
description: Return only PurchasedTapConnectTickets that have `validityStart` after this timestamp.
|
||||
- in: query
|
||||
name: validityEndBefore
|
||||
schema:
|
||||
type: string
|
||||
format: date-time
|
||||
example: 2024-10-04T12:34:56.000
|
||||
description: Return only PurchasedTapConnectTickets that have `validityEnd` before this timestamp.
|
||||
- in: query
|
||||
name: validityEndAfter
|
||||
schema:
|
||||
type: string
|
||||
format: date-time
|
||||
example: 2024-10-04T12:34:56.000
|
||||
description: Return only PurchasedTapConnectTickets that have `validityEnd` after this timestamp.
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
@@ -929,6 +982,11 @@ paths:
|
||||
"lastUpdatedOn": "2024-10-04T12:34:56.000",
|
||||
"createdBy": "user",
|
||||
"lastUpdatedBy": "user",
|
||||
"externalDeviceId": "c5545584-04af-4c60-a955-d6a70baab848",
|
||||
"serviceId": "HTM-1234-7654-8945",
|
||||
"activateBefore": "2024-10-08",
|
||||
"validityStart": "2024-10-05T12:34:56.000",
|
||||
"validityEnd": "2024-10-06T12:34:56.000"
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -958,6 +1016,8 @@ paths:
|
||||
"activatedAt": "2024-10-05T12:34:56.000",
|
||||
"cancelledAt": "2024-10-06T12:34:56.000",
|
||||
"lastUpdatedOn": "2024-10-05T12:34:56.000",
|
||||
"validityStart": "2024-10-05T12:34:56.000",
|
||||
"validityEnd": "2024-10-06T12:34:56.000"
|
||||
}
|
||||
responses:
|
||||
"200":
|
||||
@@ -968,7 +1028,7 @@ paths:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
example:
|
||||
{
|
||||
"purchasedTapconnectTicketId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90",
|
||||
"purchasedTapconnectTicketId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f90"
|
||||
}
|
||||
/purchasedproducts/{purchasedProductId}/issuedvouchers:
|
||||
parameters:
|
||||
@@ -1009,6 +1069,8 @@ paths:
|
||||
"value": "vlad.harkonnen@househarkonnen.net",
|
||||
},
|
||||
],
|
||||
"fromInclusive": "2024-10-04T12:34:56.000",
|
||||
"untilInclusive": "2025-10-04T12:34:56.000",
|
||||
}
|
||||
responses:
|
||||
"201":
|
||||
@@ -1104,6 +1166,8 @@ paths:
|
||||
"value": "vlad.harkonnen@househarkonnen.net",
|
||||
},
|
||||
],
|
||||
"fromInclusive": "2024-10-04T12:34:56.000",
|
||||
"untilInclusive": "2025-10-04T12:34:56.000",
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -1165,439 +1229,6 @@ paths:
|
||||
{ "voucherStatusId": 5, "name": "Expired" },
|
||||
],
|
||||
}
|
||||
/purchasedproducts/bulk:
|
||||
post:
|
||||
tags:
|
||||
- Bulk processing
|
||||
summary: Create one or more purchased product(s) in bulk.
|
||||
description: Create a new purchased product.
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
examples:
|
||||
Create Single Purchased GBO Product:
|
||||
value:
|
||||
{
|
||||
"purchasedProducts":[
|
||||
{
|
||||
"productId": 11,
|
||||
"createdOn": "2024-10-04T12:34:56.000",
|
||||
"lastUpdatedOn": "2024-10-04T12:34:56.000",
|
||||
"purchasedProductResources":
|
||||
[
|
||||
{
|
||||
"resourceNameId": 1,
|
||||
"resourceIdentifier": "408eefa9-b393-4bb3-8439-b2e51833abc7",
|
||||
},
|
||||
{
|
||||
"resourceNameId": 2,
|
||||
"resourceIdentifier": "f809a6e1-1c8d-4f8e-8a6e-0d0b1e1e1e1e",
|
||||
},
|
||||
],
|
||||
"purchasedGboProducts":
|
||||
[
|
||||
{
|
||||
"salesTimestamp": "2024-10-04T12:34:56.000",
|
||||
"refundTimestamp": "2024-10-04T12:34:56.000",
|
||||
"fromInclusive": "2024-10-04T12:34:56.000",
|
||||
"untilInclusive": "2024-10-04T12:34:56.000",
|
||||
"packageTemplateId": "30003",
|
||||
"xBot": "f15efe6f-7353-4968-b134-60ba6fc2da8b",
|
||||
"xTat": "42efebf7-132e-4ee0-9cbb-4037a9a54ad8",
|
||||
"xSpit": "d67b2f72-918a-4e6c-957d-a39ed9c9e16b",
|
||||
"customerTokenId": "b6492322-c458-4857-9ac3-a109c1887b9f",
|
||||
"ovPayTokenId": 13,
|
||||
"createdOn": "2024-10-04T12:34:56.000",
|
||||
"lastUpdatedOn": "2024-10-04T12:34:56.000",
|
||||
"createdBy": "someuser",
|
||||
"lastUpdatedBy": null,
|
||||
},
|
||||
],
|
||||
"purchasedTapconnectTickets": [],
|
||||
"issuedVouchers": [],
|
||||
}
|
||||
]
|
||||
}
|
||||
Create Single Purchased TapConnet Ticket:
|
||||
value:
|
||||
{
|
||||
"purchasedProducts":[
|
||||
{
|
||||
"productId": 11,
|
||||
"createdOn": "2024-10-04T12:34:56.000",
|
||||
"lastUpdatedOn": "2024-10-04T12:34:56.000",
|
||||
"purchasedProductResources":
|
||||
[
|
||||
{
|
||||
"resourceNameId": 1,
|
||||
"resourceIdentifier": "408eefa9-b393-4bb3-8439-b2e51833abc7",
|
||||
},
|
||||
{
|
||||
"resourceNameId": 2,
|
||||
"resourceIdentifier": "f809a6e1-1c8d-4f8e-8a6e-0d0b1e1e1e1e",
|
||||
},
|
||||
],
|
||||
"purchasedGboProducts": [],
|
||||
"purchasedTapconnectTickets":
|
||||
[
|
||||
{
|
||||
"issuedAt": "2024-10-04T12:34:56.000",
|
||||
"activatedAt": "2024-10-04T12:34:56.000",
|
||||
"cancelledAt": null,
|
||||
"ticketReference": "KJj43nejhbTxhr897287",
|
||||
"createdOn": "2024-10-04T12:34:56.000",
|
||||
"lastUpdatedOn": "2024-10-04T12:34:56.000",
|
||||
"createdBy": "user",
|
||||
"lastUpdatedBy": "user",
|
||||
},
|
||||
],
|
||||
"issuedVouchers": [],
|
||||
}
|
||||
]
|
||||
}
|
||||
Create Single Issued Voucher:
|
||||
value:
|
||||
{
|
||||
"purchasedProducts":[
|
||||
{
|
||||
"productId": 11,
|
||||
"createdOn": "2024-10-04T12:34:56.000",
|
||||
"lastUpdatedOn": "2024-10-04T12:34:56.000",
|
||||
"purchasedProductResources":
|
||||
[
|
||||
{
|
||||
"resourceNameId": 1,
|
||||
"resourceIdentifier": "408eefa9-b393-4bb3-8439-b2e51833abc7",
|
||||
},
|
||||
{
|
||||
"resourceNameId": 2,
|
||||
"resourceIdentifier": "f809a6e1-1c8d-4f8e-8a6e-0d0b1e1e1e1e",
|
||||
},
|
||||
],
|
||||
"purchasedGboProducts": [],
|
||||
"purchasedTapconnectTickets": [],
|
||||
"issuedVouchers":
|
||||
[
|
||||
{
|
||||
"voucherCode": "VOUCHER123",
|
||||
"voucherStatusInstances":
|
||||
[
|
||||
{
|
||||
"voucherStatusId": 1,
|
||||
"createdOn": "2024-10-04T12:34:56.000",
|
||||
},
|
||||
],
|
||||
"voucherClaims":
|
||||
[
|
||||
{
|
||||
"mandatoryCustomerDataItemId": 8,
|
||||
"value": "1999-12-31",
|
||||
},
|
||||
{
|
||||
"mandatoryCustomerDataItemId": 4,
|
||||
"value": "vlad.harkonnen@househarkonnen.net",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
}
|
||||
Create Multiple Issued Vouchers:
|
||||
value:
|
||||
{
|
||||
"purchasedProducts":[
|
||||
{
|
||||
"productId": 11,
|
||||
"createdOn": "2024-10-04T12:34:56.000",
|
||||
"lastUpdatedOn": "2024-10-04T12:34:56.000",
|
||||
"purchasedProductResources":
|
||||
[
|
||||
{
|
||||
"resourceNameId": 1,
|
||||
"resourceIdentifier": "408eefa9-b393-4bb3-8439-b2e51833abc7",
|
||||
},
|
||||
{
|
||||
"resourceNameId": 2,
|
||||
"resourceIdentifier": "f809a6e1-1c8d-4f8e-8a6e-0d0b1e1e1e1e",
|
||||
},
|
||||
],
|
||||
"purchasedGboProducts": [],
|
||||
"purchasedTapconnectTickets": [],
|
||||
"issuedVouchers":
|
||||
[
|
||||
{
|
||||
"voucherCode": "VOUCHER123",
|
||||
"voucherStatusInstances":
|
||||
[
|
||||
{
|
||||
"voucherStatusId": 1,
|
||||
"createdOn": "2024-10-04T12:34:56.000",
|
||||
},
|
||||
],
|
||||
"voucherClaims":
|
||||
[
|
||||
{
|
||||
"mandatoryCustomerDataItemId": 8,
|
||||
"value": "1999-12-31",
|
||||
},
|
||||
{
|
||||
"mandatoryCustomerDataItemId": 4,
|
||||
"value": "vlad.harkonnen@househarkonnen.net",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"productId": 11,
|
||||
"createdOn": "2024-10-04T12:34:56.000",
|
||||
"lastUpdatedOn": "2024-10-04T12:34:56.000",
|
||||
"purchasedProductResources":
|
||||
[
|
||||
{
|
||||
"resourceNameId": 1,
|
||||
"resourceIdentifier": "7ce32f9b-52f0-4e80-a527-0c6184b57f52",
|
||||
},
|
||||
{
|
||||
"resourceNameId": 2,
|
||||
"resourceIdentifier": "02047745-f03e-4c00-8e1b-8dc5c86a786e",
|
||||
},
|
||||
],
|
||||
"purchasedGboProducts": [],
|
||||
"purchasedTapconnectTickets": [],
|
||||
"issuedVouchers":
|
||||
[
|
||||
{
|
||||
"voucherCode": "VOUCHER123",
|
||||
"voucherStatusInstances":
|
||||
[
|
||||
{
|
||||
"voucherStatusId": 1,
|
||||
"createdOn": "2024-10-04T12:34:56.000",
|
||||
},
|
||||
],
|
||||
"voucherClaims":
|
||||
[
|
||||
{
|
||||
"mandatoryCustomerDataItemId": 8,
|
||||
"value": "1940-01-18",
|
||||
},
|
||||
{
|
||||
"mandatoryCustomerDataItemId": 4,
|
||||
"value": "valdemar.hoskanner@househarkonnen.net",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"productId": 11,
|
||||
"createdOn": "2024-10-04T12:34:56.000",
|
||||
"lastUpdatedOn": "2024-10-04T12:34:56.000",
|
||||
"purchasedProductResources":
|
||||
[
|
||||
{
|
||||
"resourceNameId": 1,
|
||||
"resourceIdentifier": "7c71ec8a-3326-451f-9464-3e36d10260e3",
|
||||
},
|
||||
{
|
||||
"resourceNameId": 2,
|
||||
"resourceIdentifier": "73c7a805-2edf-4616-a04c-267e88e0931c",
|
||||
},
|
||||
],
|
||||
"purchasedGboProducts": [],
|
||||
"purchasedTapconnectTickets": [],
|
||||
"issuedVouchers":
|
||||
[
|
||||
{
|
||||
"voucherCode": "VOUCHER123",
|
||||
"voucherStatusInstances":
|
||||
[
|
||||
{
|
||||
"voucherStatusId": 1,
|
||||
"createdOn": "2024-10-04T12:34:56.000",
|
||||
},
|
||||
],
|
||||
"voucherClaims":
|
||||
[
|
||||
{
|
||||
"mandatoryCustomerDataItemId": 8,
|
||||
"value": "2016-06-08",
|
||||
},
|
||||
{
|
||||
"mandatoryCustomerDataItemId": 4,
|
||||
"value": "alia.artreides@housearteides.net",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
}
|
||||
responses:
|
||||
"202":
|
||||
description: Accepted
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/BulkResponseBody"
|
||||
examples:
|
||||
Array of purchased products accepted:
|
||||
summary: Array of purchased products accepted
|
||||
description: |
|
||||
The array of purchased products was accepted successfully.
|
||||
The purchased products will be processed asynchronously.
|
||||
In the response body the consumer will find information on how to retrieve the processing status.
|
||||
value:
|
||||
startTime: 2025-02-14T05:32:47.0672237Z
|
||||
status: Running
|
||||
clientTrackingId: 08584620957189579629541919368CU00
|
||||
callbackurl: https://api.integratielaag.nl/purchasedproducts/responsestatus/runtime/webhooks/workflow/scaleUnits/prod-00/workflows/6fd466916c
|
||||
retryAfter: 10
|
||||
summary: null
|
||||
/purchasedproducts/bulk/{clientTrackingId}:
|
||||
get:
|
||||
tags:
|
||||
- Bulk processing
|
||||
summary: Get the status of the purchased products bulk post.
|
||||
description: Get the status of the asynchronous purchased products bulk post.
|
||||
parameters:
|
||||
- in: path
|
||||
name: clientTrackingId
|
||||
schema:
|
||||
type: string
|
||||
required: true
|
||||
description: The clientTrackingId of the purchased products bulk post.
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/BulkResponseBody"
|
||||
examples:
|
||||
Batch successfully processed:
|
||||
summary: Batch successfully processed
|
||||
description: |
|
||||
Body of a batch of purchased products that was successfully created.
|
||||
A number of purchased products were created.
|
||||
value:
|
||||
startTime: "2025-02-14T05:32:47.067Z"
|
||||
status: "Finished"
|
||||
clientTrackingId: "08584620957189579629541919368CU00"
|
||||
callbackurl: https://api.integratielaag.nl/purchasedproducts/bulk/responsestatus/webhooks/workflow/scaleUnits/prod-00/workflows/6fd466916c
|
||||
retryAfter: 0
|
||||
summary:
|
||||
created: 13
|
||||
updated: 0
|
||||
total: 13
|
||||
/voucherstatusinstances/bulk:
|
||||
post:
|
||||
summary: Post voucher status instances in bulk.
|
||||
description: Post voucher status instances in bulk.
|
||||
tags:
|
||||
- Bulk processing
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/unavailable"
|
||||
examples:
|
||||
List of issued vouchers to set status to revoked:
|
||||
summary: List of issued vouchers to set status to revoked
|
||||
description: List of issued vouchers to set status to revoked
|
||||
value:
|
||||
{
|
||||
"voucherStatusInstances":[
|
||||
{
|
||||
"issuedVoucherId": "8a63552f-faf5-43f3-b22d-bebc976a8a5e",
|
||||
"voucherStatusId": 4,
|
||||
"createdOn": "2024-10-04T12:34:56.000"
|
||||
},
|
||||
{
|
||||
"issuedVoucherId": "a9ff40ec-2940-413a-9957-dfd471c4caf3",
|
||||
"voucherStatusId": 4,
|
||||
"createdOn": "2024-10-04T12:34:56.000"
|
||||
},
|
||||
{
|
||||
"issuedVoucherId": "9e7363e6-beaa-4c38-9ed6-c8afed459bd5",
|
||||
"voucherStatusId": 4,
|
||||
"createdOn": "2024-10-04T12:34:56.000"
|
||||
},
|
||||
{
|
||||
"issuedVoucherId": "9d7332d6-1949-4c20-aa99-d87096b035fa",
|
||||
"voucherStatusId": 4,
|
||||
"createdOn": "2024-10-04T12:34:56.000"
|
||||
},
|
||||
{
|
||||
"issuedVoucherId": "43ca757b-8370-4cb0-92b9-717948383d5e",
|
||||
"voucherStatusId": 4,
|
||||
"createdOn": "2024-10-04T12:34:56.000"
|
||||
},
|
||||
]
|
||||
}
|
||||
responses:
|
||||
"202":
|
||||
description: Accepted
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/BulkResponseBody"
|
||||
examples:
|
||||
Array of issued vouchers accepted:
|
||||
summary: Array of issued vouchers status instances accepted
|
||||
description: |
|
||||
The array of issued vouchers status instances was accepted successfully.
|
||||
The issued vouchers status instances will be processed asynchronously.
|
||||
In the response body the consumer will find information on how to retrieve the processing status.
|
||||
value:
|
||||
startTime: 2025-02-14T05:32:47.0672237Z
|
||||
status: Running
|
||||
clientTrackingId: 08584620957189579629541919368CU00
|
||||
callbackurl: https://api.integratielaag.nl/voucherstatusinstances/bulk/responsestatus/webhooks/workflow/scaleUnits/prod-00/workflows/6fd466916c
|
||||
retryAfter: 10
|
||||
summary: null
|
||||
/voucherstatusinstances/bulk/responsestatus/{clientTrackingId}:
|
||||
get:
|
||||
tags:
|
||||
- Bulk processing
|
||||
summary: Get the status of the voucher status instances bulk post.
|
||||
description: Get the status of the asynchronous voucher status instances bulk post.
|
||||
parameters:
|
||||
- in: path
|
||||
name: clientTrackingId
|
||||
schema:
|
||||
type: string
|
||||
required: true
|
||||
description: The clientTrackingId of the voucher status instances bulk post.
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/BulkResponseBody"
|
||||
examples:
|
||||
Batch successfully processed:
|
||||
summary: Batch successfully processed
|
||||
description: |
|
||||
Body of a batch of voucher status instances that was successfully created.
|
||||
A number of voucher status instances were created.
|
||||
value:
|
||||
startTime: "2025-02-14T05:32:47.067Z"
|
||||
status: "Finished"
|
||||
clientTrackingId: "08584620957189579629541919368CU00"
|
||||
callbackurl: https://api.integratielaag.nl/voucherstatusinstances/bulk/responsestatus/webhooks/workflow/scaleUnits/prod-00/workflows/6fd466916c
|
||||
retryAfter: 0
|
||||
summary:
|
||||
created: 5
|
||||
updated: 0
|
||||
total: 5
|
||||
components:
|
||||
securitySchemes:
|
||||
bearerToken:
|
||||
@@ -1607,6 +1238,67 @@ components:
|
||||
schemas:
|
||||
unavailable:
|
||||
type: object
|
||||
PostPurchasedTapConnectTicketRequest:
|
||||
type: object
|
||||
required:
|
||||
- issuedAt
|
||||
- ticketReference
|
||||
- createdOn
|
||||
- lastUpdatedOn
|
||||
- createdBy
|
||||
- serviceId
|
||||
- activateBefore
|
||||
properties:
|
||||
issuedAt:
|
||||
type: string
|
||||
format: date-time
|
||||
example: 2024-10-04T12:34:56.000
|
||||
activatedAt:
|
||||
type: string
|
||||
format: date-time
|
||||
example: 2024-10-04T12:34:56.000
|
||||
cancelledAt:
|
||||
type: string
|
||||
format: date-time
|
||||
example: 2024-10-04T12:34:56.000
|
||||
ticketReference:
|
||||
type: string
|
||||
example: KJj43nejhbTxhr897287
|
||||
createdOn:
|
||||
type: string
|
||||
format: date-time
|
||||
example: 2024-10-04T12:34:56.000
|
||||
lastUpdatedOn:
|
||||
type: string
|
||||
format: date-time
|
||||
example: 2024-10-04T12:34:56.000
|
||||
createdBy:
|
||||
type: string
|
||||
example: John Doe
|
||||
lastUpdatedBy:
|
||||
type: string
|
||||
example: John Doe
|
||||
externalDeviceId:
|
||||
type: string
|
||||
example: c5545584-04af-4c60-a955-d6a70baab848
|
||||
serviceId:
|
||||
type: string
|
||||
example: HTM-1234-7654-8945
|
||||
activateBefore:
|
||||
type: string
|
||||
format: date
|
||||
description: Tickets can only be activated BEFORE this date. Should be equal to TapConnect's `lifeSpanEnd + P1D`
|
||||
example: 2024-10-08
|
||||
validityStart:
|
||||
type: string
|
||||
format: date-time
|
||||
description: The date-time at which the ticket will become valid for for traveling. The ticket will not be valid before this date/time.
|
||||
example: 2024-10-05T12:34:56.000
|
||||
validityEnd:
|
||||
type: string
|
||||
format: date-time
|
||||
description: The date-time at which the ticket will become invalid for traveling. The ticket will not be valid after this date/time.
|
||||
example: 2024-10-06T12:34:56.000
|
||||
BulkResponseBody:
|
||||
type: object
|
||||
properties:
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
# 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
@@ -0,0 +1,89 @@
|
||||
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
@@ -0,0 +1,162 @@
|
||||
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.
@@ -0,0 +1,60 @@
|
||||
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
@@ -0,0 +1,17 @@
|
||||
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
@@ -0,0 +1,25 @@
|
||||
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
@@ -0,0 +1,18 @@
|
||||
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
@@ -0,0 +1,228 @@
|
||||
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")
|
||||
)
|
||||
@@ -0,0 +1,13 @@
|
||||
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()
|
||||
@@ -0,0 +1,8 @@
|
||||
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
@@ -0,0 +1,69 @@
|
||||
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
@@ -0,0 +1,83 @@
|
||||
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"
|
||||
Reference in new issue
Block a user