<?php
// app/api/transactions/accept

    header("Content-Type:application/json");
    include("../../../settings/dbconn.php");
    include("../../../settings/utils.php");
    
    $nonce = generateNonce();
    // Llamamos a la api primerito
    $request = array(
        'banco'=>'0138',
        'idBeneficiario'=>'V18184460',
        'telefono'=>'4244445566',
        'monto'=>(float)number_format(10, $currencydata['decimals'], '.', ''),
        'motivo'=>'Retiro AFX',
        'canal'=>'23',
        'id-externo'=>$id
    );
    
    $headers = array('Content-Type:application/json', 
        "api-key: $BP_C2P_KEY", 
        "api-signature: ".
        (
            generateApiSignature("/".$BP_VERSION_P2P."/pagos/p2p".$nonce.json_encode($request),$BP_C2P_KEY_SECRET)
        ),
        "nonce: ".$nonce,
    );
    
    // obtenemos respuesta
    $rest = queryApiBP($BP_URL_QA, "pagos/p2p", $BP_VERSION_P2P, "POST", $headers, $request);
    
    $out->rest = $rest;

    header("HTTP/1.1 200");
    echo (json_encode($out));
    die();
?>