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

Error events for 3ds2/redirect/encryption #1918

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

erenbesel
Copy link
Contributor

@erenbesel erenbesel commented Dec 12, 2024

Summary

Several error events for:

  • ThreeDS2 flow (including the fingerPrintSubmit API error)
  • Redirect
  • Encryption

Ticket

COIOS-841

@erenbesel erenbesel added the chore a pull request that has chore changes that shouldn't be in the release notes label Dec 12, 2024
Copy link
Contributor

✅ No changes detected

Comparing COIOS-841_error_events_3ds2 to develop


Analyzed targets: Adyen, AdyenActions, AdyenCard, AdyenCashAppPay, AdyenComponents, AdyenDelegatedAuthentication, AdyenEncryption, AdyenSession, AdyenSwiftUI, AdyenTwint, AdyenWeChatPay

Copy link

sonarcloud bot commented Dec 12, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
60.9% Coverage on New Code (required ≥ 70%)

See analysis details on SonarQube Cloud

Copy link
Contributor

@goergisn goergisn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - just double checking

@@ -58,9 +58,19 @@ extension CardComponent {

submit(data: data)
} catch {
sendEncryptionErrorEvent()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we not interested in the actual error message?

@@ -462,9 +462,19 @@ extension GiftCardComponent {
storePaymentMethod: false
))
} catch {
sendEncryptionErrorEvent()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here - is the error description irrelevant?

internal var checkoutAttemptId: String? {
didSet {
if checkoutAttemptId != nil {
startNextTimer()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit bigger than the scope of this. Any reason to change this?
I quickly looked through tests changes and didn't find any new/changed tests for this part of logic.

subType: subtype
)
context.analyticsProvider?.add(log: logEvent)
private func sendErrorEvent(_ code: AnalyticsConstants.ErrorCode, for component: String, message: String? = nil) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is some inconsistency between method name and it's parameters.
First one with name omitted is code and from the outside it suggests and event (sendErrorEvent).
I would suggest to make it more consistent to not accumulate ambiguity.

It also does two things at a time:

  • creates an instance of AnalyticsEventError which is not a direct responsibility of ThreeDS2CoreActionHandler
  • asks to send it

I see we now have AnalyticsEventError instantiation across multiple files, do you think we can extract it so in the end we only send events using a predefined enum(s) from specific handlers such as ThreeDS2CoreActionHandler?

type: .internal
)
errorEvent.code = AnalyticsConstants.ErrorCode.encryptionError.stringValue
context.analyticsProvider?.add(error: errorEvent)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double dot syntax is always a trigger. It is something that would make refactor in the future really hard (extracting analytics out of context for example). We can conform context to analytics handling protocol (we can create one if necessary) and just proxy all add() calls for now.

/// Struct to hold error codes as type-safe static variables.
public struct ErrorCode {

public static let redirectFailed = ErrorCode(600)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a bunch of code.stringValue across this PR, is there a reason to make it Int instead of having an enum or just using a String raw value?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore a pull request that has chore changes that shouldn't be in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants