Skip to content

Commit

Permalink
Fix serialization of all entities when async methods are used
Browse files Browse the repository at this point in the history
  • Loading branch information
jared-invoiced committed Sep 8, 2023
1 parent ad5b31f commit 57a4998
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 48 deletions.
14 changes: 7 additions & 7 deletions invoicedapi/Entities/Coupon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected override string EntityId()
// Conditional Serialisation
public bool ShouldSerializeId()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);;
}

public bool ShouldSerializeObject()
Expand All @@ -58,32 +58,32 @@ public bool ShouldSerializeObject()

public bool ShouldSerializeCurrency()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeValue()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeIsPercent()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeExclusive()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeExpirationDate()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeMaxRedemptions()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeCreatedAt()
Expand Down
4 changes: 2 additions & 2 deletions invoicedapi/Entities/Customer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,12 @@ public bool ShouldSerializeNextChaseStep()

public bool ShouldSerializeAutopayDelayDays()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializePaymentSource()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeSignUpUrl()
Expand Down
16 changes: 8 additions & 8 deletions invoicedapi/Entities/Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected override string EntityId()
// Conditional Serialisation
public bool ShouldSerializeId()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeObject()
Expand All @@ -66,37 +66,37 @@ public bool ShouldSerializeObject()

public bool ShouldSerializeCurrency()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeUnitCost()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeTaxable()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeTaxes()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeAvalaraTaxCode()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeGlAccount()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeDiscountable()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeCreatedAt()
Expand Down
4 changes: 2 additions & 2 deletions invoicedapi/Entities/Note.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ public bool ShouldSerializeCustomer()

public bool ShouldSerializeCustomerId()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeInvoiceId()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeCreatedAt()
Expand Down
2 changes: 1 addition & 1 deletion invoicedapi/Entities/PaymentPlan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public bool ShouldSerializeStatus()

public bool ShouldSerializeInstallments()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeApproval()
Expand Down
2 changes: 1 addition & 1 deletion invoicedapi/Entities/PendingLineItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public bool ShouldSerializeId()

public bool ShouldSerializeItem()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}
}
}
18 changes: 9 additions & 9 deletions invoicedapi/Entities/Plan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public virtual bool HasStringId()
// Conditional Serialisation
public bool ShouldSerializeId()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeObject()
Expand All @@ -65,42 +65,42 @@ public bool ShouldSerializeObject()

public bool ShouldSerializeItem()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeCurrency()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeAmount()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializePricingMode()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeQuantityType()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeInterval()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeIntervalCount()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeTiers()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeCreatedAt()
Expand Down
24 changes: 12 additions & 12 deletions invoicedapi/Entities/Subscription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public async Task<SubscriptionPreview> PreviewAsync()

public bool ShouldSerializeId()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeObject()
Expand All @@ -139,27 +139,27 @@ public bool ShouldSerializeObject()

public bool ShouldSerializeCustomer()
{
return CurrentOperation != "SaveAll";
return CurrentOperation != nameof(SaveAll) && CurrentOperation != nameof(SaveAllAsync);
}

public bool ShouldSerializePlan()
{
return CurrentOperation != "SaveAll";
return CurrentOperation != nameof(SaveAll) && CurrentOperation != nameof(SaveAllAsync);
}

public bool ShouldSerializeCycles()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeStartDate()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeBillIn()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializePeriodStart()
Expand All @@ -174,7 +174,7 @@ public bool ShouldSerializePeriodEnd()

public bool ShouldSerializeCancelAtPeriodEnd()
{
return CurrentOperation != "Preview";
return CurrentOperation != nameof(Preview) && CurrentOperation != nameof(PreviewAsync);
}

public bool ShouldSerializeCanceledAt()
Expand All @@ -184,7 +184,7 @@ public bool ShouldSerializeCanceledAt()

public bool ShouldSerializePaused()
{
return CurrentOperation != "Preview";
return CurrentOperation != nameof(Preview) && CurrentOperation != nameof(PreviewAsync);
}

public bool ShouldSerializeStatus()
Expand All @@ -204,12 +204,12 @@ public bool ShouldSerializeContractPeriodEnd()

public bool ShouldSerializeRenewalCycles()
{
return CurrentOperation != "Preview";
return CurrentOperation != nameof(Preview) && CurrentOperation != nameof(PreviewAsync);
}

public bool ShouldSerializeRenewalMode()
{
return CurrentOperation != "Preview";
return CurrentOperation != nameof(Preview) && CurrentOperation != nameof(PreviewAsync);
}

public bool ShouldSerializeRecurringTotal()
Expand Down Expand Up @@ -239,12 +239,12 @@ public bool ShouldSerializeUpdatedAt()

public bool ShouldSerializeMetadata()
{
return CurrentOperation != "Preview";
return CurrentOperation != nameof(Preview) && CurrentOperation != nameof(PreviewAsync);
}

public bool ShouldSerializePendingLineItems()
{
return CurrentOperation == "Preview";
return CurrentOperation == nameof(Preview) || CurrentOperation == nameof(PreviewAsync);
}
}
}
2 changes: 1 addition & 1 deletion invoicedapi/Entities/Task.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public bool ShouldSerializeId()

public bool ShouldSerializeCustomerId()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeComplete()
Expand Down
10 changes: 5 additions & 5 deletions invoicedapi/Entities/TaxRate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public virtual bool HasStringId()
// Conditional Serialisation
public bool ShouldSerializeId()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeObject()
Expand All @@ -57,22 +57,22 @@ public bool ShouldSerializeObject()

public bool ShouldSerializeCurrency()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeValue()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeIsPercent()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeInclusive()
{
return CurrentOperation == "Create";
return CurrentOperation == nameof(Create) || CurrentOperation == nameof(CreateAsync);
}

public bool ShouldSerializeCreatedAt()
Expand Down

0 comments on commit 57a4998

Please sign in to comment.