From 4c9c594154077ac7001fbba42313cbf333650f52 Mon Sep 17 00:00:00 2001 From: Dmitry Shakolo Date: Mon, 14 Aug 2023 18:02:30 +0300 Subject: [PATCH] Release 1.1.1 version --- CHANGELOG.md | 8 + README.md | 200 +++++++++++++++--- android/build.gradle | 4 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../flutter/TokenizationResultExtensions.kt | 1 + .../flutter/YookassaPaymentsFlutterPlugin.kt | 4 + .../gradle/wrapper/gradle-wrapper.properties | 2 +- example/ios/Podfile.lock | 75 +++---- example/lib/success_tokenization_screen.dart | 3 +- example/lib/tokenization_screen.dart | 3 +- example/pubspec.lock | 120 ++++++----- example/pubspec.yaml | 4 +- .../SwiftYookassaPaymentsFlutterPlugin.swift | 4 + ios/yookassa_payments_flutter.podspec | 2 +- lib/models/payment_method_types.dart | 9 +- lib/models/tokenization_result.dart | 2 + lib/yookassa_payments_flutter.dart | 4 +- pubspec.lock | 115 +++++----- pubspec.yaml | 4 +- 19 files changed, 381 insertions(+), 185 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6dec75..3c06a7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# 1.1.1 + +* Fix SBP implementation readme. Fix and improve UI + +# 1.1.0 + +* Support new payment method — SBP + # 1.0.6 * Fix crash with 3DS confirmation for Android Platform diff --git a/README.md b/README.md index 59a003b..c037e3d 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,9 @@ await YookassaPaymentsFlutter.confirmation("3ds / App2App ссылка", result. `.yooMoney` — ЮMoney (платежи из кошелька или привязанной картой)\ `.bankCard` — банковская карта (карты можно сканировать)\ `.sberbank` — SberPay (с подтверждением через приложение Сбербанк Онлайн, если оно установленно, иначе с подтверждением по смс)\ +`.applePay` — Apple Pay\ +`.googlePay` — Google Pay +`.sbp` - СБП\ ## Настройка способов оплаты @@ -150,6 +153,21 @@ if (<Условие для ЮMoney>) { paymentMethodTypes.add(PaymentMethod.yooMoney); } +if <Условие для Apple Pay> { + // Добавляем в paymentMethodTypes элемент `.applePay` + paymentMethodTypes.insert(.applePay) +} + +if <Условие для Google Pay> { + // Добавляем в paymentMethodTypes элемент `.googlePay` + paymentMethodTypes.insert(.googlePay) +} + +if <Условие для СБП> { + // Добавляем в paymentMethodTypes элемент `.sbp` + paymentMethodTypes.insert(.sbp) +} + var settings = TokenizationSettings(PaymentMethodTypes(paymentMethodTypes)); ``` @@ -229,19 +247,6 @@ func application( ) } -@available(iOS 9.0, *) -func application( - _ app: UIApplication, - open url: URL, - options: [UIApplication.OpenURLOptionsKey: Any] = [:] -) -> Bool { - return YKSdk.shared.handleOpen( - url: url, - sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String - ) -} -``` - 4. В `Info.plist` добавьте следующие строки: ```plistbase @@ -303,19 +308,6 @@ func application( ) } -@available(iOS 9.0, *) -func application( - _ app: UIApplication, - open url: URL, - options: [UIApplication.OpenURLOptionsKey: Any] = [:] -) -> Bool { - return YKSdk.shared.handleOpen( - url: url, - sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String - ) -} -``` - 3. В `Info.plist` добавьте следующие строки: ```plistbase @@ -340,7 +332,130 @@ func application( где `examplescheme` - схема для открытия вашего приложения, которую вы указали в `applicationScheme` при создании `TokenizationModuleInputData`. Через эту схему будет открываться ваше приложение после успешной оплаты с помощью `SberPay`. -4. Обработка успешного подтверждения уже реализована в плагине. Плагин отобразит алерт с информацией об успешном подтверждении. +### SBP + +С помощью SDK можно провести платеж через СБП — с подтверждением оплаты через приложение банка. + +В `TokenizationModuleInputData` необходимо передавать `applicationScheme` – схема для возврата в ваше приложение после успешного подтверждения платежа в приложении банка. + +Пример `applicationScheme`: + +```swift +let moduleData = TokenizationModuleInputData( + ... + applicationScheme: "examplescheme://" +``` + +Чтобы провести платёж: + +1. При создании `TokenizationModuleInputData` в `TokenizationSettings` передайте значение `PaymentMethodTypes.sbp`. +2. Получите токен. +3. [Создайте платеж](https://yookassa.ru/developers/api#create_payment) с токеном по API ЮKassa. + +Для подтверждения платежа через выбранное пользователем банковское приложение: + +1. В `AppDelegate` импортируйте зависимость `YooKassaPayments`: + + ```swift + import YooKassaPayments + ``` + +2. Добавьте обработку ссылок через `YKSdk` в `AppDelegate`: + +```swift +func application( + _ application: UIApplication, + open url: URL, + sourceApplication: String?, + annotation: Any +) -> Bool { + return YKSdk.shared.handleOpen( + url: url, + sourceApplication: sourceApplication + ) +} +``` + +3. В `Info.plist` добавьте следующие строки: + +```plistbase +CFBundleURLTypes + + + CFBundleTypeRole + Editor + CFBundleURLName + ${BUNDLE_ID} + CFBundleURLSchemes + + examplescheme + + + +``` + +где `examplescheme` - схема для открытия вашего приложения, которую вы указали в `applicationScheme` при создании `TokenizationModuleInputData`. Через эту схему будет открываться ваше приложение после успешной оплаты с помощью `SberPay`. + +4. В `Info.plist` перечислить url-схемы приложений приоритетных для вас банков + +SDK пользователю отображается список банков, поддерживающих оплату `СБП`. При выборе конкретного банка из списка произойдет переход в соответствующее банковское приложение. +Список банков в SDK сформирован на основе ответа [НСПК](https://qr.nspk.ru/proxyapp/c2bmembers.json). Он содержит более тысячи банков, и для удобства SDK в первую очередь отображает список популярных банков, которые чаще всего используют для оплаты. Для проверки факта установки приложения на телефоне мы используем системную функцию [canOpenURL(:)](https://developer.apple.com/documentation/uikit/uiapplication/1622952-canopenurl). Данная функция возвращает корректный ответ только для схем добавленных в `Info.plist` с ключом `LSApplicationQueriesSchemes`. +Поэтому для корректного отображения списка популярных банков вам необходимо внести в `Info.plist` их url-схемы: + +```plistbase +LSApplicationQueriesSchemes + + bank100000000111 // Сбербанк + bank100000000004 // Тинькофф + bank110000000005 // ВТБ + bank100000000008 // Альфа + bank100000000007 // Райфайзен + bank100000000015 // Открытие + +``` + +Если список не добавлять в `Info.plist`, SDK сразу отобразит полный список банков поддерживающих оплату `СБП`. + +5. Добавьте уникальную схему в `build.gradle` +Для добавления уникальной схемы диплинка нужно добавить в ваш файл `build.gradle` в блок android.defaultConfig строку `resValue "string", "ym_app_scheme", "exampleapp"` +``` +android { + defaultConfig { + resValue "string", "ym_app_scheme", "exampleapp" + } +} +``` +Или добавить в ваш strings.xml строку вида: +``` + + exampleapp + +``` +Где `exampleapp` - это уникальная схема диплинка вашего приложения. + +6. Для подтверждения платежа при оплате через СБП необходимо запустить сценарий подтверждения: + +```dart +var clientApplicationKey = "<Ключ для клиентских приложений>"; + +await YookassaPaymentsFlutter.confirmation(confirmationUrl, PaymentMethod.sbp, clientApplicationKey); +) +``` +`confirmationUrl` вы получите в ответе от API ЮKassa при [создании платежа](https://yookassa.ru/developers/api#create_payment); он имеет вид "https://qr.nspk.ru/id?type=&bank=&sum=&cur=&crc=&payment_id=" + +7. После того, как пользователь пройдет процесс подтверждения платежа или пропустит его будет вызван метод протокола `TokenizationModuleOutput`. Обработайте в нем результат подтверждения: + +```swift +func didFinishConfirmation(paymentMethodType: PaymentMethodType) { + guard let result = flutterResult else { return } + DispatchQueue.main.async { [weak self] in + if let controller = yoomoneyController { + controller.dismiss(animated: true) + } + } + result("{\"paymentMethodType\": \"\(paymentMethodType.rawValue)\"}") +} +``` ## Описание публичных параметров @@ -453,13 +568,40 @@ func application( Отправьте токен на ваш сервер и после успешной оплаты закройте модуль.\ Если ваш сервер сообщил о необходимости подтверждения платежа (т.е. платёж пришёл со статусом `pending`), вызовите метод `confirmation(confirmationUrl, paymentMethodType)`. -Примеры кода: +Пример кода: ```dart -await YookassaPaymentsFlutter.confirmation(controller.text, result.paymentMethodType); +await YookassaPaymentsFlutter.confirmation(confirmationUrl, result.paymentMethodType); ) ``` +Если тип платежа - СБП необходимо также передать clientApplicationKey - Ключ для клиентских приложений из личного кабинета ЮKassa + +Пример кода: + +```dart + +var clientApplicationKey = "<Ключ для клиентских приложений>"; + +await YookassaPaymentsFlutter.confirmation(confirmationUrl, result.paymentMethodType, clientApplicationKey); +) +``` +`confirmationUrl` вы получите в ответе от API ЮKassa при [создании платежа](https://yookassa.ru/developers/api#create_payment); он имеет вид "https://qr.nspk.ru/id?type=&bank=&sum=&cur=&crc=&payment_id=" + +После того, как пользователь пройдет процесс подтверждения платежа или пропустит его будет вызван метод протокола `TokenizationModuleOutput`. Обработайте в нем результат подтверждения: + +```swift +func didFinishConfirmation(paymentMethodType: PaymentMethodType) { + guard let result = flutterResult else { return } + DispatchQueue.main.async { [weak self] in + if let controller = yoomoneyController { + controller.dismiss(animated: true) + } + } + result("{\"paymentMethodType\": \"\(paymentMethodType.rawValue)\"}") +} +``` + ## Логирование У вас есть возможность включить логирование всех сетевых запросов.\ diff --git a/android/build.gradle b/android/build.gradle index 64cffbd..2d29674 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -8,7 +8,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.0.3' + classpath 'com.android.tools.build:gradle:7.3.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -52,5 +52,5 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'ru.yoomoney.sdk.kassa.payments:yookassa-android-sdk:6.6.2' + implementation 'ru.yoomoney.sdk.kassa.payments:yookassa-android-sdk:6.7.1' } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index c17bc40..7645e29 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip diff --git a/android/src/main/kotlin/ru/yoomoney/sdk/kassa/payments/flutter/TokenizationResultExtensions.kt b/android/src/main/kotlin/ru/yoomoney/sdk/kassa/payments/flutter/TokenizationResultExtensions.kt index 03e4052..e4ddb51 100644 --- a/android/src/main/kotlin/ru/yoomoney/sdk/kassa/payments/flutter/TokenizationResultExtensions.kt +++ b/android/src/main/kotlin/ru/yoomoney/sdk/kassa/payments/flutter/TokenizationResultExtensions.kt @@ -13,6 +13,7 @@ fun TokenizationResult.toJson(): String { PaymentMethodType.BANK_CARD -> "bank_card" PaymentMethodType.SBERBANK -> "sberbank" PaymentMethodType.GOOGLE_PAY -> "google_pay" + PaymentMethodType.SBP -> "sbp" }) return json.toString() } \ No newline at end of file diff --git a/android/src/main/kotlin/ru/yoomoney/sdk/kassa/payments/flutter/YookassaPaymentsFlutterPlugin.kt b/android/src/main/kotlin/ru/yoomoney/sdk/kassa/payments/flutter/YookassaPaymentsFlutterPlugin.kt index 8f0ff7f..98dd7a4 100644 --- a/android/src/main/kotlin/ru/yoomoney/sdk/kassa/payments/flutter/YookassaPaymentsFlutterPlugin.kt +++ b/android/src/main/kotlin/ru/yoomoney/sdk/kassa/payments/flutter/YookassaPaymentsFlutterPlugin.kt @@ -74,14 +74,17 @@ class YookassaPaymentsFlutterPlugin: FlutterPlugin, MethodCallHandler, ActivityA "yooMoney" -> PaymentMethodType.YOO_MONEY "sberbank" -> PaymentMethodType.SBERBANK "googlePay" -> PaymentMethodType.GOOGLE_PAY + "sbp" -> PaymentMethodType.SBP else -> PaymentMethodType.BANK_CARD } val url = data["url"] as String + val clientApplicationKey = data["clientApplicationKey"] as String? val intent: Intent = Checkout.createConfirmationIntent( context = context, confirmationUrl = url, + clientApplicationKey = clientApplicationKey, paymentMethodType = paymentMethod ) @@ -213,6 +216,7 @@ private fun PaymentMethodType(data: Map): Set "PaymentMethod.yooMoney" -> paymentMethodTypes.add(PaymentMethodType.YOO_MONEY) "PaymentMethod.sberbank" -> paymentMethodTypes.add(PaymentMethodType.SBERBANK) "PaymentMethod.googlePay" -> paymentMethodTypes.add(PaymentMethodType.GOOGLE_PAY) + "PaymentMethod.sbp" -> paymentMethodTypes.add(PaymentMethodType.SBP) } } return paymentMethodTypes diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index ed1a787..4169f5c 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip \ No newline at end of file diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index df1fba5..1ee18c7 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1,39 +1,40 @@ PODS: - - Flutter (3.0.0) + - Flutter (1.0.0) - FunctionalSwift (1.8.0) - - MoneyAuth (3.4.0): - - FunctionalSwift - - ThreatMetrixAdapter - - YooMoneyCoreApi - - ThreatMetrixAdapter (3.3.3) - - TMXProfiling (1.0.1) - - TMXProfilingConnections (1.0.1) - - YandexMobileMetrica/Dynamic (4.2.0): - - YandexMobileMetrica/Dynamic/Core (= 4.2.0) - - YandexMobileMetrica/Dynamic/Crashes (= 4.2.0) - - YandexMobileMetrica/Dynamic/Core (4.2.0) - - YandexMobileMetrica/Dynamic/Crashes (4.2.0): + - MobileSdk (2.0.0) + - MoneyAuth (6.1.0): + - FunctionalSwift (~> 1.8) + - YooMoneyCoreApi (~> 2.1) + - YooMoneyUI (~> 6.0) + - YandexMobileMetrica/Dynamic (4.5.2): + - YandexMobileMetrica/Dynamic/Core (= 4.5.2) + - YandexMobileMetrica/Dynamic/Crashes (= 4.5.2) + - YandexMobileMetrica/Dynamic/Core (4.5.2) + - YandexMobileMetrica/Dynamic/Crashes (4.5.2): - YandexMobileMetrica/Dynamic/Core - yookassa_payments_flutter (0.0.1): - Flutter - - YooKassaPayments (= 6.8.0) - - YooKassaPayments (6.8.0): - - MoneyAuth (~> 3.4.0) - - ThreatMetrixAdapter (~> 3.3.3) - - TMXProfiling (= 1.0.1) - - TMXProfilingConnections (= 1.0.1) + - YooKassaPayments (= 6.12.0) + - YooKassaPayments (6.12.0): + - MoneyAuth (~> 6.1.0) - YandexMobileMetrica/Dynamic (>= 3.0) - - YooKassaPaymentsApi (~> 2.11.0) + - YooKassaPaymentsApi (~> 2.20.1) - YooKassaWalletApi (~> 2.3.1) - YooMoneyCoreApi (~> 2.1.0) - - YooKassaPaymentsApi (2.11.0): + - YooMoneySessionProfiler (~> 5.0.1) + - YooMoneyUI (~> 6.2.0) + - YooKassaPaymentsApi (2.20.1): - FunctionalSwift - - YooMoneyCoreApi - - YooKassaWalletApi (2.3.1): + - YooMoneyCoreApi (~> 2.1) + - YooKassaWalletApi (2.3.2): - FunctionalSwift - YooMoneyCoreApi - YooMoneyCoreApi (2.1.0): - FunctionalSwift (~> 1.8.0) + - YooMoneySessionProfiler (5.0.1): + - MobileSdk (~> 2.0) + - YooMoneyUI (6.2.0): + - FunctionalSwift DEPENDENCIES: - Flutter (from `Flutter`) @@ -42,14 +43,14 @@ DEPENDENCIES: SPEC REPOS: https://git.yoomoney.ru/scm/sdk/cocoa-pod-specs.git: - FunctionalSwift + - MobileSdk - MoneyAuth - - ThreatMetrixAdapter - - TMXProfiling - - TMXProfilingConnections - YooKassaPayments - YooKassaPaymentsApi - YooKassaWalletApi - YooMoneyCoreApi + - YooMoneySessionProfiler + - YooMoneyUI https://github.com/CocoaPods/Specs.git: - YandexMobileMetrica @@ -60,19 +61,19 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/yookassa_payments_flutter/ios" SPEC CHECKSUMS: - Flutter: 6f378e544fdb3c2db75671011442c5eaf902d3c4 + Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 FunctionalSwift: b65b0a7ddde7f11a11e794f79a1e8009724ed0bd - MoneyAuth: 8f2e4968132e0d187c1f33b6a99f998220c22135 - ThreatMetrixAdapter: 683cc07cd1faee65c14292f7d748d56b92ff34c9 - TMXProfiling: a3b9808d62abf72227a366f2cbdca414ee38a023 - TMXProfilingConnections: e3984a86c3c338f13af682bb77a6d18474289b79 - YandexMobileMetrica: f5f9c605eaaba33ff6ab2b6bc3259035ca60ed87 - yookassa_payments_flutter: d3cefc2d375b816278cb1f22a85a74adfda274b8 - YooKassaPayments: 6e725f147d2dc30b1427518e72d6115e227c48a2 - YooKassaPaymentsApi: 1b2ea9cadc898717f6216dd0e84dbabd5294dfb4 - YooKassaWalletApi: ea6fd080bd4663c66fe5db0f37aafb999282048c + MobileSdk: 827ec8a9ef58a60f35e920cebaecf74f20a250c4 + MoneyAuth: dedc9545fa857e7b489333e92403fe608585e518 + YandexMobileMetrica: f5368ee93f286c793d73b58da00929babfc897c1 + yookassa_payments_flutter: 9c4a1c019f2b042ebbd0b45fe19380054240d70a + YooKassaPayments: 09f7cb2b3562130aed01d75bba653a8f0d96d9f6 + YooKassaPaymentsApi: d198a1da65988af52bd408d5d5d1c8cd93f039a2 + YooKassaWalletApi: cbb352525bfe89fd2ad52635062f79f8bbbc23ec YooMoneyCoreApi: ddf9ea035b9a3f8d0563b4da8e55652fa07040d3 + YooMoneySessionProfiler: 1a19bed99feca98c04e2a906908f91a7d5db408d + YooMoneyUI: 01f293ed3486e00c5244a5feded457e7cdc18074 -PODFILE CHECKSUM: b2e848e40e05488c9273432fb90c6c5918bb082f +PODFILE CHECKSUM: 6abfb72a0d401d5c53824cfe614a85f37a1a3040 COCOAPODS: 1.11.3 diff --git a/example/lib/success_tokenization_screen.dart b/example/lib/success_tokenization_screen.dart index 2718e91..b484837 100644 --- a/example/lib/success_tokenization_screen.dart +++ b/example/lib/success_tokenization_screen.dart @@ -55,8 +55,9 @@ class _SuccessTokenizationScreenState extends State { ), ElevatedButton( onPressed: () async { + var clientApplicationKey = "<Ключ для клиентских приложений>"; await YookassaPaymentsFlutter.confirmation( - controller.text, result.paymentMethodType); + controller.text, result.paymentMethodType, clientApplicationKey); showDialog( context: context, builder: (context) => const AlertDialog( diff --git a/example/lib/tokenization_screen.dart b/example/lib/tokenization_screen.dart index eb092ce..7bf99ab 100644 --- a/example/lib/tokenization_screen.dart +++ b/example/lib/tokenization_screen.dart @@ -64,7 +64,8 @@ class TokenizationScreenState extends State { tokenizationSettings: const TokenizationSettings(PaymentMethodTypes([ PaymentMethod.bankCard, PaymentMethod.yooMoney, - PaymentMethod.sberbank + PaymentMethod.sberbank, + PaymentMethod.sbp ])), testModeSettings: null); var result = diff --git a/example/pubspec.lock b/example/pubspec.lock index 3ab698c..8041475 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,58 +5,58 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.8.2" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" + version: "1.3.0" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" + url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.17.1" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + sha256: "1989d917fbe8e6b39806207df5a3fdd3d816cbd090fac2ce26fb45e9a71476e5" + url: "https://pub.dev" source: hosted version: "1.0.4" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -66,7 +66,8 @@ packages: dependency: "direct dev" description: name: flutter_lints - url: "https://pub.dartlang.org" + sha256: b543301ad291598523947dc534aaddc5aaad597b709d2426d3a0e0d44c5cb493 + url: "https://pub.dev" source: hosted version: "1.0.4" flutter_test: @@ -74,41 +75,54 @@ packages: description: flutter source: sdk version: "0.0.0" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" lints: dependency: transitive description: name: lints - url: "https://pub.dartlang.org" + sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c + url: "https://pub.dev" source: hosted version: "1.0.1" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" + url: "https://pub.dev" source: hosted - version: "0.12.11" + version: "0.12.15" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + url: "https://pub.dev" source: hosted - version: "0.1.3" + version: "0.2.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + url: "https://pub.dev" source: hosted - version: "1.7.0" + version: "1.9.1" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.8.3" sky_engine: dependency: transitive description: flutter @@ -118,65 +132,65 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + url: "https://pub.dev" source: hosted - version: "1.8.1" + version: "1.9.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb + url: "https://pub.dev" source: hosted - version: "0.4.8" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" + version: "0.5.1" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.4" yookassa_payments_flutter: dependency: "direct main" description: path: ".." relative: true source: path - version: "1.0.5" + version: "1.1.1" sdks: - dart: ">=2.15.0 <3.0.0" + dart: ">=3.0.0-0 <4.0.0" flutter: ">=2.10.5" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 833f018..a4016b7 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -6,7 +6,7 @@ description: Demonstrates how to use the yookassa_payments_flutter plugin. publish_to: 'none' # Remove this line if you wish to publish to pub.dev environment: - sdk: ">=2.12.0 <3.0.0" + sdk: ">=2.15.0 <4.0.0" # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions @@ -82,4 +82,4 @@ flutter: # weight: 700 # # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages \ No newline at end of file + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/ios/Classes/SwiftYookassaPaymentsFlutterPlugin.swift b/ios/Classes/SwiftYookassaPaymentsFlutterPlugin.swift index c118563..fdc5f47 100644 --- a/ios/Classes/SwiftYookassaPaymentsFlutterPlugin.swift +++ b/ios/Classes/SwiftYookassaPaymentsFlutterPlugin.swift @@ -63,6 +63,8 @@ public class SwiftYookassaPaymentsFlutterPlugin: NSObject, FlutterPlugin { paymentMethod = .sberbank case "applePay": paymentMethod = .applePay + case "sbp": + paymentMethod = .sbp default: break } @@ -368,6 +370,8 @@ extension TokenizationSettings: Decodable { paymentTypes.insert(.sberbank) case "PaymentMethod.applePay": paymentTypes.insert(.applePay) + case "PaymentMethod.sbp": + paymentTypes.insert(.sbp) default: break } } diff --git a/ios/yookassa_payments_flutter.podspec b/ios/yookassa_payments_flutter.podspec index 66f9b4f..783c611 100644 --- a/ios/yookassa_payments_flutter.podspec +++ b/ios/yookassa_payments_flutter.podspec @@ -11,7 +11,7 @@ Flutter SDK from yoomoney s.source = { :path => '.' } s.source_files = 'Classes/**/*' s.dependency 'Flutter' - s.dependency 'YooKassaPayments', '6.11.3' + s.dependency 'YooKassaPayments', '6.12.3' s.platform = :ios, '10.0' diff --git a/lib/models/payment_method_types.dart b/lib/models/payment_method_types.dart index f1e0350..c704657 100644 --- a/lib/models/payment_method_types.dart +++ b/lib/models/payment_method_types.dart @@ -16,16 +16,19 @@ class PaymentMethodTypes { PaymentMethodTypes([PaymentMethod.applePay]); static const PaymentMethodTypes googlePay = PaymentMethodTypes([PaymentMethod.googlePay]); + static const PaymentMethodTypes sbp = + PaymentMethodTypes([PaymentMethod.sbp]); static const PaymentMethodTypes all = PaymentMethodTypes([ PaymentMethod.bankCard, PaymentMethod.yooMoney, PaymentMethod.sberbank, PaymentMethod.applePay, - PaymentMethod.googlePay + PaymentMethod.googlePay, + PaymentMethod.sbp ]); } -enum PaymentMethod { bankCard, yooMoney, applePay, googlePay, sberbank } +enum PaymentMethod { bankCard, yooMoney, applePay, googlePay, sberbank, sbp } extension PaymentMethodExtension on PaymentMethod { static PaymentMethod fromStringValue(String rawValue) { @@ -40,6 +43,8 @@ extension PaymentMethodExtension on PaymentMethod { return PaymentMethod.applePay; case 'google_pay': return PaymentMethod.googlePay; + case 'sbp': + return PaymentMethod.sbp; } return PaymentMethod.bankCard; } diff --git a/lib/models/tokenization_result.dart b/lib/models/tokenization_result.dart index 38411fa..953d034 100644 --- a/lib/models/tokenization_result.dart +++ b/lib/models/tokenization_result.dart @@ -56,6 +56,8 @@ PaymentMethod? _paymentMethodFromString(String type) { return PaymentMethod.applePay; case "google_pay": return PaymentMethod.googlePay; + case "sbp": + return PaymentMethod.sbp; default: return null; } diff --git a/lib/yookassa_payments_flutter.dart b/lib/yookassa_payments_flutter.dart index 7d41ea6..74d6f43 100644 --- a/lib/yookassa_payments_flutter.dart +++ b/lib/yookassa_payments_flutter.dart @@ -30,8 +30,8 @@ class YookassaPaymentsFlutter { } static Future confirmation( - String url, PaymentMethod? paymentMethod) async { - var inputData = {'url': url, 'paymentMethod': paymentMethod?.name}; + String url, PaymentMethod? paymentMethod, String? clientApplicationKey) async { + var inputData = {'url': url, 'paymentMethod': paymentMethod?.name, 'clientApplicationKey': clientApplicationKey}; return await _channel.invokeMethod('confirmation', inputData); } diff --git a/pubspec.lock b/pubspec.lock index ab91d85..721f0e7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,51 +5,50 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.8.2" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" + version: "1.3.0" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" + url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.17.1" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -59,7 +58,8 @@ packages: dependency: "direct dev" description: name: flutter_lints - url: "https://pub.dartlang.org" + sha256: b543301ad291598523947dc534aaddc5aaad597b709d2426d3a0e0d44c5cb493 + url: "https://pub.dev" source: hosted version: "1.0.4" flutter_test: @@ -67,41 +67,54 @@ packages: description: flutter source: sdk version: "0.0.0" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" lints: dependency: transitive description: name: lints - url: "https://pub.dartlang.org" + sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c + url: "https://pub.dev" source: hosted version: "1.0.1" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" + url: "https://pub.dev" source: hosted - version: "0.12.11" + version: "0.12.15" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + url: "https://pub.dev" source: hosted - version: "0.1.3" + version: "0.2.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + url: "https://pub.dev" source: hosted - version: "1.7.0" + version: "1.9.1" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.8.3" sky_engine: dependency: transitive description: flutter @@ -111,58 +124,58 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + url: "https://pub.dev" source: hosted - version: "1.8.1" + version: "1.9.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb + url: "https://pub.dev" source: hosted - version: "0.4.8" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" + version: "0.5.1" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.4" sdks: - dart: ">=2.15.0 <3.0.0" + dart: ">=3.0.0-0 <4.0.0" flutter: ">=2.10.5" diff --git a/pubspec.yaml b/pubspec.yaml index f4a5391..4ef9d76 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,11 +1,11 @@ name: yookassa_payments_flutter description: This Flutter SDK allows processing payments using a payment token. It works as an addition to the YooMoney API. -version: 1.0.6 +version: 1.1.1 homepage: https://git.yoomoney.ru/projects/SDK/repos/yookassa-payments-flutter-sdk/browse repository: https://git.yoomoney.ru/projects/SDK/repos/yookassa-payments-flutter-sdk/browse environment: - sdk: ">=2.15.0 <3.0.0" + sdk: ">=2.15.0 <4.0.0" flutter: ">=2.10.5" dependencies: