Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoice.InvoiceLineItem: add Metered property #43

Open
dgaspar opened this issue Nov 17, 2021 · 2 comments
Open

Invoice.InvoiceLineItem: add Metered property #43

dgaspar opened this issue Nov 17, 2021 · 2 comments

Comments

@dgaspar
Copy link

dgaspar commented Nov 17, 2021

Would it be possible to expose a Metered property in the Invoice.InvoiceLineItem model?
The value is already coming from the wire.

By adding this method:

        public bool Metered 
        {
            get { return GetValue<bool>("metered"); }
        }

To this class:

public class InvoiceLineItem : Resource

@cb-prajaktachavan
Copy link
Contributor

Hi, In Invoice we have "status" property which will have pending as a value when it has line items that belong to items that are metered. So basically Item model has metered property but not Invoice.InvoiceLineItem. If that is not what you want could you please elaborate more what exactly you want.

@dgaspar
Copy link
Author

dgaspar commented Dec 14, 2021

It's s just that in my use case I needed to know exactly which InvoiceLineItem(s) of an Invoice were Metered.
We pulled that off in a hacky way:

private static bool IsMetered(this Invoice.InvoiceLineItem lineItem)
{
    var jToken = lineItem.GetJToken();
    return jToken["metered"] != null && (jToken["metered"]?.ToObject<bool>() ?? false);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants