woocommerce/pinterest-for-woocommerce

v3/4 APP: When merchant has already connected to a platform, the error message is not shown in UI

adarshakb opened this issue · 1 comments

Describe the bug:

When feed registration fails due to merchant already connected to a platform, it should show the error in UI

Steps to reproduce:

  1. Connect a user twice to 2 different sites
  2. Second connection would fail

Expected behavior:

User to be told the reason for feed registration failure

Actual behavior:

No error message shown

Additional details:

pinterest-for-woocommerce-product-sync-2024-03-18.log

Screenshot 2024-03-18 at 2 46 30 PM
Screenshot 2024-03-18 at 2 46 03 PM

I also see this issue when I was doing testing in #978.

There are also more details in the pinterest-for-woocommerce log file. See example below - the API response message says "Merchant has already connected to a platform. Only one connection connection supported for an account.":

2024-04-01T08:59:57+00:00 Debug POST Request: https://api.pinterest.com/v3/catalogs/partner/connect/

{"merchant_domains":"https:\/\/ganpfw1b.mystagingwebsite.com","feed_location":"https:\/\/ganpfw1b.mystagingwebsite.com\/wp-content\/uploads\/pinterest-for-woocommerce-4GxtQ7.xml","feed_format":"XML","country":"US","locale":"en-US","currency":"USD","merchant_name":"Auto-created by Pinterest for WooCommerce"}
2024-04-01T08:59:57+00:00 Debug Response: 

HTTP/1.1 409 Conflict
Content-Type: application/json
Content-Length: 560
pinterest-version: 711b94e
x-content-type-options: nosniff
x-frame-options: DENY
x-userendpoint-ratelimit-limit: 500000
x-userendpoint-ratelimit-remaining: 320228
x-envoy-upstream-service-time: 58
x-pinterest-direct: true
pinterest-generated-by: coreapp-ngapi-prod-0a01cd6d
Cache-Control: no-cache, no-store, must-revalidate
x-pinterest-rid: 6154829809477619
Date: Mon, 01 Apr 2024 08:59:57 GMT
Alt-Svc: h3=":443"; ma=600
Connection: close
Set-Cookie: _ir=0; Max-Age=1800; HttpOnly; Path=/; Secure
AKAMAI-GRN: 0.eec83017.1711961997.1972cb05
X-CDN: akamai

{"status":"failure","code":4163,"message":"Merchant has already connected to a platform. Only one connection connection supported for an account.","endpoint_name":"v3_create_commerce_partner_merchant","message_detail":"You are trying to connect a new domain ganpfw1b.mystagingwebsite.com. Please disconnect from the previous domain ganpfw1.mystagingwebsite.com and retry.","data":null,"error":{"message":"You are trying to connect a new domain ganpfw1b.mystagingwebsite.com. Please disconnect from the previous domain ganpfw1.mystagingwebsite.com and retry."}}
2024-04-01T08:59:57+00:00 Error Merchant has already connected to a platform. Only one connection connection supported for an account.
#0 /srv/htdocs/wp-content/plugins/pinterest-for-woocommerce/src/API/Base.php(114): Automattic\WooCommerce\Pinterest\API\Base::handle_request(Array)
#1 /srv/htdocs/wp-content/plugins/pinterest-for-woocommerce/src/API/Base.php(618): Automattic\WooCommerce\Pinterest\API\Base::make_request('catalogs/partne...', 'POST', Array)
#2 /srv/htdocs/wp-content/plugins/pinterest-for-woocommerce/src/Merchants.php(164): Automattic\WooCommerce\Pinterest\API\Base::update_or_create_merchant(Array)
#3 /srv/htdocs/wp-content/plugins/pinterest-for-woocommerce/src/FeedRegistration.php(149): Automattic\WooCommerce\Pinterest\Merchants::update_or_create_merchant()
#4 /srv/htdocs/wp-content/plugins/pinterest-for-woocommerce/src/FeedRegistration.php(92): Automattic\WooCommerce\Pinterest\FeedRegistration::register_feed()
#5 /wordpress/core/6.4.3/wp-includes/class-wp-hook.php(324): Automattic\WooCommerce\Pinterest\FeedRegistration->handle_feed_registration()
#6 /wordpress/core/6.4.3/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#7 /wordpress/core/6.4.3/wp-includes/plugin.php(565): WP_Hook->do_action(Array)
#8 /srv/htdocs/wp-content/plugins/woocommerce/packages/action-scheduler/classes/actions/ActionScheduler_Action.php(56): do_action_ref_array('pinterest-for-w...', Array)
#9 /srv/htdocs/wp-content/plugins/woocommerce/packages/action-scheduler/classes/abstracts/ActionScheduler_Abstract_QueueRunner.php(88): ActionScheduler_Action->execute()
#10 /srv/htdocs/wp-content/plugins/woocommerce/packages/action-scheduler/classes/ActionScheduler_QueueRunner.php(169): ActionScheduler_Abstract_QueueRunner->process_action(62, 'WP Cron')
#11 /srv/htdocs/wp-content/plugins/woocommerce/packages/action-scheduler/classes/ActionScheduler_QueueRunner.php(139): ActionScheduler_QueueRunner->do_batch(25, 'WP Cron')
#12 /wordpress/core/6.4.3/wp-includes/class-wp-hook.php(324): ActionScheduler_QueueRunner->run('WP Cron')
#13 /wordpress/core/6.4.3/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#14 /wordpress/core/6.4.3/wp-includes/plugin.php(565): WP_Hook->do_action(Array)
#15 /wordpress/core/6.4.3/wp-cron.php(191): do_action_ref_array('action_schedule...', Array)
#16 {main}