Fixes to Payout API Support Functional Tests

This commit is contained in:
japatel
2015-01-05 13:31:22 -06:00
parent 6f13399e47
commit c51c78a722
3 changed files with 67 additions and 67 deletions

View File

@@ -18,7 +18,7 @@ class PayoutItemDetailsTest extends \PHPUnit_Framework_TestCase
*/ */
public static function getJson() public static function getJson()
{ {
return '{"payout_item_id":"TestSample","transaction_id":"TestSample","transaction_status":"TestSample","payout_item_fee":' .CurrencyTest::getJson() . ',"payout_batch_id":"TestSample","sender_batch_id":"TestSample","payout_item":' .PayoutItemTest::getJson() . ',"time_processed":"TestSample","error":' .ErrorTest::getJson() . ',"links":' .LinksTest::getJson() . '}'; return '{"payout_item_id":"TestSample","transaction_id":"TestSample","transaction_status":"TestSample","payout_item_fee":' .CurrencyTest::getJson() . ',"payout_batch_id":"TestSample","sender_batch_id":"TestSample","payout_item":' .PayoutItemTest::getJson() . ',"time_processed":"TestSample","errors":' .ErrorTest::getJson() . ',"links":' .LinksTest::getJson() . '}';
} }
/** /**
@@ -47,7 +47,7 @@ class PayoutItemDetailsTest extends \PHPUnit_Framework_TestCase
$this->assertNotNull($obj->getSenderBatchId()); $this->assertNotNull($obj->getSenderBatchId());
$this->assertNotNull($obj->getPayoutItem()); $this->assertNotNull($obj->getPayoutItem());
$this->assertNotNull($obj->getTimeProcessed()); $this->assertNotNull($obj->getTimeProcessed());
$this->assertNotNull($obj->getError()); $this->assertNotNull($obj->getErrors());
$this->assertNotNull($obj->getLinks()); $this->assertNotNull($obj->getLinks());
$this->assertEquals(self::getJson(), $obj->toJson()); $this->assertEquals(self::getJson(), $obj->toJson());
return $obj; return $obj;
@@ -67,7 +67,7 @@ class PayoutItemDetailsTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($obj->getSenderBatchId(), "TestSample"); $this->assertEquals($obj->getSenderBatchId(), "TestSample");
$this->assertEquals($obj->getPayoutItem(), PayoutItemTest::getObject()); $this->assertEquals($obj->getPayoutItem(), PayoutItemTest::getObject());
$this->assertEquals($obj->getTimeProcessed(), "TestSample"); $this->assertEquals($obj->getTimeProcessed(), "TestSample");
$this->assertEquals($obj->getError(), ErrorTest::getObject()); $this->assertEquals($obj->getErrors(), ErrorTest::getObject());
$this->assertEquals($obj->getLinks(), LinksTest::getObject()); $this->assertEquals($obj->getLinks(), LinksTest::getObject());
} }

View File

@@ -89,7 +89,8 @@ class PayoutsFunctionalTest extends \PHPUnit_Framework_TestCase
*/ */
public function testGetItem($payoutBatch) public function testGetItem($payoutBatch)
{ {
$item = $payoutBatch->getItems()[0]; $items = $payoutBatch->getItems();
$item = $items[0];
$result = PayoutItem::get($item->getPayoutItemId(), null, $this->mockPayPalRestCall); $result = PayoutItem::get($item->getPayoutItemId(), null, $this->mockPayPalRestCall);
$this->assertNotNull($result); $this->assertNotNull($result);
$this->assertEquals($item->getPayoutItemId(), $result->getPayoutItemId()); $this->assertEquals($item->getPayoutItemId(), $result->getPayoutItemId());

View File

@@ -29,38 +29,37 @@
"Content-Encoding": "gzip" "Content-Encoding": "gzip"
}, },
"body": { "body": {
"items":[ "payout_item_id": "VHBFGN95AWV82",
{ "transaction_status": "PENDING",
"payout_item_id":"1421342", "payout_item_fee": {
"transaction_id":"4345", "currency": "USD",
"transaction_status":"SUCCESS", "value": "0.02"
"payout_item_fee":{"currency":"USD","value":"0.35"}, },
"payout_batch_id":"20140724", "payout_batch_id": "CDZEC5MJ8R5HY",
"sender_batch_id":"2014021801", "transaction_id": "0728664497487461D",
"payout_item":{ "sender_batch_id": "2014021887",
"recipient_type":"EMAIL", "payout_item": {
"amount":{ "value":"9.87", "currency":"USD"}, "amount": {
"note":"Thanks for your patronage!", "currency": "USD",
"receiver":"anybody01@gmail.com", "value": "0.99"
"payouts_item_id":"1421342", },
"sender_item_id":"14Feb_234" "note": "Thanks you.",
"receiver": "shirt-supplier-one@gmail.com",
"recipient_type": "EMAIL",
"sender_item_id": "item_154a716f035001"
}, },
"time_created":"2014-01-27T10:17:00Z",
"time_processed":"2014-01-27T10:17:41Z",
"links": [ "links": [
{ {
"href": "https://api.sandbox.paypal.com/v1/payments/payouts-item/HUUQ5YASYLQFN",
"rel": "self", "rel": "self",
"href": "payouts-batch/{payout_batch_id}",
"method": "GET" "method": "GET"
}, },
{ {
"rel": "self", "href": "https://api.sandbox.paypal.com/v1/payments/payouts/LNLSEVGU4P85S",
"href": "payouts-item/{payout_item_id}", "rel": "batch",
"method": "GET" "method": "GET"
} }
] ]
} }
]
}
} }
} }