Show/Hide Toolbars

CWT Software Configuration Handbook

Navigation: Examples > Step-by-step set up of typical configurations

Example: 2: Prepay with 1 article and 1 tariff

Scroll Prev Top Next More

In this Example we will set up a terminal that sells parking tickets by means of pre-payment with one article (parking tickets) and one tariff defining the price model for the article.

The Example: describes the setup of payment, payment service, pay units, article, tariff and connections between payment service, article and tariff package.

Use the basic configuration file from Example: 1: Basic setup to start with. The completed setup can later on be extended with more functionality and adaptations to meet other requirements.

1.PAYMENT ELEMENT

Add the PAYMENT element to the XML document.

2.Tick factor

Set the attribute tick factor to match the monetary setup that is required for the terminal. If the currency is “EUR” and you want 1 cent to be the lowest denomination, set tickFactor =”100”.

3.Currency

Then set currency to the numerical value according to Valid currencies.

4.Default VAT

Set attribute default VAT to the integer value multiplied by 100 for the VAT (for 20 % default VAT the value shall be defaultVAT=”2000”). The default VAT is applied to all articles that do not specify a specific VAT value.

5.Default purchase category

Purchase category specifies what the CWT sells (see Valid Purchase Categories for a complete list of codes) and the attribute defaultPurchaseCategory shall reflect the purchase category that is sold most frequently in the terminal. This Example: represents a CWT that sells parking tickets thus defaultPurchaseCategory="10").

In your XML document, you should now have a PAYMENT element containing tick factor 100, EURO as currency, a default VAT at 20 % and a default purchase category that is 10 for parking:

<PAYMENT tickFactor="100" currency="978" defaultVAT="2000" defaultPurchaseCategory="10"/>

6.PAYMENT SERVICE ELEMENT

Add one payment service by defining a PAYMENTSERVICE element in the configuration. This defines how the CWT sells the article and how the payment can be done.

7.Payment service id

For the one and only payment service set paymentServiceId=”0”.

8.Payment service name

The name attribute can be set to paymentServiceName=“ParkingPS”.

9.Article choice (via the user interface)

Depending on the user interface configuration the name of the payment service can be presented to the end user via the user interface. However, article selection is not required because this Example: setup only has one article, so set articleChoice=”false”.

10.Ticket

To get a ticket printed after each purchase set ticket=“Yes”.

11.Step

Set step=“false” because the payment service does not require the amount to be stepped up before the pay units are activated for payment (like EMV terminals that require a fixed amount when payment is started).

12.User identifier

Set userIdentifier=”None” because the end users do not need to enter a code (like license plate number) during the purchase for identification in WebOffice or other external systems connected to WebOffice.

13.Pay unit(s)

Pay units that shall be active in the payment service shall be defined as sub-elements inside the payment service element. Use name="Coin" and name="Card".

The payment service element should now look like this:

<PAYMENTSERVICE paymentServiceId="0" name="ParkingPS" articleChoice="false" ticket="Yes" step="false" userIdentifier="None">
 <payUnit name="Coin"/>
 <payUnit name="Card"/>
</PAYMENTSERVICE>

14.PAY UNIT ELEMENT

It is now time to define the two pay units that the PAYMENT SERVICE element (see Step 13 Pay units) refers to. Both a coin unit and a card unit have to be defined. The card unit is quite easy to define because it does not require any mapping of ticks to channels. The coin pay unit, however, requires that all active channels are mapped to a tick value that corresponds to the monetary value of the channel.

15.Name and type

Set cardPayUnitName=“Card” and type=“Card”. This applies to the coin pay unit as well but the name and type shall then be “Coin” instead.

16.Channel mapping

If the coin unit handles the EURO currency and is set to active channel 0 for 50 cent coins, channel 1 for 20 cent, channel 2 for 1 EURO and channel 3 for 2 EURO, channel 0 shall give 50 ticks, channel 1 give 20 ticks, channel 2 give 100 ticks and channel 3 give 200 ticks. The tick factor is set to 100 in the PAYMENT element (see Step 2 Tick factor) which means that 1 EURO is 100 ticks.

The channel mappings are defined as a channel sub-element inside the coin payunit definition. One channel element must be defined per active channel in the physical coin validator. See PAYUNIT element for details on how to set up a pay unit.

The coin pay unit with the channel mapping described above should now look like this:

<PAYUNIT name="Coin" type="Coin">
 <channel id="0" value="50"/>
 <channel id="1" value="20"/>
 <channel id="2" value="100"/>
 <channel id="3" value="200"/>
</PAYUNIT>

The card pay unit shall look like this since it does not require any mapping of the physical pay unit channels to tick values:

<PAYUNIT name="Card" type="Card"/>

17.TARIFF PACKAGE ELEMENT

A tariff package element must be defined as a price model for the article sold at the terminal.

18.Tariff package name and id

Set name=“ParkingTariff” and tariffPackageId=“id 0”. The name of the tariff package can, be presented in certain user interface configurations to the end user via the user interface.

The tariff in this Example: is 100 ticks per 60 minutes for parking from 8:00:00 to 17:59:59 (not including 18:00:00) every day which means 1 EURO per hour with the setting tickFactor=”100” in the PAYMENT element in Step 2 Tick factor. There is also a minimum payment of 100 ticks (1 EURO) defined in the tariff. The paid amount need to be equal to or greater than 1 EURO before it is possible to finish the purchase.

19.Ticket type and id

Besides the actual tariff script in the tariff sub-element, a reference to a ticket layout is required because a ticket shall be printed after each purchase. The actual ticket layout is not yet defined but it is still possible to refer to it. Set ticketType=“Normal” because the payment service is set up as pre-payment without any code input during the purchase. Set ticketId=”0” which must match the id of the ticket layout definition when defined later on (see Step 30 TICKET element).

20.Description

One description row (with two columns) is set up in the tariff package that contains “All days:” in the first column and “1€/h” in the second column. This will be displayed as tariff information in the user interface.

See Tariff package element, Tariff calculation, and PAT selection for details regarding the TARIFFPACKAGE syntax and information on how tariff scripts are defined. See also Tariff examples for some more examples

The tariff package should now look like this:

<TARIFFPACKAGE name="ParkingTariff" tariffPackageId="0" >
 <ticket ticketType="Normal" ticketId="0"/>
 <description row="0" col="0" string="All days:"/>
 <description row="0" col="1" string="1€@/@h"/>
 <tariff>
   PACKAGE "ParkingTariff";
     min ticks = 100;
     
     INTERVAL "EveryDay8To16";
     timepredicate = "($hour in [08 to 16[)";
     tariffrate = linear 100 per 60;
 </tariff>
</TARIFFPACKAGE>

21.COMMON TARIFF GROUP ELEMENT

Because this Example: setup uses only one article and one tariff it is convenient to use a common tariff group to connect the tariff package to the article (even if an article tariff group can be used for this purpose).

Create a COMMONTARIFFGROUP element and set commonTariffGroupId=”0” because this is the first (and only) common tariff group required.

22.Tariff package

To add the tariff package defined in Step 18 Tariff package name and id, to the group that shall be controlled by button selection, or by automatic selection in the software, define a sub element named buttonControlledPackage inside the COMMONTARIFFGROUP. Set id=”0” and tariffPackageName=”ParkingTariff”. The tariff package name must be equal to the name defined in the TARIFFPACKAGE element (see Step 18 Tariff package name and id) to create a valid connection to the tariff package.

Because the terminal has only one tariff it is not necessary to select any tariff with buttons via  the user interface. The tariff package will instead be defined as the default package for the single article in the system.

The definition of the common tariff group should now look like this:

<COMMONTARIFFGROUP commonTariffGroupId="0">
 <buttonControlledPackage id="0" tariffPackageName="ParkingTariff"/>
</COMMONTARIFFGROUP>

23.ARTICLE ELEMENT

Now create the article that shall represent the parking time sold at the terminal. Each article is defined by an ARTICLE element so create one ARTICLE element.

24.Article id

Set articleId=”0”.

25.Article name

The name of the article should represent what it is. In this case it is just “Parking” so set name=”Parking”.

26.Use of common tariffs

Since a common tariff group is used to connect the tariff to the article (see Step 22 Tariff package) it is necessary to set useCommonTariffs=”true”.

27.Default tariff id

Because there is only one tariff package, it is convenient to set that tariff package as the default package for the article. This is achieved by setting the default tariff id to the same value as set with tariffPackageId in the TARIFFPACKAGE element (see Step 18 Tariff package name and id). In this case the tariff package id is “0” for the single tariff package defined in the system so set defaultTariffId=”0”.

28.Default VAT and default purchase category

Because default VAT and default purchase category were defined in the PAYMENT element (Step 2.4 Default VAT and Step 2.5 Default purchase category), it is not necessary to define them for this article. If these attributes are not explicitly defined for the article, the default VAT and default purchase category values from the PAYMENT element will be used instead.

29.Payment service

A reference to which payment services that are allowed to sell the article must be set. Only one reference is required because there is just one payment service defined (see Step 7 Payment service id and Step 8 Payment service name). Create the reference by adding a paymentService sub-element to the ARTICLE and set id equal to the payment service id defined in the PAYMENTSERVICE element. See Step 7 Payment service id above. In this case id=”0”.

The ARTICLE element should now look like this:

<ARTICLE articleId="0" name="Parking" useCommonTariffs="true" defaultTariffId="0">
 <paymentService id="0"/>
</ARTICLE>

30.TICKET ELEMENT

The last step is to create a ticket layout definition related to the ticket to be printed after each successful purchase. The layout identity must be set as ticketId=”0” to match the ticket id that is referenced in the TARIFFPACKAGE definition in Step 2.19 Ticket type and id. This ticket will be printed in landscape orientation. The height of the printing area is 300 pixels and the width is 380 pixels. The layout is very simple and the only text that is printed on this sample ticket is “Sample Ticket” in font size 36. To create more advanced ticket layouts please see Ticket element and Ticket layout.

The left margin is set to 25 pixels and the right, top and bottom margins are set to 0 pixels.

The ticket layout definition should look like this:

<TICKET ticketId="0" height="300" width="380" orientation="Landscape"
  layout="@y12@f36@fbSample Ticket">
 <margin left="25" right="0" top="0" bottom="0"/>
</TICKET>