I'm retrieving a contact by email through the constant contact API.
Trying to update the contact, I am following the code in addOrUpdateContact.php.
The email address portion of the contact is returning to me like this:
Ctct\Components\Contacts\Contact {#982
+id: "1603343335"
+status: "ACTIVE"
+first_name: "First"
+last_name: "Last"
+confirmed: false
+source: "Site Owner"
+email_addresses: array:1 [
0 => Ctct\Components\Contacts\EmailAddress {#1045
+id: "76f23fe0-134b-11e4-8c7b-d4ae52712b64"
+status: "ACTIVE"
+confirm_status: "NO_CONFIRMATION_REQUIRED"
+opt_in_source: "ACTION_BY_SYSTEM"
+opt_in_date: "2014-07-24T15:59:18.000Z"
+opt_out_date: null
+email_address: "email@email.com"
}
]
Notice that +opt_in_source is 'ACTION_BY_SYSTEM'.
However, if I take that same contact and add it to a list, I get this error:
+"error_message": "#/email_addresses/0/opt_in_source: Instance value does not match any enum value. Valid options are: ACTION_BY_VISITOR, ACTION_BY_OWNER."
so the +opt_in_source given is invalid.
This is the quick hack that fixes it at about line 74 of addOrUpdateContact.php:
foreach ( $contact->email_addresses as $em ) {
$em->opt_in_source = 'ACTION_BY_OWNER';
}