Hello,
Everything was going well with my development, until I found that I cannot use PayPAl PDT, because my webohst won't support Crypt::SSLeay and so I cannot do HTTPS requests with LWP::UserAgent.
They now tell me they have support for SOAP::Lite and have sent me to a url on paypal for info, I was kinda hoping someone would help me with writing the code as the code below looks like a module to me using methods and stuff I don't fully understand yet in PERL so all help is very much appreciated.
Regards,
1DMF
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
Everything was going well with my development, until I found that I cannot use PayPAl PDT, because my webohst won't support Crypt::SSLeay and so I cannot do HTTPS requests with LWP::UserAgent.
They now tell me they have support for SOAP::Lite and have sent me to a url on paypal for info, I was kinda hoping someone would help me with writing the code as the code below looks like a module to me using methods and stuff I don't fully understand yet in PERL so all help is very much appreciated.
Code:
Perl
Perl, the Pathologically Eclectic Rubbish Lister, has been a mainstay of Web programming since the earliest days of Web site automation. Perl's support for regular expressions, database access, and network programming makes it an easy choice for Web programmers.
These Perl examples use SOAP::Lite. They were tested with version 0.60a.[12]
Some things to remember when trying out these examples for yourself:
Change the first line of the Perl script to match the location of the Perl interpreter you want to use.
Turn on debugging by changing the line "use SOAP::Lite;" to "use SOAP::Lite +trace;".
Each of the example files needs to refer to this module: PayPalAPIInterfaceService.pm. This file was auto-generated from the WSDL file; the process is discussed in the SOAP::Lite documentation.
package PayPalAPIInterfaceService;
# -- generated by SOAP::Lite (v0.60) for Perl -- soaplite.com -- Copyright (C) 2000-2001 Paul Kulchenko --
# -- generated from file:PayPalSvc.wsdl [Tue May 25 18:16:17 2004]
my %methods = (
TransactionSearch => {
endpoint => '[URL unfurl="true"]https://api.sandbox.paypal.com/2.0/',[/URL]
soapaction => '',
uri => '',
parameters => [
SOAP::Data->new(name => 'TransactionSearchRequest', type => '', attr => {}),
],
},
GetTransactionDetails => {
endpoint => '[URL unfurl="true"]https://api.sandbox.paypal.com/2.0/',[/URL]
soapaction => '',
uri => '',
parameters => [
SOAP::Data->new(name => 'GetTransactionDetailsRequest', type => '', attr => {}),
],
},
RefundTransaction => {
endpoint => '[URL unfurl="true"]https://api.sandbox.paypal.com/2.0/',[/URL]
soapaction => '',
uri => '',
parameters => [
SOAP::Data->new(name => 'RefundTransactionRequest', type => '', attr => {}),
],
},
BillUser => {
endpoint => '[URL unfurl="true"]https://api.sandbox.paypal.com/2.0/',[/URL]
soapaction => '',
uri => '',
parameters => [
SOAP::Data->new(name => 'BillUserRequest', type => '', attr => {}),
],
},
);
use SOAP::Lite;
use Exporter;
use Carp ();
use vars qw(@ISA $AUTOLOAD @EXPORT_OK %EXPORT_TAGS);
@ISA = qw(Exporter SOAP::Lite);
@EXPORT_OK = (keys %methods);
%EXPORT_TAGS = ('all' => [@EXPORT_OK]);
no strict 'refs';
for my $method (@EXPORT_OK) {
my %method = %{$methods{$method}};
*$method = sub {
my $self = UNIVERSAL::isa($_[0] => __PACKAGE__)
? ref $_[0] ? shift # OBJECT
# CLASS, either get self or create new and assign to self
: (shift->self || __PACKAGE__->self(__PACKAGE__->new))
# function call, either get self or create new and assign to self
: (__PACKAGE__->self || __PACKAGE__->self(__PACKAGE__->new));
$self->proxy($method{endpoint} || Carp::croak "No server address (proxy) specified") unless $self->proxy;
my @templates = @{$method{parameters}};
my $som = $self
-> endpoint($method{endpoint})
-> uri($method{uri})
-> on_action(sub{qq!"$method{soapaction}"!})
-> call($method => map {@templates ? shift(@templates)->value($_) : $_} @_);
UNIVERSAL::isa($som => 'SOAP::SOM') ? wantarray ? $som->paramsall : $som->result
: $som;
}
}
sub AUTOLOAD {
my $method = substr($AUTOLOAD, rindex($AUTOLOAD, '::') + 2);
return if $method eq 'DESTROY';
die "Unrecognized method '$method'. List of available method(s): @EXPORT_OK\n";
}
1;
1DMF
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.