Skip to content

Commit

Permalink
Fixed issuee with google pay
Browse files Browse the repository at this point in the history
  • Loading branch information
berehovyi committed Feb 11, 2022
1 parent 9a6ed7e commit 472d921
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/src/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class Api {
return {
'User-Agent': 'Flutter',
'SDK-OS': _platformSpecific.operatingSystem,
'SDK-Version': '0.0.1'
'SDK-Version': '0.4.1'
};
}

Expand Down
7 changes: 5 additions & 2 deletions lib/src/native.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:convert';

import 'package:flutter/services.dart';

class Native {
Expand Down Expand Up @@ -33,8 +35,9 @@ class Native {
return _channel.invokeMethod('applePayComplete', {'success': success});
}

Future<dynamic> googlePay(dynamic configData) {
return _channel.invokeMethod('googlePay', configData);
Future<dynamic> googlePay(dynamic configData) async {
final serializedJson = await _channel.invokeMethod('googlePay', configData);
return jsonDecode(serializedJson);
}

Future<void> androidAddCookie(String url, String cookie) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 2 additions & 2 deletions test/api_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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'
};
7 changes: 5 additions & 2 deletions test/native_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:convert';

import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
Expand Down Expand Up @@ -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);
});
}

0 comments on commit 472d921

Please sign in to comment.