Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

3.0.0-alpha - cannot update contact returned from #143

Open
iateadonut opened this issue Mar 10, 2017 · 1 comment
Open

3.0.0-alpha - cannot update contact returned from #143

iateadonut opened this issue Mar 10, 2017 · 1 comment

Comments

@iateadonut
Copy link

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';
            }
@shannon7wallace
Copy link
Contributor

This is a miss on our side, not having the action by system status in our SDK's. The action by system is less than a one in a million occurrence, and indicates that the contact themselves contacted us at Constant Contact directly to be removed from the list. Sorry for the miss, and thank you for finding the workaround.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants