up
This commit is contained in:
@@ -434,6 +434,7 @@
|
||||
<td class="py-3 px-4 font-mono text-gray-400" x-text="cb.ip || '—'"></td>
|
||||
<td class="py-3 px-4 text-gray-400" x-text="cb.CreatedAt ? new Date(cb.CreatedAt).toLocaleString('es-CO',{dateStyle:'short',timeStyle:'short'}) : '—'"></td>
|
||||
<td class="py-3 px-4">
|
||||
<div class="flex items-center gap-2">
|
||||
<button @click="selectedCallback = cb; showCallbackModal = true" title="Ver parámetros recibidos"
|
||||
class="text-gray-400 hover:text-[#8eb02f] transition-colors">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
@@ -441,6 +442,17 @@
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/>
|
||||
</svg>
|
||||
</button>
|
||||
<!-- Validar: solo en intentos pendientes -->
|
||||
<button x-show="cb.estado === 'pendiente'"
|
||||
@click="validarCallback(cb)"
|
||||
:disabled="validandoCallbackID === cb.ID"
|
||||
title="Verificar si el pago realmente se realizó"
|
||||
class="flex items-center gap-1 text-[10px] px-2 py-0.5 rounded border border-indigo-300 text-indigo-600 hover:bg-indigo-50 disabled:opacity-40 transition-colors">
|
||||
<svg x-show="validandoCallbackID !== cb.ID" class="w-3 h-3" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"/></svg>
|
||||
<svg x-show="validandoCallbackID === cb.ID" class="w-3 h-3 animate-spin" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"/><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"/></svg>
|
||||
Validar
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
@@ -1030,6 +1042,7 @@ function pasarelasApp() {
|
||||
showCallbackModal: false,
|
||||
selectedCallback: null,
|
||||
validandoLogID: 0,
|
||||
validandoCallbackID: 0,
|
||||
|
||||
// ─── dLocal ─────────────────────────────────────────────────────
|
||||
dlocalModo: 'dev',
|
||||
@@ -1155,6 +1168,24 @@ function pasarelasApp() {
|
||||
} catch (_) {}
|
||||
},
|
||||
|
||||
async validarCallback(cb) {
|
||||
this.validandoCallbackID = cb.ID;
|
||||
try {
|
||||
const { data } = await axios.post(`/app/pasarelas/bold/callbacks/${cb.ID}/validar`);
|
||||
if (data.ok && data.data) {
|
||||
const idx = this.boldCallbacks.findIndex(c => c.ID === cb.ID);
|
||||
if (idx !== -1) this.boldCallbacks[idx] = data.data;
|
||||
}
|
||||
const msg = data.mensaje || (data.confirmado ? 'Pago confirmado ✓' : 'Pago aún no confirmado');
|
||||
this.showToast(msg, data.confirmado ? 'success' : 'error');
|
||||
if (data.confirmado) this.loadBoldCallbacks();
|
||||
} catch (e) {
|
||||
this.showToast(e.response?.data?.error || 'Error al validar', 'error');
|
||||
} finally {
|
||||
this.validandoCallbackID = 0;
|
||||
}
|
||||
},
|
||||
|
||||
copyWebhook() {
|
||||
const base = window.location.origin;
|
||||
const url = base + '/webhooks/bold';
|
||||
|
||||
Reference in New Issue
Block a user