From f33512ef1b0918df33dae7e899e4699db3a1e059 Mon Sep 17 00:00:00 2001 From: kFrolichs Date: Fri, 23 Feb 2018 17:22:42 +0100 Subject: [PATCH] Fixed error in data being overwritten by 2nd webhook. --- catalog/controller/module/wuunder.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/catalog/controller/module/wuunder.php b/catalog/controller/module/wuunder.php index 219a6d0..0faeffb 100644 --- a/catalog/controller/module/wuunder.php +++ b/catalog/controller/module/wuunder.php @@ -14,9 +14,11 @@ public function webhook() $order_id = $_REQUEST['order']; $booking_token = $_REQUEST['token']; $data = json_decode(file_get_contents('php://input'), true); + if ($data['action'] === "shipment_booked") { $this->db->query("UPDATE `wuunder_shipment` SET label_id = '" . $this->db->escape($data['shipment']['id']) . "', label_url = '" . $this->db->escape($data['shipment']['label_url']) . "', label_tt_url = '" . $this->db->escape($data['shipment']['track_and_trace_url']) . "' WHERE order_id = " . $order_id . " AND booking_token = '" . $booking_token . "'"); $this->load->model("checkout/order"); $this->model_checkout_order->addOrderHistory($order_id, 3); + } } } -} \ No newline at end of file +}