Skip to content

Commit f91fed8

Browse files
JlUgiajaxdesmarais
andauthored
Include information about integration path choices for developers using Google Pay (#1396)
* Add software info about the caller of LoadPaymentData calls for Google Pay * Add softwareInfo property change to the changelog --------- Co-authored-by: Jax DesMarais-Leder <jdesmarais@paypal.com>
1 parent 01fb536 commit f91fed8

File tree

3 files changed

+53
-2
lines changed

3 files changed

+53
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
* PayPal
66
* Fix an issue where `PayPalRequest` was sending `phone_number` instead of `payer_phone`
7+
* GooglePay
8+
* Add `softwareInfo` details to the `merchantInfo` field in the `loadPaymentData` request.
79

810
## 5.15.0 (2025-08-13)
911

GooglePay/src/main/java/com/braintreepayments/api/googlepay/GooglePayRequest.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,13 @@ class GooglePayRequest @JvmOverloads constructor(
184184
}
185185
}
186186

187-
val merchantInfo = JSONObject()
188-
merchantInfo.putOpt("merchantName", googleMerchantName)
187+
val merchantInfo = JSONObject().apply {
188+
put("softwareInfo", JSONObject()
189+
.put("id", "android/braintree-sdk")
190+
.put("version", BuildConfig.VERSION_NAME))
191+
192+
putOpt("merchantName", googleMerchantName)
193+
}
189194

190195
val json = JSONObject()
191196

GooglePay/src/test/java/com/braintreepayments/api/googlepay/GooglePayClientUnitTest.kt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,50 @@ class GooglePayClientUnitTest {
666666
.getString("merchantName"))
667667
}
668668

669+
@Test
670+
fun createPaymentAuthRequest_withMerchantInfo_sendSoftwareInfo() {
671+
val configuration = Configuration.fromJson(TestConfigurationBuilder()
672+
.googlePay(
673+
TestConfigurationBuilder.TestGooglePayConfigurationBuilder()
674+
.environment("sandbox")
675+
.googleAuthorizationFingerprint("google-auth-fingerprint")
676+
.paypalClientId("paypal-client-id-for-google-payment")
677+
.supportedNetworks(arrayOf("visa", "mastercard", "amex", "discover"))
678+
.enabled(true)
679+
)
680+
.withAnalytics()
681+
.build())
682+
683+
val braintreeClient = MockkBraintreeClientBuilder()
684+
.configurationSuccess(configuration)
685+
.activityInfo(activityInfo)
686+
.build()
687+
688+
every { merchantRepository.authorization } returns Authorization.fromString("sandbox_tokenization_string")
689+
690+
val internalGooglePayClient = MockkGooglePayInternalClientBuilder().build()
691+
692+
val sut = GooglePayClient(
693+
braintreeClient,
694+
internalGooglePayClient,
695+
analyticsParamRepository,
696+
merchantRepository
697+
)
698+
sut.createPaymentAuthRequest(baseRequest, intentDataCallback)
699+
700+
val captor = slot<GooglePayPaymentAuthRequest>()
701+
verify { intentDataCallback.onGooglePayPaymentAuthRequest(capture(captor)) }
702+
703+
val request = captor.captured
704+
assertTrue(request is GooglePayPaymentAuthRequest.ReadyToLaunch)
705+
val intent = request.requestParams
706+
707+
val paymentDataRequestJson = JSONObject(intent.paymentDataRequest.toJson())
708+
assert(paymentDataRequestJson
709+
.getJSONObject("merchantInfo")
710+
.has("softwareInfo"))
711+
}
712+
669713
@Test
670714
fun createPaymentAuthRequest_whenGooglePayCanProcessPayPal_tokenizationPropertiesIncludePayPal() {
671715
val configuration = Configuration.fromJson(TestConfigurationBuilder()

0 commit comments

Comments
 (0)