From 28533ab66112bed7ebd92cf3b711525f6800958d Mon Sep 17 00:00:00 2001 From: Sai Date: Fri, 8 Dec 2023 16:28:19 -0600 Subject: [PATCH] Renaming class --- .../com/braintreepayments/api/ShopperInsightsClient.kt | 5 ++--- ...ShopperInsightRequest.kt => ShopperInsightsRequest.kt} | 8 ++++---- .../api/ShopperInsightsClientUnitTest.kt | 8 ++++---- 3 files changed, 10 insertions(+), 11 deletions(-) rename BraintreeCore/src/main/java/com/braintreepayments/api/{ShopperInsightRequest.kt => ShopperInsightsRequest.kt} (89%) diff --git a/BraintreeCore/src/main/java/com/braintreepayments/api/ShopperInsightsClient.kt b/BraintreeCore/src/main/java/com/braintreepayments/api/ShopperInsightsClient.kt index 4ab321ac84..0398f03fa2 100644 --- a/BraintreeCore/src/main/java/com/braintreepayments/api/ShopperInsightsClient.kt +++ b/BraintreeCore/src/main/java/com/braintreepayments/api/ShopperInsightsClient.kt @@ -1,7 +1,6 @@ package com.braintreepayments.api import androidx.annotation.VisibleForTesting -import org.json.JSONObject /** * Use [ShopperInsightsClient] to optimize your checkout experience @@ -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() diff --git a/BraintreeCore/src/main/java/com/braintreepayments/api/ShopperInsightRequest.kt b/BraintreeCore/src/main/java/com/braintreepayments/api/ShopperInsightsRequest.kt similarity index 89% rename from BraintreeCore/src/main/java/com/braintreepayments/api/ShopperInsightRequest.kt rename to BraintreeCore/src/main/java/com/braintreepayments/api/ShopperInsightsRequest.kt index baf6e8c800..e4c2d656ee 100644 --- a/BraintreeCore/src/main/java/com/braintreepayments/api/ShopperInsightRequest.kt +++ b/BraintreeCore/src/main/java/com/braintreepayments/api/ShopperInsightsRequest.kt @@ -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 { diff --git a/BraintreeCore/src/test/java/com/braintreepayments/api/ShopperInsightsClientUnitTest.kt b/BraintreeCore/src/test/java/com/braintreepayments/api/ShopperInsightsClientUnitTest.kt index 2d98bd014a..92985e16a9 100644 --- a/BraintreeCore/src/test/java/com/braintreepayments/api/ShopperInsightsClientUnitTest.kt +++ b/BraintreeCore/src/test/java/com/braintreepayments/api/ShopperInsightsClientUnitTest.kt @@ -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) @@ -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 @@ -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() sut.getRecommendedPaymentMethods(request) { verify { @@ -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,