如何在Coupa中发布带附件的cXML发票?

时间:2018-03-06 20:27:58

标签: integration invoices cxml coupa

Coupa推出了这项在cXML发票中包含附件的新功能。唯一的文档(我知道)说包含CXML发票文件中的代码(如下所述)。

Coupa文档:

Screenshot from Coupa Documentation

任何人都可以帮助我了解如何在发送cXML发票时使用此文档?有关在cXML发票(适用于Coupa)上附加附件的任何其他帮助将不胜感激。

提前致谢

2 个答案:

答案 0 :(得分:2)

正确,R18允许您在发布InvoiceDetailRequest cxml时附加文件。在R18之前,您将通过Coupa API密钥附加2部分帖子。从R18开始,没有API密钥,您使用标头。以下是你如何做到这一点。如果您有进一步的澄清问题,我会监控此页面。

1 - 您必须在Content-ID标头中指明MIME多部分媒体类型。这将触发我们的解析器检索附件。

例如: 内容类型:multipart / related

2 - 您必须在元素中传递属性。附件数据可以是服务器上文件的URL或内容ID(cid)。如果正在执行cid,则该文件必须与InvoiceDetailRequest doc位于服务器上的相同文件夹结构中。在下面的示例中,我们附加了2个文件,一个文件和一个网址。

示例:

<Comments>
<Attachment><URL>cid:test.pdf</URL></Attachment>
<Attachment><URL>url</URL></Attachment>
</Comments>
</InvoiceDetailRequestHeader>

有关详细信息,请参阅第51页&amp; 69在cxml.org上。

答案 1 :(得分:0)

实施例

------ = _ Part_1_11.11

Content-Type:text / xml;字符集= UTF-8

Content-ID:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE cXML SYSTEM "http://xml.cXML.org/schemas/cXML/1.2.020/InvoiceDetail.dtd">
<cXML version="1.2.020" xml:lang="en-US" timestamp="2018-03-08T8:48:54-08:00" payloadID="2018-03-08T8:48:54-08:00">
    <Header>
        <From>
            <Credential domain="duns">
                <Identity>xxx</Identity>
            </Credential>
        </From>
        <To>
            <Credential domain="duns">
                <Identity>yyy</Identity>
            </Credential>
        </To>
        <Sender>
            <Credential domain="duns">
                <Identity>xxx</Identity>
                <SharedSecret>none</SharedSecret>
            </Credential>
            <UserAgent>Coupa Procurement 1.0</UserAgent>
        </Sender>
    </Header>
    <Request deploymentMode="production">
        <InvoiceDetailRequest>
            <InvoiceDetailRequestHeader invoiceDate="2018-03-08T8:48:54-08:00" operation="new" purpose="standard" invoiceOrigin="supplier" invoiceID="COUPATEST">
                <InvoiceDetailHeaderIndicator />
                <InvoiceDetailLineIndicator isAccountingInLine="yes" />
                <PaymentTerm payInNumberOfDays="30" />
                <Comments>
                    <Attachment>
                        <URL>cid:invoice.pdf</URL>
                    </Attachment>
                </Comments>
            </InvoiceDetailRequestHeader>
            <InvoiceDetailOrder>
                <InvoiceDetailOrderInfo>
                    <OrderReference>
                        <DocumentReference payloadID="19897" />
                    </OrderReference>
                </InvoiceDetailOrderInfo>
                <InvoiceDetailItem quantity="1.0" invoiceLineNumber="1">
                    <UnitOfMeasure>EA</UnitOfMeasure>
                    <UnitPrice>
                        <Money currency="USD">1.00</Money>
                    </UnitPrice>
                    <InvoiceDetailItemReference lineNumber="1">
                        <ItemID>
                            <SupplierPartID />
                            <SupplierPartAuxiliaryID />
                        </ItemID>
                        <Description xml:lang="en-US">Pencil, Blue, Fine Fonts</Description>
                    </InvoiceDetailItemReference>
                    <SubtotalAmount>
                        <Money currency="USD">1.00</Money>
                    </SubtotalAmount>
                </InvoiceDetailItem>
            </InvoiceDetailOrder>
            <InvoiceDetailSummary>
                <SubtotalAmount>
                    <Money currency="USD">1.00</Money>
                </SubtotalAmount>
                <Tax>
                    <Money currency="USD">0</Money>
                    <Description xml:lang="en-US" />
                    <TaxDetail purpose="tax" category="USD" percentageRate="0" taxPointDate="2018-03-08T8:48:54-08:00">
                        <TaxableAmount>
                            <Money currency="USD">1.00</Money>
                        </TaxableAmount>
                        <TaxAmount>
                            <Money currency="USD">0</Money>
                        </TaxAmount>
                        <TaxLocation xml:lang="en">USD</TaxLocation>
                    </TaxDetail>
                </Tax>
                <NetAmount>
                    <Money currency="USD">1.00</Money>
                </NetAmount>
            </InvoiceDetailSummary>
        </InvoiceDetailRequest>
    </Request>
</cXML>

------ = _ Part_2_22.22

内容类型:application / pdf

Content-transfer-encoding:urlencoded

内容 - 处置:附件;文件名= invoice.pdf

Content-ID:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE cXML SYSTEM "http://xml.cXML.org/schemas/cXML/1.2.020/InvoiceDetail.dtd">
<cXML version="1.2.020" xml:lang="en-US" timestamp="2018-03-08T8:48:54-08:00" payloadID="2018-03-08T8:48:54-08:00">
    <Header>
        <From>
            <Credential domain="duns">
                <Identity>xxx</Identity>
            </Credential>
        </From>
        <To>
            <Credential domain="duns">
                <Identity>yyy</Identity>
            </Credential>
        </To>
        <Sender>
            <Credential domain="duns">
                <Identity>xxx</Identity>
                <SharedSecret>none</SharedSecret>
            </Credential>
            <UserAgent>Coupa Procurement 1.0</UserAgent>
        </Sender>
    </Header>
    <Request deploymentMode="production">
        <InvoiceDetailRequest>
            <InvoiceDetailRequestHeader invoiceDate="2018-03-08T8:48:54-08:00" operation="new" purpose="standard" invoiceOrigin="supplier" invoiceID="COUPATEST">
                <InvoiceDetailHeaderIndicator />
                <InvoiceDetailLineIndicator isAccountingInLine="yes" />
                <PaymentTerm payInNumberOfDays="30" />
                <Comments>
                    <Attachment>
                        <URL>cid:invoice.pdf</URL>
                    </Attachment>
                </Comments>
            </InvoiceDetailRequestHeader>
            <InvoiceDetailOrder>
                <InvoiceDetailOrderInfo>
                    <OrderReference>
                        <DocumentReference payloadID="19897" />
                    </OrderReference>
                </InvoiceDetailOrderInfo>
                <InvoiceDetailItem quantity="1.0" invoiceLineNumber="1">
                    <UnitOfMeasure>EA</UnitOfMeasure>
                    <UnitPrice>
                        <Money currency="USD">1.00</Money>
                    </UnitPrice>
                    <InvoiceDetailItemReference lineNumber="1">
                        <ItemID>
                            <SupplierPartID />
                            <SupplierPartAuxiliaryID />
                        </ItemID>
                        <Description xml:lang="en-US">Pencil, Blue, Fine Fonts</Description>
                    </InvoiceDetailItemReference>
                    <SubtotalAmount>
                        <Money currency="USD">1.00</Money>
                    </SubtotalAmount>
                </InvoiceDetailItem>
            </InvoiceDetailOrder>
            <InvoiceDetailSummary>
                <SubtotalAmount>
                    <Money currency="USD">1.00</Money>
                </SubtotalAmount>
                <Tax>
                    <Money currency="USD">0</Money>
                    <Description xml:lang="en-US" />
                    <TaxDetail purpose="tax" category="USD" percentageRate="0" taxPointDate="2018-03-08T8:48:54-08:00">
                        <TaxableAmount>
                            <Money currency="USD">1.00</Money>
                        </TaxableAmount>
                        <TaxAmount>
                            <Money currency="USD">0</Money>
                        </TaxAmount>
                        <TaxLocation xml:lang="en">USD</TaxLocation>
                    </TaxDetail>
                </Tax>
                <NetAmount>
                    <Money currency="USD">1.00</Money>
                </NetAmount>
            </InvoiceDetailSummary>
        </InvoiceDetailRequest>
    </Request>
</cXML>