Skip to content

Commit

Permalink
YandexPaySDK 1.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kravtsovguy committed Jun 26, 2024
1 parent 9844da3 commit 97e9b39
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Demo/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ platform :ios, DEPLOYMENT_VERSION
inhibit_all_warnings!

target 'YandexPaySDKDemoApp' do
pod 'YandexPaySDK', '~> 1.8.0'
pod 'YandexPaySDK', '~> 1.9.0'
end

post_install do |installer|
Expand Down
5 changes: 2 additions & 3 deletions Demo/YandexPaySDKDemoApp/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>yandexauth</string>
<string>yandexauth2</string>
<string>yandexauth4</string>
<string>primaryyandexloginsdk</string>
<string>secondaryyandexloginsdk</string>
</array>
<key>UIApplicationSceneManifest</key>
<dict>
Expand Down
41 changes: 26 additions & 15 deletions Demo/YandexPaySDKDemoApp/PaymentURLViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,24 @@ final class PaymentURLViewController: UIViewController {
return
}

// Создайте кнопку
let button = YandexPaySDKApi.instance.createButton(dataSource: self, delegate: self)

// Есть возможность настроить отображение кнопки
button.preferredPaymentMethods = [.card, .split]
button.appearance = .system
button.order = (100, .rub)
button.cornerRadius = 16
button.isBordered = false
button.isLoading = false
let buttonModel = YPButtonModel(
amount: 1000,
currency: .rub,
preferredPaymentMethods: [.card, .split],
appearance: .system,
cornerRadius: 16,
isLoading: false,
isBordered: false
)

// Создайте кнопку
let button: UIView = YandexPaySDKApi.instance.createButton(
model: buttonModel,
paymentDataProvider: self,
presentationContextProvider: self,
delegate: self
)

// Добавьте кнопку в иерархию
view.addSubview(button)
Expand All @@ -37,9 +45,9 @@ final class PaymentURLViewController: UIViewController {
}
}

// MARK: - YandexPayButtonDataSource
// MARK: - YPButtonPaymentDataProviding

extension PaymentURLViewController: YandexPayButtonDataSource {
extension PaymentURLViewController: YPButtonPaymentDataProviding {
func paymentUrl(for yandexPayButton: YandexPayButtonProtocol) async throws -> String {
// Запросите paymentUrl (создайте заказ) асинхронно с вашего бекенда
await withCheckedContinuation { continuation in
Expand All @@ -49,11 +57,14 @@ extension PaymentURLViewController: YandexPayButtonDataSource {
}
}
}
}

func viewControllerForPresentation(for yandexPayButton: YandexPayButtonProtocol) -> UIViewController {
// Предоставьте UIViewController, с которого необходимо показать форму YandexPay по нажатию на кнопку
self
}
// MARK: - YPButtonPaymentDataProviding

extension PaymentURLViewController: YPButtonPresentationContextProviding {
func anchorForPresentation(for yandexPayButton: any YandexPayButtonProtocol) -> YPPresentationContext {
.viewController(self)
}
}

// MARK: - YandexPayButtonDelegate
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ let package = Package(
targets: [
.binaryTarget(
name: "YandexPaySDK",
url: "https://github.com/yandexmobile/yandex-pay-ios/releases/download/v1.8.0/YandexPaySDK.xcframework.zip",
checksum: "d2f224ea0f6dfb6dce043ca7bfdaa1fb04b5fd8676d34ff85cd1bb7b5f2959ab"
url: "https://github.com/yandexmobile/yandex-pay-ios/releases/download/v1.9.0/YandexPaySDK.xcframework.zip",
checksum: "59de8879f232fd3f2302eec672937b3c89c923bc0ee0ed12ebc9fd3d04fd04e7"
),
.binaryTarget(
name: "Varioqub",
Expand Down

0 comments on commit 97e9b39

Please sign in to comment.