Ejemplo n.º 1
0
 public static async Task SendTicket(
     [BlobTrigger("tickets/{blobname}.{blobextension}")] ICloudBlob ticket,
     [DocumentDB(databaseName: "%CosmosDB%", collectionName: "%CosmosCollection%", ConnectionStringSetting = "CosmosConnection", Id = "{blobname}")] NewPayment payment,
     TraceWriter log)
 {
     log.Info($"procesing file tickets/{payment.Id}.data");
     log.Info($"Prepare to send email to {payment.Email}");
 }
Ejemplo n.º 2
0
 public static async Task OnNewPayment(
     [QueueTrigger("payments")] NewPayment newPayment,
     [DocumentDB(databaseName: "%CosmosDB%", collectionName: "%CosmosCollection%", ConnectionStringSetting = "CosmosConnection", CreateIfNotExists = true)] IAsyncCollector <NewPayment> collector
     )
 {
     if (!newPayment.Valid)
     {
         throw new ArgumentException("Payment is not valid");
     }
     await collector.AddAsync(newPayment);
 }
Ejemplo n.º 3
0
        public static async Task OnError(
            [QueueTrigger("payments-poison")] NewPayment errorPayment,
            TraceWriter log,
            [SendGrid(ApiKey = "SengridKey")]  IAsyncCollector <SendGridMessage> collector)
        {
            var builder = new StringBuilder();

            builder.AppendLine("German, El siguiente pago fue rechazado. Contactar la plataforma y al asistente.");
            builder.AppendLine($"Email: {errorPayment.Email}");
            builder.AppendLine($"Nombre: {errorPayment.Name}");
            builder.AppendLine($"Apellido: {errorPayment.LastName}");
            builder.AppendLine($"Transaccion: {errorPayment.Transaction}");

            var mail = new SendGridMessage();

            mail.AddTo("*****@*****.**");
            mail.AddContent("text/plain", builder.ToString());
            mail.SetSubject("Pago Rechazado");
            mail.SetFrom("*****@*****.**");

            await collector.AddAsync(mail);
        }