From ce345ab57b47feb798251e96b5a0594c8d575459 Mon Sep 17 00:00:00 2001 From: Martin Alleus Date: Thu, 14 Nov 2024 12:23:02 +0100 Subject: [PATCH] Tweaking customize-payment request parameters --- .../Classes/Api/SwedbankPayAPIEnpointRouter.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SwedbankPaySDK/Classes/Api/SwedbankPayAPIEnpointRouter.swift b/SwedbankPaySDK/Classes/Api/SwedbankPayAPIEnpointRouter.swift index 73b94d6..b84fb60 100644 --- a/SwedbankPaySDK/Classes/Api/SwedbankPayAPIEnpointRouter.swift +++ b/SwedbankPaySDK/Classes/Api/SwedbankPayAPIEnpointRouter.swift @@ -125,16 +125,16 @@ struct SwedbankPayAPIEnpointRouter: EndpointRouterProtocol { case .customizePayment(let instrument, let paymentMethod, let restrictToPaymentMethods): switch (instrument, paymentMethod, restrictToPaymentMethods) { - case (nil, nil, let restrictToPaymentMethods): + case (nil, nil, let restrictToPaymentMethods?): return ["paymentMethod": nil, - "restrictToPaymentMethods": restrictToPaymentMethods] + "restrictToPaymentMethods": restrictToPaymentMethods.isEmpty ? nil : restrictToPaymentMethods] case (.newCreditCard(let enabledPaymentDetailsConsentCheckbox), _, _): return ["paymentMethod": "CreditCard", "restrictToPaymentMethods": nil, "hideStoredPaymentOptions": true, "showConsentAffirmation" : enabledPaymentDetailsConsentCheckbox, ] - case (nil, let paymentMethod, nil): + case (nil, let paymentMethod?, nil): return ["paymentMethod": paymentMethod, "restrictToPaymentMethods": nil] case (let instrument?, nil, nil):