@@ -109,23 +109,19 @@ public class CardClient: NSObject {
109
109
guard getQueryStringParameter ( url: url, param: " flow " ) == " 3ds " ,
110
110
url. contains ( " helios " ) ,
111
111
let url = URL ( string: url) else {
112
- self . notifyCheckoutFailure ( with: CardError . threeDSecureURLError, completion: completion)
112
+ self . notify3dsCheckoutFailure ( with: CardError . threeDSecureURLError, completion: completion)
113
113
return
114
114
}
115
115
116
- analyticsService? . sendEvent ( " card-payments:confirm-payment-source: challenge-required " )
116
+ analyticsService? . sendEvent ( " card-payments:approve-order:auth- challenge-required " )
117
117
startThreeDSecureChallenge ( url: url, orderId: result. id, completion: completion)
118
118
} else {
119
- analyticsService? . sendEvent ( " card-payments:confirm-payment-source:succeeded " )
120
-
121
119
let cardResult = CardResult ( orderID: result. id, status: result. status, didAttemptThreeDSecureAuthentication: false )
122
120
notifyCheckoutSuccess ( for: cardResult, completion: completion)
123
121
}
124
122
} catch let error as CoreSDKError {
125
- analyticsService? . sendEvent ( " card-payments:confirm-payment-source:failed " )
126
123
notifyCheckoutFailure ( with: error, completion: completion)
127
124
} catch {
128
- analyticsService? . sendEvent ( " card-payments:confirm-payment-source:failed " )
129
125
notifyCheckoutFailure ( with: CardError . unknownError, completion: completion)
130
126
}
131
127
}
@@ -161,25 +157,25 @@ public class CardClient: NSObject {
161
157
context: self ,
162
158
sessionDidDisplay: { [ weak self] didDisplay in
163
159
if didDisplay {
164
- self ? . analyticsService? . sendEvent ( " card-payments:3ds :challenge-presentation:succeeded " )
160
+ self ? . analyticsService? . sendEvent ( " card-payments:approve-order :challenge-presentation:succeeded " )
165
161
} else {
166
- self ? . analyticsService? . sendEvent ( " card-payments:3ds :challenge-presentation:failed " )
162
+ self ? . analyticsService? . sendEvent ( " card-payments:approve-order :challenge-presentation:failed " )
167
163
}
168
164
} ,
169
165
sessionDidComplete: { _, error in
170
166
if let error = error {
171
167
switch error {
172
168
case ASWebAuthenticationSessionError . canceledLogin:
173
- self . notifyCheckoutCancelWithError ( with: CardError . threeDSecureCanceledError, completion: completion)
169
+ self . notify3dsCheckoutCancelWithError ( with: CardError . threeDSecureCanceledError, completion: completion)
174
170
return
175
171
default :
176
- self . notifyCheckoutFailure ( with: CardError . threeDSecureError ( error) , completion: completion)
172
+ self . notify3dsCheckoutFailure ( with: CardError . threeDSecureError ( error) , completion: completion)
177
173
return
178
174
}
179
175
}
180
176
181
177
let cardResult = CardResult ( orderID: orderId, status: nil , didAttemptThreeDSecureAuthentication: true )
182
- self . notifyCheckoutSuccess ( for: cardResult, completion: completion)
178
+ self . notify3dsCheckoutSuccess ( for: cardResult, completion: completion)
183
179
}
184
180
)
185
181
}
@@ -229,13 +225,23 @@ public class CardClient: NSObject {
229
225
completion ( result, nil )
230
226
}
231
227
228
+ private func notify3dsCheckoutSuccess( for result: CardResult , completion: ( CardResult ? , CoreSDKError ? ) -> Void ) {
229
+ analyticsService? . sendEvent ( " card-payments:approve-order:auth-challenge-succeeded " )
230
+ completion ( result, nil )
231
+ }
232
+
232
233
private func notifyCheckoutFailure( with error: CoreSDKError , completion: ( CardResult ? , CoreSDKError ? ) -> Void ) {
233
234
analyticsService? . sendEvent ( " card-payments:approve-order:failed " )
234
235
completion ( nil , error)
235
236
}
236
237
237
- private func notifyCheckoutCancelWithError( with error: CoreSDKError , completion: ( CardResult ? , CoreSDKError ? ) -> Void ) {
238
- analyticsService? . sendEvent ( " card-payments:approve-order:challenge:user-canceled " )
238
+ private func notify3dsCheckoutFailure( with error: CoreSDKError , completion: ( CardResult ? , CoreSDKError ? ) -> Void ) {
239
+ analyticsService? . sendEvent ( " card-payments:approve-order:auth-challenge-failed " )
240
+ completion ( nil , error)
241
+ }
242
+
243
+ private func notify3dsCheckoutCancelWithError( with error: CoreSDKError , completion: ( CardResult ? , CoreSDKError ? ) -> Void ) {
244
+ analyticsService? . sendEvent ( " card-payments:approve-order:auth-challenge-canceled " )
239
245
completion ( nil , error)
240
246
}
241
247
0 commit comments