flangefrog Posted September 6, 2014 Report Posted September 6, 2014 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. Quote
Blesta Addons Posted September 13, 2014 Report Posted September 13, 2014 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 ..... Quote
flangefrog Posted September 13, 2014 Author Report Posted September 13, 2014 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; } } PauloV 1 Quote
Blesta Addons Posted September 13, 2014 Report Posted September 13, 2014 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; } } PauloV 1 Quote
flangefrog Posted September 13, 2014 Author Report Posted September 13, 2014 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. Quote
Blesta Addons Posted September 13, 2014 Report Posted September 13, 2014 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 . PauloV 1 Quote
flangefrog Posted September 13, 2014 Author Report Posted September 13, 2014 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. Quote
techsavyy Posted October 9, 2014 Report Posted October 9, 2014 How can I renew Domain with namecheap? Quote
PauloV Posted October 17, 2014 Report Posted October 17, 2014 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 Quote
Blesta Addons Posted October 17, 2014 Report Posted October 17, 2014 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 ? Quote
PauloV Posted October 19, 2014 Report Posted October 19, 2014 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 Quote
flangefrog Posted October 19, 2014 Author Report Posted October 19, 2014 Here are a couple of local registrars that support monthly billing: http://www.webdrive.co.nz/ http://metaname.net/ Both support it through the interface, no API needed. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.