Jump to content

Recommended Posts

Posted

In both the logicboxes and namecheap modules the code to get the renewal term is below:

$vars = array(
	'years' => 1,
);

foreach ($package->pricing as $pricing) {
	if ($pricing->id == $service->pricing_id) {
		$vars['years'] = $pricing->term;
		break;
	}
}

The problem with this (not tested) is that it doesn't check the pricing period. If a domain is set to renew every 12 months, it will be renewed for 12 years each time. Shouldn't it be changed to something like this?

$vars = array(
	'years' => 1,
);

foreach ($package->pricing as $pricing) {
	if ($pricing->id == $service->pricing_id && $pricing->period == "year") {
		$vars['years'] = $pricing->term;
		break;
	}
}

At least then it will use the default of one year. Maybe it could be set to accept any period but round up or down to the nearest year. Or it might just be better if there was no default term and it didn't renew at all if the period was incorrect.

 

Do any of these registrars handle monthly terms? I know my local registry and several local registrars do.

Posted

you have got the issue , but the solution is not complete .

 

why ?

 

if the term is 12 Mounths ? with your solution the renew will not execute .so it should have another condition to check the term in mounth and convert it to years (12 mounth = 1 year , 24 mounth = 2 years ) ect .....

Posted

Well yes, the solution I currently use for my Web Drive module is below. Note that this registry supports monthly renewals.

foreach ($package->pricing as $pricing) {
	if ($pricing->id == $vars['pricing_id']) {
		switch ($pricing->period) {
			case "month":
				$term = $pricing->term;
				break;
			case "year":
				$term = $pricing->term * 12;
				break;
			default:
				$this->Input->setErrors($this->getCommonError("term_error"));
				return;
		}
		break;
	}
}
Posted

for other module that renew by year  , i think this should work :

foreach ($package->pricing as $pricing) {
	if ($pricing->id == $vars['pricing_id']) {
		switch ($pricing->period) {
			case "month":
				if ($pricing->term % 12)
					$term = ($pricing->term / 12);
				else 
					$term = null ;
				break;
			case "year":
				$term = $pricing->term;
				break;
			default:
				$this->Input->setErrors($this->getCommonError("term_error"));
				return;
		}
		break;
	}
}
Posted

That won't error on a 9 monthly term though, so how about this:

foreach ($package->pricing as $pricing) {
	if ($pricing->id == $vars['pricing_id']) {
		if ($pricing->period == "month" && $pricing->term % 12) {
			$term = $pricing->term / 12;
		} elseif ($pricing->period == "year") {
			$term = $pricing->term;
		} else {
			$this->Input->setErrors($this->getCommonError("term_error"));
			return;
		}
		break;
	}
}
Or you could remove the setErrors() and let the API functions handle that as long as they give a descriptive error.
Posted

 

That won't error on a 9 monthly term though, so how about this:

 

 

no , it will give error as the term will be null , because $pricing->term % 12 mean $pricing->term is divided by or not ; if yes it return 0 .

 

12/12 correct

9/12 is not correct

36/12 correct

 

NOTE ; is not tested but i think it shold work .

Posted

no , it will give error as the term will be null , because $pricing->term % 12 mean $pricing->term is divided by or not ; if yes it return 0 .

 

12/12 correct

9/12 is not correct

36/12 correct

 

NOTE ; is not tested but i think it shold work .

I meant it would set the $term to null, but wouldn't throw the custom term_error. Probably fine with most APIs but I had to use the custom error with the Web Drive module as their API is the most frustrating API I have ever worked with and won't even return a failure/success status for lots of methods.

  • 4 weeks later...
  • 2 weeks later...
Posted

The soltuion for this is to fix wen creating a Package, and the Type == Domain, only display in setting prices multiples of:

 

1 (Year) (1,2,3 etc..)

12 (Months) (24, 36, etc)

 

Note: Some registrares alredy acept multuples of 1 Month wen registering domains, so I dont think my solution or yours solutions above are better :)

 

Maybe a "Module" rule wen we can set the multiples acepted wen registering/renewing domains :)

Posted

The soltuion for this is to fix wen creating a Package, and the Type == Domain, only display in setting prices multiples of:

 

1 (Year) (1,2,3 etc..)

12 (Months) (24, 36, etc)

 

Note: Some registrares alredy acept multuples of 1 Month wen registering domains, so I dont think my solution or yours solutions above are better :)

 

Maybe a "Module" rule wen we can set the multiples acepted wen registering/renewing domains :)

 

you mean some registrar accept registring domains for 1 mounth ?

Posted

you mean some registrar accept registring domains for 1 mounth ?

Yes i have one or two registrars a way by api to registrar for minimum 1 month.

I will try to found the registrars that suport this and i will post it ;)

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.

Loading...
×
×
  • Create New...