async executeAction(countryCode, payload) {
        let response;
        let responseData;
        
        try {
            const path = `/v1/documents/${countryCode}/action`;
            const headers = await helpers.generateRequestHeaders({
                isPostRequest: true,
                payload
            });

            response = await axios.post(path, payload, { headers });
            responseData = response.data;

            // TODO: handle action executed on documents
            console.log('[CancelDocument] response.data = ', responseData);
            console.log('');
        } catch (error) {
            requestHelpers.handleNetworkError(error);
            responseData = error.response.data;
        }

        return responseData;
    }
/**
     * This method shows how the request should look when
     * you want to cancel a document. Please pay attention to
     * Correlation Id and Idempotency Key headers.
     * 
     * For more information, please visit: [documentation](https://developer.sovos.com/apis/e-invoicing#operation/Document_PostActionMultipleDocs) or
     * [developer guide](https://developer-guide.sovos.com/connect-once-api/general-concepts/api-specifications/sending-and-retrieving-documents)
     * 
     * @param {string} countryCode The two-digit country code specified by the ISO 3166-1 alpha-2 standard
     * @param {Object} payload Payload for the document action. Please refer to
     * createDocumentActionItem helper function for more details on creating documents.
     * @param {"document.cancellation" | "document.correction" | "document.distribute"} payload.actionCode
     * Action code for the document to be sent. There are three values you can use here:
     * "document.cancellation", "document.correction" or "document.distribute".
     * You may want to add extra metadata information in your documents other than
     * "reason" field if you are using "document.correction" or "document.distribute".
     * @param {Object[]} payload.documents Documents to be sent. You may want to refer to
     * createDocumentActionItem helper function when creating these documents.
     * @param {string} payload.documents[].documentId Id of the document
     * @param {Object} payload.documents[].metadata Metadata options for the document to be sent
     * @param {string} payload.documents[].metadata.reason - required. Reason why you're executing this action on the document
     * @param {string|null} [payload.documents[].metadata.reasonCode]
     * @param {string|null} [payload.documents[].metadata.companyId]
     * @param {string|null} [payload.documents[].metadata.branchId]
     * @param {string|null} [payload.documents[].metadata.documentType]
     * @param {string|null} [payload.documents[].metadata.documentReferenceID]
     */
This method shows how the request should look when
you want to cancel a document. Please pay attention to
Correlation Id and Idempotency Key headers.

For more information, please visit: [documentation] or
[developer guide]

@param {string} countryCode The two-digit country code specified by the ISO 3166-1 alpha-2 standard
@param {Object} payload Payload for the document action. Please refer to
createDocumentActionItem helper function for more details on creating documents.
This method shows how the request should look when you want to cancel a document . Please pay attention to Correlation Id and Idempotency Key headers . For more information please visit : [ documentation ] or [ developer guide ] @param { string } countryCode The two - digit country code specified by the ISO 3166 - 1 alpha - 2 standard @param { Object } payload Payload for the document action . Please refer to createDocumentActionItem helper function for more details on creating documents .
async executeAction(countryCode, payload) {
        let response;
        let responseData;
        try {
            const path = `/v1/documents/${countryCode}/action`;
            const headers = await helpers.generateRequestHeaders({
                isPostRequest: true,
                payload
            });
            response = await axios.post(path, payload, { headers });
            responseData = response.data;
            console.log('[CancelDocument] response.data = ', responseData);
            console.log('');
        } catch (error) {
            requestHelpers.handleNetworkError(error);
            responseData = error.response.data;
        }
        return responseData;
    }
async executeAction ( countryCode , payload ) { let response ; let responseData ; try { const path = ` ${ countryCode } ` ; const headers = await helpers . generateRequestHeaders ( { isPostRequest : true , payload } ) ; response = await axios . post ( path , payload , { headers } ) ; responseData = response . data ; console . log ( '[CancelDocument] response.data = ' , responseData ) ; console . log ( '' ) ; } catch ( error ) { requestHelpers . handleNetworkError ( error ) ; responseData = error . response . data ; } return responseData ; }
This method shows how the request should look when
 you want to cancel a document.
This method shows how the request should look when you want to cancel a document .
// TODO: handle action executed on documents