@Test public void addUidParams_addsParams() { Map<String, Object> existingMap = new HashMap<>(); StripeNetworkUtils.UidProvider provider = new StripeNetworkUtils.UidProvider() { @Override public String getUid() { return "abc123"; } @Override public String getPackageName() { return "com.example.main"; } }; StripeNetworkUtils.addUidParams(provider, RuntimeEnvironment.application, existingMap); assertEquals(2, existingMap.size()); assertTrue(existingMap.containsKey("muid")); assertTrue(existingMap.containsKey("guid")); }
@SuppressWarnings("HardwareIds") static void addUidParams( @Nullable UidProvider provider, @NonNull Context context, @NonNull Map<String, Object> params) { String guid = provider == null ? Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID) : provider.getUid(); if (StripeTextUtils.isBlank(guid)) { return; } String hashGuid = StripeTextUtils.shaHashInput(guid); String muid = provider == null ? context.getApplicationContext().getPackageName() + guid : provider.getPackageName() + guid; String hashMuid = StripeTextUtils.shaHashInput(muid); if (!StripeTextUtils.isBlank(hashGuid)) { params.put(GUID, hashGuid); } if (!StripeTextUtils.isBlank(hashMuid)) { params.put(MUID, hashMuid); } }
StripeNetworkUtils { @SuppressWarnings("HardwareIds") static void addUidParams( @Nullable UidProvider provider, @NonNull Context context, @NonNull Map<String, Object> params) { String guid = provider == null ? Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID) : provider.getUid(); if (StripeTextUtils.isBlank(guid)) { return; } String hashGuid = StripeTextUtils.shaHashInput(guid); String muid = provider == null ? context.getApplicationContext().getPackageName() + guid : provider.getPackageName() + guid; String hashMuid = StripeTextUtils.shaHashInput(muid); if (!StripeTextUtils.isBlank(hashGuid)) { params.put(GUID, hashGuid); } if (!StripeTextUtils.isBlank(hashMuid)) { params.put(MUID, hashMuid); } } }
StripeNetworkUtils { @SuppressWarnings("HardwareIds") static void addUidParams( @Nullable UidProvider provider, @NonNull Context context, @NonNull Map<String, Object> params) { String guid = provider == null ? Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID) : provider.getUid(); if (StripeTextUtils.isBlank(guid)) { return; } String hashGuid = StripeTextUtils.shaHashInput(guid); String muid = provider == null ? context.getApplicationContext().getPackageName() + guid : provider.getPackageName() + guid; String hashMuid = StripeTextUtils.shaHashInput(muid); if (!StripeTextUtils.isBlank(hashGuid)) { params.put(GUID, hashGuid); } if (!StripeTextUtils.isBlank(hashMuid)) { params.put(MUID, hashMuid); } }  }
StripeNetworkUtils { @SuppressWarnings("HardwareIds") static void addUidParams( @Nullable UidProvider provider, @NonNull Context context, @NonNull Map<String, Object> params) { String guid = provider == null ? Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID) : provider.getUid(); if (StripeTextUtils.isBlank(guid)) { return; } String hashGuid = StripeTextUtils.shaHashInput(guid); String muid = provider == null ? context.getApplicationContext().getPackageName() + guid : provider.getPackageName() + guid; String hashMuid = StripeTextUtils.shaHashInput(muid); if (!StripeTextUtils.isBlank(hashGuid)) { params.put(GUID, hashGuid); } if (!StripeTextUtils.isBlank(hashMuid)) { params.put(MUID, hashMuid); } }  @SuppressWarnings("unchecked") static void removeNullAndEmptyParams(@NonNull Map<String, Object> mapToEdit); }
StripeNetworkUtils { @SuppressWarnings("HardwareIds") static void addUidParams( @Nullable UidProvider provider, @NonNull Context context, @NonNull Map<String, Object> params) { String guid = provider == null ? Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID) : provider.getUid(); if (StripeTextUtils.isBlank(guid)) { return; } String hashGuid = StripeTextUtils.shaHashInput(guid); String muid = provider == null ? context.getApplicationContext().getPackageName() + guid : provider.getPackageName() + guid; String hashMuid = StripeTextUtils.shaHashInput(muid); if (!StripeTextUtils.isBlank(hashGuid)) { params.put(GUID, hashGuid); } if (!StripeTextUtils.isBlank(hashMuid)) { params.put(MUID, hashMuid); } }  @SuppressWarnings("unchecked") static void removeNullAndEmptyParams(@NonNull Map<String, Object> mapToEdit);  }