Skip to content

Instantly share code, notes, and snippets.

@JoachimL
Created March 18, 2017 07:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoachimL/7aab1cdf5732b61d8e48d15748a9dc51 to your computer and use it in GitHub Desktop.
Save JoachimL/7aab1cdf5732b61d8e48d15748a9dc51 to your computer and use it in GitHub Desktop.
Main entry point
public static async Task Run(string message, TraceWriter log)
{
log.Info($"Processing incoming barcode: {message}");
var incoming = IncomingBarcode.FromMessage(message);
var httpClient = await CreateKolonialHttpClientAsync();
var kolonialProduct = await GetKolonialProductAsync(httpClient, incoming.Barcode);
if(kolonialProduct == null)
log.Warning($"Product with barcode {incoming.Barcode} is not available at Kolonial.");
else
await AddProductToCartAsync (httpClient, kolonialProduct, log);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment