Skip to content

Commit

Permalink
fix(iOS): 3-d security protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
pr-Mais committed Oct 27, 2022
1 parent 67f32be commit 7811305
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion ios/Classes/SwiftHyperpayPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import SafariServices
/// Handle calls from the Flutter side.
///
/// Currently supported brands: VISA, MastrCard, MADA, and Apple Pay.
public class SwiftHyperpayPlugin: NSObject, FlutterPlugin, SFSafariViewControllerDelegate, UIAdaptivePresentationControllerDelegate, PKPaymentAuthorizationViewControllerDelegate {
public class SwiftHyperpayPlugin: NSObject, FlutterPlugin, SFSafariViewControllerDelegate, UIAdaptivePresentationControllerDelegate, PKPaymentAuthorizationViewControllerDelegate, OPPThreeDSEventListener {

var provider:OPPPaymentProvider = OPPPaymentProvider(mode: OPPProviderMode.test)
var brand:Brand = Brand.UNKNOWN
Expand Down Expand Up @@ -44,6 +44,17 @@ public class SwiftHyperpayPlugin: NSObject, FlutterPlugin, SFSafariViewControlle
/// A suffix added to the bundle ID of the client's app to form a complete `shopperResultURL`.
let shopperResultURLSuffix = ".payments://result";

public func onThreeDSChallengeRequired(completion: @escaping (UINavigationController) -> Void) {
if(self.safariVC?.navigationController != nil){
completion((self.safariVC?.navigationController)!)
}
}

public func onThreeDSConfigRequired(completion: @escaping (OPPThreeDSConfig) -> Void) {
let config = OPPThreeDSConfig()
completion(config)
}

public func paymentAuthorizationViewControllerDidFinish(_ controller: PKPaymentAuthorizationViewController) {
controller.dismiss(animated: true, completion: nil)
self.paymentResult!("canceled")
Expand Down Expand Up @@ -113,6 +124,8 @@ public class SwiftHyperpayPlugin: NSObject, FlutterPlugin, SFSafariViewControlle
self.provider.mode = OPPProviderMode.live
}

self.provider.threeDSEventListener = self

NSLog("Payment mode is set to \(paymentMode)")

result(nil)
Expand Down

0 comments on commit 7811305

Please sign in to comment.