1 package Business::OnlinePayment::Jety;
5 use Business::OnlinePayment 3;
6 use Business::OnlinePayment::HTTPS;
7 use vars qw($VERSION @ISA $me $DEBUG);
12 @ISA = qw(Business::OnlinePayment::HTTPS);
14 $me = 'Business::OnlinePayment::Jety';
41 first_name => 'firstname',
42 last_name => 'lastname',
43 address => 'address1',
44 bank_name => 'bankname',
45 account_number => 'accountdda',
46 routing_code => 'accountaba',
52 $self->server('api.cardservicesportal.com');
54 $self->path('/servlet/drafts.echeck');
60 my $content = $self->{_content};
62 $self->remap_fields(%map);
64 die "Jety API only supports ECHECK payments.\n"
65 if(lc($content->{type}) ne 'echeck');
66 die "Jety interface only supports Normal Authorization.\n"
67 if(lc($content->{action}) ne 'normal authorization');
69 $content->{'function'} = 'ach';
70 $content->{'programdesc'} = '415-462-1624 Business::OnlinePayment::Jety';
71 $content->{'ref'} = time2str('%Y%m%d',time).'-'.int(rand(1000000));
77 $Business::OnlinePayment::HTTPS::DEBUG = $DEBUG;
80 $self->required_fields(qw(
96 tie my %request, 'Tie::IxHash', (
97 map { $_, $self->{_content}->{$_} } @fields
100 $DB::single = $DEBUG;
101 if($self->test_transaction()) {
102 print "https://".$self->server.$self->path."\n";
103 print "$_\t".$request{$_}."\n" foreach keys(%request);
104 $self->error_message('test mode not supported');
105 $self->is_success(0);
108 my ($reply, $response, %reply_headers) = $self->https_post(\%request);
110 if(not $response =~ /^200/) {
111 croak "HTTPS error: '$response'";
114 # string looks like this:
115 # P1=1234&P2=General Status&P3=Specific Status
116 # P3 is not always there, though.
117 if($reply =~ /^P1=(\d+)&P2=([\w ]*)(&P3=(\S+))?/) {
119 $self->is_success(1);
120 $self->authorization($4);
123 $self->is_success(0);
124 $self->error_message($2.($4 ? "($4)" : ''));
128 croak "Malformed server response: '$reply'";
139 Business::OnlinePayment::Jety - Jety Payments ACH backend for Business::OnlinePayment
143 use Business::OnlinePayment;
146 # Electronic check authorization. We only support
147 # 'Normal Authorization'.
150 my $tx = new Business::OnlinePayment("Jety");
153 login => 'testdrive',
154 password => 'testpass',
155 action => 'Normal Authorization',
156 description => 'Business::OnlinePayment test',
158 invoice_number => '100100',
159 first_name => 'Jason',
160 last_name => 'Kohles',
161 address => '123 Anystreet',
165 account_type => 'personal checking',
166 account_number => '1000468551234',
167 routing_code => '707010024',
168 check_number => '1001', # optional
172 if($tx->is_success()) {
173 print "Check processed successfully: ".$tx->authorization."\n";
175 print "Check was rejected: ".$tx->error_message."\n";
178 =head1 SUPPORTED TRANSACTION TYPES
182 Content required: type, login, password, action, amount, first_name, last_name, account_number, routing_code.
186 For detailed information see L<Business::OnlinePayment>.
188 =head1 METHODS AND FUNCTIONS
190 See L<Business::OnlinePayment> for the complete list. The following methods either override the methods in L<Business::OnlinePayment> or provide additional functions.
194 Returns the four-digit result code.
198 Returns a useful error message.
200 =head1 Handling of content(%content) data:
204 The following actions are valid:
210 Mark Wells <mark@freeside.biz>
214 perl(1). L<Business::OnlinePayment>.