From d0b477b78b6e3364de9b5f0eaeabdf64c9ec45a0 Mon Sep 17 00:00:00 2001 From: v-mamaya <136605018+v-mamaya@users.noreply.github.com> Date: Wed, 7 Feb 2024 17:06:08 -0300 Subject: [PATCH] fix: Deleting property stripping from product when sent unbundled (#86) * Fixing property stripping from product + fixing associated test * adding a sample product category to the test case --- Sources/mParticle-Appboy/MPKitAppboy.m | 2 +- mParticle_AppboyTests/mParticle_AppboyTests.m | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Sources/mParticle-Appboy/MPKitAppboy.m b/Sources/mParticle-Appboy/MPKitAppboy.m index a1c7935..4376a94 100644 --- a/Sources/mParticle-Appboy/MPKitAppboy.m +++ b/Sources/mParticle-Appboy/MPKitAppboy.m @@ -467,7 +467,7 @@ - (MPKitExecStatus *)routeCommerceEvent:(MPCommerceEvent *)commerceEvent { } // Strips key/values already being passed to Appboy, plus key/values initialized to default values - keys = @[kMPExpProductSKU, kMPProductCurrency, kMPExpProductUnitPrice, kMPExpProductQuantity, kMPProductAffiliation, kMPExpProductCategory, kMPExpProductName]; + keys = @[kMPExpProductSKU, kMPProductCurrency, kMPExpProductUnitPrice, kMPExpProductQuantity]; [properties removeObjectsForKeys:keys]; [appboyInstance logPurchase:product.sku diff --git a/mParticle_AppboyTests/mParticle_AppboyTests.m b/mParticle_AppboyTests/mParticle_AppboyTests.m index 5e9cbd9..aa37f2f 100644 --- a/mParticle_AppboyTests/mParticle_AppboyTests.m +++ b/mParticle_AppboyTests/mParticle_AppboyTests.m @@ -410,6 +410,7 @@ - (void)testlogPurchaseCommerceEvent { XCTAssertEqualObjects(mockClient, [kit appboyInstance]); MPProduct *product = [[MPProduct alloc] initWithName:@"product1" sku:@"1131331343" quantity:@1 price:@13]; + product.category = @"category1"; MPCommerceEvent *event = [[MPCommerceEvent alloc] initWithAction:MPCommerceEventActionPurchase product:product]; event.customAttributes = @{@"testKey" : @"testCustomAttValue"}; @@ -430,7 +431,9 @@ - (void)testlogPurchaseCommerceEvent { @"Total Amount" : @13.00, @"Total Product Amount" : @"13", @"Tax Amount" : @3, - @"Transaction Id" : @"foo-transaction-id" + @"Transaction Id" : @"foo-transaction-id", + @"Name" : @"product1", + @"Category" : @"category1" }]; MPKitExecStatus *execStatus = [kit logBaseEvent:event];