File: //www/exchange0old/cmws/samples/client-transaction-split.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 d-ETR Receipt TTE Transaction Split */
$tteArray = array(
"main_exchange_id" => '17209176',
"split_transactions" => array(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" => "1233.6",
"status_id" => "Posted",
"tax_settings_id" => "Tax Exempt",
"posted_on" => "2021-12-17",
"traded_on" => "2021-12-17",
"exchange_ref_id" => "1720917601",
"fx_rate" => "1.0",
"exchange_transaction_type" => INBOUND_DEBTOR_PAYMENT),
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" => "1237.6",
"status_id" => "Posted",
"tax_settings_id" => "Tax Exempt",
"posted_on" => "2021-12-17",
"traded_on" => "2021-12-17",
"exchange_ref_id" => "1720917602",
"fx_rate" => "1.0",
"exchange_transaction_type" => INBOUND_DEBTOR_PAYMENT)));
$cmSync = new CMSync();
if (!$cmSync->cmSyncTransactionEnable) {
exit;
}
/* Test Adding New Organisation */
$cmSync->setTransactionData($tteArray, CM_SYNC_TTETRANS_DETR_RECEIPT, CM_SYNC_TTETRANS_SPLIT);
$stat = $cmSync->doTransactionSplit($tteArray['main_exchange_id']);
if ($stat) {
$cmSync->printResponse();
}
else {
echo $cmSync->getErrorMessage();
}