From 472d9217e658848840443f2ed82ed538c7df70ea Mon Sep 17 00:00:00 2001 From: Valentyn Berehovyi Date: Fri, 11 Feb 2022 10:59:27 +0200 Subject: [PATCH] Fixed issuee with google pay --- CHANGELOG.md | 3 +++ lib/src/api.dart | 2 +- lib/src/native.dart | 7 +++++-- pubspec.yaml | 2 +- test/api_test.dart | 4 ++-- test/native_test.dart | 7 +++++-- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53506bb..72f8dd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.4.1 +* Fixed issue with google pay + ## 0.4.0 * Added extended cookie handling for android 3DS extra cases * Formatted code diff --git a/lib/src/api.dart b/lib/src/api.dart index 9beb33d..dfea2d7 100644 --- a/lib/src/api.dart +++ b/lib/src/api.dart @@ -201,7 +201,7 @@ class Api { return { 'User-Agent': 'Flutter', 'SDK-OS': _platformSpecific.operatingSystem, - 'SDK-Version': '0.0.1' + 'SDK-Version': '0.4.1' }; } diff --git a/lib/src/native.dart b/lib/src/native.dart index d740306..92c3128 100644 --- a/lib/src/native.dart +++ b/lib/src/native.dart @@ -1,3 +1,5 @@ +import 'dart:convert'; + import 'package:flutter/services.dart'; class Native { @@ -33,8 +35,9 @@ class Native { return _channel.invokeMethod('applePayComplete', {'success': success}); } - Future googlePay(dynamic configData) { - return _channel.invokeMethod('googlePay', configData); + Future googlePay(dynamic configData) async { + final serializedJson = await _channel.invokeMethod('googlePay', configData); + return jsonDecode(serializedJson); } Future androidAddCookie(String url, String cookie) { diff --git a/pubspec.yaml b/pubspec.yaml index 6569301..f50fe16 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: cloudipsp_mobile description: Cloudipsp SDK for Mobile(Android, iOS). The only way to accept payment with Fondy service on Flutter platform for mobiles. -version: 0.4.0 +version: 0.4.1 homepage: https://github.com/cloudipsp/flutter-mobile-sdk repository: https://github.com/cloudipsp/flutter-mobile-sdk diff --git a/test/api_test.dart b/test/api_test.dart index 2748583..5d34c7d 100644 --- a/test/api_test.dart +++ b/test/api_test.dart @@ -426,13 +426,13 @@ const RESPONSE_ERROR = ''' const REQUEST_HEADERS = { 'User-Agent': 'Flutter', 'SDK-OS': 'UnitTestOS', - 'SDK-Version': '0.0.1', + 'SDK-Version': '0.4.1', 'Accept': 'application/json', 'Content-Type': 'application/json' }; const REQUEST_HEADERS_3DS = { 'User-Agent': 'Flutter', 'SDK-OS': 'UnitTestOS', - 'SDK-Version': '0.0.1', + 'SDK-Version': '0.4.1', 'Content-Type': 'application/whoknows' }; diff --git a/test/native_test.dart b/test/native_test.dart index 28330db..f24c7b2 100644 --- a/test/native_test.dart +++ b/test/native_test.dart @@ -1,3 +1,5 @@ +import 'dart:convert'; + import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; @@ -67,11 +69,12 @@ void main() { }); test('googlePay invokes via channel with right params', () async { + final expectedResult = {'some': 'SomeResultAboutGooglePay'}; when(mockedMethodChannel.invokeMethod('googlePay', any)) - .thenAnswer((_) async => 'SomeResultAboutGooglePay'); + .thenAnswer((_) async => jsonEncode(expectedResult)); final config = {'someKey': 'someValue'}; final result = await native.googlePay(config); verify(mockedMethodChannel.invokeMethod('googlePay', config)).called(1); - expect(result, 'SomeResultAboutGooglePay'); + expect(result, expectedResult); }); }