Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore X value in contact boolean fields #10716

Merged
merged 10 commits into from Jan 24, 2022

Conversation

patrykgruszka
Copy link
Member

@patrykgruszka patrykgruszka commented Dec 31, 2021

Q A
Bug fix? (use the a.b branch) Y
New feature/enhancement? (use the a.x branch) N
Deprecations? N
BC breaks? (use the c.x branch) N
Automated tests included? N
Related user documentation PR URL mautic/mautic-documentation#...
Related developer documentation PR URL mautic/developer-documentation#...
Issue(s) addressed Fixes #10711 #10669

Description:

This PR reverts changes from #9931 that caused issues with contact boolean fields. YesNoButtonGroupType actually uses the Symfony ChoiceType and not the CheckboxType as assumed in #9931, so the 1 0 options should be correct.

After applying this PR the boolean fields in the contact edit page should have 3 options again:
obraz
Before applying this PR:
obraz

I have checked the failing test Mautic\Tests\Api\MessagesTest::testBatchEndpoints from Mautic API repo, and it works fine after applying this PR. I couldn't replicate this issue from #9931.
obraz

Steps to test this PR:

  1. Open this PR on Gitpod or pull down for testing locally (see docs on testing PRs here)
  2. Add boolean custom field if you don't have any
  3. The boolean field in contact edit page should have 3 options X Yes No. Test changing the state.
  4. The boolean field in the campaign update contact action should have 3 options X Yes No. Test changing the state.

#9931 Regression tests
4. Browse the UI and toggle the Yes/No buttons in various forms and on the contact edit page. Changing the state, saving, and editing should repopulate the correct state.
5. API functional tests should pass (the 5 tests that failed always fail on my local)
6. Test the Configuration can be saved and manipulated
7. Create a batch of messages via the API
POST /api/messages/batch/new
(change channelId to be the ID of an Email and SMS that exists in your Mautic)

[{
		"name": "API message",
		"description": "Marketing message created via API unit test",
		"channels": {
			"email": {
				"channel": "email",
				"channelId": 27,
				"isEnabled": false
			},
			"sms": {
				"channel": "sms",
				"channelId": 17,
				"isEnabled": true
			}
		}
	}, {
		"name": "API message",
		"description": "Marketing message created via API unit test",
		"channels": {
			"email": {
				"channel": "email",
				"channelId": 27,
				"isEnabled": false
			},
			"sms": {
				"channel": "sms",
				"channelId": 17,
				"isEnabled": true
			}
		}
	}, {
		"name": "API message",
		"description": "Marketing message created via API unit test",
		"channels": {
			"email": {
				"channel": "email",
				"channelId": 27,
				"isEnabled": false
			},
			"sms": {
				"channel": "sms",
				"channelId": 17,
				"isEnabled": true
			}
		}
	}
]

Then try to PATCH by switching the isEnabled of each channel and adding the message ID:
PATCH /api/messages/batch/edit

[
    {
        "id": 97,
        "name": "API message",
        "description": "Marketing message created via API unit test",
        "channels": {
            "email": {
                "channel": "email",
                "channelId": 27,
                "isEnabled": true
            },
            "sms": {
                "channel": "sms",
                "channelId": 17,
                "isEnabled": false
            }
        }
    },
    {
        "id": 98,
        "name": "API message",
        "description": "Marketing message created via API unit test",
        "channels": {
            "email": {
                "channel": "email",
                "channelId": 27,
                "isEnabled": true
            },
            "sms": {
                "channel": "sms",
                 "channelId": 17,
                "isEnabled": false
            }
        }
    },
    {
        "id": 99,
        "name": "API message",
        "description": "Marketing message created via API unit test",
        "channels": {
            "email": {
                "channel": "email",
                "channelId": 27,
                "isEnabled": true
            },
            "sms": {
                "channel": "sms",
                "channelId": 17,
                "isEnabled": false
            }
        }
    }
]

Then try PUT as well
PUT /api/messages/batch/edit

[
    {
        "id": 97,
        "isPublished": true,
        "name": "API message",
        "description": "Marketing message created via API unit test",
        "channels": {
            "email": {
                "channel": "email",
                "channelId": 27,
                "isEnabled": true
            },
            "sms": {
                "channel": "sms",
                "channelId": 17,
                "isEnabled": false
            }
        }
    },
    {
        "id": 98,
        "name": "API message",
        "description": "Marketing message created via API unit test",
        "channels": {
            "email": {
                "channel": "email",
                "channelId": 27,
                "isEnabled": true
            },
            "sms": {
                "channel": "sms",
                 "channelId": 17,
                "isEnabled": false
            }
        }
    },
    {
        "id": 99,
        "name": "API message",
        "description": "Marketing message created via API unit test",
        "channels": {
            "email": {
                "channel": "email",
                "channelId": 27,
                "isEnabled": true
            },
            "sms": {
                "channel": "sms",
                "channelId": 17,
                "isEnabled": false
            }
        }
    }
]

Finally, try using 0/1 instead of true/false.

@cla-bot cla-bot bot added the cla-signed The PR contributors have signed the contributors agreement label Dec 31, 2021
@jensolsson
Copy link

Tried it a bit, seem to work perfect in the web GUI, but over the REST API I cannot set it to X. I have tried setting a null-var but it does not work.
Maybe it has always been like this and was not an issue, but now when all these have been defaulted to No, I need a way to set them to null / X.

So for exampe this works to set Yes:
curl -X "POST" "http:///api/contacts/new"
-H 'Content-Type: application/json; charset=utf-8'
-u 'jens.olsson:Cryst4l!@#'
-d $'{
"testbool": true,
"overwriteWithBlank": false,
"email": "",
}'

This works to set No
curl -X "POST" "http:///api/contacts/new"
-H 'Content-Type: application/json; charset=utf-8'
-u 'jens.olsson:Cryst4l!@#'
-d $'{
"testbool": false,
"overwriteWithBlank": false,
"email": "",
}'

But this does not work to set X:
curl -X "POST" "http:///api/contacts/new"
-H 'Content-Type: application/json; charset=utf-8'
-u 'jens.olsson:Cryst4l!@#'
-d $'{
"testbool": null,
"overwriteWithBlank": false,
"email": "",
}'

Would be great if we can have this fixed as well

@patrykgruszka
Copy link
Member Author

@jensolsson Thank you for feedback. Setting overwriteWithBlank to true and passing field value as null should do the trick.

@jensolsson
Copy link

@jensolsson Thank you for feedback. Setting overwriteWithBlank to true and passing field value as null should do the trick.

Problem is that in that case all values I do not explicity set are reset to null. For example if I completely leave out for example "title" then it would set it to null on the contact even though the contact already have a title as CEO for example.

So this imposes a great problem when having multiple data sources.

@patrykgruszka
Copy link
Member Author

This case actually works fine for me.
POST /api/contacts/new

{
    "email": "test3@example.com",
    "title": "ceo",
    "newsletter_consent": true,
    "overwriteWithBlank": false
}

Contact created, id: 489

Edit contact with PATCH method:
PATCH /api/contacts/489/edit

{
    "email": "test3@example.com",
    "newsletter_consent": null,
    "overwriteWithBlank": true
}

After update the contact title is persisted.

@jensolsson
Copy link

We always create new contacts with Post to /api/contacts/new and it has always worked. It just changes the fields we send and it updates the existing contact if it existe.

The overhead of first searching for the contact and using its id would be alot i think even though it would be possible. But maybe it worked the same in <4.0.0. I have never had a need to reset a yesno switch via the api before.

@jensolsson
Copy link

Here is another one referencing this complicated sequence https://forum.mautic.org/t/mautic-api-editing-contact-by-email/16997

@patrykgruszka
Copy link
Member Author

Updating contacts using the create method doesn't really seem correct to me, it works because of contact merging functionality. In my opinion, the changes you suggest should be the subject of another PR. Let's focus here on fixing the boolean fields, which I think is more critical.

@jensolsson
Copy link

Totally agree with you this is off topic.

@codecov
Copy link

codecov bot commented Jan 3, 2022

Codecov Report

Merging #10716 (7102e4e) into 4.1 (7de3cbc) will increase coverage by 0.26%.
The diff coverage is 84.61%.

Impacted file tree graph

@@             Coverage Diff              @@
##                4.1   #10716      +/-   ##
============================================
+ Coverage     44.76%   45.03%   +0.26%     
- Complexity    34814    34815       +1     
============================================
  Files          2080     2080              
  Lines        116716   116737      +21     
============================================
+ Hits          52246    52568     +322     
+ Misses        64470    64169     -301     
Impacted Files Coverage Δ
...nnelBundle/Controller/Api/MessageApiController.php 93.33% <80.00%> (+93.33%) ⬆️
...dles/CoreBundle/Form/Type/YesNoButtonGroupType.php 100.00% <100.00%> (ø)
app/bundles/CoreBundle/Entity/CommonEntity.php 94.82% <0.00%> (+8.62%) ⬆️
...bundles/ChannelBundle/Entity/MessageRepository.php 13.95% <0.00%> (+13.95%) ⬆️
app/bundles/ChannelBundle/Event/ChannelEvent.php 88.88% <0.00%> (+38.88%) ⬆️
app/bundles/ChannelBundle/Model/MessageModel.php 58.49% <0.00%> (+41.50%) ⬆️
.../ChannelBundle/EventListener/MessageSubscriber.php 62.50% <0.00%> (+41.66%) ⬆️
app/bundles/ChannelBundle/Entity/Channel.php 83.33% <0.00%> (+53.33%) ⬆️
app/bundles/ChannelBundle/Entity/Message.php 85.33% <0.00%> (+62.66%) ⬆️
... and 4 more

@escopecz
Copy link
Sponsor Member

escopecz commented Jan 4, 2022

This is interesting. We must ensure that the API Library test that was failing before and why the changes were originally made are passing with this change. I wanted to run GitHub Actions on this PR but it failed on outdated Composer package. I prepared a fix for that but it needs reviewers.

mautic/api-library#264

is blocking this PR until merged.

@escopecz
Copy link
Sponsor Member

escopecz commented Jan 5, 2022

So the API Library tests are passing on main but when I run them on your PR it fails:
https://github.com/mautic/api-library/runs/4712825499?check_suite_focus=true

There were 2 failures:

1) Mautic\Tests\Api\CampaignsTest::testCampaignContactEditEvent
The response has unexpected status code (500).

Response: {"errors":[{"message":"Call to a member function getTimestamp() on null","code":500,"type":null}],"trace":[{"namespace":"","short_class":"","class":"","type":"","function":"","file":"\/var\/www\/html\/mautic\/app\/bundles\/CampaignBundle\/Model\/SummaryModel.php","line":45,"args":[]},{"namespace":"Mautic\\CampaignBundle\\Model","short_class":"SummaryModel","class":"Mautic\\CampaignBundle\\Model\\SummaryModel","type":"-\u003E","function":"updateSummary","file":"\/var\/www\/html\/mautic\/app\/bundles\/CampaignBundle\/Executioner\/Logger\/EventLogger.php","line":105,"args":[]},{"namespace":"Mautic\\CampaignBundle\\Executioner\\Logger","short_class":"EventLogger","class":"Mautic\\CampaignBundle\\Executioner\\Logger\\EventLogger","type":"-\u003E","function":"persistLog","file":"\/var\/www\/html\/mautic\/app\/bundles\/CampaignBundle\/Executioner\/Scheduler\/EventScheduler.php","line":131,"args":[]},{"namespace":"Mautic\\CampaignBundle\\Executioner\\Scheduler","short_class":"EventScheduler","...

Failed asserting that false is true.

/home/runner/work/api-library/api-library/tests/Api/MauticApiTestCase.php:89
/home/runner/work/api-library/api-library/tests/Api/CampaignsTest.php:436

2) Mautic\Tests\Api\MessagesTest::testBatchEndpoints
The response has unexpected status code (500).

Response: {"errors":[{"message":"An exception occurred while executing \u0027UPDATE message_channels SET channel_id = ?, is_enabled = ? WHERE id = ?\u0027 with params [\u00225\u0022, null, 14]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1048 Column \u0027is_enabled\u0027 cannot be null","code":500,"type":null}],"trace":[{"namespace":"","short_class":"","class":"","type":"","function":"","file":"\/var\/www\/html\/mautic\/vendor\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/AbstractMySQLDriver.php","line":125,"args":[]},{"namespace":"Doctrine\\DBAL\\Driver","short_class":"AbstractMySQLDriver","class":"Doctrine\\DBAL\\Driver\\AbstractMySQLDriver","type":"-\u003E","function":"convertException","file":"\/var\/www\/html\/mautic\/vendor\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/DBALException.php","line":182,"args":[]},{"namespace":"Doctrine\\DBAL","short_class":"DBALException","class":"Doctrine\\DBAL\\DBALException","type":"::","function":"wrapException","file":"\/var\/www\/html\/mautic\/vendor\/d...

Failed asserting that false is true.

/home/runner/work/api-library/api-library/tests/Api/MauticApiTestCase.php:89
/home/runner/work/api-library/api-library/tests/Api/MauticApiTestCase.php:104
/home/runner/work/api-library/api-library/tests/Api/MessagesTest.php:74
/home/runner/work/api-library/api-library/tests/Api/MauticApiTestCase.php:284
/home/runner/work/api-library/api-library/tests/Api/MessagesTest.php:126

So that needs to be addressed before we can merge this PR.

@escopecz escopecz added bug Issues or PR's relating to bugs pending-feedback PR's and issues that are awaiting feedback from the author regression A bug that broke something in the last release labels Jan 5, 2022
@escopecz escopecz self-assigned this Jan 6, 2022
@escopecz escopecz linked an issue Jan 6, 2022 that may be closed by this pull request
1 task
  Line   app/bundles/ChannelBundle/Controller/Api/MessageApiController.php
 ------ -------------------------------------------------------------------
  32     Property
         Mautic\ChannelBundle\Controller\Api\MessageApiController::$model
         (Mautic\ChannelBundle\Model\MessageModel) does not accept
         Mautic\CoreBundle\Model\AbstractCommonModel.
"file":"\/var\/www\/html\/mautic\/app\/bundles\/ChannelBundle\/Controller\/Api\/MessageApiController.php","line":54

I cannot figure out why the condition for PATCH was there in the first place. It's causing only troubles.
escopecz
escopecz previously approved these changes Jan 7, 2022
Copy link
Sponsor Member

@escopecz escopecz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed the API error in the original PR that this one reverts. The API Library error on SummaryModel is not related to this PR and is fixed in #10708

I can confirm the regression bug and this PR fixes that. The problem is in Symfony forms themselves. They take false as null for reasons I don't comprehend. So we have to go back to 0 and 1 in order to support the empty|null option for boolean custom fields.

@escopecz
Copy link
Sponsor Member

escopecz commented Jan 7, 2022

I approved it prematurely. The tests fail on normal patch endpoint:

Mautic\Tests\Api\MessagesTest::testEditPatch
Failed asserting that two arrays are identical.
--- Expected
+++ Actual
@@ @@
 Array &0 (
     'channel' => 'email'
     'channelId' => 23
-    'isEnabled' => true
+    'isEnabled' => false
 )

/home/runner/work/api-library/api-library/tests/Api/MessagesTest.php:83
/home/runner/work/api-library/api-library/tests/Api/MauticApiTestCase.php:312
/home/runner/work/api-library/api-library/tests/Api/MessagesTest.php:112

I'm editing marketing message with PATCH /api/messages/2/edit with payload

{
  "id": 2,
  "name": "API message 2",
  "description": "Marketing message created via API unit test",
  "channels": {
    "email": {
      "channel": "email",
      "channelId": 12,
      "isEnabled": true
    },
    "sms": {
      "channel": "sms",
      "channelId": 13,
      "isEnabled": 0
    }
  }
}

similar to the one in the test:

https://github.com/mautic/api-library/blob/main/tests/Api/MessagesTest.php#L26-L42

But it just works...

I cannot understand why it's failing. I cannot reproduce it. It should be asserting true but it's asserting false for some reason. I'll have to sleep on it. (or anyone else see the problem?)

@patrykgruszka
Copy link
Member Author

@escopecz the failing test payload is {"name": "Modified by PATCH"}. I think this condition for PATCH in prepareParametersFromRequest was necessary. When you use this method only to change name the channels param is set to []:

if (!isset($params['channels'])) {
    $params['channels'] = [];
}

And then this conditional is is setting isEnabled to 0:

if (!isset($params['channels'][$channelType])) {
    $params['channels'][$channelType] = ['isEnabled' => 0];
}

@escopecz
Copy link
Sponsor Member

@patrykgruszka that's what I was missing. Thanks for guidance!

I prepared the fix with several tests in c2b3c85

I somehow lost ability to push to your fork directly. Could you please do this:

  1. git fetch upstream (assuming the mautic/mautic repo is called upstream, adjust if needed)
  2. git checkout mtc-fix-contact-bool-fields
  3. git pull
  4. git cherry-pick c2b3c8573d57b0a9bc7dee8bfa6da0a26f589ae7
  5. git push

@patrykgruszka
Copy link
Member Author

Sure, done. There is a problem with one test.

Copy link
Sponsor Member

@escopecz escopecz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must have different error level setting on my local that it did not show up the problem. Thanks! I managed to push to your branch again. Everything is green including the API Library tests (as mentioned above, the last failing test is not related and fixed in another PR)

@patrykgruszka thanks for this!

@escopecz escopecz added pending-test-confirmation PR's that require one test before they can be merged and removed pending-feedback PR's and issues that are awaiting feedback from the author labels Jan 12, 2022
@escopecz escopecz added this to the 4.1.2 milestone Jan 12, 2022
Copy link
Sponsor Member

@RCheesley RCheesley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @patrykgruszka and for fixing this issue!

Tested in the UI and the API as instructed (thanks for the very clear instructions with the JSON!) and all cases are acting as expected:

Before the PR:
Edit Custom Field - Boolean field _ Mautic (3)

After the PR:
Edit Custom Field - Boolean field _ Mautic (2)

Via the API:

Marketing Messages _ Mautic

Marketing Messages _ Mautic (1)

Marketing Messages _ Mautic (2)

LGTM! 🚀

@RCheesley RCheesley added ready-to-commit PR's with 2 successful tests, 1 approval, automated tests and docs and is ready to be merged and removed pending-test-confirmation PR's that require one test before they can be merged labels Jan 24, 2022
@RCheesley RCheesley merged commit 9e271e5 into mautic:4.1 Jan 24, 2022
@RCheesley
Copy link
Sponsor Member

@all-contributors please add @jensolsson for userTesting

@allcontributors
Copy link
Contributor

@RCheesley

I've put up a pull request to add @jensolsson! 🎉

RCheesley added a commit that referenced this pull request Jan 27, 2022
* Update language string (#10684)

The button that i updated is for saving changes made in the "Edit code" window and should thus say "Save", not "Edit".

* Fixes 500 error in forms when render style is deactivated against 4.1 (#10697)

* Fixes issue #10453

* Adding functional test covering the bug

#10453

Co-authored-by: Rolando <rpayanm@gmail.com>

* Fixing issues when using PHPSTAN with more processes (#10696)

* Bumping to version 4.1.1

* Remove reference to mautibox (#10681)

* Fix lock wait deleting unused ips (#10710)

* Deleted unused IPs in batches and some improvements.

* Added return type declaration to command methods and some improvements.

* Removed dump()

* Created separate methods for get and delete unused ips.

* Consumed repo methods in model.

* Updated command to use model methods.

* Added test case.

* Fix static analysis

* Fix contact batch api for single id value (#10700)

Co-authored-by: John Linhart <admin@escope.cz>

* fix(LeadTimelineEvent): keys do not match the func args, strips keys (#10663)

Fix error when using PHP 8:
{"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): array_merge() does not accept unknown named parameters}

Not sure if this is the most elegant way to address the issue but this bug has broken the site functionality.

* User update role api (#10668)

* Allow user to update role via API

* Update user's role using API: test cases

* Update user's role using API: added more test cases

* Fix test cases and add more test case

* Added AbstractMauticTestCase::loginUser() method that allows login user in non-restricted areas

* Fix failing tests

Co-authored-by: fedys <miroslav.fedeles@gmail.com>
Co-authored-by: John Linhart <admin@escope.cz>

* Fix send unpublished SMS (#10577)

* Fix send unpublished SMS

* Fix send unpublished SMS for broadcast command

* Add CampaignSendSubscriberTest

* Add testSendSmsNotPublished test

* Minor change to tests

* Fixing types

* Automatic cs fix

Co-authored-by: John Linhart <admin@escope.cz>

* Fix group by If you use count columns for assets download (#10693)

* Fix group by If you use count columns

* Add unit tests

* Fix unit tests

* Remove define from tests

* Fix unit tests

* Fix unit tests

* Fix unit tests

Co-authored-by: John Linhart <admin@escope.cz>

* Update grapesjs-custom.css (#10728)

Removing the background color f0f0f0 from gjs-field-radio class to improve the color constrast between radio's background and radio's options and returning the class parameters to the default of the original editor.

Co-authored-by: Ruth Cheesley <ruth.cheesley@acquia.com>

* Update stale.yml (#10746)

Apply Stalebot only to issues and not PRs

Co-authored-by: John Linhart <admin@escope.cz>

* Fixed variable name (#10753)

Co-authored-by: Ruth Cheesley <ruth.cheesley@acquia.com>
Co-authored-by: Joey Keller <jos0405@gmail.com>

* Change field definition for column_value to longtext instead of varchar (#10778)

* Change field definition for column_value to longtext instead of varchar 255

* Update app/migrations/Version20200729170800.php

Co-authored-by: John Linhart <admin@escope.cz>

* I suggested bad namespace path during code review. Fixing it here

Co-authored-by: Don Gilbert <don@dongilbert.net>

* Correct bug no forms in the select contact source campaign when the forms have identical names (#10717)

* Correct name form Campaign Contact Source

* Refactoring and add test

* Finishing up the test

* Fixing the bug discovered by the test

* CS fix

Co-authored-by: John Linhart <admin@escope.cz>
Co-authored-by: Ruth Cheesley <ruth.cheesley@acquia.com>

* Restore X value in contact boolean fields (#10716)

* Fix empty value in contact boolean fields

* Fix configuration page save

* Fix controller functional tests

* Always retype the isEnabled param to int. Even for PATCH

* Fixing phpstan issue

  Line   app/bundles/ChannelBundle/Controller/Api/MessageApiController.php
 ------ -------------------------------------------------------------------
  32     Property
         Mautic\ChannelBundle\Controller\Api\MessageApiController::$model
         (Mautic\ChannelBundle\Model\MessageModel) does not accept
         Mautic\CoreBundle\Model\AbstractCommonModel.

* Fixing PHP Notice - Undefined index: email

"file":"\/var\/www\/html\/mautic\/app\/bundles\/ChannelBundle\/Controller\/Api\/MessageApiController.php","line":54

I cannot figure out why the condition for PATCH was there in the first place. It's causing only troubles.

* Adding functional API tests covering the problematic endpoint and method, fixing the controller

* Fix csfixer issue

* Adding missing description to payloads for assertion

Co-authored-by: John Linhart <admin@escope.cz>
Co-authored-by: Ruth Cheesley <ruth.cheesley@acquia.com>

* Add missing information (#10656)

* Add missing information

* Missing commas 😊

* Fix for pushing to integrations in campaign actions (#10674)

* Fix for #10517

Some integrations such as Hubspot have an `'encode_parameters' => 'json'` setting, which triggers the parameters being sent in `POST` / `PUT` / `PATCH` requests to be `json_encode`-d: https://github.com/mautic/mautic/blob/5975231722cfde8bdad783b373c70ad20333db37/app/bundles/PluginBundle/Integration/AbstractIntegration.php#L760

That causes a problem when the result is passed to Guzzle's `request` method under key `\GuzzleHttp\RequestOptions::FORM_PARAMS`, because the payload is expected to be an array: https://github.com/mautic/mautic/blob/5975231722cfde8bdad783b373c70ad20333db37/app/bundles/PluginBundle/Integration/AbstractIntegration.php#L829 as per the documentation: https://docs.guzzlephp.org/en/stable/request-options.html#form-params

The above RP addresses this by passing the payload under `\GuzzleHttp\RequestOptions::BODY` instead, **if** the payload is a string, rather than an array.

Tested and working with HubSpot.

* Adding test to the payload key fix

* Creating Client in another method so it could be mocked

Plus some code style improvements

* CS Fixer

* STAN fixes

* Removing whitespace

Co-authored-by: John Linhart <admin@escope.cz>
Co-authored-by: Ruth Cheesley <ruth.cheesley@acquia.com>

* Bump to 4.1.2

Co-authored-by: Kathrin Schmid <96054002+kathrin-schmid@users.noreply.github.com>
Co-authored-by: John Linhart <admin@escope.cz>
Co-authored-by: Rolando <rpayanm@gmail.com>
Co-authored-by: Tejas Navghane <ts.navghane@gmail.com>
Co-authored-by: Rahul Dhande <68939488+rahuld-dev@users.noreply.github.com>
Co-authored-by: Anthony Bailey <65302481+abailey-dev@users.noreply.github.com>
Co-authored-by: fedys <miroslav.fedeles@gmail.com>
Co-authored-by: Zdeno Kuzmany <zdeno@kuzmany.biz>
Co-authored-by: Eloi Marques da Silva <eloimarquessilva@gmail.com>
Co-authored-by: mollux <mattias.michaux@gmail.com>
Co-authored-by: Joey Keller <jos0405@gmail.com>
Co-authored-by: Don Gilbert <don@dongilbert.net>
Co-authored-by: Tomasz Kowalczyk <39382654+tomekkowalczyk@users.noreply.github.com>
Co-authored-by: Patryk Gruszka <patryk.gruszka@comarch.pl>
Co-authored-by: Tony Bogdanov <tonybogdanov@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues or PR's relating to bugs cla-signed The PR contributors have signed the contributors agreement ready-to-commit PR's with 2 successful tests, 1 approval, automated tests and docs and is ready to be merged regression A bug that broke something in the last release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bool can no longer be X only Yes and No
4 participants