Skip to content

Commit

Permalink
Merge pull request #25 from mattgenious/dev
Browse files Browse the repository at this point in the history
Implemented RechargeSharp.EntityFrameworkCore.Entities. Implemented and updated RechargeSharp and RechargeSharp.Entities to full version
  • Loading branch information
mattgenious authored Dec 8, 2021
2 parents d39dcb7 + 7be8762 commit 2e649f6
Show file tree
Hide file tree
Showing 179 changed files with 850 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using RechargeSharp.Entities.Charges;
using RechargeSharp.Entities.EntityFrameworkCore.Entities.Customers;
using RechargeSharp.Entities.EntityFrameworkCore.Entities.Discounts;
using RechargeSharp.Entities.EntityFrameworkCore.Entities.Onetimes;
using RechargeSharp.Entities.EntityFrameworkCore.Entities.Orders;
using RechargeSharp.Entities.EntityFrameworkCore.Entities.Subscriptions;
using RechargeSharp.Entities.Shared;

namespace RechargeSharp.Entities.EntityFrameworkCore.Entities.Addresses
{
public class Address : RechargeSharp.Entities.Addresses.Address
{
[JsonIgnore]
public virtual Customer? Customer { get; set; }

[JsonIgnore]
public virtual Discount? Discount { get; set; }

[JsonIgnore]
public virtual ICollection<Onetime>? Onetimes { get; set; }

[JsonIgnore]
public virtual ICollection<Subscription>? Subscriptions { get; set; }

[JsonIgnore]
public virtual ICollection<Charge>? Charges { get; set; }

[JsonIgnore]
public virtual ICollection<Order>? Orders { get; set; }

[JsonProperty("cart_attributes")]
[NotMapped]
public new ICollection<Property>? CartAttributes { get; set; }

[JsonProperty("note_attributes")]
[NotMapped]
public new ICollection<Property>? NoteAttributes { get; set; }

[JsonProperty("original_shipping_lines")]
[NotMapped]
public new ICollection<ShippingLine>? OriginalShippingLines { get; set; }

[JsonProperty("shipping_lines_override")]
[NotMapped]
public new ICollection<ShippingLine>? ShippingLinesOverride { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using RechargeSharp.Entities.Charges;
using RechargeSharp.Entities.EntityFrameworkCore.Entities.Checkouts;
using RechargeSharp.Entities.EntityFrameworkCore.Entities.Customers;
using RechargeSharp.Entities.EntityFrameworkCore.Entities.Orders;
using RechargeSharp.Entities.Shared;

namespace RechargeSharp.Entities.EntityFrameworkCore.Entities.Charges
{
/// <summary>
/// <inheritdoc/>
/// </summary>
public class Charge : RechargeSharp.Entities.Charges.Charge
{
[JsonIgnore]
public virtual Customer? Customer { get; set; }

[JsonIgnore]
public virtual Address? Address { get; set; }

[JsonIgnore]
public virtual Order? Order { get; set; }

[JsonIgnore]
public virtual Checkout? Checkout { get; set; }

[JsonProperty("line_items")]
public new virtual ICollection<Shared.LineItem>? LineItems { get; set; }

[JsonProperty("analytics_data")]
[NotMapped]
public new AnalyticsData? AnalyticsData { get; set; }

[JsonProperty("billing_address")]
[NotMapped]
public new Address? BillingAddress { get; set; }

[JsonProperty("client_details")]
[NotMapped]
public new ChargeClientDetails? ClientDetails { get; set; }

[JsonProperty("discount_codes")]
[NotMapped]
public new ICollection<ChargeDiscountCode>? DiscountCodes { get; set; }

[JsonProperty("note_attributes")]
[NotMapped]
public new ICollection<Property>? NoteAttributes { get; set; }

[JsonProperty("shipping_address")]
[NotMapped]
public new Address? ShippingAddress { get; set; }

[JsonProperty("shipping_lines")]
[NotMapped]
public new ICollection<ShippingLine>? ShippingLines { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using Newtonsoft.Json;
using RechargeSharp.Entities.Checkouts;
using RechargeSharp.Entities.EntityFrameworkCore.Entities.Charges;
using RechargeSharp.Entities.Shared;
using System.ComponentModel.DataAnnotations.Schema;

namespace RechargeSharp.Entities.EntityFrameworkCore.Entities.Checkouts
{
public class Checkout : RechargeSharp.Entities.Checkouts.Checkout
{

[JsonIgnore]
public Charge? Charge { get; set; }

[JsonProperty("analytics_data", NullValueHandling = NullValueHandling.Ignore)]
[NotMapped]
public new AnalyticsData? AnalyticsData { get; set; }

[JsonProperty("applied_discount")]
[NotMapped]
public new CheckoutAppliedDiscount? AppliedDiscount { get; set; }

[JsonProperty("billing_address")]
[NotMapped]
public new Address? BillingAddress { get; set; }

[JsonProperty("line_items", NullValueHandling = NullValueHandling.Ignore)]
[NotMapped]
public new ICollection<CheckoutLineItem>? LineItems { get; set; }

[JsonProperty("note_attributes", NullValueHandling = NullValueHandling.Ignore)]
[NotMapped]
public new ICollection<Property>? NoteAttributes { get; set; }

[JsonProperty("shipping_address", NullValueHandling = NullValueHandling.Ignore)]
[NotMapped]
public new Address? ShippingAddress { get; set; }

[JsonProperty("shipping_address_validations", NullValueHandling = NullValueHandling.Ignore)]
[NotMapped]
public new ShippingAddressValidations? ShippingAddressValidations { get; set; }

[JsonProperty("shipping_line")]
[NotMapped]
public new ShippingLine? ShippingLine { get; set; }

[JsonProperty("shipping_rate")]
[NotMapped]
public new ShippingRate? ShippingRate { get; set; }

[JsonProperty("tax_lines", NullValueHandling = NullValueHandling.Ignore)]
[NotMapped]
public new ICollection<TaxLine>? TaxLines { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Newtonsoft.Json;
using RechargeSharp.Entities.EntityFrameworkCore.Entities.Addresses;
using RechargeSharp.Entities.EntityFrameworkCore.Entities.Charges;
using RechargeSharp.Entities.EntityFrameworkCore.Entities.Onetimes;
using RechargeSharp.Entities.EntityFrameworkCore.Entities.Orders;
using RechargeSharp.Entities.EntityFrameworkCore.Entities.Subscriptions;

namespace RechargeSharp.Entities.EntityFrameworkCore.Entities.Customers
{
public class Customer : RechargeSharp.Entities.Customers.Customer
{
[JsonIgnore]
public virtual ICollection<Address>? Addresses { get; set; }

[JsonIgnore]
public virtual ICollection<Subscription>? Subscriptions { get; set; }

[JsonIgnore]
public virtual ICollection<Charge>? Charges { get; set; }

[JsonIgnore]
public virtual ICollection<Order>? Orders { get; set; }

[JsonIgnore]
public virtual ICollection<Onetime>? Onetimes { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Newtonsoft.Json;
using RechargeSharp.Entities.EntityFrameworkCore.Entities.Addresses;

namespace RechargeSharp.Entities.EntityFrameworkCore.Entities.Discounts
{
public class Discount : RechargeSharp.Entities.Discounts.Discount
{
[JsonIgnore]
public virtual Address? Address { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Newtonsoft.Json;
using RechargeSharp.Entities.EntityFrameworkCore.Entities.Customers;
using RechargeSharp.Entities.EntityFrameworkCore.Entities.Products;
using RechargeSharp.Entities.Shared;
using System.ComponentModel.DataAnnotations.Schema;

namespace RechargeSharp.Entities.EntityFrameworkCore.Entities.Onetimes
{
public class Onetime : RechargeSharp.Entities.Onetimes.Onetime
{
[JsonIgnore]
public Address? Address { get; set; }

[JsonIgnore]
public Customer? Customer { get; set; }

[JsonIgnore]
public Product? Product { get; set; }

[JsonProperty("properties")]
[NotMapped]
public new ICollection<Property>? Properties { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using Newtonsoft.Json;
using RechargeSharp.Entities.EntityFrameworkCore.Entities.Charges;
using RechargeSharp.Entities.EntityFrameworkCore.Entities.Customers;
using RechargeSharp.Entities.Shared;
using System.ComponentModel.DataAnnotations.Schema;

namespace RechargeSharp.Entities.EntityFrameworkCore.Entities.Orders
{
public class Order : RechargeSharp.Entities.Orders.Order
{
[JsonIgnore]
public Addresses.Address? Address { get; set; }

[JsonIgnore]
public Charge? Charge { get; set; }

[JsonIgnore]
public Customer? Customer { get; set; }

[JsonProperty("line_items")]
public new ICollection<Shared.LineItem>? LineItems { get; set; }

[JsonProperty("billing_address")]
[NotMapped]
public new RechargeSharp.Entities.Shared.Address? BillingAddress { get; set; }

[JsonProperty("note_attributes")]
[NotMapped]
public new ICollection<Property>? NoteAttributes { get; set; }

[JsonProperty("shipping_address")]
[NotMapped]
public new Addresses.Address? ShippingAddress { get; set; }

[JsonProperty("shipping_lines")]
[NotMapped]
public new ICollection<ShippingLine>? ShippingLines { get; set; }

[JsonProperty("tax_lines")]
[NotMapped]
public new ICollection<TaxLine>? TaxLines { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
using Newtonsoft.Json;
using RechargeSharp.Entities.Products;
using RechargeSharp.Entities.Shared;

namespace RechargeSharp.Entities.EntityFrameworkCore.Entities.Products
{
public class Product : IEquatable<Product>
{
public bool Equals(Product other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return CollectionId == other.CollectionId && CreatedAt.Equals(other.CreatedAt) && DiscountAmount == other.DiscountAmount && DiscountType == other.DiscountType && Id == other.Id && Equals(Images, other.Images) && ProductId == other.ProductId && ShopifyProductId == other.ShopifyProductId && Equals(SubscriptionDefaults, other.SubscriptionDefaults) && Title == other.Title && UpdatedAt.Equals(other.UpdatedAt);
}

public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != GetType()) return false;
return Equals((Product)obj);
}

public override int GetHashCode()
{
unchecked
{
var hashCode = CollectionId.GetHashCode();
hashCode = hashCode * 397 ^ CreatedAt.GetHashCode();
hashCode = hashCode * 397 ^ DiscountAmount.GetHashCode();
hashCode = hashCode * 397 ^ (DiscountType != null ? DiscountType.GetHashCode() : 0);
hashCode = hashCode * 397 ^ Id.GetHashCode();
hashCode = hashCode * 397 ^ (Images != null ? Images.GetHashCode() : 0);
hashCode = hashCode * 397 ^ ProductId.GetHashCode();
hashCode = hashCode * 397 ^ ShopifyProductId.GetHashCode();
hashCode = hashCode * 397 ^ (SubscriptionDefaults != null ? SubscriptionDefaults.GetHashCode() : 0);
hashCode = hashCode * 397 ^ (Title != null ? Title.GetHashCode() : 0);
hashCode = hashCode * 397 ^ UpdatedAt.GetHashCode();
return hashCode;
}
}

public static bool operator ==(Product left, Product right)
{
return Equals(left, right);
}

public static bool operator !=(Product left, Product right)
{
return !Equals(left, right);
}

[JsonProperty("collection_id")]
public long CollectionId { get; set; }

[JsonProperty("created_at")]
public DateTimeOffset CreatedAt { get; set; }

[JsonProperty("discount_amount")]
public long DiscountAmount { get; set; }

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

[JsonProperty("id")]
public long Id { get; set; }

[JsonProperty("images")]
public Images Images { get; set; }

[JsonProperty("product_id")]
public long ProductId { get; set; }

[JsonProperty("shopify_product_id")]
public long ShopifyProductId { get; set; }

[JsonProperty("subscription_defaults")]
public ProductSubscriptionDefaults SubscriptionDefaults { get; set; }

[JsonProperty("title")]
public string Title { get; set; }

[JsonProperty("updated_at")]
public DateTimeOffset UpdatedAt { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using RechargeSharp.Entities.EntityFrameworkCore.Entities.Subscriptions;
using RechargeSharp.Entities.Shared;

namespace RechargeSharp.Entities.EntityFrameworkCore.Entities.Shared
{
public class LineItem : RechargeSharp.Entities.Shared.LineItem
{
[JsonIgnore]
public string? Id { get; set; }

[JsonIgnore]
public virtual Subscription? Subscription { get; set; }

[JsonProperty("images")]
[NotMapped]
public new Images? Images { get; set; }

[JsonProperty("properties")]
[NotMapped]
public new ICollection<Property>? Properties { get; set; }
}
}
Loading

0 comments on commit 2e649f6

Please sign in to comment.