Вот как данные отправляются компанией A
Код: Выделить всё
public function handle_cancel_payment($order_id) {
$xml_data = isset($_POST['xml_data']) ? $_POST['xml_data'] : '';
if (!empty($xml_data)) {
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "nabil_payment";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO cancel_payment (message_date, language, version, currency, session_id, purchase_amount, total_amount, order_status, fee, fee_scr, order_id, shop_name, order_id_encrypted, order_description, purchase_amount_scr, currency_scr, tran_date_time, order_status_scr, total_amount_scr, result_operation, currency_iso_alpha, acq_fee_scr, transaction_type)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
$stmt = $conn->prepare($sql);
$stmt->bind_param("sssisddsdssssssssssssss", $message_date, $language, $version, $currency, $session_id, $purchase_amount, $total_amount, $order_status, $fee, $fee_scr, $order_id, $shop_name, $order_id_encrypted, $order_description, $purchase_amount_scr, $currency_scr, $tran_date_time, $order_status_scr, $total_amount_scr, $result_operation, $currency_iso_alpha, $acq_fee_scr, $transaction_type);
$xml = simplexml_load_string($xml_data);
$message_date = date('Y-m-d H:i:s', strtotime((string)$xml->TranDateTime));
$language = (string)$xml->Language;
$version = (string)$xml->Version;
$currency = (int)$xml->Currency;
$session_id = (string)$xml->SessionId;
$purchase_amount = (float)$xml->PurchaseAmount;
$total_amount = (float)$xml->TotalAmount;
$order_status = (string)$xml->OrderStatus;
$fee = (float)$xml->Fee;
$fee_scr = (string)$xml->FeeScr;
$order_id = (int)$xml->OrderID;
$shop_name = (string)$xml->ShopName;
$order_id_encrypted = (string)$xml->OrderIDEncrypted;
$order_description = (string)$xml->OrderDescription;
$purchase_amount_scr = (string)$xml->PurchaseAmountScr;
$currency_scr = (string)$xml->CurrencyScr;
$tran_date_time = date('Y-m-d H:i:s', strtotime((string)$xml->TranDateTime));
$order_status_scr = (string)$xml->OrderStatusScr;
$total_amount_scr = (string)$xml->TotalAmountScr;
$result_operation = (string)$xml->RezultOperation;
$currency_iso_alpha = (string)$xml->CurrencyISOAlpha;
$acq_fee_scr = (string)$xml->AcqFeeScr;
$transaction_type = (string)$xml->TransactionType;
if ($stmt->execute()) {
echo "XML data stored successfully in cancel_payment table.";
} else {
echo "Error: " . $sql . "
" . $conn->error;
}
$stmt->close();
$conn->close();
} else {
echo "No XML data received.";
}
}
Я пробовал это, но таблица не обновляется, и я не получаю никаких ошибок,
p>
XMLlog выглядит примерно так:
Код: Выделить всё
EN
1.0
524
F7A15894DD4ASA45991ED753876E0786E10
30
30
CANCELED
0
0,00
633249
F7A15894DD4ASA45991ED753876E0786E10
lamasarts.com
@encrypted00E137DB
5468
0,30
Nepal Rupee
14/03/2024 14:35:13
CANCELED
0,30
Transaction Result
NPR
0,00
Purchase
Подробнее здесь: https://stackoverflow.com/questions/781 ... n-database