translations = $this->module->getTranslationsArray(); parent::initContent(); $this->removeSavedInstrument(); } private function removeSavedInstrument() { $response = [ 'success' => false ]; if ($this->isTokenValid()) { try { $savedInstrumentToken = Tools::getValue('savedInstrumentToken'); (new PaynowSavedInstrumentHelper($this->context, $this->module))->remove($savedInstrumentToken); $response = [ 'success' => true, ]; } catch (Exception $e) { $response['error'] = $this->translations['An error occurred while deleting the saved card.']; PaynowLogger::error( 'An error occurred during saved instrument removal {code={}, message={}}', [ $e->getCode(), $e->getMessage() ] ); } } $this->ajaxRender(json_encode($response)); exit; } }