A csillaggal jelölt mezők kitöltése kötelező! A jelszó mezőt csak új vásárlóknak kötelező kitölteni, a regisztrált vásárlók a már beállított jelszavukat módosíthatják segítségével!
A weboldal sütiket (cookie) használ az alapvető működés, valamint a jobb felhasználói élmény eléréséhez. Az oldal használatával elfogadja az Általános Szerződési Feltételeket, valamint az Adatvédelmi tájékoztatót. A süti beállítások igény esetén bármikor megváltoztathatók a böngésző beállításaiban.
<%
' Trusted Shop engine class, which provides purchase data sending.
' Version 2.0
' Árukereső.hu 2016 */
Class TrustedShop
Private Sub Class_Initialize()
VERSION = "2.0/ASP-CLASSIC"
SERVICE_URL_SEND = "https://www.arukereso.hu/"
SERVICE_URL_AKU = "https://assets.arukereso.com/aku.min.js"
SERVICE_TOKEN_REQUEST = "t2/TokenRequest.php"
SERVICE_TOKEN_PROCESS = "t2/TrustedShop.php"
ERROR_EMPTY_EMAIL = "Customer e-mail address is empty."
ERROR_EMPTY_WEBAPIKEY = "Partner WebApiKey is empty."
ERROR_EXAMPLE_EMAIL = "Customer e-mail address has been not changed yet."
ERROR_EXAMPLE_PRODUCT = "Product name has been not changed yet."
ERROR_TOKEN_REQUEST_TIMED_OUT = "Token request timed out."
ERROR_TOKEN_REQUEST_FAILED = "Token request failed."
ERROR_TOKEN_BAD_REQUEST = "Bad request: "
Set Products = Server.CreateObject("Scripting.Dictionary")
ProductCount = 0
End Sub
Private VERSION
Private SERVICE_URL_SEND
Private SERVICE_URL_AKU
Private SERVICE_TOKEN_REQUEST
Private SERVICE_TOKEN_PROCESS
Private ERROR_EMPTY_EMAIL
Private ERROR_EMPTY_WEBAPIKEY
Private ERROR_EXAMPLE_EMAIL
Private ERROR_EXAMPLE_PRODUCT
Private ERROR_TOKEN_REQUEST_TIMED_OUT
Private ERROR_TOKEN_REQUEST_FAILED
Private ERROR_TOKEN_BAD_REQUEST
Private WebApiKey
Private Email
Private Products
Private ProductCount
' Sets the customer's e-mail address.
Public Sub SetEmail(Data)
Email = Data
End Sub
' Sets partner WebApiKey
Public Sub SetWebApiKey(Data)
WebApiKey = Data
End Sub
' Get message of occured error
Public Function GetErrorMessage()
GetErrorMessage = ErrorMessage
End Function
' Indicates whether error has been occured or not
Public Function HasError()
HasError = ErrorMessage <> ""
End Function
' Adds a product name to send. Callable multiple times.
Public Function AddProduct(ProductParams)
Dim Product
Set Product = Server.CreateObject("Scripting.Dictionary")
Dim Counter
Counter = 0
For Each Param In ProductParams
If (Counter = 0) Then
Product.Add "Name", Param
ElseIf (Counter = 1) Then
Product.Add "Id", Param
End If
Counter = Counter + 1
Next
ProductCount = ProductCount + 1
Products.Add ProductCount, Product
End Function
' Makes a Unix timestamp
Private Function GetUnixTimestamp()
GetUnixTimestamp = DateDiff("s", "01/01/1970 00:00:00", Now())
End Function
' Prepares the Trusted code, which provides data sending from the customer's browser to us.
Public Function Prepare()
Dim Examples(1)
Examples(0) = "Name of first purchased product"
Examples(1) = "Name of second purchased product"
' Check example product names:
Dim Key, Example
For Each Example In Examples
For Each Key In Products.Keys
If Products(Key)("Name") = Example Then
ErrorMessage = ERROR_EXAMPLE_PRODUCT
Exit For
End If
Next
Next
' Check additional parameters before request a token:
If Email = "somebody@example.com" Then
ErrorMessage = ERROR_EXAMPLE_EMAIL
ElseIf Email = "" Then
ErrorMessage = ERROR_EMPTY_EMAIL
ElseIf WebApiKey = "" Then
ErrorMessage = ERROR_EMPTY_WEBAPIKEY
End If
If ErrorMessage = "" Then
' Build JSON of products:
Set Json = New aspJSON
For Each Key In Products.Keys
Set Json.data(Key) = Json.Collection()
Json.data(Key).Add "Name", Products(Key)("Name")
If Products(Key).Exists("Id") Then
Json.data(Key).Add "Id", Products(Key)("Id")
End If
Next
' Prepare params to post:
Dim Params
Params = "Version=" & Server.URLEncode(VERSION)
Params = Params & "&WebApiKey=" & WebApiKey
Params = Params & "&Email=" & Server.URLEncode(Email)
Params = Params & "&Products=" & Server.URLEncode(Json.JSONoutput())
Dim Random
Randomize
Random = md5(WebApiKey & GetUnixTimestamp() & Int(Round(Rnd() * 1000) + 1))
Dim Query
Query = GetQuery(Params)
' Token request is not failed:
If ErrorMessage = "" Then
Dim Output
' Sending:
Output = ""
' Include:
Output = Output & ""
' Fallback:
Output = Output & ""
Prepare = Output
End If
End If
End Function
' Performs a request on our servers to get a token and assembles query params with it.
Private Function GetQuery(Params)
Dim Url
Url = SERVICE_URL_SEND & SERVICE_TOKEN_REQUEST
Dim Http
Set Http = Server.CreateObject("MSXML2.ServerXMLHTTP")
Http.open "POST", Url, true
Http.setRequestHeader "content-type", "application/x-www-form-urlencoded"
Http.send Params
Dim Query
If Http.waitForResponse(1) Then
If Http.status = 200 Then
Set Json = New aspJSON
Json.loadJSON(Http.responseText)
Query = "Token=" & Json.data("Token")
Query = Query & "&WebApiKey=" & WebApiKey
Query = Query & "&C="
GetQuery = "?" & Query
ElseIf Http.status = 400 Then
Set Json = New aspJSON
Json.loadJSON(Http.responseText)
ErrorMessage = ERROR_TOKEN_BAD_REQUEST & Json.data("ErrorCode") & " - " & Json.data("ErrorMessage")
Else
ErrorMessage = ERROR_TOKEN_REQUEST_FAILED
End If
Else
ErrorMessage = ERROR_TOKEN_REQUEST_TIMED_OUT
End If
End Function
End Class
%>