diff --git a/lib/PayPal/Api/AgreementTransaction.php b/lib/PayPal/Api/AgreementTransaction.php index 6f97f3b..12cad0e 100644 --- a/lib/PayPal/Api/AgreementTransaction.php +++ b/lib/PayPal/Api/AgreementTransaction.php @@ -19,7 +19,7 @@ use PayPal\Common\PayPalModel; * @property \PayPal\Api\Currency net_amount * @property string payer_email * @property string payer_name - * @property string time_updated + * @property string time_stamp * @property string time_zone */ class AgreementTransaction extends PayPalModel @@ -211,13 +211,13 @@ class AgreementTransaction extends PayPalModel /** * Time at which this transaction happened. * - * @param string $time_updated + * @param string $time_stamp * * @return $this */ - public function setTimeUpdated($time_updated) + public function setTimeStamp($time_stamp) { - $this->time_updated = $time_updated; + $this->time_stamp = $time_stamp; return $this; } @@ -226,9 +226,9 @@ class AgreementTransaction extends PayPalModel * * @return string */ - public function getTimeUpdated() + public function getTimeStamp() { - return $this->time_updated; + return $this->time_stamp; } /** diff --git a/sample/billing/SearchBillingTransactions.php b/sample/billing/SearchBillingTransactions.php index 35fe660..85c7d19 100644 --- a/sample/billing/SearchBillingTransactions.php +++ b/sample/billing/SearchBillingTransactions.php @@ -6,19 +6,25 @@ // https://developer.paypal.com/webapps/developer/docs/api/#search-for-transactions // API used: GET /v1/payments/billing-agreements//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; diff --git a/sample/doc/assets/behavior.js b/sample/doc/assets/behavior.js index 8f79a71..eff03d5 100644 --- a/sample/doc/assets/behavior.js +++ b/sample/doc/assets/behavior.js @@ -1199,7 +1199,72 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 "pageTitle": "payouts/CreateBatchPayout", "title": "CreateBatchPayout" }, - "depth": 2 + "depth": 2, + "outline": [ + { + "type": "heading", + "data": { + "level": 1, + "title": "Create Bulk Payout Sample", + "slug": "create-bulk-payout-sample" + }, + "depth": 1, + "children": [ + { + "type": "heading", + "data": { + "level": 3, + "title": "NOTE:", + "slug": "note" + }, + "depth": 3, + "children": [ + { + "type": "heading", + "data": { + "level": 4, + "title": "Batch Header Instance", + "slug": "batch-header-instance" + }, + "depth": 4 + }, { + "type": "heading", + "data": { + "level": 4, + "title": "Sender Item", + "slug": "sender-item" + }, + "depth": 4 + }, { + "type": "heading", + "data": { + "level": 4, + "title": "Sender Item 2", + "slug": "sender-item-2" + }, + "depth": 4 + }, { + "type": "heading", + "data": { + "level": 4, + "title": "Sender Item 3", + "slug": "sender-item-3" + }, + "depth": 4 + } + ] + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Create Payout", + "slug": "create-payout" + }, + "depth": 3 + } + ] + } + ] }, { "type": "file", "data": { @@ -1217,7 +1282,56 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 "pageTitle": "payouts/CreateSinglePayout", "title": "CreateSinglePayout" }, - "depth": 2 + "depth": 2, + "outline": [ + { + "type": "heading", + "data": { + "level": 1, + "title": "Create Single Synchronous Payout Sample", + "slug": "create-single-synchronous-payout-sample" + }, + "depth": 1, + "children": [ + { + "type": "heading", + "data": { + "level": 3, + "title": "NOTE:", + "slug": "note" + }, + "depth": 3, + "children": [ + { + "type": "heading", + "data": { + "level": 4, + "title": "Batch Header Instance", + "slug": "batch-header-instance" + }, + "depth": 4 + }, { + "type": "heading", + "data": { + "level": 4, + "title": "Sender Item", + "slug": "sender-item" + }, + "depth": 4 + } + ] + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Create Payout", + "slug": "create-payout" + }, + "depth": 3 + } + ] + } + ] }, { "type": "file", "data": { diff --git a/sample/doc/billing/SearchBillingTransactions.html b/sample/doc/billing/SearchBillingTransactions.html index 8d362a0..cd22372 100644 --- a/sample/doc/billing/SearchBillingTransactions.html +++ b/sample/doc/billing/SearchBillingTransactions.html @@ -1,18 +1,18 @@ billing/SearchBillingTransactions
billing/SearchBillingTransactions.php
<?php

Search Billing Transactions Sample

This sample code demonstrate how you can search all billing transactions, as documented here at: https://developer.paypal.com/webapps/developer/docs/api/#search-for-transactions -API used: GET /v1/payments/billing-agreements//transactions? start-date=yyyy-mm-dd&end-date=yyyy-mm-dd

Retrieving the Agreement object from Create Agreement From Credit Card Sample

/** @var Agreement $agreement */ -$agreement = require 'GetBillingAgreement.php'; -$agreementId = $agreement->getId(); -use PayPal\Api\Agreement; +API used: GET /v1/payments/billing-agreements//transactions? start-date=yyyy-mm-dd&end-date=yyyy-mm-dd

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;
\ No newline at end of file diff --git a/tests/PayPal/Test/Api/AgreementTransactionTest.php b/tests/PayPal/Test/Api/AgreementTransactionTest.php index ca2a741..64eeba7 100644 --- a/tests/PayPal/Test/Api/AgreementTransactionTest.php +++ b/tests/PayPal/Test/Api/AgreementTransactionTest.php @@ -18,7 +18,7 @@ class AgreementTransactionTest extends \PHPUnit_Framework_TestCase */ public static function getJson() { - return '{"transaction_id":"TestSample","status":"TestSample","transaction_type":"TestSample","amount":' .CurrencyTest::getJson() . ',"fee_amount":' .CurrencyTest::getJson() . ',"net_amount":' .CurrencyTest::getJson() . ',"payer_email":"TestSample","payer_name":"TestSample","time_updated":"TestSample","time_zone":"TestSample"}'; + return '{"transaction_id":"TestSample","status":"TestSample","transaction_type":"TestSample","amount":' .CurrencyTest::getJson() . ',"fee_amount":' .CurrencyTest::getJson() . ',"net_amount":' .CurrencyTest::getJson() . ',"payer_email":"TestSample","payer_name":"TestSample","time_stamp":"TestSample","time_zone":"TestSample"}'; } /** @@ -47,7 +47,7 @@ class AgreementTransactionTest extends \PHPUnit_Framework_TestCase $this->assertNotNull($obj->getNetAmount()); $this->assertNotNull($obj->getPayerEmail()); $this->assertNotNull($obj->getPayerName()); - $this->assertNotNull($obj->getTimeUpdated()); + $this->assertNotNull($obj->getTimeStamp()); $this->assertNotNull($obj->getTimeZone()); $this->assertEquals(self::getJson(), $obj->toJson()); return $obj; @@ -67,7 +67,7 @@ class AgreementTransactionTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getNetAmount(), CurrencyTest::getObject()); $this->assertEquals($obj->getPayerEmail(), "TestSample"); $this->assertEquals($obj->getPayerName(), "TestSample"); - $this->assertEquals($obj->getTimeUpdated(), "TestSample"); + $this->assertEquals($obj->getTimeStamp(), "TestSample"); $this->assertEquals($obj->getTimeZone(), "TestSample"); } diff --git a/tests/PayPal/Test/Functional/Api/BillingAgreementsFunctionalTest.php b/tests/PayPal/Test/Functional/Api/BillingAgreementsFunctionalTest.php index 0031649..ba14b63 100644 --- a/tests/PayPal/Test/Functional/Api/BillingAgreementsFunctionalTest.php +++ b/tests/PayPal/Test/Functional/Api/BillingAgreementsFunctionalTest.php @@ -175,7 +175,8 @@ class BillingAgreementsFunctionalTest extends \PHPUnit_Framework_TestCase */ public function testGetTransactions($agreement) { - $result = Agreement::searchTransactions($agreement->getId(),array('start_date' => '2013-01-01', 'end_date' => '2015-01-20'), null, $this->mockPayPalRestCall); + $params = array('start_date' => date('Y-m-d', strtotime('-15 years')), 'end_date' => date('Y-m-d', strtotime('+5 days'))); + $result = Agreement::searchTransactions($agreement->getId(), $params, null, $this->mockPayPalRestCall); $this->assertNotNull($result); $this->assertTrue(is_array($result->getAgreementTransactionList())); $this->assertTrue(sizeof($result->getAgreementTransactionList()) > 0);