File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
main/java/com/segment/analytics/android/integrations/firebase
test/java/com/segment/analytics/android/integration/firebase Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -211,7 +211,7 @@ && isNullOrEmpty(properties.currency())) {
211
211
} else {
212
212
property = makeKey (property );
213
213
}
214
- if (property .equals (Param .ITEMS )) {
214
+ if (property .equals (Param .ITEMS ) && value != null ) {
215
215
List <ValueMap > products = properties .getList ("products" , ValueMap .class );
216
216
ArrayList <Bundle > mappedProducts = formatProducts (products );
217
217
bundle .putParcelableArrayList (property , mappedProducts );
Original file line number Diff line number Diff line change @@ -152,6 +152,23 @@ public void trackPurchaseWithProducts() {
152
152
verify (firebase ).logEvent (eq ("purchase" ), bundleEq (expected ));
153
153
}
154
154
155
+ @ Test
156
+ public void trackPurchaseWithNullProducts () {
157
+ Properties properties = new Properties ()
158
+ .putValue ("revenue" , 100.0 )
159
+ .putValue ("currency" , "USD" )
160
+ .putValue ("products" , null );
161
+
162
+ integration .track (new TrackPayload .Builder ().anonymousId ("1234" ).properties (properties ).event ("Order Completed" ).build ());
163
+
164
+ Bundle expected = new Bundle ();
165
+ expected .putDouble ("value" , 100.0 );
166
+ expected .putString ("currency" , "USD" );
167
+ expected .putString ("items" , null );
168
+
169
+ verify (firebase ).logEvent (eq ("purchase" ), bundleEq (expected ));
170
+ }
171
+
155
172
@ Test
156
173
public void trackWithEventNameTransformation () {
157
174
Properties properties = new Properties ()
You can’t perform that action at this time.
0 commit comments