public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is InvoicePaymentRequest other &&
                   ((Uid == null && other.Uid == null) || (Uid?.Equals(other.Uid) == true)) &&
                   ((RequestMethod == null && other.RequestMethod == null) || (RequestMethod?.Equals(other.RequestMethod) == true)) &&
                   ((RequestType == null && other.RequestType == null) || (RequestType?.Equals(other.RequestType) == true)) &&
                   ((DueDate == null && other.DueDate == null) || (DueDate?.Equals(other.DueDate) == true)) &&
                   ((FixedAmountRequestedMoney == null && other.FixedAmountRequestedMoney == null) || (FixedAmountRequestedMoney?.Equals(other.FixedAmountRequestedMoney) == true)) &&
                   ((PercentageRequested == null && other.PercentageRequested == null) || (PercentageRequested?.Equals(other.PercentageRequested) == true)) &&
                   ((TippingEnabled == null && other.TippingEnabled == null) || (TippingEnabled?.Equals(other.TippingEnabled) == true)) &&
                   ((AutomaticPaymentSource == null && other.AutomaticPaymentSource == null) || (AutomaticPaymentSource?.Equals(other.AutomaticPaymentSource) == true)) &&
                   ((CardId == null && other.CardId == null) || (CardId?.Equals(other.CardId) == true)) &&
                   ((Reminders == null && other.Reminders == null) || (Reminders?.Equals(other.Reminders) == true)) &&
                   ((ComputedAmountMoney == null && other.ComputedAmountMoney == null) || (ComputedAmountMoney?.Equals(other.ComputedAmountMoney) == true)) &&
                   ((TotalCompletedAmountMoney == null && other.TotalCompletedAmountMoney == null) || (TotalCompletedAmountMoney?.Equals(other.TotalCompletedAmountMoney) == true)) &&
                   ((RoundingAdjustmentIncludedMoney == null && other.RoundingAdjustmentIncludedMoney == null) || (RoundingAdjustmentIncludedMoney?.Equals(other.RoundingAdjustmentIncludedMoney) == true)));
        }
示例#2
0
        public async Task <IActionResult> OnPost()
        {
            string responseContent = "[]";

            try
            {
                Uri baseURL = new Uri(BaseUrl);

                HttpClient client = new HttpClient();

                // Any parameters? Get value, and then add to the client
                string key = HttpUtility.ParseQueryString(baseURL.Query).Get("key");
                if (key != "")
                {
                    client.DefaultRequestHeaders.Add("api-key", key);
                }


                if (RequestMethod.Equals("GET"))
                {
                    HttpResponseMessage response = await client.GetAsync(baseURL.ToString());

                    if (response.IsSuccessStatusCode)
                    {
                        responseContent = await response.Content.ReadAsStringAsync();
                    }
                }

                else if (RequestMethod.Equals("POST"))
                {
                    JObject jObject = JObject.Parse(Data);

                    var stringContent = new StringContent(jObject.ToString(), Encoding.UTF8, "application/json");

                    HttpResponseMessage response = await client.PostAsync(baseURL.ToString(), stringContent);

                    if (response.IsSuccessStatusCode)
                    {
                        responseContent = await response.Content.ReadAsStringAsync();
                    }
                }

                return(RedirectToPage("Response", new { result = responseContent }));
            }
            catch (ArgumentNullException uex)
            {
                return(RedirectToPage("Error", new { msg = uex.Message + " | URL missing or invalid." }));
            }
            catch (JsonReaderException jex)
            {
                return(RedirectToPage("Error", new { msg = jex.Message + " | Json data could not be read." }));
            }
            catch (Exception ex)
            {
                return(RedirectToPage("Error", new { msg = ex.Message + " | Are you missing some Json keys and values? Please check your Json data." }));
            }
        }