从 Xero 删除发票

发布于 2025-01-09 12:25:32 字数 4575 浏览 0 评论 0原文

我正在尝试通过将发票状态更新为“已删除”来从 Xero 中删除发票。在 xeroizer github 页面之后,我尝试了以下操作:

xero = XeroApp.find_by(business_id: 270);
invoice = xero.find_invoice_by_ref(372).first
delete_invoice = xero.xero_client.Invoice.build(id: invoice.id, status: 'DELETED')
delete_invoice.save #=> false
delete_invoice.status #=> "AUTHORISED"

不幸的是,这不会更新发票状态。我认为也许删除相应的付款可能会有所帮助,但事实并非如此。顺便说一句,我使用了类似的方法来删除上面的付款,这确实有效。


delete_invoice.save 的响应是:

XeroGateway Request: GET /api.xro/2.0/Invoices/09b354ba-c659-4aac-b353-7d56cb52c2d6?unitdp=4
XeroGateway Response (200)
/api.xro/2.0/Invoices/09b354ba-c659-4aac-b353-7d56cb52c2d6?unitdp=4
== Response Body

<Response xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance">
  <Id>3033fc56-2eed-446c-a16b-1c0a3678f6cf</Id>
  <Status>OK</Status>
  <ProviderName>My-App</ProviderName>
  <DateTimeUTC>2022-02-24T13:40:46.7218944Z</DateTimeUTC>
  <Invoices>
    <Invoice>
      <Contact>
        <ContactID>0bb81c84-22a0-40fc-a12b-322646752710</ContactID>
        <ContactStatus>ACTIVE</ContactStatus>
        <Name>Sagar Pandya</Name>
        <Addresses>
          <Address>
            <AddressType>STREET</AddressType>
          </Address>
          <Address>
            <AddressType>POBOX</AddressType>
            <AddressLine1>123 High Road</AddressLine1>
            <City>London</City>
            <PostalCode>SW1 8RE</PostalCode>
            <Country>United Kingdom</Country>
          </Address>
        </Addresses>
        <Phones>
          <Phone>
            <PhoneType>DEFAULT</PhoneType>
            <PhoneNumber>07123456789</PhoneNumber>
          </Phone>
          <Phone>
            <PhoneType>DDI</PhoneType>
          </Phone>
          <Phone>
            <PhoneType>FAX</PhoneType>
          </Phone>
          <Phone>
            <PhoneType>MOBILE</PhoneType>
          </Phone>
        </Phones>
        <UpdatedDateUTC>2022-02-08T20:01:08.327</UpdatedDateUTC>
        <IsSupplier>false</IsSupplier>
        <IsCustomer>true</IsCustomer>
      </Contact>
      <Date>2022-02-24T00:00:00</Date>
      <DueDate>2022-02-24T00:00:00</DueDate>
      <BrandingThemeID>5d4dd402-c851-497e-aae1-9ff265c0d15a</BrandingThemeID>
      <Status>AUTHORISED</Status>
      <LineAmountTypes>Exclusive</LineAmountTypes>
      <LineItems>
        <LineItem>
          <ItemCode>FOOTYT</ItemCode>
          <Description>Football T-Shirt</Description>
          <UnitAmount>100.0000</UnitAmount>
          <TaxType>NONE</TaxType>
          <TaxAmount>0.00</TaxAmount>
          <LineAmount>100.00</LineAmount>
          <AccountCode>200</AccountCode>
          <Item>
            <ItemID>0ad76998-051d-4031-9f97-fba6b9bb255e</ItemID>
            <Code>FOOTYT</Code>
          </Item>
          <Quantity>1.0000</Quantity>
          <LineItemID>497fc08c-3571-49cb-bcd7-6a28533f9d34</LineItemID>
        </LineItem>
      </LineItems>
      <SubTotal>100.00</SubTotal>
      <TotalTax>0.00</TotalTax>
      <Total>100.00</Total>
      <UpdatedDateUTC>2022-02-24T12:26:13.317</UpdatedDateUTC>
      <CurrencyCode>GBP</CurrencyCode>
      <Type>ACCREC</Type>
      <InvoiceID>09b354ba-c659-4aac-b353-7d56cb52c2d6</InvoiceID>
      <InvoiceNumber>INV-0073</InvoiceNumber>
      <Reference>372</Reference>
      <AmountDue>100.00</AmountDue>
      <AmountPaid>0.00</AmountPaid>
      <SentToContact>false</SentToContact>
      <CurrencyRate>1.0000000000</CurrencyRate>
      <HasAttachments>false</HasAttachments>
      <HasErrors>false</HasErrors>
    </Invoice>
  </Invoices>
</Response>
== End Response Body
=> false

I'm trying to delete an invoice from Xero by updating its status to "DELETED". Following the xeroizer github page I have tried the following:

xero = XeroApp.find_by(business_id: 270);
invoice = xero.find_invoice_by_ref(372).first
delete_invoice = xero.xero_client.Invoice.build(id: invoice.id, status: 'DELETED')
delete_invoice.save #=> false
delete_invoice.status #=> "AUTHORISED"

Unfortunately this doesn't update the invoice status. I thought that maybe removing the corresponding payment may help but it didn't. Incidentally I used a similar approach for removing the payment as above which did work.


Response to delete_invoice.save is:

XeroGateway Request: GET /api.xro/2.0/Invoices/09b354ba-c659-4aac-b353-7d56cb52c2d6?unitdp=4
XeroGateway Response (200)
/api.xro/2.0/Invoices/09b354ba-c659-4aac-b353-7d56cb52c2d6?unitdp=4
== Response Body

<Response xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance">
  <Id>3033fc56-2eed-446c-a16b-1c0a3678f6cf</Id>
  <Status>OK</Status>
  <ProviderName>My-App</ProviderName>
  <DateTimeUTC>2022-02-24T13:40:46.7218944Z</DateTimeUTC>
  <Invoices>
    <Invoice>
      <Contact>
        <ContactID>0bb81c84-22a0-40fc-a12b-322646752710</ContactID>
        <ContactStatus>ACTIVE</ContactStatus>
        <Name>Sagar Pandya</Name>
        <Addresses>
          <Address>
            <AddressType>STREET</AddressType>
          </Address>
          <Address>
            <AddressType>POBOX</AddressType>
            <AddressLine1>123 High Road</AddressLine1>
            <City>London</City>
            <PostalCode>SW1 8RE</PostalCode>
            <Country>United Kingdom</Country>
          </Address>
        </Addresses>
        <Phones>
          <Phone>
            <PhoneType>DEFAULT</PhoneType>
            <PhoneNumber>07123456789</PhoneNumber>
          </Phone>
          <Phone>
            <PhoneType>DDI</PhoneType>
          </Phone>
          <Phone>
            <PhoneType>FAX</PhoneType>
          </Phone>
          <Phone>
            <PhoneType>MOBILE</PhoneType>
          </Phone>
        </Phones>
        <UpdatedDateUTC>2022-02-08T20:01:08.327</UpdatedDateUTC>
        <IsSupplier>false</IsSupplier>
        <IsCustomer>true</IsCustomer>
      </Contact>
      <Date>2022-02-24T00:00:00</Date>
      <DueDate>2022-02-24T00:00:00</DueDate>
      <BrandingThemeID>5d4dd402-c851-497e-aae1-9ff265c0d15a</BrandingThemeID>
      <Status>AUTHORISED</Status>
      <LineAmountTypes>Exclusive</LineAmountTypes>
      <LineItems>
        <LineItem>
          <ItemCode>FOOTYT</ItemCode>
          <Description>Football T-Shirt</Description>
          <UnitAmount>100.0000</UnitAmount>
          <TaxType>NONE</TaxType>
          <TaxAmount>0.00</TaxAmount>
          <LineAmount>100.00</LineAmount>
          <AccountCode>200</AccountCode>
          <Item>
            <ItemID>0ad76998-051d-4031-9f97-fba6b9bb255e</ItemID>
            <Code>FOOTYT</Code>
          </Item>
          <Quantity>1.0000</Quantity>
          <LineItemID>497fc08c-3571-49cb-bcd7-6a28533f9d34</LineItemID>
        </LineItem>
      </LineItems>
      <SubTotal>100.00</SubTotal>
      <TotalTax>0.00</TotalTax>
      <Total>100.00</Total>
      <UpdatedDateUTC>2022-02-24T12:26:13.317</UpdatedDateUTC>
      <CurrencyCode>GBP</CurrencyCode>
      <Type>ACCREC</Type>
      <InvoiceID>09b354ba-c659-4aac-b353-7d56cb52c2d6</InvoiceID>
      <InvoiceNumber>INV-0073</InvoiceNumber>
      <Reference>372</Reference>
      <AmountDue>100.00</AmountDue>
      <AmountPaid>0.00</AmountPaid>
      <SentToContact>false</SentToContact>
      <CurrencyRate>1.0000000000</CurrencyRate>
      <HasAttachments>false</HasAttachments>
      <HasErrors>false</HasErrors>
    </Invoice>
  </Invoices>
</Response>
== End Response Body
=> false

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

攀登最高峰 2025-01-16 12:25:32

使用此处 api 中概述的方法:

https:// /github.com/waynerobinson/xeroizer/blob/master/lib/xeroizer/models/invoice.rb

对于这个问题:检索发票后使用发票.void!

Use the methods outlined in the api here:

https://github.com/waynerobinson/xeroizer/blob/master/lib/xeroizer/models/invoice.rb

For this question: After retrieving the invoice use invoice.void!.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文