[interchange-cvs] interchange - heins modified lib/Vend/Payment/Skipjack.pm

interchange-core@icdevgroup.org interchange-core@icdevgroup.org
Mon Sep 2 12:53:01 2002


User:      heins
Date:      2002-09-02 16:52:14 GMT
Modified:  lib/Vend/Payment Tag: STABLE_4_8-branch Skipjack.pm
Log:
* Properly format Skipjack order string. I think this makes about zero
  difference in how Interchange operates, but it may allow some reporting
  functions to work at Skipjack.

Revision  Changes    Path
No                   revision



No                   revision



2.0.2.3   +38 -3     interchange/lib/Vend/Payment/Skipjack.pm


rev 2.0.2.3, prev_rev 2.0.2.2
Index: Skipjack.pm
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /anon_cvs/repository/interchange/lib/Vend/Payment/Skipjack.pm,v
retrieving revision 2.0.2.2
retrieving revision 2.0.2.3
diff -u -r2.0.2.2 -r2.0.2.3
--- Skipjack.pm	9 Feb 2002 03:44:24 -0000	2.0.2.2
+++ Skipjack.pm	2 Sep 2002 16:52:13 -0000	2.0.2.3
@@ -1,6 +1,6 @@
 # Vend::Payment::Skipjack - Interchange Skipjack support
 #
-# $Id: Skipjack.pm,v 2.0.2.2 2002/02/09 03:44:24 mheins Exp $
+# $Id: Skipjack.pm,v 2.0.2.3 2002/09/02 16:52:13 mheins Exp $
 #
 # Copyright (C) 1999-2002 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -27,7 +27,7 @@
=20
 =3Dhead1 Interchange Skipjack Support
=20
-Vend::Payment::Skipjack $Revision: 2.0.2.2 $
+Vend::Payment::Skipjack $Revision: 2.0.2.3 $
=20
 =3Dhead1 SYNOPSIS
=20
@@ -482,6 +482,41 @@
 			$amount =3D Vend::Util::round_to_frac_digits($amount,$precision);
     }
=20
+	if(! $opt->{orderstring}) {
+=09=09
+		my @strings;
+		my $tax_charged =3D Vend::Tags->salestax({noformat =3D> 1}) > 0;
+		my $tf =3D $Vend::Cfg->{NonTaxableField};
+
+		for my $item (@$Vend::Items) {
+			my $price =3D Vend::Data::item_price($item);
+			my $desc =3D $item->{description} || Vend::Data::item_description($item=
);
+			$desc =3D~ s/~//g;
+			$desc =3D~ s/[\r\n]+/ /g;
+			$desc =3D HTML::Entities::encode_entities($desc);
+
+			my $taxable;
+			if(defined $item->{mv_nontaxable}) {
+				$taxable =3D $item->{mv_nontaxable} ? 'N' : 'Y';=20
+			}
+			elsif($tf) {
+				$taxable =3D is_yes(Vend::Data::item_field($item, $tf)) ? 'N' : 'Y';
+			}
+			else {
+				$taxable =3D $tax_charged ? 'Y' : 'N';
+			}
+			push @strings,
+					join "~",
+						$item->{code},
+						$desc,
+						$price,
+						$item->{quantity},
+						$taxable,
+						'';
+		}
+		$opt->{orderstring} =3D join '||', @strings;
+	}
+
 	my %values;
 	if($transtype eq 'sale') {
 		%values =3D (
@@ -497,7 +532,7 @@
 			Year =3D> $ccey,
 			Serialnumber =3D> $user,
 			Transactionamount =3D> $amount,
-			Orderstring =3D> "0001~Generic Order String~$amount~1~N~||",
+			Orderstring =3D> $opt->{orderstring},
 			Shiptophone =3D> $actual{phone_day}
 			);
 	}