PayPal\Api\CreditCard::delete PHP Method

delete() public method

Delete the Credit Card resource for the given identifier.
public delete ( ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : boolean
$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 boolean
    public function delete($apiContext = null, $restCall = null)
    {
        ArgumentValidator::validate($this->getId(), "Id");
        $payLoad = "";
        self::executeCall("/v1/vault/credit-cards/{$this->getId()}", "DELETE", $payLoad, null, $apiContext, $restCall);
        return true;
    }

Usage Example

 /**
  * @dataProvider mockProvider
  * @param CreditCard $obj
  */
 public function testDelete($obj, $mockApiContext)
 {
     $mockPPRestCall = $this->getMockBuilder('\\PayPal\\Transport\\PayPalRestCall')->disableOriginalConstructor()->getMock();
     $mockPPRestCall->expects($this->any())->method('execute')->will($this->returnValue(true));
     $result = $obj->delete($mockApiContext, $mockPPRestCall);
     $this->assertNotNull($result);
 }