ssafronova (ssafronova) wrote in changelog,
ssafronova
ssafronova
changelog

[ljcom] r10255: LJSUP-8014: Credit card payment process ...

Committer: ssafronova
LJSUP-8014: Credit card payment process refactoring - LJSUP-8210: error "invalid value for element city at"
U   trunk/bin/upgrading/en_LJ.dat
U   trunk/cgi-bin/LJ/Widget/CreditCard.pm
Modified: trunk/bin/upgrading/en_LJ.dat
===================================================================
--- trunk/bin/upgrading/en_LJ.dat	2011-03-17 09:00:07 UTC (rev 10254)
+++ trunk/bin/upgrading/en_LJ.dat	2011-03-17 09:36:26 UTC (rev 10255)
@@ -4307,14 +4307,22 @@
 
 pay.cc.validate.cardtype2=Wrong card type selected.  You have selected [[cardtype]], but entered a [[actual]] number.
 
+pay.cc.validate.city=Invalid city.
+
 pay.cc.validate.country=Please select a valid country.
 
 pay.cc.validate.cvv2=Invalid CVV2 number entered. [[cardtype]] has a [[num]] digit CVV2 number.
 
 pay.cc.validate.email.need=Please check your email address. You must enter your email address to proceed.
 
+pay.cc.validate.exp_m=Invalid month.
+
+pay.cc.validate.exp_y=Invalid year.
+
 pay.cc.validate.name=Please enter the card owner's full name.
 
+pay.cc.validate.state=Invalid state.
+
 pay.cc.form.postalcode.bubble-lite=Enter your postal code.
 
 pay.cc.form.postalcode.bubble-warning=Please check your zip code. If you have recently moved, you may need to use your previous address. If you are using your full zip+4 zip code, use the format XXXXX-XXXX, including the hyphen.

Modified: trunk/cgi-bin/LJ/Widget/CreditCard.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/CreditCard.pm	2011-03-17 09:00:07 UTC (rev 10254)
+++ trunk/cgi-bin/LJ/Widget/CreditCard.pm	2011-03-17 09:36:26 UTC (rev 10255)
@@ -353,6 +353,18 @@
                       field => 'cc_cvv2' };
     }
 
+    my $p_year = sprintf("%04d", $POST->{exp_y});
+    my $p_month = sprintf("%02d", $POST->{exp_m});
+    unless ($p_year =~ /^\d{4}$/) {
+        push @errs, { err => LJ::Lang::ml('pay.cc.validate.exp_y'),
+                      field => 'exp_y' };
+    }
+
+    unless ($p_month >= 1 and $p_month <= 12) {
+        push @errs, { err => LJ::Lang::ml('pay.cc.validate.exp_m'),
+                      field => 'exp_y' };
+    }
+
     my ($sec,$min,$hour,$mday,$mon,$year,
           $wday,$yday,$isdst) = localtime();
     $mon++;
@@ -368,7 +380,8 @@
                       field => 'name_full' };
     }
 
-    unless (length($POST->{addr})) {
+    my $addr_len = LJ::Text->char_len($POST->{addr});
+    unless ($addr_len > 0 and $addr_len <= 60) {
         push @errs, { err => LJ::Lang::ml('pay.cc.validate.address'),
                       field => 'addr' };
     }
@@ -410,6 +423,18 @@
                       field => 'country' };
     }
 
+    my $city_len = length $POST->{city};
+    unless ($city_len > 0 and $city_len <= 50) {
+        push @errs, { err => LJ::Lang::ml('pay.cc.validate.city'),
+                      field => 'city' };
+    }
+
+    my $state_len = length $POST->{state};
+    unless ($state_len <= 65) {
+        push @errs, { err => LJ::Lang::ml('pay.cc.validate.state'),
+                      field => 'state_other' };
+    }
+
     unless ($POST->{email}) {
         push @errs, { err =>  LJ::Lang::ml('pay.cc.validate.email.need'),
                       field => 'email' };

Tags: dat, ljcom, pm, ssafronova
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