Skip to content

Commit eeb35fb

Browse files
Merge pull request #26 from SwedbankPay/feature/sdk-version-5.0.3
Feature/sdk version 5.0.3
2 parents 0f48fed + b332521 commit eeb35fb

6 files changed

Lines changed: 45 additions & 16 deletions

File tree

.github/workflows/deploy_new_version.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@ on:
77

88
jobs:
99
deploy:
10-
runs-on: macos-13
10+
runs-on: macos-latest
1111
steps:
1212
- uses: actions/checkout@v3
1313
- uses: maxim-lobanov/setup-xcode@v1
1414
with:
15-
xcode-version: "15.0.1"
15+
xcode-version: "16.2"
16+
- name: Manually download iOS 18.2
17+
run: |
18+
xcodebuild -downloadPlatform iOS -buildVersion 18.2 -exportPath ~/SimulatorRuntimes/
19+
xcodebuild -importPlatform "/Users/runner/SimulatorRuntimes/iphonesimulator_18.2_22C150.dmg"
1620
- run: swift run
1721
working-directory: ./deploy_new_version
1822
env:

Example-app.xcodeproj/project.pbxproj

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -771,9 +771,8 @@
771771
buildSettings = {
772772
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
773773
CODE_SIGN_STYLE = Automatic;
774-
DEVELOPMENT_TEAM = MUD77FXNE9;
774+
DEVELOPMENT_TEAM = "MUD77FXNE9";
775775
INFOPLIST_FILE = "Example-app-UITests/Info.plist";
776-
IPHONEOS_DEPLOYMENT_TARGET = 14.3;
777776
LD_RUNPATH_SEARCH_PATHS = (
778777
"$(inherited)",
779778
"@executable_path/Frameworks",
@@ -793,7 +792,6 @@
793792
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
794793
CODE_SIGN_STYLE = Automatic;
795794
INFOPLIST_FILE = "Example-app-UITests/Info.plist";
796-
IPHONEOS_DEPLOYMENT_TARGET = 14.3;
797795
LD_RUNPATH_SEARCH_PATHS = (
798796
"$(inherited)",
799797
"@executable_path/Frameworks",
@@ -859,7 +857,7 @@
859857
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
860858
GCC_WARN_UNUSED_FUNCTION = YES;
861859
GCC_WARN_UNUSED_VARIABLE = YES;
862-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
860+
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
863861
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
864862
MTL_FAST_MATH = YES;
865863
ONLY_ACTIVE_ARCH = YES;
@@ -915,7 +913,7 @@
915913
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
916914
GCC_WARN_UNUSED_FUNCTION = YES;
917915
GCC_WARN_UNUSED_VARIABLE = YES;
918-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
916+
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
919917
MTL_ENABLE_DEBUG_INFO = NO;
920918
MTL_FAST_MATH = YES;
921919
SDKROOT = iphoneos;
@@ -937,7 +935,6 @@
937935
DEVELOPMENT_TEAM = "";
938936
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 8ZL2DT9DQM;
939937
INFOPLIST_FILE = "Example-app/Info.plist";
940-
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
941938
LD_RUNPATH_SEARCH_PATHS = (
942939
"$(inherited)",
943940
"@executable_path/Frameworks",
@@ -965,7 +962,6 @@
965962
DEVELOPMENT_TEAM = "";
966963
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 8ZL2DT9DQM;
967964
INFOPLIST_FILE = "Example-app/Info.plist";
968-
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
969965
LD_RUNPATH_SEARCH_PATHS = (
970966
"$(inherited)",
971967
"@executable_path/Frameworks",
@@ -1026,7 +1022,7 @@
10261022
repositoryURL = "https://github.com/SwedbankPay/swedbank-pay-sdk-ios.git";
10271023
requirement = {
10281024
kind = upToNextMajorVersion;
1029-
minimumVersion = 5.0.0;
1025+
minimumVersion = "5.0.3-rc.1";
10301026
};
10311027
};
10321028
/* End XCRemoteSwiftPackageReference section */

Example-app/Base.lproj/Localizable.strings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@
2525
"stand_alone_url_payment_abort" = "Abort";
2626
"stand_alone_url_payment_session_end_state_reached" = "Something went wrong with the payment";
2727
"stand_alone_internal_inconsistency_error" = "Something was called it the wrong order";
28+
"stand_alone_abort_payment_not_allowed" = "Abort payment currently not possible";
2829
"stand_alone_generic_error_title" = "Something went wrong";
2930
"stand_alone_url_seamless_title" = "Seamless View";
3031
"stand_alone_url_payment_web" = "Get payment menu";
3132
"stand_alone_url_payment_web_restricted" = "Get payment menu\nRestricted to non native";
3233
"stand_alone_url_payment_apple_pay" = "ApplePay";
34+
"stand_alone_url_payment_apple_pay_can_make_payments %@" = "Can make payments: %@";
35+
"stand_alone_url_payment_apple_pay_using_networks_and_capabilities %@" = "...using networks and capabilities: %@";
3336
"stand_alone_url_payment_web_based" = "Web Based";

Example-app/ViewModels/StandaloneUrlViewModel.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,15 @@ extension StandaloneUrlView {
111111
retry: retry)
112112
}
113113

114-
private func showAlert(errorTitle: String?, errorMessage: String?, retry: (()->Void)? = nil) {
114+
private func showAlert(errorTitle: String?, errorMessage: String?, stopLoading: Bool = true, retry: (()->Void)? = nil) {
115115
self.errorTitle = errorTitle
116116
self.errorMessage = errorMessage
117117
self.retry = retry
118118
self.showingAlert = true
119119

120-
isLoadingNativePayment = false
120+
if stopLoading {
121+
isLoadingNativePayment = false
122+
}
121123
}
122124

123125
private func showAlertOnPaymentSession3DSecureViewController(error: Error, retry: (()->Void)?) {
@@ -183,6 +185,8 @@ extension StandaloneUrlView {
183185
setPaymentResult(success: false, resultText: "stand_alone_internal_inconsistency_error".localize)
184186
case .automaticConfigurationFailed:
185187
setPaymentResult(success: false, resultText: "stand_alone_automatic_configuration_failed".localize)
188+
case .abortPaymentNotAllowed:
189+
showAlert(errorTitle: nil, errorMessage: "stand_alone_abort_payment_not_allowed".localize, stopLoading: false)
186190
}
187191
}
188192

Example-app/Views/StandaloneUrlView.swift

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ struct StandaloneUrlView: View {
336336
.frame(height: 48)
337337
.accessibilityIdentifier("swishButton")
338338
}
339-
.disabled(viewModel.swishNumber.isEmpty)
339+
.disabled(viewModel.swishNumber.isEmpty || viewModel.isLoadingNativePayment)
340340
.foregroundColor(!viewModel.swishNumber.isEmpty ? .white : .gray)
341341
.background(!viewModel.swishNumber.isEmpty ? .black : .backgroundGray)
342342
.cornerRadius(30)
@@ -354,6 +354,7 @@ struct StandaloneUrlView: View {
354354
.frame(height: 48)
355355
.accessibilityIdentifier("swishButton")
356356
}
357+
.disabled(viewModel.isLoadingNativePayment)
357358
.foregroundColor(.white)
358359
.background(.black)
359360
.cornerRadius(30)
@@ -373,6 +374,7 @@ struct StandaloneUrlView: View {
373374
.frame(height: 48)
374375
.accessibilityIdentifier("swishPrefillButton")
375376
}
377+
.disabled(viewModel.isLoadingNativePayment)
376378
.foregroundColor(.white)
377379
.background(.black)
378380
.cornerRadius(30)
@@ -398,6 +400,7 @@ struct StandaloneUrlView: View {
398400
.accessibilityIdentifier("creditCardPrefillButton")
399401

400402
}
403+
.disabled(viewModel.isLoadingNativePayment)
401404
.foregroundColor(.white)
402405
.background(.black)
403406
.cornerRadius(30)
@@ -409,19 +412,30 @@ struct StandaloneUrlView: View {
409412
isFocused = false
410413

411414
viewModel.isLoadingNativePayment = true
412-
viewModel.nativePayment?.makeNativePaymentAttempt(instrument: .newCreditCard(enabledPaymentDetailsConsentCheckbox: true))
415+
viewModel.nativePayment?.makeNativePaymentAttempt(instrument: .newCreditCard(enabledPaymentDetailsConsentCheckbox: false))
413416
} label: {
414417
Text("stand_alone_url_payment_new_credit_card")
415418
.smallFont()
416419
.frame(maxWidth: .infinity)
417420
.frame(height: 48)
418421
.accessibilityIdentifier("newCreditCardButton")
419422
}
423+
.disabled(viewModel.isLoadingNativePayment)
420424
.foregroundColor(.white)
421425
.background(.black)
422426
.cornerRadius(30)
423427
.padding(.top, 10)
424-
case .applePay:
428+
case .applePay(let canMakePayments, let canMakePaymentsUsingNetworksAndCapabilities):
429+
VStack(spacing: 0) {
430+
Text("stand_alone_url_payment_apple_pay")
431+
Text("stand_alone_url_payment_apple_pay_can_make_payments \(String(canMakePayments))")
432+
Text("stand_alone_url_payment_apple_pay_using_networks_and_capabilities \(String(canMakePaymentsUsingNetworksAndCapabilities))")
433+
}
434+
.smallFont()
435+
.frame(maxWidth: .infinity)
436+
.accessibilityIdentifier("applePayPaymentReadinessLabel")
437+
.foregroundColor(.black)
438+
425439
Button {
426440
isFocused = false
427441

@@ -437,6 +451,7 @@ struct StandaloneUrlView: View {
437451
.frame(height: 48)
438452
.accessibilityIdentifier("applePayExampleAppButton")
439453
}
454+
.disabled(viewModel.isLoadingNativePayment)
440455
.foregroundColor(.white)
441456
.background(.black)
442457
.cornerRadius(30)
@@ -457,6 +472,7 @@ struct StandaloneUrlView: View {
457472
.frame(height: 48)
458473
.accessibilityIdentifier("applePayCharityButton")
459474
}
475+
.disabled(viewModel.isLoadingNativePayment)
460476
.foregroundColor(.white)
461477
.background(.black)
462478
.cornerRadius(30)
@@ -478,6 +494,7 @@ struct StandaloneUrlView: View {
478494
.accessibilityIdentifier("webBasedButton")
479495

480496
}
497+
.disabled(viewModel.isLoadingNativePayment)
481498
.foregroundColor(.white)
482499
.background(.black)
483500
.cornerRadius(30)
@@ -497,6 +514,7 @@ struct StandaloneUrlView: View {
497514
.accessibilityIdentifier("webBasedButton")
498515

499516
}
517+
.disabled(viewModel.isLoadingNativePayment)
500518
.foregroundColor(.white)
501519
.background(.black)
502520
.cornerRadius(30)
@@ -522,6 +540,7 @@ struct StandaloneUrlView: View {
522540
.accessibilityIdentifier("webBasedButton")
523541

524542
}
543+
.disabled(viewModel.isLoadingNativePayment)
525544
.foregroundColor(.white)
526545
.background(.black)
527546
.cornerRadius(30)

Example-app/en.lproj/Localizable.strings

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"stand_alone_url_payment_base_url" = "Base URL";
1212
"stand_alone_url_payment_complete_url" = "Complete URL";
1313
"stand_alone_url_payment_cancel_url" = "Cancel URL";
14-
"stand_alone_url_payment_checkout_v3" = "Use CheckoutV3";
14+
"stand_alone_url_payment_checkout_v3" = "Use Checkout V3";
1515
"stand_alone_url_payment_payment_url" = "Payment URL";
1616
"stand_alone_url_payment_payment_url_scheme" = "swedbankexample://";
1717
"stand_alone_url_payment_session_url" = "Session URL";
@@ -25,9 +25,12 @@
2525
"stand_alone_url_payment_abort" = "Abort";
2626
"stand_alone_url_payment_session_end_state_reached" = "Something went wrong with the payment";
2727
"stand_alone_internal_inconsistency_error" = "Something was called it the wrong order";
28+
"stand_alone_abort_payment_not_allowed" = "Abort payment currently not possible";
2829
"stand_alone_generic_error_title" = "Something went wrong";
2930
"stand_alone_url_seamless_title" = "Seamless View";
3031
"stand_alone_url_payment_web" = "Get payment menu";
3132
"stand_alone_url_payment_web_restricted" = "Get payment menu\nRestricted to non native";
3233
"stand_alone_url_payment_apple_pay" = "ApplePay";
34+
"stand_alone_url_payment_apple_pay_can_make_payments %@" = "Can make payments: %@";
35+
"stand_alone_url_payment_apple_pay_using_networks_and_capabilities %@" = "...using networks and capabilities: %@";
3336
"stand_alone_url_payment_web_based" = "Web Based";

0 commit comments

Comments
 (0)