feat(code_push_protocol): add currency to ShorebirdPlan (#1124)

This commit is contained in:
Felix Angelov
2023-08-17 16:26:12 -05:00
committed by GitHub
parent 2c10539594
commit 382b36fb96
6 changed files with 10 additions and 0 deletions
@@ -2040,6 +2040,7 @@ void main() {
plan: ShorebirdPlan(
name: 'Hobby',
monthlyCost: Money.fromIntWithCurrency(0, usd),
currency: 'USD',
patchInstallLimit: 1000,
maxTeamSize: 1,
),
@@ -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;
@@ -17,6 +17,7 @@ ShorebirdPlan _$ShorebirdPlanFromJson(Map<String, dynamic> 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<String, dynamic> _$ShorebirdPlanToJson(ShorebirdPlan instance) =>
<String, dynamic>{
'name': instance.name,
'monthly_cost': const MoneyConverter().toJson(instance.monthlyCost),
'currency': instance.currency,
'patch_install_limit': instance.patchInstallLimit,
'max_team_size': instance.maxTeamSize,
};
@@ -8,6 +8,7 @@ void main() {
plan: ShorebirdPlan(
name: 'Hobby',
monthlyCost: Money.fromIntWithCurrency(0, usd),
currency: 'USD',
patchInstallLimit: 1000,
maxTeamSize: 1,
),
@@ -7,6 +7,7 @@ void main() {
final plan = ShorebirdPlan(
name: 'Hobby',
monthlyCost: Money.fromIntWithCurrency(0, usd),
currency: 'USD',
patchInstallLimit: 1000,
maxTeamSize: 1,
);
@@ -6,6 +6,7 @@ void main() {
final plan = ShorebirdPlan(
name: 'Hobby',
monthlyCost: Money.fromIntWithCurrency(0, usd),
currency: 'USD',
patchInstallLimit: 1000,
maxTeamSize: 1,
);