XeroAPI/xero-ruby

get_invoice returns batch payment ID as if it were payment ID

steveh opened this issue · 1 comments

Given two invoices with payments created in the same batch, get_invoices returns the correct value for batch_payment_id and payment_id:

xero_client.get_invoices(xero_organisation.id, i_ds: [inv1.invoice_id, inv2.invoice_id]).invoices.flat_map(&:payments).map(&:batch_payment_id)
=> ["137916a0-c94b-4b94-a708-67424f1c1dac", "137916a0-c94b-4b94-a708-67424f1c1dac"]

xero_client.get_invoices(xero_organisation.id, i_ds: [inv1.invoice_id, inv2.invoice_id]).invoices.flat_map(&:payments).map(&:payment_id)
=> ["90462a0c-da8d-492c-8109-85cf41cdcefc", "2ce0c26f-ea1d-46d3-9b62-62a1566cd441"]

However, get_invoice returns the value of batch_payment_id instead:

xero_client.get_invoice(org_id, inv1_id).invoices[0].payments[0].payment_id
=> "137916a0-c94b-4b94-a708-67424f1c1dac"

xero_client.get_invoice(org_id, inv2_id).invoices[0].payments[0].payment_id
=> "137916a0-c94b-4b94-a708-67424f1c1dac"

I expected:

xero_client.get_invoice(org_id, inv1_id).invoices[0].payments[0].payment_id
=> "90462a0c-da8d-492c-8109-85cf41cdcefc"

xero_client.get_invoice(org_id, inv2_id).invoices[0].payments[0].payment_id
=> "2ce0c26f-ea1d-46d3-9b62-62a1566cd441"

Hi @steveh - thank you for picking up this. I've replicated the issue, and have raised internally.
Will keep you posted.