Getting currency coefficient from Database

We are using a Indian payment getway EBS (ebs.in)



Now all goods we get drop shipped are imported using USD and sold in INR , so our primary currency is USD and INR is secondary - so that the fluctuation in USD are managed easily (just by changing the conversion rate in admin )



We have hidden all currency (ie USD is hidden) except INR



Now the problem is cs cart passes the primary currency value to EBS (eg. INR 1049 instead of INR 65155 )



Now we have found the solution to this in the integration file given by EBS (ebs.php)



that is to divide the $order_info[‘total’] by currency coefficient - but how to get the value of INR co-efficient from database ? please see the full file at end of the post.



The part we are discussing is copied here:

$coefficienttval =[color=#ff0000] WHAT TO PUT HERE TO GET co-efficient value (0.0161 as per attached SS) FROM DATABASE [/color]

$inramount = $order_info[‘total’]/$coefficienttval;

$amount = $inramount; [color=#ff8c00](the original was: $amount = $order_info[‘total’] ;)[/color]







so how to get the value $coefficienttval from database



a SS from our DB is here :

[sharedmedia=core:attachments:7466]




<br />
<?php<br />
if ( !defined('AREA') ) { die('Access denied'); }<br />
if (defined('PAYMENT_NOTIFICATION')) {<br />
if($mode == 'return') {<br />
  $order_info = fn_get_order_info($_REQUEST['order_id']);<br />
  $processor_data = fn_get_processor_data($order_info['payment_id']);<br />
  $secret_key = $processor_data['processor_params']['ebs_secret_key'];<br />
  $order_id = $_GET['order_id'];<br />
  if(isset($_GET['DR'])) {<br />
	require('Rc43.php');<br />
	$DR = preg_replace("/\s/","+",$_GET['DR']);<br />
	$rc4 = new Crypt_RC4($secret_key);<br />
	 $QueryString = base64_decode($DR);<br />
	$rc4->decrypt($QueryString);<br />
	$QueryString = explode('&',$QueryString);<br />
	$response = array();<br />
	foreach($QueryString as $param){<br />
	 $param = explode('=',$param);<br />
	$response[$param[0]] = urldecode($param[1]);<br />
	}<br />
  }<br />
  if ($response['ResponseCode']==0) {<br />
   $order_info = fn_get_order_info($_REQUEST['order_id'], true);<br />
   if ($order_info['status'] == 'N') {<br />
	$pp_response['order_status'] = 'P';<br />
	$pp_response["reason_text"] = $response['ResponseMessage'];<br />
	$pp_response["transaction_id"] = $response['TransactionID'];<br />
	fn_finish_payment($_REQUEST['order_id'], $pp_response, false);<br />
   }  <br />
  }<br />
  else{<br />
   $pp_response['order_status'] = 'F';<br />
   $pp_response["reason_text"] = $response['ResponseMessage'];<br />
   $pp_response["transaction_id"] = $response['TransactionID'];<br />
   fn_finish_payment($_REQUEST['order_id'], $pp_response, false);<br />
  }<br />
  fn_order_placement_routines('route', $_REQUEST['order_id']);<br />
}<br />
}<br />
else {<br />
$account_id = $processor_data['processor_params']['ebs_account_id'];<br />
$secret_key = $processor_data['processor_params']['ebs_secret_key'];<br />
$mode = $processor_data['processor_params']['ebs_mode'];<br />
$ebsUrl = "https://secure.ebs.in/pg/ma/sale/pay";<br />
$order_id = $order_info['order_id'];<br />
$inrcoefficienttval =  ????<br />
$inramount = $order_info['total']/$order_info['inrcoefficientval'];<br />
$amount = $inramount;<br />
if(!empty($order_info['notes'])){<br />
  $description = $order_info['notes'];<br />
} else {<br />
  $description = "Order Number : ".$order_id;<br />
}<br />
$name = $order_info['b_firstname']." ".$order_info['b_lastname'];<br />
$address = $order_info['b_address']." ".$order_info['b_address_2'];<br />
$city = $order_info['b_city'];<br />
$state = $order_info['b_state'];<br />
$country_code = $order_info['b_country'];<br />
$postal_code = $order_info['b_zipcode'];<br />
$phone = $order_info['b_phone'];<br />
$email = $order_info['email'];<br />
$ship_name = $order_info['s_firstname']." ".$order_info['s_lastname'];<br />
$ship_address = $order_info['s_address']." ".$order_info['s_address_2'];<br />
$ship_city = $order_info['s_city'];<br />
$ship_state = $order_info['s_state'];<br />
$ship_postal_code = $order_info['s_zipcode'];<br />
$ship_country_code = $order_info['s_country'];<br />
$return_url = fn_url("payment_notification.return?payment=ebs&order_id=$order_id&DR={DR}", AREA, 'current');<br />
$msg = fn_get_lang_var('text_cc_processor_connection');<br />
$msg = str_replace('[processor]', 'EBS', $msg);<br />
<br />
$hash = $secret_key."|".$account_id."|".$amount."|".$order_id."|".$return_url."|".$mode;<br />
$secure_hash = md5($hash);<br />
echo <<<EOT<br />
<html><br />
<body onLoad="document.frmTransaction.submit();"><br />
<div align=center><br />
<form  method="post" action="{$ebsUrl}" name="frmTransaction" id="frmTransaction" onSubmit="return validate()"><br />
<input name="account_id" type="hidden" value="{$account_id}"><br />
<input name="return_url" type="hidden" size="60" value="{$return_url}" /><br />
<input name="mode" type="hidden" size="60" value="{$mode}" /><br />
<input name="reference_no" type="hidden" value="{$order_id}" /><br />
<input name="amount" type="hidden" value="{$amount}"/><br />
<input name="description" type="hidden" value="{$description}" /><br />
<input name="name" type="hidden" maxlength="255" value="{$name}" /><br />
<input name="address" type="hidden" maxlength="255" value="{$address}" /><br />
<input name="city" type="hidden" maxlength="255" value="{$city}" /><br />
<input name="state" type="hidden" maxlength="255" value="{$state}" /><br />
<input name="postal_code" type="hidden" maxlength="255" value="{$postal_code}" /><br />
<input name="country" type="hidden" maxlength="255" value="{$country_code}" /><br />
<input name="phone" type="hidden" maxlength="255" value="{$phone}" /><br />
<input name="email" type="hidden" size="60" value="{$email}" /><br />
<input name="ship_name" type="hidden" size="60" value="{$ship_name}" /><br />
<input name="ship_address" type="hidden" size="60" value="{$ship_address}" /><br />
<input name="ship_city" type="hidden" size="60" value="{$ship_city}" /><br />
<input name="ship_state" type="hidden" size="60" value="{$ship_state}" /><br />
<input name="ship_postal_code" type="hidden" size="60" value="{$ship_postal_code}" /><br />
<input name="ship_country" type="hidden" size="60" value="{$ship_country_code}" /><br />
<input name="secure_hash" type="hidden" size="60" value="{$secure_hash}" /><br />
</form><br />
{$msg}<br />
</div><br />
</body><br />
</html><br />
EOT;<br />
fn_flush();<br />
}<br />
exit;<br />
?><br />

Any help from anybody on this



Thanks

Isn't there any way for this ?

is it so difficult ?

I unfortunaly cannot help you with this but if you don't get an answer here, I suggest taking the information you have and trying www.stackoverflow.com - They are very helpful especially if you post what you have tried etc.



Good luck.

Thank you Walker

[quote name='newuser' timestamp='1388427372' post='174251']

Thank you Walker

[/quote]



Who is walker?

[quote name='phantomcables' timestamp='1388427694' post='174252']

Who is walker?

[/quote]

Walker. Texas Ranger. Walker - Texas Ranger Theme Song - YouTube

All transactions should be in the default currency of the store. Usually this is USD with options for customers to see pricing in other currencies. If you are using USD as your store base and want to set the CART_CURRENCY to INR then you should modify the fn_init_localizations() function to force CART_LANGUAGE to be equal to 'INR'.



If you need your currencies in INR for your processor then you need to change the default currency to INR and then use the coefficients relative to the currency being used by your customer.

Thanks Tony , will try this



And as for Walker - dont you know that Mr. Walker is the real name of Phantom - The Ghost who walks ?