2014-03-23 02:31:50 +00:00
|
|
|
|
2009-12-02 16:44:18 +00:00
|
|
|
=pod
|
|
|
|
|
|
|
|
The tester must supply their own PayPal sandbox seller authentication
|
|
|
|
(either using certificates or 3-token auth), as well as the buyer
|
|
|
|
sandbox account (email address).
|
|
|
|
|
|
|
|
Should we set env variables, prompt for them, or have them in a conf
|
|
|
|
file? Prompt for them, but we should allow for an input file as an env
|
|
|
|
variable:
|
|
|
|
|
|
|
|
WPP_TEST=auth.txt make test
|
|
|
|
|
|
|
|
=cut
|
|
|
|
|
|
|
|
sub do_args {
|
2014-03-23 02:31:50 +00:00
|
|
|
unless ( $ENV{WPP_TEST} && -f $ENV{WPP_TEST} ) {
|
|
|
|
die
|
|
|
|
"See the TESTING section in `perldoc Business::PayPal::API documentation`\n";
|
2009-12-02 16:44:18 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
my %args = ();
|
|
|
|
open FILE, "<", $ENV{WPP_TEST}
|
2014-03-23 02:31:50 +00:00
|
|
|
or die "Could not open $ENV{WPP_TEST}: $!\n";
|
2009-12-02 16:44:18 +00:00
|
|
|
|
|
|
|
my @variables = qw( Username Password Signature Subject timeout
|
2014-03-23 02:31:50 +00:00
|
|
|
CertFile KeyFile PKCS12File PKCS12Password
|
2015-01-01 21:36:58 +00:00
|
|
|
BuyerEmail SellerEmail
|
2014-03-23 02:31:50 +00:00
|
|
|
);
|
2009-12-02 16:44:18 +00:00
|
|
|
|
|
|
|
my %patterns = ();
|
2014-03-23 02:31:50 +00:00
|
|
|
@patterns{ map {qr/^$_\b/i} @variables } = @variables;
|
2009-12-02 16:44:18 +00:00
|
|
|
|
2014-03-23 02:31:50 +00:00
|
|
|
while ( <FILE> ) {
|
2009-12-02 16:44:18 +00:00
|
|
|
chomp;
|
|
|
|
|
2014-03-23 02:31:50 +00:00
|
|
|
MATCH: for my $pat ( keys %patterns ) {
|
|
|
|
next unless $_ =~ $pat;
|
|
|
|
( my $value = $_ ) =~ s/$pat\s*=\s*(.+)/$1/;
|
|
|
|
$args{ $patterns{$pat} } = $value;
|
|
|
|
delete $patterns{$pat};
|
|
|
|
last MATCH;
|
|
|
|
}
|
2009-12-02 16:44:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
close FILE;
|
|
|
|
|
|
|
|
## leave this!
|
|
|
|
$args{sandbox} = 1;
|
|
|
|
|
|
|
|
return %args;
|
|
|
|
}
|
|
|
|
|
|
|
|
1;
|