Skip to content

Commit

Permalink
Refactor RedirectType decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
nauaros committed Oct 31, 2024
1 parent 9b827b6 commit 68a0bb0
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions AdyenActions/Actions/RedirectAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,14 @@ import Foundation
public struct RedirectAction: Decodable {

/// Defines the type of redirect flow utilized by the `RedirectAction` object.
public enum RedirectType: Decodable {
public enum RedirectType: String, Decodable {
case redirect
case nativeRedirect

public init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
let type = try? container.decode(String.self)
switch type {
case "nativeRedirect": self = .nativeRedirect
case "redirect": self = .redirect
default:
self = .redirect
}
let type = try container.decode(String.self)
self = RedirectType(rawValue: type) ?? .redirect
}
}

Expand Down

0 comments on commit 68a0bb0

Please sign in to comment.