public capture ( |
||
$capture | ||
$apiContext | is the APIContext for this call. It can be used to pass dynamic configuration and credentials. | |
$restCall | PayPalRestCall | is the Rest Call Service that is used to make rest calls |
Результат |
public function capture($capture, $apiContext = null, $restCall = null)
{
ArgumentValidator::validate($this->getId(), "Id");
ArgumentValidator::validate($capture, 'capture');
$payLoad = $capture->toJSON();
$json = self::executeCall("/v1/payments/orders/{$this->getId()}/capture", "POST", $payLoad, null, $apiContext, $restCall);
$ret = new Capture();
$ret->fromJson($json);
return $ret;
}
/** * @dataProvider mockProvider * @param Order $obj */ public function testCapture($obj, $mockApiContext) { $mockPPRestCall = $this->getMockBuilder('\\PayPal\\Transport\\PayPalRestCall')->disableOriginalConstructor()->getMock(); $mockPPRestCall->expects($this->any())->method('execute')->will($this->returnValue(CaptureTest::getJson())); $capture = CaptureTest::getObject(); $result = $obj->capture($capture, $mockApiContext, $mockPPRestCall); $this->assertNotNull($result); }