-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from mattgenious/dev
Implemented RechargeSharp.EntityFrameworkCore.Entities. Implemented and updated RechargeSharp and RechargeSharp.Entities to full version
- Loading branch information
Showing
179 changed files
with
850 additions
and
32 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
RechargeSharp.Entities.EntityFrameworkCore/Entities/Addresses/Address.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
RechargeSharp.Entities.EntityFrameworkCore/Entities/Charges/Charge.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
RechargeSharp.Entities.EntityFrameworkCore/Entities/Checkouts/Checkout.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
RechargeSharp.Entities.EntityFrameworkCore/Entities/Customers/Customer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
RechargeSharp.Entities.EntityFrameworkCore/Entities/Discounts/Discount.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
RechargeSharp.Entities.EntityFrameworkCore/Entities/Onetimes/OneTime.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
RechargeSharp.Entities.EntityFrameworkCore/Entities/Orders/Order.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
RechargeSharp.Entities.EntityFrameworkCore/Entities/Products/Product.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
RechargeSharp.Entities.EntityFrameworkCore/Entities/Shared/LineItem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | ||
} | ||
} |
Oops, something went wrong.