Skip to content

Commit

Permalink
fix: Deleting property stripping from product when sent unbundled (#86)
Browse files Browse the repository at this point in the history
* Fixing property stripping from product + fixing associated test

* adding a sample product category to the test case
  • Loading branch information
v-mamaya authored Feb 7, 2024
1 parent e3d887e commit d0b477b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Sources/mParticle-Appboy/MPKitAppboy.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion mParticle_AppboyTests/mParticle_AppboyTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -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"};
Expand All @@ -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];
Expand Down

0 comments on commit d0b477b

Please sign in to comment.