Skip to content

Commit

Permalink
updated param name to pd
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Espinola committed Jul 12, 2024
1 parent 9d7e131 commit c11d53c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Example/Example/ProductViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ - (IBAction)addToCartWithDeeplinkButtonPressed:(id)sender {
addToCart.deeplink = @"https://www.clientapp.com/flow=payment";

[[ATTNEventTracker sharedInstance] recordEvent:addToCart];
[self showToast: [NSString stringWithFormat:@"Add To Cart event sent with requestURL: '%@'", addToCart.deeplink] duration:4];
[self showToast: [NSString stringWithFormat:@"Add To Cart event sent with requestURL(pd): '%@'", addToCart.deeplink] duration:4];
}

- (IBAction)purchaseButtonPressed:(id)sender {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ extension ATTNAddToCartEvent: ATTNEventRequestProvider {
item.addItem(toDictionary: &metadata, with: priceFormatter)

if let deeplink {
metadata["requestURL"] = deeplink
metadata["pd"] = deeplink
}

eventRequests.append(.init(metadata: metadata, eventNameAbbreviation: ATTNEventTypes.addToCart))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ extension ATTNProductViewEvent: ATTNEventRequestProvider {
item.addItem(toDictionary: &metadata, with: priceFormatter)

if let deeplink {
metadata["requestURL"] = deeplink
metadata["pd"] = deeplink
}

eventRequests.append(.init(metadata: metadata, eventNameAbbreviation: ATTNEventTypes.productView))
Expand Down
6 changes: 3 additions & 3 deletions Tests/TestCases/ATTNAddToCartEventTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ final class ATTNAddToCartEventTests: XCTestCase {
let item = ATTNTestEventUtils.buildItem()
let addToCart = ATTNAddToCartEvent(items: [item])
XCTAssertFalse(addToCart.eventRequests.isEmpty)
XCTAssertNil(addToCart.eventRequests.first?.metadata["requestURL"])
XCTAssertNil(addToCart.eventRequests.first?.metadata["pd"])
}

func testAddCart_GivenData_ShouldBuildURLWithRequestURL() {
let item = ATTNTestEventUtils.buildItem()
let addToCart = ATTNAddToCartEvent(items: [item])
addToCart.deeplink = "https://www.clientapp.com/flow=payment"
addToCart.deeplink = "https://mydeeplink.com/products/32432423"
XCTAssertFalse(addToCart.eventRequests.isEmpty)
let requestURL = addToCart.eventRequests.first?.metadata["requestURL"] as? String
let requestURL = addToCart.eventRequests.first?.metadata["pd"] as? String
XCTAssertNotNil(requestURL)
XCTAssertFalse(requestURL?.isEmpty ?? true)
}
Expand Down
6 changes: 3 additions & 3 deletions Tests/TestCases/ATTNProductViewEventTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ final class ATTNProductViewEventTests: XCTestCase {
let item = ATTNTestEventUtils.buildItem()
let productView = ATTNProductViewEvent(items: [item])
XCTAssertFalse(productView.eventRequests.isEmpty)
XCTAssertNil(productView.eventRequests.first?.metadata["requestURL"])
XCTAssertNil(productView.eventRequests.first?.metadata["pd"])
}

func testProductView_GivenData_ShouldBuildURLWithRequestURL() {
let item = ATTNTestEventUtils.buildItem()
let productView = ATTNProductViewEvent(items: [item], deeplink: "https://www.clientapp.com/flow=payment")
let productView = ATTNProductViewEvent(items: [item], deeplink: "https://mydeeplink.com/products/32432423")
XCTAssertFalse(productView.eventRequests.isEmpty)
let requestURL = productView.eventRequests.first?.metadata["requestURL"] as? String
let requestURL = productView.eventRequests.first?.metadata["pd"] as? String
XCTAssertNotNil(requestURL)
XCTAssertFalse(requestURL?.isEmpty ?? true)
}
Expand Down

0 comments on commit c11d53c

Please sign in to comment.