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

Shopper insights rp1 feature fixes from main merge #1490

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
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Braintree iOS SDK Release Notes

## 6.25.0 (2024-12-11)
## unreleased
* BraintreePayPal
* Add `BTPayPalRequest.userPhoneNumber` optional property
* Add `shopperSessionID` to `BTPayPalCheckoutRequest` and `BTPayPalVaultRequest`
* BraintreeVenmo
* Send `url` in `event_params` for App Switch events to PayPal's analytics service (FPTI)
* BraintreeShopperInsights (BETA)
* Add `shopperSessionID` to `BTShopperInsightsClient` initializer
* Add `isPayPalAppInstalled()` and/or `isVenmoAppInstalled()`

## 6.25.0 (2024-12-11)
* BraintreePayPal
* Add `BTPayPalRequest.userPhoneNumber` optional property
* Send `url` in `event_params` for App Switch events to PayPal's analytics service (FPTI)
* BraintreeVenmo
* Send `url` in `event_params` for App Switch events to PayPal's analytics service (FPTI)
Expand Down
48 changes: 24 additions & 24 deletions Sources/BraintreePayPal/BTPayPalClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,29 @@ import BraintreeDataCollector
performSwitchRequest(appSwitchURL: url, paymentType: paymentType, completion: completion)
}

func invokedOpenURLSuccessfully(_ success: Bool, url: URL, completion: @escaping (BTPayPalAccountNonce?, Error?) -> Void) {
if success {
apiClient.sendAnalyticsEvent(
BTPayPalAnalytics.appSwitchSucceeded,
isVaultRequest: isVaultRequest,
linkType: linkType,
payPalContextID: payPalContextID,
appSwitchURL: url
)
BTPayPalClient.payPalClient = self
appSwitchCompletion = completion
} else {
apiClient.sendAnalyticsEvent(
BTPayPalAnalytics.appSwitchFailed,
isVaultRequest: isVaultRequest,
linkType: linkType,
payPalContextID: payPalContextID,
appSwitchURL: url
)
notifyFailure(with: BTPayPalError.appSwitchFailed, completion: completion)
}
}

// MARK: - App Switch Methods

func handleReturnURL(_ url: URL) {
Expand Down Expand Up @@ -412,30 +435,7 @@ import BraintreeDataCollector
}

application.open(redirectURL) { success in
self.invokedOpenURLSuccessfully(success, completion: completion)
}
}

private func invokedOpenURLSuccessfully(_ success: Bool, completion: @escaping (BTPayPalAccountNonce?, Error?) -> Void) {
if success {
apiClient.sendAnalyticsEvent(
BTPayPalAnalytics.appSwitchSucceeded,
isVaultRequest: isVaultRequest,
linkType: linkType,
payPalContextID: payPalContextID,
shopperSessionID: payPalRequest?.shopperSessionID
)
BTPayPalClient.payPalClient = self
appSwitchCompletion = completion
} else {
apiClient.sendAnalyticsEvent(
BTPayPalAnalytics.appSwitchFailed,
isVaultRequest: isVaultRequest,
linkType: linkType,
payPalContextID: payPalContextID,
shopperSessionID: payPalRequest?.shopperSessionID
)
notifyFailure(with: BTPayPalError.appSwitchFailed, completion: completion)
self.invokedOpenURLSuccessfully(success, url: redirectURL, completion: completion)
}
}

Expand Down