PayU确认页面未调用

时间:2018-11-12 19:17:02

标签: firebase firebase-realtime-database woocommerce google-cloud-functions payu

编辑:使用curl我发现问题是回声...回声是在屏幕上打印的,而不是用于此用例..问题仍然存在,我如何调用javascript函数来更新我的Firebase数据库

编辑2:我刚刚发现Cloud Functions可能适合我,而无需安装firebase admin sdk。当我学习如何使用云功能时,我将给出一些答案。如果有人可以针对我的情况给我一个有关云功能的答案,我会很乐意选择它作为答案。

我的PayU确认页面有问题。这是他们在其网站上为integration提供的信息。

  

确认页面使您可以更新系统上的数据库。因此,它不应包含HTML代码,并且永远不会对买方可见。此页面是可选的。交易完成后(即批准,拒绝或取消交易),我们的平台会通过HTTP POST方法发送变量。在确认页面中,您必须捕获要存储在数据库中的数据。捕获内容将取决于所使用的编程语言。

这是我捕获信息的代码...它甚至是已经工作的代码的副本,但由于使用Firebase,我使用JavaScript来更新数据库。

<script src="https://www.gstatic.com/firebasejs/5.5.8/firebase.js"></script>
<script>
  // Initialize Firebase
  var config = {
    apiKey: "apikey",
    authDomain: "domain",
    databaseURL: "database",
    projectId: "poject",
    storageBucket: "storage",
    messagingSenderId: "123"
  };
  firebase.initializeApp(config);


  function seachEnsayoIDSSC(identifier){

    var updates = {};
    updates['/recibido/' + identifier ] = 'funciono';

    return firebase.database().ref().update(updates);

        let ref = firebase.database().ref('ensayos').orderByChild('ensayoId');

        ref.equalTo(identifier).on("value", function(snapshot) {
                console.log(snapshot.val());
                snapshot.forEach(function(data) {
                        console.log(data.key);
                });
        });
    }
</script>


<?php

$to = "testing@gmail.com";
$subject = "My subject";
$txt = "Hello world!";
$headers = "From: webmaster@testing.com";

mail($to,$subject,$txt,$headers);



echo "<script>var updates = {};
    updates['/estoseestaprobandoenpost/estamosmaso' ] = 'funciono';

    firebase.database().ref().update(updates);</script>";

if(isset($_REQUEST['sign'])){
    echo "<script>var updates = {};
    updates['/estoseestaprobandoenpost/estamosmaso' ] = 'funciono';

    firebase.database().ref().update(updates);</script>";

    $confirmationMD = $_REQUEST['sign'];
    $merchantId = $_REQUEST["merchant_id"];
    $state = $_REQUEST["state_pol"];
    $ensayoIDSSC = $_REQUEST["reference_sale"];
    $currency = $_REQUEST["currency"];
    $valor = $_REQUEST["value"];

    updateEnsayo();
}

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    echo "<script>var updates = {};
    updates['/estoseestaprobandoenpost/estamosmaso' ] = 'funciono';

    firebase.database().ref().update(updates);</script>";

    $merchantId = $_POST["merchant_id"];
    $state = $_POST["state_pol"];
    $ensayoIDSSC = $_POST["reference_sale"];
    $currency = $_POST["currency"];
    $valor = $_POST["value"];
    $confirmationMD = $_POST["sign"];

    updateEnsayo();
}

function updateEnsayo(){
    echo "<script>seachEnsayoIDSSC(". $ensayoIDSSC .")</script>";
}
?>

这是PayU收到的用于捕获付款的表格(示例)

<form method="post" action="https://sandbox.checkout.payulatam.com/ppp-web-gateway-payu/">
  <input name="merchantId"    type="hidden"  value="508029"   >
  <input name="accountId"     type="hidden"  value="512321" >
  <input name="description"   type="hidden"  value="Test PAYU"  >
  <input name="referenceCode" type="hidden"  value="TestPayU" >
  <input name="amount"        type="hidden"  value="20000"   >
  <input name="tax"           type="hidden"  value="3193"  >
  <input name="taxReturnBase" type="hidden"  value="16806" >
  <input name="currency"      type="hidden"  value="COP" >
  <input name="signature"     type="hidden"  value="7ee7cf808ce6a39b17481c54f2c57acc"  >
  <input name="test"          type="hidden"  value="1" >
  <input name="buyerEmail"    type="hidden"  value="test@test.com" >
  <input name="responseUrl"    type="hidden"  value="http://www.test.com/response" >
  <input name="confirmationUrl"    type="hidden"  value="http://www.test.com/confirmation" >
  <input name="Submit"        type="submit"  value="Enviar" >
</form>

在输入“ confirmationUrl”中,我用前面提到的代码设置了URL。这里的问题是,由于未知原因,我的Firebase数据库甚至没有来自邮件代码的电子邮件都没有得到任何更新。确实,我使用的是我自己的电子邮件,而不是代码中的电子邮件,并且即使没有发布请求,我也用发布请求测试了该URL,以检查它是否正常运行,请..帮助!谢谢!

0 个答案:

没有答案