PayPal\Api\PayoutItem::cancel PHP Method

cancel() public static method

Cancels the unclaimed payment using the items id passed in the request URI. If an unclaimed item is not claimed within 30 days, the funds will be automatically returned to the sender. This call can be used to cancel the unclaimed item prior to the automatic 30-day return.
public static cancel ( string $payoutItemId, ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : PayoutItemDetails
$payoutItemId string
$apiContext PayPal\Rest\ApiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
$restCall PayPal\Transport\PayPalRestCall is the Rest Call Service that is used to make rest calls
return PayoutItemDetails
    public static function cancel($payoutItemId, $apiContext = null, $restCall = null)
    {
        ArgumentValidator::validate($payoutItemId, 'payoutItemId');
        $payLoad = "";
        $json = self::executeCall("/v1/payments/payouts-item/{$payoutItemId}/cancel", "POST", $payLoad, null, $apiContext, $restCall);
        $ret = new PayoutItemDetails();
        $ret->fromJson($json);
        return $ret;
    }

Usage Example

Esempio n. 1
0
 /**
  * @dataProvider mockProvider
  * @param PayoutItem $obj
  */
 public function testCancel($obj, $mockApiContext)
 {
     $mockPPRestCall = $this->getMockBuilder('\\PayPal\\Transport\\PayPalRestCall')->disableOriginalConstructor()->getMock();
     $mockPPRestCall->expects($this->any())->method('execute')->will($this->returnValue(PayoutItemDetailsTest::getJson()));
     $result = $obj->cancel("payoutItemId", $mockApiContext, $mockPPRestCall);
     $this->assertNotNull($result);
 }
All Usage Examples Of PayPal\Api\PayoutItem::cancel