Corrected errors int RecurrintPayments.t and TransactionSearch.t

This commit is contained in:
Danny Hembree 2009-12-06 23:10:55 -08:00
parent 04de06bbf5
commit d92e94b703
2 changed files with 27 additions and 24 deletions

View file

@ -4,7 +4,7 @@ if( ! $ENV{WPP_TEST} || ! -f $ENV{WPP_TEST} ) {
plan skip_all => 'No WPP_TEST env var set. Please see README to run tests'; plan skip_all => 'No WPP_TEST env var set. Please see README to run tests';
} }
else { else {
plan tests => 4; plan tests => 3;
} }
use_ok( 'Business::PayPal::API::RecurringPayments' ); use_ok( 'Business::PayPal::API::RecurringPayments' );
@ -16,16 +16,16 @@ my %args = do_args();
my $pp = new Business::PayPal::API::RecurringPayments(%args); my $pp = new Business::PayPal::API::RecurringPayments(%args);
$Business::PayPal::API::Debug = 1; #$Business::PayPal::API::Debug = 1;
my %response = $pp->SetCustomerBillingAgreement my %response = $pp->SetCustomerBillingAgreement
( (
BillingType => 'RecurringPayments', BillingType => 'RecurringPayments',
BillingAgreementDescription => '10.00 per month for 1 year',
ReturnURL => 'http://www.google.com/', ReturnURL => 'http://www.google.com/',
CancelURL => 'http://www.google.com/', CancelURL => 'http://www.google.com/',
BuyerEmail => $args{BuyerEmail}, BuyerEmail => $args{BuyerEmail},
); );
$Business::PayPal::API::Debug = 0; #$Business::PayPal::API::Debug = 0;
my $token = $response{Token}; my $token = $response{Token};
@ -70,14 +70,14 @@ die "Need a PayerID.\n" unless $payerid;
## CreateRecurringPaymentsProfile ## CreateRecurringPaymentsProfile
$Business::PayPal::API::Debug = 1; #$Business::PayPal::API::Debug = 1;
my %profile = $pp->CreateRecurringPaymentsProfile my %profile = $pp->CreateRecurringPaymentsProfile
( Token => $token, ( Token => $token,
## RecurringPaymentProfileDetails ## RecurringPaymentProfileDetails
SubscriberName => 'Joe Schmoe', SubscriberName => 'Joe Schmoe',
SubscriberShipperName => "Schmoe House", SubscriberShipperName => 'Schmoe House',
SubscriberShipperStreet1 => '1234 Street St.', SubscriberShipperStreet1 => '1234 Street St.',
SubscriberShipperCityName => 'Orem', SubscriberShipperCityName => 'Orem',
SubscriberShipperStateOrProvince => 'UT', SubscriberShipperStateOrProvince => 'UT',
@ -85,39 +85,39 @@ my %profile = $pp->CreateRecurringPaymentsProfile
SubscriberShipperCountry => 'USA', SubscriberShipperCountry => 'USA',
SubscriberShipperPhone => '123-123-1234', SubscriberShipperPhone => '123-123-1234',
BillingStartDate => '12-31-08', BillingStartDate => '2009-12-01Z',
ProfileReference => 'BH12341234', ProfileReference => 'BH12341234',
## ScheduleDetails ## ScheduleDetails
Description => "12 Month Hosting Package: We Love You!", Description => '12 Month Hosting Package: We Love You!',
InitialAmount => '12.34', InitialAmount => '12.34',
TrialBillingPeriod => "Month", TrialBillingPeriod => 'Month',
TrialBillingFrequency => 1, TrialBillingFrequency => 1,
TrialTotalBillingCycles => 1, TrialTotalBillingCycles => 1,
TrialAmount => 0.00, TrialAmount => 0.00,
TrialShippingAmount => 0.00, TrialShippingAmount => 0.00,
TrialTaxAmount => 0.00, TrialTaxAmount => 0.00,
PaymentBillingPeriod => "Year", PaymentBillingPeriod => 'Year',
PaymentBillingFrequency => 1, PaymentBillingFrequency => 1,
PaymentTotalBillingCycles => 1, PaymentTotalBillingCycles => 1,
PaymentAmount => 95.40, PaymentAmount => 95.40,
PaymentShippingAmount => 0.00, PaymentShippingAmount => 0.00,
PaymentTaxAmount => 0.00, PaymentTaxAmount => 0.00,
MaxFailedPayments => 1, # MaxFailedPayments => 1,
AutoBillOutstandingAmount => 'AddToNextBilling', # AutoBillOutstandingAmount => 'AddToNextBilling',
); );
$Business::PayPal::API::Debug = 0; #$Business::PayPal::API::Debug = 0;
## GetBillingAgreementCustomerDetails ## GetBillingAgreementCustomerDetails
#$Business::PayPal::API::Debug = 1; #$Business::PayPal::API::Debug = 1;
my %details = $pp->GetBillingAgreementCustomerDetails($token); my %details = $pp->GetBillingAgreementCustomerDetails($token);
$Business::PayPal::API::Debug = 0; #$Business::PayPal::API::Debug = 0;
like( $details{Ack}, qr/Success/ , "details ok" ); like( $details{Ack}, qr/Success/ , "details ok" );

View file

@ -12,23 +12,25 @@ use_ok( 'Business::PayPal::API::TransactionSearch' );
require 't/API.pl'; require 't/API.pl';
my %args = do_args(); my %args = do_args();
my $resp ='';
my $pp = new Business::PayPal::API::TransactionSearch( %args ); my $pp = new Business::PayPal::API::TransactionSearch( %args );
print STDERR <<"_TRANSID_"; print STDERR <<"_TRANSID_";
Please login to the PayPal Developer's site, and start a sandbox in Please login to the PayPal Developer's site, and start a sandbox in
the Business account you want to test. the Business account you want to test. This function will allow you
to view MassPayment transactions by transaction ID's. It may fail for
other types of transaction ID's. The GetTransactionDetails can be
used in those cases but not for Mass Payment transactions. I know, I'm
just the messenger.
Review the Business accounts transaction history: Review the Business accounts transaction history:
My Account -> History (tab) My Account -> History (tab)
Click the 'Details' link for a transaction whose status is Click the 'Details' link for a Mass Payment transaction whose status is
'Completed'. Copy the Transaction ID for that transaction. The 'Processed'. Go to the bottom of the page and click "View Detail". It will
transaction id may appear like this: give you download choices. Download it however you prefer the copy the
Transaction ID from the message.
Express Checkout Payment Received (ID # 2DE2563K55B16978M)
_TRANSID_ _TRANSID_
@ -38,10 +40,11 @@ my $transid = <STDIN>; chomp $transid;
die "Need a transaction id.\n" unless $transid; die "Need a transaction id.\n" unless $transid;
my $startdate = '1998-01-01T00:00:00Z'; ## before PayPal my $startdate = '1998-01-01T01:45:10.00Z';
#$Business::PayPal::API::Debug = 1; #$Business::PayPal::API::Debug = 1;
my $resp = $pp->TransactionSearch( StartDate => $startdate, my $resp = $pp->TransactionSearch( StartDate => $startdate,
TransactionID => $transid, ); TransactionID => $transid,
);
ok( scalar @$resp , "Matching Transactions Found");
ok( scalar @$resp, "matching transaction(s) found" );