diff options
author | ivan <ivan> | 2005-10-11 00:57:05 +0000 |
---|---|---|
committer | ivan <ivan> | 2005-10-11 00:57:05 +0000 |
commit | dafab54d874265f576305d8ba44a6d90a142a7b1 (patch) | |
tree | 572ca43ddfcd4731d8f4285f459a9a82ba8c2956 /lib | |
parent | 0aae49345c4ed31a94a19328693af3c669207bd1 (diff) |
0.02 fixes for postauth/refund/void
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Business/OnlinePayment/Capstone.pm | 53 |
1 files changed, 23 insertions, 30 deletions
diff --git a/lib/Business/OnlinePayment/Capstone.pm b/lib/Business/OnlinePayment/Capstone.pm index ed645bb..6302592 100644 --- a/lib/Business/OnlinePayment/Capstone.pm +++ b/lib/Business/OnlinePayment/Capstone.pm @@ -9,7 +9,7 @@ use Business::OnlinePayment::HTTPS 0.03; use vars qw($VERSION $DEBUG @ISA);
@ISA = qw(Business::OnlinePayment::HTTPS);
-$VERSION = '0.01';
+$VERSION = '0.02';
$DEBUG = 0;
sub set_defaults {
@@ -65,14 +65,12 @@ sub submit { custom0 => 'description',
);
-
# => 'order_type',
# => 'transaction_type',
#authorization =>
#company =>
- #country =>
#phone =>
#fax =>
@@ -80,45 +78,40 @@ sub submit { #customer_id =>
#authorization => 'txn_number'
- # XXXfix check required fields!
-# if ( $action =~ /^(purchase|preauth|ind_refund)$/ ) {
-#
-# $self->required_fields(
-# qw( login password amount card_number expiration )
-# );
-#
+ if ( $action =~ /^auth(postauth)?$/ ) {
+
+ $self->required_fields(qw(
+ login password action amount
+ name address city state zip
+ email
+ card_number expiration cvv2
+ ));
+
$self->{_content}{'expiration'} =~ /^(\d+)\D+\d*(\d{2})$/
- or croak "unparsable expiration ". $self->{_content}{expiration};
+ or croak "unparsable expiration: ". $self->{_content}{expiration};
my( $month, $year ) = ( $1, $2 );
$month = '0'. $month if $month =~ /^\d$/;
$self->{_content}{card_exp} = $month.$year;
if ( $self->{_content}{'card_start'} ) {
$self->{_content}{'card_start'} =~ /^(\d+)\D+\d*(\d{2})$/
- or croak "unparsable expiration ". $self->{_content}{card_start};
+ or croak "unparsable card_start ". $self->{_content}{card_start};
my( $month, $year ) = ( $1, $2 );
$month = '0'. $month if $month =~ /^\d$/;
$self->{_content}{start_date} = $month.$year;
}
-# $self->generate_order_id;
-#
# $self->{_content}{amount} = sprintf('%.2f', $self->{_content}{amount} );
-#
-# } elsif ( $action eq 'completion' || $action eq 'void' ) {
-#
-# $self->required_fields( qw( login password order_number authorization ) );
-#
-# } elsif ( $action eq 'refund' ) {
-#
-# $self->required_fields(
-# qw( login password order_number authorization )
-# );
-#
-# }
-
- #warn $self->get_fields('zip');
- #warn $self->get_fields('postal');
+
+ } elsif ( $action =~ /^(postauth|void|return)$/ ) {
+
+ $self->required_fields(qw(
+ login password action order_number
+ ));
+
+ } else {
+ die "unknown action $action";
+ }
$self->{'_content'}{country} ||= 'US';
@@ -179,7 +172,7 @@ sub submit { if ( $result{'status'} eq 'good' ) {
$self->is_success(1);
$self->authorization( $result{'auth_code'} );
- $self->order_number( $result{'orderid'} );
+ $self->order_number( $result{'orderid'} );
} elsif ( $result{'status'} =~ /^(bad|error|fraud)$/ ) {
$self->is_success(0);
$self->error_message("$1: ". $result{'status_msg'});
|