-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInstrucoesDoTitulo.cs
92 lines (75 loc) · 3.88 KB
/
InstrucoesDoTitulo.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
using System;
namespace NetBoletoSantander
{
public class InstrucoesDoTitulo
{
public double Multa { get; }
public int MultaApos { get; }
public double Juros { get; }
public TipoDesconto TipoDesconto { get; }
public double ValorDesconto { get; }
public DateTime? DataLimiteDesconto { get; }
public double ValorAbatimento { get; }
public TipoProtesto TipoProtesto { get; }
public int ProtestarApos { get; }
public int BaixarApos { get; }
public TipoPagamento TipoPagamento { get; }
public int QuantidadePagamentosPossiveis { get; }
public TipoValor TipoValor { get; }
public double PercentualMinimo { get; }
public double PercentualMaximo { get; }
public InstrucoesDoTitulo(double multa, int multaApos, double juros, TipoDesconto tipoDesconto,
double valorDesconto, DateTime? dataLimiteDesconto, double valorAbatimento, TipoProtesto tipoProtesto,
int protestarApos, int baixarApos, TipoPagamento tipoPagamento, int quantidadePagamentosPossiveis,
TipoValor tipoValor, double percentualMinimo, double percentualMaximo)
{
Multa = multa;
MultaApos = multaApos;
Juros = juros;
TipoDesconto = tipoDesconto;
ValorDesconto = valorDesconto;
DataLimiteDesconto = dataLimiteDesconto;
ValorAbatimento = valorAbatimento;
TipoProtesto = tipoProtesto;
ProtestarApos = protestarApos;
BaixarApos = baixarApos;
TipoPagamento = tipoPagamento;
QuantidadePagamentosPossiveis = quantidadePagamentosPossiveis;
TipoValor = tipoValor;
PercentualMinimo = percentualMinimo;
PercentualMaximo = percentualMaximo;
Validar();
}
private void Validar()
{
if (Multa < 0)
throw new ArgumentException("Não poder ser menor que 0.", "Multa");
if (MultaApos < 0)
throw new ArgumentException("Não poder ser menor que 0.", "MultaApos");
if (MultaApos > 99)
throw new ArgumentException("Não poder ter mais que 2 dígitos.", "MultaApos");
if (Juros < 0)
throw new ArgumentException("Não poder ser menor que 0.", "Juros");
if (ValorDesconto < 0)
throw new ArgumentException("Não poder ser menor que 0.", "ValorDesconto");
if (ValorAbatimento < 0)
throw new ArgumentException("Não poder ser menor que 0.", "ValorAbatimento");
if (ProtestarApos < 0)
throw new ArgumentException("Não poder ser menor que 0.", "ProtestarApos");
if (ProtestarApos > 99)
throw new ArgumentException("Não poder ter mais que 2 dígitos.", "ProtestarApos");
if (BaixarApos < 0)
throw new ArgumentException("Não poder ser menor que 0.", "BaixarApos");
if (BaixarApos > 99)
throw new ArgumentException("Não poder ter mais que 2 dígitos.", "BaixarApos");
if (QuantidadePagamentosPossiveis < 0)
throw new ArgumentException("Não poder ser menor que 0.", "QuantidadePagamentosPossiveis");
if (QuantidadePagamentosPossiveis > 99)
throw new ArgumentException("Não poder ter mais que 2 dígitos.", "QuantidadePagamentosPossiveis");
if (PercentualMinimo < 0)
throw new ArgumentException("Não poder ser menor que 0.", "PercentualMinimo");
if (PercentualMaximo < 0)
throw new ArgumentException("Não poder ser menor que 0.", "PercentualMaximo");
}
}
}