Business-PayPal-API
view release on metacpan or search on metacpan
lib/Business/PayPal/API.pm view on Meta::CPAN
for my $module (@modules) {
eval("use Business::PayPal::API::$module;");
if ($@) {
warn $@;
next;
}
## import 'exported' subroutines into our namespace
no strict 'refs';
for my $sub (
@{ "Business::PayPal::API::" . $module . "::EXPORT_OK" } ) {
*{ "Business::PayPal::API::" . $sub }
= *{ "Business::PayPal::API::" . $module . "::" . $sub };
}
}
}
sub new {
my $class = shift;
my %args = @_;
my $self = bless \( my $fake ), $class;
## if you add new args, be sure to update the test file's @variables array
$args{Username} ||= '';
$args{Password} ||= '';
$args{Signature} ||= '';
$args{Subject} ||= '';
$args{sandbox} = 1 unless exists $args{sandbox};
$args{timeout} ||= 30;
$H_PKCS12File{$self} = $args{PKCS12File} || '';
$H_PKCS12Password{$self} = $args{PKCS12Password} || '';
$H_CertFile{$self} = $args{CertFile} || '';
$H_KeyFile{$self} = $args{KeyFile} || '';
my $proxy = (
$args{sandbox}
? (
$args{Signature}
? C_api_sandbox_3t
: C_api_sandbox
)
: (
$args{Signature}
? C_api_live_3t
: C_api_live
)
);
$Soap{$self} = SOAP::Lite->proxy(
$proxy,
timeout => $args{timeout},
(
exists $args{proxy_url}
? ( proxy => [ [ 'http', 'https' ] => $args{proxy_url} ] )
: ()
)
)->uri(C_xmlns_pp);
$Header{$self} = SOAP::Header->name(
RequesterCredentials => \SOAP::Header->value(
SOAP::Data->name(
Credentials => \SOAP::Data->value(
SOAP::Data->name( Username => $args{Username} )->type(''),
SOAP::Data->name( Password => $args{Password} )->type(''),
SOAP::Data->name( Signature => $args{Signature} )
->type(''),
SOAP::Data->name( Subject => $args{Subject} )->type(''),
),
)->attr( { xmlns => C_xmlns_ebay } )
)
)->attr( { xmlns => C_xmlns_pp } )->mustUnderstand(1);
return $self;
}
sub DESTROY {
my $self = $_[0];
delete $Soap{$self};
delete $Header{$self};
delete $H_PKCS12File{$self};
delete $H_PKCS12Password{$self};
delete $H_CertFile{$self};
delete $H_KeyFile{$self};
my $super = $self->can("SUPER::DESTROY");
goto &$super if $super;
}
sub version_req {
return SOAP::Data->name( Version => C_version )->type('xs:string')
->attr( { xmlns => C_xmlns_ebay } );
}
sub doCall {
my $self = shift;
my $method_name = shift;
my $request = shift;
my $method
= SOAP::Data->name($method_name)->attr( { xmlns => C_xmlns_pp } );
my $som;
{
$H_PKCS12File{$self}
and local $ENV{HTTPS_PKCS12_FILE} = $H_PKCS12File{$self};
$H_PKCS12Password{$self}
and local $ENV{HTTPS_PKCS12_PASSWORD} = $H_PKCS12Password{$self};
$H_CertFile{$self}
and local $ENV{HTTPS_CERT_FILE} = $H_CertFile{$self};
$H_KeyFile{$self} and local $ENV{HTTPS_KEY_FILE} = $H_KeyFile{$self};
if ($Debug) {
print STDERR SOAP::Serializer->envelope(
method => $method,
$Header{$self}, $request
),
"\n";
}
( run in 3.153 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )