Skip to content
  1. Extras
  2. msYandexDelivery
  3. Requests and manager

Requests and manager

Lifecycle

  1. At checkout the selection is stored in properties.msyandexdelivery.
  2. On the order tab, Create calls Platform offers/create.
  3. Confirmoffers/confirm with offer_id.
  4. Refresh statusrequest/info.
  5. Cancelrequest/cancel (while the request is not yet with a courier).

There are no push webhooks. Other-day API does not provide them. Refresh status manually or in batch.

Request data lives in table msyandex_requests (model msydRequest) and in order properties.

MiniShop3 order tab

Yandex Delivery tab on the order card

Plugin msYandexDelivery Manager order tab on msOnManagerCustomCssJs (order page) registers the tab via MS3OrderTabsRegistry. VueTools is required.

The tab shows status, offer/request id, price, tracking, and Create / Confirm / Refresh / Cancel.

Cancel is available after the request is confirmed and before the parcel is handed to a courier. It is unavailable for completed requests (delivered, cancelled, returned, failed), orders at a pickup point, returns in progress, and the status “On the way to recipient”. After a successful cancel the tab shows “Cancelled”.

Status polling

Batch polling pulls current statuses from Yandex Delivery for active requests. Completed ones (delivered, cancelled, returned, failed) are skipped. Requests that have not synced recently are updated first.

Each change is saved on the MiniShop3 order. To auto-update order status or send notifications, hook a plugin to the status-change event (see below).

Scheduler

Task file: core/components/msyandexdelivery/elements/tasks/sync_statuses.php

  1. Install Scheduler or similar.
  2. Create a File task pointing at that path.
  3. Interval 15–30 minutes.
  4. You can set limit in task properties. Otherwise msyandexdelivery_sync_poll_limit is used.

Cron without Scheduler

Set a long msyandexdelivery_sync_secret and call the connector:

bash
curl -sS 'https://example.com/assets/components/msyandexdelivery/connector.php?action=sync_statuses&secret=YOUR_SECRET'

POST works too. Without the secret and without a manager session the response is unauthorized. If you are already logged into the manager, action=sync_statuses works without the secret.

Plugin on status change

php
<?php
/** @var modX $modx */
switch ($modx->event->name) {
    case 'msYandexDeliveryOnStatusChange':
        $orderId = (int) ($modx->event->params['order_id'] ?? 0);
        $normalized = (string) ($modx->event->params['normalized_status'] ?? '');
        // e.g. change MS3 status when delivered
        break;
}

Subscribe the plugin to the event. MODX creates the name on the first invokeEvent, or add msYandexDeliveryOnStatusChange to the package Events list.

Connector

Single endpoint: assets/components/msyandexdelivery/connector.php.

actionContextPurpose
calculatewebRate quote
select_optionwebPersist selection (ms3_token required)
list_pickup_pointsweb / mgrPickup point list
get_order_summarymgrOrder summary
create_requestmgrCreate offer
confirm_requestmgrConfirm offer
refresh_statusmgrRefresh status
cancel_requestmgrCancel request
sync_statusesmgr or secretBatch poll of active requests

Platform API (client)

Base host: msyandexdelivery_base_url. Client paths:

MethodPath
POST/api/b2b/platform/pricing-calculator
POST/api/b2b/platform/offers/create
POST/api/b2b/platform/offers/confirm
GET/api/b2b/platform/request/info
GET/api/b2b/platform/request/actual_info
GET/api/b2b/platform/request/history
POST/api/b2b/platform/request/cancel
POST/api/b2b/platform/location/detect
POST/api/b2b/platform/pickup-points/list

Service: MsYandexDelivery\Service\YandexDeliveryService. HTTP: MsYandexDelivery\Api\YandexPlatformClient.

Plugins

PluginEvents
msYandexDelivery AutoloadOnMODXInit (priority -100)
msYandexDelivery DeliverymsOnGetDeliveryCost
msYandexDelivery Order persistmsOnSubmitOrder, msOnBeforeCreateOrder, msOnCreateOrder
msYandexDelivery Manager order tabmsOnManagerCustomCssJs