adjust link bank account functionality
This commit is contained in:
parent
c85e9761eb
commit
405ef7a69c
|
|
@ -2721,15 +2721,20 @@ class Gestion extends CI_Controller
|
|||
public function validate_link_request() {
|
||||
if ($this->isLogged()) {
|
||||
$id = $this->input->post('id_transaction');
|
||||
$iban = $this->input->post('iban');
|
||||
$iban = $this->input->post('iban');
|
||||
|
||||
log_message('info', 'Validation de la demande de rattachement ID_transaction ' . $id);
|
||||
|
||||
// Démarrage transaction
|
||||
$this->db->trans_begin();
|
||||
|
||||
// Appel API
|
||||
$url = WALLET_SERVICE_URL . '/wallets/users/validate_link_user_bank_account';
|
||||
|
||||
$url = WALLET_SERVICE_URL . '/wallets/users/validate_link_user_bank_account';
|
||||
|
||||
log_message('info', 'URL API pour rattachement : ' . $url);
|
||||
$body = [
|
||||
'iban' => $iban,
|
||||
'id_transaction' => $id
|
||||
'id_transaction' => $id,
|
||||
'iban' => $iban
|
||||
];
|
||||
|
||||
$payload = json_encode($body);
|
||||
|
|
@ -2745,16 +2750,38 @@ class Gestion extends CI_Controller
|
|||
));
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
// Désactivation SSL pour test local si besoin
|
||||
// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
|
||||
$result = curl_exec($ch);
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
log_message('info', 'API Response for Link ID '.$id.' : HTTP Code = '.$httpCode.', Result = '.$result);
|
||||
|
||||
if ($result && ($httpCode >= 200 && $httpCode < 300)) {
|
||||
echo json_encode(['success' => 'ok', 'message' => 'Rattachement validé avec succès.']);
|
||||
$this->db->trans_commit();
|
||||
|
||||
// SUCCÈS
|
||||
echo json_encode([
|
||||
'success' => 'ok',
|
||||
'message' => 'Rattachement de compte validé avec succès.'
|
||||
]);
|
||||
exit;
|
||||
|
||||
} else {
|
||||
$this->db->trans_rollback();
|
||||
log_message('error', 'Erreur API Link ID '.$id.' : '.$result);
|
||||
echo json_encode(['success' => 'false', 'message' => 'Erreur API (' . $httpCode . ')', 'api_error' => $result]);
|
||||
} json_encode(['success' => 'false', 'message' => 'Erreur DB Locale']);
|
||||
|
||||
// ERREUR API
|
||||
echo json_encode([
|
||||
'success' => 'ok',
|
||||
'message' => 'Erreur API (' . $httpCode . ')',
|
||||
'api_error' => $result
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -499,7 +499,7 @@
|
|||
<option value="actived"><?= $this->lang->line('status_active'); ?></option>
|
||||
<option value="validated"><?= $this->lang->line('status_validated'); ?></option>
|
||||
<option value="rejected"><?= $this->lang->line('status_rejected'); ?></option>
|
||||
<option value="close"><?= $this->lang->line('status_closed'); ?></option>
|
||||
<option value="closed"><?= $this->lang->line('status_closed'); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
|
@ -887,8 +887,9 @@ $(document).ready(function () {
|
|||
$("#btn-validate-link").prop('disabled', false).html('<?= $this->lang->line("btn_validate"); ?>');
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
error: function (error) {
|
||||
toastr.error("<?= $this->lang->line('error_server_500'); ?>");
|
||||
console.error("AJAX Error: ", error);
|
||||
$("#btn-validate-link").prop('disabled', false).html('<?= $this->lang->line("btn_validate"); ?>');
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue