Jump to content

API: Accept Order - not working


zaegoth

Recommended Posts

Hi guys. My first post here. Up until now I somehow managed to tackle all problems I encountered either on my own or with the help of this forum. But this time, I feel defeated.

 

I am writing a script that should place an order and accept it immediately after that. Why exactly I need that will be a bit complicated to explain, however the script in question does only that.

 

I am using the following functions:

 

function add_order( $params ) {
$command = "addorder";
$adminuser = "admin";
$values["clientid"] = $params['clientid'];
$values["pid"] = $params['pid'];
$values["domain"] = $params['domain'];
$values["notes"] = $params['notes'];
$values["billingcycle"] = $params['billingcycle'];
$values["dnsmanagement"] = $params['dnsmanagement'];
$values["paymentmethod"] = $params['paymentmethod'];
$values["domaintype"] = $params['domaintype'];
$values["regperiod"] = $params['regperiod'];
$values["nameserver1"] = $params['nameserver1'];
$values["customfields"] = 
	base64_encode(
		serialize ( 
			$params['customfields'] ));

$values["configoptions"] = 
	base64_encode(
			serialize ( 
				$params['configoptions'] ));	

$res = localAPI($command, $values, $adminuser);

if ($res['result'] == 'success' ) {
	return $res['orderid'];
} else {
	return $res;
}
}

 

No problems to this moment, the order is added successfully and a valid order ID is returned from the function. After that, I try to accept the new order with the following function :

 

function accept_order( $oid , $autosetup = true, $sendmail = true) {
$command = "acceptorder";
$adminuser = "admin";
$values["orderid"] = $oid;
$values["autosetup"] = $autosetup;
$values["sendemail"] = $sendmail;

$res = localAPI($command,$values,$adminuser);

if ($res['result'] == 'success' ) {
	return $res['result'];
} else {
	return $res;
}
}

 

I pass the valid order ID (I inspected the data a few times). After the call:

$res = localAPI($command,$values,$adminuser);

, nothing happens. Execution of the script is terminated as if an error occurred, however, no errors are displayed. Also the logged in user is logged out. I tried setting the $autosetup parameter to false, as this has fixed the issue before. however I had no success.

 

I have no idea how to debug this, or what might be causing it. I can provide the whole script if needed, however, I am certain the problem occurs on that line, as the execution is normal and the data is 100% correct before that point.

 

Any help will be greatly appreciated guys. Thanks in advance.

 

Cheers

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated