Skip to content

Commit 048c57e

Browse files
committed
Merge branch 'feature/SP-60-konfiguration-av-betalmenyn' into 'feature/native-payments'
Support for web based instruments as well as payment menu with or without restriction to instruments See merge request swedbank-pay/swedbank-pay-example-app-ios!11
2 parents 1ba1b7c + 4c11c1c commit 048c57e

File tree

3 files changed

+43
-3
lines changed

3 files changed

+43
-3
lines changed

Example-app/Base.lproj/Localizable.strings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@
2929
"stand_alone_generic_error_title" = "Something went wrong";
3030
"stand_alone_url_seamless_title" = "Seamless View";
3131
"stand_alone_url_payment_web" = "Get payment menu";
32+
"stand_alone_url_payment_web_restricted" = "Get payment menu (restricted 2 first)";
3233
"stand_alone_url_payment_apple_pay" = "ApplePay";
34+
"stand_alone_url_payment_web_based" = "Web Based";

Example-app/Views/StandaloneUrlView.swift

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,15 +461,51 @@ struct StandaloneUrlView: View {
461461
.background(.black)
462462
.cornerRadius(30)
463463
.padding(.top, 10)
464-
case .webBased(identifier: let identifier):
465-
EmptyView()
464+
case .webBased(let paymentMethod):
465+
Button {
466+
isFocused = false
467+
468+
viewModel.isLoadingNativePayment = true
469+
viewModel.nativePayment?.createSwedbankPaySDKController(mode: .instrumentMode(instrument: instrument))
470+
} label: {
471+
VStack(spacing: 0) {
472+
Text("stand_alone_url_payment_web_based")
473+
Text(paymentMethod)
474+
}
475+
.smallFont()
476+
.frame(maxWidth: .infinity)
477+
.frame(height: 48)
478+
.accessibilityIdentifier("webBasedButton")
479+
480+
}
481+
.foregroundColor(.white)
482+
.background(.black)
483+
.cornerRadius(30)
484+
.padding(.top, 10)
466485
}
467486
}
468487

469488
Button {
470489
isFocused = false
471490

472-
viewModel.nativePayment?.createSwedbankPaySDKController()
491+
viewModel.nativePayment?.createSwedbankPaySDKController(mode: .menu(restrictedToInstruments: [availableInstruments[0], availableInstruments[1]]))
492+
} label: {
493+
Text("stand_alone_url_payment_web_restricted")
494+
.smallFont()
495+
.frame(maxWidth: .infinity)
496+
.frame(height: 48)
497+
.accessibilityIdentifier("webBasedButton")
498+
499+
}
500+
.foregroundColor(.white)
501+
.background(.black)
502+
.cornerRadius(30)
503+
.padding(.top, 10)
504+
505+
Button {
506+
isFocused = false
507+
508+
viewModel.nativePayment?.createSwedbankPaySDKController(mode: .menu(restrictedToInstruments: nil))
473509
} label: {
474510
Text("stand_alone_url_payment_web")
475511
.smallFont()

Example-app/en.lproj/Localizable.strings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@
2929
"stand_alone_generic_error_title" = "Something went wrong";
3030
"stand_alone_url_seamless_title" = "Seamless View";
3131
"stand_alone_url_payment_web" = "Get payment menu";
32+
"stand_alone_url_payment_web_restricted" = "Get payment menu (restricted 2 first)";
3233
"stand_alone_url_payment_apple_pay" = "ApplePay";
34+
"stand_alone_url_payment_web_based" = "Web Based";

0 commit comments

Comments
 (0)