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

ECP-8327 Allow saving multiple statedata #436

Closed
wants to merge 1 commit into from

Conversation

khushboo-singhvi
Copy link
Contributor

@khushboo-singhvi khushboo-singhvi commented Nov 27, 2023

Summary

Refactoring the behaviour that allows adding multiple state data per context token.
Also, It enables to delete individual giftcard for the given context token.

Tested scenarios

Fixed issue:

@khushboo-singhvi khushboo-singhvi changed the base branch from develop to feature/Multigiftcards December 4, 2023 13:17
@khushboo-singhvi khushboo-singhvi marked this pull request as ready for review December 4, 2023 14:19
@khushboo-singhvi khushboo-singhvi requested a review from a team as a code owner December 4, 2023 14:19
Comment on lines +191 to 195
$stateData = json_decode($request->request->get('stateData', ''), true);
$Id = $stateData['id'];
$this->paymentStateDataService->deletePaymentStateData($Id);

return new JsonResponse(['token' => $context->getToken()]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to handle situation when stateData is not provided

Suggested change
$stateData = json_decode($request->request->get('stateData', ''), true);
$Id = $stateData['id'];
$this->paymentStateDataService->deletePaymentStateData($Id);
return new JsonResponse(['token' => $context->getToken()]);
$stateData = json_decode($request->request->get('stateData', '[]'), true);
if (empty($stateData)) {
// @TODO handle this situation
}
$stateData = json_decode($request->request->get('stateData', ''), true);
$Id = $stateData['id'];
$this->paymentStateDataService->deletePaymentStateData($Id);
return new JsonResponse(['token' => $context->getToken()]);

@khushboo-singhvi khushboo-singhvi marked this pull request as draft December 11, 2023 08:18
@khushboo-singhvi khushboo-singhvi deleted the ECP-8327 branch December 11, 2023 08:18
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

Successfully merging this pull request may close these issues.

2 participants