src/Client/PilotApiClient.php
public function storeLead(LeadData $lead_data, $notification_email = '')
    {
        $form_params = [
            'debug' => $this->debug,
            'action' => 'create',
            'appkey' => $this->getAppKey(),
        ];

        $form_params = array_merge($form_params, $lead_data->toArray());

        if (!empty($notification_email)) {
            $form_params['notification_email'] = $notification_email;
        }

        $response = $this->guzzleClient->post(self::BASE_URI, [
            'body' => $form_params
        ]);

        if ($response->getStatusCode() === 200) {
            $content = json_decode($response->getBody()->getContents());
            if ($content->success === false) {
                throw new InvalidArgumentException($content->data);
            }
            return $content;
        }
    }
public function storeLead(LeadData $lead_data, $notification_email = '')
    {
        $form_params = [
            'debug' => $this->debug,
            'action' => 'create',
            'appkey' => $this->getAppKey(),
        ];

        $form_params = array_merge($form_params, $lead_data->toArray());

        if (!empty($notification_email)) {
            $form_params['notification_email'] = $notification_email;
        }

        $response = $this->guzzleClient->post(self::BASE_URI, [
            'body' => $form_params
        ]);

        if ($response->getStatusCode() === 200) {
            $content = json_decode($response->getBody()->getContents());
            if ($content->success === false) {
                throw new InvalidArgumentException($content->data);
            }
            return $content;
        }
    }
public function storeLead ( LeadData $ lead_data , $ notification_email = '' ) { $ form_params = [ 'debug' => $ this -> debug , 'action' => 'create' , 'appkey' => $ this -> getAppKey ( ) , ] ; $ form_params = array_merge ( $ form_params , $ lead_data -> toArray ( ) ) ; if ( ! empty ( $ notification_email ) ) { $ form_params [ 'notification_email' ] = $ notification_email ; } $ response = $ this -> guzzleClient -> post ( self :: BASE_URI , [ 'body' => $ form_params ] ) ; if ( $ response -> getStatusCode ( ) === 200 ) { $ content = json_decode ( $ response -> getBody ( ) -> getContents ( ) ) ; if ( $ content -> success === false ) { throw new InvalidArgumentException ( $ content -> data ) ; } return $ content ; } }
Stores a lead

@param LeadData $lead_data
@param string $notification_email

@throws InvalidArgumentException

@return mixed
Stores a lead