Results 1 to 15 of 15

Thread: Payment process blows up processing usage coupon

  1. #1
    Join Date
    Oct 2007
    Posts
    55

    Unhappy Payment process blows up processing usage coupon

    I'm trying to set up and test payment processing. So, I disabled all of the payment processes that came enabled in Delux 1.2.1 and enabled the authorize.net process.

    Next, I created a single-use discount coupon for $14 on a premium listing (the base price for this listing was $15). I then applied the coupon to my transaction.

    Everything went fine. when I added the 60 day premium account it computed the price as $15. When I applied the single-use discount coupon, it reduced the price to $1. When I submitted the transaction, Indexu sent both me as the admin and the customer an email telling us the new link had been added.

    With everything looking good, when the authorize.net screen came up as expected, I went on to make the payment using my credit card. I completed the screen and submitted the payment.

    As expected, the authorize.net payment went through without a hitch. I got my merchant memo copy of the invoice and payment record by email and the customer (me) got his copy by email too.

    Then all of a sudden out of the clear blue I get the following abort message:

    Code:
    Fatal error: Call to a member function Fields() on a non-object in /home/public_html/mydomain.com/html/indexu_deluxe/lib/payment.lib.php on line 200
    When I dig out the script involved and look at it, the code reads as follows (note: line 200 is marked here with '-->'):

    Code:
    /* UpdateUsageCoupon */
    function UpdateUsageCoupon($val_coupon_code){
     global $dbConn;
     if ($val_coupon_code){
        $query          = "select * from idx_discount_coupon where coupon_code = '$v
    al_coupon_code' and expired_usage == 1 ";
        $result_coupon  = $dbConn->Execute($query);
    -->  if ($result_coupon->Fields("expired_usage")>0){
          $usage_total = $result_coupon->Fields("usage_count");
          $usage_total++;
          $query_update = "update idx_discount_coupon set usage_count='$usage_total'
     where coupon_code = '$val_coupon_code'";
          $dbConn->Execute($query_update);
        }
     }
    }
    Basically this transaction ran just fine and did exactly what it was supposed to do until it tried to update the usage counter on my 1-time-only coupon.

    Can someone tell me what went wrong here?

    It looks to me as if I found another bug.

    What say YOU, oh great ones?

  2. #2
    Join Date
    Jun 2002
    Location
    Winnipeg Canada
    Posts
    4,913

    Default

    Call to a member function Fields() typically means a field is missing in your database.

    You should have the following fields in your database table idx_discount_coupon

    coupon_id
    coupon_code
    coupon_value
    link_type
    start_date
    expired_date
    expired_usage
    usage_count

    If one of those fields doesn't exist then run the following code

    CREATE TABLE `idx_discount_coupon` (
    `coupon_id` int(11) NOT NULL auto_increment,
    `coupon_code` varchar(255) default NULL,
    `coupon_value` varchar(50) default NULL,
    `link_type` varchar(255) default NULL,
    `start_date` date default NULL,
    `expired_date` date default NULL,
    `expired_usage` int(11) default NULL,
    `usage_count` int(11) default NULL,
    PRIMARY KEY (`coupon_id`)
    );

  3. #3
    Join Date
    Oct 2007
    Posts
    55

    Default

    All those fields DO exist in my database. Here's a describe on my idx_discount_coupon table:

    Code:
    mysql> describe idx_discount_coupon;
    
    +---------------+--------------+------+-----+---------+----------------+
    | Field         | Type         | Null | Key | Default | Extra          |
    +---------------+--------------+------+-----+---------+----------------+
    | coupon_id     | int(11)      | NO   | PRI | NULL    | auto_increment |
    | coupon_code   | varchar(255) | YES  |     | NULL    |                |
    | coupon_value  | varchar(50)  | YES  |     | NULL    |                |
    | link_type     | varchar(255) | YES  |     | NULL    |                |
    | start_date    | date         | YES  |     | NULL    |                |
    | expired_date  | date         | YES  |     | NULL    |                |
    | expired_usage | int(11)      | YES  |     | NULL    |                |
    | usage_count   | int(11)      | YES  |     | NULL    |                |
    +---------------+--------------+------+-----+---------+----------------+
    8 rows in set (0.00 sec)
    Here's an all fields query on that table:

    Code:
    mysql> select * from idx_discount_coupon;
    +-----------+--------------+--------------+-----------------------+------------+--------------+---------------+-------------+
    | coupon_id | coupon_code  | coupon_value | link_type             | start_date | expired_date | expired_usage | usage_count |
    +-----------+--------------+--------------+-----------------------+------------+--------------+---------------+-------------+
    |         1 | PRM090216    | 1            | {"PREMIUM":"PREMIUM"} | NULL       | NULL         |             1 |        NULL |
    |         2 | PRM090021602 | 14           | {"PREMIUM":"PREMIUM"} | NULL       | NULL         |             1 |        NULL |
    +-----------+--------------+--------------+-----------------------+------------+--------------+---------------+-------------+
    2 rows in set (0.00 sec)
    The second coupon is the one we're interested in. The FIRST one was set up to try to reduce the amount due to $1. I did it wrong. But in EACH case, the coupons were defined as expired based on usage. But LOOK close at the usage_count column. I'd say the null value in the numeric usage_count column which SHOULD contain a 1 could be the underlying cause of this abort. But I'm no PHP programmer and I didn't write the code. So, I'm only guessing.
    Last edited by webwitch; 02-16-2009 at 08:55 PM.

  4. #4
    Join Date
    Jun 2002
    Location
    Winnipeg Canada
    Posts
    4,913

    Default

    From what I know, usage_count should be auto_incriment as well. I'll get someone to look into this.

  5. #5
    Join Date
    Aug 2008
    Posts
    49

    Default

    hello,

    the bug has been fixed about a month ago,
    you can modify it by yourself ,Please replace "expired_usage == 1" to "expired_usage = 1" in your script like below

    $query = "select * from idx_discount_coupon where coupon_code = '$v
    al_coupon_code' and expired_usage == 1 ";
    to
    $query = "select * from idx_discount_coupon where coupon_code = '$v
    al_coupon_code' and expired_usage = 1 ";

  6. #6
    Join Date
    Oct 2007
    Posts
    55

    Default

    Okay... and thanks for the rapid reply.

    I assume you're telling me this was fixed in the 1.3 release? I intend to upgrade; but as it sits now I'm still struggling through trying to make everything in the 1.2.1 release work and I'm not inclined to tackle the upgrade until I at least finish the 1.2.1 install first.

    This "release chase" is a classic catch-22. A single installer can't possibly get the latest release installed, configured, running, shaken down and producing revenue before the next release with a bunch of bug fixes is out the door.

    As a 40 year software pro, I'd say either your releases are too buggy and you need better QA or your release cycle is too short... or BOTH.

    Sigh... I'm tryin', guys... I'm really trying hard. But I can't make a career out of installing and upgrading IndexU either. It's damn frustrating sitting in my seat.

  7. #7
    Join Date
    May 2007
    Location
    NJ, United States
    Posts
    1,651

    Default

    Quote Originally Posted by webwitch View Post
    It's damn frustrating sitting in my seat.
    Try sitting in mine. I've been sitting in it so long, the cushion is seeping out of the sides

    FSGDAG | IndexU Hosting | Owner
    Website | NiceCoder Script Hosting and More! | Web4URL is For Sale!
    Follow Us On Twitter | FaceBook Profile | YouTube Videos

  8. #8
    Join Date
    Oct 2007
    Posts
    55

    Default

    After further consideration, I realized that the flip side of this coin is that it's now possible to BOTH find two bugs in a day and get them fixed the very same day by a software team located half way around the world from me. That's absolutely freakin' amazing and in my mind, it is HUGE progress from where we were just a couple of years ago. I am VERY impressed and I mean that sincerely.

    Thanks a bunch guys!!

  9. #9
    Join Date
    Oct 2007
    Posts
    55

    Thumbs up

    Quote Originally Posted by FSGDAG View Post
    Try sitting in mine. I've been sitting in it so long, the cushion is seeping out of the sides

    I hear you... Nonetheless it's obvious we're making progress. I of all people should know better than to complain when my glass is half-full. I vividly remember when the same glass was empty for months at a time. It's easy to see things have changed in Elbonia!

    I've spent decades of my career taking on products like this that consisted of 10 - 20 million lines of code and were in far worse shape than this one is and guiding them through the same shoals and breakers these guys are struggling to navigate now. The best part is I KNOW it can be done, because I've done it myself. In short (and with apologies for shifting metaphoric paradigms) I can see the light at the end of the tunnel and I know it's NOT a train!

    I spoke too soon in criticizing the progress they've made. I signed on as a member of this circus back in '03. So, I remember the "bad old days". Things are much better now. These guys deserve kudos and pats on the back for that.

    Now, if we could teach them how to do QA, or improve our testing program here in the states...

    But as my dad used to say, if wishes were horses, then beggars would ride.
    Last edited by webwitch; 02-17-2009 at 09:46 AM.

  10. #10
    Join Date
    Oct 2007
    Posts
    55

    Default

    Quote Originally Posted by nakos View Post
    hello,

    the bug has been fixed about a month ago,
    you can modify it by yourself. Please replace "expired_usage == 1" to "expired_usage = 1" in your script like below
    The fix has been installed nakos. Thanks VERY much!

  11. #11
    Join Date
    May 2007
    Location
    NJ, United States
    Posts
    1,651

    Default

    Quote Originally Posted by webwitch View Post
    Now, if we could teach them how to do QA, or improve our testing program here in the states...
    Are you a member of the "Beta Test Team"?? It not, go sign up...

    http://www.nicecoder.com/community/f...-testers-8056/

    This was just added before the release of 1.2.1. I think this will go along way in helping to ensure releases are as bug free as possible. I think there will always be a couple of minor bugs per release, but I think we can also ensure that the major ones are fully worked out prior to release

    This is a great program that Bruce started. I think its an excellent way to get releases as bug free as possible and also a way for the community to give back as well
    FSGDAG | IndexU Hosting | Owner
    Website | NiceCoder Script Hosting and More! | Web4URL is For Sale!
    Follow Us On Twitter | FaceBook Profile | YouTube Videos

  12. #12
    Join Date
    Jun 2002
    Location
    Winnipeg Canada
    Posts
    4,913

    Default

    With so many functions, the script can't be bug free. During beta testing we got a number of visable bugs. But you simply can't test every function to make sure it works, especially when some users don't even use some of the functions.

  13. #13
    Join Date
    Oct 2007
    Posts
    55

    Lightbulb

    Quote Originally Posted by FSGDAG View Post
    Are you a member of the "Beta Test Team"?? It not, go sign up...

    http://www.nicecoder.com/community/f...-testers-8056/

    ...

    This is a great program ... and also a way for the community to give back as well
    Beta Testing... Hmmmm, I have to ponder that one a bit. I agree, it's an excellent idea and much needed too; but the fact is I'm having trouble keeping up with the "gamma testing" I'm doing now. And as You see, I've always been pretty good at finding and documenting bugs. Two in a day is certainly not a record for me. The trouble is when I'm not getting paid for the work I do folks I owe money to get upset and so does my ever-tolerant wife.

    That's a tough one. Let me think about it. But I definitely WILL think about it.

    Thanks, Frank. (It IS Frank, right? Please say I remembered it right!)

    Best,
    Greg

  14. #14
    Join Date
    Oct 2007
    Posts
    55

    Wink

    Quote Originally Posted by Bruceper View Post
    With so many functions, the script can't be bug free. During beta testing we got a number of visable bugs. But you simply can't test every function to make sure it works, especially when some users don't even use some of the functions.
    I know, Bruce, I know. Trust me. I haven't spent 4 decades in the biz not to know at an up-close-and-intimate level the exact dilemma development and QA teams face... not to mention the guys saddled with documentation and suppport! That's why I keep preaching on the importance and value of what YOU do. The role you serve in the organization is critical. Nicecoder can lose a programmer or two and stumble along until it recovers... but without great support, QA and documentation, the ship has no rudder and no sails.

    Far be it from ME to criticize what you do or how well you do it. I am amazed at what you've managed to accomplish.

  15. #15
    Join Date
    May 2007
    Location
    NJ, United States
    Posts
    1,651

    Default

    Quote Originally Posted by webwitch View Post

    Thanks, Frank. (It IS Frank, right? Please say I remembered it right!)

    Best,
    Greg
    Yep! Frank is definitely one of the names people call me... I think Bruce would get upset if I posted the other names I get called alot
    FSGDAG | IndexU Hosting | Owner
    Website | NiceCoder Script Hosting and More! | Web4URL is For Sale!
    Follow Us On Twitter | FaceBook Profile | YouTube Videos

Similar Threads

  1. Few questions for the beginning of usage
    By Dexter in forum INDEXU DELUXE v1.x
    Replies: 12
    Last Post: 03-01-2009, 08:43 PM
  2. Form Processing
    By echo@ in forum v5.x
    Replies: 11
    Last Post: 12-09-2007, 01:32 PM
  3. Payment processing
    By Webfriend in forum Customers Lounge
    Replies: 2
    Last Post: 05-28-2007, 03:52 PM
  4. Replies: 1
    Last Post: 01-03-2004, 09:34 PM
  5. looking up user during add process
    By esm in forum v5.x
    Replies: 3
    Last Post: 06-18-2003, 10:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •