Exemplo n.º 1
0
        /// <summary>
        /// Get data type from event type
        /// </summary>
        /// <param name="type">Webhhok event type</param>
        /// <returns></returns>
        protected Type GetDataType(WebhookEventEnum type)
        {
            switch (type)
            {
            case WebhookEventEnum.CustomerCreated:
            case WebhookEventEnum.CustomerUpdated:
                return(typeof(GetCustomerResponse));

            case WebhookEventEnum.ChargeCreated:
            case WebhookEventEnum.ChargeOverpaid:
            case WebhookEventEnum.ChargePaid:
            case WebhookEventEnum.ChargePartialCanceled:
            case WebhookEventEnum.ChargePaymentFailed:
            case WebhookEventEnum.ChargePending:
            case WebhookEventEnum.ChargeRefunded:
            case WebhookEventEnum.ChargeUnderpaid:
            case WebhookEventEnum.ChargeUpdated:
            case WebhookEventEnum.ChargeProcessing:
                return(typeof(GetChargeResponse));

            case WebhookEventEnum.OrderCanceled:
            case WebhookEventEnum.OrderClosed:
            case WebhookEventEnum.OrderPaid:
            case WebhookEventEnum.OrderCreated:
            case WebhookEventEnum.OrderPaymentFailed:
            case WebhookEventEnum.OrderUpdated:
                return(typeof(GetOrderResponse));

            case WebhookEventEnum.SubscriptionCanceled:
            case WebhookEventEnum.SubscriptionCreated:
            case WebhookEventEnum.SubscriptionDeleted:
            case WebhookEventEnum.SubscriptionUpdated:
                return(typeof(GetSubscriptionResponse));

            case WebhookEventEnum.InvoiceCanceled:
            case WebhookEventEnum.InvoiceCreated:
            case WebhookEventEnum.InvoicePaid:
            case WebhookEventEnum.InvoicePaymentFailed:
            case WebhookEventEnum.InvoiceUpdated:
                return(typeof(GetInvoiceResponse));

            default:
                return(null);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="WebhookResultDto" /> class.
 /// </summary>
 /// <param name="id">id.</param>
 /// <param name="userId">userId (required).</param>
 /// <param name="inboxId">inboxId (required).</param>
 /// <param name="webhookId">webhookId (required).</param>
 /// <param name="webhookUrl">webhookUrl (required).</param>
 /// <param name="messageId">messageId (required).</param>
 /// <param name="redriveId">redriveId.</param>
 /// <param name="httpMethod">httpMethod (required).</param>
 /// <param name="webhookEvent">webhookEvent (required).</param>
 /// <param name="responseStatus">responseStatus.</param>
 /// <param name="responseTimeMillis">responseTimeMillis (required).</param>
 /// <param name="responseBodyExtract">responseBodyExtract.</param>
 /// <param name="resultType">resultType.</param>
 /// <param name="createdAt">createdAt (required).</param>
 /// <param name="updatedAt">updatedAt (required).</param>
 /// <param name="seen">seen.</param>
 public WebhookResultDto(Guid id = default(Guid), Guid userId = default(Guid), Guid inboxId = default(Guid), Guid webhookId = default(Guid), string webhookUrl = default(string), string messageId = default(string), Guid redriveId = default(Guid), HttpMethodEnum httpMethod = default(HttpMethodEnum), WebhookEventEnum webhookEvent = default(WebhookEventEnum), int responseStatus = default(int), long responseTimeMillis = default(long), string responseBodyExtract = default(string), ResultTypeEnum?resultType = default(ResultTypeEnum?), DateTime createdAt = default(DateTime), DateTime updatedAt = default(DateTime), bool seen = default(bool))
 {
     this.UserId    = userId;
     this.InboxId   = inboxId;
     this.WebhookId = webhookId;
     // to ensure "webhookUrl" is required (not null)
     this.WebhookUrl = webhookUrl ?? throw new ArgumentNullException("webhookUrl is a required property for WebhookResultDto and cannot be null");
     // to ensure "messageId" is required (not null)
     this.MessageId          = messageId ?? throw new ArgumentNullException("messageId is a required property for WebhookResultDto and cannot be null");
     this.HttpMethod         = httpMethod;
     this.WebhookEvent       = webhookEvent;
     this.ResponseTimeMillis = responseTimeMillis;
     this.CreatedAt          = createdAt;
     this.UpdatedAt          = updatedAt;
     this.Id                  = id;
     this.RedriveId           = redriveId;
     this.ResponseStatus      = responseStatus;
     this.ResponseBodyExtract = responseBodyExtract;
     this.ResultType          = resultType;
     this.Seen                = seen;
 }