diff --git a/Sources/CrapCore/Checkout.swift b/Sources/CrapCore/Checkout.swift new file mode 100644 index 0000000..9710b82 --- /dev/null +++ b/Sources/CrapCore/Checkout.swift @@ -0,0 +1,18 @@ +import Foundation + +/// Deliberately messy: high complexity, untested, and several SwiftLint violations +/// (force cast, short identifiers). A showcase of crap4swift flagging real risk. +public func routeCheckout(_ code: Int, _ payload: Any) -> String { + let p = payload as! [String: Int] + if code == 1 { return "auth" } + if code == 2 { return "cart" } + if code == 3 { return "pay" } + if code == 4 { return "ship" } + if code == 5 { return "done" } + if code == 6 { return "refund" } + if code == 7 { return "cancel" } + if code == 8 { return "hold" } + if let q = p["qty"], q > 0 { return "qty" } + if p["vip"] != nil { return "vip" } + return "unknown" +}