Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[ljcom] r8136: LJSV-892 (after vgift order is completed...

Committer: ailyin
LJSV-892 (after vgift order is completed, old order still shows and must
be manually cleared): create a new cart in case the old one has been
checked out and delivered successfully

U   trunk/cgi-bin/LJ/Widget/IPPU/AddVGift.pm
Modified: trunk/cgi-bin/LJ/Widget/IPPU/AddVGift.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/IPPU/AddVGift.pm	2010-01-26 08:04:29 UTC (rev 8135)
+++ trunk/cgi-bin/LJ/Widget/IPPU/AddVGift.pm	2010-01-26 08:18:58 UTC (rev 8136)
@@ -100,21 +100,21 @@
 
     my $cart = $post->{'cart'} || $BML::COOKIE{cart};
     my $ensurecookie = sub {
-        if (! $BML::COOKIE{'cart'} && $cart =~ /^(\d+)-(\d+)$/) {
+        if ($BML::COOKIE{'cart'} ne $cart) {
             $BML::COOKIE{'cart'} = $cart;
         }
     };
 
     my $cartobj = eval { LJ::Pay::Payment::load_cart($cart) };
-    unless ($cartobj) {
+    if (!$cartobj || $cartobj->get_used eq 'Y') {
         $cartobj = LJ::Pay::Payment::new_cart($remote);
         $cart = "$cartobj->{'payid'}-$cartobj->{'anum'}";
     }
     $ensurecookie->();
 
     # don't let them modify the cart if they've already started
-    # any sort of checkout process
-    my $can_mod = ! $cartobj || ! $cartobj->{'method'};
+    # any sort of checkout process and hasn't yet finished it
+    my $can_mod = ! $cartobj || ! $cartobj->get_method;
     die BML::ml('.error.alreadycheckedout', {
                     'aopts1' => "href='$LJ::SITEROOT/pay/?c=$cart'",
                     'aopts2' => "href='$LJ::SITEROOT/pay/?c=new&old=$cart'"})

Tags: andy, ljcom, pm
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments