From 382b36fb96b965f1c690baf3077804ef5e0b76f0 Mon Sep 17 00:00:00 2001 From: Felix Angelov Date: Thu, 17 Aug 2023 16:26:12 -0500 Subject: [PATCH] feat(code_push_protocol): add currency to `ShorebirdPlan` (#1124) --- .../test/src/code_push_client_test.dart | 1 + .../lib/src/models/shorebird_plan.dart | 4 ++++ .../lib/src/models/shorebird_plan.g.dart | 2 ++ .../test/src/messages/get_usage/get_usage_response_test.dart | 1 + .../test/src/models/shorebird_plan_test.dart | 1 + .../test/src/models/subscription_test.dart | 1 + 6 files changed, 10 insertions(+) diff --git a/packages/shorebird_code_push_client/test/src/code_push_client_test.dart b/packages/shorebird_code_push_client/test/src/code_push_client_test.dart index fb0f2916..b1458607 100644 --- a/packages/shorebird_code_push_client/test/src/code_push_client_test.dart +++ b/packages/shorebird_code_push_client/test/src/code_push_client_test.dart @@ -2040,6 +2040,7 @@ void main() { plan: ShorebirdPlan( name: 'Hobby', monthlyCost: Money.fromIntWithCurrency(0, usd), + currency: 'USD', patchInstallLimit: 1000, maxTeamSize: 1, ), diff --git a/packages/shorebird_code_push_protocol/lib/src/models/shorebird_plan.dart b/packages/shorebird_code_push_protocol/lib/src/models/shorebird_plan.dart index f940d46e..2dc1887a 100644 --- a/packages/shorebird_code_push_protocol/lib/src/models/shorebird_plan.dart +++ b/packages/shorebird_code_push_protocol/lib/src/models/shorebird_plan.dart @@ -12,6 +12,7 @@ class ShorebirdPlan { const ShorebirdPlan({ required this.name, required this.monthlyCost, + required this.currency, required this.patchInstallLimit, this.maxTeamSize, }); @@ -29,6 +30,9 @@ class ShorebirdPlan { @MoneyConverter() final Money monthlyCost; + /// The currency of the plan (e.g. USD, CAD, etc.) + final String currency; + /// The number of patch installs allowed per billing period. This will be null /// for accounts with unlimited patch installs. final int? patchInstallLimit; diff --git a/packages/shorebird_code_push_protocol/lib/src/models/shorebird_plan.g.dart b/packages/shorebird_code_push_protocol/lib/src/models/shorebird_plan.g.dart index 8180cf53..8d6537b9 100644 --- a/packages/shorebird_code_push_protocol/lib/src/models/shorebird_plan.g.dart +++ b/packages/shorebird_code_push_protocol/lib/src/models/shorebird_plan.g.dart @@ -17,6 +17,7 @@ ShorebirdPlan _$ShorebirdPlanFromJson(Map json) => name: $checkedConvert('name', (v) => v as String), monthlyCost: $checkedConvert( 'monthly_cost', (v) => const MoneyConverter().fromJson(v as int)), + currency: $checkedConvert('currency', (v) => v as String), patchInstallLimit: $checkedConvert('patch_install_limit', (v) => v as int?), maxTeamSize: $checkedConvert('max_team_size', (v) => v as int?), @@ -34,6 +35,7 @@ Map _$ShorebirdPlanToJson(ShorebirdPlan instance) => { 'name': instance.name, 'monthly_cost': const MoneyConverter().toJson(instance.monthlyCost), + 'currency': instance.currency, 'patch_install_limit': instance.patchInstallLimit, 'max_team_size': instance.maxTeamSize, }; diff --git a/packages/shorebird_code_push_protocol/test/src/messages/get_usage/get_usage_response_test.dart b/packages/shorebird_code_push_protocol/test/src/messages/get_usage/get_usage_response_test.dart index f647e873..adb0e83d 100644 --- a/packages/shorebird_code_push_protocol/test/src/messages/get_usage/get_usage_response_test.dart +++ b/packages/shorebird_code_push_protocol/test/src/messages/get_usage/get_usage_response_test.dart @@ -8,6 +8,7 @@ void main() { plan: ShorebirdPlan( name: 'Hobby', monthlyCost: Money.fromIntWithCurrency(0, usd), + currency: 'USD', patchInstallLimit: 1000, maxTeamSize: 1, ), diff --git a/packages/shorebird_code_push_protocol/test/src/models/shorebird_plan_test.dart b/packages/shorebird_code_push_protocol/test/src/models/shorebird_plan_test.dart index 41fbe6a9..351d310f 100644 --- a/packages/shorebird_code_push_protocol/test/src/models/shorebird_plan_test.dart +++ b/packages/shorebird_code_push_protocol/test/src/models/shorebird_plan_test.dart @@ -7,6 +7,7 @@ void main() { final plan = ShorebirdPlan( name: 'Hobby', monthlyCost: Money.fromIntWithCurrency(0, usd), + currency: 'USD', patchInstallLimit: 1000, maxTeamSize: 1, ); diff --git a/packages/shorebird_code_push_protocol/test/src/models/subscription_test.dart b/packages/shorebird_code_push_protocol/test/src/models/subscription_test.dart index 94bbeb7b..97b09a4d 100644 --- a/packages/shorebird_code_push_protocol/test/src/models/subscription_test.dart +++ b/packages/shorebird_code_push_protocol/test/src/models/subscription_test.dart @@ -6,6 +6,7 @@ void main() { final plan = ShorebirdPlan( name: 'Hobby', monthlyCost: Money.fromIntWithCurrency(0, usd), + currency: 'USD', patchInstallLimit: 1000, maxTeamSize: 1, );