Skip to content

feat: add lock in database for fix duplicate order - #706

Merged
Benjamin-Freoua-Alma merged 4 commits into
developfrom
feature/ecom-2944-doublon-prestashop
Sep 10, 2025
Merged

Benjamin-Freoua-Alma merged 4 commits into
developfrom
feature/ecom-2944-doublon-prestashop

Conversation

@Benjamin-Freoua-Alma

Copy link
Copy Markdown
Member

Reason for change

Linear task

Code changes

Handle the duplicate order

How to test

As a reviewer, you are encouraged to test the PR locally.

Execute this code between the payment validated on Alma and before the return confirmation

<?php
$nbRequests = 5;
$url = "http://prestashop-a-8-1-7.local.test/module/alma/validation?pid=payment_121QAPc3SxmOBIcRyx7bvcF4KYYx45hEzV"; // replace the url with payment id

$multiHandle = curl_multi_init();
$handles = [];

for ($i = 0; $i < $nbRequests; $i++) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // selon config locale
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // idem
    $handles[] = $ch;
    curl_multi_add_handle($multiHandle, $ch);
}

$running = null;
do {
    curl_multi_exec($multiHandle, $running);
    curl_multi_select($multiHandle);
} while ($running > 0);

// R  sultats
foreach ($handles as $ch) {
    $response = curl_multi_getcontent($ch);
    echo "Response:\n$response\n\n";
    curl_multi_remove_handle($multiHandle, $ch);
}

curl_multi_close($multiHandle);

Checklist for authors and reviewers

  • The title of the PR uses business wording, not technical jargon, for the changelog readers to understand it
  • The PR implements the changes asked in the referenced task / issue
  • The automated tests are compliant with the testing strategy
  • The tests are relevant, and cover the corner/error cases, not only the happy path
  • You understand the impact of this PR on existing code/features
  • The changes include adequate logging and Datadog traces
  • Documentation is updated (API, developer documentation, ADR, Notion...)

Non applicable

@Benjamin-Freoua-Alma Benjamin-Freoua-Alma self-assigned this Jul 23, 2025
@Benjamin-Freoua-Alma
Benjamin-Freoua-Alma requested a review from a team as a code owner July 23, 2025 13:53
@github-actions github-actions Bot added the type: feature New feature label Jul 23, 2025
@Benjamin-Freoua-Alma
Benjamin-Freoua-Alma force-pushed the feature/ecom-2944-doublon-prestashop branch from 81f84f1 to 767d193 Compare August 6, 2025 14:23
@KarlSNT2 KarlSNT2 mentioned this pull request Aug 26, 2025
@sonarqubecloud

sonarqubecloud Bot commented Sep 3, 2025

Copy link
Copy Markdown

@Benjamin-Freoua-Alma
Benjamin-Freoua-Alma merged commit 263d475 into develop Sep 10, 2025
3 of 5 checks passed
@Benjamin-Freoua-Alma
Benjamin-Freoua-Alma deleted the feature/ecom-2944-doublon-prestashop branch September 10, 2025 14:39
@Benjamin-Freoua-Alma Benjamin-Freoua-Alma changed the title Feature/ecom 2944 doublon prestashop feat: add lock in database for fix duplicate order Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants