Skip to content

Commit

Permalink
refactor: rename binding contract initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilbaczek committed Feb 1, 2024
1 parent 9dc01ce commit 79d6c4e
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,17 @@ public static Contract Prepare(Guid customerId, int customerAge, int customerHei
StandardDuration);
}

internal BindingContract Sign(DateTimeOffset signedAt, DateTimeOffset dateNow)
public BindingContract Sign(DateTimeOffset signedAt, DateTimeOffset dateNow)
{
if (IsSigned)
{
throw new ContractAlreadySignedException();
}
BusinessRuleValidator.Validate(
new ContractMustNotBeAlreadySigned(IsSigned));

BusinessRuleValidator.Validate(
new ContractCanOnlyBeSignedWithin30DaysFromPreparation(PreparedAt, signedAt));

SignedAt = signedAt;
var expiringAt = dateNow.Add(Duration);
var bindingContract = BindingContract.Acceptance(Id, CustomerId, Duration, expiringAt);
var bindingContract = BindingContract.Start(Id, CustomerId, Duration, expiringAt);

return bindingContract;
}
Expand Down

0 comments on commit 79d6c4e

Please sign in to comment.