Skip to content

Commit

Permalink
[PriceTracking] Add a flag for whether to parse seen offer to server
Browse files Browse the repository at this point in the history
This CL adds a flag parameter to control whether to parse the user seen
offer data to the server side.

(cherry picked from commit 9914fa8)

Bug: 1303212
Change-Id: I36c388d6c5976569fc018035e57f6a3ac69f84c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3583362
Reviewed-by: Ayman Almadhoun <ayman@chromium.org>
Commit-Queue: Zhiyuan Cai <zhiyuancai@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#993051}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3591272
Auto-Submit: Zhiyuan Cai <zhiyuancai@chromium.org>
Reviewed-by: Krishna Govind <govind@chromium.org>
Commit-Queue: Krishna Govind <govind@chromium.org>
Owners-Override: Krishna Govind <govind@chromium.org>
Cr-Commit-Position: refs/branch-heads/4951@{#857}
Cr-Branched-From: 27de622-refs/heads/main@{#982481}
  • Loading branch information
Zhiyuan Cai authored and Chromium LUCI CQ committed Apr 18, 2022
1 parent fa93761 commit 8d28a53
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Expand Up @@ -57,7 +57,8 @@ public static JSONObject serialize(CommerceSubscription subscription) {
subscriptionJson.put(SUBSCRIPTION_IDENTIFIER_KEY, subscription.getTrackingId());

PriceTrackableOffer seenOffer = subscription.getSeenOffer();
if (seenOffer != null) {
if (CommerceSubscriptionsServiceConfig.shouldParseSeenOfferToServer()
&& seenOffer != null) {
JSONObject seenOfferJson = new JSONObject();
seenOfferJson.put(SEEN_OFFER_ID_KEY, seenOffer.offerId);
seenOfferJson.put(SEEN_OFFER_PRICE_KEY, seenOffer.currentPrice);
Expand Down
Expand Up @@ -28,6 +28,9 @@ public class CommerceSubscriptionsServiceConfig {
public static final String IMPLICIT_SUBSCRIPTIONS_ENABLED_PARAM =
"implicit_subscriptions_enabled";

private static final String PARSE_SEEN_OFFER_TO_SERVER_PARAM =
"price_tracking_parse_seen_offer_to_server";

private static final int DEFAULT_STALE_TAB_LOWER_BOUND_DAYS = 1;

public static String getDefaultServiceUrl() {
Expand Down Expand Up @@ -58,4 +61,13 @@ public static boolean isImplicitSubscriptionsEnabled() {
}
return false;
}

public static boolean shouldParseSeenOfferToServer() {
if (FeatureList.isInitialized()) {
return ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
ChromeFeatureList.COMMERCE_PRICE_TRACKING, PARSE_SEEN_OFFER_TO_SERVER_PARAM,
true);
}
return true;
}
}

0 comments on commit 8d28a53

Please sign in to comment.