diff --git a/Makefile b/Makefile index 2c500c3..2a294d9 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ FVM_FLUTTER = $(FVM) flutter FVM_DART = $(FVM) dart init: - $(FVM) use 3.3.5 --force; $(FVM_DART) pub global activate pana; + $(FVM) use 3.10.2 --force; $(FVM_DART) pub global activate pana; version: $(FVM_FLUTTER) --version; $(FVM_DART) --version; @@ -36,7 +36,7 @@ clean: $(foreach v, $(PACKAGES_PATH), cd $(v); $(FVM_FLUTTER) clean; cd ../..;) fix: - $(foreach v, $(PACKAGES_PATH), cd $(v); $(FVM_FLUTTER) format .; cd ../..;) + $(foreach v, $(PACKAGES_PATH), cd $(v); $(FVM_DART) format .; cd ../..;) analyze: $(foreach v, $(PACKAGES_PATH), cd $(v); $(FVM_FLUTTER) analyze . --fatal-infos; cd ../..;) diff --git a/analysis_options.yaml b/analysis_options.yaml index 006cf13..7f5528b 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -3,9 +3,6 @@ analyzer: strict-casts: true strict-inference: true strict-raw-types: true - strong-mode: - implicit-casts: false - implicit-dynamic: false errors: todo: ignore missing_return: warning diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 88f3370..90e5bc8 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 32 + compileSdkVersion 33 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 diff --git a/example/android/build.gradle b/example/android/build.gradle index 4256f91..0a2d6a1 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index a390b3b..abdf5ec 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -200,10 +200,12 @@ /* Begin PBXShellScriptBuildPhase section */ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", ); name = "Thin Binary"; outputPaths = ( @@ -236,6 +238,7 @@ }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist index 907f329..7f55346 100644 --- a/example/ios/Runner/Info.plist +++ b/example/ios/Runner/Info.plist @@ -45,5 +45,7 @@ CADisableMinimumFrameDurationOnPhone + UIApplicationSupportsIndirectInputEvents + diff --git a/example/lib/main.dart b/example/lib/main.dart index 0c1d436..b1c8c1a 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -24,7 +24,6 @@ final TinkoffAcquiring acquiring = TinkoffAcquiring( TinkoffAcquiringConfig.credential( terminalKey: terminalKey, password: password, - isDebugMode: true, ), ); @@ -330,8 +329,8 @@ details: ${response.details} paReq: fa.paReq, acsTransId: fa.acsTransId, version: check3DSVersion.version, - onLoad: (bool v) { - debugPrint('WebView load: $v'); + onLoad: ({required bool isLoading}) { + debugPrint('WebView load: $isLoading'); }, onFinished: (Submit3DSAuthorizationResponse? v) { Navigator.of(context).pop(); diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 1f95e84..eb89710 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -5,13 +5,13 @@ version: 1.0.0+1 publish_to: none environment: - sdk: ">=2.12.0 <3.0.0" + sdk: ">=3.0.0 <4.0.0" dependencies: flutter: sdk: flutter - tinkoff_acquiring: ^3.0.10 - tinkoff_acquiring_flutter: ^3.0.10 + tinkoff_acquiring: ^3.0.11 + tinkoff_acquiring_flutter: ^3.0.11 dependency_overrides: tinkoff_acquiring: diff --git a/packages/tinkoff_acquiring/CHANGELOG.md b/packages/tinkoff_acquiring/CHANGELOG.md index fe34c76..82c1643 100644 --- a/packages/tinkoff_acquiring/CHANGELOG.md +++ b/packages/tinkoff_acquiring/CHANGELOG.md @@ -1,3 +1,8 @@ +# 3.0.11 + +* Bumped Flutter to 3.10.2, Dart to 3 +* Upgraded dependencies + # 3.0.10 * Fixing the 3DSv2 Challenge Flow Passage diff --git a/packages/tinkoff_acquiring/lib/src/constants.dart b/packages/tinkoff_acquiring/lib/src/constants.dart index a8a5f6f..a9a553e 100644 --- a/packages/tinkoff_acquiring/lib/src/constants.dart +++ b/packages/tinkoff_acquiring/lib/src/constants.dart @@ -1,6 +1,6 @@ // ignore_for_file: public_member_api_docs -abstract class JsonKeys { +abstract final class JsonKeys { static const String terminalKey = 'TerminalKey'; static const String customerKey = 'CustomerKey'; static const String checkType = 'CheckType'; @@ -144,7 +144,7 @@ abstract class JsonKeys { static const String timestamp = 'Timestamp'; } -abstract class NetworkSettings { +abstract final class NetworkSettings { static const String domainDebug = 'rest-api-test.tinkoff.ru'; static const String domainRelease = 'securepay.tinkoff.ru'; static const String apiPath = '/'; @@ -160,7 +160,7 @@ abstract class NetworkSettings { }; } -abstract class ApiMethods { +abstract final class ApiMethods { static const String init = 'Init'; static const String finishAuthorize = 'FinishAuthorize'; static const String confirm = 'Confirm'; @@ -189,7 +189,7 @@ abstract class ApiMethods { static const String getAddCardState = 'GetAddCardState'; } -abstract class Ignore { +abstract final class Ignore { static const Set ignoredFields = { JsonKeys.data, JsonKeys.receipt, @@ -198,7 +198,7 @@ abstract class Ignore { }; } -abstract class CardSettings { +abstract final class CardSettings { static const List defaultRangers = [16]; static const List unknownRangers = [13, 14, 15, 16, 17, 18, 19]; static const List maestroRangers = [13, 14, 15, 16, 17, 18, 19]; diff --git a/packages/tinkoff_acquiring/lib/src/core/models/finish_authorize/finish_authorize_request.dart b/packages/tinkoff_acquiring/lib/src/core/models/finish_authorize/finish_authorize_request.dart index f8731b7..2b5cf71 100644 --- a/packages/tinkoff_acquiring/lib/src/core/models/finish_authorize/finish_authorize_request.dart +++ b/packages/tinkoff_acquiring/lib/src/core/models/finish_authorize/finish_authorize_request.dart @@ -209,7 +209,7 @@ class FinishAuthorizeRequest extends AcquiringRequest { } /// Проверка запроса на наличие 3DsV2 - @JsonKey(ignore: true) + @JsonKey(includeToJson: false, includeFromJson: false) bool get is3DsVersionV2 => data != null && ip != null; /// Зашифрованные данные карты. См. класс [PaymentSource]. diff --git a/packages/tinkoff_acquiring/lib/src/core/tinkoff_acquiring_config.dart b/packages/tinkoff_acquiring/lib/src/core/tinkoff_acquiring_config.dart index 7428e6f..99895b6 100644 --- a/packages/tinkoff_acquiring/lib/src/core/tinkoff_acquiring_config.dart +++ b/packages/tinkoff_acquiring/lib/src/core/tinkoff_acquiring_config.dart @@ -6,14 +6,14 @@ import 'models/base/base.dart'; /// Позволяет изменять путь и загаловок запроса. /// {@endtemplate} typedef ProxyMapping = ProxyRequest? Function( - AcquiringRequest request, - bool isDebugMode, -); + AcquiringRequest request, { + required bool isDebugMode, +}); /// {@template tinkoff_acquiring_config} /// Класс позволяет конфигурировать SDK. /// {@endtemplate} -abstract class TinkoffAcquiringConfig { +sealed class TinkoffAcquiringConfig { /// Создает экземпляр класса для конфигурирования SDK, через `terminalKey` и `password`. /// /// Если не передать `password`, то SDK будет работать в режиме passwordless. diff --git a/packages/tinkoff_acquiring/lib/src/utils/logger.dart b/packages/tinkoff_acquiring/lib/src/utils/logger.dart index a04b5d9..27a0459 100644 --- a/packages/tinkoff_acquiring/lib/src/utils/logger.dart +++ b/packages/tinkoff_acquiring/lib/src/utils/logger.dart @@ -1,7 +1,7 @@ import 'dart:developer' as dev; /// Интерфейс базового логгера -abstract class BaseLogger { +abstract interface class BaseLogger { /// Конструктор базового логгера const BaseLogger(); diff --git a/packages/tinkoff_acquiring/lib/src/utils/network_client.dart b/packages/tinkoff_acquiring/lib/src/utils/network_client.dart index 2b9d04b..b9efc1d 100644 --- a/packages/tinkoff_acquiring/lib/src/utils/network_client.dart +++ b/packages/tinkoff_acquiring/lib/src/utils/network_client.dart @@ -13,7 +13,7 @@ import 'crypto_utils.dart'; /// {@endtemplate} class NetworkClient { /// {@macro network_client} - NetworkClient(this._config); + const NetworkClient(this._config); /// {@macro tinkoff_acquiring_config} final TinkoffAcquiringConfig _config; @@ -31,7 +31,7 @@ class NetworkClient { if (config is TinkoffAcquiringConfigProxy) { final ProxyRequest? setting = config.mapping?.call( request, - _config.isDebugMode, + isDebugMode: _config.isDebugMode, ); proxyHeaders = { @@ -114,30 +114,33 @@ class NetworkClient { ) { final Map temp = request.toJson(); - if (config is TinkoffAcquiringConfigCredential) { - final String token = SignToken.generate( - terminalKey: config.terminalKey, - password: config.password, - request: request, - ); - - final Map _request = temp - ..addAll({ - JsonKeys.terminalKey: config.terminalKey, - JsonKeys.token: token, - }); - - return _request; + switch (config) { + case TinkoffAcquiringConfigCredential(): + final String token = SignToken.generate( + terminalKey: config.terminalKey, + password: config.password, + request: request, + ); + + final Map _request = temp + ..addAll( + { + JsonKeys.terminalKey: config.terminalKey, + JsonKeys.token: token, + }, + ); + + return _request; + case TinkoffAcquiringConfigToken(): + return temp + ..addAll( + { + JsonKeys.terminalKey: config.terminalKey, + }, + ); + case TinkoffAcquiringConfigProxy(): + return temp; } - - if (config is TinkoffAcquiringConfigToken) { - return temp - ..addAll({ - JsonKeys.terminalKey: config.terminalKey, - }); - } - - return temp; } } diff --git a/packages/tinkoff_acquiring/pubspec.yaml b/packages/tinkoff_acquiring/pubspec.yaml index bfa48b1..134cc4c 100644 --- a/packages/tinkoff_acquiring/pubspec.yaml +++ b/packages/tinkoff_acquiring/pubspec.yaml @@ -1,22 +1,22 @@ name: tinkoff_acquiring description: Flutter Tinkoff Acquiring SDK is a simple way to integrate payments into your mobile application. -version: 3.0.10 +version: 3.0.11 repository: https://github.com/MadBrains/Tinkoff-Acquiring-SDK-Flutter issue_tracker: https://github.com/MadBrains/Tinkoff-Acquiring-SDK-Flutter/issues homepage: https://madbrains.ru/ environment: - sdk: ">=2.12.0 <3.0.0" + sdk: ">=3.0.0 <4.0.0" dependencies: comparer: ^2.0.1 - crypto: ^3.0.2 - crypton: ^2.0.5 - http: ^0.13.4 - meta: ^1.7.0 - json_annotation: ^4.5.0 + crypto: ^3.0.3 + crypton: ^2.1.0 + http: ^1.0.0 + meta: ^1.9.1 + json_annotation: ^4.8.1 dev_dependencies: test: ^1.21.3 - build_runner: ^2.1.11 - json_serializable: ^6.2.0 \ No newline at end of file + build_runner: ^2.4.4 + json_serializable: ^6.7.0 \ No newline at end of file diff --git a/packages/tinkoff_acquiring_flutter/lib/src/constants.dart b/packages/tinkoff_acquiring_flutter/lib/src/constants.dart index 385e32a..472a1af 100644 --- a/packages/tinkoff_acquiring_flutter/lib/src/constants.dart +++ b/packages/tinkoff_acquiring_flutter/lib/src/constants.dart @@ -1,6 +1,6 @@ // ignore_for_file: public_member_api_docs -abstract class WebViewKeys { +abstract final class WebViewKeys { static const String threeDSServerTransId = 'threeDSServerTransID'; static const String threeDSMethodNotificationURL = 'threeDSMethodNotificationURL'; @@ -16,7 +16,7 @@ abstract class WebViewKeys { static const String cresCallbackUrl = 'cresCallbackUrl'; } -abstract class WebViewSettings { +abstract final class WebViewSettings { static const String messageType = 'CReq'; static const String challengeWindowSize = '05'; static const List cancelActions = [ @@ -25,7 +25,7 @@ abstract class WebViewSettings { ]; } -abstract class WebViewMethods { +abstract final class WebViewMethods { static const String submit3DSAuthorization = 'Submit3DSAuthorization'; static const String submit3DSAuthorizationV2 = 'Submit3DSAuthorizationV2'; static const String complete3DSMethodv2 = 'Complete3DSMethodv2'; diff --git a/packages/tinkoff_acquiring_flutter/lib/src/web_view_3ds.dart b/packages/tinkoff_acquiring_flutter/lib/src/web_view_3ds.dart index c7c9ae9..9269255 100644 --- a/packages/tinkoff_acquiring_flutter/lib/src/web_view_3ds.dart +++ b/packages/tinkoff_acquiring_flutter/lib/src/web_view_3ds.dart @@ -55,7 +55,7 @@ class WebView3DS extends StatefulWidget { final void Function(Submit3DSAuthorizationResponse?) onFinished; /// Загрузка 3-D Secure - final void Function(bool) onLoad; + final void Function({required bool isLoading}) onLoad; String get _termUrl => config .apiUrl( @@ -134,7 +134,7 @@ class _WebView3DSState extends State { await _logNavigationDelegate('onPageStarted', url); if (url == widget._termUrl) { - widget.onLoad(true); + widget.onLoad(isLoading: true); } }, onPageFinished: (String url) async { @@ -151,7 +151,7 @@ class _WebView3DSState extends State { if (url == widget._termUrl) { await _response(); } else { - widget.onLoad(false); + widget.onLoad(isLoading: false); } }, ), diff --git a/packages/tinkoff_acquiring_flutter/pubspec.yaml b/packages/tinkoff_acquiring_flutter/pubspec.yaml index 26f78a7..67cd3c9 100644 --- a/packages/tinkoff_acquiring_flutter/pubspec.yaml +++ b/packages/tinkoff_acquiring_flutter/pubspec.yaml @@ -1,21 +1,21 @@ name: tinkoff_acquiring_flutter description: Flutter Tinkoff Acquiring SDK is a simple way to integrate payments into your mobile application. -version: 3.0.10 +version: 3.0.11 repository: https://github.com/MadBrains/Tinkoff-Acquiring-SDK-Flutter issue_tracker: https://github.com/MadBrains/Tinkoff-Acquiring-SDK-Flutter/issues homepage: https://madbrains.ru/ environment: - sdk: ">=2.12.0 <3.0.0" - flutter: ">=2.0.0" + sdk: ">=3.0.0 <4.0.0" + flutter: ">=3.10.2" dependencies: flutter: sdk: flutter flutter_localizations: sdk: flutter - tinkoff_acquiring: ^3.0.10 - webview_flutter: ^4.0.2 + tinkoff_acquiring: ^3.0.11 + webview_flutter: ^4.2.1 dev_dependencies: flutter_test: