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

fix(Invoice Ninja Node): Fix assigning an invoice to a payment #9590

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

CodeShakingSheep
Copy link
Contributor

@CodeShakingSheep CodeShakingSheep commented Jun 2, 2024

Summary

Describe what the PR does and how to test. Photos and videos are recommended.

Currently, when creating a payment and specifying an invoice ID for it, the invoice isn't assigned to the payment. Instead, an unapplied payment is created in InvoiceNinja. This is because the body for the payment create request has changed in API v5, see https://api-docs.invoicing.co/#post-/api/v1/payments.

This PR fixes this by keeping the current request body for API version 4 and changes adds an invoices array to the request body for API version 5.

{
  <OLD_PAYMENT_CREATE_REQUEST_BODY>
  "invoices": [
    {
      "invoice_id": "{{INVOICE_ID}}",
      "amount": "{{AMOUNT}}"
    }
  ]
}

Related tickets and issues

Include links to Linear ticket or Github issue or Community forum post. Important in order to close automatically and provide context to reviewers.

None available. I just used the Invoice Ninja API node and figured that a payment is never assigned to an invoice although an invoice_id has been specified.

Review / Merge checklist

  • PR title and summary are descriptive. Remember, the title automatically goes into the changelog. Use (no-changelog) otherwise. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.

    A bug is not considered fixed, unless a test is added to prevent it from happening again.
    A feature is not complete without tests.

@n8n-assistant n8n-assistant bot added community Authored by a community member node/improvement New feature or request in linear Issue or PR has been created in Linear for internal review labels Jun 2, 2024
@CodeShakingSheep
Copy link
Contributor Author

@Joffcom Can this PR please get a review asap? It's broken functionality that's not working with the latest InvoiceNinja software and should be fixed. I made the changes as minimal invasive as possible as not to break v4 functionality. Thank you.

Same applies to #9589. As it seems InvoiceNinja v5 isn't working for 1.5 years when I look at the history of #4807 . So, I would really appreciate having this reviewed and merged asap. If there's anything I can do to speed this up, please let me know.

@Joffcom
Copy link
Member

Joffcom commented Jun 19, 2024

Hey @CodeShakingSheep,

Sorry I had a week off so wasn't able to get to this one, This PR is on my list to check tomorrow morning which is one of 2 review sessions I do each week.

@CodeShakingSheep
Copy link
Contributor Author

Hey @Joffcom,
of course, I hope you enjoyed your week off. As the PR hasn't been reviewed yet, I added a commit to fix assigning a payment type to a payment. This didn't work either in v5 as the key has been changed from payment_type_id to type_id. See https://api-docs.invoicing.co/#post-/api/v1/Payments Though, I kept version 4 compatibility.

I made the changes in my Invoice Ninja PRs as small as possible. I'd appreciate a review of these PRs asap when you have your next review session. Thank you 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Authored by a community member in linear Issue or PR has been created in Linear for internal review node/improvement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants