Skip to content

Commit 3aad126

Browse files
Merge pull request #200 from Playgama/origin/feature/PB-1190-msn-iap-fix
Origin/feature/pb 1190 msn iap fix
2 parents cb17cb5 + 5a3c3da commit 3aad126

2 files changed

Lines changed: 19 additions & 12 deletions

File tree

src/platform-bridges/MicrosoftStorePlatformBridge.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -463,14 +463,15 @@ class MicrosoftStorePlatformBridge extends PlatformBridgeBase {
463463
const mergedProducts = products.map((product) => {
464464
const msProduct = data.data?.find((p) => p.id === product.platformProductId)
465465

466-
const priceValue = deformatPrice(msProduct?.price?.formattedPrice)
466+
const formattedPrice = msProduct?.price?.formattedPrice
467+
const priceValue = formattedPrice ? deformatPrice(formattedPrice) : null
467468
const priceCurrencyCode = msProduct?.price?.currencyCode || null
468-
const price = `${priceValue} ${priceCurrencyCode}`
469+
const price = formattedPrice || null
469470

470471
return {
471472
id: product.id,
472-
title: msProduct?.title,
473-
description: msProduct?.description,
473+
title: msProduct?.title || null,
474+
description: msProduct?.description || null,
474475
price,
475476
priceValue,
476477
priceCurrencyCode,

src/platform-bridges/MsnPlatformBridge.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -472,16 +472,22 @@ class MsnPlatformBridge extends PlatformBridgeBase {
472472
const mergedProducts = products.map((product) => {
473473
const msnProduct = msnProducts.find((p) => p.productId === product.platformProductId)
474474

475+
const listPrice = msnProduct?.price?.listPrice ?? null
476+
const priceCurrencyCode = msnProduct?.price?.currencyCode || null
477+
const price = listPrice !== null && priceCurrencyCode
478+
? `${listPrice} ${priceCurrencyCode} `
479+
: null
480+
475481
return {
476482
id: product.id,
477-
title: msnProduct.title,
478-
description: msnProduct.description,
479-
publisherName: msnProduct.publisherName,
480-
inAppOfferToken: msnProduct.inAppOfferToken,
481-
isConsumable: msnProduct.isConsumable,
482-
price: `${msnProduct.price.listPrice} ${msnProduct.price.currencyCode} `,
483-
priceCurrencyCode: msnProduct.price.currencyCode,
484-
priceValue: msnProduct.price.listPrice,
483+
title: msnProduct?.title || null,
484+
description: msnProduct?.description || null,
485+
publisherName: msnProduct?.publisherName || null,
486+
inAppOfferToken: msnProduct?.inAppOfferToken || null,
487+
isConsumable: msnProduct?.isConsumable ?? null,
488+
price,
489+
priceCurrencyCode,
490+
priceValue: listPrice,
485491
}
486492
})
487493

0 commit comments

Comments
 (0)