~ubuntu-branches/ubuntu/wily/libbusiness-onlinepayment-perl/wily

« back to all changes in this revision

Viewing changes to FraudDetect.pm

  • Committer: Bazaar Package Importer
  • Author(s): Ivan Kohler
  • Date: 2006-11-29 21:59:57 UTC
  • mfrom: (1.2.1 upstream) (3.1.2 feisty)
  • Revision ID: james.westby@ubuntu.com-20061129215957-xinqiz3lrwh76l21
Tags: 3.00~05-1
New upstream release (3.00_05 CPAN developer release)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package Business::FraudDetect;
 
2
 
 
3
 
 
4
 
 
5
use vars qw / $VERSION @ISA /;
 
6
 
 
7
$VERSION = '0.01';
 
8
@ISA = qw / Business::OnlinePayment /;
 
9
 
 
10
1;
 
11
 
 
12
=pod
 
13
 
 
14
=head1 NAME
 
15
 
 
16
Business::FraudDetect - A cohort to Business::OnlinePayment
 
17
 
 
18
=head1 SYNOPSIS
 
19
 
 
20
  my %processor_info = ( fraud_detection => 'preCharge',
 
21
                         maximum_fraud_score => 500,
 
22
                         preCharge_id => '1000000000000001',
 
23
                         preCharge_security1 => 'abcdef0123',
 
24
                         preCharge_security2 => '3210fedcba',
 
25
                        )
 
26
  my $transaction = new Business::OnlinePayment($processor, %processor_info);
 
27
  $transaction->content(
 
28
                        type       => 'Visa',
 
29
                        amount     => '49.95',
 
30
                        cardnumber => '1234123412341238',
 
31
                        expiration => '0100',
 
32
                        name       => 'John Q Doe',
 
33
                       );
 
34
  $transaction->submit();
 
35
 
 
36
  if($transaction->is_success()) {
 
37
    print "Card processed successfully: ".$transaction->authorization()."\n";
 
38
  } else {
 
39
    print "Card was rejected: ".$transaction->error_message()."\n";
 
40
  }
 
41
 
 
42
=head1 DESCRIPTION
 
43
 
 
44
This is a module that adds functionality to Business::OnlinePayment.  See L<Business::OnlinePayment>.
 
45
 
 
46
The user instantiates a Business::OnlinePayment object per usual, adding in three processor directives
 
47
 
 
48
=over 4
 
49
 
 
50
=item *  fraud_detection
 
51
 
 
52
Which Fraud Detection module to use.
 
53
 
 
54
=item *  maximum_fraud_score
 
55
 
 
56
FraudDetection drivers are expected to return a numeric "risk" factor, this parameter allows you to set the threshold to reject the transaction based on that risk.  Higher numbers are "riskier" transactions.
 
57
 
 
58
=item * other driver-specific parameters.
 
59
 
 
60
Consult the specific Fraud Detection module you intend to use for its required parameters.
 
61
 
 
62
=back
 
63
 
 
64
The $tx->submit() method is overridden to interpose a FraudDetection phase.  A subordinate object is created using the same content as the parent OnlinePayment object, and a I<Fraud Detect> action is run against that subordinate object.  If the resulting fraud score is less than or equal to the maximum_risk parameter, the parent transaction will be allowed to proceed.  Otherwise, a failure state will exist with a suitable error message.
 
65
 
 
66
=head1 METHODS
 
67
 
 
68
This module provides no new methods.  It does, however override the
 
69
submit method to interpose an additional Fraud Detection phase. 
 
70
 
 
71
=head1 AUTHORS
 
72
 
 
73
Lawrence Statton <lawrence@cluon.com>
 
74
 
 
75
=head1 DISCLAIMER
 
76
 
 
77
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
78
 
 
79
=head1 SEE ALSO
 
80
 
 
81
http://420.am/business-onlinepayment
 
82
 
 
83
=cut