public static function getMessageForOrder(TdbShopOrder $oOrder, $sStatusCode)
    {
        $oStatus = null;
        $oPaymentHandler = $oOrder->GetPaymentHandler();
        $query = "SELECT `pkg_shop_payment_ipn_message`.*
                    FROM `pkg_shop_payment_ipn_message`
              INNER JOIN `pkg_shop_payment_ipn_status` ON `pkg_shop_payment_ipn_message`.`pkg_shop_payment_ipn_status_id` = `pkg_shop_payment_ipn_status`.`id`
                   WHERE (
                            `pkg_shop_payment_ipn_message`.`shop_order_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($oOrder->id)."'
                            AND `pkg_shop_payment_ipn_message`.`shop_payment_handler_group_id` = '".MySqlLegacySupport::getInstance()->real_escape_string(
            $oPaymentHandler->fieldShopPaymentHandlerGroupId
        )."'
                            AND `pkg_shop_payment_ipn_message`.`success` = '1'
                            AND `pkg_shop_payment_ipn_message`.`completed` = '1'
                         )
                     AND `pkg_shop_payment_ipn_status`.`code` = '".MySqlLegacySupport::getInstance()->real_escape_string($sStatusCode)."'
                 ";
        if ($aMessage = MySqlLegacySupport::getInstance()->fetch_assoc(MySqlLegacySupport::getInstance()->query($query))) {
            $oStatus = TdbPkgShopPaymentIpnMessage::GetNewInstance($aMessage);
        }

        return $oStatus;
    }