Uncomplete transactions is overwritten by new transaction

fajerstarter - August 25, 2009 - 08:27
Project:DIBS Payment Gateway API
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

I saw this during testing on a local machine that wasn't accessible for a DIBS callback, but this could also happen if the callback from DIBS is delayed for some reason.

1. Place an order. The uncompleted transaction is then stored in the dibs_transactions table.
2. Pay the order on Dibs but don't follow the link to the receipt. The callback from Dibs is not fired.
3. Place a new order. Now this uncompleted transaction overwrites the transaction in 1.

The code is on line 383 in dibs.module

<?php
 
// DIBS transaction data
 
$hash = isset($_SESSION['dibs'][$data['api_module']][$data['api_delta']]['hash']) ? $_SESSION['dibs'][$data['api_module']][$data['api_delta']]['hash'] : NULL;
  if (!empty(
$hash) && is_string($hash)) {
   
// We are forcing the system to use a new transaction id for every load of this page,
    // therefore are we deleting the old transaction record
   
db_query("DELETE FROM {dibs_transactions} WHERE payment_status < 1 AND api_hash = '%s'", $hash);
   
$hash = NULL;
  }
?>

The hash used to delete the old transaction record in 3. is the hash from the transaction in 1.

 
 

Drupal is a registered trademark of Dries Buytaert.