-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged PR 56874: Do not sync Email, EmailType or OptInType as data fi…
…elds ## What's being changed This PR fixes handling of some data points previously treated as data fields in the context of CSV sync. All contact exports now do not export Email or EmailType. Subscriber exports now set OptInType per subscriber depending on Customers > Newsletter > Subscription Options > Need to Confirm at _store level_ (this is a change - we used to check this at website level but the config is store-scoped). ## Why it's being changed Email, EmailType and OptInType are not data fields - in V3, EmailType and OptInType are channel properties, and in fact even in V2, these data points are sent separately from data fields in API requests. It's only because of how we used to send these via CSV that they were handled the way they were. ## How to review / test this change - Run customer sync, guest sync and subscriber sync - All exported JSON should have `,"channelProperties":{"email":{"emailType":"html"}}` for each contact - Subscriber exports should _not_ contain `optInType` yet - Turn on Customers > Newsletter > Subscription Options > Need to Confirm in a store scope - Re-sync subscribers - Subscribers in the affected store scope should be synced with `"channelProperties":{"email":{"emailType":"html","optInType":"double"}}` - Email, EmailType and OptInType should not be seen in data fields at all Related work items: #264085, #265397, #265398
- Loading branch information
Showing
18 changed files
with
230 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Dotdigitalgroup\Email\Model\Newsletter; | ||
|
||
use Magento\Framework\App\Config\ScopeConfigInterface; | ||
use Magento\Newsletter\Model\Subscriber; | ||
use Magento\Store\Model\ScopeInterface; | ||
|
||
class OptInTypeFinder | ||
{ | ||
/** | ||
* @var ScopeConfigInterface | ||
*/ | ||
private $scopeConfig; | ||
|
||
/** | ||
* @param ScopeConfigInterface $scopeConfig | ||
*/ | ||
public function __construct( | ||
ScopeConfigInterface $scopeConfig | ||
) { | ||
$this->scopeConfig = $scopeConfig; | ||
} | ||
|
||
/** | ||
* Get opt in type by store. | ||
* | ||
* @param int $storeId | ||
* | ||
* @return string|null | ||
*/ | ||
public function getOptInType($storeId) | ||
{ | ||
$needToConfirm = $this->scopeConfig->getValue( | ||
Subscriber::XML_PATH_CONFIRMATION_FLAG, | ||
ScopeInterface::SCOPE_STORE, | ||
$storeId | ||
); | ||
|
||
return $needToConfirm ? 'double' : null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.