403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/wbs24.ozonapinew/lib/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/wbs24.ozonapinew/lib/OrdersState.php
<?php
namespace Wbs24\Ozonapinew;

use Bitrix\Main\SystemException;

class OrdersState {
    use Exception; // trait

    protected $Db;

    protected $accountIndex;

    public function __construct($accountIndex = 1, $objects = [])
    {
        try {
            $this->Db = $objects['Db'] ?? new Db();

            $this->setAccountIndex($accountIndex);
        } catch (SystemException $exception) {
            $this->exceptionHandler($exception);
        }
    }

    public function setAccountIndex($accountIndex)
    {
        $this->accountIndex = $accountIndex;
    }

    public function addOrdersInformation($ordersFromTradingPlatform)
    {
        $data = [];
        foreach ($ordersFromTradingPlatform as $key => $resultOrder) {
            $data['external_id'] = $resultOrder['posting_number'];
            $data['delivery_method_id'] = $resultOrder['delivery_method']['id'];
            $data['account_index'] = $this->accountIndex;
            $data['tpl_integration_type'] = $resultOrder['tpl_integration_type'];
            $this->Db->set('wbs24_ozonapinew_orders_state', $data);
        }
    }

    public function setSuccessShip($externalId)
    {
        try {
            $data['success_ship'] = 'success';
            $data['external_id'] = $externalId;
            $data['account_index'] = $this->accountIndex;
            $this->Db->set('wbs24_ozonapinew_orders_state', $data);

            return 'success';
        } catch (SystemException $exception) {
            $this->exceptionHandler($exception);
        }
    }

    public function setPathToPackageLabel($externalId, $packageLabel, $disabled = null, $attemptsGetPackageLabel)
    {
        try {
            $data['external_id'] = $externalId;
            $data['package_label'] = $packageLabel;
            $data['disabled_package_label'] = $disabled;
            $data['account_index'] = $this->accountIndex;
            $data['attempts_package_label'] = $attemptsGetPackageLabel;
            $this->Db->set('wbs24_ozonapinew_orders_state', $data);

            return 'success';
        } catch (SystemException $exception) {
            $this->exceptionHandler($exception);
        }
    }

    public function setCreatedActId($externalId, $createActId, $disabled = null)
    {
        try {
            $data['external_id'] = $externalId;
            $data['act_create_id'] = $createActId;
            $data['disabled_act'] = $disabled;
            $data['account_index'] = $this->accountIndex;
            $this->Db->set('wbs24_ozonapinew_orders_state', $data);

            return 'success';
        } catch (SystemException $exception) {
            $this->exceptionHandler($exception);
        }
    }

    public function setStatusAct($externalId, $status)
    {
        try {
            $data['external_id'] = $externalId;
            $data['act_creation_status'] = $status;
            $data['account_index'] = $this->accountIndex;
            $this->Db->set('wbs24_ozonapinew_orders_state', $data);

            return 'success';
        } catch (SystemException $exception) {
            $this->exceptionHandler($exception);
        }
    }

    public function setAct($externalId, $act)
    {
        try {
            $data['external_id'] = $externalId;
            $data['act'] = $act;
            $data['account_index'] = $this->accountIndex;
            $this->Db->set('wbs24_ozonapinew_orders_state', $data);

            return 'success';
        } catch (SystemException $exception) {
            $this->exceptionHandler($exception);
        }
    }

    public function getOrdersInformation($externalId = null, $where = [])
    {
        if ($externalId) {
            $orders = $this->Db->get('wbs24_ozonapinew_orders_state', [
                'external_id' => $externalId,
                'account_index' => $this->accountIndex,
            ]);
            return $orders[0];
        } else {
            $orders = $this->Db->get('wbs24_ozonapinew_orders_state', $where);
            return $orders;
        }
    }

    public function setOrderCancel($externalId)
    {
        try {
            $data['external_id'] = $externalId;
            $data['cancelled_order'] = true;
            $data['account_index'] = $this->accountIndex;
            $this->Db->set('wbs24_ozonapinew_orders_state', $data);
        } catch (SystemException $exception) {
            $this->exceptionHandler($exception);
        }
    }

    public function setOrderDelivering($externalId)
    {
        try {
            $data['external_id'] = $externalId;
            $data['delivering_order_status'] = true;
            $data['account_index'] = $this->accountIndex;
            $this->Db->set('wbs24_ozonapinew_orders_state', $data);
        } catch (SystemException $exception) {
            $this->exceptionHandler($exception);
        }
    }

    public function setOrderLastMile($externalId)
    {
        try {
            $data['external_id'] = $externalId;
            $data['delivering_order_status'] = true;
            $data['last_mile_order_status'] = true;
            $data['account_index'] = $this->accountIndex;
            $this->Db->set('wbs24_ozonapinew_orders_state', $data);
        } catch (SystemException $exception) {
            $this->exceptionHandler($exception);
        }
    }

    public function setOrderDelivered($externalId)
    {
        try {
            $data['external_id'] = $externalId;
            $data['delivering_order_status'] = true;
            $data['last_mile_order_status'] = true;
            $data['delivered_order_status'] = true;
            $data['account_index'] = $this->accountIndex;
            $this->Db->set('wbs24_ozonapinew_orders_state', $data);
        } catch (SystemException $exception) {
            $this->exceptionHandler($exception);
        }
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit