[interchange-cvs] interchange - heins modified lib/Vend/Payment.pm
interchange-core@icdevgroup.org
interchange-core@icdevgroup.org
Thu Jul 18 12:15:14 2002
User: heins
Date: 2002-07-18 16:14:59 GMT
Modified: lib/Vend Tag: STABLE_4_8-branch Payment.pm
Log:
* Fixed bug where decimal pricing would not be forced, causing failure for
round amounts with some gateways.
* Additional debug put in DEVEL, not stable, for future development.
* Add penny_pricing option for those gateways which might not accept
decimals.
Revision Changes Path
No revision
No revision
2.2.2.2 +6 -2 interchange/lib/Vend/Payment.pm
rev 2.2.2.2, prev_rev 2.2.2.1
Index: Payment.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.pm,v
retrieving revision 2.2.2.1
retrieving revision 2.2.2.2
diff -u -r2.2.2.1 -r2.2.2.2
--- Payment.pm 24 Jan 2002 05:07:01 -0000 2.2.2.1
+++ Payment.pm 18 Jul 2002 16:14:59 -0000 2.2.2.2
@@ -1,6 +1,6 @@
# Vend::Payment - Interchange payment processing routines
#
-# $Id: Payment.pm,v 2.2.2.1 2002/01/24 05:07:01 jon Exp $
+# $Id: Payment.pm,v 2.2.2.2 2002/07/18 16:14:59 mheins Exp $
#
# Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
#
@@ -22,7 +22,7 @@
package Vend::Payment;
require Exporter;
=20
-$VERSION =3D substr(q$Revision: 2.2.2.1 $, 10);
+$VERSION =3D substr(q$Revision: 2.2.2.2 $, 10);
=20
@ISA =3D qw(Exporter);
=20
@@ -306,9 +306,13 @@
=20
# Uses the {precision} -> MV_PAYMENT_PRECISION options if set
my $precision =3D charge_param('precision') || 2;
+ my $penny =3D charge_param('penny_pricing') || 0;
=20
my $amount =3D $pay_opt->{amount} || Vend::Interpolate::total_cost();
$amount =3D round_to_frac_digits($amount, $precision);
+ $amount =3D sprintf "%.${precision}f", $amount;
+ $amount *=3D 100 if $penny;
+
$pay_opt->{total_cost} =3D $amount;
$pay_opt->{amount} =3D "$currency $amount";
=20