Example #1
0
 public function change($status_to, $status_from)
 {
     if (self::$from_api) {
         return;
     }
     if (!empty($this->order['yandex_market']['status'])) {
         if (in_array($this->order['yandex_market']['status'], array('PROCESSING', 'DELIVERY', 'PICKUP'))) {
             $map = $this->getBackMap();
             $status = '';
             $substatus = '';
             if (isset($map[$status_to])) {
                 $status = $map[$status_to];
             } elseif (in_array($status_to, array('O', 'F', 'D', 'I'))) {
                 $status = 'CANCELLED';
             }
             if ($status == 'CANCELLED') {
                 if ($status_to == 'I') {
                     $substatus = 'USER_CHANGED_MIND';
                 } else {
                     $substatus = 'SHOP_FAILED';
                 }
             }
             if (!empty($status)) {
                 $data = array_filter(array('status' => $status, 'substatus' => $substatus));
                 $client = new ApiClient();
                 return $client->orderStatusUpdate($this->order['yandex_market']['order_id'], $data);
             }
         }
     }
 }
Example #2
0
<?php

/***************************************************************************
*                                                                          *
*   (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev    *
*                                                                          *
* This  is  commercial  software,  only  users  who have purchased a valid *
* license  and  accept  to the terms of the  License Agreement can install *
* and use this program.                                                    *
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
use Tygh\Ym\ApiClient;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
$api = new ApiClient();
if ($mode == 'oauth') {
    if (!empty($_REQUEST['code'])) {
        $api->auth($_REQUEST['code']);
    }
    return array(CONTROLLER_STATUS_REDIRECT, 'addons.update&addon=yandex_market&selected_section=yandex_market_purchase');
}
if ($mode == 'api_test') {
    $res = $api->test();
    fn_print_die($res);
}