projects
/
Business-CreditCard.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a8d298e
)
Allow use of our subroutines as class methods, patch from Adam Kennedy, thanks!
author
Ivan Kohler
<ivan@freeside.biz>
Tue, 6 May 2014 08:07:58 +0000
(
01:07
-0700)
committer
Ivan Kohler
<ivan@freeside.biz>
Tue, 6 May 2014 08:07:58 +0000
(
01:07
-0700)
Changes
patch
|
blob
|
history
CreditCard.pm
patch
|
blob
|
history
diff --git
a/Changes
b/Changes
index
d3c2183
..
9a90f30
100644
(file)
--- a/
Changes
+++ b/
Changes
@@
-3,6
+3,8
@@
Revision history for Perl extension Business::CreditCard.
0.33 unreleased
- With $Country explicity to CA, fix identification of JCB 3529-3589
as Discover
0.33 unreleased
- With $Country explicity to CA, fix identification of JCB 3529-3589
as Discover
+ - Allow use of our subroutines as class methods, patch from Adam
+ Kennedy, thanks!
0.32 Thu Feb 21 16:02:42 PST 2013
- Add Israeli Isracard (no checksum yet)
0.32 Thu Feb 21 16:02:42 PST 2013
- Add Israeli Isracard (no checksum yet)
diff --git
a/CreditCard.pm
b/CreditCard.pm
index
4fe901e
..
4fdcebd
100644
(file)
--- a/
CreditCard.pm
+++ b/
CreditCard.pm
@@
-132,7
+132,7
@@
types. Lee also contributed a working test.pl. Alexandr Ciornii
Copyright (C) 1995,1996,1997 Jon Orwant
Copyright (C) 2001-2006 Ivan Kohler
Copyright (C) 1995,1996,1997 Jon Orwant
Copyright (C) 2001-2006 Ivan Kohler
-Copyright (C) 2007-201
3
Freeside Internet Services, Inc.
+Copyright (C) 2007-201
4
Freeside Internet Services, Inc.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.8 or,
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.8 or,
@@
-174,6
+174,9
@@
providing credit card number verification (LUHN checking).
## a lot more than just 6011*, they don't handle processing agreements, etc.
sub cardtype {
## a lot more than just 6011*, they don't handle processing agreements, etc.
sub cardtype {
+ # Allow use as a class method
+ shift if UNIVERSAL::isa( $_[0], 'Business::CreditCard' );
+
my ($number) = @_;
$number =~ s/[\s\-]//go;
my ($number) = @_;
$number =~ s/[\s\-]//go;
@@
-242,6
+245,9
@@
sub cardtype {
}
sub generate_last_digit {
}
sub generate_last_digit {
+ # Allow use as a class method
+ shift if UNIVERSAL::isa( $_[0], 'Business::CreditCard' );
+
my ($number) = @_;
die "invalid operation" if length($number) == 8 || length($number) == 9;
my ($number) = @_;
die "invalid operation" if length($number) == 8 || length($number) == 9;
@@
-274,6
+280,9
@@
sub generate_last_digit {
# $type = '' if $ccn % 10;
# return $type;
sub validate {
# $type = '' if $ccn % 10;
# return $type;
sub validate {
+ # Allow use as a class method
+ shift if UNIVERSAL::isa( $_[0], 'Business::CreditCard' );
+
my ($number) = @_;
my ($i, $sum, $weight);
my ($number) = @_;
my ($i, $sum, $weight);