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

Making integration_data data not mandatory. #1077

Merged
merged 11 commits into from
Oct 23, 2024

Conversation

message-dimke
Copy link
Contributor

@message-dimke message-dimke commented Oct 22, 2024

Changes proposed in this Pull Request:

Integration data appeared not mandatory for the extension to function. However, we were using it to identify if the user connected status. Since the Pinterest Commerce Integration request may fail, we do not want the extension to rely on its presence.

Detailed test instructions:

  1. Add a filter to make the APIV5::create_commerce_integration call fail.
add_filter(
	'pre_http_request',
	function ( $response, $parsed_args, $url ) {
		if (
			'https://api.pinterest.com/v5/integrations/commerce' === $url &&
			'POST' === $parsed_args['method']
		) {
			return array(
				'headers' => array(
					'content-type' => 'application/json',
				),
				'body' => json_encode(
					array(
						'code'    => 911,
						'message' => 'Oops! Something went wrong!',
					)
				),
				'response' => array(
					'code'    => 500,
					'message' => 'Unexpected error',
				),
				'cookies'  => array(),
				'filename' => '',
			);
		}

		return $response;
	},
	10,
	3
);

public static function create_commerce_integration( array $integration_data ): array {
return self::make_request(
'integrations/commerce',
'POST',
$integration_data
);
}

  1. If you are connected to Pinterest - disconnect. Otherwise, connect to your Pinterest account using the extension.
  2. You should not see any changes. Nothing must fail.

Changelog entry

Update - Make integration_data optional for the extension.

…unction.

- Redoing how 'is connected' user is identified.
- Adjusting unit tests to the new 'is connected' behaviour.
@github-actions github-actions bot added the changelog: update Big changes to something that wasn't broken. label Oct 22, 2024
@message-dimke message-dimke self-assigned this Oct 22, 2024
…ep where they belong;

- Introducing Commerce Integration controller class;
- Adjusting unit tests;
- Adding commerce integration retry action registration;
- Adding commerce integration retry actions cleanup on disconnect;
@message-dimke message-dimke marked this pull request as ready for review October 22, 2024 16:55
Copy link
Collaborator

@budzanowski budzanowski left a comment

Choose a reason for hiding this comment

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

Looks good!

message-dimke and others added 4 commits October 23, 2024 09:05
…be changed in the future without paying attention to set a proper time frame for it.
…ration-sync

Synchronising Commerce Integration `partner_metadata` weekly.
…tion-retry

Retrying Commerce Integration Creation on Falure.
@message-dimke message-dimke merged commit 771db05 into develop Oct 23, 2024
4 checks passed
@message-dimke message-dimke deleted the update/revise-integration-data-usage branch October 23, 2024 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: update Big changes to something that wasn't broken.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants