Skip to content

Commit

Permalink
MAINT-32872: Fix productTypeName mapping (#487)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Chiuratto Seabra <[email protected]>
  • Loading branch information
daniel-chiuratto-seabra and Daniel Chiuratto Seabra authored Nov 19, 2024
1 parent e63edf9 commit 80ae9ad
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file.

## [6.5.0](https://github.com/Backbase/stream-services/compare/6.4.0...6.5.0)
### Fixed
- Fixed productTypeName mapping when ingesting Product data into arrangement-manager

## [6.4.0](https://github.com/Backbase/stream-services/compare/6.3.0...6.4.0)
### Fixed
- Fixed setting internal id for creatorLE before creating SA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,14 @@ private Flux<ProductKind> getProductKindFlux() {
*/
public Mono<ProductCatalog> setupProductCatalog(ProductCatalog productCatalog) {
return getProductCatalog().flatMap(existingProductCatalog -> {

List<ProductKind> newProductKinds = new ArrayList<>();
if (productCatalog.getProductKinds() != null) {
newProductKinds = productCatalog.getProductKinds().stream()
.filter(newProductKind -> existingProductCatalog.getProductKinds().stream()
.noneMatch(productKind ->
productKind.getExternalKindId().equals(newProductKind.getExternalKindId())))
.collect(Collectors.toList());
}
List<ProductType> newProductTypes = new ArrayList<>();
if (productCatalog.getProductTypes() != null) {
newProductTypes = productCatalog.getProductTypes().stream()
.filter(newProductType -> existingProductCatalog.getProductTypes().stream()
.noneMatch(productType ->
productType.getExternalProductId().equals(newProductType.getExternalProductId())))
.collect(Collectors.toList());
productType.getExternalProductId().equals(newProductType.getExternalProductId()))).toList();
}

// Ensure products kinds are created first
List<ProductType> finalNewProductTypes = newProductTypes;
return getProductKindFlux().collectList().flatMap(productKinds -> createProductTypes(finalNewProductTypes, productKinds).collectList().flatMap(productTypes -> {
productCatalog.setProductTypes(productTypes);
Expand Down Expand Up @@ -170,7 +159,7 @@ public Mono<ProductType> createProductType(ProductType productType, List<Product

arrangementProductItemBase.setExternalProductKindId(productKind.getExternalKindId());
arrangementProductItemBase.setProductKindName(productKind.getKindName());
arrangementProductItemBase.setTypeName(productType.getTypeName());
arrangementProductItemBase.setProductTypeName(productType.getTypeName());
arrangementProductItemBase.setExternalTypeId(productType.getExternalTypeId());

return arrangementProductItemBase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"method": "POST",
"bodyPatterns": [
{
"equalToJson": "{\"externalId\":null,\"externalTypeId\":null,\"typeName\":\"Savings Accounts\",\"externalProductId\":\"savings-account\",\"externalProductKindId\":\"kind2\",\"productKindName\":\"Savings Account\",\"externalProductTypeId\":null,\"productTypeName\":\"savings-account\",\"productKind\":null,\"translations\":[],\"additions\":{}}",
"equalToJson": "{\"externalId\":null,\"externalTypeId\":null,\"typeName\":\"Savings Accounts\",\"externalProductId\":\"savings-account\",\"externalProductKindId\":\"kind2\",\"productKindName\":\"Savings Account\",\"externalProductTypeId\":null,\"productTypeName\":\"Savings Accounts\",\"productKind\":null,\"translations\":[],\"additions\":{}}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
Expand Down Expand Up @@ -43,7 +43,7 @@
"method": "POST",
"bodyPatterns": [
{
"equalToJson": "{\"externalId\":null,\"externalTypeId\":null,\"typeName\":\"Current Account\",\"externalProductId\":\"current-account\",\"externalProductKindId\":\"kind1\",\"productKindName\":\"Current Account\",\"externalProductTypeId\":null,\"productTypeName\":\"current-account\",\"productKind\":null,\"translations\":[],\"additions\":{}}",
"equalToJson": "{\"externalId\":null,\"externalTypeId\":null,\"typeName\":\"Current Account\",\"externalProductId\":\"current-account\",\"externalProductKindId\":\"kind1\",\"productKindName\":\"Current Account\",\"externalProductTypeId\":null,\"productTypeName\":\"Current Account\",\"productKind\":null,\"translations\":[],\"additions\":{}}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
Expand Down

0 comments on commit 80ae9ad

Please sign in to comment.