Flexmail webform handler not matching flexmail API schema

Created on 17 October 2022, over 2 years ago
Updated 31 May 2023, almost 2 years ago

Problem/Motivation

When adding flexmail handler errors are thrown upon submission. It appears FlexmailWebformHandler.php does not correctly reference properties coming from flexmail API.

Steps to reproduce

  1. Setup flexmail handler select "Update contact" and submit the webform. Error is thrown "There was a problem updating ... in Flexmail".
  2. Select "do no update existing contact" in webform handler settings, submit form. Error is thrown "Can not create or retrieve user with email"

Proposed resolution

For the first issue (Updating contact):

The API return data but with a 'total' property set to 0 if no results are found.
Here we can add a check on the 'total' property to allow pass through:
if (empty($contacts) || $contacts['total'] === 0) {

For the second issue (Default submission):
It appears the code is not correctly referencing the response returned from flexmail API.

Currently:
$contactArray = \reset($contacts);

Suggested:
$contactArray = $contacts['_embedded']['item'][0];

Flexmail API documentation:
https://api.flexmail.eu/documentation/?_ga=2.103788096.1348026172.166601...

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

🇧🇪Belgium j1mb0b

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024