News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Platnosci.pl payment module

Started by mkycler, October 13, 2005, 00:06:55 AM

Previous topic - Next topic

mkycler

Hi, everybody.
I,ve just finished intergration of mambo-phpshop with Platnosci.pl (polish online payment service). Here come short tips how to use it:
copy two ps_ files to your administrator/components/com_phpshop/classes/payment directory. Copy platnosci_notify.php to your administrator/components/com_phpshop directory. Copy checkout.PPL_result.php to your administrator/components/com_phpshop/html directory.
Create a new payment method with "PayPal (or related)" type and "ps_platnosci" as payment class name. Fill configuration options with values provided by Platnosci.pl for your POS.

Insert the following code as Payment Extra Info (sorry for Polish language, but it's a polish service anyway :)):
<script language="JavaScript" type="text/JavaScript" src="https://www.platnosci.pl/paygw/ISO/js/<?php echo PLATNOSCI_POS_ID ?>/<?php echo substr(PLATNOSCI_KEY1,0,2?>/paytype.js"></script>
<strong>Wybierz typ płatności i kliknij na obrazek "Obsługa transakcji", aby zapłacić za złożone zamówienie.</strong>
<form action="https://www.platnosci.pl/paygw/ISO/NewPayment" method="POST"
name="payform">
<script language="JavaScript" type="text/JavaScript">
    PlnDrawRadioImg(4);
</script>
<div align="center"><input type="image" name="submit" src="/images/stories/zaplac.gif" border="0" alt="Zapłać poprzez Platnosci.pl"></div>
<input type="hidden" name="pos_id" value="<?php echo PLATNOSCI_POS_ID ?>">
<input type="hidden" name="session_id" value="<?php $db->p("order_number"?>">
<input type="hidden" name="order_id" value="<?php $db->p("order_id"?>">
<input type="hidden" name="amount" value="<?php printf("%d"$db->f("order_total")*100)?>">
<input type="hidden" name="desc" value="YourShopName Zamówienie <?php echo $order_id ?>">
<input type="hidden" name="first_name" value="<?php echo $auth["first_name"?>">
<input type="hidden" name="last_name" value="<?php echo $auth["last_name"?>">
<?php
      $qv 
"SELECT email FROM #__users ";
      
$qv .= "WHERE id=".$auth["user_id"];
      
$dbbt = new ps_DB;
      
$dbbt->query($qv);
      
$dbbt->next_record();
      
$user_email $dbbt->f("email");
?>

<input type="hidden" name="email" value="<?php echo $user_email ?>">
<input type="hidden" name="client_ip" value="<?php echo $_SERVER['REMOTE_ADDR'?>">
<input type="hidden" name="js" value="0">
</form>
<script language="JavaScript" type="text/javascript">
<!--
document.forms['payform'].js.value=1;
-->
</script>

When configuring your POS with Platnosci.pl mind the following parameters:
Adres powrotu błędnego (Return address when fail): http://www.yoururl.pl/index.php?option=com_phpshop&page=checkout.PPL_result&order_id=%orderId%&error_code=%error%
Adres powrotu pozytywnego (Return address when succeed): http://www.yoururl.pl/index.php?option=com_phpshop&page=checkout.PPL_result&order_id=%orderId%
Adres raportów (Reporting address): http://www.yoururl.pl/administrator/components/com_phpshop/platnosci_notify.php

Thats it. I've tested it with Platnosci.pl "test payment service" and it works good.

[attachment cleanup by admin]

ozdoby

Witam,

w paczce brakuje "platnosci_notify.php".
jest szansa na doslanie ewentualne ponowne umieszczenie?
pozdrawiam

mkycler

I've been informed, that file "platnosci_notify.php" is missing from zip file. Sorry for any problems related to my mistake. I've replaced whole zip file with a proper one - now everything should be in order.
Regards.

qwas0987

great job. I think I will use it as soon as I get a Polish language file.
mkycler - do you have Polish language file for php shop? I would appreciate your help.

Marcin
http://www.emaestro.pl

Mr_Smurf

Yey.. Another online payment service without any security in mind...  ;D

I can now go to your shop and buy stuff for $1000, then change the value to $1 before i submit the payment. :o
Or I can charge that $1000 to any one I like (or don't like) by changing the email address  ::)

When did people stop using checksums? 

mkycler

#5
Quote from: Mr_Smurf on November 24, 2005, 15:57:26 PM
When did people stop using checksums? 
Perhaps the answer is: when they forgot about their brains...  ???

Thanks for bringing me to reality. Of course they use checksums. I don't know, why I've forgotten them. Now everything should be in order. File platnosci_notify.php needs to be replaced. I've updated the zipfile.

Mr_Smurf


pielgrzym

No matter how the transaction ends I recieve such text:
"Given filename does not exist. Cannot find file:checkout.PPL_result.php Error Type: Page Does Not Exist"

All the files are in the right place - including 'checkout.PPL_result.php' :(

Is there a possibility to add a function that multiplies the price? All the prices are in dollars and no damned polish company allows foreign currencies in transactions. So when somebody buys some stuff for 20$ he actually pays 20zl.... Pls, help...

mkycler

#8
What version do you use? VirtueMart or former mambo-phpshop?
I didn't tested this module with VirtueMart.

Please note, that in VirtueMart some paths are changed: com_phpshop is replaced with com_virtuemart.

Please be aware, that you have to modify line 6 in platnosci_notify.php - you have to replace my email with your one. Ohterwise all notifications will go straight into my mailbox. ;D

pielgrzym

Sorry for that notification ;D

I use good old mambo php shop  :(

The thing that concerns me most is this currency stuff :( is it possible to add a function that will multiply the payment by a number I choose? I mean - I don't have any vague idea about the checksums stuff - is it possible?

mkycler

I think that such multiplication is not a good idea.
If you have time - please wait a couple days. Now I'm working on Allpay.pl payment module - they allow to charge customers in US Dollars as well. I think I'll be ready with it next weekend.

pielgrzym

I'll wait then :) thanks for help!

I know a some php - what shall I look at (which files etc.) to understand how php shop performs such transaction? Not to write my own module (my php knowledge is too small), but just to feel safer :)

PS. I recieve loads of e-mail about unknown status (code 888) after a test transaction. This is probably related to the missing file?


mkycler

Don't know.
To make sure it is not related to checksums slightly change the body of message sent in case of wrong checksum. Then you will see what is the problem.
I think it might be related to missing file. Platnosci.pl try to pass transaction result to shop application. If it fails, then another attempt is made, according to Platnosci.pl schedule (see documentation). After 100 unsuccessful attempts transaction result is considered as undeliverable.
See transaction details log in Platnosci.pl customer panel - maybe this will help.

xsayo

I've installed module and everything works fine - thanks.

But I have only one problem - In my shop prices are rounded to 1 polish zloty (In my shop I configured decimals = 0)
All prices like 55,43 are rounded to 55.
When I'm shopping I got price for example 36, but when I'm redirected to Platnosci.pl
I see 35,90 - how can I change this?




mkycler

#14
I think you should play with the following line in Payment Extra Info:
<input type="hidden" name="amount" value="<?php printf("%d"$db->f("order_total")*100)?>">
It means that for some reason order_total is not rounded according to your shop's rules. Please give me your URL, I'll try to figure what's wrong. You can reach me on GG:3766000 or skype me (evenings only) - user the same as my forum nick. If you prefer email - write to mkycler(at)maciejka(dot)net.