protected function getCustomer()
    {
        if (!isset($this->params['user'])) {
            throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_API_NO_USER);
        }

        if (!isset($this->params['pass'])) {
            throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_API_NO_PASS);
        }

        $customer = $this->plugin->getCustomer($this->params['user'], $this->params['pass']);
        if (!is_object($customer) || !($customer instanceof ShopgateCustomer)) {
            throw new ShopgateLibraryException(
                ShopgateLibraryException::PLUGIN_API_WRONG_RESPONSE_FORMAT,
                'Plugin Response: ' . var_export($customer, true)
            );
        }

        foreach ($customer->getCustomerGroups() as $customerGroup) {
            /** @var ShopgateCustomerGroup $customerGroup */
            if (!is_object($customerGroup) || !($customerGroup instanceof ShopgateCustomerGroup)) {
                throw new ShopgateLibraryException(
                    ShopgateLibraryException::PLUGIN_API_WRONG_RESPONSE_FORMAT,
                    '$customerGroup is of type: ' . is_object($customerGroup)
                        ? get_class($customerGroup)
                        : gettype($customerGroup)
                );
            }
        }

        $customerData = $customer->toArray();
        $addressList  = $customerData['addresses'];
        unset($customerData['addresses']);

        if (empty($this->response)) {
            $this->response = new ShopgatePluginApiResponseAppJson($this->trace_id);
        }
        $this->responseData["user_data"] = $customerData;
        $this->responseData["addresses"] = $addressList;
    }