forked from LiveCarta/PayPal-PHP-SDK
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:
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user