2009-12-02 16:44:18 +00:00
|
|
|
use Test::More;
|
2014-03-23 02:31:50 +00:00
|
|
|
if ( !$ENV{WPP_TEST} || !-f $ENV{WPP_TEST} ) {
|
|
|
|
plan skip_all =>
|
|
|
|
'No WPP_TEST env var set. Please see README to run tests';
|
2009-12-02 16:44:18 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
plan tests => 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
use_ok( 'Business::PayPal::API::RefundTransaction' );
|
|
|
|
#########################
|
|
|
|
|
|
|
|
require 't/API.pl';
|
|
|
|
|
|
|
|
my %args = do_args();
|
|
|
|
|
|
|
|
my $pp = new Business::PayPal::API::RefundTransaction( %args );
|
|
|
|
|
|
|
|
print STDERR <<"_TRANSID_";
|
|
|
|
|
|
|
|
Please login to the PayPal Developer's site, and start a sandbox in
|
|
|
|
the Business account you want to test.
|
|
|
|
|
|
|
|
Review the Business accounts transaction history:
|
|
|
|
|
|
|
|
My Account -> History (tab)
|
|
|
|
|
|
|
|
Follow the 'Details' link for a transaction (whose status is
|
|
|
|
'Completed') that occurred in the past 60 days.
|
|
|
|
|
|
|
|
Copy the Transaction ID for that transaction. It may appear like this:
|
|
|
|
|
|
|
|
Express Checkout Payment Received (ID # 2DE2563K55B16978M)
|
|
|
|
|
|
|
|
_TRANSID_
|
|
|
|
|
|
|
|
print STDERR "\nType or paste that Transaction ID here and hit Enter: \n";
|
|
|
|
|
2014-03-23 02:31:50 +00:00
|
|
|
my $transid = <STDIN>;
|
|
|
|
chomp $transid;
|
2009-12-02 16:44:18 +00:00
|
|
|
|
|
|
|
die "Need a transaction id.\n" unless $transid;
|
|
|
|
|
2014-03-23 02:31:50 +00:00
|
|
|
my %resp = $pp->RefundTransaction(
|
|
|
|
TransactionID => $transid,
|
|
|
|
RefundType => 'Full',
|
|
|
|
Memo => 'Fancy refund time.'
|
|
|
|
);
|
2009-12-02 16:44:18 +00:00
|
|
|
|
2014-03-23 02:31:50 +00:00
|
|
|
like( $resp{Ack}, qr/Success/, "Successful refund." );
|
2009-12-02 16:44:18 +00:00
|
|
|
|
2014-03-23 02:31:50 +00:00
|
|
|
if ( $resp{Ack} ) {
|
2009-12-02 16:44:18 +00:00
|
|
|
print STDERR <<"_REFUND_";
|
|
|
|
|
|
|
|
You may now login to your Business sandbox account and verify the
|
|
|
|
transaction was refunded.
|
|
|
|
|
|
|
|
_REFUND_
|
|
|
|
}
|