Contents

Conditions

 

A Condition defines the circumstances under which an action will be performed. This page explains how to manage conditions on your site.

URL
Rules, conditions and actions are all managed through the MyST Rule Manager

To get there, click “Rule manager” from the navigation on the left of the MyST interface.

Note: You must have role Site admin, Developer or Developer 2 to view this page.

 


 

Creating conditions

 

To create a condition, please follow these steps:

  1. Select the sitereference and Action type from the drop-down boxes in the upper-left (1) and click “Change”.
  2. Click the “New condition” button in the “Information” pane (2).

Click here for a list of supported action types

You will be presented with a page allowing you to create a new condition. Assign the condition an appropriate and unique name, by typing this into the “Condition name” text field in the upper-left corner of the page (e.g. successful Visa AUTH).

Now choose the filters that you would like to be used in order to specify when the action occurs. Each filter displayed represents a different property that can be associated with a transaction. Ticking a checkbox selects the specific value.

When the drop-down box by a filter is set to “in” (default), the action will be performed when the request matches any of the fields ticked within this filter. When set to “not in”, the action will be performed when the request does not match the fields ticked in the box beneath it.

 

e.g. If “Payment types” “in” “American Express”, “Mastercard” and “Visa”
The redirect will only be performed when the customer uses any of the aforementioned payment types.
When you have selected all the filters required, click “Save”.

 

Warning
When creating a condition, ensure that you specify at least one Request type and Error code. Failure to do so may cause unexpected issues.

 

Managing conditions

Conditions created on your MyST user account can be managed by clicking the “Manage conditions” tab above the table.

Info
Please be aware that conditions are actions can only be managed by the users that created them.

 

This tab will list any conditions configured on your MyST account (if you have no conditions configured, it will prompt you to create your first).

 

Viewing further details

 

Conditions are listed in a table with [+] icons to the left of each one. Clicking the [+] icon will cause the condition to expand in order to display its properties. When finished, you can click the [-] icon to collapse the condition, hiding the properties from view.

Clicking the [+] icon in the header row expands all conditions at once. Subsequently clicking the [-] icon in the header row will collapse all conditions at once, returning the table to its original state.

 

Modifying conditions

To modify the properties of a condition, click the condition name in the table.

Info
You can only modify conditions your MyST user account has created.

 

You will be presented with a page that allows you to modify the condition.

Warning
When modifying a condition, ensure that you specify at least one Request type and Error code. Failure to do so may cause unexpected issues.

 

Conditions in use

When modifying a condition that is being used by an active rule, a yellow warning is shown at the top of the page. This lists the number of rules that will be affected by the changes made, and their associated Secure Trading sitereference(s).

 

Deleting conditions

Using the checkboxes to the right of each condition, you can select conditions for deletion.

 

When you have selected the conditions you would like to delete, press the “Delete” button. You will be shown a confirmation prompt before deleting a condition(s). You can only delete conditions that are not part of an existing rule.

 

Deleting “IN USE” conditions

Conditions that are part of an existing rule are highlighted with the words “IN USE” in the “Delete” column. In order to delete these conditions, you must first delete the rules that are using the conditions in question.

 

Finding out which sites are using “IN USE” conditions

In order to find which sites have rules using “IN USE” conditions, click the condition name from the table under the “Manage conditions” tab to access the modify condition page. The number of rules using the condition and the sitereference(s) with which these rules are associated are shown in the yellow warning message at the top of the page.

 


 

Advanced settings

When creating or modifying a condition, it is possible to specify your own custom filter in the “Advanced settings” tab. customfield1 is a field that can be submitted in a request.

e.g. The following request will match the condition: customfield1 is “store2″.


#!/usr/bin/python
import securetrading

stconfig = securetrading.Config()
stconfig.username = "[email protected]"
stconfig.password = "Password1^"
st = securetrading.Api(stconfig)

auth = {
  "sitereference": "test_site12345",
  "requesttypedescriptions": ["AUTH"],
  "accounttypedescription": "ECOM",
  "currencyiso3a": "GBP",
  "baseamount": "1050",
  "orderreference": "My_Order_123",
  "cachetoken": "token_posted_by_st.js",
  "ruleidentifier": ["UDR-23"],
  "customfield1": "store2"
}

strequest = securetrading.Request()
strequest.update(auth)
stresponse = st.process(strequest) #stresponse contains the transaction response
<?php

if (!($autoload = realpath(__DIR__ . '/../../../autoload.php')) && !($autoload = realpath(__DIR__ . '/../vendor/autoload.php'))) {
  throw new Exception('Composer autoloader file could not be found.');
}
require_once($autoload);

$configData = array(
  'username' => '[email protected]',
  'password' => 'Password1^',
);

$requestData = array(
  'sitereference' => 'test_site12345', 
  'requesttypedescriptions' => array('AUTH'),
  'accounttypedescription' => 'ECOM',
  'currencyiso3a' => 'GBP',
  'baseamount' => '1050',
  'orderreference' => 'My_Order_123',
  'cachetoken' => 'token_posted_by_st.js',
  'requesttypedescriptions' => array('UDR-23'),
  'customfield1' => 'store2'
);

$api = \Securetrading\api($configData);
$response = $api->process($requestData);
var_dump($response->toArray());

?>
curl --user [email protected]:Password1^ https://webservices.securetrading.net/json/ -H "Content-type: application/json" -H "Accept: application/json" -X POST -d '{
"alias":"[email protected]",
"version": "1.00",
"request": [{
  "currencyiso3a": "GBP",
  "requesttypedescriptions": ["AUTH"],
  "sitereference": "test_site12345",
  "baseamount": "1050",
  "orderreference": "My_Order_123",
  "accounttypedescription": "ECOM",
  "cachetoken": "token_posted_by_st.js",
  "ruleidentifier": ["UDR-23"],
  "customfield1": "store2"
}]}'