gdc-common-utils-ts 1.20.2 → 1.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/claims/claims-helpers-related-person.d.ts +14 -0
- package/dist/claims/claims-helpers-related-person.js +28 -0
- package/dist/constants/Schemas.d.ts +3 -0
- package/dist/constants/Schemas.js +3 -0
- package/dist/constants/fhir-code-systems.d.ts +1 -0
- package/dist/constants/fhir-code-systems.js +1 -0
- package/dist/constants/fhir-resource-types.d.ts +2 -0
- package/dist/constants/fhir-resource-types.js +1 -0
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/index.js +3 -0
- package/dist/constants/individual-sections.d.ts +210 -0
- package/dist/constants/individual-sections.js +35 -0
- package/dist/constants/lifecycle.d.ts +17 -0
- package/dist/constants/lifecycle.js +18 -0
- package/dist/constants/observation-category.d.ts +72 -0
- package/dist/constants/observation-category.js +30 -0
- package/dist/constants/schemaorg.d.ts +4 -0
- package/dist/constants/schemaorg.js +4 -0
- package/dist/constants/vital-signs.d.ts +2 -17
- package/dist/constants/vital-signs.js +1 -6
- package/dist/convert/convert-observation.d.ts +20 -2
- package/dist/convert/convert-observation.js +80 -9
- package/dist/examples/index.d.ts +2 -0
- package/dist/examples/index.js +2 -0
- package/dist/examples/invoice.d.ts +37 -0
- package/dist/examples/invoice.js +72 -0
- package/dist/examples/license.d.ts +161 -0
- package/dist/examples/license.js +136 -7
- package/dist/examples/lifecycle.d.ts +44 -0
- package/dist/examples/lifecycle.js +25 -0
- package/dist/examples/related-person.d.ts +348 -0
- package/dist/examples/related-person.js +184 -2
- package/dist/examples/shared.d.ts +110 -8
- package/dist/examples/shared.js +129 -17
- package/dist/examples/vital-signs.d.ts +56 -0
- package/dist/examples/vital-signs.js +159 -0
- package/dist/models/fhir-documents.d.ts +35 -0
- package/dist/models/indexing.d.ts +68 -6
- package/dist/models/indexing.js +294 -11
- package/dist/models/interoperable-claims/index.d.ts +1 -0
- package/dist/models/interoperable-claims/index.js +1 -0
- package/dist/models/interoperable-claims/invoice-claims.d.ts +277 -0
- package/dist/models/interoperable-claims/invoice-claims.js +353 -0
- package/dist/models/interoperable-claims/observation-claims.d.ts +253 -1
- package/dist/models/interoperable-claims/observation-claims.js +249 -3
- package/dist/models/interoperable-claims.d.ts +1 -1
- package/dist/models/interoperable-claims.js +1 -1
- package/dist/models/urlPath.d.ts +3 -1
- package/dist/models/urlPath.js +2 -0
- package/dist/utils/bundle-document-builder.js +22 -4
- package/dist/utils/bundle-editor.d.ts +105 -2
- package/dist/utils/bundle-editor.js +282 -2
- package/dist/utils/clinical-resource-converters.d.ts +4 -4
- package/dist/utils/clinical-resource-converters.js +5 -5
- package/dist/utils/communication-attached-bundle-session.d.ts +11 -0
- package/dist/utils/communication-attached-bundle-session.js +29 -0
- package/dist/utils/consent-lifecycle-result-reader.d.ts +24 -0
- package/dist/utils/consent-lifecycle-result-reader.js +27 -0
- package/dist/utils/employee.d.ts +25 -0
- package/dist/utils/employee.js +57 -0
- package/dist/utils/gw-core-path.d.ts +24 -0
- package/dist/utils/gw-core-path.js +21 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/index.js +11 -0
- package/dist/utils/individual-bundle-vault.d.ts +144 -0
- package/dist/utils/individual-bundle-vault.js +455 -0
- package/dist/utils/individual-organization-lifecycle.d.ts +104 -0
- package/dist/utils/individual-organization-lifecycle.js +179 -0
- package/dist/utils/interoperable-resource-operation.d.ts +158 -0
- package/dist/utils/interoperable-resource-operation.js +244 -0
- package/dist/utils/invoice-bundle.d.ts +82 -0
- package/dist/utils/invoice-bundle.js +240 -0
- package/dist/utils/license-commercial-search.d.ts +118 -0
- package/dist/utils/license-commercial-search.js +228 -0
- package/dist/utils/license-list-search.d.ts +105 -0
- package/dist/utils/license-list-search.js +209 -0
- package/dist/utils/license-offer-order.d.ts +107 -0
- package/dist/utils/license-offer-order.js +262 -0
- package/dist/utils/license.d.ts +6 -0
- package/dist/utils/license.js +6 -0
- package/dist/utils/lifecycle-result-reader.d.ts +33 -0
- package/dist/utils/lifecycle-result-reader.js +99 -0
- package/dist/utils/related-person-list.d.ts +20 -0
- package/dist/utils/related-person-list.js +54 -0
- package/package.json +2 -1
|
@@ -2,20 +2,68 @@
|
|
|
2
2
|
// File: src/utils/convert-observation.ts
|
|
3
3
|
import { ObservationClaim } from '../models/interoperable-claims/observation-claims.js';
|
|
4
4
|
import { codingFromValue, codingListToCsv, codingToValue, referenceListToCsv, referenceToValue } from './convert-shared.js';
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Converts flat editable Observation claims into a FHIR R4 Observation.
|
|
7
|
+
*
|
|
8
|
+
* Naming convention:
|
|
9
|
+
* - place the concrete FHIR version suffix at the end of the helper name
|
|
10
|
+
* - prefer `observationFromFlatToFhirR4` / `observationToFlatFhirR4`
|
|
11
|
+
* - avoid `observationFhirR4ToFlat`
|
|
12
|
+
*/
|
|
13
|
+
export function observationFromFlatToFhirR4(claims) {
|
|
6
14
|
const subject = claims[ObservationClaim.Subject] ?? claims[ObservationClaim.Patient];
|
|
15
|
+
const codeToken = claims[ObservationClaim.Code]
|
|
16
|
+
?? codingToValue({
|
|
17
|
+
system: claims[ObservationClaim.CodeSystem],
|
|
18
|
+
code: claims[ObservationClaim.CodeValue],
|
|
19
|
+
});
|
|
20
|
+
const valueConceptToken = claims[ObservationClaim.ValueConcept]
|
|
21
|
+
?? codingToValue({
|
|
22
|
+
system: claims[ObservationClaim.ValueConceptSystem],
|
|
23
|
+
code: claims[ObservationClaim.ValueConceptValue],
|
|
24
|
+
});
|
|
25
|
+
const valueQuantityCoding = codingFromValue(claims[ObservationClaim.ValueQuantityUnit])?.[0];
|
|
7
26
|
return {
|
|
8
27
|
resourceType: 'Observation',
|
|
9
28
|
identifier: claims[ObservationClaim.Identifier] ? [{ value: claims[ObservationClaim.Identifier] }] : undefined,
|
|
10
29
|
status: claims[ObservationClaim.Status],
|
|
11
30
|
category: claims[ObservationClaim.Category] ? claims[ObservationClaim.Category].split(',').map((value) => ({ coding: codingFromValue(value.trim()) })) : undefined,
|
|
12
|
-
code:
|
|
31
|
+
code: codeToken
|
|
32
|
+
? {
|
|
33
|
+
coding: codingFromValue(codeToken),
|
|
34
|
+
...(claims[ObservationClaim.CodeText] || claims[ObservationClaim.CodeDisplay]
|
|
35
|
+
? { text: claims[ObservationClaim.CodeText] ?? claims[ObservationClaim.CodeDisplay] }
|
|
36
|
+
: {}),
|
|
37
|
+
}
|
|
38
|
+
: undefined,
|
|
13
39
|
subject: subject ? { reference: subject } : undefined,
|
|
14
40
|
effectiveDateTime: claims[ObservationClaim.EffectiveDateTime] ?? claims[ObservationClaim.Date],
|
|
15
41
|
issued: claims[ObservationClaim.EffectiveDateTime] ? undefined : claims[ObservationClaim.Date],
|
|
16
42
|
performer: claims[ObservationClaim.Performer] ? claims[ObservationClaim.Performer].split(',').map((reference) => ({ reference: reference.trim() })) : undefined,
|
|
17
|
-
valueCodeableConcept:
|
|
43
|
+
valueCodeableConcept: valueConceptToken
|
|
44
|
+
? {
|
|
45
|
+
coding: codingFromValue(valueConceptToken),
|
|
46
|
+
...(claims[ObservationClaim.ValueConceptText] || claims[ObservationClaim.ValueConceptDisplay]
|
|
47
|
+
? { text: claims[ObservationClaim.ValueConceptText] ?? claims[ObservationClaim.ValueConceptDisplay] }
|
|
48
|
+
: {}),
|
|
49
|
+
}
|
|
50
|
+
: undefined,
|
|
18
51
|
valueDateTime: claims[ObservationClaim.ValueDate],
|
|
52
|
+
valueQuantity: claims[ObservationClaim.ValueQuantityNumber]
|
|
53
|
+
? {
|
|
54
|
+
value: Number(claims[ObservationClaim.ValueQuantityNumber]),
|
|
55
|
+
...(claims[ObservationClaim.ValueQuantityComparator]
|
|
56
|
+
? { comparator: claims[ObservationClaim.ValueQuantityComparator] }
|
|
57
|
+
: {}),
|
|
58
|
+
...(claims[ObservationClaim.ValueQuantityUnit]
|
|
59
|
+
? {
|
|
60
|
+
unit: claims[ObservationClaim.ValueQuantityUnit],
|
|
61
|
+
...(valueQuantityCoding?.system ? { system: valueQuantityCoding.system } : {}),
|
|
62
|
+
...(valueQuantityCoding?.code ? { code: valueQuantityCoding.code } : {}),
|
|
63
|
+
}
|
|
64
|
+
: {}),
|
|
65
|
+
}
|
|
66
|
+
: undefined,
|
|
19
67
|
valueString: claims[ObservationClaim.ValueString],
|
|
20
68
|
note: claims[ObservationClaim.Note] ? [{ text: claims[ObservationClaim.Note] }] : undefined,
|
|
21
69
|
basedOn: claims[ObservationClaim.BasedOn] ? claims[ObservationClaim.BasedOn].split(',').map((reference) => ({ reference: reference.trim() })) : undefined,
|
|
@@ -25,16 +73,27 @@ export function observationFlatToFhirR4(claims) {
|
|
|
25
73
|
hasMember: claims[ObservationClaim.HasMember] ? claims[ObservationClaim.HasMember].split(',').map((reference) => ({ reference: reference.trim() })) : undefined,
|
|
26
74
|
method: claims[ObservationClaim.Method] ? { coding: codingFromValue(claims[ObservationClaim.Method]) } : undefined,
|
|
27
75
|
specimen: claims[ObservationClaim.Specimen] ? { reference: claims[ObservationClaim.Specimen] } : undefined,
|
|
28
|
-
component: claims[ObservationClaim.ComponentCode] ? [{ code: { coding: codingFromValue(claims[ObservationClaim.ComponentCode]) } }] : undefined,
|
|
29
76
|
};
|
|
30
77
|
}
|
|
31
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Converts a FHIR R4 Observation into the flat editable claims contract.
|
|
80
|
+
*
|
|
81
|
+
* `Observation.category` stays in `Observation.category`.
|
|
82
|
+
* Coded result values belong in `Observation.value-concept-*`.
|
|
83
|
+
*/
|
|
84
|
+
export function observationToFlatFhirR4(resource) {
|
|
32
85
|
const valueCodeableConcept = resource.valueCodeableConcept;
|
|
33
|
-
const
|
|
86
|
+
const codeCoding = resource.code?.coding?.[0];
|
|
87
|
+
const valueConceptCoding = valueCodeableConcept?.coding?.[0];
|
|
88
|
+
const valueQuantity = resource.valueQuantity;
|
|
34
89
|
return {
|
|
35
90
|
[ObservationClaim.BasedOn]: referenceListToCsv(resource.basedOn),
|
|
36
91
|
[ObservationClaim.Category]: codingListToCsv(resource.category?.flatMap((item) => item.coding || [])),
|
|
37
|
-
[ObservationClaim.Code]: codingToValue(
|
|
92
|
+
[ObservationClaim.Code]: codingToValue(codeCoding),
|
|
93
|
+
[ObservationClaim.CodeSystem]: codeCoding?.system,
|
|
94
|
+
[ObservationClaim.CodeValue]: codeCoding?.code,
|
|
95
|
+
[ObservationClaim.CodeText]: resource.code?.text,
|
|
96
|
+
[ObservationClaim.CodeDisplay]: codeCoding?.display,
|
|
38
97
|
[ObservationClaim.Date]: resource.effectiveDateTime || resource.issued,
|
|
39
98
|
[ObservationClaim.Device]: referenceToValue(resource.device),
|
|
40
99
|
[ObservationClaim.Encounter]: referenceToValue(resource.encounter),
|
|
@@ -47,11 +106,23 @@ export function observationFhirR4ToFlat(resource) {
|
|
|
47
106
|
[ObservationClaim.Specimen]: referenceToValue(resource.specimen),
|
|
48
107
|
[ObservationClaim.Status]: resource.status,
|
|
49
108
|
[ObservationClaim.Subject]: referenceToValue(resource.subject),
|
|
50
|
-
[ObservationClaim.ValueConcept]: codingToValue(
|
|
109
|
+
[ObservationClaim.ValueConcept]: codingToValue(valueConceptCoding),
|
|
110
|
+
[ObservationClaim.ValueConceptSystem]: valueConceptCoding?.system,
|
|
111
|
+
[ObservationClaim.ValueConceptValue]: valueConceptCoding?.code,
|
|
112
|
+
[ObservationClaim.ValueConceptText]: valueCodeableConcept?.text,
|
|
113
|
+
[ObservationClaim.ValueConceptDisplay]: valueConceptCoding?.display,
|
|
51
114
|
[ObservationClaim.ValueDate]: resource.valueDateTime,
|
|
115
|
+
[ObservationClaim.ValueQuantityComparator]: valueQuantity?.comparator,
|
|
116
|
+
[ObservationClaim.ValueQuantityNumber]: valueQuantity?.value !== undefined ? String(valueQuantity.value) : undefined,
|
|
117
|
+
[ObservationClaim.ValueQuantityUnit]: codingToValue(valueQuantity?.system || valueQuantity?.code
|
|
118
|
+
? { system: valueQuantity?.system, code: valueQuantity?.code }
|
|
119
|
+
: undefined) || valueQuantity?.unit,
|
|
52
120
|
[ObservationClaim.ValueString]: resource.valueString,
|
|
53
|
-
[ObservationClaim.ComponentCode]: codingToValue(component?.code?.coding?.[0]),
|
|
54
121
|
[ObservationClaim.Note]: resource.note?.[0]?.text,
|
|
55
122
|
[ObservationClaim.EffectiveDateTime]: resource.effectiveDateTime,
|
|
56
123
|
};
|
|
57
124
|
}
|
|
125
|
+
/** @deprecated Prefer `observationFromFlatToFhirR4`. */
|
|
126
|
+
export const observationFlatToFhirR4 = observationFromFlatToFhirR4;
|
|
127
|
+
/** @deprecated Prefer `observationToFlatFhirR4`. */
|
|
128
|
+
export const observationFhirR4ToFlat = observationToFlatFhirR4;
|
package/dist/examples/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './individual-controller';
|
|
|
6
6
|
export * from './professional';
|
|
7
7
|
export * from './employee';
|
|
8
8
|
export * from './license';
|
|
9
|
+
export * from './invoice';
|
|
9
10
|
export * from './related-person';
|
|
10
11
|
export * from './consent-access';
|
|
11
12
|
export * from './relationship-access';
|
|
@@ -16,3 +17,4 @@ export * from './contract-examples';
|
|
|
16
17
|
export * from './communication-attached-bundle-session';
|
|
17
18
|
export * from './communication-bundle-document-request';
|
|
18
19
|
export * from './ips-bundle';
|
|
20
|
+
export * from './vital-signs';
|
package/dist/examples/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export * from './individual-controller.js';
|
|
|
6
6
|
export * from './professional.js';
|
|
7
7
|
export * from './employee.js';
|
|
8
8
|
export * from './license.js';
|
|
9
|
+
export * from './invoice.js';
|
|
9
10
|
export * from './related-person.js';
|
|
10
11
|
export * from './consent-access.js';
|
|
11
12
|
export * from './relationship-access.js';
|
|
@@ -16,3 +17,4 @@ export * from './contract-examples.js';
|
|
|
16
17
|
export * from './communication-attached-bundle-session.js';
|
|
17
18
|
export * from './communication-bundle-document-request.js';
|
|
18
19
|
export * from './ips-bundle.js';
|
|
20
|
+
export * from './vital-signs.js';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const EXAMPLE_INVOICE_PDF_DOCUMENT: Readonly<{
|
|
2
|
+
readonly documentId: "invoice-001-pdf";
|
|
3
|
+
readonly contentType: "application/pdf";
|
|
4
|
+
readonly title: "invoice-001.pdf";
|
|
5
|
+
readonly description: "Human-readable invoice PDF";
|
|
6
|
+
readonly language: "en";
|
|
7
|
+
readonly dataBase64: "JVBERi0xLjQKJUZha2UgaW52b2ljZSBQREYK";
|
|
8
|
+
readonly createdAt: "2026-06-11T10:00:00Z";
|
|
9
|
+
}>;
|
|
10
|
+
export declare const EXAMPLE_INVOICE_JSON_DOCUMENT: Readonly<{
|
|
11
|
+
readonly documentId: "invoice-001-json";
|
|
12
|
+
readonly contentType: "application/json";
|
|
13
|
+
readonly title: "invoice-001.json";
|
|
14
|
+
readonly description: "Structured invoice JSON";
|
|
15
|
+
readonly language: "en";
|
|
16
|
+
readonly dataBase64: "eyJpbnZvaWNlSWQiOiJpbnZvaWNlLTAwMSJ9";
|
|
17
|
+
readonly createdAt: "2026-06-11T10:00:00Z";
|
|
18
|
+
}>;
|
|
19
|
+
export declare const EXAMPLE_INVOICE_BUNDLE: Readonly<Record<string, unknown>>;
|
|
20
|
+
export declare const EXAMPLE_INVOICE_CHARGE_ITEM_ROW_A: Readonly<{
|
|
21
|
+
readonly identifier: "chargeitem-001";
|
|
22
|
+
readonly status: "billable";
|
|
23
|
+
readonly partOf: "invoice-001";
|
|
24
|
+
readonly code: "08412345678903";
|
|
25
|
+
readonly codeText: "Botella de suero salino estéril 500 mL";
|
|
26
|
+
readonly category: "medical-supplies";
|
|
27
|
+
readonly supplierProductCode: "IMP-SAL-500";
|
|
28
|
+
readonly quantity: "3|bottle";
|
|
29
|
+
readonly quantityNumber: "3";
|
|
30
|
+
readonly quantityUnit: "bottle";
|
|
31
|
+
readonly itemsPerUnit: "24";
|
|
32
|
+
readonly itemsQuantity: "500|mL";
|
|
33
|
+
readonly itemsQuantityNumber: "500";
|
|
34
|
+
readonly itemsQuantityUnit: "mL";
|
|
35
|
+
}>;
|
|
36
|
+
export declare const EXAMPLE_INVOICE_FHIR_CLAIMS: Readonly<import("..").InvoiceClaims>;
|
|
37
|
+
export declare const EXAMPLE_INVOICE_CHARGEITEM_FHIR_CLAIMS_ROWS: readonly (import("..").InvoiceClaims & import("..").ChargeItemClaims)[];
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { EXAMPLE_INVOICE_CHARGEITEM_CATEGORY, EXAMPLE_INVOICE_CHARGEITEM_CODE_TEXT, EXAMPLE_INVOICE_CHARGEITEM_IDENTIFIER, EXAMPLE_INVOICE_CHARGEITEM_ITEMS_PER_UNIT, EXAMPLE_INVOICE_CHARGEITEM_ITEMS_QUANTITY, EXAMPLE_INVOICE_CHARGEITEM_ITEMS_QUANTITY_NUMBER, EXAMPLE_INVOICE_CHARGEITEM_ITEMS_QUANTITY_UNIT, EXAMPLE_INVOICE_CHARGEITEM_PART_OF, EXAMPLE_INVOICE_CHARGEITEM_PRODUCT_CODE, EXAMPLE_INVOICE_CHARGEITEM_QUANTITY, EXAMPLE_INVOICE_CHARGEITEM_QUANTITY_NUMBER, EXAMPLE_INVOICE_CHARGEITEM_STATUS, EXAMPLE_INVOICE_CHARGEITEM_SUPPLIER_PRODUCT_CODE, EXAMPLE_INVOICE_CHARGEITEM_QUANTITY_UNIT, EXAMPLE_API_ORGANIZATION_DID, EXAMPLE_CONTENT_TYPE_APPLICATION_JSON, EXAMPLE_DOCUMENT_REFERENCE_CONTENT_TYPE_PDF, EXAMPLE_DOCUMENT_REFERENCE_LANGUAGE, EXAMPLE_LICENSE_AMOUNT, EXAMPLE_LICENSE_INVOICE_ID, EXAMPLE_LICENSE_PAYMENT_METHOD_INVOICE, EXAMPLE_LICENSE_PAYMENT_URL, EXAMPLE_LICENSE_CURRENCY, EXAMPLE_SUBJECT_DID, EXAMPLE_INVOICE_DATE, EXAMPLE_VAULT_PRIMARY_DATE_TIME, } from './shared.js';
|
|
2
|
+
import { createInvoiceBundleEditor } from '../utils/invoice-bundle.js';
|
|
3
|
+
export const EXAMPLE_INVOICE_PDF_DOCUMENT = Object.freeze({
|
|
4
|
+
documentId: `${EXAMPLE_LICENSE_INVOICE_ID}-pdf`,
|
|
5
|
+
contentType: EXAMPLE_DOCUMENT_REFERENCE_CONTENT_TYPE_PDF,
|
|
6
|
+
title: `${EXAMPLE_LICENSE_INVOICE_ID}.pdf`,
|
|
7
|
+
description: 'Human-readable invoice PDF',
|
|
8
|
+
language: EXAMPLE_DOCUMENT_REFERENCE_LANGUAGE,
|
|
9
|
+
dataBase64: 'JVBERi0xLjQKJUZha2UgaW52b2ljZSBQREYK',
|
|
10
|
+
createdAt: EXAMPLE_VAULT_PRIMARY_DATE_TIME,
|
|
11
|
+
});
|
|
12
|
+
export const EXAMPLE_INVOICE_JSON_DOCUMENT = Object.freeze({
|
|
13
|
+
documentId: `${EXAMPLE_LICENSE_INVOICE_ID}-json`,
|
|
14
|
+
contentType: EXAMPLE_CONTENT_TYPE_APPLICATION_JSON,
|
|
15
|
+
title: `${EXAMPLE_LICENSE_INVOICE_ID}.json`,
|
|
16
|
+
description: 'Structured invoice JSON',
|
|
17
|
+
language: EXAMPLE_DOCUMENT_REFERENCE_LANGUAGE,
|
|
18
|
+
dataBase64: 'eyJpbnZvaWNlSWQiOiJpbnZvaWNlLTAwMSJ9',
|
|
19
|
+
createdAt: EXAMPLE_VAULT_PRIMARY_DATE_TIME,
|
|
20
|
+
});
|
|
21
|
+
export const EXAMPLE_INVOICE_BUNDLE = Object.freeze(createInvoiceBundleEditor()
|
|
22
|
+
.setInvoiceId(EXAMPLE_LICENSE_INVOICE_ID)
|
|
23
|
+
.setSubjectReference(EXAMPLE_SUBJECT_DID)
|
|
24
|
+
.setIssuerReference(EXAMPLE_API_ORGANIZATION_DID)
|
|
25
|
+
.setRecipientReference(EXAMPLE_SUBJECT_DID)
|
|
26
|
+
.setIssuedAt(EXAMPLE_INVOICE_DATE)
|
|
27
|
+
.setAmount(EXAMPLE_LICENSE_AMOUNT)
|
|
28
|
+
.setCurrency(EXAMPLE_LICENSE_CURRENCY)
|
|
29
|
+
.setPaymentMethod(EXAMPLE_LICENSE_PAYMENT_METHOD_INVOICE)
|
|
30
|
+
.setPaymentUrl(EXAMPLE_LICENSE_PAYMENT_URL)
|
|
31
|
+
.setPdfDocument(EXAMPLE_INVOICE_PDF_DOCUMENT)
|
|
32
|
+
.setStructuredDocument(EXAMPLE_INVOICE_JSON_DOCUMENT)
|
|
33
|
+
.buildBundle());
|
|
34
|
+
export const EXAMPLE_INVOICE_CHARGE_ITEM_ROW_A = Object.freeze({
|
|
35
|
+
identifier: EXAMPLE_INVOICE_CHARGEITEM_IDENTIFIER,
|
|
36
|
+
status: EXAMPLE_INVOICE_CHARGEITEM_STATUS,
|
|
37
|
+
partOf: EXAMPLE_INVOICE_CHARGEITEM_PART_OF,
|
|
38
|
+
code: EXAMPLE_INVOICE_CHARGEITEM_PRODUCT_CODE,
|
|
39
|
+
codeText: EXAMPLE_INVOICE_CHARGEITEM_CODE_TEXT,
|
|
40
|
+
category: EXAMPLE_INVOICE_CHARGEITEM_CATEGORY,
|
|
41
|
+
supplierProductCode: EXAMPLE_INVOICE_CHARGEITEM_SUPPLIER_PRODUCT_CODE,
|
|
42
|
+
quantity: EXAMPLE_INVOICE_CHARGEITEM_QUANTITY,
|
|
43
|
+
quantityNumber: EXAMPLE_INVOICE_CHARGEITEM_QUANTITY_NUMBER,
|
|
44
|
+
quantityUnit: EXAMPLE_INVOICE_CHARGEITEM_QUANTITY_UNIT,
|
|
45
|
+
itemsPerUnit: EXAMPLE_INVOICE_CHARGEITEM_ITEMS_PER_UNIT,
|
|
46
|
+
itemsQuantity: EXAMPLE_INVOICE_CHARGEITEM_ITEMS_QUANTITY,
|
|
47
|
+
itemsQuantityNumber: EXAMPLE_INVOICE_CHARGEITEM_ITEMS_QUANTITY_NUMBER,
|
|
48
|
+
itemsQuantityUnit: EXAMPLE_INVOICE_CHARGEITEM_ITEMS_QUANTITY_UNIT,
|
|
49
|
+
});
|
|
50
|
+
export const EXAMPLE_INVOICE_FHIR_CLAIMS = Object.freeze(createInvoiceBundleEditor()
|
|
51
|
+
.setInvoiceId(EXAMPLE_LICENSE_INVOICE_ID)
|
|
52
|
+
.setSubjectReference(EXAMPLE_SUBJECT_DID)
|
|
53
|
+
.setIssuerReference(EXAMPLE_API_ORGANIZATION_DID)
|
|
54
|
+
.setRecipientReference(EXAMPLE_SUBJECT_DID)
|
|
55
|
+
.setIssuedAt(EXAMPLE_INVOICE_DATE)
|
|
56
|
+
.setAmount(EXAMPLE_LICENSE_AMOUNT)
|
|
57
|
+
.setCurrency(EXAMPLE_LICENSE_CURRENCY)
|
|
58
|
+
.setPaymentMethod(EXAMPLE_LICENSE_PAYMENT_METHOD_INVOICE)
|
|
59
|
+
.setPaymentUrl(EXAMPLE_LICENSE_PAYMENT_URL)
|
|
60
|
+
.buildInvoiceClaims());
|
|
61
|
+
export const EXAMPLE_INVOICE_CHARGEITEM_FHIR_CLAIMS_ROWS = Object.freeze(createInvoiceBundleEditor()
|
|
62
|
+
.setInvoiceId(EXAMPLE_LICENSE_INVOICE_ID)
|
|
63
|
+
.setSubjectReference(EXAMPLE_SUBJECT_DID)
|
|
64
|
+
.setIssuerReference(EXAMPLE_API_ORGANIZATION_DID)
|
|
65
|
+
.setRecipientReference(EXAMPLE_SUBJECT_DID)
|
|
66
|
+
.setIssuedAt(EXAMPLE_INVOICE_DATE)
|
|
67
|
+
.setAmount(EXAMPLE_LICENSE_AMOUNT)
|
|
68
|
+
.setCurrency(EXAMPLE_LICENSE_CURRENCY)
|
|
69
|
+
.setPaymentMethod(EXAMPLE_LICENSE_PAYMENT_METHOD_INVOICE)
|
|
70
|
+
.setPaymentUrl(EXAMPLE_LICENSE_PAYMENT_URL)
|
|
71
|
+
.addChargeItem(EXAMPLE_INVOICE_CHARGE_ITEM_ROW_A)
|
|
72
|
+
.buildChargeItemClaimRows());
|
|
@@ -25,8 +25,169 @@ export declare const EXAMPLE_LICENSE_ACTIVE_RECORD: Readonly<{
|
|
|
25
25
|
readonly "org.schema.Person.hasOccupation.identifier.value": "ISCO-08|2211";
|
|
26
26
|
};
|
|
27
27
|
}>;
|
|
28
|
+
export declare const EXAMPLE_LICENSE_AVAILABLE_RECORD: Readonly<{
|
|
29
|
+
readonly id: "8a8a5e1b-0d8e-4a7c-8c39-3b8034440009";
|
|
30
|
+
readonly status: "available";
|
|
31
|
+
readonly subjectId: "urn:uuid:subject-license-available-001";
|
|
32
|
+
readonly claims: {
|
|
33
|
+
readonly "org.schema.IndividualProduct.serialNumber": "8a8a5e1b-0d8e-4a7c-8c39-3b8034440009";
|
|
34
|
+
readonly '@context': "org.schema";
|
|
35
|
+
readonly "org.schema.IndividualProduct.category": "professional";
|
|
36
|
+
readonly "org.schema.IndividualProduct.additionalType": "mobile";
|
|
37
|
+
readonly "org.schema.Person.email": "controller@acme.org";
|
|
38
|
+
readonly "org.schema.Person.hasOccupation.identifier.value": "ISCO-08|2211";
|
|
39
|
+
};
|
|
40
|
+
}>;
|
|
41
|
+
export declare const EXAMPLE_LICENSE_LIST_RESPONSE_BODY: Readonly<{
|
|
42
|
+
readonly data: readonly [{
|
|
43
|
+
readonly meta: {
|
|
44
|
+
readonly status: "active";
|
|
45
|
+
readonly subjectId: "urn:uuid:employee-controller-active-001";
|
|
46
|
+
readonly claims: {
|
|
47
|
+
readonly '@context': "org.schema";
|
|
48
|
+
readonly "org.schema.IndividualProduct.serialNumber": "8a8a5e1b-0d8e-4a7c-8c39-3b8034440001";
|
|
49
|
+
readonly "org.schema.IndividualProduct.category": "professional";
|
|
50
|
+
readonly "org.schema.IndividualProduct.additionalType": "mobile";
|
|
51
|
+
readonly "org.schema.Person.email": "controller@acme.org";
|
|
52
|
+
readonly "org.schema.Person.hasOccupation.identifier.value": "ISCO-08|2211";
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
}, {
|
|
56
|
+
readonly meta: {
|
|
57
|
+
readonly status: "available";
|
|
58
|
+
readonly subjectId: "urn:uuid:subject-license-available-001";
|
|
59
|
+
readonly claims: {
|
|
60
|
+
readonly "org.schema.IndividualProduct.serialNumber": "8a8a5e1b-0d8e-4a7c-8c39-3b8034440009";
|
|
61
|
+
readonly '@context': "org.schema";
|
|
62
|
+
readonly "org.schema.IndividualProduct.category": "professional";
|
|
63
|
+
readonly "org.schema.IndividualProduct.additionalType": "mobile";
|
|
64
|
+
readonly "org.schema.Person.email": "controller@acme.org";
|
|
65
|
+
readonly "org.schema.Person.hasOccupation.identifier.value": "ISCO-08|2211";
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
}];
|
|
69
|
+
}>;
|
|
28
70
|
export declare function buildExampleLicenseIssueClaims(): Readonly<Record<string, unknown>>;
|
|
29
71
|
export declare function buildExampleLicensePurchaseClaims(): Readonly<Record<string, unknown>>;
|
|
30
72
|
export declare const EXAMPLE_LICENSE_PURCHASE_CLAIMS: Readonly<Record<string, unknown>>;
|
|
31
73
|
export declare const EXAMPLE_LICENSE_ISSUE_CLAIMS: Readonly<Record<string, unknown>>;
|
|
32
74
|
export declare const EXAMPLE_LICENSE_PURCHASE_EXPECTED_SERIAL_NUMBER: string;
|
|
75
|
+
/**
|
|
76
|
+
* Shared high-level preview used by SDK/runtime tests when an onboarding start
|
|
77
|
+
* flow returns an `Offer`.
|
|
78
|
+
*/
|
|
79
|
+
export declare const EXAMPLE_LICENSE_OFFER_PREVIEW: Readonly<Readonly<{
|
|
80
|
+
offerId?: string;
|
|
81
|
+
amount?: string;
|
|
82
|
+
currency?: string;
|
|
83
|
+
seats?: number;
|
|
84
|
+
planName?: string;
|
|
85
|
+
sku?: string;
|
|
86
|
+
paymentMethod?: string;
|
|
87
|
+
checkoutUrl?: string;
|
|
88
|
+
}>>;
|
|
89
|
+
/**
|
|
90
|
+
* Shared high-level summary used by SDK/runtime tests when an order is
|
|
91
|
+
* confirmed and GW returns payment/activation fields.
|
|
92
|
+
*/
|
|
93
|
+
export declare const EXAMPLE_LICENSE_ORDER_SUMMARY: Readonly<Readonly<{
|
|
94
|
+
acceptedOfferId?: string;
|
|
95
|
+
paymentUrl?: string;
|
|
96
|
+
invoiceId?: string;
|
|
97
|
+
paymentMethod?: string;
|
|
98
|
+
activationCode?: string;
|
|
99
|
+
amount?: string;
|
|
100
|
+
currency?: string;
|
|
101
|
+
seats?: number;
|
|
102
|
+
}>>;
|
|
103
|
+
/**
|
|
104
|
+
* Shared operational defaults reused by runtime tests that need stored
|
|
105
|
+
* `DeviceLicense` examples instead of higher-level Offer/Order claims.
|
|
106
|
+
*/
|
|
107
|
+
export declare const EXAMPLE_LICENSE_RUNTIME_DEFAULTS: Readonly<{
|
|
108
|
+
readonly plan: "default";
|
|
109
|
+
readonly renewalCycle: "12m";
|
|
110
|
+
readonly reactivationEnabled: true;
|
|
111
|
+
}>;
|
|
112
|
+
export declare const EXAMPLE_LICENSE_OFFER_RESPONSE_BODY: Readonly<{
|
|
113
|
+
readonly data: readonly [{
|
|
114
|
+
readonly meta: {
|
|
115
|
+
readonly claims: {
|
|
116
|
+
readonly "org.schema.Offer.identifier": "urn:offer:family-003";
|
|
117
|
+
readonly "org.schema.Offer.price": "9.99";
|
|
118
|
+
readonly "org.schema.Offer.priceCurrency": "EUR";
|
|
119
|
+
readonly "org.schema.Offer.eligibleQuantity.value": 2;
|
|
120
|
+
readonly "org.schema.Offer.itemOffered.name": "Family starter";
|
|
121
|
+
readonly "org.schema.Offer.itemOffered.sku": "FAM-START";
|
|
122
|
+
readonly "org.schema.Offer.acceptedPaymentMethod": "invoice";
|
|
123
|
+
readonly "org.schema.Offer.checkoutPageURLTemplate": "https://pay.example/offer-001";
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
}];
|
|
127
|
+
}>;
|
|
128
|
+
export declare const EXAMPLE_LICENSE_ORDER_RESPONSE_BODY: Readonly<{
|
|
129
|
+
readonly body: {
|
|
130
|
+
readonly data: readonly [{
|
|
131
|
+
readonly resource: {
|
|
132
|
+
readonly meta: {
|
|
133
|
+
readonly claims: {
|
|
134
|
+
readonly "org.schema.Order.acceptedOffer.identifier": "urn:offer:family-003";
|
|
135
|
+
readonly "org.schema.Order.paymentUrl": "https://pay.example/invoice-001";
|
|
136
|
+
readonly "org.schema.Order.partOfInvoice": "invoice-001";
|
|
137
|
+
readonly "org.schema.Order.paymentMethod": "invoice";
|
|
138
|
+
readonly "org.schema.Offer.price": "9.99";
|
|
139
|
+
readonly "org.schema.Offer.priceCurrency": "EUR";
|
|
140
|
+
readonly "org.schema.Offer.eligibleQuantity.value": string;
|
|
141
|
+
readonly "org.schema.IndividualProduct.serialNumber": "ACT-001";
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
}];
|
|
146
|
+
};
|
|
147
|
+
}>;
|
|
148
|
+
export declare const EXAMPLE_LICENSE_OFFER_LIST_RESPONSE_BODY: Readonly<{
|
|
149
|
+
readonly data: readonly [{
|
|
150
|
+
readonly resource: {
|
|
151
|
+
readonly total: 1;
|
|
152
|
+
readonly data: readonly [{
|
|
153
|
+
readonly id: "urn:offer:family-003";
|
|
154
|
+
readonly meta: {
|
|
155
|
+
readonly status: "active";
|
|
156
|
+
readonly claims: {
|
|
157
|
+
readonly "org.schema.Offer.identifier": "urn:offer:family-003";
|
|
158
|
+
readonly "org.schema.Offer.price": "9.99";
|
|
159
|
+
readonly "org.schema.Offer.priceCurrency": "EUR";
|
|
160
|
+
readonly "org.schema.Offer.eligibleQuantity.value": 2;
|
|
161
|
+
readonly "org.schema.Offer.itemOffered.name": "Family starter";
|
|
162
|
+
readonly "org.schema.Offer.itemOffered.sku": "FAM-START";
|
|
163
|
+
readonly "org.schema.Offer.acceptedPaymentMethod": "invoice";
|
|
164
|
+
readonly "org.schema.Offer.checkoutPageURLTemplate": "https://pay.example/offer-001";
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
}];
|
|
168
|
+
};
|
|
169
|
+
}];
|
|
170
|
+
}>;
|
|
171
|
+
export declare const EXAMPLE_LICENSE_ORDER_LIST_RESPONSE_BODY: Readonly<{
|
|
172
|
+
readonly data: readonly [{
|
|
173
|
+
readonly resource: {
|
|
174
|
+
readonly total: 1;
|
|
175
|
+
readonly data: readonly [{
|
|
176
|
+
readonly id: "urn:offer:family-003";
|
|
177
|
+
readonly meta: {
|
|
178
|
+
readonly status: "active";
|
|
179
|
+
readonly claims: {
|
|
180
|
+
readonly "org.schema.Order.acceptedOffer.identifier": "urn:offer:family-003";
|
|
181
|
+
readonly "org.schema.Order.paymentUrl": "https://pay.example/invoice-001";
|
|
182
|
+
readonly "org.schema.Order.partOfInvoice": "invoice-001";
|
|
183
|
+
readonly "org.schema.Order.paymentMethod": "invoice";
|
|
184
|
+
readonly "org.schema.Offer.price": "9.99";
|
|
185
|
+
readonly "org.schema.Offer.priceCurrency": "EUR";
|
|
186
|
+
readonly "org.schema.Offer.eligibleQuantity.value": string;
|
|
187
|
+
readonly "org.schema.IndividualProduct.serialNumber": "ACT-001";
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
}];
|
|
191
|
+
};
|
|
192
|
+
}];
|
|
193
|
+
}>;
|
package/dist/examples/license.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { DeviceAppTypes, DeviceUserClasses } from '../constants/device.js';
|
|
2
|
-
import { ClaimsIndividualProductSchemaorg, ClaimsOfferSchemaorg, ClaimsPersonSchemaorg, } from '../constants/schemaorg.js';
|
|
3
|
-
import { buildLicenseIssueClaims, buildLicensePurchaseClaims, LicenseCategories, LicenseStatuses, } from '../utils/license.js';
|
|
4
|
-
import {
|
|
2
|
+
import { ClaimsOrderSchemaorg, ClaimsIndividualProductSchemaorg, ClaimsOfferSchemaorg, ClaimsPersonSchemaorg, } from '../constants/schemaorg.js';
|
|
3
|
+
import { buildLicenseIssueClaims, buildLicensePurchaseClaims, LicenseClaimContext, LicenseCategories, LicenseStatuses, } from '../utils/license.js';
|
|
4
|
+
import { createLicenseOfferOrderEditor } from '../utils/license-offer-order.js';
|
|
5
|
+
import { EXAMPLE_LICENSE_ACCEPTED_OFFER_ID, EXAMPLE_LICENSE_AMOUNT, EXAMPLE_LICENSE_CHECKOUT_URL, EXAMPLE_LICENSE_CURRENCY, EXAMPLE_EMAIL_CONTROLLER_ORG, EXAMPLE_EMPLOYEE_ACTIVATION_CODE, EXAMPLE_HEALTHCARE_ACTOR_ROLE_GENERALIST_MEDICAL_PRACTITIONER, EXAMPLE_LICENSE_INVOICE_ID, EXAMPLE_LICENSE_OFFER_ID, EXAMPLE_LICENSE_PLAN_DEFAULT, EXAMPLE_LICENSE_PAYMENT_METHOD_INVOICE, EXAMPLE_LICENSE_PAYMENT_URL, EXAMPLE_LICENSE_RENEWAL_CYCLE_YEARLY, EXAMPLE_LICENSE_PLAN_NAME, EXAMPLE_LICENSE_SEAT_UUID_ACTIVE, EXAMPLE_LICENSE_SEAT_UUID_AVAILABLE, EXAMPLE_LICENSE_SEAT_UUID_SECONDARY, EXAMPLE_LICENSE_SKU, EXAMPLE_LICENSE_SUBJECT_ID_ACTIVE, EXAMPLE_LICENSE_SUBJECT_ID_AVAILABLE, } from './shared.js';
|
|
5
6
|
export const EXAMPLE_LICENSE_SEAT_UUIDS = Object.freeze([
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
EXAMPLE_LICENSE_SEAT_UUID_ACTIVE,
|
|
8
|
+
EXAMPLE_LICENSE_SEAT_UUID_SECONDARY,
|
|
8
9
|
]);
|
|
9
10
|
export const EXAMPLE_LICENSE_ISSUE_INPUT = Object.freeze({
|
|
10
11
|
email: EXAMPLE_EMAIL_CONTROLLER_ORG,
|
|
@@ -22,9 +23,9 @@ export const EXAMPLE_LICENSE_ACTIVE_RECORD = Object.freeze({
|
|
|
22
23
|
id: EXAMPLE_LICENSE_SEAT_UUIDS[0],
|
|
23
24
|
status: LicenseStatuses.Active,
|
|
24
25
|
activationCode: EXAMPLE_EMPLOYEE_ACTIVATION_CODE,
|
|
25
|
-
subjectId:
|
|
26
|
+
subjectId: EXAMPLE_LICENSE_SUBJECT_ID_ACTIVE,
|
|
26
27
|
claims: {
|
|
27
|
-
'@context':
|
|
28
|
+
'@context': LicenseClaimContext.SchemaOrg,
|
|
28
29
|
[ClaimsIndividualProductSchemaorg.serialNumber]: EXAMPLE_LICENSE_SEAT_UUIDS[0],
|
|
29
30
|
[ClaimsIndividualProductSchemaorg.category]: LicenseCategories.Professional,
|
|
30
31
|
[ClaimsIndividualProductSchemaorg.additionalType]: DeviceAppTypes.Mobile,
|
|
@@ -32,6 +33,33 @@ export const EXAMPLE_LICENSE_ACTIVE_RECORD = Object.freeze({
|
|
|
32
33
|
[ClaimsPersonSchemaorg.hasOccupationalRoleValue]: EXAMPLE_HEALTHCARE_ACTOR_ROLE_GENERALIST_MEDICAL_PRACTITIONER,
|
|
33
34
|
},
|
|
34
35
|
});
|
|
36
|
+
export const EXAMPLE_LICENSE_AVAILABLE_RECORD = Object.freeze({
|
|
37
|
+
id: EXAMPLE_LICENSE_SEAT_UUID_AVAILABLE,
|
|
38
|
+
status: LicenseStatuses.Available,
|
|
39
|
+
subjectId: EXAMPLE_LICENSE_SUBJECT_ID_AVAILABLE,
|
|
40
|
+
claims: {
|
|
41
|
+
...EXAMPLE_LICENSE_ACTIVE_RECORD.claims,
|
|
42
|
+
[ClaimsIndividualProductSchemaorg.serialNumber]: EXAMPLE_LICENSE_SEAT_UUID_AVAILABLE,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
export const EXAMPLE_LICENSE_LIST_RESPONSE_BODY = Object.freeze({
|
|
46
|
+
data: [
|
|
47
|
+
{
|
|
48
|
+
meta: {
|
|
49
|
+
status: EXAMPLE_LICENSE_ACTIVE_RECORD.status,
|
|
50
|
+
subjectId: EXAMPLE_LICENSE_ACTIVE_RECORD.subjectId,
|
|
51
|
+
claims: EXAMPLE_LICENSE_ACTIVE_RECORD.claims,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
meta: {
|
|
56
|
+
status: EXAMPLE_LICENSE_AVAILABLE_RECORD.status,
|
|
57
|
+
subjectId: EXAMPLE_LICENSE_AVAILABLE_RECORD.subjectId,
|
|
58
|
+
claims: EXAMPLE_LICENSE_AVAILABLE_RECORD.claims,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
});
|
|
35
63
|
export function buildExampleLicenseIssueClaims() {
|
|
36
64
|
return Object.freeze(buildLicenseIssueClaims(EXAMPLE_LICENSE_ISSUE_INPUT));
|
|
37
65
|
}
|
|
@@ -41,3 +69,104 @@ export function buildExampleLicensePurchaseClaims() {
|
|
|
41
69
|
export const EXAMPLE_LICENSE_PURCHASE_CLAIMS = buildExampleLicensePurchaseClaims();
|
|
42
70
|
export const EXAMPLE_LICENSE_ISSUE_CLAIMS = buildExampleLicenseIssueClaims();
|
|
43
71
|
export const EXAMPLE_LICENSE_PURCHASE_EXPECTED_SERIAL_NUMBER = EXAMPLE_LICENSE_PURCHASE_CLAIMS[ClaimsOfferSchemaorg.serialNumber];
|
|
72
|
+
/**
|
|
73
|
+
* Shared high-level preview used by SDK/runtime tests when an onboarding start
|
|
74
|
+
* flow returns an `Offer`.
|
|
75
|
+
*/
|
|
76
|
+
export const EXAMPLE_LICENSE_OFFER_PREVIEW = Object.freeze(createLicenseOfferOrderEditor()
|
|
77
|
+
.setOfferId(EXAMPLE_LICENSE_OFFER_ID)
|
|
78
|
+
.setAmount(EXAMPLE_LICENSE_AMOUNT)
|
|
79
|
+
.setCurrency(EXAMPLE_LICENSE_CURRENCY)
|
|
80
|
+
.setSeats(EXAMPLE_LICENSE_SEAT_UUIDS.length)
|
|
81
|
+
.setPlanName(EXAMPLE_LICENSE_PLAN_NAME)
|
|
82
|
+
.setSku(EXAMPLE_LICENSE_SKU)
|
|
83
|
+
.setPaymentMethod(EXAMPLE_LICENSE_PAYMENT_METHOD_INVOICE)
|
|
84
|
+
.setCheckoutUrl(EXAMPLE_LICENSE_CHECKOUT_URL)
|
|
85
|
+
.getOfferPreview());
|
|
86
|
+
/**
|
|
87
|
+
* Shared high-level summary used by SDK/runtime tests when an order is
|
|
88
|
+
* confirmed and GW returns payment/activation fields.
|
|
89
|
+
*/
|
|
90
|
+
export const EXAMPLE_LICENSE_ORDER_SUMMARY = Object.freeze(createLicenseOfferOrderEditor()
|
|
91
|
+
.setAcceptedOfferId(EXAMPLE_LICENSE_ACCEPTED_OFFER_ID)
|
|
92
|
+
.setAmount(EXAMPLE_LICENSE_AMOUNT)
|
|
93
|
+
.setCurrency(EXAMPLE_LICENSE_CURRENCY)
|
|
94
|
+
.setSeats(EXAMPLE_LICENSE_SEAT_UUIDS.length + 1)
|
|
95
|
+
.setPaymentMethod(EXAMPLE_LICENSE_PAYMENT_METHOD_INVOICE)
|
|
96
|
+
.setPaymentUrl(EXAMPLE_LICENSE_PAYMENT_URL)
|
|
97
|
+
.setInvoiceId(EXAMPLE_LICENSE_INVOICE_ID)
|
|
98
|
+
.setActivationCode(EXAMPLE_EMPLOYEE_ACTIVATION_CODE)
|
|
99
|
+
.getOrderSummary());
|
|
100
|
+
/**
|
|
101
|
+
* Shared operational defaults reused by runtime tests that need stored
|
|
102
|
+
* `DeviceLicense` examples instead of higher-level Offer/Order claims.
|
|
103
|
+
*/
|
|
104
|
+
export const EXAMPLE_LICENSE_RUNTIME_DEFAULTS = Object.freeze({
|
|
105
|
+
plan: EXAMPLE_LICENSE_PLAN_DEFAULT,
|
|
106
|
+
renewalCycle: EXAMPLE_LICENSE_RENEWAL_CYCLE_YEARLY,
|
|
107
|
+
reactivationEnabled: true,
|
|
108
|
+
});
|
|
109
|
+
export const EXAMPLE_LICENSE_OFFER_RESPONSE_BODY = Object.freeze({
|
|
110
|
+
data: [{
|
|
111
|
+
meta: {
|
|
112
|
+
claims: {
|
|
113
|
+
[ClaimsOfferSchemaorg.identifier]: EXAMPLE_LICENSE_OFFER_ID,
|
|
114
|
+
[ClaimsOfferSchemaorg.price]: EXAMPLE_LICENSE_AMOUNT,
|
|
115
|
+
[ClaimsOfferSchemaorg.priceCurrency]: EXAMPLE_LICENSE_CURRENCY,
|
|
116
|
+
[ClaimsOfferSchemaorg.eligibleQuantityValue]: EXAMPLE_LICENSE_SEAT_UUIDS.length,
|
|
117
|
+
[ClaimsOfferSchemaorg.itemOfferedName]: EXAMPLE_LICENSE_PLAN_NAME,
|
|
118
|
+
[ClaimsOfferSchemaorg.itemOfferedSku]: EXAMPLE_LICENSE_SKU,
|
|
119
|
+
[ClaimsOfferSchemaorg.acceptedPaymentMethod]: EXAMPLE_LICENSE_PAYMENT_METHOD_INVOICE,
|
|
120
|
+
[ClaimsOfferSchemaorg.checkoutPageURLTemplate]: EXAMPLE_LICENSE_CHECKOUT_URL,
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
}],
|
|
124
|
+
});
|
|
125
|
+
export const EXAMPLE_LICENSE_ORDER_RESPONSE_BODY = Object.freeze({
|
|
126
|
+
body: {
|
|
127
|
+
data: [{
|
|
128
|
+
resource: {
|
|
129
|
+
meta: {
|
|
130
|
+
claims: {
|
|
131
|
+
[ClaimsOrderSchemaorg.acceptedOfferIdentifier]: EXAMPLE_LICENSE_ACCEPTED_OFFER_ID,
|
|
132
|
+
[ClaimsOrderSchemaorg.paymentUrl]: EXAMPLE_LICENSE_PAYMENT_URL,
|
|
133
|
+
[ClaimsOrderSchemaorg.partOfInvoice]: EXAMPLE_LICENSE_INVOICE_ID,
|
|
134
|
+
[ClaimsOrderSchemaorg.paymentMethod]: EXAMPLE_LICENSE_PAYMENT_METHOD_INVOICE,
|
|
135
|
+
[ClaimsOfferSchemaorg.price]: EXAMPLE_LICENSE_AMOUNT,
|
|
136
|
+
[ClaimsOfferSchemaorg.priceCurrency]: EXAMPLE_LICENSE_CURRENCY,
|
|
137
|
+
[ClaimsOfferSchemaorg.eligibleQuantityValue]: String(EXAMPLE_LICENSE_SEAT_UUIDS.length + 1),
|
|
138
|
+
[ClaimsIndividualProductSchemaorg.serialNumber]: EXAMPLE_EMPLOYEE_ACTIVATION_CODE,
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
}],
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
export const EXAMPLE_LICENSE_OFFER_LIST_RESPONSE_BODY = Object.freeze({
|
|
146
|
+
data: [{
|
|
147
|
+
resource: {
|
|
148
|
+
total: 1,
|
|
149
|
+
data: [{
|
|
150
|
+
id: EXAMPLE_LICENSE_OFFER_ID,
|
|
151
|
+
meta: {
|
|
152
|
+
status: 'active',
|
|
153
|
+
claims: EXAMPLE_LICENSE_OFFER_RESPONSE_BODY.data[0].meta.claims,
|
|
154
|
+
},
|
|
155
|
+
}],
|
|
156
|
+
},
|
|
157
|
+
}],
|
|
158
|
+
});
|
|
159
|
+
export const EXAMPLE_LICENSE_ORDER_LIST_RESPONSE_BODY = Object.freeze({
|
|
160
|
+
data: [{
|
|
161
|
+
resource: {
|
|
162
|
+
total: 1,
|
|
163
|
+
data: [{
|
|
164
|
+
id: EXAMPLE_LICENSE_ACCEPTED_OFFER_ID,
|
|
165
|
+
meta: {
|
|
166
|
+
status: 'active',
|
|
167
|
+
claims: EXAMPLE_LICENSE_ORDER_RESPONSE_BODY.body.data[0].resource.meta.claims,
|
|
168
|
+
},
|
|
169
|
+
}],
|
|
170
|
+
},
|
|
171
|
+
}],
|
|
172
|
+
});
|