Enabled Payout Cancel API for Unclaimed Payout Item

- PayoutItem supports [Cancel and Unclaimed Payout Item](https://developer.paypal.com/docs/api/#cancel-an-unclaimed-payout-item)
- Updated Unit and Functional Tests Accordingly
- Updated Samples accordingly
This commit is contained in:
japatel
2015-01-23 13:50:51 -06:00
parent d9a5baf202
commit d84ddf85c9
11 changed files with 274 additions and 132 deletions

View File

@@ -65,6 +65,11 @@ class PayoutsFunctionalTest extends \PHPUnit_Framework_TestCase
$result = $obj->create($params, null, $this->mockPayPalRestCall);
$this->assertNotNull($result);
$this->assertEquals(PayoutsFunctionalTest::$batchId, $result->getBatchHeader()->getSenderBatchHeader()->getSenderBatchId());
$this->assertEquals('SUCCESS', $result->getBatchHeader()->getBatchStatus());
$items = $result->getItems();
$this->assertTrue(sizeof($items) > 0);
$item = $items[0];
$this->assertEquals('UNCLAIMED', $item->getTransactionStatus());
return $result;
}
@@ -99,4 +104,26 @@ class PayoutsFunctionalTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($item->getPayoutItemFee(), $result->getPayoutItemFee());
}
/**
* @depends testCreate
* @param $payoutBatch PayoutBatch
* @return PayoutBatch
*/
public function testCancel($payoutBatch)
{
$items = $payoutBatch->getItems();
$item = $items[0];
if ($item->getTransactionStatus() != 'UNCLAIMED') {
$this->markTestSkipped('Transaction status needs to be Unclaimed for this test ');
return;
}
$result = PayoutItem::cancel($item->getPayoutItemId(), null, $this->mockPayPalRestCall);
$this->assertNotNull($result);
$this->assertEquals($item->getPayoutItemId(), $result->getPayoutItemId());
$this->assertEquals($item->getPayoutBatchId(), $result->getPayoutBatchId());
$this->assertEquals($item->getTransactionId(), $result->getTransactionId());
$this->assertEquals($item->getPayoutItemFee(), $result->getPayoutItemFee());
$this->assertEquals('RETURNED', $result->getTransactionStatus());
}
}