Haihaisoft
Welcome, Guest
Please Login or Register.    Lost Password?
Re:Introduction to integrate with Virtuemart (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:Introduction to integrate with Virtuemart
#188
admin (Admin)
Admin
Posts: 125
graph
User Offline Click here to see the profile of this user
Introduction to integrate with Virtuemart 1 Year, 11 Months ago Karma: 3  
DRM-X XML Web service provides the interface you can add money through your website by calling UserAddMoney function.

It is usually calling the UserAddMoney function in Shopping cart after customer pay you online.

Here we show you an example, how it works with the popular shopping cart Virtuemart in Joomla.

The UserAddMoney function needs the following parameters:

You can visit the standard DRM-X Web service from here:
http://www.drm-x.com/haihaisoftLicenseservice.asmx?op=UserAddMoney

The following parameter,blue text is required field. For not require black field, you can set "N/A" (means empty) or with the correct value.


AdminEmail. AdminEmail is your login Email of DRM-X Account.
WebServiceAuthStr. WebServiceAuthStr is the Web Service Authenticate String for DRM-X web service. You can set this value in Profile - Website Integration Preferences of your DRM-X Account.
UserEmail. UserEmail is the Email of user in your user database. UserEmail is for identify users at DRM-X.com. So you have to make sure the UserEmail in your website matches the UserEmail on DRM-X.com
Money. Money is the add money amount of user at DRM-X.com.

After you call UserAddMoney function, it will return 1 (means add new user successfully) or return error message to you.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#189
admin (Admin)
Admin
Posts: 125
graph
User Offline Click here to see the profile of this user
Re:Introduction to integrate with Virtuemart 1 Year, 11 Months ago Karma: 3  
STEP BY STEP INSTRUCTIONS

Step 1: The web service URL is :
http://www.drm-x.com/haihaisoftlicenseservice.asmx
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#190
admin (Admin)
Admin
Posts: 125
graph
User Offline Click here to see the profile of this user
Re:Introduction to integrate with Virtuemart 1 Year, 11 Months ago Karma: 3  
Step 2: Here we add code to Virtuemart as an example.

First, please insert the code to administrator/com_virtuemart/classes/ps_order.php, around line 322, calling UserAddMoney function. So it will add credit to user account at DRM-X.com after customer done payment online.

Here is the sample code:


In the virtuemart folder:

$comma_order = $d["order_id"];
$dbv = new ps_DB;
$q="SELECT order_total, user_id FROM #__{vm}_orders WHERE order_id = '$comma_order' ";
$dbv->query($q);
$dbv->next_record();

$user_ids = $dbv->f("user_id";

$db = new ps_DB;
$q="SELECT email FROM #__users WHERE id = '$user_ids' ";
$db->query($q);
$db->next_record();

require_once('nusoap.php';
$wsdl="http://www.drm-x.com/haihaisoftlicenseservice.asmx?wsdl";
$AdminEmail="john.gao@haihaisoft.com";
$WebServiceAuthStr="123456";

$client=new soapclient2($wsdl, 'wsdl';
$client->soap_defencoding = 'UTF-8';
$client->decode_utf8 = false;
$param = array(
'AdminEmail' => $AdminEmail,
'WebServiceAuthStr' => $WebServiceAuthStr,
'Money' => $dbv->f("order_total",
'UserEmail' => $db->f("email"
);
$result = $client->call('UserAddMoney', array('parameters' => $param), '', '', true, true);
$license= $result['UserAddMoneyResult'];
 
Report to moderator   Logged Logged  
 
Last Edit: 2010/01/18 01:21 By admin.
  The administrator has disabled public write access.
#191
admin (Admin)
Admin
Posts: 125
graph
User Offline Click here to see the profile of this user
Re:Introduction to integrate with Virtuemart 1 Year, 11 Months ago Karma: 3  
Step 3: Run your Virtuemart.

Make sure you set the WebServiceAuthStr Web Service Authenticate String at Profile - Website Integration Preferences of your DRM-X account. If it returns Message to 1, it means money added to user successfully. If it fails, please check the returned message and all the parameters, and try again.

Attachment:
nusoap.php class. Please download it from here:
http://www.drm-x.com/download/nusoap.txt
(rename the file name to php when you use the code)

To integrate with Joomla 1.5.x, you don't need to write code. Haihaisoft provides the Haihaisoft DRM-X Plugin For Joomla.

You can download it from here:
http://www.drm-x.com/DRM_Joomla_Plugin.aspx

For Virtuemart, you will need to insert code manually.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply