Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d3e9384
SP-5 Added Standalone URL payment feature
AndreasDev3 May 15, 2023
2bc9371
Merge branch 'feature/standalone-url-payment' into 'develop'
AndreasDev3 May 15, 2023
ba83498
added codescanner to scan qrs and fill url fields
johanmobility Sep 26, 2023
1835658
Merge branch 'feature/add-barcode-scanner' into 'develop'
johanmobility Sep 26, 2023
6eadc41
standalone textfield updates, add payment URL scheme, iOS bump 14.0 -…
johanmobility Nov 2, 2023
4417e54
Merge branch 'fix/update-textfields' into 'develop'
johanmobility Nov 2, 2023
3fda928
Native Payment
mbalsiger May 15, 2024
4d4248e
Added internalInconsistencyError
mbalsiger May 30, 2024
ff349cd
Code Review Fixes
mbalsiger May 31, 2024
3927597
Moving Swedbank Pay SDK SPM dependency to feature/native-payments branch
alleus May 31, 2024
45655f1
Bumping Xcode version for deploy script
alleus May 31, 2024
9fa8991
Deployment workflow test
alleus Nov 8, 2023
1006231
SP-43 Example app improvements
mbalsiger Jun 3, 2024
b6d9f24
Merge branch 'feature/SP-43-Example-app-improvements' into 'feature/n…
mbalsiger Jun 4, 2024
276f753
Added header for Payment URL
mbalsiger Jun 5, 2024
1dc68d1
SP-45 CreditCard prefills and payment attempt
mbalsiger Jun 5, 2024
acf3316
WIP: SP-51 SCA Redirect
mbalsiger Jun 13, 2024
49da756
SP-55 Automatic configuration
mbalsiger Jun 24, 2024
239a23a
WIP: Renames
mbalsiger Jun 27, 2024
3bb971b
SP-59 Stöd för att visa betalmenyn
mbalsiger Jun 28, 2024
dc21eef
Code Review fixes
mbalsiger Jun 28, 2024
2192777
Merge branch 'feature/SP-59-Stöd-för-att-visa-betalmenyn' into 'featu…
mbalsiger Jun 28, 2024
147c5fc
Clean up
mbalsiger Jul 1, 2024
8897b44
WIP: SP-72 Grundfunktionalitet för Apple Pay
mbalsiger Sep 18, 2024
fe844f6
com.apple.developer.in-app-payments
mbalsiger Sep 18, 2024
c3d38b5
Added merchantIdentifier
mbalsiger Sep 26, 2024
ee71971
Remove ApplePayFailed
mbalsiger Sep 30, 2024
e36f312
SP-58 Stöd för nytt betalkort
mbalsiger Sep 25, 2024
1a4b649
Code Review fixes
mbalsiger Oct 1, 2024
5b4ba16
Move paymentSession3DSecureViewControllerLoadFailed into sdkProblemOc…
mbalsiger Oct 1, 2024
26f3d34
Merge branch 'feature/SP-58-Stöd-för-nytt-betalkort' into 'feature/na…
alleus Oct 1, 2024
e209fa7
Adding entitlements file specification to code signing in deploy script
alleus Oct 2, 2024
a67f5f5
Merge branch 'alleus/entitlements-in-deploy-script' into 'feature/nat…
alleus Oct 3, 2024
a553020
Added a Apple Pay Charity button
mbalsiger Oct 3, 2024
1ba1b7c
Merge branch 'feature/added-charity' into 'feature/native-payments'
alleus Oct 3, 2024
4c11c1c
Support for web based instruments as well as payment menu with or wit…
alleus Nov 13, 2024
048c57e
Merge branch 'feature/SP-60-konfiguration-av-betalmenyn' into 'featur…
alleus Nov 14, 2024
333019e
Tweaking payment menu buttons and code
alleus Nov 15, 2024
9b0b0c2
Removing handling of legacy local clientAppLaunchFailed error
alleus Nov 19, 2024
f226fc6
Merge branch 'feature/client-app-launch-failed-serverside' into 'feat…
alleus Nov 19, 2024
77f7bf2
Moving to SDK production version 5.0.0
alleus Nov 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/deploy_new_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ on:

jobs:
deploy:
runs-on: macos-latest
runs-on: macos-13
steps:
- uses: actions/checkout@v3
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "14.2"
xcode-version: "15.0.1"
- run: swift run
working-directory: ./deploy_new_version
env:
Expand Down
107 changes: 92 additions & 15 deletions Example-app.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions Example-app/Base.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//General
"general_checkout" = "Checkout";
"general_ok" = "OK";
"general_retry" = "Retry";

// Stand-alone URL View Controller
"stand_alone_url_payment_successful" = "Payment completed";
"stand_alone_url_payment_cancelled" = "Payment cancelled";

"stand_alone_url_payment_view_checkout_url" = "View checkout URL";
"stand_alone_url_payment_base_url" = "Base URL";
"stand_alone_url_payment_complete_url" = "Complete URL";
"stand_alone_url_payment_cancel_url" = "Cancel URL";
"stand_alone_url_payment_checkout_v3" = "Use Checkout V3";
"stand_alone_url_payment_payment_url" = "Payment URL";
"stand_alone_url_payment_payment_url_scheme" = "swedbankexample://";
"stand_alone_url_payment_session_url" = "Session URL";
"stand_alone_url_payment_get_session" = "Get Session";
"stand_alone_url_payment_swish_number" = "Swish number";
"stand_alone_url_payment_swish" = "Swish";
"stand_alone_url_payment_swish_device" = "Swish using this device";
"stand_alone_url_payment_swish_prefill %@" = "Swish: %@";
"stand_alone_url_payment_credit_card_prefill %@" = "Credit Card: %@";
"stand_alone_url_payment_new_credit_card" = "New Credit Card";
"stand_alone_url_payment_abort" = "Abort";
"stand_alone_url_payment_session_end_state_reached" = "Something went wrong with the payment";
"stand_alone_internal_inconsistency_error" = "Something was called it the wrong order";
"stand_alone_generic_error_title" = "Something went wrong";
"stand_alone_url_seamless_title" = "Seamless View";
"stand_alone_url_payment_web" = "Get payment menu";
"stand_alone_url_payment_web_restricted" = "Get payment menu\nRestricted to non native";
"stand_alone_url_payment_apple_pay" = "ApplePay";
"stand_alone_url_payment_web_based" = "Web Based";
145 changes: 109 additions & 36 deletions Example-app/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions Example-app/Example-app.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,10 @@
<string>applinks:pp-dot-payex-merchant-samples.ey.r.appspot.com</string>
<string>applinks:payex-merchant-samples-prod.appspot.com</string>
</array>
<key>com.apple.developer.in-app-payments</key>
<array>
<string>merchant.com.swedbankpay.exampleapp</string>
<string>merchant.com.swedbankpay.charity</string>
</array>
</dict>
</plist>
11 changes: 11 additions & 0 deletions Example-app/Extensions/String+Localize.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Foundation

extension String {
var localize: String {
return NSLocalizedString(self, comment: "")
}

func localize(_ arguments: CVarArg...) -> String {
return String(format: self.localize, arguments: arguments)
}
}
6 changes: 3 additions & 3 deletions Example-app/Images.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "download-2.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "original"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "download.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "original"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions Example-app/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
<false/>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>Appen behöver åtkomst till kameran för att kunna skanna koder.</string>
<key>UIAppFonts</key>
<array>
<string>IBMPlexMono-Medium.ttf</string>
Expand Down
25 changes: 25 additions & 0 deletions Example-app/Models/ScanUrl.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
enum ScanUrl: String {
case checkout
case base
case complete
case cancel
case payment
case sessionApi
case swish
case unknown

func toKey() -> StorageHelper.Key? {
switch self {
case .base:
return .baseUrl
case .complete:
return .completeUrl
case .cancel:
return .cancelUrl
case .payment:
return .paymentUrl
default:
return nil
}
}
}
29 changes: 29 additions & 0 deletions Example-app/Utilities/StorageHelper.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import Foundation

struct StorageHelper {

enum Key: String, CaseIterable {
case baseUrl
case completeUrl
case cancelUrl
case useCheckoutV3
case paymentUrl

var storageString: String {
return "Storage\(self.rawValue)"
}
}

static let shared = StorageHelper()

private let store = UserDefaults.standard

// MARK: Generic methods
func save<T>(value: T, forKey key: Key) {
store.set(value, forKey: key.storageString)
}

func value<T>(for key: Key) -> T? {
return store.value(forKey: key.storageString) as? T
}
}
36 changes: 36 additions & 0 deletions Example-app/Utilities/SwedbankPayConfiguration.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import Foundation
import SwedbankPaySDK

enum SwedbankPayConfigurationError: Error {
case notImplemented
}

class SwedbankPayConfiguration {
let orderInfo: SwedbankPaySDK.ViewPaymentOrderInfo

init(isV3: Bool = true, webViewBaseURL: URL?,
viewPaymentLink: URL, completeUrl: URL, cancelUrl: URL?,
paymentUrl: URL? = nil, termsOfServiceUrl: URL? = nil) {
self.orderInfo = SwedbankPaySDK.ViewPaymentOrderInfo(
isV3: isV3,
webViewBaseURL: webViewBaseURL,
viewPaymentLink: viewPaymentLink,
completeUrl: completeUrl,
cancelUrl: cancelUrl,
paymentUrl: paymentUrl,
termsOfServiceUrl: termsOfServiceUrl
)
}
}

extension SwedbankPayConfiguration: SwedbankPaySDKConfiguration {

// This delegate method is not used but required
func postConsumers(consumer: SwedbankPaySDK.Consumer?, userData: Any?, completion: @escaping (Result<SwedbankPaySDK.ViewConsumerIdentificationInfo, Error>) -> Void) {
completion(.failure(SwedbankPayConfigurationError.notImplemented))
}

func postPaymentorders(paymentOrder: SwedbankPaySDK.PaymentOrder?, userData: Any?, consumerProfileRef: String?, options: SwedbankPaySDK.VersionOptions, completion: @escaping (Result<SwedbankPaySDK.ViewPaymentOrderInfo, Error>) -> Void) {
completion(.success(orderInfo))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Foundation
import SwiftUI
import UIKit

class PaymentAlternativesViewController: UIViewController {

@IBSegueAction func showStandaloneUrlView(_ coder: NSCoder) -> UIViewController? {
return UIHostingController(coder: coder, rootView: StandaloneUrlView())
}
}
14 changes: 14 additions & 0 deletions Example-app/ViewControllers/PaymentViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,25 @@ extension PaymentViewController: SwedbankPaySDKDelegate {
performSegue(withIdentifier: "showResult", sender: self)
}

func sessionProblemOccurred(problem: SwedbankPaySDK.ProblemDetails) {
PaymentViewModel.shared.setResult(.unknown)
performSegue(withIdentifier: "showResult", sender: self)
}

func sdkProblemOccurred(problem: SwedbankPaySDK.PaymentSessionProblem) {
PaymentViewModel.shared.setResult(.unknown)
performSegue(withIdentifier: "showResult", sender: self)
}

func paymentCanceled() {
PaymentViewModel.shared.setResult(.unknown)
performSegue(withIdentifier: "backToStore", sender: self)
}

func paymentSessionFetched(availableInstruments: [SwedbankPaySDK.AvailableInstrument]) {

}

func updatePaymentOrderFailed(updateInfo: Any, error: Error) {
updateInstrumentUI()

Expand Down
Loading
Loading