Skip to content

Commit

Permalink
More Code Review Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mbalsiger committed Oct 15, 2024
1 parent 35e233b commit e68e1c8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions SwedbankPaySDK/Classes/Api/SwedbankPayAPIEnpointRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,20 @@ struct SwedbankPayAPIEnpointRouter: EndpointRouterProtocol {
return ["instrument": "ApplePay",
"paymentPayload": paymentPayload]
case .customizePayment(let instrument):
if case .newCreditCard(let enabledPaymentDetailsConsentCheckbox) = instrument {
guard let instrument = instrument else {
return ["paymentMethod": nil]
}

switch instrument {
case .newCreditCard(let enabledPaymentDetailsConsentCheckbox):
return ["paymentMethod": "CreditCard",
"hideStoredPaymentOptions": true,
"showConsentAffirmation" : enabledPaymentDetailsConsentCheckbox,
]
} else {
return ["paymentMethod": nil]
case .swish,
.creditCard,
.applePay:
return ["paymentMethod": instrument.identifier]
}
default:
return nil
Expand Down
2 changes: 1 addition & 1 deletion SwedbankPaySDK/Classes/SwedbankPayPaymentSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ public extension SwedbankPaySDK {
makeRequest(router: .customizePayment(instrument: nil), operation: customizePayment)
} else if let instrument = self.instrument,
case .newCreditCard = instrument,
ongoingModel?.paymentSession.instrumentModePaymentMethod == nil || ongoingModel?.paymentSession.instrumentModePaymentMethod != "CreditCard",
ongoingModel?.paymentSession.instrumentModePaymentMethod == nil || ongoingModel?.paymentSession.instrumentModePaymentMethod != instrument.identifier,
let customizePayment = ongoingModel?.operations?.first(where: { $0.rel == .customizePayment }) {
makeRequest(router: .customizePayment(instrument: instrument), operation: customizePayment)
} else if case .newCreditCard = self.instrument,
Expand Down

0 comments on commit e68e1c8

Please sign in to comment.