-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#80 ILogger for UPS provider, updated IShippingProvider interface
- Loading branch information
1 parent
a6d2652
commit 04b2488
Showing
22 changed files
with
442 additions
and
338 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace ShippingRates.Models | ||
{ | ||
internal class RateResultBuilder | ||
{ | ||
private readonly string _providerName; | ||
private readonly List<Rate> _rates = new List<Rate>(); | ||
private readonly List<Error> _errors = new List<Error>(); | ||
private readonly List<string> _internalErrors = new List<string>(); | ||
|
||
internal RateResultBuilder(string providerName) | ||
{ | ||
_providerName = providerName; | ||
} | ||
|
||
internal void AddError(Error error) | ||
{ | ||
_errors.Add(error); | ||
} | ||
|
||
internal void AddInternalError(string error) | ||
{ | ||
_internalErrors.Add(error); | ||
} | ||
|
||
internal void AddRate(string providerCode, string name, decimal totalCharges, DateTime delivery, RateOptions options, string currencyCode) | ||
{ | ||
_rates.Add(new Rate(_providerName, providerCode, name, totalCharges, delivery, options, currencyCode)); | ||
} | ||
|
||
internal RateResult GetRateResult() | ||
{ | ||
var result = new RateResult(); | ||
result.Rates.AddRange(_rates); | ||
result.Errors.AddRange(_errors); | ||
result.InternalErrors.AddRange(_internalErrors); | ||
return result; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.