Skip to content

Commit b2f9043

Browse files
authored
Merge pull request #25 from queueit/fix-readme-file
Fix readme file and version
2 parents d884897 + 2fcf7cd commit b2f9043

File tree

2 files changed

+27
-29
lines changed

2 files changed

+27
-29
lines changed

README.md

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,26 @@ You can find the latest released version [here](https://github.com/queueit/Known
77

88
## Implementation
99
The KnownUser validation must be done on *all requests except requests for static and cached pages, resources like images, css files and ...*.
10-
So, if you add the KnownUser validation logic to a central place, then be sure that the Triggers only fire on page requests (including ajax requests) and not on e.g. image.
10+
So, if you add the KnownUser validation logic to a central place, then make sure that the Triggers only fire on page requests (including ajax requests) and not on e.g. image.
1111

12-
If we have the `integrationconfig.json` copied in the folder beside other knownuser files inside web application folder then
13-
the following method is all that is needed to validate that a user has been through the queue:
12+
If the integrationconfig.json file is placed in the same folder as the other KnownUser files within the web application directory,
13+
then the following method is all that’s needed to validate that a user has passed through the queue:
1414

1515
```php
16-
require_once( __DIR__ .'Models.php');
17-
require_once( __DIR__ .'KnownUser.php');
18-
require_once( __DIR__ .'QueueITHelpers.php');
16+
require_once( __DIR__ .'/Models.php');
17+
require_once( __DIR__ .'/KnownUser.php');
1918

2019
$configText = file_get_contents('integrationconfig.json');
2120
$customerID = ""; //Your Queue-it customer ID
22-
$secretKey = ""; //Your 72 char secret key as specified in Go Queue-it self-service platform
21+
$secretKey = ""; //Your 72 characters secret key as specified in Go Queue-it self-service platform
2322

2423
try
2524
{
2625
$fullUrl = getFullRequestUri();
27-
$queueittoken = QueueIT\KnownUserV3\SDK\Utils::getParameterByName($fullUrl, KnownUser::QueueItTokenKey);
26+
$queueittoken = QueueIT\KnownUserV3\SDK\Utils::getParameterByName($fullUrl, QueueIT\KnownUserV3\SDK\KnownUser::QueueItTokenKey);
2827
$currentUrlWithoutQueueitToken = preg_replace("/([\\?&])("."queueittoken"."=[^&]*)/i", "", $fullUrl);
2928

30-
//Verify if the user has been through the queue
29+
//Verify if the user has passed through the queue
3130
$result = QueueIT\KnownUserV3\SDK\KnownUser::validateRequestByIntegrationConfig($currentUrlWithoutQueueitToken,
3231
$queueittoken, $configText, $customerID, $secretKey);
3332

@@ -41,7 +40,7 @@ try
4140

4241
if(!$result->isAjaxResult)
4342
{
44-
//Send the user to the queue - either because hash was missing or because is was invalid
43+
//Send the user to the queue - either because the hash was missing or because it was invalid
4544
header('Location: ' . $result->redirectUrl);
4645
}
4746
else
@@ -55,24 +54,24 @@ try
5554
}
5655
if(!empty($queueittoken) && $result->actionType == "Queue")
5756
{
58-
//Request can continue - we remove queueittoken form querystring parameter to avoid sharing of user specific token
57+
//Request can continue - we remove queueittoken from the query string to avoid sharing a user specific token
5958
header('Location: ' . $currentUrlWithoutQueueitToken);
6059
die();
6160
}
6261
}
6362
catch(\Exception $e)
6463
{
65-
// There was an error validating the request
64+
// There is an error validating the request
6665
// Use your own logging framework to log the error
67-
// This was a configuration error, so we let the user continue
66+
// This is a configuration error, so we allow the user to continue
6867
}
6968
```
7069

71-
Helper method to get the current url (you can have your own).
72-
The result of this helper method is used to match Triggers and as the Target url (where to return the users to).
73-
It is therefor important that the result is exactly the url of the users browsers.
70+
Helper method to get the current url (you can use your own implementation).
71+
The result of this helper method is used to match Triggers and as the Target url (where users are returned to).
72+
It is therefore important that the result exactly matches the URL in the user's browser.
7473

75-
So if your webserver is e.g. behind a load balancer that modifies the host name or port, reformat the helper method as needed:
74+
So, if your web server is, for example, behind a load balancer that modifies the hostname or port, adjust the helper method accordingly:
7675
```php
7776
function getFullRequestUri()
7877
{
@@ -91,14 +90,13 @@ So if your webserver is e.g. behind a load balancer that modifies the host name
9190

9291
## Implementation using inline queue configuration
9392
Specify the configuration in code without using the Trigger/Action paradigm. In this case it is important *only to queue-up page requests* and not requests for resources.
94-
This can be done by adding custom filtering logic before caling the `KnownUser::resolveQueueRequestByLocalConfig()` method.
93+
This can be done by adding custom filtering logic before calling the `QueueIT\KnownUserV3\SDK\KnownUser::resolveQueueRequestByLocalConfig()` method.
9594

9695
The following is an example of how to specify the configuration in code:
9796

9897
```php
99-
require_once( __DIR__ .'Models.php');
100-
require_once( __DIR__ .'KnownUser.php');
101-
require_once( __DIR__ .'QueueITHelpers.php');
98+
require_once( __DIR__ .'/Models.php');
99+
require_once( __DIR__ .'/KnownUser.php');
102100

103101
$customerID = ""; //Your Queue-it customer ID
104102
$secretKey = ""; //Your 72 char secret key as specified in Go Queue-it self-service platform
@@ -115,11 +113,11 @@ $eventConfig->extendCookieValidity = true; //Should the Queue-it session cookie
115113
try
116114
{
117115
$fullUrl = getFullRequestUri();
118-
$queueittoken = QueueIT\KnownUserV3\SDK\Utils::getParameterByName($fullUrl, KnownUser::QueueItTokenKey);
116+
$queueittoken = QueueIT\KnownUserV3\SDK\Utils::getParameterByName($fullUrl, QueueIT\KnownUserV3\SDK\KnownUser::QueueItTokenKey);
119117
$currentUrlWithoutQueueitToken = preg_replace("/([\\?&])("."queueittoken"."=[^&]*)/i", "", $fullUrl);
120118

121-
//Verify if the user has been through the queue
122-
$result = QueueIT\KnownUserV3\SDK\KnownUser::validateRequestByLocalEventConfig($currentUrlWithoutQueueitToken,
119+
//Verify if the user has passed through the queue
120+
$result = QueueIT\KnownUserV3\SDK\KnownUser::resolveQueueRequestByLocalConfig($currentUrlWithoutQueueitToken,
123121
$queueittoken, $eventConfig, $customerID, $secretKey);
124122

125123
if($result->doRedirect())
@@ -145,22 +143,22 @@ try
145143
}
146144
if(!empty($queueittoken) && $result->actionType == "Queue")
147145
{
148-
//Request can continue - we remove queueittoken form querystring parameter to avoid sharing of user specific token
146+
//Request can continue - we remove queueittoken form the query string parameter to avoid sharing of user specific token
149147
header('Location: ' . $currentUrlWithoutQueueitToken);
150148
die();
151149
}
152150
}
153151
catch(\Exception $e)
154152
{
155-
// There was an error validating the request
153+
// There is an error validating the request
156154
// Use your own logging framework to log the error
157-
// This was a configuration error, so we let the user continue
155+
// This is a configuration error, so we allow the user to continue
158156
}
159157
```
160158
## Request body trigger (advanced)
161159

162160
The connector supports triggering on request body content. An example could be a POST call with specific item ID where you want end-users to queue up for.
163-
For this to work, you will need to contact Queue-it support or enable request body triggers in your integration settings in your GO Queue-it platform account.
161+
For this to work, you need to contact Queue-it support or enable request body triggers in your integration settings in your GO Queue-it platform account.
164162
Once enabled you will need to update your integration so request body is available for the connector.
165163
You need to create a new context provider similar to this one:
166164

UserInQueueService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class UserInQueueService implements IUserInQueueService
4141
{
4242
public static function getSDKVersion()
4343
{
44-
return "v3-php-" . "3.7.2";
44+
return "v3-php-" . "3.7.4";
4545
}
4646

4747
private $userInQueueStateRepository;

0 commit comments

Comments
 (0)