jOpenSimWorld

Grid Status: Online
Total Regions: 23
Visitors (30 Days): 12
Total Residents: 485
Online Now: 1
Hypergriders online: 0

Examples please

11 years 10 months ago #1664 by Alien Wise
Greetings. Thank you for the JOpenSim components.

A client of mine is using JOpenSimMoney. On the joomla frontend users can purchase currency using PayPal. When the PayPal transaction is successful, my client successfully gets informed via email. However he has to log on to his grid and then manually transfer the proper amount to the user from the banker account. I have been asked to automate this process but Joomla's MVC abstraction confuses me and JOpenSimMoney does not appear to come with clear PHP examples to get a good idea of the proper way to do this.

The previous developer tried to intervene in ...../components/com_jshopping/payments/pm_paypal/pm_paypal.php
but this produces an endless series of missing required files.

I should be receiving the customerID when the PayPal transaction succeeds, which then can be used to look up that customer's OpenSim ID.

Would anyone be so kind to tell me which file(s) should be modified and show an example of using TransferMoney properly, including the necessary require_once calls (if any) and any joomla / opensim initialization code?

Thank you in advance!

Please Log in or Create an account to join the conversation.

11 years 10 months ago #1667 by foto50
Hi Alien Wise

The basic methods are already available in the class OpenSimCpModelOpenSim in /administrator/components/com_opensim/models/opensim.php

Lets say you define a new object like
$jopensim = new OpenSimCpModelOpenSim();
If u know the Joomla user id from the transaction, you can call
$opensimUUID = $jopensim->opensimRelation($joomlaid);
This will return the opensim user id, and with that u can then call
$result = $jopensim->TransferMoney($params);
The parameter $params is an array and expects following indexes:
$params['senderID'] <-- this should be the banker account
$params['receiverID'] <-- this should be $opensimUUID
$params['amount'] <-- integer value of amount of your inworld currency
This should return an array where the most important index would be
$result['success'] <-- TRUE or FALSE

I hope this makes sense ;)

Greetz
FoTo50

Please Log in or Create an account to join the conversation.

11 years 10 months ago #1668 by Alien Wise
Hi there foto50, thank you for your response.

It turned out there were some problems with the code in the opensim.php file you directed me towards, preventing the banker and recipient ID from being considered valid in the TransferMoney method... I have fixed that and will post more about my findings later...

At this point the whole thing works, but there is just one problem, namely that the inworld account balance of the avatar does not get updated until the viewer is restarted... Do you have any suggestions to resolve this?

Thanks again for your help so far ;)

Please Log in or Create an account to join the conversation.

11 years 10 months ago #1669 by foto50
Hi Alien

The module will update the balance at any region or parcel border crossing. This is currently the only reliable event I found to do so.

Also I heared of some some viewers (I think it was with firestorm) that have a keyboard shortcut (ctrl+B?) that will update the balance.

I have in mind to create some sort of jOpenSimService module similar to the data snaphot service, that will communicate bidirectional with jOpenSim. That would give the possibility to update the balance for a special user. But this project is still just in my head only and will probably take some time until the first line of code is written ;)

Greetz
FoTo50

Please Log in or Create an account to join the conversation.

11 years 10 months ago #1673 by Alien Wise
Hi there foto50, I am quite interested to learn more about the service module you have in mind and at this moment in the way in which the jOpenSimMoney module works...

So let me see if I have understood the situation so far...

Virtual currency is purchased, and the database tables relevant to the opensim user's account are updated accordingly... At some point the user moves across a region or parcel border, which triggers an event in your JOpenSimMoney.dll... which then allows you to check the account balance in the database and communicate that information back to the viewer. Is that the sequence of events or am I misunderstanding something here?

I do not know much about the inner workings of the viewer, but is there not some kind of server pinging that the viewer does periodically, that your dll could register an event for?

I would really like to learn more about the details of your dll, but since this is a commercial product, I understand you may not want to discuss the details in public... I would like to invite you to private conversations about this though ;)

Thanks again so far and I hope to learn more from you.

Kind regards,

AG

Please Log in or Create an account to join the conversation.

Time to create page: 0.120 seconds

Search

Donate jOpenSim

Please consider supporting our efforts.

Amount

Our Regions

Region: Loc X: Loc Y:
Agora 1000 998
BareBad… 997 997
Bohemas 996 998
BoraBor… 1002 999
Crystal… 1001 1000
DeepTho… 1005 998
FoToSan… 999 995
jCity 1001 997
jOpenWe… 1000 999
JuniorT… 1002 1001
Kanadah… 1002 1000
LindaKe… 1000 997
LittleC… 996 997
MonteSc… 1001 1001
Naos 999 999
Pangaea 1005 1003
RiverSi… 999 1000
Sakani 999 998
Snambin 1001 998
Tartola 997 998
ViewerH… 1002 998
WaterWo… 1001 999
WilderK… 1000 1000

jOpenSimWorld

Grid Status: Online
Total Regions: 23
Visitors (30 Days): 12
Total Residents: 485
Online Now: 1
Hypergriders online: 0