From 9ff6eb7893a51acb00f35fbaaa8691a97b3363b1 Mon Sep 17 00:00:00 2001 From: Martin Alleus Date: Wed, 13 Nov 2024 11:57:28 +0100 Subject: [PATCH] Improving beacon logging for new web based modes --- .../Classes/SwedbankPayPaymentSession.swift | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/SwedbankPaySDK/Classes/SwedbankPayPaymentSession.swift b/SwedbankPaySDK/Classes/SwedbankPayPaymentSession.swift index 2eda530..64a5c8d 100644 --- a/SwedbankPaySDK/Classes/SwedbankPayPaymentSession.swift +++ b/SwedbankPaySDK/Classes/SwedbankPayPaymentSession.swift @@ -209,6 +209,25 @@ public extension SwedbankPaySDK { return } + let logValues: [String: String?] + + switch mode { + case .instrumentMode(let instrument): + logValues = [ + "mode": "instrumentMode", + "instrument": instrument.paymentMethod + ] + case .menu(let restrictedToInstruments): + logValues = [ + "mode": "menu", + "restrictedToInstruments": restrictedToInstruments?.compactMap({ $0.paymentMethod }).joined(separator: ";") + ] + } + + BeaconService.shared.log(type: .sdkMethodInvoked(name: "createSwedbankPaySDKController", + succeeded: true, + values: logValues)) + paymentViewSessionIsOngoing = false sdkControllerMode = mode @@ -245,10 +264,6 @@ public extension SwedbankPaySDK { paymentOrder: nil, userData: nil) - BeaconService.shared.log(type: .sdkMethodInvoked(name: "createSwedbankPaySDKController", - succeeded: true, - values: nil)) - paymentViewSessionIsOngoing = true viewController.internalDelegate = self