Skip to content

Commit

Permalink
Use upper case notation for enums with a string representation for th…
Browse files Browse the repository at this point in the history
…e page type
  • Loading branch information
warmkesselj committed Dec 18, 2024
1 parent be84b9f commit 043d4ac
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,63 @@ package com.braintreepayments.api.shopperinsights
/**
* The page or view that a button is displayed on.
*/
enum class PageType {
enum class PageType(internal val stringValue: String) {
/**
* The homepage
*/
homepage,
HOMEPAGE("homepage"),

/**
* The about page
*/
about,
ABOUT("about"),

/**
* The contact page
*/
contact,
CONTACT("contact"),

/**
* A product category page
*/
product_category,
PRODUCT_CATEGORY("product_category"),

/**
* The product details page
*/
product_details,
PRODUCT_DETAILS("product_details"),

/**
* The search page
*/
search,
SEARCH("search"),

/**
* The checkout page
*/
checkout,
CHECKOUT("checkout"),

/**
* The order review page
*/
order_review,
ORDER_REVIEW("order_review"),

/**
* The order confirmation page
*/
order_confirmation,
ORDER_CONFIRMATION("order_confirmation"),

/**
* The mini cart
*/
mini_cart,
MINI_CAR("mini_cart"),

/**
* Some other page
*/
other
OTHER("other");

internal fun getStringRepresentation(): String {
return stringValue
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class ShopperInsightsClient internal constructor(
shopperSessionId = shopperSessionId,
buttonType = buttonType.getStringRepresentation(),
buttonOrder = presentmentDetails.buttonOrder.getStringRepresentation(),
pageType = presentmentDetails.pageType.toString()
pageType = presentmentDetails.pageType.getStringRepresentation()
)

braintreeClient.sendAnalyticsEvent(BUTTON_PRESENTED, params)
Expand Down

0 comments on commit 043d4ac

Please sign in to comment.