Filippo Bertilotti
7 days ago 4532f1c4e89a1c662ce15fee6bbf30650d632366
app/Vola/Services/VolaFakeHTTPResponder/VolaFakeHTTPResponder.php
@@ -2,6 +2,7 @@
namespace App\Vola\Services\VolaFakeHTTPResponder;
use App\Models\VodafoneUser;
use App\Vola\Classes\Utils;
use Cookie;
use GuzzleHttp\Promise\RejectedPromise;
@@ -15,9 +16,14 @@
    public array $data;
    private array $xmlResponses;
    protected string $pathTemplateFolderLegacy;
    protected string $pathTemplateFolderPicasso;
    public function __construct()
    {
        $this->xmlResponses = config('devtools.fake_sso_profiles');
        $this->pathTemplateFolderLegacy = 'response_templates.legacy';
        $this->pathTemplateFolderPicasso = 'response_templates.picasso';
    }
    public function getModelBasedResponses(Request $request): array
@@ -27,7 +33,7 @@
        if (isset($profile)) {
            $responseContent["data"] = 'test. funziono ma le logiche non sono state ancora implementate';
            $responseContent["data"] = $this->fillXmlResponses($profile, $picassoRequest);
            $responseContent["status"] = 200;
            \RequestLogger::logProcessedRequest($request, $responseContent, (($picassoRequest) ? 'Picasso' : 'SSO Legacy') );
            return $responseContent;
@@ -42,6 +48,13 @@
    }
    public function fillXMLResponses(string $profile, bool $picasso): string
    {
        $user = VodafoneUser::where(['id' => $profile]);
        $viewFolder = ($picasso) ? $this->pathTemplateFolderPicasso : $this->pathTemplateFolderLegacy;
        return view($viewFolder, ['user' => $user])->render(); //views/response_templates/legacy/*.blade.php ?? *.xml
    }
    public function getResponses(Request $request, $selectedUser, $picasso = false): string|array
    {
            $uriParts = explode("?", $request->url());