sbp

Форк
0

4 месяца назад
4 месяца назад
4 месяца назад
4 месяца назад
2 года назад
2 года назад
4 месяца назад
4 месяца назад
4 месяца назад
README.md

SDK для работы с СБП НСПК

Latest release

contact: @lexkraev Telegram Group

Swift package for service SBP (СБП), more details about SBP you can find here.

Quick Start

with UIKit

you may define smth like this:

import SwiftUI
import SBP
@available(iOS 13.0, *)
final class SBPay {
func chooseBank(on viewController: UIViewController,
presentationStyle: UIModalPresentationStyle = .fullScreen,
completion: @escaping (String) -> (),
onClose: @escaping () -> ()) {
registerFonts()
let vc = UIHostingController(rootView: BanksView() {
print($0)
completion($0)
viewController.presentedViewController?.dismiss(animated: true)
} onCloseTap: {
onClose()
viewController.presentedViewController?.dismiss(animated: true)
})
vc.modalPresentationStyle = presentationStyle
viewController.present(vc, animated: true)
}
}
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
SBPay().chooseBank(on: self) {
print($0)
}
}
}

with SwiftUI

Just use BanksView()

project settings

also you need add LSApplicationQueriesSchemes key into you project info.plst

<key>LSApplicationQueriesSchemes</key>
<array>
<string>bank100000000000</string>
<string>bank100000000001</string>
...
<string>bank100000000999</string>
<string>bank100000001000</string>
</array>

Warning! Starting with iOS 15 there's limit in maximum 50 entries in list, so you probably need to take first 50 entries from c2bmembers.json. Look for details here.

That's need for UIApplication.shared.canOpenURL method worked correctly. You can copy and paste all lines from example

Different cases

Based on the infomartion above service is trying to find installed apps and then module opens screen with the list of bank apps:

Otherwise the service offers to choose the bank connected to SBP from the list:

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.