commit b77392b6393ba93fc9e1883831498df979d1c4c2 Author: administrator Date: Thu Jul 9 08:02:27 2026 +0000 chore: initial commit — Jumio IDV demo app diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..445ce6a --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +# macOS artifacts +.DS_Store + +# Debug logs (generated at runtime when DEBUG=true) +html/log/ + +# Nginx backup configs +nginx/*.bak +nginx/*_old.conf diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..fa28630 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,48 @@ +# AGENTS.md + +## Project identity +- **Name**: idv-demo — Jumio identity verification (KYC/KYB) demo app +- **Stack**: vanilla PHP (no framework, no Composer), nginx + PHP-FPM +- **Owner**: customer-engineering / Sechpoint + +## Repo setup +- **Git remote**: `https://git.sechpoint.app/customer-engineering/idv-demo.git` +- **Credentials**: source `~/bin/.gitenv` for `GIT_USER_NAME`, `GIT_USER_EMAIL`, `GIT_TOKEN` +- **Default branch**: `main` +- **Commit prefix convention**: `chore:` + +## Architecture (non-obvious) + +``` +html/ → web root (deploys as /var/www/html/public — see nginx config) + index.php → single entry point (front controller) + class/ → core: config.php, site.php (session init), functions.php + app/ + controler/ → routing: start.php (GET pages), request.php (POST actions) + model/ → Jumio API calls: M01.php, M04.php, docv.php, retrival_1.php, retrival_2.php, success.php + view/ → .phtml templates (header, footer, pages 00–04, loader, results) + cdn/ → static assets (JS includes iovation/IGLOO blackbox) + lng/ → language strings: en/ (default), de/ +nginx/ → nginx site config (serves from /var/www/html/public, PHP-FPM via socket) +``` + +- **No build tools, no tests, no CI/CD, no package manager** — it's raw PHP. +- Routing: URL segments drive pages (`$PARAMS[1]` in start.php); POST/GET `do` parameter drives actions (request.php). +- Jumio workflow: M01 (ID verification) → docv (document verification) → retrival → results. + +## Dev mode +- Hostname starting with `dev` sets `DEBUG = TRUE` (`html/class/config.php` line 28). +- When DEBUG is true, `debug_log()` writes to `html/log/YYYYMM.log`. The `log/` directory must exist and be writable. + +## Secrets warning +- `html/class/config.php` contains hardcoded Jumio API credentials. **Do not commit to public repos.** + +## Nginx +- Active config: `nginx/default.conf` +- PHP-FPM socket: `unix:/run/php-fpm.sock` +- Clean URLs via `try_files $uri $uri/ /index.php?$args` +- Stale backup files in `nginx/`: `default_old.conf`, `default.conf.bak`, `default.bak.3.conf` + +## Gotchas +- Filename `retrival` is intentionally misspelled (not "retrieval") — used consistently in `retrival_1.php`, `retrival_2.php`, and session keys. +- `html/` contains `.DS_Store` (macOS artifact) — should be gitignored. diff --git a/html/app/controler/dev.php b/html/app/controler/dev.php new file mode 100644 index 0000000..0c3c283 --- /dev/null +++ b/html/app/controler/dev.php @@ -0,0 +1,61 @@ +> + case 'workbanch': + include(__ROOT__.'/app/model/workbanch.php'); + break; + //==========>> + case 'test': + include(__ROOT__.'/app/view/test.html'); + break; + //==========>> + case 'clear': + session_unset(); + session_destroy(); + $_SESSION = array(); + echo 'session clear success!
';echo json_encode($_SESSION, JSON_PRETTY_PRINT); + break; + //==========>> + default: + debug_log("URI WRONG",$_SERVER['REQUEST_URI']); + $error_msg=ERROR_404; + include(__ROOT__.'/app/view/_header.phtml'); + include(__ROOT__.'/app/view/page_error.phtml'); + include(__ROOT__.'/app/view/_footer.phtml'); + } + } else { + $_SESSION=array(); + include(__ROOT__.'/app/view/_header.phtml'); + include(__ROOT__.'/app/view/page_home.phtml'); + include(__ROOT__.'/app/view/_footer.phtml'); + } + +} else { + $_SESSION=array(); + include(__ROOT__.'/app/view/_header.phtml'); + include(__ROOT__.'/app/view/page_home.phtml'); + include(__ROOT__.'/app/view/_footer.phtml'); +} diff --git a/html/app/controler/request.php b/html/app/controler/request.php new file mode 100644 index 0000000..aeb1156 --- /dev/null +++ b/html/app/controler/request.php @@ -0,0 +1,116 @@ +> + default: + echo "oh shit"; + #debug_log("Request Wrong",$HTML_REQUEST); + #session_unset(); + #session_destroy(); + #$_SESSION = array(); + #header('Location: '.$url_basic); + exit; + } +} else { + debug_log("Request Error",$HTML_REQUEST); + session_unset(); + session_destroy(); + $_SESSION = array(); + header('Location: '.$url_basic); + exit; +} +#echo '
'.json_encode($_SESSION, JSON_PRETTY_PRINT).'
';exit; + +?> diff --git a/html/app/controler/start.php b/html/app/controler/start.php new file mode 100644 index 0000000..df4d641 --- /dev/null +++ b/html/app/controler/start.php @@ -0,0 +1,87 @@ +> MENUE OPTIONS + case 'home': + include(__ROOT__.'/app/view/_header.phtml'); + include(__ROOT__.'/app/view/page_00.phtml'); + include(__ROOT__.'/app/view/_footer.phtml'); + break; + case 'one': + $_SESSION['TRANSACTION']=array(); + $_SESSION['TRANSACTION']["RETURN_1"]=array(); + $_SESSION['TRANSACTION']["RETURN_2"]=array(); + $_SESSION['TRANSACTION']["RETRIVAL_1"]=array(); + $_SESSION['TRANSACTION']["RETRIVAL_2"]=array(); + include(__ROOT__.'/app/view/_header.phtml'); + include(__ROOT__.'/app/view/page_01.phtml'); + include(__ROOT__.'/app/view/_footer.phtml'); + break; + case 'two': + $_SESSION['TRANSACTION']=array(); + $_SESSION['TRANSACTION']['status']=''; + $_SESSION['TRANSACTION']["RETURN_1"]=array(); + $_SESSION['TRANSACTION']["RETURN_2"]=array(); + $_SESSION['TRANSACTION']["RETRIVAL_1"]=array(); + $_SESSION['TRANSACTION']["RETRIVAL_2"]=array(); + include(__ROOT__.'/app/view/_header.phtml'); + include(__ROOT__.'/app/view/page_02.phtml'); + include(__ROOT__.'/app/view/_footer.phtml'); + break; + case 'three': + $_SESSION['TRANSACTION']=array(); + $_SESSION['TRANSACTION']['status']=''; + $_SESSION['TRANSACTION']["RETURN_1"]=array(); + $_SESSION['TRANSACTION']["RETURN_2"]=array(); + $_SESSION['TRANSACTION']["RETRIVAL_1"]=array(); + $_SESSION['TRANSACTION']["RETRIVAL_2"]=array(); + include(__ROOT__.'/app/view/_header.phtml'); + include(__ROOT__.'/app/view/page_03.phtml'); + include(__ROOT__.'/app/view/_footer.phtml'); + break; + case 'four': + $_SESSION['TRANSACTION']=array(); + $_SESSION['TRANSACTION']['status']=''; + $_SESSION['TRANSACTION']["RETURN_1"]=array(); + $_SESSION['TRANSACTION']["RETURN_2"]=array(); + $_SESSION['TRANSACTION']["RETRIVAL_1"]=array(); + $_SESSION['TRANSACTION']["RETRIVAL_2"]=array(); + include(__ROOT__.'/app/view/_header.phtml'); + include(__ROOT__.'/app/view/page_04.phtml'); + include(__ROOT__.'/app/view/_footer.phtml'); + break; + case 'results': + include(__ROOT__.'/app/view/_header.phtml'); + include(__ROOT__.'/app/view/results.phtml'); + include(__ROOT__.'/app/view/_footer.phtml'); + break; +//==========>> FUNCTIONAL OPTIONS + case 'dev': + include(__ROOT__.'/app/controler/development.php'); + break; + + case 'q5b35W4M3cWt': + include(__ROOT__.'/app/view/dev_demo.html'); + break; + + case 'clear': + $url_basic=$_SESSION['SITE']['site_url']; + $_SESSION=array(); + header('Location: '.$url_basic); + + break; +//==========>> + default: + debug_log("URI WRONG",$_SERVER['REQUEST_URI']); + $error_msg=ERROR_404; + include(__ROOT__.'/app/view/_header.phtml'); + include(__ROOT__.'/app/view/page_error.phtml'); + include(__ROOT__.'/app/view/_footer.phtml'); + } + +} else { + $_SESSION=array(); + include(__ROOT__.'/app/view/_header.phtml'); + include(__ROOT__.'/app/view/page_home.phtml'); + include(__ROOT__.'/app/view/_footer.phtml'); +} diff --git a/html/app/model/M01.php b/html/app/model/M01.php new file mode 100644 index 0000000..8550fe1 --- /dev/null +++ b/html/app/model/M01.php @@ -0,0 +1,120 @@ +format('Y-m-d\TH:i:s'); +$consentTimeNow = $time . '.000Z'; +$access_token = oAuth(); + +# === iniciate the transaction +# -- prepare the API request +$request_body ='{ + "workflowDefinition": { + "key": "32003" + }, + "customerInternalReference": "'.$guid.'", + "userReference": "'.$guid.'", + "reportingCriteria":"Jumio Web App", + "callbackUrl": "'.$_SESSION['SITE']['site_url'].'?do=callback", + "tokenLifetime": "90m", + "web":{ + "successUrl":"'.$_SESSION['SITE']['site_url'].'?do=success", + "errorUrl":"'.$_SESSION['SITE']['site_url'].'?do=error" + }, + "userConsent": { + "userIp": "'.$_SERVER['REMOTE_ADDR'].'", + "userLocation": { + "country": "GBR", + "state": "" + }, + "consent": { + "obtained": "yes", + "obtainedAt": "'.$consentTimeNow.'" + }, + "privacyPolicy": { + "read": "yes", + "readAt": "'.$consentTimeNow.'" + } + } +}'; + + $curl = curl_init(); + curl_setopt_array($curl, [ + CURLOPT_URL => "https://account.".$_SESSION['SITE']['datacenter']."/api/v1/accounts", + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => "", + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 30, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => "POST", + CURLOPT_POSTFIELDS => $request_body, + CURLOPT_HTTPHEADER => [ + "Authorization: Bearer ". $access_token , + "Content-Type: application/json", + "User-Agent: Jumio SE Testing" + ], + ]); + $response_json = curl_exec($curl); + $err = curl_error($curl); + curl_close($curl); + if ($err) { + $_SESSION['SITE']['ERROR']="cURL Error #:" . $err; + $_SESSION['SITE']['ERROR']['API']=array(); + $_SESSION['SITE']['ERROR']['API']=$response_json; + debug_log("API ERROR",json_encode($_SESSION, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT )); + $error_msg=ERROR_501; + include(__ROOT__.'/app/view/_header.phtml'); + include(__ROOT__.'/app/view/page_error.phtml'); + include(__ROOT__.'/app/view/_footer.phtml'); + } else { + $iniciate=array(); + $iniciate=json_decode($response_json,TRUE); + } + $prepared_data_url = $iniciate["workflowExecution"]["credentials"]["3"]["api"]["parts"]["prepared_data"]; + $redirect_url = $iniciate["web"]["href"]; + # ==== Prepare data + $request_body ='{ + "firstName": "'.$_SESSION['TRANSACTION']["FORM"]['firstName'].'", + "lastName": "'.$_SESSION['TRANSACTION']["FORM"]['lastName'].'", + "dateOfBirth":"'.$_SESSION['TRANSACTION']["FORM"]['dateOfBirth'].'", + "email": "'.$_SESSION['TRANSACTION']["FORM"]['email'].'", + "phoneNumber": "'.$_SESSION['TRANSACTION']["FORM"]['phone'].'", + "address": { + "line1": "'.$_SESSION['TRANSACTION']["FORM"]['street'].'", + "postalCode": "'.$_SESSION['TRANSACTION']["FORM"]['postcode'].'", + "city": "'.$_SESSION['TRANSACTION']["FORM"]['city'].'", + "country": "'.$_SESSION['TRANSACTION']["FORM"]['country'].'" + } + }'; + + $curl = curl_init(); + curl_setopt_array($curl, [ + CURLOPT_URL => $prepared_data_url , + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => "", + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 30, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => "POST", + CURLOPT_POSTFIELDS => $request_body, + CURLOPT_HTTPHEADER => [ + "Authorization: Bearer ". $access_token , + "Content-Type: application/json", + "User-Agent: Jumio SE Testing" + ], + ]); + + $response = curl_exec($curl); + $err = curl_error($curl); + + curl_close($curl); + + if ($err) { + echo "cURL Error #:" . $err; + } else { + echo $response; + } + header("Location:".$redirect_url); + //==================================================== + #echo '
'.json_encode($_SESSION, JSON_PRETTY_PRINT).'
'; + exit; diff --git a/html/app/model/M04.php b/html/app/model/M04.php new file mode 100644 index 0000000..8550fe1 --- /dev/null +++ b/html/app/model/M04.php @@ -0,0 +1,120 @@ +format('Y-m-d\TH:i:s'); +$consentTimeNow = $time . '.000Z'; +$access_token = oAuth(); + +# === iniciate the transaction +# -- prepare the API request +$request_body ='{ + "workflowDefinition": { + "key": "32003" + }, + "customerInternalReference": "'.$guid.'", + "userReference": "'.$guid.'", + "reportingCriteria":"Jumio Web App", + "callbackUrl": "'.$_SESSION['SITE']['site_url'].'?do=callback", + "tokenLifetime": "90m", + "web":{ + "successUrl":"'.$_SESSION['SITE']['site_url'].'?do=success", + "errorUrl":"'.$_SESSION['SITE']['site_url'].'?do=error" + }, + "userConsent": { + "userIp": "'.$_SERVER['REMOTE_ADDR'].'", + "userLocation": { + "country": "GBR", + "state": "" + }, + "consent": { + "obtained": "yes", + "obtainedAt": "'.$consentTimeNow.'" + }, + "privacyPolicy": { + "read": "yes", + "readAt": "'.$consentTimeNow.'" + } + } +}'; + + $curl = curl_init(); + curl_setopt_array($curl, [ + CURLOPT_URL => "https://account.".$_SESSION['SITE']['datacenter']."/api/v1/accounts", + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => "", + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 30, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => "POST", + CURLOPT_POSTFIELDS => $request_body, + CURLOPT_HTTPHEADER => [ + "Authorization: Bearer ". $access_token , + "Content-Type: application/json", + "User-Agent: Jumio SE Testing" + ], + ]); + $response_json = curl_exec($curl); + $err = curl_error($curl); + curl_close($curl); + if ($err) { + $_SESSION['SITE']['ERROR']="cURL Error #:" . $err; + $_SESSION['SITE']['ERROR']['API']=array(); + $_SESSION['SITE']['ERROR']['API']=$response_json; + debug_log("API ERROR",json_encode($_SESSION, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT )); + $error_msg=ERROR_501; + include(__ROOT__.'/app/view/_header.phtml'); + include(__ROOT__.'/app/view/page_error.phtml'); + include(__ROOT__.'/app/view/_footer.phtml'); + } else { + $iniciate=array(); + $iniciate=json_decode($response_json,TRUE); + } + $prepared_data_url = $iniciate["workflowExecution"]["credentials"]["3"]["api"]["parts"]["prepared_data"]; + $redirect_url = $iniciate["web"]["href"]; + # ==== Prepare data + $request_body ='{ + "firstName": "'.$_SESSION['TRANSACTION']["FORM"]['firstName'].'", + "lastName": "'.$_SESSION['TRANSACTION']["FORM"]['lastName'].'", + "dateOfBirth":"'.$_SESSION['TRANSACTION']["FORM"]['dateOfBirth'].'", + "email": "'.$_SESSION['TRANSACTION']["FORM"]['email'].'", + "phoneNumber": "'.$_SESSION['TRANSACTION']["FORM"]['phone'].'", + "address": { + "line1": "'.$_SESSION['TRANSACTION']["FORM"]['street'].'", + "postalCode": "'.$_SESSION['TRANSACTION']["FORM"]['postcode'].'", + "city": "'.$_SESSION['TRANSACTION']["FORM"]['city'].'", + "country": "'.$_SESSION['TRANSACTION']["FORM"]['country'].'" + } + }'; + + $curl = curl_init(); + curl_setopt_array($curl, [ + CURLOPT_URL => $prepared_data_url , + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => "", + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 30, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => "POST", + CURLOPT_POSTFIELDS => $request_body, + CURLOPT_HTTPHEADER => [ + "Authorization: Bearer ". $access_token , + "Content-Type: application/json", + "User-Agent: Jumio SE Testing" + ], + ]); + + $response = curl_exec($curl); + $err = curl_error($curl); + + curl_close($curl); + + if ($err) { + echo "cURL Error #:" . $err; + } else { + echo $response; + } + header("Location:".$redirect_url); + //==================================================== + #echo '
'.json_encode($_SESSION, JSON_PRETTY_PRINT).'
'; + exit; diff --git a/html/app/model/docv.php b/html/app/model/docv.php new file mode 100644 index 0000000..d9342ce --- /dev/null +++ b/html/app/model/docv.php @@ -0,0 +1,90 @@ +format('Y-m-d\TH:i:s'); +$consentTimeNow = $time . '.000Z'; +$access_token = oAuth(); + +# === iniciate the transaction +# -- prepare the API request +$request_body ='{ + "workflowDefinition": { + "key": "10055", + "credentials": [{ + "category": "DOCUMENT", + "country": { + "predefinedType": "DEFINED", + "values": ["GBR"] + }, + "type": { + "predefinedType": "DEFINED", + "values": ["UB"] + } + }] + }, + "customerInternalReference": "'.$guid.'", + "userReference": "'.$guid.'", + "reportingCriteria":"Jumio Web App", + "callbackUrl": "'.$_SESSION['SITE']['site_url'].'?do=callback", + "tokenLifetime": "90m", + "web":{ + "successUrl":"'.$_SESSION['SITE']['site_url'].'?do=success", + "errorUrl":"'.$_SESSION['SITE']['site_url'].'?do=error" + }, + "userConsent": { + "userIp": "'.$_SERVER['REMOTE_ADDR'].'", + "userLocation": { + "country": "GBR", + "state": "" + }, + "consent": { + "obtained": "yes", + "obtainedAt": "'.$consentTimeNow.'" + }, + "privacyPolicy": { + "read": "yes", + "readAt": "'.$consentTimeNow.'" + } + } +}'; + + $curl = curl_init(); + curl_setopt_array($curl, [ + CURLOPT_URL => "https://account.".$_SESSION['SITE']['datacenter']."/api/v1/accounts", + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => "", + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 30, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => "POST", + CURLOPT_POSTFIELDS => $request_body, + CURLOPT_HTTPHEADER => [ + "Authorization: Bearer ". $access_token , + "Content-Type: application/json", + "User-Agent: Jumio SE Testing" + ], + ]); + $response_json = curl_exec($curl); + $err = curl_error($curl); + curl_close($curl); +echo $response_json; + if ($err) { + $_SESSION['SITE']['ERROR']="cURL Error #:" . $err; + $_SESSION['SITE']['ERROR']['API']=array(); + $_SESSION['SITE']['ERROR']['API']=$response_json; + debug_log("API ERROR",json_encode($_SESSION, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT )); + $error_msg=ERROR_501; + include(__ROOT__.'/app/view/_header.phtml'); + include(__ROOT__.'/app/view/page_error.phtml'); + include(__ROOT__.'/app/view/_footer.phtml'); + } else { + $iniciate=array(); + $iniciate=json_decode($response_json,TRUE); + } + $redirect_url = $iniciate["web"]["href"]; + header("Location:".$redirect_url); + //==================================================== + #echo '
'.json_encode($_SESSION, JSON_PRETTY_PRINT).'
'; + exit; diff --git a/html/app/model/retrival_1.php b/html/app/model/retrival_1.php new file mode 100644 index 0000000..c050f6f --- /dev/null +++ b/html/app/model/retrival_1.php @@ -0,0 +1,46 @@ + "https://retrieval.".$_SESSION['SITE']['datacenter']."/api/v1/accounts/".$_SESSION['TRANSACTION']["RETURN"]['accountId']."/workflow-executions/".$_SESSION['TRANSACTION']["RETURN"]['workflowExecutionId']."/status", + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => "", + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 30, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => "GET", + CURLOPT_HTTPHEADER => [ + "Authorization: Bearer ". $access_token , + "Content-Type: application/json", + "User-Agent: Jumio SE Testing" + ], + ]); + while ($retry_count <= $max_retries) { + $response = curl_exec($curl); + $retrival_status=json_decode($response,TRUE); + if($retrival_status["workflowExecution"]["status"] === "PROCESSED"){break;} + time_sleep_until(time() + 5); + $retry_count++; + } + curl_setopt_array($curl, [ + CURLOPT_URL => "https://retrieval.".$_SESSION['SITE']['datacenter']."/api/v1/accounts/".$_SESSION['TRANSACTION']["RETURN"]['accountId']."/workflow-executions/".$_SESSION['TRANSACTION']["RETURN"]['workflowExecutionId'], + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => "", + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 30, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => "GET", + CURLOPT_HTTPHEADER => [ + "Authorization: Bearer ". $access_token , + "Content-Type: application/json", + "User-Agent: Jumio SE Testing" + ], + ]); + $response = curl_exec($curl); + $_SESSION['TRANSACTION']["RETRIVAL_1"]=json_decode($response,TRUE); +//==================================================== +#echo '
'.json_encode($_SESSION, JSON_PRETTY_PRINT).'
';exit; diff --git a/html/app/model/retrival_2.php b/html/app/model/retrival_2.php new file mode 100644 index 0000000..ffb328c --- /dev/null +++ b/html/app/model/retrival_2.php @@ -0,0 +1,47 @@ + "https://retrieval.".$_SESSION['SITE']['datacenter']."/api/v1/accounts/".$_SESSION['TRANSACTION']["RETURN"]['accountId']."/workflow-executions/".$_SESSION['TRANSACTION']["RETURN"]['workflowExecutionId']."/status", + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => "", + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 30, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => "GET", + CURLOPT_HTTPHEADER => [ + "Authorization: Bearer ". $access_token , + "Content-Type: application/json", + "User-Agent: Jumio SE Testing" + ], + ]); + while ($retry_count <= $max_retries) { + $response = curl_exec($curl); + $retrival_status=json_decode($response,TRUE); + if($retrival_status["workflowExecution"]["status"] === "PROCESSED"){break;} + time_sleep_until(time() + 5); + $retry_count++; + } + curl_setopt_array($curl, [ + CURLOPT_URL => "https://retrieval.".$_SESSION['SITE']['datacenter']."/api/v1/accounts/".$_SESSION['TRANSACTION']["RETURN"]['accountId']."/workflow-executions/".$_SESSION['TRANSACTION']["RETURN"]['workflowExecutionId'], + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => "", + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 30, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => "GET", + CURLOPT_HTTPHEADER => [ + "Authorization: Bearer ". $access_token , + "Content-Type: application/json", + "User-Agent: Jumio SE Testing" + ], + ]); + $response = curl_exec($curl); + $_SESSION['TRANSACTION']["RETRIVAL"]=json_decode($response,TRUE); + +//==================================================== +#echo '
'.json_encode($_SESSION, JSON_PRETTY_PRINT).'
';exit; diff --git a/html/app/model/success.php b/html/app/model/success.php new file mode 100644 index 0000000..887d04f --- /dev/null +++ b/html/app/model/success.php @@ -0,0 +1,19 @@ + window.location.href = "'.$url_basic.'results"; '; + exit; + break; +} +//==================================================== +#echo '
'.json_encode($_SESSION, JSON_PRETTY_PRINT).'
';exit; diff --git a/html/app/model/success.php.old b/html/app/model/success.php.old new file mode 100644 index 0000000..a11afba --- /dev/null +++ b/html/app/model/success.php.old @@ -0,0 +1,52 @@ + "https://retrieval.".$_SESSION['SITE']['datacenter']."/api/v1/accounts/".$_SESSION['TRANSACTION']["RETURN"]['accountId']."/workflow-executions/".$_SESSION['TRANSACTION']["RETURN"]['workflowExecutionId']."/status", + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => "", + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 30, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => "GET", + CURLOPT_HTTPHEADER => [ + "Authorization: Bearer ". $access_token , + "Content-Type: application/json", + "User-Agent: Jumio SE Testing" + ], + ]); + // Look to check Jumio Result. + do { + $response = curl_exec($curl); + $err = curl_error($curl); + if ($err) { + $_SESSION['SITE']['ERROR']="cURL Error #:" . $err; + $_SESSION['SITE']['ERROR']['API']=array(); + $_SESSION['SITE']['ERROR']['API']=$response_json; + debug_log("API ERROR",json_encode($_SESSION, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT )); + $error_msg=ERROR_501; + include(__ROOT__.'/app/view/_header.phtml'); + include(__ROOT__.'/app/view/page_error.phtml'); + include(__ROOT__.'/app/view/_footer.phtml'); + break; + } else { + $retrival_status=array(); + $retrival_status=json_decode($response,TRUE); + } + print_r($retrival_status); + if ($retrival_status["workflowExecution"]["status"] === "PROCESSED") { break; } + sleep(10); + $retry_count++; + } while ($retry_count < $max_retries); + break; +} +//==================================================== +echo '
'.json_encode($_SESSION, JSON_PRETTY_PRINT).'
';exit; diff --git a/html/app/view/_footer.phtml b/html/app/view/_footer.phtml new file mode 100644 index 0000000..456b690 --- /dev/null +++ b/html/app/view/_footer.phtml @@ -0,0 +1,40 @@ + + + + + + + +'; +}?> + + + + + diff --git a/html/app/view/_header.phtml b/html/app/view/_header.phtml new file mode 100644 index 0000000..ca87767 --- /dev/null +++ b/html/app/view/_header.phtml @@ -0,0 +1,49 @@ +'.$url_txt_0.''; +if ($_SESSION['SITE']['access']=='true'){ + $url_txt_1 = MENUE_ONE; + $url_link_1 = $url_basis.'one'; + $menue.= ''.$url_txt_1.''; + $url_txt_2 = MENUE_TWO; + $url_link_2 = $url_basis.'two'; + $menue.= ''.$url_txt_2.''; + $url_txt_3 = MENUE_THREE; + $url_link_3 = $url_basis.'three'; + $menue.= ''.$url_txt_3.''; + $url_txt_4 = MENUE_FOUR; + $url_link_4 = $url_basis.'four'; + $menue.= ''.$url_txt_4.''; +} +?> + + + + + + + + + + <?php echo SITE_NAME; ?> + + + + + + + + + + + + +
+ +
+ +
diff --git a/html/app/view/dev_demo.html b/html/app/view/dev_demo.html new file mode 100644 index 0000000..53bf955 --- /dev/null +++ b/html/app/view/dev_demo.html @@ -0,0 +1,30 @@ + + + + + + Start Jumio Demo + + + + + +
+

Please click to initiate your Demo!

+
+ + diff --git a/html/app/view/dev_test.html b/html/app/view/dev_test.html new file mode 100644 index 0000000..c4b723d --- /dev/null +++ b/html/app/view/dev_test.html @@ -0,0 +1,45 @@ + + + + + + Nav Menu + + + + + + + + + + + + diff --git a/html/app/view/loader.phtml b/html/app/view/loader.phtml new file mode 100644 index 0000000..bb16bd3 --- /dev/null +++ b/html/app/view/loader.phtml @@ -0,0 +1,9 @@ + +
+
+
+
+
+

Loading...

+
diff --git a/html/app/view/page_00.phtml b/html/app/view/page_00.phtml new file mode 100644 index 0000000..105c397 --- /dev/null +++ b/html/app/view/page_00.phtml @@ -0,0 +1,10 @@ + +
+
+
+
+
+
+
+
diff --git a/html/app/view/page_01.phtml b/html/app/view/page_01.phtml new file mode 100644 index 0000000..05522d5 --- /dev/null +++ b/html/app/view/page_01.phtml @@ -0,0 +1,196 @@ + +
+
+
+
+
+
+
+
+
+ +
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+
+
+ diff --git a/html/app/view/page_02.phtml b/html/app/view/page_02.phtml new file mode 100644 index 0000000..012bba7 --- /dev/null +++ b/html/app/view/page_02.phtml @@ -0,0 +1,10 @@ + +
+
+
+
+
+
+
+
diff --git a/html/app/view/page_03.phtml b/html/app/view/page_03.phtml new file mode 100644 index 0000000..cecf0c9 --- /dev/null +++ b/html/app/view/page_03.phtml @@ -0,0 +1,10 @@ + +
+
+
+
+
+
+
+
diff --git a/html/app/view/page_04.phtml b/html/app/view/page_04.phtml new file mode 100644 index 0000000..11be53b --- /dev/null +++ b/html/app/view/page_04.phtml @@ -0,0 +1,196 @@ + +
+
+
+
+
+
+
+
+
+ +
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+
+ + diff --git a/html/app/view/results.phtml b/html/app/view/results.phtml new file mode 100644 index 0000000..e0053cc --- /dev/null +++ b/html/app/view/results.phtml @@ -0,0 +1,3 @@ + {console.error(`iovation called an error ${msg}`);}, + }, +}; + +function getBB(){ + var bb = ""; + try { + bb = window.IGLOO.getBlackbox(); + return( bb ); + } catch (e) { + return(e); + } + } diff --git a/html/class/config.php b/html/class/config.php new file mode 100644 index 0000000..4f9b7d7 --- /dev/null +++ b/html/class/config.php @@ -0,0 +1,38 @@ +'.json_encode($_SESSION, JSON_PRETTY_PRINT).'
';exit; +/// Set default timezone + date_default_timezone_set('UCT'); + +//============================================================================== + $tmp=explode('.', $_SERVER['HTTP_HOST']); + $modus = array_shift(($tmp)); + if($modus == 'dev'){define('DEBUG',TRUE);}else{define('DEBUG',FALSE);} + define('__ROOT__', dirname(dirname(__FILE__))); + + +// API Credentials for IDV + $api_key = '2b2i83jup3eu2tr3tn581kl2dc'; + $api_secret = '1vat6laeka5gv8riltk1j0hqlguo80bue3q6gvrnk9u3f2adl39i'; + $api_token = base64_encode($api_key . ":" . $api_secret); + define( 'API_URL' , 'emea-1.jumio.ai'); + define( 'API_TOKEN' , $api_token); diff --git a/html/class/functions.php b/html/class/functions.php new file mode 100644 index 0000000..21f8fdf --- /dev/null +++ b/html/class/functions.php @@ -0,0 +1,43 @@ + "https://auth.".$_SESSION['SITE']['datacenter']."/oauth2/token", + CURLOPT_RETURNTRANSFER => true, + CURLOPT_ENCODING => "", + CURLOPT_MAXREDIRS => 10, + CURLOPT_TIMEOUT => 30, + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => "POST", + CURLOPT_POSTFIELDS => "grant_type=client_credentials", + CURLOPT_HTTPHEADER => [ + "Authorization: Basic ".$_SESSION['SITE']['apiToken'], + "Content-Type: application/x-www-form-urlencoded", + "User-Agent: ACME Payments testing" + ], + ]); + $response = curl_exec($curl); + $err = curl_error($curl); + curl_close($curl); + + if ($err) { + $result='error'; + $_SESSION['SITE']['ERROR']="cURL Error #:" . $err; + $_SESSION['SITE']['ERROR']['API']=array(); + $_SESSION['SITE']['ERROR']['API']=$response; + } else { + $oAuth = array(); + $oAuth = json_decode($response,TRUE); + } + return $oAuth["access_token"]; +} diff --git a/html/class/site.php b/html/class/site.php new file mode 100644 index 0000000..56c3e5c --- /dev/null +++ b/html/class/site.php @@ -0,0 +1,52 @@ + 86400,]); +if(empty($_SESSION)){ + $_SESSION['SITE']=array(); + $_SESSION['SITE']['ERROR']=array(); + $_SESSION['SITE']['arrived']=gmdate(DATE_ATOM); + $_SESSION['SITE']['client_ip']=''; + $_SESSION['SITE']['site_url'] = 'https://'.$_SERVER["HTTP_HOST"].'/'; + $_SESSION['SITE']['apiToken']=''; + $_SESSION['SITE']['datacenter']=''; + $_SESSION['SITE']['language']=''; + $_SESSION['SITE']['access']='false'; +// check if language is suppoted + $activeLanguage=substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); + switch ($activeLanguage) { + case 'de': + $_SESSION['SITE']['language']='de'; + break; + + default: + $_SESSION['SITE']['language']='en'; + break; + } +// -------- GET CLIENT IP ----------------------------------------------------------------- + if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { //to check ip is pass from proxy + $_SESSION['SITE']['client_ip']=$_SERVER['HTTP_X_FORWARDED_FOR']; + } else { + $_SESSION['SITE']['client_ip']=$_SERVER['REMOTE_ADDR']; + } + } diff --git a/html/img/logo.png b/html/img/logo.png new file mode 100644 index 0000000..8651eb8 Binary files /dev/null and b/html/img/logo.png differ diff --git a/html/index.php b/html/index.php new file mode 100644 index 0000000..b0ab521 --- /dev/null +++ b/html/index.php @@ -0,0 +1,41 @@ +';echo json_encode($_SESSION, JSON_PRETTY_PRINT);//exit; diff --git a/html/lng/de/default.php b/html/lng/de/default.php new file mode 100644 index 0000000..a07a253 --- /dev/null +++ b/html/lng/de/default.php @@ -0,0 +1,63 @@ +> +// == PAGES +// == HOME +define('HOME_TITLE', 'HOME_TITLE'); +define('HOME_CONTENT', 'HOME_CONTENT'); +// == PAGE_LINK +define('PAGE_LINK_TITLE', 'PAGE_LINK_TITLE'); +define('PAGE_LINK_CONTENT', 'PAGE_LINK_CONTENT'); +//==========>> + +define('WALLET_TOP_UP_TITLE','Your e-wallet by iovation'); +define('WALLET_TOP_UP_CONTENT_1','Provide your login credential and the amount you wish to top-up.'); +define('WALLET_TOP_UP_CONTENT_2', ' +

You need to provide mock-up login credentials. You can use your email or invent an email but please ensue that you can remember the email and use the same email during testing. The email provide is converted in to a GDPR compliant fingerprint and stored on iovations servers. We use the email only as an account identifier. +You can invent a password and don`t need to remember this, we are not useing password verification for this mock-up demonstration.

+

+

You can controle the result of the fraud screening.

+Any amount below 100.00 will result in ALLOWED.
+Any amount between 100.01 and 199.99 will result in REVIEW
+Any amount over 200.00 will result in DENIED
+

+'); +//==========>> + +define('WALLET_CHECKOUT_A_TITLE','Card Payment'); +define('WALLET_CHECKOUT_A_CONTENT_1','This was a low risk transaction, therefore no liability shift through 3D secure is required.'); +define('WALLET_CHECKOUT_A_CONTENT_2',' +

Please provide a credit card number for testing. This can be any random number of 16 digits.For the card expiry date, +take any date from 2019 to 2029 and 4 random digits for the CVV number.

' +); +define('WALLET_CHECKOUT_AMT_FINAL', 'You will top up '); +define('WALLET_CHECKOUT_SUBMIT', 'execute top up'); + +//==========>> + +define('WALLET_CHECKOUT_D_TITLE', 'SEPA Instant Bank Payment'); +define('WALLET_CHECKOUT_D_CONTENT_1','This was a high risk transaction, therefore only SEPA instant bank payment is offerd.'); +define('WALLET_CHECKOUT_D_CONTENT_2',' +

Please provide a IBAN number for testing. This can be any random number of 16 digits.

' +); +//==========>> + +define('WALLET_CHECKOUT_R_TITLE', 'Card Payment'); +define('WALLET_CHECKOUT_R_CONTENT_1','This was a medium risk transaction, therefore a liability shift through 3D secure is initiated.'); +define('WALLET_CHECKOUT_R_CONTENT_2',' +

Please provide a credit card number for testing. This can be any random number of 16 digits.For the card expiry date, +take any date from 2019 to 2029 and 4 random digits for the CVV number.

' +); +//==========>> diff --git a/html/lng/en/default.php b/html/lng/en/default.php new file mode 100644 index 0000000..23d78a8 --- /dev/null +++ b/html/lng/en/default.php @@ -0,0 +1,59 @@ +> First Level Pages +// =========>> PAGE_PAGE_HOME + define('PAGE_HOME_TITLE','Jumio KYX Platform Use-Case Demo'); + define('PAGE_HOME_CONTENT_1',''); + define('PAGE_HOME_CONTENT_2',''); + define('PAGE_HOME_CONTENT_3',''); + define('PAGE_HOME_CONTENT_4',''); + define('PAGE_HOME_CONTENT_5',''); + +// =========>> PAGE_ONE + define('PAGE_ONE_TITLE','ACME Holiday Homes'); + define('PAGE_ONE_CONTENT_1','Please fill out the form to register on our platform'); + define('PAGE_ONE_CONTENT_2',''); + define('PAGE_ONE_CONTENT_3',''); + define('PAGE_ONE_CONTENT_4',''); + define('PAGE_ONE_CONTENT_5',''); + + define('PAGE_TWO_TITLE','ACME Rent a Bike'); + define('PAGE_TWO_CONTENT_1',''); + define('PAGE_TWO_CONTENT_2',''); + define('PAGE_TWO_CONTENT_3',''); + define('PAGE_TWO_CONTENT_4',''); + define('PAGE_TWO_CONTENT_5',''); + + define('PAGE_THREE_TITLE','ACME Games'); + define('PAGE_THREE_CONTENT_1',''); + define('PAGE_THREE_CONTENT_2',''); + define('PAGE_THREE_CONTENT_3',''); + define('PAGE_THREE_CONTENT_4',''); + define('PAGE_THREE_CONTENT_5',''); + + define('PAGE_FOUR_TITLE','ACME Bank'); + define('PAGE_FOUR_CONTENT_1','Apply for your new ACME Account today'); + define('PAGE_FOUR_CONTENT_2','
'); + define('PAGE_FOUR_CONTENT_3',''); + define('PAGE_FOUR_CONTENT_4',''); + define('PAGE_FOUR_CONTENT_5',''); +// =========>> Second Level Pages <<======= + + +// == PAGE_ERRORS +define('ERROR_404', '

404 Not Found

The requested resource could not be found but may be available in the future.

'); +define('ERROR_501', '

500 Internal Server Error

A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.

'); diff --git a/nginx/default.bak.3.conf b/nginx/default.bak.3.conf new file mode 100644 index 0000000..9eac48b --- /dev/null +++ b/nginx/default.bak.3.conf @@ -0,0 +1,35 @@ +server { + listen [::]:80 default_server; + + root /var/www/html/public; + index index.php index.html; + charset utf-8; + server_name _; + +#Logging + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log notice; + +#handling Static files +# location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ { +# access_log off; +# expires max; +# } + +# Support Clean (aka Search Engine Friendly) URLs +# location / { +# try_files $uri $uri/ /index.php?$args ; +# } + +# Handling .php files + location ~ [^/]\.php(/|$) { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + if (!-f $document_root$fastcgi_script_name) { + return 404; + } + include fastcgi_params; + fastcgi_pass unix:/run/php-fpm.sock; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + } +} diff --git a/nginx/default.conf b/nginx/default.conf new file mode 100644 index 0000000..c6702dd --- /dev/null +++ b/nginx/default.conf @@ -0,0 +1,34 @@ +server { + listen 80 default_server; + root /var/www/html/public; + index index.php index.html; + charset utf-8; + server_name _; + +#Logging + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log notice; + +#handling Static files + location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ { + access_log off; + expires max; + } + +# Support Clean (aka Search Engine Friendly) URLs + location / { + try_files $uri $uri/ /index.php?$args ; + } + +# Handling .php files + location ~ [^/]\.php(/|$) { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + if (!-f $document_root$fastcgi_script_name) { + return 404; + } + include fastcgi_params; + fastcgi_pass unix:/run/php-fpm.sock; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + } +}