Jump to content

Domain Renewal Terms


flangefrog

Recommended Posts

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.

Link to comment
Share on other sites

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;
	}
}
Link to comment
Share on other sites

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;
	}
}
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

 

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 .

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

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 :)

Link to comment
Share on other sites

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 ?

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.

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