Skip to content

Commit f2aea54

Browse files
committed
fix: add logs for Google Play price merge
1 parent ab96b14 commit f2aea54

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

client/android/billing/src/main/kotlin/BillingProvider.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ private fun displayPricePerMonth(priceAmountMicros: Long, currencyCode: String,
5454
NumberFormat.getCurrencyInstance().apply { currency = Currency.getInstance(currencyCode) }
5555
.format(amountPerMonth)
5656
} catch (e: IllegalArgumentException) {
57+
Log.w(TAG, "Unknown currency code from Play Billing: $currencyCode")
5758
null
5859
}
5960
}
@@ -157,6 +158,8 @@ class BillingProvider(context: Context) : AutoCloseable {
157158
}
158159
}
159160
}
161+
val regularPhase = offerDetails.pricingPhases.pricingPhaseList.lastOrNull()
162+
Log.v(TAG, "Offer ${offerDetails.basePlanId}: regular price = ${regularPhase?.formattedPrice}")
160163
}
161164
}
162165
return resultJson

client/core/controllers/api/servicesCatalogController.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ namespace
123123
quotesByProductId.insert(productId, quote);
124124
}
125125

126+
qInfo().noquote() << "[IAP] Built StoreKit quote map, quotes:" << quotesByProductId.size();
126127
return quotesByProductId;
127128
}
128129
#elif defined(Q_OS_ANDROID)
@@ -148,6 +149,7 @@ namespace
148149
<< plansResult.value("responseCode").toInt(-1);
149150
return quotesByProductId;
150151
}
152+
qInfo() << "[Billing] Fetched subscription plans for price display";
151153

152154
const QJsonArray products = plansResult.value("products").toArray();
153155
for (const QJsonValue &productValue : products) {
@@ -177,6 +179,7 @@ namespace
177179
quotesByProductId.insert(basePlanId, quote);
178180
}
179181
}
182+
qInfo() << "[Billing] Built Google Play quote map, quotes:" << quotesByProductId.size();
180183
return quotesByProductId;
181184
}
182185
#endif
@@ -188,6 +191,7 @@ namespace
188191
return;
189192
}
190193

194+
int mergedPlanCount = 0;
191195
for (int serviceIndex = 0; serviceIndex < services.size(); ++serviceIndex) {
192196
QJsonObject serviceObject = services.at(serviceIndex).toObject();
193197
if (serviceObject.value(apiDefs::key::serviceType).toString() != serviceType::amneziaPremium) {
@@ -220,6 +224,7 @@ namespace
220224
const bool isTrialPlan = planObject.value(configKey::isTrial).toBool();
221225
const SubscriptionPlanQuote &quote = *quoteIterator;
222226
planObject.insert(configKey::priceLabel, quote.displayPrice);
227+
++mergedPlanCount;
223228

224229
const double months = quote.subscriptionBillingMonths;
225230
if (!isTrialPlan && months > oneMonthThreshold && !quote.displayPricePerMonth.isEmpty()) {
@@ -252,6 +257,7 @@ namespace
252257
serviceObject.insert(configKey::serviceDescription, descriptionObject);
253258
services.replace(serviceIndex, serviceObject);
254259
}
260+
qInfo().noquote() << "[IAP] Merged store quotes into" << mergedPlanCount << "premium plan(s)";
255261
data.insert(apiDefs::key::services, services);
256262
}
257263

0 commit comments

Comments
 (0)