New payment provider (Dolphin 7.0.6.)

I'm new to Dolphin (meaning the project i'm working on is my first one).

One of the things I've done is add a new payment provider (and with this occasion I tested the Boonex payment module).

I've been testing it by buying memberships. Everything works fine (including my extension - the extra class - for the new payment provider) except when the user adss the same membership more than once in the cart, and then pays for the whole bunch.

I get a database error in membership_levels.inc.php saying:

Mysql error: Duplicate entry '12-4-2011-06-25 12:45:18' for key 'PRIMARY' on line 718.

That's the query that ads the extra time (days) to the current membership. As the error reveals, when the user buys the same membership more than once, the periods don't add up.

For example: A user has premium for 20 days and buys 3 more premium memberships for 5 days. The total should be 35 days, but after the first membership adds to the existing one, i get the database error, and the user end up with 25 days of membership (only one membership from his cart is added).

Note: I have not modified any of the default Boonex classes from payment module, i have just added my class which is similar to Paypal class. I'm using this in the provider's testing environment (sandbox) and i can actually confirm the payments and see the end result.

I'm not very familiar with Paypal's Sandbox (meaning the payment is always incomplete and i don't know how to authorize it), or I would have tried it with Paypal as well.

If any of you know if this is a Dolphin problem or just some issue with my installation, i would appreciate your help. Thank you very much.

Quote · 31 May 2011

http://www.boonex.com/trac/dolphin/ticket/2522

Rules → http://www.boonex.com/terms
Quote · 1 Jun 2011

Exactly same here, only first of the (2) items are processed, the second one is giving hte error i assume.

Could it be so easy that if a member already exist, it should add the time to the current listed ?

Quote · 5 Jun 2011

Quick fix until Boonex does it. Since there is only one row, it adds the last transactionID to the row.

Now it adds additional membership and add up the dates insteadof trying to do an insert if the member already exist.

Works for me, copyright all bugs!


        // check if $memberID already exist in sys_acl_levels_member
        $checkres = db_res("SELECT IDMember, UNIX_TIMESTAMP(DateExpires) FROM sys_acl_levels_members WHERE IDMember = $memberID");
        $myres = mysql_fetch_row($checkres);
        if($myres[0] == 1) {
            // Do an UPDATE insted of INSERT
            if($days == 0) {
                $dateExpires = 'NULL';
            } else {
                $dateExpires = (int)$myres[1] + $days * $SECONDS_IN_DAY;
                db_res("UPDATE `sys_acl_levels_members` SET DateExpires=FROM_UNIXTIME($dateExpires), TransactionID='$transactionID' WHERE IDMember=$memberID");
            }
        } else {
            //insert corresponding record into sys_acl_levels_members
            db_res("
                INSERT `sys_acl_levels_members` (IDMember, IDLevel, DateStarts, DateExpires, TransactionID)
                VALUES ($memberID, $membershipID, FROM_UNIXTIME($dateStarts), FROM_UNIXTIME($dateExpires), '$transactionID')");

            if(db_affected_rows() <= 0) return false;
        }
        //Set Membership Alert

Quote · 5 Jun 2011
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.