Skip to content

Commit

Permalink
fix: Scarto fattura se presenta uno sconto a 3+ cifre decimali
Browse files Browse the repository at this point in the history
Closes #401
  • Loading branch information
nicolaiarocci committed Aug 3, 2023
1 parent d47dc4e commit 4fd609e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

## In Development

- Fix: Scarto Fattura se presenta uno sconto a 3+ cifre decimali ([#401][401])
- Fix: typos nella documentazione ([#399][399])

[401]: https://github.com/FatturaElettronica/FatturaElettronica.NET/issues/401
[399]: https://github.com/FatturaElettronica/FatturaElettronica.NET/pull/399

## Stable
Expand Down
9 changes: 8 additions & 1 deletion Extensions/DecimalRuleExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,25 @@ public static void ScalePrecision8DecimalType<T>(this IRuleBuilder<T, decimal> r
{
ruleBuilder.ScalePrecision(8, 19);

Check warning on line 9 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'

Check warning on line 9 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'

Check warning on line 9 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (macOS-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'

Check warning on line 9 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (macOS-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'

Check warning on line 9 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'

Check warning on line 9 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'
}

public static void ScalePrecision2DecimalType<T>(this IRuleBuilder<T, decimal> ruleBuilder)
{
ruleBuilder.ScalePrecision(2, 13);

Check warning on line 14 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'

Check warning on line 14 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'

Check warning on line 14 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (macOS-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'

Check warning on line 14 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (macOS-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'

Check warning on line 14 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'

Check warning on line 14 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'
}

public static void ScalePrecision8DecimalType<T>(this IRuleBuilder<T, decimal?> ruleBuilder)
{
ruleBuilder.ScalePrecision(8, 19);

Check warning on line 19 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal?>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'

Check warning on line 19 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal?>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'

Check warning on line 19 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (macOS-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal?>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'

Check warning on line 19 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (macOS-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal?>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'

Check warning on line 19 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal?>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'

Check warning on line 19 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal?>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'
}

public static void ScalePrecision2DecimalType<T>(this IRuleBuilder<T, decimal?> ruleBuilder)
{
ruleBuilder.ScalePrecision(2, 13);

Check warning on line 24 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal?>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'

Check warning on line 24 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (macOS-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal?>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'

Check warning on line 24 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal?>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'
}

public static void ScalePrecisionPercentualeDecimalType<T>(this IRuleBuilder<T, decimal?> ruleBuilder)
{
ruleBuilder.ScalePrecision(2, 6);

Check warning on line 29 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal?>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'

Check warning on line 29 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (macOS-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal?>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'

Check warning on line 29 in Extensions/DecimalRuleExtensions.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

'DefaultValidatorExtensions.ScalePrecision<T>(IRuleBuilder<T, decimal?>, int, int, bool)' is obsolete: 'Please use the PrecisionScale method instead, which takes precision as the first parameter and scale as the second. See https://github.com/FluentValidation/FluentValidation/issues/2030 for further details'
}
}
}
5 changes: 5 additions & 0 deletions Test/Common/ScontoMaggiorazioneValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,10 @@ public void Importo()
{
AssertDecimalType(x => x.Importo, 8, 19);
}
[TestMethod]
public void Percentuale()
{
AssertDecimalType(x => x.Percentuale, 2, 6);
}
}
}
2 changes: 2 additions & 0 deletions Validators/ScontoMaggiorazioneValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public ScontoMaggiorazioneValidator()
.WithErrorCode("00437");
RuleFor(x => x.Importo)
.ScalePrecision8DecimalType();
RuleFor(x => x.Percentuale)
.ScalePrecisionPercentualeDecimalType();
}
}
}

0 comments on commit 4fd609e

Please sign in to comment.