-
Notifications
You must be signed in to change notification settings - Fork 572
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 #1896 from stripe/remi-add-creditnote-preview-lines
Add support for `CreditNoteLineItem`
- Loading branch information
Showing
14 changed files
with
453 additions
and
16 deletions.
There are no files selected for viewing
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
92 changes: 92 additions & 0 deletions
92
src/Stripe.net/Entities/CreditNoteLineItems/CreditNoteLineItem.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,92 @@ | ||
namespace Stripe | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
using Stripe.Infrastructure; | ||
|
||
public class CreditNoteLineItem : StripeEntity<CreditNoteLineItem>, IHasId, IHasObject | ||
{ | ||
/// <summary> | ||
/// Unique identifier for the object. | ||
/// </summary> | ||
[JsonProperty("id")] | ||
public string Id { get; set; } | ||
|
||
/// <summary> | ||
/// String representing the object’s type. Objects of the same type share the same value. | ||
/// </summary> | ||
[JsonProperty("object")] | ||
public string Object { get; set; } | ||
|
||
/// <summary> | ||
/// The integer amount representing the gross amount being credited for this line item, | ||
/// excluding (exclusive) tax and discounts. | ||
/// </summary> | ||
[JsonProperty("amount")] | ||
public long Amount { get; set; } | ||
|
||
/// <summary> | ||
/// Description of the item being credited. | ||
/// </summary> | ||
[JsonProperty("description")] | ||
public string Description { get; set; } | ||
|
||
/// <summary> | ||
/// The integer amount representing the discount being credited for this line item. | ||
/// </summary> | ||
[JsonProperty("discount_amount")] | ||
public long DiscountAmount { get; set; } | ||
|
||
/// <summary> | ||
/// ID of the invoice line item being credited. | ||
/// </summary> | ||
[JsonProperty("invoice_line_item")] | ||
public string InvoiceLineItem { get; set; } | ||
|
||
/// <summary> | ||
/// Has the value <c>true</c> if the object exists in live mode or the value <c>false</c> | ||
/// if the object exists in test mode. | ||
/// </summary> | ||
[JsonProperty("livemode")] | ||
public bool Livemode { get; set; } | ||
|
||
/// <summary> | ||
/// The number of units of product being credited. | ||
/// </summary> | ||
[JsonProperty("quantity")] | ||
public long Quantity { get; set; } | ||
|
||
/// <summary> | ||
/// The amount of tax calculated per tax rate for this line item. | ||
/// </summary> | ||
[JsonProperty("tax_amounts")] | ||
public List<CreditNoteTaxAmount> TaxAmounts { get; set; } | ||
|
||
/// <summary> | ||
/// Tax rates applied to the invoice. | ||
/// </summary> | ||
[JsonProperty("tax_rates")] | ||
public List<TaxRate> TaxRates { get; set; } | ||
|
||
/// <summary> | ||
/// The type of the credit note line item, one of <c>custom_line_item</c> or | ||
/// <c>invoice_line_item`</c>. | ||
/// </summary> | ||
[JsonProperty("type")] | ||
public string Type { get; set; } | ||
|
||
/// <summary> | ||
/// The cost of each unit of product being credited. | ||
/// </summary> | ||
[JsonProperty("unit_amount")] | ||
public long? UnitAmount { get; set; } | ||
|
||
/// <summary> | ||
/// Same as <see cref="UnitAmount"/>, but contains a decimal value with at most 12 decimal | ||
/// places. | ||
/// </summary> | ||
[JsonProperty("unit_amount_decimal")] | ||
public decimal? UnitAmountDecimal { get; set; } | ||
} | ||
} |
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
44 changes: 44 additions & 0 deletions
44
src/Stripe.net/Entities/CreditNotes/CreditNoteTaxAmount.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,44 @@ | ||
namespace Stripe | ||
{ | ||
using Newtonsoft.Json; | ||
using Stripe.Infrastructure; | ||
|
||
public class CreditNoteTaxAmount : StripeEntity<CreditNoteTaxAmount> | ||
{ | ||
/// <summary> | ||
/// The amount, in cents, of the tax. | ||
/// </summary> | ||
[JsonProperty("amount")] | ||
public long Amount { get; set; } | ||
|
||
/// <summary> | ||
/// Whether this tax amount is inclusive or exclusive. | ||
/// </summary> | ||
[JsonProperty("inclusive")] | ||
public bool Inclusive { get; set; } | ||
|
||
#region Expandable TaxRate | ||
|
||
/// <summary> | ||
/// The ID of the tax rate that was applied to get this tax amount. | ||
/// </summary> | ||
[JsonIgnore] | ||
public string TaxRateId | ||
{ | ||
get => this.InternalTaxRate?.Id; | ||
set => this.InternalTaxRate = SetExpandableFieldId(value, this.InternalTaxRate); | ||
} | ||
|
||
[JsonIgnore] | ||
public TaxRate TaxRate | ||
{ | ||
get => this.InternalTaxRate?.ExpandedObject; | ||
set => this.InternalTaxRate = SetExpandableFieldObject(value, this.InternalTaxRate); | ||
} | ||
|
||
[JsonProperty("tax_rate")] | ||
[JsonConverter(typeof(ExpandableFieldConverter<TaxRate>))] | ||
internal ExpandableField<TaxRate> InternalTaxRate { get; set; } | ||
#endregion | ||
} | ||
} |
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
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
73 changes: 73 additions & 0 deletions
73
src/Stripe.net/Services/CreditNotes/CreditNoteLineOptions.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,73 @@ | ||
namespace Stripe | ||
{ | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
|
||
public class CreditNoteLineOptions : INestedOptions, IHasMetadata | ||
{ | ||
/// <summary> | ||
/// The line item amount to credit. Only valid when <see cref="Type"/> is | ||
/// <c>invoice_line_item</c> and the referenced invoice line item does not have a quantity, | ||
/// only an amount. | ||
/// </summary> | ||
[JsonProperty("amount")] | ||
public long? Amount { get; set; } | ||
|
||
/// <summary> | ||
/// The description of the credit note line item. Only valid when the <see cref="Type"/> is | ||
/// <c>custom_line_item</c>. | ||
/// </summary> | ||
[JsonProperty("description")] | ||
public string Description { get; set; } | ||
|
||
/// <summary> | ||
/// The invoice line item to credit. Only valid when the <see cref="Type"/> is | ||
/// <c>invoice_line_item</c>. | ||
/// </summary> | ||
[JsonProperty("invoice_line_item")] | ||
public string InvoiceLineItem { get; set; } | ||
|
||
/// <summary> | ||
/// A set of key/value pairs that you can attach to a charge object. It can be useful for | ||
/// storing additional information about the customer in a structured format. It's often a | ||
/// good idea to store an email address in metadata for tracking later. | ||
/// </summary> | ||
[JsonProperty("metadata")] | ||
public Dictionary<string, string> Metadata { get; set; } | ||
|
||
/// <summary> | ||
/// The line item quantity to credit. | ||
/// </summary> | ||
[JsonProperty("quantity")] | ||
public long? Quantity { get; set; } | ||
|
||
/// <summary> | ||
/// The tax rates which apply to the credit note line item. Only valid when the | ||
/// <see cref="Type"/> is <c>custom_line_item</c>. | ||
/// </summary> | ||
[JsonProperty("tax_rates")] | ||
public List<string> TaxRates { get; set; } | ||
|
||
/// <summary> | ||
/// Type of the credit note line item, one of <c>custom_line_item</c> or | ||
/// <c>invoice_line_item</c>. | ||
/// </summary> | ||
[JsonProperty("type")] | ||
public string Type { get; set; } | ||
|
||
/// <summary> | ||
/// The integer unit amount of the credit note line item. This will be multiplied by the | ||
/// quantity to get the full amount to credit for this line item. Only valid | ||
/// when <see cref="Type"/> is <c>custom_line_item</c>. | ||
/// </summary> | ||
[JsonProperty("unit_amount")] | ||
public long? UnitAmount { get; set; } | ||
|
||
/// <summary> | ||
/// Same as <see cref="UnitAmount"/>, but contains a decimal value with at most 12 decimal | ||
/// places. | ||
/// </summary> | ||
[JsonProperty("unit_amount_decimal")] | ||
public decimal? UnitAmountDecimal { get; set; } | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/Stripe.net/Services/CreditNotes/CreditNoteListLineItemsOptions.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 @@ | ||
namespace Stripe | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
using Stripe.Infrastructure; | ||
|
||
public class CreditNoteListLineItemsOptions : ListOptions | ||
{ | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
src/Stripe.net/Services/CreditNotes/CreditNoteListPreviewLineItemsOptions.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,67 @@ | ||
namespace Stripe | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
using Stripe.Infrastructure; | ||
|
||
public class CreditNoteListPreviewLineItemsOptions : ListOptions, IHasMetadata | ||
{ | ||
/// <summary> | ||
/// Credit note amount. | ||
/// </summary> | ||
[JsonProperty("amount")] | ||
public long? Amount { get; set; } | ||
|
||
/// <summary> | ||
/// Amount to credit the customer balance. | ||
/// </summary> | ||
[JsonProperty("credit_amount")] | ||
public long? CreditAmount { get; set; } | ||
|
||
/// <summary> | ||
/// ID of the invoice. | ||
/// </summary> | ||
[JsonProperty("invoice")] | ||
public string Invoice { get; set; } | ||
|
||
/// <summary> | ||
/// Credit note memo. | ||
/// </summary> | ||
[JsonProperty("memo")] | ||
public string Memo { get; set; } | ||
|
||
/// <summary> | ||
/// Set of key-value pairs that you can attach to an object. This can be useful for storing | ||
/// additional information about the object in a structured format. | ||
/// </summary> | ||
[JsonProperty("metadata")] | ||
public Dictionary<string, string> Metadata { get; set; } | ||
|
||
/// <summary> | ||
/// The integer amount representing the amount that is credited outside of Stripe. | ||
/// </summary> | ||
[JsonProperty("out_of_band_amount")] | ||
public long? OutOfBandAmount { get; set; } | ||
|
||
/// <summary> | ||
/// Reason for issuing this credit note, one of <c>duplicate</c>, <c>fraudulent</c>, | ||
/// <c>order_change</c>, or <c>product_unsatisfactory</c>. | ||
/// </summary> | ||
[JsonProperty("reason")] | ||
public string Reason { get; set; } | ||
|
||
/// <summary> | ||
/// ID of an existing refund to link this credit note to. | ||
/// </summary> | ||
[JsonProperty("refund")] | ||
public string Refund { get; set; } | ||
|
||
/// <summary> | ||
/// Amount to refund. If set, a refund will be created for the charge associated with the | ||
/// invoice. | ||
/// </summary> | ||
[JsonProperty("refund_amount")] | ||
public long? RefundAmount { get; set; } | ||
} | ||
} |
Oops, something went wrong.