Skip to content

Invoiced::Invoice#payment_plan returns the payment plan ID when it should return an Invoiced::PaymentPlan instance #21

@arthurhess

Description

@arthurhess

Hi!

I'm trying to retrieve a payment plan from an Invoiced::Invoice object, but here's what I'm getting.

api_client = Invoiced::Client.new(...)
invoice = api_client.Invoice.retrieve(...)
invoice.payment_plan
# => (payment plan id, integer)

I'm guessing it's returning the attribute from @values. I might have time to investigate it later and suggest something through a PR, but it may take a while as this isn't urgent for me.

I'm working around it by instantiating Invoiced::PaymentPlan and calling retrieve on it directly:

Invoiced::PaymentPlan.new(api_client).set_endpoint_base("/invoices/#{invoice.id}").retrieve
# => (instance of Invoiced::PaymentPlan)

I wanted to leave this here anyway, in case someone else coming across this issue has time to fix it (or just use the workaround above)

Edit: I realize Invoiced::Object#set_endpoint_base is probably private API, so I'll be locking this gem's version in my project for now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions