This file is indexed.

/usr/share/perl5/Business/OnlinePayment/HTTPS.pm is in libbusiness-onlinepayment-perl 3.05-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
package Business::OnlinePayment::HTTPS;

use strict;
use base qw(Business::OnlinePayment);
use vars qw($VERSION $DEBUG);
use Tie::IxHash;
use Net::HTTPS::Any 0.10;

$VERSION = '0.10';
$DEBUG   = 0;

=head1 NAME

Business::OnlinePayment::HTTPS - Base class for HTTPS payment APIs

=head1 SYNOPSIS

  package Business::OnlinePayment::MyProcessor;
  use base qw(Business::OnlinePayment::HTTPS);
  
  sub submit {
      my $self = shift;
  
      #...
  
      # pass a list (order is preserved, if your gateway needs that)
      ( $page, $response, %reply_headers )
          = $self->https_get( field => 'value', ... );
  
      # or a hashref
      my %hash = ( field => 'value', ... );
      ( $page, $response_code, %reply_headers )
            = $self->https_get( \%hash );
  
      #...
  }

=head1 DESCRIPTION

This is a base class for HTTPS based gateways, providing useful code
for implementors of HTTPS payment APIs.

It depends on Net::HTTPS::Any, which in turn depends on
Net::SSLeay _or_ ( Crypt::SSLeay and LWP::UserAgent ).

=head1 METHODS

=over 4

=item https_get [ \%options ] HASHREF | FIELD => VALUE, ...

Accepts parameters as either a hashref or a list of fields and values.
In the latter case, ordering is preserved (see L<Tie::IxHash> to do so
when passing a hashref).

Returns a list consisting of the page content as a string, the HTTP
response code and message (i.e. "200 OK" or "404 Not Found"), and a list of
key/value pairs representing the HTTP response headers.

The options hashref supports setting headers:

  {
      headers => { 'X-Header1' => 'value', ... },
  }

=cut

#      Content-Type => 'text/namevalue',

sub https_get {
    my $self = shift;

    # handle optional options hashref
    my $opts = {};
    if ( scalar(@_) > 1 and ref( $_[0] ) eq "HASH" ) {
      $opts = shift;
    }

    # accept a hashref or a list (keep it ordered)
    my $post_data;
    if ( ref( $_[0] ) eq 'HASH' ) {
      $post_data = shift;
    } elsif ( scalar(@_) > 1 ) {
      tie my %hash, 'Tie::IxHash', @_;
      $post_data = \%hash;
    } elsif ( scalar(@_) == 1 ) {
      $post_data = shift;
    } else {
      die "https_get called with no params\n";
    }

    $self->build_subs(qw( response_page response_code response_headers ));

    my( $res_page, $res_code, @res_headers) = Net::HTTPS::Any::https_get( 
      'host'    => $self->server,
      'path'    => $self->path,
      'headers' => $opts->{headers},
      'args'    => $post_data,
      'debug'   => $DEBUG,
    );

    $self->response_page( $res_page );
    $self->response_code( $res_code );
    $self->response_headers( { @res_headers } );

    ( $res_page, $res_code, @res_headers );

}

=item https_post [ \%options ] SCALAR | HASHREF | FIELD => VALUE, ...

Accepts form fields and values as either a hashref or a list.  In the
latter case, ordering is preserved (see L<Tie::IxHash> to do so when
passing a hashref).

Also accepts instead a simple scalar containing the raw content.

Returns a list consisting of the page content as a string, the HTTP
response code and message (i.e. "200 OK" or "404 Not Found"), and a list of
key/value pairs representing the HTTP response headers.

The options hashref supports setting headers and Content-Type:

  {
      headers => { 'X-Header1' => 'value', ... },
      Content-Type => 'text/namevalue',
  }

=cut

sub https_post {
    my $self = shift;

    # handle optional options hashref
    my $opts = {};
    if ( scalar(@_) > 1 and ref( $_[0] ) eq "HASH" ) {
        $opts = shift;
    }

    my %post = (
      'host'         => $self->server,
      'path'         => $self->path,
      'headers'      => $opts->{headers},
      'Content-Type' => $opts->{'Content-Type'},
      'debug'        => $DEBUG,
    );

    # accept a hashref or a list (keep it ordered)
    my $post_data = '';
    my $content = undef;
    if ( ref( $_[0] ) eq 'HASH' ) {
      $post{'args'} = shift;
    } elsif ( scalar(@_) > 1 ) {
      tie my %hash, 'Tie::IxHash', @_;
      $post{'args'} = \%hash;
    } elsif ( scalar(@_) == 1 ) {
      $post{'content'} = shift;
    } else {
      die "https_post called with no params\n";
    }

    $self->build_subs(qw( response_page response_code response_headers ));

    my( $res_page, $res_code, @res_headers)= Net::HTTPS::Any::https_post(%post);

    $self->response_page( $res_page );
    $self->response_code( $res_code );
    $self->response_headers( { @res_headers } );

    ( $res_page, $res_code, @res_headers );

}

=back

=head1 SEE ALSO

L<Business::OnlinePayment>, L<Net::HTTPS::Any>

=cut

1;