[ic] order.profile logic commands

Brendan Crosser-McGay interchange-users@interchange.redhat.com
Tue Apr 30 14:37:02 2002


Thank you very much, I haven't looked at ic_ecommerce yet, thats quite
interesting.  Hopefully I can get this going with too much trouble!
Thanks! :)

-----------------------------------------
Brendan Crosser-McGay
brendan@paymentonline.com
-----------------------------------------


> -----Original Message-----
> From: interchange-users-admin@interchange.redhat.com
> [mailto:interchange-users-admin@interchange.redhat.com]On
> Behalf Of Dan
> Browning
> Sent: Tuesday, April 30, 2002 7:59 AM
> To: interchange-users@interchange.redhat.com
> Subject: Re: [ic] order.profile logic commands
>
>
> At 07:08 PM 4/29/2002 -0700, you wrote:
> >I was trying to perform some checks on some numbers for
> checking a date of
> >birth to see if it is past a certain age.  I tried this and
> it didn't work,
> >this code is from the orders.profile, all I get is
> >
> >(elsif): No format check routine for 'value'
> >
> >when I go through an order.  I guess that means the order
> profile is not
> >working, but I can't think of what could be wrong, from what
> I've seen from
> >the other order profiles, ITL can be used there without any
> problems, Any
> >help would be appreciated!
> >
> >profiles.order    code follows:
> >
> >__NAME__                            credit_card
> >fname=required
> >lname=required
> >address1=required
> >city=required
> >country=required
> >&set = timeyear [calc][time]%Y[/time]-18[/calc]
> >&set = timemonth [time]%m[/time]
> >&set = timeday [time]%d[/time]
> >[if value dob_year < timeyear]
> >         [then]
> >                 &set = DOB_check 1
> >         [/then]
> >         [elsif value dob_year == timeyear]
> >                 [if value dob_month == timemonth]
> >                         [then]
> >                         [if value dob_day == timeday]
> >                                         &set = DOB_check 1
> >                                 [elsif scratch dob_day < timeday]
> >                                         &set = DOB_check 1
> >                                 [/elsif]
> >                         [/if]
> >                         [/then]
> >                 [elsif value dob_month < timemonth]
> >                         &set = DOB_check 1
> >                 [/elsif]
> >                 [/if]
> >         [/elsif]
> >[/if]
> >DOB_check=required You cannot continue since you are under 18.
> >phone_check=required
> >[if !value phone_check == ""]
> >   [then]
> >     [if !value phone_day == ""]
> >     phone_day=phone
> >     [/if]
> >
> >     [if !value phone_night == ""]
> >     phone_night=phone
> >     [/if]
> >
> >     [if !value phone_mobile == ""]
> >     phone_mobile=phone
> >     [/if]
> >    [/then]
> >   [/if]
> >[if value country =~ /^(US|CA)$/i]
> >         state=state_province
> >         zip=postcode
> >[/if]
> >
> >&fatal = yes
> >email=required
> >email=email
> >
> >&set = mv_payment Incomplete
> >
> >[if variable MV_PAYMENT_MODE]
> >&credit_card=standard keep __CREDIT_CARDS_ACCEPTED__
> >&charge=[var MV_PAYMENT_MODE][cgi mv_payment_test]
> >&set=mv_payment Real-time Credit Card (%c -- [var MV_PAYMENT_MODE])
> >[else]
> >&credit_card=standard __CREDIT_CARDS_ACCEPTED__
> >&set=mv_payment Credit Card (%c)
> >[/else]
> >[/if]
> >
> >&calc = $Values->{mv_payment} =~
> s/\%c/$Values->{mv_credit_card_type}/g; 1;
> >&final = yes
> >&setcheck=mv_email [value email]
> >
> >-----------------------------------------
> >Brendan Crosser-McGay
>
> I would recommend that you first test your code outside the
> profile with
> test parameters to make sure you don't have any bugs (it seems to be
> missing a little bit of logic in your if statements).  Then I
> would either
> create a new filter with this code in it (to be used with a filter
> directive in the profile), or create a globalsub that runs
> this code in the
> profile.  This is documented in the Ed LaFrance's
> ic_ecommerce (which can
> be found in man format in VENDROOT/doc, man2html can convert to
> HTML).  Here is an example of a globalsub that checks if a
> certain date is
> in the past, note the use of < as well as == when checking
> dates, that may
> be your problem.
>
> GlobalSub <<EOF
>      sub set_up_extra_check {
>          BEGIN {
>              package Vend::Order;
>                          sub _date_past {
>                                  my($ref, $var, $val) = @_;
>
>                                  $_ = $val;
>                                  my ($mo, $da, $yr) =
> /(^\d{1,2}).(\d{1,2}).(\d\d\d\d|\d\d)/;
>
>                                  my ($DAY, $MONTH, $YEAR) =
> (localtime)[3,4,5];
>                                  $YEAR += 1900;
>
>                                  my $error_msg = "must be in
> the past";
>                                  if ($yr < $YEAR){
>                                          return (1, $var, '');
>                                  } elsif ($yr == $YEAR){
>                                          if ($mo < $MONTH){
>                                                  return (1, $var, '');
>                                          } elsif ($mo == $MONTH){
>                                                  if ($da < $DAY){
>
> return (1, $var, '');
>                                                  } else {
>
> return (undef,
> $var, $error_msg);
>                                                  }
>                                          } else {
>                                                  return (undef, $var,
> $error_msg);
>                                          }
>                                  } else {
>                                          return (undef, $var,
> $error_msg);
>                                  }
>                                  return (1, $var, '');
>                          }
>                  }
>          }
> EOF
>
> HTH,
>
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> | Dan Browning, Kavod Technologies <db@kavod.com>
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> "I'll rob that rich person and give it to some poor deserving slob.
> That will *prove* I'm Robin Hood."
>                  -- Daffy Duck, "Robin Hood Daffy", [1958,
> Chuck Jones]
>
> _______________________________________________
> interchange-users mailing list
> interchange-users@interchange.redhat.com
> http://interchange.redhat.com/mailman/listinfo/interchange-users
>