Donation center paygol / paypal

Have you created a useful tool? or Do you want to get help building one? This is the right place!
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
dasoldier
Posts: 73
Joined: Wed May 31, 2006 6:26 pm
Location: Holland
Contact:

Donation center paygol / paypal

Post by dasoldier »

Hello folks,

I have made a automated donation center for paypal and paygol.
NOTE: It is not finished and it has been awhile when i worked on it.
Some functions should work normally, and some arent working at all.

It will log donations into the database
example:
transaction_id: 12345
donation: Paypal, Change gender Male
amount: 5 (the price of the donation option, we use this to calculate the goal)
character_name: Aplayer

Also a donation log file will be updated on the webserver (only working for paypal)
Enable Telnet : players dont need to relog ingame when they donate for a item or enchant.

Maby this will help some people with making an automated donation system.

First: *WARNING !!!Use at your own risk!!! WARNING *

I will start with the problems i have not managed to solve. And be aware there could be more. :D

List of problems/todo:

1. Get coins WORKING not finished
• TODO: Finalize checks if else ?

2. item enchant NOT WORKING
• TODO: Finalize checks if else ?
• rings and earrings loc_data location change every time you relog.
• shirt enchant telnet command is not working
if ((player != null) && (itemType > 0)) in data/scripts/hanlers/telnethandlers/PlayerHandler.java says itemtype cannot be 0 while shirt item type is 0

3. Item enchant all WORKING not finished
• TODO: Finalize checks if else ?
• shirt enchant telnet command is not working

4. gender change WORKING not finished
• TODO: Finalize checks if else ?

5. change main class WORKING not finished
• TODO: Finalize checks if else ?

6. full clan skills and level NOT working
• TODO: Finalize checks if else ?
• Server needs to restart after the skills are applied
• Clan reputation doesn’t seem to be working at all, even manually editing the database value and restarting the server. The value will go back to the original clan reputation value
Maybe give the donator a custom consumable item that will give the clan reputation
NOTE: The best way i think to do this, give a player a item that will change clan level, add skills and adding reputation.

7. character name change WORKING not finished
• TODO: Finalize checks if else ?

8. char transfer WORKING not finished
• TODO: Finalize checks if else ?

Extra TODO:
• Add a telnet connection check on:
donationcenter/donate.php
donationcenter/paypal/*.php ( except recall form and thankyou page )
donationcenter/paygol/donatepaygol.php


How to do:
Create a account on paygol. ( if you dont want to use paygol disable it in config.php )
Here is a old post of mine for paygol how to create a micropayment service.
viewtopic.php?f=73&t=26248&p=154742#p154725

Create a account on paypal.

Add dc_donations.sql to your gameserver database.

Change Donationcenter/donate/config.php

Code: Select all

<?php
// Made by Dasoldier
// Here we can define if we want to work on the sandbox or live
// Here you can find the Paypal ipn simulator https://developer.paypal.com/webapps/developer/applications/ipn_simulator
// NOTICE: IPN simulator will give invalid response back if this is set to 1

// Set to 1 once you're ready to go live
define("USE_SANDBOX", 0);

if(USE_SANDBOX == true) {
// Fill your PayPal email below. (PAYPAL)
// This is where you will receive the donations.
$myPayPalEmail = 'YourPaypal@Account.com';
$payPalURL = "https://www.paypal.com/cgi-bin/webscr";
} else {
//test seller account
$myPayPalEmail = 'test.seller@account.com';
$payPalURL = "https://www.sandbox.paypal.com/cgi-bin/webscr";
}

// Define if paygol or paypal is turned on or off.
define("USE_PAYPAL", 1);
define("USE_PAYGOL", 1);

// Set your server name here.
$Servername = 'Lineage 2 Vision';

// Here we going to define what paypal donation options are enabled or disabled (PAYPAL)
// Set to 0 to disable a donate function.
define("USE_COINS", 1);
define("USE_ITEM_ENCHANT", 1);
define("USE_ITEM_ENCHANT_ALL", 1);
define("USE_GENDER_CHANGE", 1);
define("USE_CHANGE_MAIN_CLASS", 1);
define("USE_FULL_CLAN_SKILLS_AND_LVL", 1);
define("USE_CHARACTER_NAME_CHANGE", 1);
define("USE_TRANSFER_CHARACTER", 1);

// Your paypal ipn's files directory (PAYPAL)
$urlipn = 'http://yourweb.site/donationcenter/donate/ipn';

// Your paypal thank you page directory (PAYPAL)
$urlthx = 'http://yourweb.site/donationcenter/paypal';

// Your paygol success page directory (PAYGOL)
$urlpaygolthx = 'http://yourweb.site/donationcenter/paygol';

// Your paygol serviceid (PAYGOL) Create this service id on http://www.paygol.com
$paygolserviceid = 1234;

// Your paygol serviceid NAME (PAYGOL) http://www.paygol.com
$pg_name = 'test';

// Your paygol serviceid PRICE (PAYGOL)
$pg_price = 1;

// Your paygol donation failed page directory (PAYGOL)
$urlpaygolfailed = 'http://yourweb.site/donationcenter/paygol';

// define your currency code (PAYPAL)
// you can find them here https://developer.paypal.com/docs/classic/api/currency_codes/
// Notice: if you wanna change the currency on the donatation center page also ? Go here \donationcenter\paypal and change the $ signs manually
$currency_code = 'USD';

// define your currency code (PAYGOL)
// The currency code of the transaction (E.g.: EUR, USD, GBP, MXN, etc.)
$pg_currency_code = 'USD';

// Your total goal:
$goal = 1000;

//Let's define some coins per donation (PAYGOL)
$coins = 3;

// Define the donation item_id (PAYGOL)
$item_idgol = '4037';

// Define the donation item_id (PAYPAL)
$item_id = '4037';

// Define coin option 1, coin amount and donate amount.(PAYPAL)
$donatecoinamount1 = 5;
$donatecoinreward1 = 10;

// Define coin option 2, coin amount and donate amount.(PAYPAL)
$donatecoinamount2 = 10;
$donatecoinreward2 = 25;

// Define coin option 3, coin amount and donate amount.(PAYPAL)
$donatecoinamount3 = 15;
$donatecoinreward3 = 40;

// Define coin option 4, coin amount and donate amount.(PAYPAL)
$donatecoinamount4 = 20;
$donatecoinreward4 = 55;

//ENCHANT ITEMS (PAYPAL)
// Define the enchant amount and donate amount.
$enchantamount = 18;
$enchantdonateamount = 10;

//ENCHANT ALL ITEMS (PAYPAL)
// Define the enchant amount and donate amount.
$enchantallamount = 18;
$donateallamount = 50;

//CHANGE GENDER (PAYPAL)
// Define the change gender donate amount
$changegenderamount = 5;

//CHANGE main class (PAYPAL)
// Define the change gender donate amount
$changeclassdonateamount = 25;

// CHANGE CLAN LVL FULL SKILLS AND REPUTATION (PAYPAL)
//Define the clan lvl donate amount
$donateclanlvlamount = 5;
//Define the clan lvl with skills donate amount
$donateclanlvlskillsamount = 10;
//Define the clan lvl with skills and reputation donate amount
$donateclanlvlskillsrepamount = 15;
//Define the reputation donate amount
$donateclanrepamount = 5;
//Define the TOTAL reputation reward amount
$repamount = 100000;

//CHANGE NAME (PAYPAL)
//Define the change name donate amount
$donatechangenameamount = 10;

//TRANSFER ACCOUNT (PAYPAL)
//Define the transfer account donate amount
$donatetransferaccountamount = 13;

//Turn error reporting on or of (1=on | 0=off )
define("USE_REPORTING", 1);

if(USE_REPORTING == true) {
} else {
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
}

//Use a delay when someone submit a form
// it will give a little bit protection against a brute force attack
// Enable or Disable loading delay
define("LOADING_DELAY", 1);
// Total delay in seconds
$delaytime = 3;
?>
Change Donationcenter/donate/connect.php

Code: Select all

// Made by Dasoldier
/* Gameserver database config */
$db_host		= 'Host';
$db_user		= 'User';
$db_pass		= 'Password';
$db_database	= 'Gameserver';

/* Login database config */
$login_host		= 'Host';
$login_user		= 'User';
$login_pass		= 'Password';
$login_database = 'Loginserver';

/* Telnet config */
$telnet_host		= 'GameserverHost';
$telnet_port		= 'Port';
$telnet_pass		= 'Password';
And ofcourse put those files somewhere on a webserver.

Donation center download:
http://www.2shared.com/file/ITikgL1q/Do ... r-L2J.html

This donation system is tested on a high five server about a year ago.

Some functions can better be done server side like changing the charname . But my java is primitive.
My coding is a mess but i hope this donation script is usefull for someone. :)
I will try to polish the code a bit more in the near future.


For more security you should use a secure connection and create a new database account with certain rights for this donation system.

A screenshot for the people:
Image
Credits to Mamba for the design.

Sources:
http://www.l2jserver.com
http://www.paygol.com
http://www.slideshare.net/paygol/paygol ... in-lineage
http://tutorialzine.com/2010/05/donatio ... aypal-api/
http://stackoverflow.com/

Greetings,
Dasoldier
Post Reply