public static qrCode ( string $invoiceId, array $params = [], |
||
$invoiceId | string | |
$params | array | |
$apiContext | is the APIContext for this call. It can be used to pass dynamic configuration and credentials. | |
$restCall | is the Rest Call Service that is used to make rest calls | |
return | PayPal\Api\Image |
public static function qrCode($invoiceId, $params = array(), $apiContext = null, $restCall = null)
{
ArgumentValidator::validate($invoiceId, 'invoiceId');
ArgumentValidator::validate($params, 'params');
$allowedParams = array('width' => 1, 'height' => 1, 'action' => 1);
$payLoad = "";
$json = self::executeCall("/v1/invoicing/invoices/{$invoiceId}/qr-code?" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", $payLoad, null, $apiContext, $restCall);
$ret = new Image();
$ret->fromJson($json);
return $ret;
}
/** * @dataProvider mockProvider * @param Invoice $obj */ public function testQrCode($obj, $mockApiContext) { $mockPayPalRestCall = $this->getMockBuilder('\\PayPal\\Transport\\PayPalRestCall')->disableOriginalConstructor()->getMock(); $mockPayPalRestCall->expects($this->any())->method('execute')->will($this->returnValue(ImageTest::getJson())); $result = $obj->qrCode("invoiceId", array(), $mockApiContext, $mockPayPalRestCall); $this->assertNotNull($result); }