diff --git a/application/config/database.php b/application/config/database.php
index 8e493c59..44cb512c 100755
--- a/application/config/database.php
+++ b/application/config/database.php
@@ -79,6 +79,7 @@ $db['default'] = array(
'username' => 'root',
'password' => '@iLink@2025',
'database' => 'iLink_preprod',
+ 'database' => 'iLink_world',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
diff --git a/application/controllers/Gestion.php b/application/controllers/Gestion.php
index bb5e581e..58d31a65 100755
--- a/application/controllers/Gestion.php
+++ b/application/controllers/Gestion.php
@@ -2651,8 +2651,6 @@ class Gestion extends CI_Controller
$doc_front = $this->input->post('doc_front');
$doc_back = $this->input->post('doc_back');
- $this->db->trans_begin();
-
$updateLocal = $this->user_model->updateRequestStatus($id, 'validated');
log_message('info', 'Validation de la demande d\'ouverture de compte agence bancaire ID_demande ' . $id);
@@ -2689,36 +2687,121 @@ class Gestion extends CI_Controller
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
+ log_message('info', 'Réponse API lors de l\'ouverture du compte agence bancaire ID_demande ' . $id . ' : ' . $result);
+
if ($result && ($httpCode >= 200 && $httpCode < 300)) {
-
- $this->db->trans_commit();
echo json_encode([
'success' => 'ok',
- 'message' => 'Compte créé avec succès.',
- 'api_response' => json_decode($result)
+ 'message' => 'Compte créé avec succès.'
]);
} else {
-
- $this->db->trans_rollback();
echo json_encode([
'success' => 'false',
- 'message' => 'Un problème est survenu lors de l\'ouverture du compte (' . $httpCode . ')',
- 'api_error' => $result
+ 'message' => 'Un problème est survenu lors de l\'ouverture du compte (' . $result . ')'
]);
- log_message('error', 'Erreur API lors de l\'ouverture du compte agence bancaire ID_demande ' . $id . ' : ' . $result);
+ log_message('error', '------------- Erreur API lors de l\'ouverture du compte agence bancaire ID_demande ' . $id . ' : ' . $result);
}
} else {
-
- // ECHEC LOCAL : ON ANNULE LA TRANSACTION (ROLLBACK)
- $this->db->trans_rollback();
echo json_encode(['alert' => 'error', 'success' => 'false', 'message' => 'Erreur lors de l\'activation du compte']);
}
}
}
+ /* --------------------------------------------------------------------------
+ GESTION DES RATTACHEMENTS (LINKS)
+ -------------------------------------------------------------------------- */
+
+ public function validate_link_request() {
+ if ($this->isLogged()) {
+ $id = $this->input->post('id_transaction');
+ $iban = $this->input->post('iban');
+ $code_client = $this->input->post('code_client');
+
+ $updateLocal = $this->user_model->updateLinkStatus($id, 1);
+ log_message('info', 'Validation Rattachement ID: ' . $id);
+
+ if ($updateLocal) {
+
+ // Appel API
+ $url = WALLET_SERVICE_URL . '/validate_link_user_bank_account';
+
+
+ $body = [
+ 'iban' => $iban,
+ 'code_client' => $code_client,
+ 'id_transaction' => $id
+ ];
+
+ $payload = json_encode($body);
+
+ $ch = curl_init($url);
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
+ 'Content-Type: application/json',
+ 'Content-Length: ' . strlen($payload),
+ 'Authorization: ' . WALLET_SERVICE_TOKEN,
+ 'X-localization: ' . ($this->session->userdata('site_lang') == 'french' ? 'fr' : 'en')
+ ));
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+
+ $result = curl_exec($ch);
+ $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+ curl_close($ch);
+
+ if ($result && ($httpCode >= 200 && $httpCode < 300)) {
+ echo json_encode(['success' => 'ok', 'message' => 'Rattachement validé avec succès.']);
+ } else {
+ log_message('error', 'Erreur API Link ID '.$id.' : '.$result);
+ echo json_encode(['success' => 'false', 'message' => 'Erreur API (' . $httpCode . ')', 'api_error' => $result]);
+ }
+ } else {
+ echo json_encode(['success' => 'false', 'message' => 'Erreur DB Locale']);
+ }
+ }
+ }
+
+ public function update_link_request() {
+ if ($this->isLogged()) {
+ $id = $this->input->post('id_transaction');
+
+ // On récupère les données du formulaire
+ $data = [];
+ if($this->input->post('iban')) $data['iban'] = $this->input->post('iban');
+ if($this->input->post('code_client')) $data['code_client'] = $this->input->post('code_client');
+
+ // is_verified (Status)
+ if($this->input->post('is_verified') !== null) {
+ $data['is_verified'] = $this->input->post('is_verified');
+ }
+
+ $result = $this->user_model->updateLinkRequest($id, $data);
+
+ if ($result) {
+ echo json_encode(['success' => 'ok', 'message' => 'Mise à jour réussie']);
+ } else {
+ echo json_encode(['success' => 'false', 'message' => 'Erreur DB']);
+ }
+ }
+ }
+
+ // 3. SUPPRESSION
+ public function delete_link_request() {
+ if ($this->isLogged()) {
+ $id = $this->input->post('id_transaction');
+ $result = $this->user_model->deleteLinkRequest($id);
+
+ if ($result) {
+ echo json_encode(['success' => 'ok', 'message' => 'Suppression effectuée']);
+ } else {
+ echo json_encode(['success' => 'ko', 'message' => 'Erreur DB']);
+ }
+ }
+ }
+
}
diff --git a/application/helpers/functions_helper.php b/application/helpers/functions_helper.php
index 7cfd2574..9447070f 100755
--- a/application/helpers/functions_helper.php
+++ b/application/helpers/functions_helper.php
@@ -224,7 +224,7 @@ if (!function_exists('getStatusBadge')) {
case 'pending':
return ''.$label.'';
- case 'active':
+ case 'actived':
return ''.$label.'';
case 'validated':
diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php
index fd6317af..9f58ac0a 100755
--- a/application/language/english/message_lang.php
+++ b/application/language/english/message_lang.php
@@ -1103,4 +1103,10 @@ $lang['status_validated'] = 'Validated';
$lang['subscriptions_history'] = "Subscription history";
$lang["list_of_request_opening_bank_accounts"] = "List of bank account opening requests";
$lang["product"] = "Product";
+$lang["status_actived"] = "Actived";
+$lang["status_rejected"] = "Rejected";
+$lang["status_validated"] = "Validated";
+$lang["status_close"] = "Closed";
+$lang["status_closed"] = "Closed";
+$lang["status_pernding"]= "Pending";
?>
diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php
index 644915e9..2e55d6d2 100755
--- a/application/language/french/message_lang.php
+++ b/application/language/french/message_lang.php
@@ -1110,4 +1110,11 @@ $lang['status_rejected'] = 'Rejeté';
$lang['status_validated'] = 'Validé';
$lang['subscriptions_history'] = 'Historique des souscriptions';
$lang["product"] = "Produit";
+$lang["status_actived"] = "Activé";
+$lang["status_rejected"] = "Rejété";
+$lang["status_validated"] = "Validé";
+$lang["status_close"] = "Fermé";
+$lang["status_closed"] = "Fermé";
+$lang["status_pernding"]= "En cours";
+
?>
diff --git a/application/models/User_model.php b/application/models/User_model.php
index d3017cb9..44f2b9db 100755
--- a/application/models/User_model.php
+++ b/application/models/User_model.php
@@ -2373,7 +2373,8 @@ class User_model extends CI_Model
u.email,
u.phone,
op.nom as bank_name,
- opc.adresse as bank_address
+ opc.adresse as bank_address,
+ uba.customer_number as code_client
');
$this->db->from('users_banking_account_verification v');
@@ -2381,6 +2382,7 @@ class User_model extends CI_Model
$this->db->join('operators_countries opc', 'opc.id = v.id_bank_country', 'left');
$this->db->join('operators op', 'op.id = opc.id_operator', 'left');
+ $this->db->join('user_bank_accounts uba', 'uba.id_user = u.id', 'left');
$this->db->order_by('v.created_at', 'ASC');
@@ -2392,4 +2394,22 @@ class User_model extends CI_Model
$this->db->where("id", $id);
return $this->db->update("user_bank_accounts", ['status' => $status, 'reason' => 'En attente d\'activation de compte']);
}
+
+ /* GESTION DES RATTACHEMENTS */
+
+ public function updateLinkStatus($id, $status) {
+ $this->db->where('id_transaction', $id);
+ return $this->db->update('users_banking_account_verification', ['is_verified' => $status]);
+ }
+
+ public function updateLinkRequest($id, $data) {
+ $this->db->where('id_transaction', $id);
+ return $this->db->update('users_banking_account_verification', $data);
+ }
+
+ // Suppression
+ public function deleteLinkRequest($id) {
+ $this->db->where('id_transaction', $id);
+ return $this->db->delete('users_banking_account_verification');
+ }
}
diff --git a/application/views/config_wallet_ilink_hyp/customers_accounts.php b/application/views/config_wallet_ilink_hyp/customers_accounts.php
index 323606fe..5b84eab4 100755
--- a/application/views/config_wallet_ilink_hyp/customers_accounts.php
+++ b/application/views/config_wallet_ilink_hyp/customers_accounts.php
@@ -95,12 +95,9 @@
@@ -303,7 +300,7 @@
$("#update-form input[name='opening_amount']").val($(this).data('opening_amount'));
$("#update-form input[name='opening_amount_payment_period_days']").val($(this).data('opening_amount_payment_period_days'));
- $("#update-form select[name='parent_id']").empty().append("");
+ $("#update-form select[name='parent_id']").empty().append("");
$.each(types, function (j, it) {
$("#update-form select[name='parent_id']").append(``);
});
diff --git a/application/views/gestion_agency_banking.php b/application/views/gestion_agency_banking.php
index 32f781f3..e20fcfcc 100755
--- a/application/views/gestion_agency_banking.php
+++ b/application/views/gestion_agency_banking.php
@@ -189,6 +189,7 @@
Téléphone |
Banque |
IBAN / Compte |
+ Code client |
= $this->lang->line('status'); ?> |
Actions |
@@ -199,7 +200,7 @@
is_verified == 1) $statusStr = 'active';
+ if($l->is_verified == 1) $statusStr = 'actived';
if($l->is_verified == 2) $statusStr = 'rejected';
?>
@@ -210,12 +211,13 @@
= $l->lastname ?> = $l->firstname ?>
= $l->email ?>
- = $l->phone ?> |
+ = !empty($l->phone) ? $l->phone : '-'; ?> |
= $l->bank_name ?>
= substr($l->bank_address, 0, 20) ?>...
|
= $l->iban ?> |
+ = !empty($l->code_client) ? $l->code_client : '-'; ?> |
= getStatusBadge($statusStr, $this->lang) ?>
|
@@ -233,11 +235,31 @@
data-bank_name="= $l->bank_name ?>"
data-bank_address="= $l->bank_address ?>"
data-iban="= $l->iban ?>"
+ data-code_client="= $l->code_client ?>"
data-status="= $statusStr ?>"
data-created_at="= $l->created_at ?>"
>
+
+
+
+
+
@@ -250,6 +272,71 @@
+
+
+
+
+
+
+
+
+
+
Voulez-vous vraiment supprimer cette demande de rattachement ?
+
+
+
+
+
+
+
@@ -360,7 +447,7 @@
-
Code Utilisateur :
+
Code wallet Utilisateur :
Nom Complet :
Email :
Téléphone :
@@ -369,6 +456,7 @@
Nom de la Banque :
Adresse Banque :
IBAN / Numéro Carte :
+
Code Client :
Date Demande :
Statut Actuel :
@@ -418,7 +506,7 @@