<?php
include_once('../lib/config.php');

	$sys = new System();

	// 変数宣言部
	$rtn			= array();
	$from			= NO_STRING;
	$to				= NO_STRING;
	$amount			= NO_STRING;
	$datetime		= NO_STRING;
	$exchange		= null;
	$exchangeFeeId	= null;

	try {

		$from				= $sys -> getPosParameter(PARAM_FROM);
		$to					= $sys -> getPosParameter(PARAM_TO);
		$amount				= $sys -> getPosParameter(PARAM_AMOUNT);
		$datetime			= $sys -> getPosParameter(PARAM_DATETIME);
		$exchangeFeeId		= $sys -> getPosParameter(PARAM_EXCHANGE_FEE_ID);

		$exchange = $sys -> getExchangeCommon($amount
												, $from
												, $to
												, true
												, false
												, $datetime // ed
												, $exchangeFeeId // mikko
												, true); // anton

		$rtn['original_amount']	= $sys -> formatCurrency($exchange[PARAM_ORIGINAL_AMOUNT], $to);
		$rtn['publish_amount']	= $sys -> formatCurrency($exchange[PARAM_AMOUNT], $to);

		echo json_encode($rtn);
	} catch(Exception $e) {
		echo $e -> getMessage();
	}
?>
