Assigning key to Employee

@param string $employeeId
@param integer $cardNumber
@param boolean $force
@return object
345814
public function assignKey($employeeId, $cardNumber, $force = false)
    {
        $cardNumber = $this->prepareKey($cardNumber);
        $result     = null;
        $this->addHeader();
        try {
            $data                       = new \stdClass();
            $data->employeeId           = $employeeId;
            $data->indexNumber          = 1;
            $data->keyData              = new \stdClass();
            $data->keyData->KeyNumber   = $cardNumber;
            $data->keyData->StartDate   = date('Y-m-d\TH:i:s.811P',
                time() - 10 * 60);
            $data->keyData->EndDate     = date('Y-m-d\TH:i:s.811P',
                time() + 60 * 60 * 24 * 365);
            $data->keyData->Description = 'Карта номер:' . $cardNumber;

            if (!$force) {
                $result = $this->getSoap()->AssignAcsKeyForEmployee($data);
            } else {
                $result = $this->getSoap()->ForceAssignAcsKeyForEmployee($data);
            }
        } catch (\SoapFault $ex) {
            $this->logError();
        }
        return $result;
    }
352497
public function removeEmployeeByCardNumber($cardNumber)
    {
        $cardNumber = $this->prepareKey($cardNumber);
        $result     = null;
        $this->addHeader();
        try {
            $empResult = $this->getSoap()->GetAssignedAcsKeyByKeyNumber([
                'keyNumber' => $cardNumber
            ]);
            if ($empResult->GetAssignedAcsKeyByKeyNumberResult !== null) {
                $result = $this->removeEmployee($empResult->GetAssignedAcsKeyByKeyNumberResult->AcsEmployeeId);
            }
        } catch (\SoapFault $ex) {
            $this->logError();
        }
        return $result;
    }
1265519
public function createAddCardJsPackage($cardid = null, $data = array())
    {
        $cardList = array();
        if (is_array($cardid)) {
            foreach ($cardid as $id) {
                $cardList[] = array('cardId' => $id, 'cardExt' => json_encode($this->_cardSign($id, $data)));
            }
        } else {
            $cardList[] = array('cardId' => $cardid, 'cardExt' => json_encode($this->_cardSign($cardid, $data)));
        }
        return array('cardList' => $cardList);
    }
1226087
public function deactivate(string $cardId, string $code)
    {
        $params = [
            'card_id' => $cardId,
            'code' => $code,
        ];

        return $this->httpPostJson('card/generalcard/unactivate', $params);
    }
1044440
public function memberCardSummaryById(string $from, string $to, string $cardId)
    {
        $ext = [
            'card_id' => $cardId,
        ];

        return $this->query('datacube/getcardmembercarddetail', $from, $to, $ext);
    }
977022
public function createAndGetDraftForUser($userId, $force = false)
    {
        //wyszukiwanie najnowszego draftu (chyba że wymuszony nowy)
        if (!$force && null !== $lastDraft = (new \Cms\Orm\CmsCategoryQuery)
            ->whereCmsCategoryOriginalId()->equals($this->_category->id)
            ->andFieldStatus()->equals(\Cms\Orm\CmsCategoryRecord::STATUS_DRAFT)
            ->andFieldDateAdd()->greater(date('Y-m-d H:i:s', strtotime(self::DRAFT_MAX_LIFETIME)))
            ->andFieldCmsAuthId()->equals($userId)
            ->orderDescId()
            ->findFirst()) {
            //czyszczenie starych draftów
            $this->_gc($userId, $lastDraft->id);
            //zwrot ostatniego draftu
            return $lastDraft;
        }
        //próba kopiowania
        if (!parent::copyWithTransaction()) {
            return;
        }
        //pobranie drafta
        $draft = $this->getCopyRecord();
        //przypinanie użytkownika do draftu
        $draft->cmsAuthId = $userId;
        $draft->dateAdd = date('Y-m-d H:i:s');
        $draft->save();
        //czyszczenie starych draftów
        $this->_gc($userId, $draft->id);
        //zwrot drafta
        return $draft;
    }
703977
public function delete($productId, $force = null)
    {
        $options = (object)[];
        $options->qs = [ "force" => ($force ? "true" : "false") ];

        return $this->client->delete("/products/" . rawurlencode($productId), null, $options);
    }
1243879
public static function select($cardId) {
    $card = self::load($cardId);

    $available = array_keys($card['usable']);
    $selected  = Rand::int(0, count($available)-1);

    return $available[$selected];
  }
4481
public function addHistoryEntry($employeeId, $requestId, string $date, string $note)
    {
        $xml = "
            <history>
                <date>{$date}</date>
                <eventType>used</eventType>
                <timeOffRequestId>{$requestId}</timeOffRequestId>
                <note>{$note}</note>
            </history>
        ";

        $this->put("employees/{$employeeId}/time_off/history", $xml);
    }
459336
public function Create($cardPreAuthorization, $idempotencyKey = null)
    {
        return $this->CreateObject('preauthorization_create', $cardPreAuthorization, '\MangoPay\CardPreAuthorization', null, null, $idempotencyKey);
    }
772996
public function deleteCard($card_id)
    {
        $url = "https://api.weixin.qq.com/card/delete?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, ['card_id' => $card_id]);
    }
193079
public function deleteCard($card_id)
    {
        if (empty($card_id)) {
            return false;
        }

        $result = $this->httpPost(static::WECHAT_DELETE_CARD_URL . 'access_token=' . $this->getAccessToken(), [
            'card_id' => $card_id
        ]);

        return isset($result['errmsg']) && $result['errmsg'] === 'ok' ? true : false;
    }
1207520
public function cardDelete($card_id)
    {
        if (empty($card_id)) {
            $this->setError('缺少错误');

            return false;
        }

        $queryStr            = [];
        $queryStr['card_id'] = $card_id;

        $this->apitype = 'card';
        $this->module  = 'delete';
        $res           = $this->_post('', $queryStr);

        return $res;
    }
964951
public function getCard($cardID)
    {
        $tokenContext = new TokenContext("", 'get');
        $token = $this->accessTokenProvider->getToken($tokenContext);

        $responseModel = $this->cardClient->getCard($cardID, (string)$token);
        if ($responseModel instanceof ErrorResponseModel) {
            throw new CardClientException(
                "error response from card service", $responseModel->getCode(), $responseModel->getMessage()
            );
        }

        $card = $this->parseRawCard($responseModel->getRawSignedModel(), $responseModel->isOutdated());

        if (!$this->cardVerifier->verifyCard($card)) {
            throw new CardVerificationException('Validation errors have been detected');
        }

        return $card;
    }
1300488
public function getCard($userId, $cardId)
    {
        $card = $this->client->get($this->getResourceEndpoint($userId) . '/' . (int)$cardId);

        return $card['Response'][0];
    }
106518
public function getCard($cardID, $token)
    {
        $httpResponse = $this->httpClient->send(
            new GetHttpRequest(
                sprintf("%s/card/v5/%s", $this->serviceUrl, $cardID),
                null,
                ["Authorization" => sprintf("Virgil %s", $token)]
            )
        );

        if (!$httpResponse->getHttpStatusCode()
                          ->isSuccess()) {
            return $this->parseErrorResponse($httpResponse->getBody());
        }

        $rawSignedModel = RawSignedModel::RawSignedModelFromJson($httpResponse->getBody());

        return new ResponseModel($httpResponse->getHeaders(), $rawSignedModel);
    }
995522
public function customWxcard($card_id = '', $card_ext = [], $openid, $kf_account = '')
    {
        $queryStr                       = [];
        $queryStr['touser']             = $openid;
        $queryStr['msgtype']            = 'wxcard';
        $queryStr['wxcard']['card_id']  = $card_id;
        $queryStr['wxcard']['card_ext'] = $card_ext;

        $queryStr['customservice']['kf_account'] = $kf_account;

        $this->module = 'message';

        $res = $this->_post('custom/send', $queryStr);

        return $res;
    }