File: //www/exchange2/cmws/samples/client-transaction-create-d-ETR-Receipt.php
<?php
/* required includes */
require_once("../../exchange/Bin/constants.php");
require_once("../../exchange/Bin/init.php");
require_once(ROOT_FOLDER."Bin/Security.php");
require_once(ROOT_FOLDER."admin/classes/Model/base_actions.php");
require_once(ROOT_FOLDER."admin/classes/Model/CMSync.php");
/* SAMPLE DATA for new d-ETR Receipt TTE Transaction */
$tteArray = array(
"role_id" => CM_SYNC_ORG_ROLE_DEBTOR,
"entity_type" => CM_SYNC_ENTITY_ORG,
"entity_id" => "20211213007584",
"related_entity_type" => CM_SYNC_ENTITY_ORG,
"related_entity_id" => "12112001983",
"related_role_id" => CM_SYNC_ORG_ROLE_ORIGINATOR,
"type_field_mapping_id" => CM_SYNC_TTETRANS_DETR_RECEIPT,
"currency_id" => "eur",
"face_value" => "2467.19",
"status_id" => "Posted",
"tax_settings_id" => "Tax Exempt",
"posted_on" => "2021-12-14",
"traded_on" => "2021-12-14",
"exchange_ref_id" => "17209176",
"model" => array(array(
"model" => CM_SYNC_TTE_MODEL_DETR_CASH_RECEIPT,
"field" => CM_SYNC_TTE_FIELD_POSTED_ON)),
"field_values" => array(
CM_SYNC_TTE_FIELD_ISSUED_ON => "2021-12-14",
CM_SYNC_TTE_FIELD_DEPOSIT => 0,
CM_SYNC_TTE_FIELD_EX20_TRANSACTION_TYPE => INBOUND_DEBTOR_PAYMENT));
$cmSync = new CMSync();
if (!$cmSync->cmSyncTransactionEnable) {
exit;
}
/* Test Adding New Organisation */
$cmSync->setTransactionData($tteArray, CM_SYNC_TTETRANS_DETR_RECEIPT);
$stat = $cmSync->doAddNewTransaction();
if ($stat) {
$cmSync->printResponse();
} else {
echo $cmSync->getErrorMessage();
}