журнал (shhh) wrote in changelog,
журнал
shhh
changelog

[ljcom] r12911: LJSUP-14234: Implement server part for s...

Committer: nnikulochkina
LJSUP-14234: Implement server part for shop payment pages
U   trunk/cgi-bin/LJ/Pay/Method/CreditCard.pm
U   trunk/cgi-bin/LJ/Pay/Method/WebMoney.pm
U   trunk/cgi-bin/LJ/Pay/Payment.pm
U   trunk/cgi-bin/LJ/Widget/Shop/Cart.pm
Modified: trunk/cgi-bin/LJ/Pay/Method/CreditCard.pm
===================================================================
--- trunk/cgi-bin/LJ/Pay/Method/CreditCard.pm	2012-11-16 11:44:06 UTC (rev 12910)
+++ trunk/cgi-bin/LJ/Pay/Method/CreditCard.pm	2012-11-16 12:44:06 UTC (rev 12911)
@@ -41,12 +41,9 @@
 
     my ($err, $html);
 
-    # TODO: type
     my $type = LJ::Request->get_param('type');
 
-    # TODO: err
-    #$self->ml_error('error.invalidform')
-    #    unless $type;
+    return LJ::Request->redirect($cart->cart_error_link(siteroot => $LJ::SITEROOT)) unless $type;
     
     my @params = ( 
         LJ::Pay::RecBill->valid_countries,
@@ -73,8 +70,7 @@
 
             unless ($result && $result->{status} &&
                     $result->{status} eq 'OK') {
-                LJ::Request->redirect("$LJ::SITEROOT/shop/cart.bml?pay_err=1&cart=${cart_id}");
-                return;
+                return LJ::Request->redirect($cart->cart_error_link(siteroot => $LJ::SITEROOT));
             }
             
             $template_params->{iframe} = 1;

Modified: trunk/cgi-bin/LJ/Pay/Method/WebMoney.pm
===================================================================
--- trunk/cgi-bin/LJ/Pay/Method/WebMoney.pm	2012-11-16 11:44:06 UTC (rev 12910)
+++ trunk/cgi-bin/LJ/Pay/Method/WebMoney.pm	2012-11-16 12:44:06 UTC (rev 12911)
@@ -41,7 +41,7 @@
         );
         
         unless($result && $result->{status} && ($result->{status} eq 'OK')){
-            LJ::Request->redirect("$LJ::SITEROOT/shop/cart.bml?pay_err=1&cart=$cart_id");
+            return LJ::Request->redirect($cart->cart_error_link(siteroot => $LJ::SITEROOT));
         }
         
         my %form_params = map {$_ => $result->{$_}} qw(LMI_PAYEE_PURSE LMI_PAYMENT_AMOUNT LMI_PAYMER_NUMBER 

Modified: trunk/cgi-bin/LJ/Pay/Payment.pm
===================================================================
--- trunk/cgi-bin/LJ/Pay/Payment.pm	2012-11-16 11:44:06 UTC (rev 12910)
+++ trunk/cgi-bin/LJ/Pay/Payment.pm	2012-11-16 12:44:06 UTC (rev 12911)
@@ -561,6 +561,11 @@
     return "$siteroot/shop/cart.bml?cart=$cart";
 }
 
+sub cart_error_link {
+    my $self = shift;
+    return ( $self->cart_link(@_) . '&pay_err=1' );
+}
+
 sub is_valid_cart {
     my $self = shift;
     my $errs = shift || [];

Modified: trunk/cgi-bin/LJ/Widget/Shop/Cart.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/Shop/Cart.pm	2012-11-16 11:44:06 UTC (rev 12910)
+++ trunk/cgi-bin/LJ/Widget/Shop/Cart.pm	2012-11-16 12:44:06 UTC (rev 12911)
@@ -348,10 +348,13 @@
             LJ::Request->delete_cookie('cart');
         }
 
-        # TODO: type
-        LJ::Request->redirect("$LJ::SSLROOT/shop/checkout.bml?cart=" .
-            $cart->get_cart_as_string .
-            "&type=".LJ::Request->post_param('type'));
+        my $redirect_url = "$LJ::SSLROOT/shop/checkout.bml?cart=".$cart->get_cart_as_string;
+        
+        if(my $type = LJ::Request->post_param('type')) {
+            $redirect_url .= "&type=$type";
+        }
+
+        LJ::Request->redirect($redirect_url);
     }
 
     # repeat order

Tags: ljcom, nikulochkina, nnikulochkina, 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