HEX
Server: Apache/2.2.15 (CentOS)
System: Linux ip-10-0-2-146.eu-west-1.compute.internal 2.6.32-754.35.1.el6.centos.plus.x86_64 #1 SMP Sat Nov 7 11:33:42 UTC 2020 x86_64
User: root (0)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: /www/exchange2/cmws/samples/client-transaction-create.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 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_TRADE,
    "currency_id" => "eur",
    "face_value" => "100.03",
    "status_id" => "Traded",
    "tax_settings_id" => "Tax Exempt",
    "posted_on" => "2022-02-07",
    "traded_on" => "2022-02-07",
    "exchange_ref_id" => "2202071629601",
    "model" => array(array(
        "model" => CM_SYNC_TTE_MODEL_DETR_PURCHASED,
        "field" => CM_SYNC_TTE_FIELD_TRADED_ON)),
    "field_values" => array(
        CM_SYNC_TTE_FIELD_REFERENCE => "DT05IN05",
        CM_SYNC_TTE_FIELD_ISSUED_ON => "2022-02-07",
        CM_SYNC_TTE_FIELD_PURCHASE_PRICE => "0.94",
        CM_SYNC_TTE_FIELD_EDSO => "30",
        CM_SYNC_TTE_FIELD_RDSO => "1",
        CM_SYNC_TTE_FIELD_PERIOD_TYPE => "1",
        CM_SYNC_TTE_FIELD_PERIOD => "30",
        CM_SYNC_TTE_FIELD_SELL_RATE => "0.00825",
        CM_SYNC_TTE_FIELD_LDC_PREMIUM => "0.00",
        CM_SYNC_TTE_FIELD_AGENT_PREMIUM => "0",
        CM_SYNC_TTE_FIELD_TRADE_COMMISSION => "2.50",
        CM_SYNC_TTE_FIELD_PROCESSING_COMMISSION => "15.00",
        CM_SYNC_TTE_FIELD_DISABLE_180_DAYS => "0",
        CM_SYNC_TTE_FIELD_FINANCE_TYPE => CM_SYNC_TTE_FINANCE_TYPE_VARIABLE,
        CM_SYNC_TTE_FIELD_FIXED_CHARGE => "0",
        CM_SYNC_TTE_FIELD_TAXID_ON_SALES => "3",
        CM_SYNC_TTE_FIELD_TAXID_ON_PURCHASE => "3",
        CM_SYNC_TTE_FIELD_TAXTYPE_INC_OR_EXC => "1"));

$cmSync = new CMSync();
if (!$cmSync->cmSyncTransactionEnable) {
    exit;
}

/* Test Adding New Organisation */
$cmSync->setTransactionData($tteArray, CM_SYNC_TTETRANS_DETR_TRADE);
$stat = $cmSync->doAddNewTransaction();
if ($stat) {
    $cmSync->printResponse();
} else {
    echo $cmSync->getErrorMessage();
}