From 187f2a4af5406c3259ec71e06ece6ab542b895ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D1=81=D0=BA=D0=B0=D0=BD=D0=B4=D0=B0=D1=80=20=D0=A0?= =?UTF-8?q?=2E=20=D0=A8=D0=B0=D0=B1=D0=B0=D0=B5=D0=B2?= Date: Tue, 19 Jul 2022 12:17:10 +0300 Subject: [PATCH] Made applePayID and moneyAuthClientId fields optional --- .vscode/launch.json | 2 +- CHANGELOG.md | 4 ++++ README.md | 18 ++++++++++-------- android/build.gradle | 2 +- android/src/main/AndroidManifest.xml | 10 +++++++++- .../flutter/YookassaPaymentsFlutterPlugin.kt | 2 +- example/ios/Flutter/Debug.xcconfig | 2 +- example/lib/tokenization_screen.dart | 2 -- .../saved_card_module_input_data.dart | 6 +++--- .../tokenization_module_input_data.dart | 10 +++++----- pubspec.yaml | 2 +- 11 files changed, 36 insertions(+), 24 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index aa11258..7830690 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -18,7 +18,7 @@ "flutterMode": "debug", "args": [ "-t", - "lib/main-dev.dart", + "lib/main_dev.dart", "--flavor", "dev" ] diff --git a/CHANGELOG.md b/CHANGELOG.md index 025e1f3..4466f7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.0.2 + +* Made applePayID and moneyAuthClientId fields optional. + # 1.0.1 * Formatted code. Added homepage and repo urls. diff --git a/README.md b/README.md index a7e70b5..693d0ea 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,15 @@ dependencies: yookassa_payments_flutter: ^version ``` -2. Для iOS в файле your_project_name.podspec, лежащий в корне проекта в папке ios добавьте зависимость: +или используйте команду `flutter pub add yookassa_payments_flutter`. + +2. В Podfile вашего приложения добавьте ссылки на репозитории с podspecs YooKassa: ```ruby -s.dependency 'YooKassaPayments', '6.8.0' +source 'https://github.com/CocoaPods/Specs.git' +source 'https://git.yoomoney.ru/scm/sdk/cocoa-pod-specs.git' ``` -3. Запустите `pod install` в директории рядом с Runner.xcworkspace +3. Запустите `pod install --repo-update` в директории рядом с Runner.xcworkspace 4. В Info.plist своего приложения добавьте поддержку url-схем для корректной работы mSDK с оплатой через Сбер и ЮMoney: ``` @@ -76,7 +79,6 @@ B. В некоторых сложных случаях рекомендуем с ```dart var clientApplicationKey = "<Ключ для клиентских приложений>"; var amount = Amount(value: 999.9, currency: Currency.rub); -var applePayID = "<Идентификатор продавца Apple Pay>"; var shopId = "<Идентификатор магазина в ЮKassa)>"; var tokenizationModuleInputData = TokenizationModuleInputData(clientApplicationKey: clientApplicationKey, @@ -89,6 +91,10 @@ var tokenizationModuleInputData = 2. Запустите процесс токенизации с кейсом `.tokenization` и передайте `TokenizationModuleInputData`. +```dart +var result = await YookassaPaymentsFlutter.tokenization(tokenizationModuleInputData); +``` + 3. Получите token в `TokenizationResult` Пример: @@ -339,7 +345,6 @@ func application( | clientApplicationKey | String | Ключ для клиентских приложений из личного кабинета ЮKassa | | title | String | Название магазина в форме оплаты | | subtitle | String | Описание заказа в форме оплаты | -| purchaseDescription | String | Описание заказа в форме оплаты | | amount | Amount | Объект, содержащий сумму заказа и валюту | | shopId | String | Идентификатор магазина в ЮKassa ([раздел Организации](https://yookassa.ru/my/company/organization) - скопировать shopId у нужного магазина) | | savePaymentMethod | SavePaymentMethod | Объект, описывающий логику того, будет ли платеж рекуррентным | @@ -370,7 +375,6 @@ func application( | -------------------- | ------ | -------- | | clientApplicationKey | String | Ключ для клиентских приложений из личного кабинета ЮKassa | | title | String | Название магазина в форме оплаты | -| purchaseDescription | String | Описание заказа в форме оплаты | | subtitle | String | Описание заказа в форме оплаты | | paymentMethodId | String | Идентификатор сохраненного способа оплаты | | amount | Amount | Объект, содержащий сумму заказа и валюту | @@ -495,10 +499,8 @@ var savedBankCardModuleInputData = SavedBankCardModuleInputData( clientApplicationKey: clientApplicationKey, title: "Космические объекты", subtitle: "Комета повышенной яркости, период обращения — 112 лет", - purchaseDescription: "root.description", amount: amount, savePaymentMethod: SavePaymentMethod.on, - applePayID: applePayID, shopId: shopId, paymentMethodId: paymentMethodId ); diff --git a/android/build.gradle b/android/build.gradle index 843a471..470ece2 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -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.5.2' + implementation 'ru.yoomoney.sdk.kassa.payments:yookassa-android-sdk:6.5.3' } diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index b2726e8..3d04f6a 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -1 +1,9 @@ - + + + + + + + + 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 9269e70..2a7e35e 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 @@ -169,7 +169,7 @@ private fun PaymentParameters(data: Map): PaymentParameters { val title = data["title"] as String val subtitle = data["subtitle"] as String val shopId = data["shopId"] as String - val authCenterClientId = data["moneyAuthClientId"] as String + val authCenterClientId = data["moneyAuthClientId"] as? String val gatewayId = data["gatewayId"] as? String val userPhoneNumber = data["userPhoneNumber"] as? String val customReturnUrl = data["returnUrl"] as? String diff --git a/example/ios/Flutter/Debug.xcconfig b/example/ios/Flutter/Debug.xcconfig index ec97fc6..2b32752 100644 --- a/example/ios/Flutter/Debug.xcconfig +++ b/example/ios/Flutter/Debug.xcconfig @@ -1,2 +1,2 @@ #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" -#include "Generated.xcconfig" +#include "Flutter/Generated.xcconfig" diff --git a/example/lib/tokenization_screen.dart b/example/lib/tokenization_screen.dart index 6444651..9d55497 100644 --- a/example/lib/tokenization_screen.dart +++ b/example/lib/tokenization_screen.dart @@ -48,7 +48,6 @@ class TokenizationScreenState extends State { var clientApplicationKey = "<Ключ для клиентских приложений>"; var amount = Amount(value: double.parse(controller.text), currency: Currency.rub); var moneyAuthClientId = ""; - var applePayID = "<Идентификатор продавца Apple Pay>"; var shopId = "<Идентификатор магазина в ЮKassa>"; var applicationScheme = "<Схема вашего приложения для deeplink>" "://"; var tokenizationModuleInputData = TokenizationModuleInputData( @@ -59,7 +58,6 @@ class TokenizationScreenState extends State { savePaymentMethod: SavePaymentMethod.userSelects, isLoggingEnabled: true, moneyAuthClientId: moneyAuthClientId, - applePayID: applePayID, shopId: shopId, customerId: "<Уникальный идентификатор покупателя>", applicationScheme: applicationScheme, diff --git a/lib/input_data/saved_card_module_input_data.dart b/lib/input_data/saved_card_module_input_data.dart index e33398e..5c89ec6 100644 --- a/lib/input_data/saved_card_module_input_data.dart +++ b/lib/input_data/saved_card_module_input_data.dart @@ -10,7 +10,6 @@ class SavedBankCardModuleInputData { String subtitle; Amount amount; SavePaymentMethod savePaymentMethod; - String applePayID; String shopId; String paymentMethodId; String? gatewayId; @@ -21,6 +20,7 @@ class SavedBankCardModuleInputData { String? customerId; bool isSafeDeal; HostParameters? hostParameters; + String? applePayID; SavedBankCardModuleInputData( {required this.clientApplicationKey, @@ -28,7 +28,6 @@ class SavedBankCardModuleInputData { required this.subtitle, required this.amount, required this.savePaymentMethod, - required this.applePayID, required this.shopId, required this.paymentMethodId, required this.isSafeDeal, @@ -38,7 +37,8 @@ class SavedBankCardModuleInputData { this.isLoggingEnabled = false, this.customizationSettings = const CustomizationSettings(), this.customerId, - this.hostParameters}); + this.hostParameters, + this.applePayID}); Map toJson() => { 'clientApplicationKey': clientApplicationKey, diff --git a/lib/input_data/tokenization_module_input_data.dart b/lib/input_data/tokenization_module_input_data.dart index 285a5b0..8668751 100644 --- a/lib/input_data/tokenization_module_input_data.dart +++ b/lib/input_data/tokenization_module_input_data.dart @@ -12,9 +12,8 @@ class TokenizationModuleInputData { String subtitle; Amount amount; SavePaymentMethod savePaymentMethod; - String applePayID; String shopId; - String moneyAuthClientId; + String? moneyAuthClientId; HostParameters? hostParameters; String? gatewayId; TokenizationSettings tokenizationSettings; @@ -27,6 +26,7 @@ class TokenizationModuleInputData { String? customerId; GooglePayParameters googlePayParameters; bool googlePayTestEnvironment; + String? applePayID; TokenizationModuleInputData( {required this.clientApplicationKey, @@ -34,9 +34,8 @@ class TokenizationModuleInputData { required this.subtitle, required this.amount, required this.savePaymentMethod, - required this.applePayID, required this.shopId, - required this.moneyAuthClientId, + this.moneyAuthClientId, this.hostParameters, this.gatewayId, this.tokenizationSettings = const TokenizationSettings(), @@ -48,7 +47,8 @@ class TokenizationModuleInputData { this.applicationScheme, this.customerId, this.googlePayParameters = const GooglePayParameters(), - this.googlePayTestEnvironment = false}); + this.googlePayTestEnvironment = false, + this.applePayID}); Map toJson() => { 'clientApplicationKey': clientApplicationKey, diff --git a/pubspec.yaml b/pubspec.yaml index 69b2e15..ee49157 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ 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.1 +version: 1.0.2 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