Add customer to request.

@param string[] $params
@param string[] $options

@return array
432875
protected function addCustomer(array $params, array $options)
    {
        $params['payer']['email'] = Arr::get($options, 'email', '');

        $params['additional_info']['payer'] = [
            'first_name' => Arr::get($options, 'first_name', ''),
            'last_name'  => Arr::get($options, 'last_name', ''),
        ];

        if ($billingAddress = Arr::get($options, 'billing_address', [])) {
            $params['additional_info']['payer']['address'] = [
                'zip_code'    => Arr::get($billingAddress, 'zip', ''),
                'street_name' => trim(sprintf('%s %s', Arr::get($billingAddress, 'address1', ''), Arr::get($billingAddress, 'address2', ''))),
            ];
        }

        if ($shipping = Arr::get($options, 'shipping_address', [])) {
            $params['additional_info']['shipments']['receiver_address'] = [
                'zip_code'    => Arr::get($shipping, 'zip', ''),
                'street_name' => trim(sprintf('%s %s', Arr::get($shipping, 'address1', ''), Arr::get($shipping, 'address2', ''))),
            ];
        }

        return $params;
    }
550632
public function addOptions(array $options)
    {
        foreach ($options as $name => $defaultValue) {
            $this->addOption($name, $defaultValue);
        }

        return $this;
    }
1081628
public function add($options)
	{
		$xml = '';

		if (isset($options['resource'], $options['postXml']) || isset($options['url'], $options['postXml']))
		{
			$url = (isset($options['resource']) ? $this->url.'/api/'.$options['resource'] : $options['url']);
			$xml = $options['postXml'];
			if (isset($options['id_shop']))
				$url .= '&id_shop='.$options['id_shop'];
			if (isset($options['id_group_shop']))
				$url .= '&id_group_shop='.$options['id_group_shop'];
		}
		else
			throw new PrestaShopWebServiceException('Bad parameters given');
		$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $xml));

		self::checkStatusCode($request['status_code']);
		return self::parseXML($request['response']);
	}
1297371
private function addCustomerData($trans, $options)
    {
        if ($options->ip) {
            $trans->addChild('IpAddress', $options->ip);
        }
        if ($options->customer) {
            $trans->addChild('CustomerInfo')
                ->addChild('CustomerCode', $options->customer);
        }

        $trans->addChild('MerchantID', $this->options->login);
    }
345638
public function charges($params = null)
    {
        $params = $params ?: [];
        $params['customer'] = $this->id;
        $charges = Charge::all($params, $this->_opts);
        return $charges;
    }
1258219
public function addOptions(array $options)
    {
        foreach ($options as $name => $value) {
            $this->setOption($name, $value);
        }

        return $this;
    }
937092
public function post($params = array(), $options = array())
	{
		// If its an array (instead of a query string) then format it correctly
		if (is_array($params))
		{
            if($this->format == "json"){
                $params = json_encode($params);
            }else{
                if(!empty($_FILES)){
                    foreach($_FILES as $fileField => $fileVal){
                        $params[$fileField] = curl_file_create($fileVal['tmp_name'], $fileVal['type'], $fileVal['name']);
                    }
                }else{
					$params = http_build_query($params, NULL, '&');
				}
            }
		}

		// Add in the specific options provided
		$this->options($options);

		$this->http_method('post');

		$this->option(CURLOPT_POST, TRUE);
		$this->option(CURLOPT_POSTFIELDS, $params);
	}
8680
public function post($url, array $params = null, array $options = array())
	{
		return $this->request($url, 'POST', $params, $options);
	}
76783
protected function addPayment($params, $amount, $payment, $options)
    {
        return array_merge($params, [
            'payment' => [
                'external' => [
                    'transaction'     => Arr::get($options, 'reference'),
                    'application_key' => $this->gateway->getApplicationKey(),
                ],
                'reference' => [
                    'number'      => Arr::get($options, 'reference'),
                    'description' => Arr::get($options, 'description'),
                ],
                'total' => [
                    'amount'   => $this->gateway->amount($amount),
                    'currency' => Arr::get($options, 'currency', $this->gateway->getCurrency()),
                ],
                'origin'    => [
                    'ip'       => Arr::get($options, 'ip', ''),
                    'location' => [
                        'latitude'  => Arr::get($options, 'latitude', '0.00000'),
                        'longitude' => Arr::get($options, 'longitude', '0.00000'),
                    ],
                ],
            ],
            'recurrent' => $payment,
            'total'     => [
                'amount' => $this->gateway->amount($amount),
            ],
        ]);
    }
1019578
public function updateStripeCustomer(array $options = [])
    {
        $customer = StripeCustomer::update(
            $this->stripe_id, $options, $this->getStripeKey()
        );

        return $customer;
    }
1356180
public function addOptions(array $options) : Select
    {
        foreach ($options as $value => $content) {
            $this->addOption($content, $value);
        }

        return $this;
    }
176310
public function addParams(array $params)
    {
        foreach ($params as $k => $v) {
            $this->addParam($k, $v);
        }
        return $this;
    }
583649
private function addCustomerData($options)
    {
        $this->post->addChild('Customer_Ref', $options->customer);
        $this->post->addChild('Client_IP', $options->ip);
        $this->post->addChild('Client_Email', $options->email);
    }
1224772
public function create($token = null, array $options = [])
    {
        $customer = $this->getStripeCustomer($token, $options);

        if ($this->useCard) {
            $this->owner->updateDefaultCard($this->useCard);
        }

        $subscription = $customer->subscriptions->create($this->buildPayload());

        if ($this->skipTrial) {
            $trialEndsAt = null;
        } else {
            $trialEndsAt = $this->trialExpires;
        }

        return $this->owner->subscriptions()->create([
            'name' => $this->name,
            'stripe_id' => $subscription->id,
            'stripe_plan' => $this->plan,
            'quantity' => $this->quantity,
            'trial_ends_at' => $trialEndsAt,
            'ends_at' => null,
        ]);
    }
475531
protected function actionAdd($params=array())
    {
        $response = array(
            'errors' => array(),
            'data' => array(),
        );
        $values = $this->company->prepareParams($params);

        if (empty($values['name'])) {
            $response['errors'][] = 'cmp01';
        }
        if (empty($values['build'])) {
            $response['errors'][] = 'cmp02';
        }
        if (!$this->checkBuildExists($values['build'])) {
            $response['errors'][] = 'cmp03';
        }
        if ($this->checkCompanyExists($values['id'])) {
            $response['errors'][] = 'cmp04';
            $response['data']['id'] = $values['id'];
        }

        if (!empty($response['errors'])) {
            return $response;
        }
        $result = $this->company->add($values);
        if ($result) {
            $response['data']['id'] = $values['id'];
        } else {
            $response['errors'][] = 'err01';
        }
        return $response;
    }
496365
protected function addPaymentMethod(array $params, $payment, array $options)
    {
        $params['payment_methods'] = [];

        if (isset($options['monthly_installments'])) {
            $params['payment_methods']['installments'] = in_array($options['monthly_installments'], [3, 6, 9, 12])
                ? (int) Arr::get($options, 'monthly_installments')
                : 1;
        }

        if (isset($options['enabled_brands'])) {
            $paymentTypes = ['prepaid_card', 'digital_currency', 'credit_card', 'debit_card', 'ticket', 'atm', 'bank_transfer'];
            $enabledTypes = Arr::get($options, 'enabled_brands', []);

            $excludedTypes = array_map(function ($type) {
                return ['id' => $type];
            }, array_values(array_filter($paymentTypes, function ($type) use ($enabledTypes) {
                return !in_array($type, $enabledTypes);
            })));

            $params['payment_methods']['excluded_payment_types'] = $excludedTypes;
        }

        return $params;
    }
566632
protected function addAddress(array $params, array $options)
    {
        if ($address = Arr::get($options, 'address') ?: Arr::get($options, 'billing_address')) {
            $params['address']['street1'] = Arr::get($address, 'address1');
            if ($address2 = Arr::get($address, 'address2')) {
                $params['address']['street2'] = $address2;
            }
            if ($address3 = Arr::get($address, 'address3')) {
                $params['address']['street3'] = $address3;
            }
            if ($externalNumber = Arr::get($address, 'external_number')) {
                $params['address']['external_number'] = $externalNumber;
            }
            $params['address']['city'] = Arr::get($address, 'city');
            $params['address']['country'] = Arr::get($address, 'country');
            $params['address']['state'] = Arr::get($address, 'state');
            $params['address']['postal_code'] = Arr::get($address, 'zip');

            return $params;
        }
    }