Add platform device id package. Send device uuid to ionia for purchase request. (#494)

This commit is contained in:
mkyq 2022-08-31 17:37:43 +01:00 committed by GitHub
parent d9905a7cf3
commit 92458e2f4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 1 deletions

View file

@ -63,6 +63,8 @@ PODS:
- Flutter
- device_display_brightness (0.0.1):
- Flutter
- device_info (0.0.1):
- Flutter
- devicelocale (0.0.1):
- Flutter
- DKImagePickerController/Core (4.3.2):
@ -113,6 +115,8 @@ PODS:
- Flutter
- "permission_handler (5.1.0+2)":
- Flutter
- platform_device_id (0.0.1):
- Flutter
- Reachability (3.2)
- SDWebImage (5.9.1):
- SDWebImage/Core (= 5.9.1)
@ -141,6 +145,7 @@ DEPENDENCIES:
- cw_monero (from `.symlinks/plugins/cw_monero/ios`)
- cw_shared_external (from `.symlinks/plugins/cw_shared_external/ios`)
- device_display_brightness (from `.symlinks/plugins/device_display_brightness/ios`)
- device_info (from `.symlinks/plugins/device_info/ios`)
- devicelocale (from `.symlinks/plugins/devicelocale/ios`)
- esys_flutter_share (from `.symlinks/plugins/esys_flutter_share/ios`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
@ -150,6 +155,7 @@ DEPENDENCIES:
- package_info (from `.symlinks/plugins/package_info/ios`)
- path_provider (from `.symlinks/plugins/path_provider/ios`)
- permission_handler (from `.symlinks/plugins/permission_handler/ios`)
- platform_device_id (from `.symlinks/plugins/platform_device_id/ios`)
- share (from `.symlinks/plugins/share/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
- uni_links (from `.symlinks/plugins/uni_links/ios`)
@ -183,6 +189,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/cw_shared_external/ios"
device_display_brightness:
:path: ".symlinks/plugins/device_display_brightness/ios"
device_info:
:path: ".symlinks/plugins/device_info/ios"
devicelocale:
:path: ".symlinks/plugins/devicelocale/ios"
esys_flutter_share:
@ -201,6 +209,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/path_provider/ios"
permission_handler:
:path: ".symlinks/plugins/permission_handler/ios"
platform_device_id:
:path: ".symlinks/plugins/platform_device_id/ios"
share:
:path: ".symlinks/plugins/share/ios"
shared_preferences:
@ -221,6 +231,7 @@ SPEC CHECKSUMS:
cw_monero: 4cf3b96f2da8e95e2ef7d6703dd4d2c509127b7d
cw_shared_external: 2972d872b8917603478117c9957dfca611845a92
device_display_brightness: 1510e72c567a1f6ce6ffe393dcd9afd1426034f7
device_info: d7d233b645a32c40dfdc212de5cf646ca482f175
devicelocale: b22617f40038496deffba44747101255cee005b0
DKImagePickerController: b5eb7f7a388e4643264105d648d01f727110fc3d
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
@ -233,6 +244,7 @@ SPEC CHECKSUMS:
package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0
platform_device_id: 81b3e2993881f87d0c82ef151dc274df4869aef5
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
SDWebImage: a990c053fff71e388a10f3357edb0be17929c9c5
share: 0b2c3e82132f5888bccca3351c504d0003b3b410

View file

@ -11,6 +11,7 @@ import 'package:cake_wallet/ionia/ionia_gift_card.dart';
class IoniaApi {
static const baseUri = 'api.ionia.io';
static const pathPrefix = 'cake';
static const requestedUUIDHeader = 'requestedUUID';
static final createUserUri = Uri.https(baseUri, '/$pathPrefix/CreateUser');
static final verifyEmailUri = Uri.https(baseUri, '/$pathPrefix/VerifyEmail');
static final signInUri = Uri.https(baseUri, '/$pathPrefix/SignIn');
@ -254,6 +255,7 @@ class IoniaApi {
// Purchase Gift Card
Future<IoniaOrder> purchaseGiftCard({
@required String requestedUUID,
@required String merchId,
@required double amount,
@required String currency,
@ -264,6 +266,7 @@ class IoniaApi {
'clientId': clientId,
'username': username,
'password': password,
requestedUUIDHeader: requestedUUID,
'Content-Type': 'application/json'};
final body = <String, dynamic>{
'Amount': amount,

View file

@ -7,6 +7,7 @@ import 'package:cake_wallet/.secrets.g.dart' as secrets;
import 'package:cake_wallet/ionia/ionia_api.dart';
import 'package:cake_wallet/ionia/ionia_gift_card.dart';
import 'package:cake_wallet/ionia/ionia_category.dart';
import 'package:platform_device_id/platform_device_id.dart';
class IoniaService {
IoniaService(this.secureStorage, this.ioniaApi);
@ -114,7 +115,9 @@ class IoniaService {
@required String currency}) async {
final username = await secureStorage.read(key: ioniaUsernameStorageKey);
final password = await secureStorage.read(key: ioniaPasswordStorageKey);
final deviceId = await PlatformDeviceId.getDeviceId;
return ioniaApi.purchaseGiftCard(
requestedUUID: deviceId,
merchId: merchId,
amount: amount,
currency: currency,

View file

@ -124,7 +124,7 @@ class IoniaAccountPage extends BasePage {
//),
SizedBox(height: 40),
Observer(
builder: (_) => IoniaTile(title: S.of(context).email_address, subTitle: ioniaAccountViewModel.email),
builder: (_) => IoniaTile(title: S.of(context).email_address, subTitle: ioniaAccountViewModel.email ?? ''),
),
Divider()
],

View file

@ -55,6 +55,7 @@ dependencies:
unorm_dart: ^0.2.0
permission_handler: ^5.0.1+1
device_display_brightness: ^0.0.6
platform_device_id: ^0.2.1
dev_dependencies:
flutter_test: