Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move FPTI tenant_name into event_params #1104

Merged
merged 6 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Braintree iOS SDK Release Notes

## unreleased
* Send `tenant_name` in `event_params` to PayPal's analytics service (FPTI)
* Update `component` from `btmobilesdk` to `braintreeclientsdk` for PayPal's analytics service (FPTI)
* BraintreeCore
* Fix bug where `type` was always returned as `Unknown` in `fetchPaymentMethodNonces` (fixes #1099)

Expand Down
11 changes: 5 additions & 6 deletions Sources/BraintreeCore/Analytics/FPTIBatchData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ struct FPTIBatchData: Codable {
let errorDescription: String?
let eventName: String
let timestamp: String

let tenantName: String = "Braintree"

enum CodingKeys: String, CodingKey {
case errorDescription = "error_desc"
case eventName = "event_name"
case timestamp = "t"
case tenantName = "tenant_name"
}
}

Expand All @@ -51,7 +53,7 @@ struct FPTIBatchData: Codable {

let clientOS: String = UIDevice.current.systemName + " " + UIDevice.current.systemVersion

let component = "btmobilesdk"
let component = "braintreeclientsdk"

let deviceManufacturer = "Apple"

Expand Down Expand Up @@ -97,9 +99,7 @@ struct FPTIBatchData: Codable {
let platform = "iOS"

let sessionID: String

let tenantName = "Braintree"


let tokenizationKey: String?

enum CodingKeys: String, CodingKey {
Expand All @@ -120,7 +120,6 @@ struct FPTIBatchData: Codable {
case merchantID = "merchant_id"
case platform = "platform"
case sessionID = "session_id"
case tenantName = "tenant_name"
case tokenizationKey = "tokenization_key"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ final class FPTIBatchData_Tests: XCTestCase {
XCTAssertEqual(batchParams["auth_fingerprint"] as! String, "fake-auth")
XCTAssertTrue((batchParams["c_sdk_ver"] as! String).matches("^\\d+\\.\\d+\\.\\d+(-[0-9a-zA-Z-]+)?$"))
XCTAssertTrue((batchParams["client_os"] as! String).matches("iOS \\d+\\.\\d+|iPadOS \\d+\\.\\d+"))
XCTAssertEqual(batchParams["comp"] as? String, "btmobilesdk")
XCTAssertEqual(batchParams["comp"] as? String, "braintreeclientsdk")
XCTAssertEqual(batchParams["device_manufacturer"] as? String, "Apple")
XCTAssertEqual(batchParams["merchant_sdk_env"] as? String, "fake-env")
XCTAssertEqual(batchParams["event_source"] as? String, "mobile-native")
Expand All @@ -70,14 +70,15 @@ final class FPTIBatchData_Tests: XCTestCase {
XCTAssertEqual(batchParams["merchant_id"] as! String, "fake-merchant-id")
XCTAssertEqual(batchParams["platform"] as? String, "iOS")
XCTAssertEqual(batchParams["session_id"] as? String, "fake-session")
XCTAssertEqual(batchParams["tenant_name"] as? String, "Braintree")
XCTAssertEqual(batchParams["tokenization_key"] as! String, "fake-auth")

// Verify event-level parameters
XCTAssertEqual(eventParams[0]["t"] as? String, "fake-time-1")
XCTAssertEqual(eventParams[1]["t"] as? String, "fake-time-2")
XCTAssertEqual(eventParams[0]["event_name"] as? String, "fake-event-1")
XCTAssertEqual(eventParams[1]["event_name"] as? String, "fake-event-2")
XCTAssertEqual(eventParams[0]["tenant_name"] as? String, "Braintree")
XCTAssertEqual(eventParams[1]["tenant_name"] as? String, "Braintree")
XCTAssertEqual(eventParams[0]["error_desc"] as? String, "fake-error-description-1")
XCTAssertNil(eventParams[1]["error_desc"])
}
Expand Down