-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shopper insights rp2 feature presentment details (#1244)
* Add new classes and enums * Update new objects, introduce new method * Use a data class instead * Use the built in functionality to convert the treatment to a string * Update content, update analyticsEventParam to take in a buttonType * Use refactored sendPresentedEvent fun * Remove comments * Update sendPresentedEvent signature * Remove unused methods * Update comments button order * Update comments for button type * Update comments * Update signature * Resolve conflicts * Update PresentmentDetails signature * Update analyticsEvent and add button selected string name * Add comment for shopperSessionId * Update AnalyticsClient * Update unit test * Update presentment signature * Add changelog * Remove shopperSessionId from signature * Remove comment * Remove extra line * Fix lint issues * Newline * Update unit test to test venmo and control type button * Lint issues * Update ButtonOrder * Update keys * PR Comments * Analytics update * Add accessors to enum func to get internal string value * Use upper case notation for enums with a string representation for the page type * Updates * Fix unit test
- Loading branch information
1 parent
f93a608
commit 894fc2d
Showing
13 changed files
with
291 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
ShopperInsights/src/main/java/com/braintreepayments/api/shopperinsights/ButtonOrder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.braintreepayments.api.shopperinsights | ||
|
||
/** | ||
* The order or ranking in which payment buttons appear. | ||
*/ | ||
enum class ButtonOrder(internal val stringValue: String) { | ||
|
||
/** | ||
* First place | ||
*/ | ||
FIRST("1"), | ||
|
||
/** | ||
* Second place | ||
*/ | ||
SECOND("2"), | ||
|
||
/** | ||
* Third place | ||
*/ | ||
THIRD("3"), | ||
|
||
/** | ||
* Fourth place | ||
*/ | ||
FOURTH("4"), | ||
|
||
/** | ||
* Fifth place | ||
*/ | ||
FIFTH("5"), | ||
|
||
/** | ||
* Sixth place | ||
*/ | ||
SIXTH("6"), | ||
|
||
/** | ||
* Seventh place | ||
*/ | ||
SEVENTH("7"), | ||
|
||
/** | ||
* Eighth place | ||
*/ | ||
Eighth("8"), | ||
|
||
/** | ||
* Greater than Eighth place | ||
*/ | ||
OTHER("other"); | ||
|
||
internal fun getStringRepresentation(): String { | ||
return stringValue | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
ShopperInsights/src/main/java/com/braintreepayments/api/shopperinsights/ButtonType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.braintreepayments.api.shopperinsights | ||
|
||
/** | ||
* The button type to be displayed or presented. | ||
*/ | ||
enum class ButtonType(internal val stringValue: String) { | ||
/** | ||
* PayPal button | ||
*/ | ||
PAYPAL("PayPal"), | ||
|
||
/** | ||
* Venmo button | ||
*/ | ||
VENMO("Venmo"), | ||
|
||
/** | ||
* Other button | ||
*/ | ||
OTHER("Other"); | ||
|
||
internal fun getStringRepresentation(): String { | ||
return stringValue | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
ShopperInsights/src/main/java/com/braintreepayments/api/shopperinsights/ExperimentType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.braintreepayments.api.shopperinsights | ||
|
||
/** | ||
* An ExperimentType that is either a control or test type. | ||
*/ | ||
enum class ExperimentType(private val rawValue: String) { | ||
CONTROL("control"), | ||
TEST("test"); | ||
|
||
internal fun formattedExperiment(): String { | ||
return """ | ||
[ | ||
{ "exp_name" : "PaymentReady" } | ||
{ "treatment_name" : $rawValue } | ||
] | ||
""" | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
ShopperInsights/src/main/java/com/braintreepayments/api/shopperinsights/PageType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.braintreepayments.api.shopperinsights | ||
|
||
/** | ||
* The page or view that a button is displayed on. | ||
*/ | ||
enum class PageType(internal val stringValue: String) { | ||
/** | ||
* The homepage | ||
*/ | ||
HOMEPAGE("homepage"), | ||
|
||
/** | ||
* The about page | ||
*/ | ||
ABOUT("about"), | ||
|
||
/** | ||
* The contact page | ||
*/ | ||
CONTACT("contact"), | ||
|
||
/** | ||
* A product category page | ||
*/ | ||
PRODUCT_CATEGORY("product_category"), | ||
|
||
/** | ||
* The product details page | ||
*/ | ||
PRODUCT_DETAILS("product_details"), | ||
|
||
/** | ||
* The search page | ||
*/ | ||
SEARCH("search"), | ||
|
||
/** | ||
* The checkout page | ||
*/ | ||
CHECKOUT("checkout"), | ||
|
||
/** | ||
* The order review page | ||
*/ | ||
ORDER_REVIEW("order_review"), | ||
|
||
/** | ||
* The order confirmation page | ||
*/ | ||
ORDER_CONFIRMATION("order_confirmation"), | ||
|
||
/** | ||
* The mini cart | ||
*/ | ||
MINI_CART("mini_cart"), | ||
|
||
/** | ||
* Some other page | ||
*/ | ||
OTHER("other"); | ||
|
||
internal fun getStringRepresentation(): String { | ||
return stringValue | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...perInsights/src/main/java/com/braintreepayments/api/shopperinsights/PresentmentDetails.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.braintreepayments.api.shopperinsights | ||
|
||
/** | ||
* Initializes a new PresentmentDetails instance | ||
* | ||
* @property type An ExperimentType that is either a control or test type | ||
* @property buttonOrder optional Represents this buttons order in context of other buttons. | ||
* @property pageType optional Represents the page or view the button is rendered on. | ||
*/ | ||
data class PresentmentDetails( | ||
val type: ExperimentType, | ||
val buttonOrder: ButtonOrder, | ||
val pageType: PageType | ||
) |
3 changes: 1 addition & 2 deletions
3
...ights/src/main/java/com/braintreepayments/api/shopperinsights/ShopperInsightsAnalytics.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.