Skip to content

Latest commit

 

History

History
57 lines (48 loc) · 1.3 KB

examples.md

File metadata and controls

57 lines (48 loc) · 1.3 KB

Advanced examples

Verification mode

var response = await client.SendRevenueAsync(record, EetMode.Verification);

Using playground

var client = new EetClient(certificate, EetEnvironment.Playground);

Timeouts

The default HTTP request timeout is set to 2 seconds as per the Czech law. If you want to change it, you need to pass a parameter to the EetClient constructor:

var client = new EetClient(certificate, EetEnvironment.Playground, httpTimeout: TimeSpan.FromSeconds(20));

Logging

  • Catchall logger:
Action<string, object> logHandler = (message, detailsObject) => { ... };
var client = new EetClient(
    certificate,
    logger: logHandler
);
  • Selective logger:
Action<string, object> logHandler = (message, detailsObject) => { ... };
var client = new EetClient(
    certificate,
    logger: new EetLogger(onError: logHandler, onInfo: logHandler, onDebug: null)
);

Events

  • HTTP request duration
var client = new EetClient(certificate);
client.HttpRequestFinished += (sender, args) =>
{
    var duration = args.Duration;
};
  • Catching XML message sent to EET
var client = new EetClient(certificate);
client.XmlMessageSerialized += (sender, args) =>
{
    var xmlString = args.XmlElement.OuterXml;
};