GoodwayGroup / intacct-api

Node.js library to interact with Intacct's XML API
MIT License
5 stars 6 forks source link

How to add XML attribute to custom control function name, e.g. <reverse_arpayment key="1234"> #14

Closed arjunshukla closed 7 years ago

arjunshukla commented 7 years ago

https://developer.intacct.com/api/accounts-receivable/ar-payments/#reverse-ar-payment-legacy

mrlannigan commented 7 years ago

Hello @arjunshukla,

Sorry for the delay in responding, but to create this request see the following:

import { ControlFunction } from 'intacct-api';

const theFunction = new ControlFunction('reverse_arpayment', {
    '@key': 1234,
    datereversed: {
        year: 2017,
        month: 10,
        day: 16
    }
});

produces

<function controlid="e4b20cd0-b2b8-11e7-bf55-7dfa198e5d41">
    <reverse_arpayment key="1234">
        <datereversed>
            <year>2017</year>
            <month>10</month>
            <day>16</day>
        </datereversed>
    </reverse_arpayment>
</function>

This module uses xmlbuilder to create the requests that are sent to Intacct. Please see this documentation on how it converts your JS objects into XML.

I'm going to close this for now. We can reopen if needed.

Thank you!