feature(PayPal): collect and send device_info to determine app switch eligibility#1600
Open
santugowda wants to merge 3 commits into
Open
feature(PayPal): collect and send device_info to determine app switch eligibility#1600santugowda wants to merge 3 commits into
santugowda wants to merge 3 commits into
Conversation
… eligibility Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
0025eb8 to
f30f4ca
Compare
Contributor
|
@santugowda please follow the |
- Wrap ActivityManager.getMemoryInfo() in withContext(Dispatchers.IO) to avoid Binder IPC on Dispatchers.Main - Switch getJSONObject → optJSONObject in injectDeviceInfo for defense-in-depth (outer guard already ensures the key exists, but this makes the function safe in isolation) - Extract hardcoded "ANDROID" string to OS_TYPE_VALUE constant in PayPalRequest - Rename MODEL_KEY → DEVICE_MODEL_KEY for consistency with sibling constants - Promote activityManager to class field in unit tests with non-zero default memory values in beforeEach, removing per-test mock duplication - Add instrumentation test for PayPalVaultRequest app switch nested structure - Add unit test for vault path device_info injection - Add unit test for no-op when app switch enabled but no app link present Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Author
|
/ready |
Author
|
/inner source |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of changes
Sends device information as a nested
app_switch_contextobject in PayPal Hermes requests whenenablePayPalAppSwitchis enabled. This data is used downstream to determine app switch eligibility.JSON structure sent to BTGW:
{ "launch_paypal_app": true, "app_switch_context": { "device_info": { "model": "SM-A166U", "memory_available_mb": 350, "memory_total_mb": 4096 }, "native_app": { "app_url": "https://...", "os_type": "ANDROID", "os_version": "35" } } }Changes:
PayPalVaultRequest/PayPalCheckoutRequest: replaced flatos_type,os_version,merchant_app_return_urlkeys with nestedapp_switch_context.native_appobjectPayPalInternalClient:injectDeviceInfo()addsdevice_info(model, memory_available_mb, memory_total_mb) intoapp_switch_contextPayPalRequest: updated constants for new nested key structureAI Usage
Which AI Agent Was Used?
How was AI used?
Code generation, cross-codebase analysis (Android SDK, BTGW, backend), refactoring from flat to nested JSON structure, and writing tests.
Estimated AI Code Contribution
Checklist
Authors
Inner Source Process
Internal to PayPal contributors should fill out this section. All others can delete.
PR should follow these steps before codeowners review will begin:
/inner sourceon this PR — this will automatically add theinner sourceandtech lead review requiredlabels. Open the PR in a draft state./readyon this PR — this will automatically remove thetech lead review requiredlabel. Move the PR to ready to review.Inner Source Checklist