Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$client->SecuritySignOut() is creating a new session instead of closing existing one. #428

Closed
dil-hf opened this issue Feb 11, 2021 · 9 comments

Comments

@dil-hf
Copy link

dil-hf commented Feb 11, 2021

No, a Signout has to be implemented by you yourself. Otherwise you will have problems when trying to get the application certified by Amadeus (which is needed for production access). That is because an active session uses server resources on Amadeus' infrastructure.

Session signout is explained here

Originally posted by @DerMika in #151 (comment)

Hi @DerMika
Following your thought above, I was trying to implement the SecuritySignOut message to release the current session but instead of that it is creating a new session and ending this one only. So then I had always a session unclosed.
Please help me, I need it for UAT.
log.txt

@DerMika
Copy link
Collaborator

DerMika commented Feb 11, 2021

I can only imagine that at the moment you do your signout call, you no longer have the session in context.

You should review when the client gets initialized in your code, and what its lifespan is.

I can assure you this is working just fine - this library has been around 5 years now.

@dil-hf
Copy link
Author

dil-hf commented Feb 11, 2021

Hi,
Thank you for fast reply.

I have edited my questiong by adding a log file.
Also see how I am doing in my code.

I have a trait class with this:

`
public $params;
public function sendPnrRetrieveCall($pnr)
{
$client = new Client($this->params);
$pnrResult = $client->pnrRetrieve(
new PnrRetrieveOptions(['recordLocator' => $pnr])
);
if ($pnrResult->status === Result::STATUS_OK) {
$pnrResult = $this->sendDisplayTstCall($client); // send TSTrequest for price
}else{
$pnrResult = $client->securitySignOut(); //Terminates an active stateful session.
}
}

public function sendDisplayTstCall(Client $client)
{
    // $client = new Client($this->params);
    return $client->ticketDisplayTST(
        new TicketDisplayTstOptions([
            'displayMode' => TicketDisplayTstOptions::MODE_ALL
        ]),
        ['endSession' => true]
    );
}`

@dil-hf
Copy link
Author

dil-hf commented Feb 11, 2021

You should review when the client gets initialized in your code, and what its lifespan is.

Yes, I checked this too.
I just made a test by calling SecuritySignOut() directly after a PNR retrieve call and having the same issue.
I am maybe doing something wrong.

@dil-hf
Copy link
Author

dil-hf commented Feb 12, 2021

Hi @DerMika

Please have a look at the below comments.
I have tested in all manner but SecuritySignOut still creates a new session without closing the previous one.

Thank you for your help.

@DerMika
Copy link
Collaborator

DerMika commented Feb 12, 2021

Make sure you validate that your initial call actually succeeds in signing in.

If your initial call fails to sign in, i'm not sure what the result will be.

@dil-hf
Copy link
Author

dil-hf commented Feb 12, 2021

Thank you for your reply @DerMika .

I just tested when pnr_retrieve call succeed and SecuritySignOut call work perfectly by closing the session.
But when the pnr_retrieve call failed, I mean by sending a wrong PNR, the SecuritySignOut call creates a new session by sending TransactionStatusCode="start".

So my problem is when the previous call failed. I still have session ID and I want to close that session by sending a SecuritySignOut call.
I am dealing with only three messages: pnrRetrieve ,ticketDisplayTST and SecuritySignOut .

@DerMika
Copy link
Collaborator

DerMika commented Feb 12, 2021

Since it's been years i've worked with PHP and no longer have access to Amadeus, I suggest the best course of action is for you to either avoid this problem by checking if you have an active session before sending a signout (check $client->getSessionData();) or by investigating yourself and providing a PR that fixes the problem.

@dil-hf
Copy link
Author

dil-hf commented Feb 12, 2021

I suggest the best course of action is for you to either avoid this problem by checking if you have an active session before sending a signout (check $client->getSessionData();)

I checked that but it still sending a TransactionStatusCode="start".

I will try to investigate the library.

Thank you @DerMika for your time.

@DerMika
Copy link
Collaborator

DerMika commented Feb 16, 2021

Closing this as you've created a new issue for the same problem

@DerMika DerMika closed this as completed Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants