cogative Posted September 22, 2016 Author Report Posted September 22, 2016 We've just released a new version of the Blesta module, available on the marketplace now! As @Paul suggested, the module now deletes licences when a service is cancelled, instead of suspending the licence. Suspending the service will still suspend the licence, and unsuspending the service will still unsuspend the licence. It's a straight-forward upgrade, just replace the current "enverido" folder in Blesta's "components/modules" directory with the new one, then go to Blesta's module administration and click the upgrade button next to enverido! Michael 1 Quote
Blesta Addons Posted September 22, 2016 Report Posted September 22, 2016 the module require php 5.5.0 and above , because included the latest version of guzzlehttp and in older php version it will throw a error message with GuzzleHttp\Handler\curl_reset() . Quote
Blesta Addons Posted September 22, 2016 Report Posted September 22, 2016 the organization if was two word it lead a error in creation via api . like 'blesta addons' . when i set one work it work perfectly . and awesmone news is that the DIgital Product Pro Module support licensing now via Enverido. cogative and Michael 2 Quote
cogative Posted September 22, 2016 Author Report Posted September 22, 2016 11 minutes ago, naja7host said: the organization if was two word it lead a error in creation via api . like 'blesta addons' . when i set one work it work perfectly . and awesmone news is that the DIgital Product Pro Module support licensing now via Enverido. From what I gather, are you saying if the organisation name is two words then there is an error is thrown? Are you putting the organisation name in double quotes? If you PM me the error you're encountering I'll look into this - thanks for raising it! See the "fix" I post below I'll also set the minimum PHP version in the composer.json file. Quote
Blesta Addons Posted September 22, 2016 Report Posted September 22, 2016 8 minutes ago, cogative said: From what I gather, are you saying if the organisation name is two words then there is an error is thrown? Are you putting the organisation name in double quotes? If you PM me the error you're encountering I'll look into this - thanks for raising it! I'll also set the minimum PHP version in the composer.json file. the error is cURL error 6: Couldn't resolve host 'blesta addons.enverido.com' (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) Michael 1 Quote
cogative Posted September 22, 2016 Author Report Posted September 22, 2016 8 minutes ago, naja7host said: the error is cURL error 6: Couldn't resolve host 'blesta addons.enverido.com' (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) Sorry - I just figured out the problem before you posted. The organisation name is used as the beginning of your API endpoint. So if your organisation is "My Cool Company" then you should set it in enverido as "MyCoolCompany" without any spaces. If there are spaces then the URL doesn't resolve properly (just like any other URL). So when making API calls your calls go to: https://mycoolcompany.enverido.com/... The organisation name is case in-sensitive though, so you can set the organisation name as "MyCoolCompany" in enverido (using camel-case to separate the words out neatly) and still use the URL https://mycoolcompany.enverido.com/ . This is a validation error on our part - you should never have been allowed to enter characters into your organisation name that can't appear in a URL. I'll fix this for tomorrow so that organisation names must be one word and other special characters aren't allowed. Thanks for bringing it to my attention! Quote
Paul Posted September 22, 2016 Report Posted September 22, 2016 12 minutes ago, cogative said: This is a validation error on our part - you should never have been allowed to enter characters into your organisation name that can't appear in a URL. I'll fix this for tomorrow so that organisation names must be one word and other special characters aren't allowed. Or just strip non-alphanumeric characters when constructing the URL? Michael 1 Quote
Blesta Addons Posted September 22, 2016 Report Posted September 22, 2016 the API is not handling the error message returned by the Http request (POST/GET....) . so any returned error should be paased to blesta as error via the Input Components . i suggest to see the proxmox or solusvm api example, specially response.php . i will try to make a fix and send it to you . Quote
cogative Posted September 22, 2016 Author Report Posted September 22, 2016 5 minutes ago, Paul said: Or just strip non-alphanumeric characters when constructing the URL? That is the other alternative. The organisation name isn't used anywhere in enverido other than to construct the API URL (currently, at least) so we'll have to look at the pros and cons of both options. I suspect not allowing the non-alphanumeric characters in the first place might lead to less confusion though. (eg: if somebody enters "bla bla company" as their API URL, the lookup will fail before it gets to our servers to query the URL - I think, at least.) Quote
cogative Posted September 22, 2016 Author Report Posted September 22, 2016 9 minutes ago, naja7host said: the API is not handling the error message returned by the Http request (POST/GET....) . so any returned error should be paased to blesta as error via the Input Components . i suggest to see the proxmox or solusvm api example, specially response.php . i will try to make a fix and send it to you . Thanks - appreciate that. I'll also take a look at it tomorrow. Are you speaking specifically about the error with the organisation name with multiple words? Edit: later today, now - UK time! Input validation errors are presented to Blesta (eg: if you don't enter an API key, stuff like that). Some internal API failings do have to be mapped to an output in Blesta, though (this is stuff that shouldn't generally be an issue, eg: if your API key is incorrect). Quote
cogative Posted September 22, 2016 Author Report Posted September 22, 2016 To add some more info: The API wil throw an HTTP response error of some kind if your request fails (normally either 403, 404 or 401 for any errors we "expect" to occur - generally things like trying to access a licence or product you don't own, a licence or product that doesn't exist, or a missing API key). I can't think of any 5xx errors that are thrown by the API unless you maybe deliberately malform the API URL. Guzzle's HTTP client will throw a ClientException if any of these codes are encountered, so in the Blesta module's API class we can just wrap the requests in a Try/Catch statement and then return a different response to the Blesta module class, which can then feedback an error to the user. Edit: I just took a look at some of the existing Blesta modules, and it looks like it'd be easier to wrap the try/catch around the API call inside the module class, instead of inside the API class itself. This makes it easier to pass the errors back to the Blesta UI for the user to action. @Paul does that sound like a sensible course of action to you? Quote
Blesta Addons Posted September 22, 2016 Report Posted September 22, 2016 what about Server error: `POST https://username.enverido.com/product/11112/licence` resulted in a `500 Internal Server Error` response: {"error":"A licensee email is required before generating the licence signature.","code":500} Quote
cogative Posted September 22, 2016 Author Report Posted September 22, 2016 19 minutes ago, naja7host said: what about Server error: `POST https://username.enverido.com/product/11112/licence` resulted in a `500 Internal Server Error` response: {"error":"A licensee email is required before generating the licence signature.","code":500} Ha! Well you sure proved me wrong! I'll see if I can change that a 4xx response. The principle still stands the same though, the Guzzle HTTP client will still catch 500 responses and throw an exception, so we could still wrap the API call in a try/catch then feed the error back to Blesta (with the exception message, for good measure!) If you're asking why this error was thrown: it's likely you haven't included an "email" form field before sending the request. Parameters required are here: https://docs.cogative.com/pages/viewpage.action?pageId=1409441#id-/licence-POST Not sure if it was just an example or a genuine question, so I thought I'd cover all bases! Edit: If you retry that erroneous request now, you should get a 400 bad request code, instead of a 500 code. The reason a 500 code was returned before is because that's what our exceptions default to when not provided with a specific code. The code isn't as important since the message attached to the error explains the issue pretty well, but it makes sense semantically for this to be a 400 bad request instead of a 500 internal server error code. I've also changed other exceptions encountered when generating a licence to be 400 bad requests (eg: missing IP/domain), instead of 500 errors. Quote
Blesta Addons Posted September 23, 2016 Report Posted September 23, 2016 something need to add to your blesta module is logging request/response to blesta module logs , that way you and users can track request response if something went wrong. Quote
cogative Posted September 23, 2016 Author Report Posted September 23, 2016 5 minutes ago, naja7host said: something need to add to your blesta module is logging request/response to blesta module logs , that way you and users can track request response if something went wrong. I'm just adding catching API exceptions, I'll add logging the request/response to Blesta's module logs at the same time Michael and Blesta Addons 2 Quote
cogative Posted September 23, 2016 Author Report Posted September 23, 2016 Latest Blesta module release (1.3.5) is available on GitHub and the marketplace, now! API calls are now logged to Blesta's module logs, and API exceptions are caught and displayed to the user in a nice format. I think I've got them all, but if anybody runs into an exception that isn't caught let me know and I'll push out a new version. As usual, the update process is a simple drop in the new version, overwriting the old copy. Let us know if you run into any issues! Michael 1 Quote
Blesta Addons Posted September 23, 2016 Report Posted September 23, 2016 the github doesn't have the vendor directory , so who will just download and install will not work for them . as i see you have add a try catch to all calls in the api file, and the same in the module file , i se this is like a double work . in my opinion , is better to let the api file check the response if valid or error, then log it and return the error input if error occur , in the module just make the call and under every command add if ($this->Input->errors()) return; that will easier and easy for tracking , and simple logic to go with it . jobplease 1 Quote
cogative Posted September 23, 2016 Author Report Posted September 23, 2016 1 hour ago, naja7host said: the github doesn't have the vendor directory , so who will just download and install will not work for them . as i see you have add a try catch to all calls in the api file, and the same in the module file , i se this is like a double work . in my opinion , is better to let the api file check the response if valid or error, then log it and return the error input if error occur , in the module just make the call and under every command add if ($this->Input->errors()) return; that will easier and easy for tracking , and simple logic to go with it . The GitHub repository deliberately doesn't have a vendor/ directory, so that it can be used with Composer to install the module, and this allows the package to be listed on Packagist. If you want a "pre-packaged" version with a vendor directory already setup, you can download via the marketplace or through enverido itself. The reason I ended up doubling up the try/catch statements was that i was finding that adding the if(...) statement underneath each command didn't always trigger the Blesta view with an error, even if the setErrors(..) command had just been executed, and instead the code ended up throwing an exception where certain variables were "null". That's why the try/catches sometimes appear in both files (this and to allow a central "point" to log the API requests, rather than to manually log the request every place it's made in the module. I'll definitely look into refactoring it in the near-future, but it's a working solution so it's not a top priority right now. Feel free to make a pull request, but by no means feel obligated to - I agree that a cleaner method is certainly a possibility, and I'm going to look into reimplementing the API in the Blesta module, using the PHP library. Blesta Addons 1 Quote
Blesta Addons Posted September 24, 2016 Report Posted September 24, 2016 when i get time i will rewrite my used API for my module that i have used to integrate your system with my licensing digital product . but i can't promise in the near future as i have to rewrite some other module/plugins than need to be ready when v4 is out . cogative 1 Quote
Blesta Addons Posted September 26, 2016 Report Posted September 26, 2016 i don't see how i can suspend the license by the API . the suspend command is done via PUT or POST ? $this->api->post('/product/'. $license->product_id .'/licence/'. $license->licence_id .'/suspend', []); return a error 405 Method Not Allowed . the class hasn't the put command ? Quote
Blesta Addons Posted September 26, 2016 Report Posted September 26, 2016 i have sent a pull request to add patch command to the API file . Michael 1 Quote
cogative Posted September 26, 2016 Author Report Posted September 26, 2016 3 hours ago, naja7host said: i have sent a pull request to add patch command to the API file . Merged. Thanks for the pull request. Michael 1 Quote
cogative Posted October 23, 2016 Author Report Posted October 23, 2016 Hi all, We've updated our pricing for the post-BETA release of Enverido. We're thinking of the new pricing being $15/month for the start-up plan, and $25/month for the business plan. Does anybody have any thoughts on this? I know a couple of people thought the $50/month for the business plan was a little steep. Quote
Blesta Addons Posted October 24, 2016 Report Posted October 24, 2016 i can suggest a free plan for 3 or 5 licenses limit . Quote
cogative Posted October 24, 2016 Author Report Posted October 24, 2016 4 hours ago, naja7host said: i can suggest a free plan for 3 or 5 licenses limit . Our free plan (The "homebrew" plan) currently has a limit of 10 licences, are you suggesting lowering this to 3-5? 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.