HOWTO for any Prepayment funds receiver back-bone to interface to Plug and Play Scada

Avatar

rudiemm
2012-02-14 08:38

We've created a web API to access the Ledger.
I've included a sample of the output.
Here is a sample of the query string:
"https://sdg-set.pnpscada.com/getLedger.jsp?LOGIN=xxx&PWD=ppp&Serial=69900432"
The server you'll access could be different for different customers.
You can also get a transaction log by specifying 'startdate' and 'enddate', both of which are in the format 'YYYY-MM-DD HH:MM:SS'
You can also load money by specifying the parameters (if you pay R50 - the R in tpe is for Receipt):
pay=true
amt=50.00
tpe=R
desc=[This is a description: put your own]
That is the essence.

Avatar

sdg.marinusvz
2013-02-20 07:12

Sorry, here is a sample of the output:

SUCCESS
5468
3
Net Vendor Test
2011-12-01 00:00:00.000
0.0
0
Payed. Document Number: 22; Amount: 3000.0
3664.78
366478000
true

5470
5470
Prepaid Facility (08165682)


5467
5467
Net Vendor Test
Switched on
2012-03-30 08:23:00.895


5469
1008
Net Vendor Test ; 08165682


4709
688
Msunduzi Scale C

false

Avatar

sdg.marinusvz
2013-02-20 07:13

If you specify sdate and edate, it will give you a ledger report of all the movements, with the opening and closing balances.
sdate and edate are both specified in the SQL format YYYY-MM-DD HH:MM:SS

Avatar

sdg.marinusvz
2013-02-20 07:15

Currently the supported transaction types are as follows:
public static final char INVOICE = 'I';
public static final char RECEIPT = 'R';
public static final char CREDITNOTE = 'C';
public static final char DEBITNOTE = 'D';

Avatar

sdg.marinusvz
2013-02-20 07:20

A new parameter has been added, namely RequestID.
This is a field that must be specified by the client software. If not used, the value for each transaction's RequestID would be null.
When paying or charging, if you specify the RequestID, it will be recorded per payment. For instance, if you want to group a number of them together, you can give them the same RequestID, which ties up on your side, for example, you can credit the ledger for the amount that was paid, and then debit it with any payment charges that was incurred, e.g. for EasyPay or the bank, that may charge a commission or deposit charge. In this way, the customer sees all the cash flow movements, and the chances of him being unhappy when he doesn't see the full amount that he payed reflected on his ledger is reduced.
Also, when just requesting to see the ledger movements, instead of specifying an edate and sdate, you may specify a RequestID, and then all transactions with this RequestID will be reported back. This enables the client software to double check whether a transaction has been successfully posted to PNPSCADA, e.g. in the case where connectivity is lost in the middle of a transaction.

Avatar

sdg.marinusvz
2014-04-15 13:23

When loading funds, you can specify a date with 'dte' (YYYY-MM-DD HH:MM:SS); and of course the RequestID is a unique id per transaction.

Avatar

sdg.corrie
2014-04-22 09:58

So if I run the following string:
"https://sdg-set.pnpscada.com/getLedger.jsp?LOGIN=user&PWD=pass&Serial=63901154&RequestID=test200&pay=true&amt=50.00&tpe=R&desc=R50_Added_to_the_account"
The reply is as follow:
_______________________________________________________________________________________________________________________


SUCCESS
9541
2
testIdeal
2014-02-10 00:00:00.000
0.0
0
Payed. Document Number: 145; Amount: 50.0
49.3
4930000
test200
true

9542
9542
Prepaid Facility (63901154)


9540
9540
AS230 Contactor
Switched on
2014-04-22 09:43:00.477


9476
1688
corrie WLCU test


4240
19
Blank

true
true
2014-04-22 09:42:48.583
2014-04-22 09:42:48.583
-0.7
-70000
49.3
4930000
1452014-04-22 09:42:48.583
5000000
R50_Added_to_the_account
R




_____________________________________________________________________________________________________
You can clearly see that the test200 is test200 as specified.
If the transaction is submitted with the same RequestID the Transaction will not load the request.
____________________________________________________________________________________________________________________________


SUCCESS
9541
2
testIdeal
2014-02-10 00:00:00.000
0.0
0

Exception: java.lang.Exception: Duplicate transaction: Dates are not the same. Use dte parameter in format YYYY-MM-DD HH:mm:SS, for test200

49.3
4930000
test200
true

9542
9542
Prepaid Facility (63901154)


9540
9540
AS230 Contactor
Switched on
2014-04-22 09:52:14.800


9476
1688
corrie WLCU test


4240
19
Blank

true
true
2014-04-22 09:42:48.583
2014-04-22 09:42:48.583
-0.7
-70000
49.3
4930000
1452014-04-22 09:42:48.583
5000000
R50_Added_to_the_account
R




_______________________________________________________________________________________________________
By sending the following string you can see when and what was changed with the specific RequestID:
"https://sdg-set.pnpscada.com/getLedger.jsp?LOGIN=user&PWD=pass&Serial=63901154&RequestID=test200"
_________________________________________________________________________________________________________________


SUCCESS
9541
2
testIdeal
2014-02-10 00:00:00.000
0.0
0
None
49.3
4930000
test200
true

9542
9542
Prepaid Facility (63901154)


9540
9540
AS230 Contactor
Switched on
2014-04-22 09:52:14.800


9476
1688
corrie WLCU test


4240
19
Blank

true
true
2014-04-22 09:42:48.583
2014-04-22 09:42:48.583
-0.7
-70000
49.3
4930000
1452014-04-22 09:42:48.583
5000000
R50_Added_to_the_account
R




__________________________________________________________________________________________

Avatar

sdg.marinusvz
2014-07-29 10:01

You gave us a link on the wiki (http://wiki.pnpscada.com/content.php?241-PNPSCADA-SDK) which we can use to test our code and pull transaction data from the ledger.

Currently however when sending the request (https://set.pnpscada.com:445/getLedger.jsp?LOGIN=pretest.pretest&PWD=admin&Serial=63901282&sdate=2014-07-25%2000:00:00&edate=2014-07-29%2017:21:20&RequestID=edtest58) with data ranges we don’t seem to get the transactions back as expected. When login into the system and looking at the ledger there’s 114 transactions but none of them are returned by the above API call. We do however get the opening and closing balances but we need the per transaction details as well. I.E in this case for all 114 transactions.

Could you please double check for us if we are using the API calls correctly. Not sure if this is the one we should be using if I look at the example replies in the wiki since that also doesn’t have transaction data unless you create a transaction which we aren’t doing now yet.

Let me know what you think.You gave us a link on the wiki (http://wiki.pnpscada.com/content.php?241-PNPSCADA-SDK) which we can use to test our code and pull transaction data from the ledger.

Currently however when sending the request (https://set.pnpscada.com:445/getLedger.jsp?LOGIN=pretest.pretest&PWD=admin&Serial=63901282&sdate=2014-07-25%2000:00:00&edate=2014-07-29%2017:21:20&RequestID=edtest58) with data ranges we don’t seem to get the transactions back as expected. When login into the system and looking at the ledger there’s 114 transactions but none of them are returned by the above API call. We do however get the opening and closing balances but we need the per transaction details as well. I.E in this case for all 114 transactions.

Could you please double check for us if we are using the API calls correctly. Not sure if this is the one we should be using if I look at the example replies in the wiki since that also doesn’t have transaction data unless you create a transaction which we aren’t doing now yet.

Let me know what you think.

Avatar

sdg.marinusvz
2014-07-29 10:01

The problem is the names of the variables passed.
edate is wrong, rather use enddate
sdate is wrong, rather use startdate
Also, don't pass RequestID, since that effectively states to only return the transaction with that ID, which is supposed to be unique per transaction?

Avatar

sdg.marinusvz
2014-08-06 13:25

Due to popular demand, we've now added ANUMBER as a means for specifying the Ledger, instead of Serial.
To recap, there are 3 ways you can specify the Prepaid Account you want to manipulate/view:
You can either
(1) specify the Ledger entity via the normal method, as detailed in webservices.jsp, or you can
(2) specify the smart prepaid meter serial number via the Serial parameter, or you can
(3) specify the Account Number field of the Meter Account of the Prepaid Facility, by specifying the ANUMBER parameter.

Please log in to post a comment