-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(woocommerce-connection): handle explicit UTM meta fields meta (#3371
- Loading branch information
Showing
4 changed files
with
96 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,4 +57,43 @@ public function test_newsletters_master_list_feature() { | |
'Expected to get the same lists back when no master list is set.' | ||
); | ||
} | ||
|
||
/** | ||
* Contact handling. | ||
*/ | ||
public static function test_newsletters_contact_handling() { | ||
$utm_params = [ | ||
'campaign' => 'test_campaign', | ||
'content' => 'test_content', | ||
]; | ||
$contact = [ | ||
'email' => '[email protected]', | ||
'name' => 'John Doe', | ||
'metadata' => [ | ||
'NP_Payment Page' => '/donate/?utm_campaign=' . $utm_params['campaign'] . '&utm_content=' . $utm_params['content'], | ||
'NP_Payment UTM: campaign' => $utm_params['campaign'], | ||
'NP_Membership Status' => 'Donor', | ||
'NP_Product Name' => 'Donate: One-Time', | ||
'NP_Last Payment Amount' => '20.00', | ||
'NP_Last Payment Date' => '2024-08-27', | ||
'NP_Payment UTM: source' => '', | ||
'NP_Payment UTM: medium' => '', | ||
'NP_Payment UTM: term' => '', | ||
'NP_Payment UTM: content' => $utm_params['content'], | ||
'NP_Current Subscription Start Date' => '', | ||
'NP_Current Subscription End Date' => '', | ||
'NP_Billing Cycle' => '', | ||
'NP_Recurring Payment' => '', | ||
'NP_Next Payment Date' => '', | ||
'NP_Total Paid' => '109.00', | ||
'NP_Account' => '492', | ||
'NP_Registration Date' => '2024-08-26', | ||
], | ||
]; | ||
$normalized_contact = Newspack_Newsletters::normalize_contact_data( $contact ); | ||
self::assertEquals( $contact['email'], $normalized_contact['email'] ); | ||
self::assertEquals( $utm_params['campaign'], $normalized_contact['metadata']['NP_Payment UTM: campaign'] ); | ||
self::assertEquals( $utm_params['content'], $normalized_contact['metadata']['NP_Payment UTM: content'] ); | ||
self::assertEquals( '', $normalized_contact['metadata']['NP_Payment UTM: term'] ); | ||
} | ||
} |
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