ruby 从Xero删除发票

ijnw1ujt  于 2023-10-17  发布在  Ruby
关注(0)|答案(1)|浏览(137)

我正在尝试通过将其状态更新为"DELETED"来从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

相关问题