Model/Apiconnector/Client.php
public function postContactsTransactionalData(
        $data,
        $collectionName = 'Orders'
    ) {
        $order = $this->getContactsTransactionalDataByKey(
            $collectionName,
            $data['id']
        );
        if (!isset($order->key) || isset($order->message)
            && $order->message == self::API_ERROR_TRANS_NOT_EXISTS
        ) {
            $url = $this->getApiEndpoint() . self::REST_TRANSACTIONAL_DATA
                . $collectionName;
        } else {
            $url = $this->getApiEndpoint() . self::REST_TRANSACTIONAL_DATA
                . $collectionName . '/' . $order->key;
        }
        $apiData = [
            'Key' => $data['id'],
            'ContactIdentifier' => $data['email'],
            'Json' => json_encode($data),
        ];

        $this->setUrl($url)
            ->setVerb('POST')
            ->buildPostBody($apiData);
        $response = $this->execute();

        if (isset($response->message)) {
            $message = 'POST CONTACTS TRANSACTIONAL DATA  '
                . $response->message;
            $this->helper->debug('postContactsTransactionalData', [$message]);
            $this->helper->debug('postContactsTransactionalData', $apiData);
        }

        return $response;
    }
public function postContactsTransactionalData(
        $data,
        $collectionName = 'Orders'
    ) {
        $order = $this->getContactsTransactionalDataByKey(
            $collectionName,
            $data['id']
        );
        if (!isset($order->key) || isset($order->message)
            && $order->message == self::API_ERROR_TRANS_NOT_EXISTS
        ) {
            $url = $this->getApiEndpoint() . self::REST_TRANSACTIONAL_DATA
                . $collectionName;
        } else {
            $url = $this->getApiEndpoint() . self::REST_TRANSACTIONAL_DATA
                . $collectionName . '/' . $order->key;
        }
        $apiData = [
            'Key' => $data['id'],
            'ContactIdentifier' => $data['email'],
            'Json' => json_encode($data),
        ];

        $this->setUrl($url)
            ->setVerb('POST')
            ->buildPostBody($apiData);
        $response = $this->execute();

        if (isset($response->message)) {
            $message = 'POST CONTACTS TRANSACTIONAL DATA  '
                . $response->message;
            $this->helper->debug('postContactsTransactionalData', [$message]);
            $this->helper->debug('postContactsTransactionalData', $apiData);
        }

        return $response;
    }
public function postContactsTransactionalData ( $ data , $ collectionName = 'Orders' ) { $ order = $ this -> getContactsTransactionalDataByKey ( $ collectionName , $ data [ 'id' ] ) ; if ( ! isset ( $ order -> key ) || isset ( $ order -> message ) && $ order -> message == self :: API_ERROR_TRANS_NOT_EXISTS ) { $ url = $ this -> getApiEndpoint ( ) . self :: REST_TRANSACTIONAL_DATA . $ collectionName ; } else { $ url = $ this -> getApiEndpoint ( ) . self :: REST_TRANSACTIONAL_DATA . $ collectionName . '/' . $ order -> key ; } $ apiData = [ 'Key' => $ data [ 'id' ] , 'ContactIdentifier' => $ data [ 'email' ] , 'Json' => json_encode ( $ data ) , ] ; $ this -> setUrl ( $ url ) -> setVerb ( 'POST' ) -> buildPostBody ( $ apiData ) ; $ response = $ this -> execute ( ) ; if ( isset ( $ response -> message ) ) { $ message = 'POST CONTACTS TRANSACTIONAL DATA  ' . $ response -> message ; $ this -> helper -> debug ( 'postContactsTransactionalData' , [ $ message ] ) ; $ this -> helper -> debug ( 'postContactsTransactionalData' , $ apiData ) ; } return $ response ; }
Adds a single piece of transactional data to a contact.

@param array $data
@param string $collectionName

@return null
@throws \Exception
Adds a single piece of transactional data to a contact .