Prepares a POST Request data

@param array $parameters
@return array
423462
protected function preparePost(array $parameters)
    {
        // Transform any array value to JSON
        extract($this->parseValues($parameters));
        /** @var string $signable */

        // Add the signed string
        $parameters['s'] = $this->makeSignature($signable);

        return $parameters;
    }
313072
private function generateURL($parameters)
    {
        $ch = curl_init();

        $parameters = http_build_query($parameters);

        curl_setopt($ch, CURLOPT_URL, $this->url);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters);

        $result = curl_exec($ch);

        curl_close($ch);
        
        return $result;
    }
802040
public function buildUrlWithParameters(array $parameters = [])
    {
        $url = $this->url;

        if (!$this->hasParameters() && !$parameters) {
            return $url;
        }

        foreach ($parameters as $key => $value) {
            $url = str_replace('{' . $key . '}', $value, $url);
        }
        return $url;
    }
1150575
private function buildParametersString($parameters)
    {
        $parts = [];

        ksort($parameters);
        foreach ($parameters as $key => $val) {
            $parts[] = sprintf('%s=%s', $key, $val);
        }

        return implode('; ', $parts);
    }
509639
private function getSearchResults($parameters)
    {
        $searchRequest  = $this->requestBuilder->getSearchRequest($parameters);
        $searchResponse = $this->searchEngine->search($searchRequest);

        return $searchResponse;
    }
735540
public function prepare(string $method, array $parameters)
    {
        // Delete any empty key
        $parameters = $this->deleteEmptyKeys($parameters);

        // Add the API Key
        $parameters['apiKey'] = $this->flow->getCredentials()->apiKey;

        // Sort the parameters
        ksort($parameters);

        // Return the final data
        switch ($method) {
            case 'get':
                return $this->prepareGet($parameters);
            case 'post':
                return $this->preparePost($parameters);
            default:
                return null;
        }
    }
775637
protected function flattenParameters(array $parameters)
	{
		$flattened = array();

		foreach($parameters as $parameter) {
			array_walk($parameter, function($value, $key) use (&$flattened) {
				$flattened[$key] = $value;
			});
		}

		return $flattened;
	}
1078570
public function createOrder($parameters = [])
    {
        $response = $this->client->post('transactions/orders', [
            'json' => $parameters,
        ]);
        return json_decode($response->getBody())->order;
    }
746910
protected function prepareParameters(array $parameters = [])
    {
        foreach ($parameters as &$parameterValue) {
            if (is_bool($parameterValue)) {
                $parameterValue = (int) $parameterValue;
            } elseif ($parameterValue instanceof \DateTimeInterface) {
                $parameterValue = $parameterValue->format('Y-m-d H:i:s');
            } elseif (!is_scalar($parameterValue) && $parameterValue !== null) {
                throw new \InvalidArgumentException(
                    sprintf('Invalid db parameter type "%s"', gettype($parameterValue))
                );
            }
        }
        unset($parameterValue);

        return $parameters;
    }
853393
protected static function prepareRequest($url, $parameters = [], $headers = [])
    {
        $request = curl_init();

        if ($query = http_build_query($parameters)) {
            $url .= '?'.$query;
        }

        curl_setopt($request, CURLOPT_URL, $url);
        curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($request, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($request, CURLINFO_HEADER_OUT, true);
        curl_setopt($request, CURLOPT_SSL_VERIFYPEER, true);

        return $request;
    }
970249
protected function getParameters(array $parameters)
    {
        return empty($parameters) ? $this->parameters : array_merge($this->parameters, $parameters);
    }
658504
protected function prepareParams(array $params)
    {
        foreach ($params as $key => $param) {
            if (gettype($param) === 'boolean') {
                $params[$key] = (string)(($param) ? 'true' : 'false');
            }
        }
        return $params;
    }
84859
protected function prepareMultipartData($params)
    {
        $multipart = [];

        if ($params instanceof Arrayable) {
            $params = $params->toArray();
        }

        foreach ($params as $key => $value) {

            if ( ! is_array($value)) {

                $multipart[] = [
                    'name'     => $key,
                    'contents' => $value,
                ];

                continue;
            }

            foreach (array_dot($value) as $dotKey => $leafValue) {

                $partKey = $key
                    . implode(
                        array_map(
                            function($partKey) { return "[{$partKey}]"; },
                            explode('.', $dotKey)
                        )
                    );

                $multipart[] = [
                    'name'     => $partKey,
                    'contents' => $leafValue,
                ];
            }
        }
        
        return $multipart;
    }
536227
private function parametersToData(array $parameters)
    {
        $data = array();

        foreach ($parameters as $parameter) {
            $data[$parameter->getName()] = $this->parameterToData($parameter);
        }

        return (object) $data;
    }
576748
public function getParameters(array $parameters = []): array
    {
        foreach (array_merge($parameters, $this->getParameterArray()) as $parameter) {
            if (isset($this->$parameter)) {
                $parameters[$parameter] = $this->$parameter;
            }
        }
        foreach ($this->extraParameters as $parameter => $function) {
            $parameters[$parameter] = $this->$function();
        }
        return $this->filterArray($parameters);
    }
33206
public function post($parameters = null)
    {
        $this->setOption(CURLOPT_POST, true);
        if ($parameters !== null) {
            $this->setParameters($parameters);
        }

        return $this->execute();
    }
2395
private function prepareRequestParams(array $data)
    {
        $has_resource = false;
        $multipart = [];

        foreach ($data as $key => $value) {
            if (!is_array($value)) {
                $multipart[] = ['name' => $key, 'contents' => $value];
                continue;
            }

            foreach ($value as $multiKey => $multiValue) {
                is_resource($multiValue) && $has_resource = true;
                $multiName = $key . '[' . $multiKey . ']' . (is_array($multiValue) ? '[' . key($multiValue) . ']' : '') . '';
                $multipart[] = ['name' => $multiName, 'contents' => (is_array($multiValue) ? reset($multiValue) : $multiValue)];
            }
        }

        if ($has_resource) {
            return ['multipart' => $multipart];
        }

        return ['form_params' => $data];
    }