Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 26 additions & 34 deletions class/paycomet_bankstore.php
Original file line number Diff line number Diff line change
Expand Up @@ -1544,40 +1544,32 @@ private function SendResponse($respuesta = false)
*/
private function GenerateHash($operationdata, $operationtype)
{
$hash = false;


if ((int)$operationtype == 1) { // Authorization (execute_purchase)
$hash = hash('sha512', $this->merchantCode.$this->terminal.$operationtype.$operationdata->Reference.$operationdata->Amount.$operationdata->Currency.md5($this->password));
} elseif ((int)$operationtype == 3) { // Preauthorization
$hash = hash('sha512', $this->merchantCode.$this->terminal.$operationtype.$operationdata->Reference.$operationdata->Amount.$operationdata->Currency.md5($this->password));
} elseif ((int)$operationtype == 6) { // Confirmación de Preauthorization
$hash = hash('sha512', $this->merchantCode.$operationdata->IdUser.$operationdata->TokenUser.$this->terminal.$operationtype.$operationdata->Reference.$operationdata->Amount.md5($this->password));
} elseif ((int)$operationtype == 4) { // Cancelación de Preauthorization
$hash = hash('sha512', $this->merchantCode.$operationdata->IdUser.$operationdata->TokenUser.$this->terminal.$operationtype.$operationdata->Reference.$operationdata->Amount.md5($this->password));
} elseif ((int)$operationtype == 9) { // Subscription
$hash = hash('sha512', $this->merchantCode.$this->terminal.$operationtype.$operationdata->Reference.$operationdata->Amount.$operationdata->Currency.md5($this->password));
} elseif ((int)$operationtype == 107) { // Add_user
$hash = hash('sha512', $this->merchantCode.$this->terminal.$operationtype.$operationdata->Reference.md5($this->password));
} elseif ((int)$operationtype == 109) { // execute_purchase_token
$hash = hash('sha512', $this->merchantCode.$operationdata->IdUser.$operationdata->TokenUser.$this->terminal.$operationtype.$operationdata->Reference.$operationdata->Amount.$operationdata->Currency.md5($this->password));
} elseif ((int)$operationtype == 110) { // create_subscription_token
$hash = hash('sha512', $this->merchantCode.$operationdata->IdUser.$operationdata->TokenUser.$this->terminal.$operationtype.$operationdata->Reference.$operationdata->Amount.$operationdata->Currency.md5($this->password));
} elseif ((int)$operationtype == 111) { // create_preauthorization_token
$hash = hash('sha512', $this->merchantCode.$operationdata->IdUser.$operationdata->TokenUser.$this->terminal.$operationtype.$operationdata->Reference.$operationdata->Amount.$operationdata->Currency.md5($this->password));
} elseif ((int)$operationtype == 13) { // Preauthorization Diferida
$hash = hash('sha512', $this->merchantCode.$this->terminal.$operationtype.$operationdata->Reference.$operationdata->Amount.$operationdata->Currency.md5($this->password));
} elseif ((int)$operationtype == 16) { // Confirmación de Preauthorization Diferida
$hash = hash('sha512', $this->merchantCode.$operationdata->IdUser.$operationdata->TokenUser.$this->terminal.$operationtype.$operationdata->Reference.$operationdata->Amount.md5($this->password));
} elseif ((int)$operationtype == 14) { // Cancelación de Preauthorization Diferida
$hash = hash('sha512', $this->merchantCode.$operationdata->IdUser.$operationdata->TokenUser.$this->terminal.$operationtype.$operationdata->Reference.$operationdata->Amount.md5($this->password));
} elseif ((int)$operationtype == 114) { // Execute purchase rtoken
$hash = hash('sha512', $this->merchantCode.$this->terminal.$operationtype.$operationdata->Reference.$operationdata->Amount.$operationdata->Currency.md5($this->password));
} elseif ((int)$operationtype == 117) { // Execute purchase rtoken
$hash = hash('sha512', $this->merchantCode.$this->terminal.$operationtype.$operationdata->Reference.$operationdata->Amount.$operationdata->Currency.md5($this->password));
}

return $hash;
switch ((int)$operationtype) {
case 1: // Authorization (execute_purchase)
case 3: // Preauthorization
case 9: // Subscription
case 13: // Preauthorization Diferida
case 114: // Execute purchase rtoken
case 117: // Create preauthorization rtoken
return hash('sha512', $this->merchantCode.$this->terminal.$operationtype.$operationdata->Reference.$operationdata->Amount.$operationdata->Currency.md5($this->password));

case 4: // Cancelación de Preauthorization
case 6: // Confirmación de Preauthorization
case 14: // Cancelación de Preauthorization Diferida
case 16: // Confirmación de Preauthorization Diferida
return hash('sha512', $this->merchantCode.$operationdata->IdUser.$operationdata->TokenUser.$this->terminal.$operationtype.$operationdata->Reference.$operationdata->Amount.md5($this->password));

case 107: // Add_user
return hash('sha512', $this->merchantCode.$this->terminal.$operationtype.$operationdata->Reference.md5($this->password));

case 109: // execute_purchase_token
case 110: // create_subscription_token
case 111: // create_preauthorization_token
return hash('sha512', $this->merchantCode.$operationdata->IdUser.$operationdata->TokenUser.$this->terminal.$operationtype.$operationdata->Reference.$operationdata->Amount.$operationdata->Currency.md5($this->password));

default:
return false;
}
}

/**
Expand Down