Fixes to Agreement Search Transaction TimeStamp Parameter

- Updated TimeUpdate parameter to TimeStamp
- Updated Tests accordingly.
- Updated Samples accordingly
- Fixes #221
This commit is contained in:
japatel
2015-01-23 12:30:23 -06:00
parent 4326394447
commit d9a5baf202
6 changed files with 142 additions and 21 deletions

View File

@@ -6,19 +6,25 @@
// https://developer.paypal.com/webapps/developer/docs/api/#search-for-transactions
// API used: GET /v1/payments/billing-agreements/<Agreement-Id>/transactions? start-date=yyyy-mm-dd&end-date=yyyy-mm-dd
// Retrieving the Agreement object from Create Agreement From Credit Card Sample
// Retrieving the Agreement object from Get Billing Agreement. This may not be necessary if you are trying to search for transactions of already created Agreement.
/** @var Agreement $agreement */
$agreement = require 'GetBillingAgreement.php';
// Replace this with your AgreementId to search transactions based on your agreement.
$agreementId = $agreement->getId();
use PayPal\Api\Agreement;
// Adding Params to search transaction within a given time frame.
$params = array('start_date' => date('Y-m-d', strtotime('-15 years')), 'end_date' => date('Y-m-d', strtotime('+5 days')));
try {
$result = Agreement::searchTransactions($agreementId,array('start_date' => '2013-01-01', 'end_date' => '2015-01-20'), $apiContext);
$result = Agreement::searchTransactions($agreementId, $params, $apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Search for Transactions", "AgreementTransaction", $agreementId, null, $ex);
exit(1);
}
ResultPrinter::printResult("Search for Transactions", "AgreementTransaction", $agreementId, null, $result);
ResultPrinter::printResult("Search for Transactions", "AgreementTransaction", $agreementId, $params, $result);
return $agreement;