-
-
Save marrek13/506fd4ed9d881a9ce9aab15db7a6f83f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
class CatalogService(private val catalogClient: CatalogClient) { | |
suspend fun getAll(merchantCode: String): List<CategoryResponse> = catalogClient.getCategories( | |
merchantCode, | |
getSumupHeaders(), | |
) | |
.call() | |
.map { categoryResponse -> CategoryResponseFactory.create(categoryResponse) } | |
} | |
class CategoryResponseFactory { | |
companion object { | |
fun create( | |
categoryResponse: CategoryResponse, | |
) = CategoryResponse( | |
categoryId = categoryResponse.id, | |
name = categoryResponse.name, | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment