Secutix scripts
Reference of the four Secutix scripts, contact mapper, contact pass updater, movement mapper and ticket pass type finder: signatures and examples.
Four scripts adjust the Secutix connector. The contact mapper maps the wallet account to a Secutix contact and back. The contact pass updater writes the wallet installation status into the Secutix contact. The movement mapper adds values from a ticket to the pass data. The ticket pass type finder chooses the pass type of a ticket. This page is the reference for extensions.secutix.contact.mapper, extensions.secutix.contact.passUpdater, extensions.secutix.movement.mapper and extensions.secutix.ticket.passTypeFinder. The connector is described on the Secutix connector pages; the rules shared by every connector script are in Connector scripts. A script that must call another Secutix service uses the twc/secutix module.
Registration
Key
Slot file
Methods (required in bold)
extensions.secutix.contact.mapper
secutix.contact.mapper.js
MapToSecutix, MapToNeostore
extensions.secutix.contact.passUpdater
secutix.contact.passUpdater.js
OnPassInstallationStatusChanged
extensions.secutix.movement.mapper
secutix.movement.mapper.js
MapFromSecutix
extensions.secutix.ticket.passTypeFinder
secutix.ticket.passTypeFinder.js
GetPassType
The slots are in the Advanced tab of the Secutix configuration page, and are read and written with GET and PUT /api/{tenantId}/admin/extensions/secutix/scripts; the API reference describes them. When no script is registered for a key, the default behavior applies.
When it runs
contact.mapper: MapToSecutix
In the registration flow step, before the contact is saved in Secutix, after the default mapping
contact.mapper: MapToNeostore
After Secutix answers, when the contact is read, to map it back to the account
contact.passUpdater
When the installation status of a member card changes, only for passes whose identifiers carry the Secutix contact number
movement.mapper
After the default ticket.* mapping of a movement
ticket.passTypeFinder
When the pass type of a ticket is chosen. The order is: this hook, then the WALLET comfort variable of the operation (then of the product), then the product family subtype, then the default pass type
The default contact mapping writes email to Email, lastName to IndividualLastname, firstName to IndividualFirstname, phoneNumber to PhoneNumber1 and neo.lng to IndividualPreferredLanguage (left empty when the account has no neo.lng; MapToSecutix can set it), and sets IndividualTitle to UNDEFINED. The prefix neostore is the platform's former name and is kept in technical identifiers: MapToNeostore means "map back to the account" and its name cannot be changed.
Handlers
contact.mapper
MapToSecutix
account, request
nothing
Optional
Synchronous
contact.mapper
MapToNeostore
response, account
nothing
Optional
Synchronous
contact.passUpdater
OnPassInstallationStatusChanged
request, isInstalled, device
nothing
Required
Synchronous
movement.mapper
MapFromSecutix
data ({ Movement, Operation, Product?, Timeslot? }), account
nothing
Required
Synchronous
ticket.passTypeFinder
GetPassType
movementData, operationData?, product?
a promise of a pass type name, or of null
Required
Asynchronous: declare it async
Different signatures.
GetPassTypetakes three positional arguments.MapFromSecutixtakes one object with the membersMovement,Operation,ProductandTimeslot.ProductandTimeslotcan be absent. InGetPassType,operationDatacan also be absent, andproductis fetched only when the operation carries a product id.Install hook.
requestis a new SecutixSaveIndividualContactRequest, saved right after the hook: it carries theContactNumber, an emptyIndividualContactDataand no criterion.deviceis0for Apple and2for Google. The hook changesrequestin place and is synchronous: anasynchook that awaits loses its changes, because the request is saved without waiting. Without the script, the contact is not written.Pass type. The returned name must be a pass type of the tenant. A name that is not configured, even one returned by the hook, is logged as an error and replaced by the subtype or the default mapping, skipping
WALLET. TheWALLETcomfort variable is compared without regard to case, and the product's ownWALLETvariable is tried when the operation has none.Product family subtypes. When nothing else gives a pass type, the connector uses the default pass template configured for the product family subtype of the operation, in the Default section of the Secutix settings:
MEMBERSHIP→ Membership,SEASONTICKET→ Season ticket,SIMPLE_TICKET→ Event,SPORTING_EVENT→ Match,VISIT_PASS→ Visit pass,OPEN_PASS→ Open pass,OPEN→ Open product,VOUCHER→ Voucher,DONATION→ Donation,SERVICE→ Service. When that field is empty, or for any other subtype, the Default pass template is used.
Errors and edge cases
A required method is missing: the call fails with
method <Name> missingwhen the connector reaches it.operationDataorproductis absent:operationData.Sitethrows. Guard it with?..GetPassTypereturns an unknown name: logged as an error, and the default resolution applies.A script throws: the error reaches the operation that called it.
A synchronous method is declared
async: it is not awaited, so changes made after anawaitare lost.
Example
The contact mapper writes the email consent as a criterion without removing the criteria already on the request, and reads it back. The criterion code OPT_CO comes from the connector page: use the codes of the brand's Secutix configuration.
The pass type finder routes two halls to dedicated pass types. It guards operationData, which can be absent:
The movement mapper exposes one value to the templates:
The install hook records the status in a criterion per wallet. The values Installé and Désinstallé are specific to the project of the connector page: use the values the Secutix criterion accepts.
ExternalContactCriterionData is a .NET list: it is read by index, has a length and accepts push, but Array.isArray returns false for it.
Common pitfalls
ExternalContactCriterionDatais assigned in two hooks of the same project: the second assignment replaces the first.operationData.Siteis read without a guard on an operation that has no site.deviceis compared with a string: it is0or2.The slot's registration lines are still commented out.
Last updated

