Skip to content

Commit

Permalink
Renaming class
Browse files Browse the repository at this point in the history
  • Loading branch information
saperi22 committed Dec 8, 2023
1 parent 238fe4f commit 28533ab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.braintreepayments.api

import androidx.annotation.VisibleForTesting
import org.json.JSONObject

/**
* Use [ShopperInsightsClient] to optimize your checkout experience
Expand All @@ -18,12 +17,12 @@ class ShopperInsightsClient @VisibleForTesting internal constructor(
/**
* Retrieves recommended payment methods based on the provided shopper insights request.
*
* @param request The [ShopperInsightRequest] containing information about the shopper.
* @param request The [ShopperInsightsRequest] containing information about the shopper.
* @return A [ShopperInsightResult] object indicating the recommended payment methods.
*/
@Suppress("UnusedPrivateMember")
fun getRecommendedPaymentMethods(
request: ShopperInsightRequest,
request: ShopperInsightsRequest,
callback: ShopperInsightCallback
) {
val jsonBody = request.toJson()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ data class BuyerPhone(
/**
* Data class representing a request for shopper insights.
*/
sealed class ShopperInsightRequest {
data class Email(var email: String) : ShopperInsightRequest()
sealed class ShopperInsightsRequest {
data class Email(var email: String) : ShopperInsightsRequest()
data class Phone(
var phone: BuyerPhone
) : ShopperInsightRequest()
) : ShopperInsightsRequest()
data class EmailAndPhone(
var email: String,
var phone: BuyerPhone
) : ShopperInsightRequest()
) : ShopperInsightsRequest()

private fun toJson(email: String? = null, phone: BuyerPhone? = null): String {
return JSONObject().apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ShopperInsightsClientUnitTest {
*/
@Test
fun testGetRecommendedPaymentMethods_returnsDefaultRecommendations() {
val request = ShopperInsightRequest.Email("fake-email")
val request = ShopperInsightsRequest.Email("fake-email")
sut.getRecommendedPaymentMethods(request
) { result ->
assertNotNull(result)
Expand All @@ -52,7 +52,7 @@ class ShopperInsightsClientUnitTest {
fun testGetRecommendedPaymentMethods_verifyPhoneJson() {
val testCountryCode = "1"
val testNationalNumber = "123456789"
val request = ShopperInsightRequest.Phone(
val request = ShopperInsightsRequest.Phone(
BuyerPhone(
countryCode = testCountryCode,
nationalNumber = testNationalNumber
Expand Down Expand Up @@ -81,7 +81,7 @@ class ShopperInsightsClientUnitTest {
@Test
fun testGetRecommendedPaymentMethods_verifyEmailJson() {
val fakeEmail = "fake-email"
val request = ShopperInsightRequest.Email(fakeEmail)
val request = ShopperInsightsRequest.Email(fakeEmail)
val slot = CapturingSlot<String>()
sut.getRecommendedPaymentMethods(request) {
verify {
Expand All @@ -105,7 +105,7 @@ class ShopperInsightsClientUnitTest {
val testCountryCode = "1"
val testNationalNumber = "123456789"

val request = ShopperInsightRequest.EmailAndPhone(
val request = ShopperInsightsRequest.EmailAndPhone(
email = fakeEmail,
phone = BuyerPhone(
countryCode = testCountryCode,
Expand Down

0 comments on commit 28533ab

Please sign in to comment.