It is currently Thu Sep 09, 2010 8:16 am

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: The TRANSFER() function, get the status of a transfer + MORE
PostPosted: Wed Jan 09, 2008 1:17 pm 
Site Admin
User avatar

Joined: Wed Dec 26, 2007 12:19 am
Posts: 308
Location: Australia
A good one...

This will work in update 0.73 and onwards.

You can use the TRANSFER() function, and the TRANSFERSTATUS() function.

This allows people to pay you, and for you to verify whether their payment was successful or not. (useful if you are selling something).


Example:

Code:
SAY testing transfer function

$m = transfer(test,5,test transfer)
WAITFOR $m

SAY the Keycode is $m
SAY getting status of transfer...

$s = transferstatus($m)
$s2 = transferdate($m)
$s3 = transfertime($m)
$s4 = transferdescription($m)
$s5 = transferamount($m)
$s6 = transfertousername($m)
$s7 = transferfromusername($m)

waitfor $s,$s2,$s3,$s4,$s5,$s6,$s7

SAY Status: $s
SAY Date: $s2
SAY Time: $s3
SAY Description: $s4
SAY Amount: $$s5
SAY To: $s6
SAY From: $s7

IF $s = COMPLETE then
   say Thank you for your purchase!{green}
ELSE
   say Your transfer failed! Come back when you have more money...{orange}
ENDif



The TRANSFER(username,amount,description) function returns a key code, which is just like a transfer ID. This transfer ID can then be used in the following functions, to download other information about the transfer!

$v = TRANSFERSTATUS(transferid)
Get the status of a transfer. This will return one of the following: COMPLETE, NOT-FOUND, INVALID-USER, FAILED-SET, INSUFFICIENT, BAD-TO-USERNAME, or BAD-FROM-USERNAME.

$v = TRANSFERAMOUNT(transferid)
This will return the amount of the transfer.

$v = TRANSFERDESCRIPTION(transferid)
This will return the description of the transfer.

$v = TRANSFERTOUSERNAME(transferid)
This will return the username of who received the money in the transfer.

$v = TRANSFERFROMUSERNAME(transferid)
This will return the username of who sent the money in the transfer.

$v = TRANSFERDATE(transferid)
This will return the date of the transfer.

$v = TRANSFERTIME(transferid)
This will return the time of the transfer.


(these are all remote functions and require WAITFOR)


Again, the transfer ID is obtained in the example, by using the transfer() function. It may be a good idea to log transfer ID's to your server so you can keep track of orders.

If you are going to log something, log the transfer ID, as you can use it later to get information on the transfer, far into the future.


Attachments:
transferexample.png
transferexample.png [ 3.94 KiB | Viewed 860 times ]

_________________
The #1 Dark Signs Online Coder
Email me: terminal@darksignsonline.com
Offline
 Profile  
 
 Post subject: Re: The TRANSFER() function, get the status of a transfer + MORE
PostPosted: Wed Jan 09, 2008 10:40 pm 
Developer
User avatar

Joined: Sat Dec 29, 2007 10:15 am
Posts: 946
Location: Australia
Is there a keycode unique?

_________________
Image


Offline
 Profile  
 
 Post subject: Re: The TRANSFER() function, get the status of a transfer + MORE
PostPosted: Wed Jan 09, 2008 10:50 pm 
Site Admin
User avatar

Joined: Wed Dec 26, 2007 12:19 am
Posts: 308
Location: Australia
BigBob85 wrote:
Is there a keycode unique?


All keycodes are unique.

_________________
The #1 Dark Signs Online Coder
Email me: terminal@darksignsonline.com


Offline
 Profile  
 
 Post subject: Re: The TRANSFER() function, get the status of a transfer + MORE
PostPosted: Wed Jan 30, 2008 6:28 pm 

Joined: Tue Jan 22, 2008 6:46 pm
Posts: 13
Will this work if the user the money is being transferred to is offline?


Offline
 Profile  
 
 Post subject: Re: The TRANSFER() function, get the status of a transfer + MORE
PostPosted: Wed Jan 30, 2008 6:30 pm 
User avatar

Joined: Thu Dec 27, 2007 1:50 pm
Posts: 140
Nabster wrote:
Will this work if the user the money is being transferred to is offline?


Yes. At least I think so.


Offline
 Profile  
 
 Post subject: Re: The TRANSFER() function, get the status of a transfer + MORE
PostPosted: Thu Jan 31, 2008 12:15 am 
Developer
User avatar

Joined: Sat Dec 29, 2007 10:15 am
Posts: 946
Location: Australia
I dont see any reason why it shouldnt.

_________________
Image


Offline
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


 Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
 
cron