Observer/Sales/SaveStatusSmsAutomation.php
private function doAutomationEnrolment($data)
    {
        //the program is not mapped
        if ($data['programId']) {
            try {
                $typeId = $data['order_id'];
                $automationTypeId = $data['automationType'];
                $exists = $this->emailAutomationFactory->create()
                    ->addFieldToFilter('type_id', $typeId)
                    ->addFieldToFilter('automation_type', $automationTypeId)
                    ->setPageSize(1);

                //automation type, and type should be unique
                if (! $exists->getSize()) {
                    $automation = $this->automationFactory->create()
                        ->setEmail($data['email'])
                        ->setAutomationType($data['automationType'])
                        ->setEnrolmentStatus(\Dotdigitalgroup\Email\Model\Sync\Automation::AUTOMATION_STATUS_PENDING)
                        ->setTypeId($data['order_id'])
                        ->setWebsiteId($data['website_id'])
                        ->setStoreName($data['store_name'])
                        ->setProgramId($data['programId']);
                    $this->automationResource->save($automation);
                }
            } catch (\Exception $e) {
                $this->helper->debug((string)$e, []);
            }
        } else {
            $this->helper->log('automation type : ' . $data['automationType'] . ' program id not found');
        }
    }
private function doAutomationEnrolment($data)
    {
        //the program is not mapped
        if ($data['programId']) {
            try {
                $typeId = $data['order_id'];
                $automationTypeId = $data['automationType'];
                $exists = $this->emailAutomationFactory->create()
                    ->addFieldToFilter('type_id', $typeId)
                    ->addFieldToFilter('automation_type', $automationTypeId)
                    ->setPageSize(1);

                //automation type, and type should be unique
                if (! $exists->getSize()) {
                    $automation = $this->automationFactory->create()
                        ->setEmail($data['email'])
                        ->setAutomationType($data['automationType'])
                        ->setEnrolmentStatus(\Dotdigitalgroup\Email\Model\Sync\Automation::AUTOMATION_STATUS_PENDING)
                        ->setTypeId($data['order_id'])
                        ->setWebsiteId($data['website_id'])
                        ->setStoreName($data['store_name'])
                        ->setProgramId($data['programId']);
                    $this->automationResource->save($automation);
                }
            } catch (\Exception $e) {
                $this->helper->debug((string)$e, []);
            }
        } else {
            $this->helper->log('automation type : ' . $data['automationType'] . ' program id not found');
        }
    }
private function doAutomationEnrolment ( $ data ) { //the program is not mapped if ( $ data [ 'programId' ] ) { try { $ typeId = $ data [ 'order_id' ] ; $ automationTypeId = $ data [ 'automationType' ] ; $ exists = $ this -> emailAutomationFactory -> create ( ) -> addFieldToFilter ( 'type_id' , $ typeId ) -> addFieldToFilter ( 'automation_type' , $ automationTypeId ) -> setPageSize ( 1 ) ; //automation type, and type should be unique if ( ! $ exists -> getSize ( ) ) { $ automation = $ this -> automationFactory -> create ( ) -> setEmail ( $ data [ 'email' ] ) -> setAutomationType ( $ data [ 'automationType' ] ) -> setEnrolmentStatus ( \ Dotdigitalgroup \ Email \ Model \ Sync \ Automation :: AUTOMATION_STATUS_PENDING ) -> setTypeId ( $ data [ 'order_id' ] ) -> setWebsiteId ( $ data [ 'website_id' ] ) -> setStoreName ( $ data [ 'store_name' ] ) -> setProgramId ( $ data [ 'programId' ] ) ; $ this -> automationResource -> save ( $ automation ) ; } } catch ( \ Exception $ e ) { $ this -> helper -> debug ( ( string ) $ e , [ ] ) ; } } else { $ this -> helper -> log ( 'automation type : ' . $ data [ 'automationType' ] . ' program id not found' ) ; } }
Save enrolment to queue for cron automation enrolment.

@param array $data

@return null
Save enrolment to queue for cron automation enrolment .