@@ -56,8 +56,8 @@ public function __construct() {
5656 public function get_feed_issues ( WP_REST_Request $ request ) {
5757
5858 try {
59-
60- if ( ! Pinterest \ProductSync::is_product_sync_enabled () || ! Pinterest \ProductSync:: is_feed_registered () ) {
59+ $ feed_id = Pinterest \ProductSync:: get_registered_feed_id ();
60+ if ( ! Pinterest \ProductSync::is_product_sync_enabled () || ! $ feed_id ) {
6161 return array ( 'lines ' => array () );
6262 }
6363
@@ -67,7 +67,7 @@ public function get_feed_issues( WP_REST_Request $request ) {
6767 $ per_page = $ request ->has_param ( 'per_page ' ) ? (int ) $ request ->get_param ( 'per_page ' ) : 25 ;
6868
6969 if ( false === $ issues_file_url ) {
70- $ workflow = self ::get_last_feed_workflow ( );
70+ $ workflow = self ::get_feed_workflow ( $ feed_id );
7171
7272 if ( $ workflow && isset ( $ workflow ->s3_validation_url ) ) {
7373 $ issues_file_url = $ workflow ->s3_validation_url ;
@@ -271,14 +271,15 @@ private function save_feed_data_cache() {
271271 * Get the latest Workflow of the
272272 * active feed related to the last attempt to process and ingest our feed, for the Merchant saved in the settings.
273273 *
274+ * @param string $feed_id The ID of the feed.
275+ *
274276 * @return object
275277 *
276278 * @throws \Exception PHP Exception.
277279 */
278- private static function get_last_feed_workflow () {
279-
280+ private static function get_feed_workflow ( $ feed_id ) {
280281 $ merchant_id = Pinterest_For_Woocommerce ()::get_data ( 'merchant_id ' );
281- $ feed_report = $ merchant_id ? Base::get_feed_report ( $ merchant_id ) : false ;
282+ $ feed_report = $ merchant_id ? Base::get_merchant_feed ( $ merchant_id, $ feed_id ) : false ;
282283
283284 if ( ! $ feed_report || 'success ' !== $ feed_report ['status ' ] ) {
284285 throw new \Exception ( esc_html__ ( 'Could not get feed report from Pinterest. ' , 'pinterest-for-woocommerce ' ), 400 );
0 commit comments