ASP.NET VETtrak API web services
ContentsIndexHome
PreviousUpNext
VT_API.ProcessWebEnrolment Method

Automatically processes a web enrolment to turn it into a real enrolment without human intervention.

C#
[WebMethod(Description = "Processes a web enrolment with the specified ID, to turn it into a real enrolment")]
public TAuthProcessedWebEnrol ProcessWebEnrolment(string token, int webEnrolId, bool updateMatches);
Parameters 
Description 
string token 
String containing a token. 
int webEnrolId 
Integer ID of the web enrolment to process. 
bool updateMatches 
Boolean indicating whether to update any existing clients or employers if matched. If false, if any web client or company in the web enrolment can be matched with an existing client or employer, the existing client or employer is not updated with the new details from the web client or web company in this web enrolment - if true, the existing client or employer is updated. Note that this setting has no effect for any web client in the web enrolment that cannot be matched to an existing client and thus a new client is created, or for any web company in the web enrolment that cannot be matched to an existing employer and thus a new employer is created. 

TAuthProcessedWebEnrol containing the result of the process and, if successful, details of the processed enrolment.

As an alternative to having a VETtrak user manually match clients and employers and process a web enrolment using the Process Web Enrolment extension, you may call this function to automatically process a web enrolment and turn it into a real enrolment. Both client and employer web enrolments can be processed using this function. 

The webEnrolId parameter is the ID of the web enrolment to process. This should be the ID returned from AddClientWebEnrolment or AddEmployerWebEnrolment

The updateMatches parameter indicates whether any existing clients or employers should be updated with details from the web enrolment, for any existing clients or employers that are automatically matched to any web client or web company in the web enrolment. If true and the email address of a client is updated, and that client's username was matching their email address, the client's username will also be updated to match the new email address - this will cause an error if there's already another client with a username matching that new email address. 

In order to attempt to automatically match web clients and companies with existing clients or employers that may be in the VETtrak database, some simple automatic client and employer matching rules are used: 

  • If you correctly specified a client code or employer identifier in the web enrolment, that client or employer will be used.
  • For a client, if a USI was specified in the web client, and it matches the USI of an existing client, that client will be used.
  • If a client or employer exists with a name that exactly matches that in the web enrolment, that client or employer will be used (For clients, the surname, given name and date of birth must exactly match. For employers, the name must exactly match).
  • For a client, if a client exists with a surname, given name and email address that exactly matches that of the web client, that client will be used.
  • If an existing client or employer could not be matched by any of the above rules, a new client or employer will be created for the enrolment.
 

Note that this means that duplicate clients or employers could be created (due to differences in the names for example), but if this becomes a problem, VETtrak has Merge Client and Merge Employer functions that allows a VETtrak user to merge duplicate clients or employers. 

If VETtrak's security settings are configured to use email addresses for usernames, and this function needs to add a new client, you should have specified an email address on the web client (otherwise the client will have no username and cannot log in), and there must be no other clients with a username matching that email address. 

If processing a client web enrolment and the web client is matched to an existing client that is already enrolled in the occurrence, an error will be returned. If processing an employer web enrolment, and some of the employees are matched to existing clients that are already enrolled in the occurrence, those employees are skipped (not enrolled again) and no error is produced, but the EmployeesAlreadyEnrolled property of the returned TProcessedWebEnrol will contain a list of web clients that were already enrolled in the occurrence and not enrolled again. 

When adding client or employee enrolments, if the "auto link enrolments" preference is ticked, it will check if the enrolling client has any existing active enrolments with a date range that overlaps the new occurrence enrolment and contain any of the units in the occurrence that the new enrolment is going into. If so, these existing enrolments will be linked to the new enrolment, and the units will not be enrolled again in the new enrolment. 

The new enrolment will get any units (except those marked as optional), tasks (except those linked only to optional units, and including "loose" tasks that are not linked to any of the occurrence's units), prices (if AddPriceTypesToWebEnrolment was not used), invoice schedules, and staff that are on the occurrence, and the enrolled client will be added to all classes in the occurrence. 

For this function to work, a VETtrak user must have first configured a valid location for web payments in Global Preferences, and one payment type in the Configuration Manager must be set as the default for web based payment processing. 

A reservation cannot be processed - it must be completed first using CompleteWebReservation, then it can be processed by this function. 

If VETtrak users need the ability to choose some occurrences to have web enrolments automatically processed and others not, it is recommended that you instead use the web reservation API functionality along with the "Auto process web reservations" setting against occurrences in VETtrak. See AddClientWebReservation, AddEmployerWebReservation and CompleteWebReservation functions. 

To be able to process a web enrolment that contains custom data for a client or employer, the DatabaseMapping.xml file must exist in IIS in the folder where the VT_API.asmx file is located (there is a web.config setting to change the location of this file if required). 

This function may also automatically transfer any new enrolment(s) to an LMS for online learning, if the relevant add-on is installed and the occurrence is configured to do so. 

This function returns a TAuthProcessedWebEnrol which, if successful, contains a TProcessedWebEnrol object with lots of details about the processed enrolment. This includes the new or matched client code or employer identifier, ID of the new enrolment, IDs of any created invoice or payment, details of automatic transfer to an LMS etc. 

A token is passed for authentication. If the authentication fails, or other errors occur, nothing is updated. The result of the process is represented by a TAuthenticate object. If an error occurs, there are no side-effects in the database and, depending on the nature of the error, it may be possible to retry the process. If an error occurs with this function, it is recommended that you do not report this error to the web site user - instead, the error should be reported to an administrator as it may be possible for an administrator to make a fix and retry the web enrolment processing. 

Requires a valid registration key entry for the Short Courses feature. 

This function has security level "Protected", and can only be accessed by users that have explicitly been granted permission to the API, or users with access to the "API Functions" feature in the VETtrak application.

Copyright (c) VETtrak 2022. All rights reserved.