diff options
Diffstat (limited to 'LedgerSMB/CreditCard')
-rw-r--r-- | LedgerSMB/CreditCard/Config.pm | 4 | ||||
-rw-r--r-- | LedgerSMB/CreditCard/TrustCommerce.pm | 96 | ||||
-rw-r--r-- | LedgerSMB/CreditCard/TrustCommerce/Config.pm | 9 |
3 files changed, 54 insertions, 55 deletions
diff --git a/LedgerSMB/CreditCard/Config.pm b/LedgerSMB/CreditCard/Config.pm index 199431c0..c8b30758 100644 --- a/LedgerSMB/CreditCard/Config.pm +++ b/LedgerSMB/CreditCard/Config.pm @@ -1,6 +1,6 @@ #===================================================================== -# LedgerSMB +# LedgerSMB # Small Medium Business Accounting software # http://www.ledgersmb.org/ # Copyright (C) 2006 @@ -18,6 +18,6 @@ package Config; $gateway_module = "TrustCommerce"; -$debug = 0; # Debugging off by default +$debug = 0; # Debugging off by default 1; diff --git a/LedgerSMB/CreditCard/TrustCommerce.pm b/LedgerSMB/CreditCard/TrustCommerce.pm index 7b75530d..93aaee83 100644 --- a/LedgerSMB/CreditCard/TrustCommerce.pm +++ b/LedgerSMB/CreditCard/TrustCommerce.pm @@ -1,6 +1,6 @@ #===================================================================== -# LedgerSMB +# LedgerSMB # Small Medium Business Accounting software # http://www.ledgersmb.org/ # Copyright (C) 2006 @@ -23,63 +23,63 @@ use Net::TCLink; $debug = $1; sub sale { - $form = shift @_; - $params{action} = 'sale'; - $params{amount} = $form->{amount} * 100; - $params{track1} = $form->{track1}; - $params{track2} = $form->{track2}; - &process; + $form = shift @_; + $params{action} = 'sale'; + $params{amount} = $form->{amount} * 100; + $params{track1} = $form->{track1}; + $params{track2} = $form->{track2}; + &process; } sub process { - for (keys %params){ - print "$_= ".$params{$_}."\n"; - } - my %result = Net::TCLink::send(\%params); - $form->{status} = $result{status}; - if ($result{status} eq 'decline'){ - $form->{declinetype} = $result{declinetype}; - $form->{declinemsg} = $declinemsg{$result{declinetype}}; - } - $form->{ccauth} = $result{transID}; - # log transID and status - print STDERR "Info: TCLink CC AUTH transID $result{transid} returned ". - "status $result{status}:$result{declinetype}:$result{baddata}:". - "$result{errortype}\n"; - if ($debug){ - print STDERR "Full Result:\n"; + for ( keys %params ) { + print "$_= " . $params{$_} . "\n"; + } + my %result = Net::TCLink::send( \%params ); + $form->{status} = $result{status}; + if ( $result{status} eq 'decline' ) { + $form->{declinetype} = $result{declinetype}; + $form->{declinemsg} = $declinemsg{ $result{declinetype} }; + } + $form->{ccauth} = $result{transID}; - for (keys %result){ - print STDERR "$_= ".$result{$_}."\n"; - } - } - - %result; + # log transID and status + print STDERR "Info: TCLink CC AUTH transID $result{transid} returned " + . "status $result{status}:$result{declinetype}:$result{baddata}:" + . "$result{errortype}\n"; + if ($debug) { + print STDERR "Full Result:\n"; + + for ( keys %result ) { + print STDERR "$_= " . $result{$_} . "\n"; + } + } + + %result; } sub credit { - $form = shift @_; - my %params = %baseparams; - $params{transid} = $form->{transid}; - $params{amount} = $form->{amount}; - &process; + $form = shift @_; + my %params = %baseparams; + $params{transid} = $form->{transid}; + $params{amount} = $form->{amount}; + &process; } - %declinemsg = ( - decline => 'Transaction declined by bank', - avs => 'AVS failed: Address and/or Zip mismatch', - cvv => 'CVV2 Failure: Check the CVV2 number and try again', - call => 'Call customer service number on card to get authcode', - expiredcard => 'This card has expired', - carderror => 'This card number is invalid.', - authexpired => 'The authorization expired. Can not postauth.', - fraud => 'CrediGuard Fraud Score exceeded desired threshold', - blacklist => 'CrediGuard Declined: blacklisted this transaction.', - velocity => 'Crediguard declined: Too many transactions', - dailylimit => 'Too many transactions in a day.', - weeklylimit => 'Too many transactions in a week', - monthlylimit => 'Too many transactions in a month' + decline => 'Transaction declined by bank', + avs => 'AVS failed: Address and/or Zip mismatch', + cvv => 'CVV2 Failure: Check the CVV2 number and try again', + call => 'Call customer service number on card to get authcode', + expiredcard => 'This card has expired', + carderror => 'This card number is invalid.', + authexpired => 'The authorization expired. Can not postauth.', + fraud => 'CrediGuard Fraud Score exceeded desired threshold', + blacklist => 'CrediGuard Declined: blacklisted this transaction.', + velocity => 'Crediguard declined: Too many transactions', + dailylimit => 'Too many transactions in a day.', + weeklylimit => 'Too many transactions in a week', + monthlylimit => 'Too many transactions in a month' ); 1; diff --git a/LedgerSMB/CreditCard/TrustCommerce/Config.pm b/LedgerSMB/CreditCard/TrustCommerce/Config.pm index bbe707be..86d026d8 100644 --- a/LedgerSMB/CreditCard/TrustCommerce/Config.pm +++ b/LedgerSMB/CreditCard/TrustCommerce/Config.pm @@ -1,5 +1,5 @@ #===================================================================== -# LedgerSMB +# LedgerSMB # Small Medium Business Accounting software # http://www.ledgersmb.org/ # Copyright (C) 2006 @@ -14,12 +14,11 @@ # # TrustCommerce configuration Information goes Here - package TrustCommerce; - -%baseparams = ( custid => '000000', - password => 'password', +%baseparams = ( + custid => '000000', + password => 'password', ); $debug = 0; |