Skip to main content

Magento 2 connector B2B Technical Solution

Base Module Design

Picture 1 - B2B Connector always sync customers

b2b-always-sync-customer.png


Picture 2 - B2B Connector company sync to NetSuite

b2b-company-sync-to-netsuite.png



The extension structure

Picture 3,4 - Structure of the extension

b2b-structure-1.png

b2b-structure-2.png

Mappers

\RocketWeb\NetSuiteB2B\Model\Mapper\Company - provides a solution to get NetSuite data format for the export of companies.

\RocketWeb\NetSuiteB2B\Model\Mapper\CustomerAddress - provides a solution to get Magento data format for importing companies' addresses.

\RocketWeb\NetSuiteB2B\Model\Mapper\Customer - provides a solution to get Magento data format for importing customers.

\RocketWeb\NetSuiteB2B\Model\Mapper\CustomerAddress - provides a solution to get Magento data format for importing customers' addresses.

Processors

Import processors

\RocketWeb\NetSuiteB2B\Model\Process\Import\SearchRequest\Customer - provides NetSuite request for customers import.

\RocketWeb\NetSuiteB2B\Model\Process\Import\Customer - process the customer import from NetSuite to Magento.

\RocketWeb\NetSuiteB2B\Model\Process\Import\SearchRequest\Company - provides NetSuite request for companies import.

\RocketWeb\NetSuiteB2B\Model\Process\Import\Company - process the company import from NetSuite to Magento.

\RocketWeb\NetSuiteB2B\Model\Process\Import\CustomerCompany - process the assigning customers to a Magento company.

Export processors

\RocketWeb\NetSuiteB2B\Model\Process\Export\CompanySave class is responsible for exporting customers' companies from Magento to NetSuite.

CLI Commands

The Magento B2B Connector provides the CLI command "netsuite:utils:importcustomer" to import customers from NetSuite to Magento.

The Magento B2B Connector provides the CLI command "netsuite:utils:importcompany" to import companies from NetSuite to Magento.

Export Customer's Company

\RocketWeb\NetSuiteB2B\Observer\CompanySaveObserver is responsible for checking that NetSuite connector is enabled, permissions allow a company's export and is not set the registry flag "netsuite_skip_company_export". If a company can be exported prepares and save the message to the queue for the closest export process.

Export Customers

\RocketWeb\NetSuiteB2B\Observer\NetsuiteCustomerSendBeforeObserver observer extends customers export feature. The feature checks that B2B is enabled and if this is enabled assigns to the currently exported customer its company in NetSuite by NetSuite internalId.

Plugins

\RocketWeb\NetSuiteB2B\Plugin\CustomerSaveObserverPlugin - provides permanent customer synchronization.

\RocketWeb\NetSuiteB2B\Plugin\QueueMessagePlugin - extends import/export actions.