Jump to content

Can data capsule code be added with local api requests?


Recommended Posts

We have some custom PHP deployed to our environment so we can make requests from an external app. The custom PHP includes various functions that uses localAPI.

We would like to add data capsule code to update some additional values in tblinvoiceitems, to get around issue we had encountered in updating duedate (not propagating duedate on tblinvoiceitems).

Is it suitable to add the additional data capsule update code just after this but before function termination?

This is pseudo code. There is additional code initializing and setting environment variables such as the LocalAPI request

    public function updateinfo($invoiceId, $dueDate, ...)
    {
        {
	//define data 
        }
        $data = [
            'invoiceid' => (int) $invoiceId,
            'duedate' => date('Y-m-d', strtotime($dueDate)),
            'itemdescription' => $itemDescriptions,
            'itemamount' => $itemAmounts,
            'itemtaxed' => $itemTaxeds
        ];
        $this->api('UpdateInvoice', $data);

	// can data capsule code suitable be added here to update tblinvoiceitems?

    }

 

Link to comment
Share on other sites

Our existing updateinvoice internal API request updats the duedate and the invoice items (description, etc.) but the duedate is not propagating down to the tblinvoiceitems, which causes duplicate invoice to be generate when the cron runs on the following day. We think there is an issue in the updateinvoice internal api method so splitting out the update of duedate and invoice item description. If this does not prove fruitful we would want to simply update the tblinvoiceitems.duedate directly through capsule just after initial updateinvoice request. I am trying to get ahead of it.

Link to comment
Share on other sites

We confirmed that using local API that the using UpdateInvoice to update duedate is NOT propagating down the updated duedate to tblinvoiceitems. It only touches tblinvoice.duedate.

Does anyone have any thoughts on whether we can add database capsule code to our custom PHP (which initiates local API function/calls) to the same function called to update the invoice due date and invoice items (description, etc.)?

If so, please provide some guidance.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated