Skip to content

Commit

Permalink
Merge pull request #22 from mattgenious/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
mattgenious authored Sep 8, 2021
2 parents d6798e2 + e938fd6 commit c832b29
Show file tree
Hide file tree
Showing 66 changed files with 1,672 additions and 1,015 deletions.
8 changes: 4 additions & 4 deletions RechargeSharp/Entities/Charges/Charge.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using RechargeSharp.Entities.Shared;

namespace RechargeSharp.Entities.Charges
Expand All @@ -11,7 +12,7 @@ public bool Equals(Charge other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return AddressId == other.AddressId && Equals(AnalyticsData, other.AnalyticsData) && Equals(BillingAddress, other.BillingAddress) && Equals(ClientDetails, other.ClientDetails) && CreatedAt.Equals(other.CreatedAt) && CustomerHash == other.CustomerHash && CustomerId == other.CustomerId && Email == other.Email && FirstName == other.FirstName && HasUncommitedChanges == other.HasUncommitedChanges && Id == other.Id && LastName == other.LastName && Note == other.Note && Nullable.Equals(ProcessedAt, other.ProcessedAt) && ProcessorName == other.ProcessorName && Nullable.Equals(ScheduledAt, other.ScheduledAt) && ShipmentsCount == other.ShipmentsCount && Equals(ShippingAddress, other.ShippingAddress) && ShopifyOrderId == other.ShopifyOrderId && Status == other.Status && SubTotal == other.SubTotal && SubtotalPrice == other.SubtotalPrice && Tags == other.Tags && TaxLines == other.TaxLines && TotalDiscounts == other.TotalDiscounts && TotalLineItemsPrice == other.TotalLineItemsPrice && TotalPrice == other.TotalPrice && TotalRefunds == other.TotalRefunds && TotalTax == other.TotalTax && TotalWeight == other.TotalWeight && TransactionId == other.TransactionId && Type == other.Type && UpdatedAt.Equals(other.UpdatedAt);
return AddressId == other.AddressId && Equals(BillingAddress, other.BillingAddress) && Equals(ClientDetails, other.ClientDetails) && CreatedAt.Equals(other.CreatedAt) && CustomerHash == other.CustomerHash && CustomerId == other.CustomerId && Email == other.Email && FirstName == other.FirstName && HasUncommitedChanges == other.HasUncommitedChanges && Id == other.Id && LastName == other.LastName && Note == other.Note && Nullable.Equals(ProcessedAt, other.ProcessedAt) && ProcessorName == other.ProcessorName && Nullable.Equals(ScheduledAt, other.ScheduledAt) && ShipmentsCount == other.ShipmentsCount && Equals(ShippingAddress, other.ShippingAddress) && ShopifyOrderId == other.ShopifyOrderId && Status == other.Status && SubTotal == other.SubTotal && SubtotalPrice == other.SubtotalPrice && Tags == other.Tags && TaxLines == other.TaxLines && TotalDiscounts == other.TotalDiscounts && TotalLineItemsPrice == other.TotalLineItemsPrice && TotalPrice == other.TotalPrice && TotalRefunds == other.TotalRefunds && TotalTax == other.TotalTax && TotalWeight == other.TotalWeight && TransactionId == other.TransactionId && Type == other.Type && UpdatedAt.Equals(other.UpdatedAt);
}

public override bool Equals(object obj)
Expand All @@ -27,7 +28,6 @@ public override int GetHashCode()
unchecked
{
var hashCode = AddressId.GetHashCode();
hashCode = (hashCode * 397) ^ (AnalyticsData != null ? AnalyticsData.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (BillingAddress != null ? BillingAddress.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (ClientDetails != null ? ClientDetails.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ CreatedAt.GetHashCode();
Expand All @@ -45,7 +45,7 @@ public override int GetHashCode()
hashCode = (hashCode * 397) ^ ShipmentsCount.GetHashCode();
hashCode = (hashCode * 397) ^ (ShippingAddress != null ? ShippingAddress.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ ShopifyOrderId.GetHashCode();
hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ Status.GetHashCode();
hashCode = (hashCode * 397) ^ (SubTotal != null ? SubTotal.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ SubtotalPrice.GetHashCode();
hashCode = (hashCode * 397) ^ (Tags != null ? Tags.GetHashCode() : 0);
Expand Down Expand Up @@ -143,7 +143,7 @@ public override int GetHashCode()
public long? ShopifyOrderId { get; set; }

[JsonProperty("status")]
public string Status { get; set; }
public ChargeStatus? Status { get; set; }

[JsonProperty("sub_total")]
public string SubTotal { get; set; }
Expand Down
17 changes: 17 additions & 0 deletions RechargeSharp/Entities/Charges/ChargeStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Newtonsoft.Json.Converters;
using Newtonsoft.Json;
using System.Runtime.Serialization;

namespace RechargeSharp.Entities.Charges
{
[JsonConverter(typeof(StringEnumConverter))]
public enum ChargeStatus
{
[EnumMember(Value = "SUCCESS")] Success,
[EnumMember(Value = "ERROR")] Error,
[EnumMember(Value = "QUEUED")] Queued,
[EnumMember(Value = "SKIPPED")] Skipped,
[EnumMember(Value = "REFUNDED")] Refunded,
[EnumMember(Value = "PARTIALLY_REFUNDED")] PartiallyRefunded
}
}
5 changes: 2 additions & 3 deletions RechargeSharp/Entities/Checkouts/Checkout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class Checkout : IEquatable<Checkout>
public string ExternalCheckoutSource { get; set; }

[JsonProperty("external_customer_id")]
public object ExternalCustomerId { get; set; }
public string ExternalCustomerId { get; set; }

[JsonProperty("line_items", NullValueHandling = NullValueHandling.Ignore)]
public List<CheckoutLineItem> LineItems { get; set; }
Expand Down Expand Up @@ -108,7 +108,7 @@ public bool Equals(Checkout other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return Equals(AnalyticsData, other.AnalyticsData) && Equals(AppliedDiscount, other.AppliedDiscount) && Equals(BillingAddress, other.BillingAddress) && BuyerAcceptsMarketing == other.BuyerAcceptsMarketing && ChargeId == other.ChargeId && Nullable.Equals(CompletedAt, other.CompletedAt) && Nullable.Equals(CreatedAt, other.CreatedAt) && Currency == other.Currency && DiscountCode == other.DiscountCode && Email == other.Email && ExternalCheckoutId == other.ExternalCheckoutId && ExternalCheckoutSource == other.ExternalCheckoutSource && Equals(ExternalCustomerId, other.ExternalCustomerId) && Note == other.Note && PaymentProcessor == other.PaymentProcessor && PaymentProcessorCustomerId == other.PaymentProcessorCustomerId && PaymentProcessorTransactionId == other.PaymentProcessorTransactionId && Phone == other.Phone && RequiresShipping == other.RequiresShipping && Equals(ShippingAddress, other.ShippingAddress) && Equals(ShippingAddressValidations, other.ShippingAddressValidations) && Equals(ShippingLine, other.ShippingLine) && SubtotalPrice == other.SubtotalPrice && TaxesIncluded == other.TaxesIncluded && Token == other.Token && TotalPrice == other.TotalPrice && TotalTax == other.TotalTax && Nullable.Equals(UpdatedAt, other.UpdatedAt);
return Equals(AppliedDiscount, other.AppliedDiscount) && Equals(BillingAddress, other.BillingAddress) && BuyerAcceptsMarketing == other.BuyerAcceptsMarketing && ChargeId == other.ChargeId && Nullable.Equals(CompletedAt, other.CompletedAt) && Nullable.Equals(CreatedAt, other.CreatedAt) && Currency == other.Currency && DiscountCode == other.DiscountCode && Email == other.Email && ExternalCheckoutId == other.ExternalCheckoutId && ExternalCheckoutSource == other.ExternalCheckoutSource && Equals(ExternalCustomerId, other.ExternalCustomerId) && Note == other.Note && PaymentProcessor == other.PaymentProcessor && PaymentProcessorCustomerId == other.PaymentProcessorCustomerId && PaymentProcessorTransactionId == other.PaymentProcessorTransactionId && Phone == other.Phone && RequiresShipping == other.RequiresShipping && Equals(ShippingAddress, other.ShippingAddress) && Equals(ShippingAddressValidations, other.ShippingAddressValidations) && Equals(ShippingLine, other.ShippingLine) && SubtotalPrice == other.SubtotalPrice && TaxesIncluded == other.TaxesIncluded && Token == other.Token && TotalPrice == other.TotalPrice && TotalTax == other.TotalTax && Nullable.Equals(UpdatedAt, other.UpdatedAt);
}

public override bool Equals(object obj)
Expand All @@ -122,7 +122,6 @@ public override bool Equals(object obj)
public override int GetHashCode()
{
var hashCode = new HashCode();
hashCode.Add(AnalyticsData);
hashCode.Add(AppliedDiscount);
hashCode.Add(BillingAddress);
hashCode.Add(BuyerAcceptsMarketing);
Expand Down
2 changes: 1 addition & 1 deletion RechargeSharp/Entities/Checkouts/CheckoutResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public override bool Equals(object obj)

public override int GetHashCode()
{
return (Checkout != null ? Checkout.GetHashCode() : 0);
return Checkout != null ? Checkout.GetHashCode() : 0;
}

public static bool operator ==(CheckoutResponse left, CheckoutResponse right)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public bool Equals(CreateCheckoutRequestCheckout other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return Equals(ShippingAddress, other.ShippingAddress) && Equals(BillingAddress, other.BillingAddress) && Equals(AnalyticsData, other.AnalyticsData) && Email == other.Email && Note == other.Note && DiscountCode == other.DiscountCode && Phone == other.Phone && BuyerAcceptsMarketing == other.BuyerAcceptsMarketing;
return Equals(ShippingAddress, other.ShippingAddress) && Equals(BillingAddress, other.BillingAddress) && Email == other.Email && Note == other.Note && DiscountCode == other.DiscountCode && Phone == other.Phone && BuyerAcceptsMarketing == other.BuyerAcceptsMarketing;
}

public override bool Equals(object obj)
Expand All @@ -29,7 +29,6 @@ public override int GetHashCode()
{
var hashCode = (ShippingAddress != null ? ShippingAddress.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (BillingAddress != null ? BillingAddress.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (AnalyticsData != null ? AnalyticsData.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (Email != null ? Email.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (Note != null ? Note.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (DiscountCode != null ? DiscountCode.GetHashCode() : 0);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace RechargeSharp.Entities.Checkouts
namespace RechargeSharp.Entities.Checkouts
{
public static class ProcessCheckoutErrorMessages
{
Expand Down
5 changes: 3 additions & 2 deletions RechargeSharp/Entities/Customers/Customer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace RechargeSharp.Entities.Customers
{
Expand Down Expand Up @@ -41,7 +42,7 @@ public override int GetHashCode()
hashCode = (hashCode * 397) ^ (BillingCountry != null ? BillingCountry.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (BillingPhone != null ? BillingPhone.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (ProcessorType != null ? ProcessorType.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ Status.GetHashCode();
hashCode = (hashCode * 397) ^ (StripeCustomerToken != null ? StripeCustomerToken.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ HasValidPaymentMethod.GetHashCode();
hashCode = (hashCode * 397) ^ (ReasonPaymentMethodNotValid != null ? ReasonPaymentMethodNotValid.GetHashCode() : 0);
Expand Down Expand Up @@ -115,7 +116,7 @@ public override int GetHashCode()
public string ProcessorType { get; set; }

[JsonProperty("status")]
public string Status { get; set; }
public CustomerStatus? Status { get; set; }

[JsonProperty("stripe_customer_token")]
public string StripeCustomerToken { get; set; }
Expand Down
15 changes: 15 additions & 0 deletions RechargeSharp/Entities/Customers/CustomerStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Newtonsoft.Json.Converters;
using Newtonsoft.Json;
using System.Runtime.Serialization;

namespace RechargeSharp.Entities.Customers
{
[JsonConverter(typeof(StringEnumConverter))]
public enum CustomerStatus
{
[EnumMember(Value = "ACTIVE")]
Active,
[EnumMember(Value = "INACTIVE")]
Inactive
}
}
17 changes: 17 additions & 0 deletions RechargeSharp/Entities/Discounts/AppliesToProductType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Newtonsoft.Json.Converters;
using Newtonsoft.Json;
using System.Runtime.Serialization;

namespace RechargeSharp.Entities.Discounts
{
[JsonConverter(typeof(StringEnumConverter))]
public enum AppliesToProductType
{
[EnumMember(Value = "ALL")]
All,
[EnumMember(Value = "ONETIME")]
Onetime,
[EnumMember(Value = "SUBSCRIPTION")]
Subscription
}
}
15 changes: 15 additions & 0 deletions RechargeSharp/Entities/Discounts/AppliesToResource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Newtonsoft.Json.Converters;
using Newtonsoft.Json;
using System.Runtime.Serialization;

namespace RechargeSharp.Entities.Discounts
{
[JsonConverter(typeof(StringEnumConverter))]
public enum AppliesToResource
{
[EnumMember(Value = "shopify_product")]
ShopifyProduct,
[EnumMember(Value = "shopify_collection_id")]
ShopifyCollectionId
}
}
19 changes: 10 additions & 9 deletions RechargeSharp/Entities/Discounts/Discount.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace RechargeSharp.Entities.Discounts
{
Expand Down Expand Up @@ -29,16 +30,16 @@ public override int GetHashCode()
hashCode = (hashCode * 397) ^ Value.GetHashCode();
hashCode = (hashCode * 397) ^ EndsAt.GetHashCode();
hashCode = (hashCode * 397) ^ StartsAt.GetHashCode();
hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ Status.GetHashCode();
hashCode = (hashCode * 397) ^ UsageLimit.GetHashCode();
hashCode = (hashCode * 397) ^ AppliesToId.GetHashCode();
hashCode = (hashCode * 397) ^ (DiscountType != null ? DiscountType.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (AppliesTo != null ? AppliesTo.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (AppliesToResource != null ? AppliesToResource.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ AppliesToResource.GetHashCode();
hashCode = (hashCode * 397) ^ TimesUsed.GetHashCode();
hashCode = (hashCode * 397) ^ (Duration != null ? Duration.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ Duration.GetHashCode();
hashCode = (hashCode * 397) ^ DurationUsageLimit.GetHashCode();
hashCode = (hashCode * 397) ^ (AppliesToProductType != null ? AppliesToProductType.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ AppliesToProductType.GetHashCode();
hashCode = (hashCode * 397) ^ CreatedAt.GetHashCode();
hashCode = (hashCode * 397) ^ UpdatedAt.GetHashCode();
hashCode = (hashCode * 397) ^ OncePerCustomer.GetHashCode();
Expand Down Expand Up @@ -72,7 +73,7 @@ public override int GetHashCode()
public DateTime? StartsAt { get; set; }

[JsonProperty("status")]
public string Status { get; set; }
public DiscountStatus? Status { get; set; }

[JsonProperty("usage_limit")]
public long? UsageLimit { get; set; }
Expand All @@ -81,25 +82,25 @@ public override int GetHashCode()
public long? AppliesToId { get; set; }

[JsonProperty("discount_type")]
public string DiscountType { get; set; }
public DiscountType? DiscountType { get; set; }

[JsonProperty("applies_to")]
public string AppliesTo { get; set; }

[JsonProperty("applies_to_resource")]
public string AppliesToResource { get; set; }
public AppliesToResource? AppliesToResource { get; set; }

[JsonProperty("times_used")]
public long TimesUsed { get; set; }

[JsonProperty("duration")]
public string Duration { get; set; }
public Duration? Duration { get; set; }

[JsonProperty("duration_usage_limit")]
public long? DurationUsageLimit { get; set; }

[JsonProperty("applies_to_product_type")]
public string AppliesToProductType { get; set; }
public AppliesToProductType? AppliesToProductType { get; set; }

[JsonProperty("created_at")]
public DateTime CreatedAt { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion RechargeSharp/Entities/Discounts/DiscountListResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace RechargeSharp.Entities.Discounts
{
class DiscountListResponse : IEquatable<DiscountListResponse>
public class DiscountListResponse : IEquatable<DiscountListResponse>
{
public bool Equals(DiscountListResponse other)
{
Expand Down
2 changes: 1 addition & 1 deletion RechargeSharp/Entities/Discounts/DiscountResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace RechargeSharp.Entities.Discounts
{
class DiscountResponse : IEquatable<DiscountResponse>
public class DiscountResponse : IEquatable<DiscountResponse>
{
public bool Equals(DiscountResponse other)
{
Expand Down
17 changes: 17 additions & 0 deletions RechargeSharp/Entities/Discounts/DiscountStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Newtonsoft.Json.Converters;
using Newtonsoft.Json;
using System.Runtime.Serialization;

namespace RechargeSharp.Entities.Discounts
{
[JsonConverter(typeof(StringEnumConverter))]
public enum DiscountStatus
{
[EnumMember(Value = "enabled")]
Enabled,
[EnumMember(Value = "disabled")]
Disabled,
[EnumMember(Value = "fully_disabled")]
FullyDisabled
}
}
15 changes: 15 additions & 0 deletions RechargeSharp/Entities/Discounts/DiscountType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Newtonsoft.Json.Converters;
using Newtonsoft.Json;
using System.Runtime.Serialization;

namespace RechargeSharp.Entities.Discounts
{
[JsonConverter(typeof(StringEnumConverter))]
public enum DiscountType
{
[EnumMember(Value = "percentage")]
Percentage,
[EnumMember(Value = "fixed_amount")]
FixedAmount
}
}
17 changes: 17 additions & 0 deletions RechargeSharp/Entities/Discounts/Duration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Newtonsoft.Json.Converters;
using Newtonsoft.Json;
using System.Runtime.Serialization;

namespace RechargeSharp.Entities.Discounts
{
[JsonConverter(typeof(StringEnumConverter))]
public enum Duration
{
[EnumMember(Value = "forever")]
Forever,
[EnumMember(Value = "usage_limit")]
UsageLimit,
[EnumMember(Value = "single_use")]
SingleUse
}
}
5 changes: 3 additions & 2 deletions RechargeSharp/Entities/Metafields/Metafield.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace RechargeSharp.Entities.Metafields
{
Expand Down Expand Up @@ -30,7 +31,7 @@ public override int GetHashCode()
hashCode = (hashCode * 397) ^ (Key != null ? Key.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (Namespace != null ? Namespace.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ OwnerId.GetHashCode();
hashCode = (hashCode * 397) ^ (OwnerResource != null ? OwnerResource.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ OwnerResource.GetHashCode();
hashCode = (hashCode * 397) ^ UpdatedAt.GetHashCode();
hashCode = (hashCode * 397) ^ (Value != null ? Value.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (ValueType != null ? ValueType.GetHashCode() : 0);
Expand Down Expand Up @@ -67,7 +68,7 @@ public override int GetHashCode()
public long OwnerId { get; set; }

[JsonProperty("owner_resource")]
public string OwnerResource { get; set; }
public OwnerResource? OwnerResource { get; set; }

[JsonProperty("updated_at")]
public DateTime UpdatedAt { get; set; }
Expand Down
21 changes: 21 additions & 0 deletions RechargeSharp/Entities/Metafields/OwnerResource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Newtonsoft.Json.Converters;
using Newtonsoft.Json;
using System.Runtime.Serialization;

namespace RechargeSharp.Entities.Metafields
{
[JsonConverter(typeof(StringEnumConverter))]
public enum OwnerResource
{
[EnumMember(Value = "store")]
Store,
[EnumMember(Value = "customer")]
Customer,
[EnumMember(Value = "subscription")]
Subscription,
[EnumMember(Value = "order")]
Order,
[EnumMember(Value = "charge")]
Charge
}
}
Loading

0 comments on commit c832b29

Please sign in to comment.