Skip to content

Commit

Permalink
Merge branch 'feature/SP-43-Example-app-improvements' into 'feature/n…
Browse files Browse the repository at this point in the history
…ative-payments'

SP-43 Example app improvements

See merge request swedbank-pay/swedbank-pay-sdk-ios!3
  • Loading branch information
mbalsiger committed Jun 4, 2024
2 parents ee9af39 + 6fde734 commit cdd19c3
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,15 @@ public extension SwedbankPaySDK {
private func sessionOperationHandling(model: PaymentOutputModel, culture: String? = nil) {
ongoingModel = model

var hasShowedError = false

if let modelProblem = model.problem,
let problemOperation = modelProblem.operation,
problemOperation.rel == .acknowledgeFailedAttempt {
if !hasShownProblemDetails.contains(where: { $0.operation?.href == problemOperation.href }) {
hasShownProblemDetails.append(modelProblem)
hasShowedError = true

DispatchQueue.main.async {
self.delegate?.sessionProblemOccurred(problem: modelProblem)

Expand Down Expand Up @@ -270,6 +274,12 @@ public extension SwedbankPaySDK {
BeaconService.shared.log(type: .sdkCallbackInvoked(name: "paymentComplete",
succeeded: self.delegate != nil,
values: nil))
} else {
self.delegate?.sdkProblemOccurred(problem: .paymentSessionEndStateReached)

BeaconService.shared.log(type: .sdkCallbackInvoked(name: "sdkProblemOccurred",
succeeded: self.delegate != nil,
values: ["problem": SwedbankPaySDK.NativePaymentProblem.paymentSessionEndStateReached.rawValue]))
}
}
sessionIsOngoing = false
Expand Down Expand Up @@ -303,7 +313,7 @@ public extension SwedbankPaySDK {
self.sessionStartTimestamp = Date()
self.makeRequest(model: getPayment, culture: culture)
}
} else {
} else if !hasShowedError {
DispatchQueue.main.async {
self.delegate?.sdkProblemOccurred(problem: .paymentSessionEndStateReached)

Expand Down

0 comments on commit cdd19c3

Please sign in to comment.