From 104e92ed78a367119ab7275c67d704a1634eae34 Mon Sep 17 00:00:00 2001 From: cb-palanim Date: Thu, 19 Sep 2024 19:32:14 +0530 Subject: [PATCH 1/4] Update product.dart --- lib/src/models/product.dart | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/src/models/product.dart b/lib/src/models/product.dart index 3148993..cefad3c 100644 --- a/lib/src/models/product.dart +++ b/lib/src/models/product.dart @@ -198,21 +198,22 @@ class Subscripton { subscriptionId = json['subscription_id'] as String; customerId = json['customer_id'] as String; status = json['status'] as String; - activatedAt = json['activated_at'] as int; - currentTermStart = json['current_term_start'] as int; - currentTermEnd = json['current_term_end'] as int; - planAmount = json['plan_amount'].toString(); + activatedAt = json.containsKey('activated_at') ? json['activated_at'] as int : -1; + currentTermStart = json.containsKey('current_term_start') ? json['current_term_start'] as int: -1; + currentTermEnd = json.containsKey('current_term_end') ? json['current_term_end'] as int: -1; + planAmount = json.containsKey('plan_amount') ? json['plan_amount'].toString() : ''; + /// Defaults to -1/'' if key not present /// Plan amount sometime we are getting double value sometime Int } /// convert json data into Subscripton model for Android Subscripton.fromJsonAndroid(Map json) { - activatedAtString = json['activated_at'].toString(); - currentTermEndString = json['current_term_end'].toString(); - currentTermStartString = json['current_term_start'].toString(); + activatedAtString = json.containsKey('activated_at') ? json['activated_at'].toString(): ''; + currentTermEndString = json.containsKey('current_term_end') ? json['current_term_end'].toString(): ''; + currentTermStartString = json.containsKey('current_term_start') ? json['current_term_start'].toString(): ''; customerId = json['customer_id'] as String; - planAmount = json['plan_amount'].toString(); + planAmount = json.containsKey('plan_amount') ? json['plan_amount'].toString(): ''; status = json['status'] as String; subscriptionId = json['subscription_id'] as String; } From 0ee9db4f09c4824e104b757be0bccbc27790dca0 Mon Sep 17 00:00:00 2001 From: cb-palanim Date: Thu, 19 Sep 2024 19:32:44 +0530 Subject: [PATCH 2/4] Update version --- CHANGELOG.md | 4 ++++ README.md | 2 +- android/build.gradle | 2 +- ios/chargebee_flutter.podspec | 2 +- pubspec.yaml | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75b459c..cc18ae5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.0-beta.8 +Chore +* Trial support for retrieve Subscription + ## 1.0.0-beta.7 Chore * UTF8 support diff --git a/README.md b/README.md index b7145cc..952ac5b 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ To use Chargebee SDK in your Flutter app, follow these steps: ``` dart dependencies: - chargebee_flutter: ^1.0.0-beta.7 + chargebee_flutter: ^1.0.0-beta.8 ``` 2. Install dependency. diff --git a/android/build.gradle b/android/build.gradle index 926d49c..1cd9a60 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ group 'com.chargebee.flutter.sdk' -version '1.0.0-beta.7' +version '1.0.0-beta.8' buildscript { ext.kotlin_version = '1.6.0' diff --git a/ios/chargebee_flutter.podspec b/ios/chargebee_flutter.podspec index 783d5e2..f347a42 100644 --- a/ios/chargebee_flutter.podspec +++ b/ios/chargebee_flutter.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'chargebee_flutter' - s.version = '1.0.0-beta.7' + s.version = '1.0.0-beta.8' s.summary = 'This is the official Software Development Kit (SDK) for Chargebee Flutter.' s.description = <<-DESC A new Flutter plugin. diff --git a/pubspec.yaml b/pubspec.yaml index 583f01e..d09a0d3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: chargebee_flutter description: This is the official Software Development Kit (SDK) for Chargebee Flutter. -version: 1.0.0-beta.7 +version: 1.0.0-beta.8 homepage: 'https://chargebee.com' repository: 'https://github.com/chargebee/chargebee-flutter' From 870ea3eb2b511eeacc8666769a9b31b4112241d6 Mon Sep 17 00:00:00 2001 From: cb-palanim Date: Thu, 19 Sep 2024 21:17:45 +0530 Subject: [PATCH 3/4] UPdating to return null instead of -1/'' --- lib/src/models/product.dart | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/src/models/product.dart b/lib/src/models/product.dart index cefad3c..f914a45 100644 --- a/lib/src/models/product.dart +++ b/lib/src/models/product.dart @@ -198,10 +198,10 @@ class Subscripton { subscriptionId = json['subscription_id'] as String; customerId = json['customer_id'] as String; status = json['status'] as String; - activatedAt = json.containsKey('activated_at') ? json['activated_at'] as int : -1; - currentTermStart = json.containsKey('current_term_start') ? json['current_term_start'] as int: -1; - currentTermEnd = json.containsKey('current_term_end') ? json['current_term_end'] as int: -1; - planAmount = json.containsKey('plan_amount') ? json['plan_amount'].toString() : ''; + activatedAt = json.containsKey('activated_at') ? json['activated_at'] as int : null; + currentTermStart = json.containsKey('current_term_start') ? json['current_term_start'] as int: null; + currentTermEnd = json.containsKey('current_term_end') ? json['current_term_end'] as int: null; + planAmount = json.containsKey('plan_amount') ? json['plan_amount'].toString() : null; /// Defaults to -1/'' if key not present /// Plan amount sometime we are getting double value sometime Int @@ -209,11 +209,11 @@ class Subscripton { /// convert json data into Subscripton model for Android Subscripton.fromJsonAndroid(Map json) { - activatedAtString = json.containsKey('activated_at') ? json['activated_at'].toString(): ''; - currentTermEndString = json.containsKey('current_term_end') ? json['current_term_end'].toString(): ''; - currentTermStartString = json.containsKey('current_term_start') ? json['current_term_start'].toString(): ''; + activatedAtString = json.containsKey('activated_at') ? json['activated_at'].toString(): null; + currentTermEndString = json.containsKey('current_term_end') ? json['current_term_end'].toString(): null; + currentTermStartString = json.containsKey('current_term_start') ? json['current_term_start'].toString(): null; customerId = json['customer_id'] as String; - planAmount = json.containsKey('plan_amount') ? json['plan_amount'].toString(): ''; + planAmount = json.containsKey('plan_amount') ? json['plan_amount'].toString(): null; status = json['status'] as String; subscriptionId = json['subscription_id'] as String; } From 8e9d2df05cd5354ac1dc99b597983c63d66bb420 Mon Sep 17 00:00:00 2001 From: cb-palanim Date: Thu, 19 Sep 2024 21:23:27 +0530 Subject: [PATCH 4/4] Update product.dart --- lib/src/models/product.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/models/product.dart b/lib/src/models/product.dart index f914a45..d57d2bf 100644 --- a/lib/src/models/product.dart +++ b/lib/src/models/product.dart @@ -203,7 +203,7 @@ class Subscripton { currentTermEnd = json.containsKey('current_term_end') ? json['current_term_end'] as int: null; planAmount = json.containsKey('plan_amount') ? json['plan_amount'].toString() : null; - /// Defaults to -1/'' if key not present + /// Defaults to null if key not present /// Plan amount sometime we are getting double value sometime Int }