@@ -638,66 +638,6 @@ contract ServiceProviderRegistry is
638638 }
639639 }
640640
641- /// @notice Get multiple providers with product information by their IDs
642- /// @param providerIds Array of provider IDs to retrieve
643- /// @param productType The type of product to include in the response
644- /// @return providersWithProducts Array of provider and product information corresponding to the input IDs
645- /// @return validIds Array of booleans indicating whether each ID is valid (exists, is active, and has the product)
646- /// @dev Returns empty ProviderWithProduct structs for invalid IDs, with corresponding validIds[i] = false
647- function getProvidersWithProductByIds (uint256 [] calldata providerIds , ProductType productType )
648- external
649- view
650- returns (ProviderWithProduct[] memory providersWithProducts , bool [] memory validIds )
651- {
652- uint256 length = providerIds.length ;
653- providersWithProducts = new ProviderWithProduct [](length);
654- validIds = new bool [](length);
655-
656- uint256 _numProviders = numProviders;
657-
658- for (uint256 i = 0 ; i < length; i++ ) {
659- uint256 providerId = providerIds[i];
660-
661- if (providerId > 0 && providerId <= _numProviders) {
662- ServiceProviderInfo storage provider = providers[providerId];
663- ServiceProduct storage product = providerProducts[providerId][productType];
664-
665- if (provider.serviceProvider != address (0 ) && provider.isActive && product.isActive) {
666- providersWithProducts[i] = ProviderWithProduct ({
667- providerId: providerId,
668- providerInfo: provider,
669- product: product,
670- productCapabilityValues: getProductCapabilities (providerId, productType, product.capabilityKeys)
671- });
672- validIds[i] = true ;
673- } else {
674- providersWithProducts[i] = _getEmptyProviderWithProduct ();
675- validIds[i] = false ;
676- }
677- } else {
678- providersWithProducts[i] = _getEmptyProviderWithProduct ();
679- validIds[i] = false ;
680- }
681- }
682- }
683-
684- /// @notice Internal helper to create an empty ProviderWithProduct
685- /// @return Empty ProviderWithProduct struct
686- function _getEmptyProviderWithProduct () internal pure returns (ProviderWithProduct memory ) {
687- return ProviderWithProduct ({
688- providerId: 0 ,
689- providerInfo: ServiceProviderInfo ({
690- serviceProvider: address (0 ),
691- payee: address (0 ),
692- name: "" ,
693- description: "" ,
694- isActive: false
695- }),
696- product: ServiceProduct ({productType: ProductType.PDP, capabilityKeys: new string [](0 ), isActive: false }),
697- productCapabilityValues: new bytes [](0 )
698- });
699- }
700-
701641 /// @notice Internal helper to create an empty ServiceProviderInfoView
702642 /// @return Empty ServiceProviderInfoView struct
703643 function _getEmptyProviderInfoView () internal pure returns (ServiceProviderInfoView memory ) {
0 commit comments