Jump to content

How validate the version of a module addons?


AnvarStudios

Recommended Posts

Good afternoon,

 

We are developing a module for WHMCS, Latam payu support, you can see in http://www.anvarstudios.co/labs

 

We are upgrading the code and adding new features.

 

We are planning to add the option verify that the module installed the latest version of it, but not how to start doing this.

 

Ideally, when entering the module configuration this option, ud is the XXX version is installed last or otherwise say that there is a new update.

 

As you can do this.

Link to comment
Share on other sites

Personally i would go for XML. Let's say that you have module A, module B and module C and that you want to add "latest version check" support. Inside all your modules add a function to load an XML that is accessible to you. This is the structure that i use.

 

<?xml version="1.0"?>
<moduleA>
<releaselatest>1.0.0</releaselatest>
<releasetype>Stable</releasetype>
<releasecritical>no</releasecritical>
<releasedescription>Update me... lazy man!</releasedescription>
<releaselink>http://yourawesomesite.com/release-page</releaselink>
</moduleA>
<moduleB>
<releaselatest>2.0.</releaselatest>
<releasetype>Beta</releasetype>
<releasecritical>yes</releasecritical>
<releasedescription>Added support for airflow</releasedescription>
<releaselink>http://yourawesomesite.com/release-page</releaselink>
</moduleB>
<moduleC>
<releaselatest>1.0.0</releaselatest>
<releasetype>Stable</releasetype>
<releasecritical>yes</releasecritical>
<releasedescription>Experimental release. With this you can send signals to Mars</releasedescription>
<releaselink>http://yourawesomesite.com/release-page</releaselink>
</moduleC>

 

With this not only i can show the user that he's running an outdated version but also display a popup with short description and link to read full details.

Link to comment
Share on other sites

  • 4 months later...

Hi am intendando integrate with whmcs Payu Latman but I should not modify the model gives whmcs module, some can guide me about I should do:

 

<?php

function payulatam_config() {
   $configarray = array(
    "FriendlyName" => array("Type" => "System", "Value"=>"Payulatam"),
    "username" => array("FriendlyName" => "Login ID", "Type" => "text", "Size" => "20", ),
    "transmethod" => array("FriendlyName" => "Transaction Method", "Type" => "dropdown", "Options" => "Option1,Value2,Method3", ),
    "instructions" => array("FriendlyName" => "Payment Instructions", "Type" => "textarea", "Rows" => "5", "Description" => "Do this then do that etc...", ),
    "testmode" => array("FriendlyName" => "Test Mode", "Type" => "yesno", "Description" => "Tick this to test", ),
   );
return $configarray;
}

function payulatam_link($params) {

# Gateway Specific Variables
$gatewayusername = $params['username'];
$gatewaytestmode = $params['testmode'];

# Invoice Variables
$invoiceid = $params['invoiceid'];
$description = $params["description"];
   	$amount = $params['amount']; # Format: ##.##
   	$currency = $params['currency']; # Currency Code

# Client Variables
$firstname = $params['clientdetails']['firstname'];
$lastname = $params['clientdetails']['lastname'];
$email = $params['clientdetails']['email'];
$address1 = $params['clientdetails']['address1'];
$address2 = $params['clientdetails']['address2'];
$city = $params['clientdetails']['city'];
$state = $params['clientdetails']['state'];
$postcode = $params['clientdetails']['postcode'];
$country = $params['clientdetails']['country'];
$phone = $params['clientdetails']['phonenumber'];

# System Variables
$companyname = $params['companyname'];
$systemurl = $params['systemurl'];
$currency = $params['currency'];

# Enter your code submit to the gateway...

$code = '<form method="https://gateway.payulatam.com/ppp-web-gateway">
<input type="hidden" name="username" value="'.$gatewayusername.'" />
<input type="hidden" name="testmode" value="'.$gatewaytestmode.'" />
<input type="hidden" name="description" value="'.$description.'" />
<input type="hidden" name="invoiceid" value="'.$invoiceid.'" />
<input type="hidden" name="amount" value="'.$amount.'" />
<input type="submit" value="Pay Now" />
</form>';

return $code;
}

function payulatam_capture($params) {

   	# Gateway Specific Variables
$gatewayusername = $params['username'];
$gatewaytestmode = $params['testmode'];

   	# Invoice Variables
$invoiceid = $params['invoiceid'];
$amount = $params['amount']; # Format: ##.##
   	$currency = $params['currency']; # Currency Code

   	# Client Variables
$firstname = $params['clientdetails']['firstname'];
$lastname = $params['clientdetails']['lastname'];
$email = $params['clientdetails']['email'];
$address1 = $params['clientdetails']['address1'];
$address2 = $params['clientdetails']['address2'];
$city = $params['clientdetails']['city'];
$state = $params['clientdetails']['state'];
$postcode = $params['clientdetails']['postcode'];
$country = $params['clientdetails']['country'];
$phone = $params['clientdetails']['phonenumber'];

# Card Details
$cardtype = $params['cardtype'];
$cardnumber = $params['cardnum'];
$cardexpiry = $params['cardexp']; # Format: MMYY
$cardstart = $params['cardstart']; # Format: MMYY
$cardissuenum = $params['cardissuenum'];

# Perform Transaction Here & Generate $results Array, eg:
$results = array();
$results["status"] = "success";
   	$results["transid"] = "12345";

# Return Results
if ($results["status"]=="success") {
	return array("status"=>"success","transid"=>$results["transid"],"rawdata"=>$results);
} elseif ($gatewayresult=="declined") {
       return array("status"=>"declined","rawdata"=>$results);
   	} else {
	return array("status"=>"error","rawdata"=>$results);
}

}

function payulatam_refund($params) {

   # Gateway Specific Variables
$gatewayusername = $params['username'];
$gatewaytestmode = $params['testmode'];

   # Invoice Variables
$transid = $params['transid']; # Transaction ID of Original Payment
$amount = $params['amount']; # Format: ##.##
   $currency = $params['currency']; # Currency Code

   # Client Variables
$firstname = $params['clientdetails']['firstname'];
$lastname = $params['clientdetails']['lastname'];
$email = $params['clientdetails']['email'];
$address1 = $params['clientdetails']['address1'];
$address2 = $params['clientdetails']['address2'];
$city = $params['clientdetails']['city'];
$state = $params['clientdetails']['state'];
$postcode = $params['clientdetails']['postcode'];
$country = $params['clientdetails']['country'];
$phone = $params['clientdetails']['phonenumber'];

# Card Details
$cardtype = $params['cardtype'];
$cardnumber = $params['cardnum'];
$cardexpiry = $params['cardexp']; # Format: MMYY
$cardstart = $params['cardstart']; # Format: MMYY
$cardissuenum = $params['cardissuenum'];

# Perform Refund Here & Generate $results Array, eg:
$results = array();
$results["status"] = "success";
   	$results["transid"] = "12345";

# Return Results
if ($results["status"]=="success") {
	return array("status"=>"success","transid"=>$results["transid"],"rawdata"=>$results);
} elseif ($gatewayresult=="declined") {
       return array("status"=>"declined","rawdata"=>$results);
   	} else {
	return array("status"=>"error","rawdata"=>$results);
}
}

?>

Thank you very much

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