/** * @test */ public function shouldFilterNotSupportedOnPrepareFields() { $api = new Api(array('skinCode' => 'skin', 'merchantAccount' => 'account', 'hmacKey' => '4468', 'sandbox' => true), $this->createHttpClientMock()); $post = $api->prepareFields(['FOO' => 'fooVal', 'BAR' => 'barVal']); $this->assertInternalType('array', $post); $this->assertArrayNotHasKey('FOO', $post); $this->assertArrayNotHasKey('BAR', $post); }
/** * {@inheritDoc} * * @param Capture $request */ public function execute($request) { RequestNotSupportedException::assertSupports($this, $request); /** * @var TokenInterface */ $token = $request->getToken(); $model = ArrayObject::ensureArrayObject($request->getModel()); $this->gateway->execute($httpRequest = new GetHttpRequest()); // Check httpRequest $extraData = $model['extraData'] ? json_decode($model['extraData'], true) : []; if (false == isset($extraData['capture_token']) && $token) { $extraData['capture_token'] = $token->getHash(); } if (false == isset($extraData['notify_token']) && $token && $this->tokenFactory) { $notifyToken = $this->tokenFactory->createNotifyToken($token->getGatewayName(), $token->getDetails()); $extraData['notify_token'] = $notifyToken->getHash(); $model['resURL'] = $notifyToken->getTargetUrl(); } $model['extraData'] = json_encode($extraData); throw new HttpPostRedirect($this->api->getApiEndpoint(), $this->api->prepareFields($model->toUnsafeArray())); }