repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
joomla-framework/database
src/DatabaseImporter.php
DatabaseImporter.getAddColumnSQL
protected function getAddColumnSQL($table, \SimpleXMLElement $field) { $sql = 'ALTER TABLE ' . $this->db->quoteName($table) . ' ADD COLUMN ' . $this->getColumnSQL($field); return $sql; }
php
protected function getAddColumnSQL($table, \SimpleXMLElement $field) { $sql = 'ALTER TABLE ' . $this->db->quoteName($table) . ' ADD COLUMN ' . $this->getColumnSQL($field); return $sql; }
[ "protected", "function", "getAddColumnSQL", "(", "$", "table", ",", "\\", "SimpleXMLElement", "$", "field", ")", "{", "$", "sql", "=", "'ALTER TABLE '", ".", "$", "this", "->", "db", "->", "quoteName", "(", "$", "table", ")", ".", "' ADD COLUMN '", ".", ...
Get the SQL syntax to add a column. @param string $table The table name. @param \SimpleXMLElement $field The XML field definition. @return string @since 1.0
[ "Get", "the", "SQL", "syntax", "to", "add", "a", "column", "." ]
90a6b42fec66f735e5e871d1fb2a8202c2a3216f
https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/DatabaseImporter.php#L134-L139
train
joomla-framework/database
src/DatabaseImporter.php
DatabaseImporter.getRealTableName
protected function getRealTableName($table) { $prefix = $this->db->getPrefix(); // Replace the magic prefix if found. $table = preg_replace('|^#__|', $prefix, $table); return $table; }
php
protected function getRealTableName($table) { $prefix = $this->db->getPrefix(); // Replace the magic prefix if found. $table = preg_replace('|^#__|', $prefix, $table); return $table; }
[ "protected", "function", "getRealTableName", "(", "$", "table", ")", "{", "$", "prefix", "=", "$", "this", "->", "db", "->", "getPrefix", "(", ")", ";", "// Replace the magic prefix if found.", "$", "table", "=", "preg_replace", "(", "'|^#__|'", ",", "$", "p...
Get the real name of the table, converting the prefix wildcard string if present. @param string $table The name of the table. @return string The real name of the table. @since 1.0
[ "Get", "the", "real", "name", "of", "the", "table", "converting", "the", "prefix", "wildcard", "string", "if", "present", "." ]
90a6b42fec66f735e5e871d1fb2a8202c2a3216f
https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/DatabaseImporter.php#L221-L229
train
joomla-framework/database
src/Mysqli/MysqliExporter.php
MysqliExporter.buildXml
protected function buildXml() { $buffer = array(); $buffer[] = '<?xml version="1.0"?>'; $buffer[] = '<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'; $buffer[] = ' <database name="">'; $buffer = array_merge($buffer, $this->buildXmlStructure()); $buffer[] = ' </database>'; $buffer[] = '</mysqldump>'; return implode("\n", $buffer); }
php
protected function buildXml() { $buffer = array(); $buffer[] = '<?xml version="1.0"?>'; $buffer[] = '<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'; $buffer[] = ' <database name="">'; $buffer = array_merge($buffer, $this->buildXmlStructure()); $buffer[] = ' </database>'; $buffer[] = '</mysqldump>'; return implode("\n", $buffer); }
[ "protected", "function", "buildXml", "(", ")", "{", "$", "buffer", "=", "array", "(", ")", ";", "$", "buffer", "[", "]", "=", "'<?xml version=\"1.0\"?>'", ";", "$", "buffer", "[", "]", "=", "'<mysqldump xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">'", "...
Builds the XML data for the tables to export. @return string An XML string @since 1.0 @throws \Exception if an error occurs.
[ "Builds", "the", "XML", "data", "for", "the", "tables", "to", "export", "." ]
90a6b42fec66f735e5e871d1fb2a8202c2a3216f
https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Mysqli/MysqliExporter.php#L28-L42
train
joomla-framework/database
src/Postgresql/PostgresqlQuery.php
PostgresqlQuery.forUpdate
public function forUpdate($table_name, $glue = ',') { $this->type = 'forUpdate'; if ($this->forUpdate === null) { $glue = strtoupper($glue); $this->forUpdate = new QueryElement('FOR UPDATE', 'OF ' . $table_name, "$glue "); } else { $this->forUpdate->append($table_name); } return $this; }
php
public function forUpdate($table_name, $glue = ',') { $this->type = 'forUpdate'; if ($this->forUpdate === null) { $glue = strtoupper($glue); $this->forUpdate = new QueryElement('FOR UPDATE', 'OF ' . $table_name, "$glue "); } else { $this->forUpdate->append($table_name); } return $this; }
[ "public", "function", "forUpdate", "(", "$", "table_name", ",", "$", "glue", "=", "','", ")", "{", "$", "this", "->", "type", "=", "'forUpdate'", ";", "if", "(", "$", "this", "->", "forUpdate", "===", "null", ")", "{", "$", "glue", "=", "strtoupper",...
Sets the FOR UPDATE lock on select's output row @param string $table_name The table to lock @param string $glue The glue by which to join the conditions. Defaults to ',' . @return PostgresqlQuery FOR UPDATE query element @since 1.0
[ "Sets", "the", "FOR", "UPDATE", "lock", "on", "select", "s", "output", "row" ]
90a6b42fec66f735e5e871d1fb2a8202c2a3216f
https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Postgresql/PostgresqlQuery.php#L435-L450
train
joomla-framework/database
src/Postgresql/PostgresqlQuery.php
PostgresqlQuery.noWait
public function noWait() { $this->type = 'noWait'; if ($this->noWait === null) { $this->noWait = new QueryElement('NOWAIT', null); } return $this; }
php
public function noWait() { $this->type = 'noWait'; if ($this->noWait === null) { $this->noWait = new QueryElement('NOWAIT', null); } return $this; }
[ "public", "function", "noWait", "(", ")", "{", "$", "this", "->", "type", "=", "'noWait'", ";", "if", "(", "$", "this", "->", "noWait", "===", "null", ")", "{", "$", "this", "->", "noWait", "=", "new", "QueryElement", "(", "'NOWAIT'", ",", "null", ...
Sets the NOWAIT lock on select's output row @return PostgresqlQuery NOWAIT query element @since 1.0
[ "Sets", "the", "NOWAIT", "lock", "on", "select", "s", "output", "row" ]
90a6b42fec66f735e5e871d1fb2a8202c2a3216f
https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Postgresql/PostgresqlQuery.php#L588-L598
train
joomla-framework/database
src/Postgresql/PostgresqlQuery.php
PostgresqlQuery.setLimit
public function setLimit($limit = 0, $offset = 0) { $this->limit = (int) $limit; $this->offset = (int) $offset; return $this; }
php
public function setLimit($limit = 0, $offset = 0) { $this->limit = (int) $limit; $this->offset = (int) $offset; return $this; }
[ "public", "function", "setLimit", "(", "$", "limit", "=", "0", ",", "$", "offset", "=", "0", ")", "{", "$", "this", "->", "limit", "=", "(", "int", ")", "$", "limit", ";", "$", "this", "->", "offset", "=", "(", "int", ")", "$", "offset", ";", ...
Sets the offset and limit for the result set, if the database driver supports it. Usage: $query->setLimit(100, 0); (retrieve 100 rows, starting at first record) $query->setLimit(50, 50); (retrieve 50 rows, starting at 50th record) @param integer $limit The limit for the result set @param integer $offset The offset for the result set @return PostgresqlQuery Returns this object to allow chaining. @since 1.0
[ "Sets", "the", "offset", "and", "limit", "for", "the", "result", "set", "if", "the", "database", "driver", "supports", "it", "." ]
90a6b42fec66f735e5e871d1fb2a8202c2a3216f
https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Postgresql/PostgresqlQuery.php#L671-L677
train
joomla-framework/database
src/Postgresql/PostgresqlQuery.php
PostgresqlQuery.dateAdd
public function dateAdd($date, $interval, $datePart) { if (substr($interval, 0, 1) !== '-') { return "timestamp " . $date . " + interval '" . $interval . " " . $datePart . "'"; } return "timestamp " . $date . " - interval '" . ltrim($interval, '-') . " " . $datePart . "'"; }
php
public function dateAdd($date, $interval, $datePart) { if (substr($interval, 0, 1) !== '-') { return "timestamp " . $date . " + interval '" . $interval . " " . $datePart . "'"; } return "timestamp " . $date . " - interval '" . ltrim($interval, '-') . " " . $datePart . "'"; }
[ "public", "function", "dateAdd", "(", "$", "date", ",", "$", "interval", ",", "$", "datePart", ")", "{", "if", "(", "substr", "(", "$", "interval", ",", "0", ",", "1", ")", "!==", "'-'", ")", "{", "return", "\"timestamp \"", ".", "$", "date", ".", ...
Add to the current date and time. Usage: $query->select($query->dateAdd()); Prefixing the interval with a - (negative sign) will cause subtraction to be used. @param string $date The db quoted string representation of the date to add to @param string $interval The string representation of the appropriate number of units @param string $datePart The part of the date to perform the addition on @return string The string with the appropriate sql for addition of dates @since 1.5.0 @link http://www.postgresql.org/docs/9.0/static/functions-datetime.html.
[ "Add", "to", "the", "current", "date", "and", "time", "." ]
90a6b42fec66f735e5e871d1fb2a8202c2a3216f
https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Postgresql/PostgresqlQuery.php#L724-L732
train
joomla-framework/database
src/Mysqli/MysqliImporter.php
MysqliImporter.xmlToCreate
protected function xmlToCreate(\SimpleXMLElement $table) { $existingTables = $this->db->getTableList(); $tableName = (string) $table['name']; if (\in_array($tableName, $existingTables, true)) { throw new \RuntimeException('The table you are trying to create already exists'); } $createTableStatement = 'CREATE TABLE ' . $this->db->quoteName($tableName) . ' ('; foreach ($table->xpath('field') as $field) { $createTableStatement .= $this->getColumnSQL($field) . ', '; } foreach ($table->xpath('key') as $key) { $createTableStatement .= $this->getKeySQL(array($key)) . ', '; } $createTableStatement = rtrim($createTableStatement, ', '); $createTableStatement .= ')'; return $createTableStatement; }
php
protected function xmlToCreate(\SimpleXMLElement $table) { $existingTables = $this->db->getTableList(); $tableName = (string) $table['name']; if (\in_array($tableName, $existingTables, true)) { throw new \RuntimeException('The table you are trying to create already exists'); } $createTableStatement = 'CREATE TABLE ' . $this->db->quoteName($tableName) . ' ('; foreach ($table->xpath('field') as $field) { $createTableStatement .= $this->getColumnSQL($field) . ', '; } foreach ($table->xpath('key') as $key) { $createTableStatement .= $this->getKeySQL(array($key)) . ', '; } $createTableStatement = rtrim($createTableStatement, ', '); $createTableStatement .= ')'; return $createTableStatement; }
[ "protected", "function", "xmlToCreate", "(", "\\", "SimpleXMLElement", "$", "table", ")", "{", "$", "existingTables", "=", "$", "this", "->", "db", "->", "getTableList", "(", ")", ";", "$", "tableName", "=", "(", "string", ")", "$", "table", "[", "'name'...
Get the SQL syntax to add a table. @param \SimpleXMLElement $table The table information. @return string @since 1.4.0 @throws \RuntimeException
[ "Get", "the", "SQL", "syntax", "to", "add", "a", "table", "." ]
90a6b42fec66f735e5e871d1fb2a8202c2a3216f
https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Mysqli/MysqliImporter.php#L55-L82
train
joomla-framework/database
src/Mysqli/MysqliImporter.php
MysqliImporter.getColumnSql
protected function getColumnSql(\SimpleXMLElement $field) { // TODO Incorporate into parent class and use $this. $blobs = array('text', 'smalltext', 'mediumtext', 'largetext'); $fName = (string) $field['Field']; $fType = (string) $field['Type']; $fNull = (string) $field['Null']; $fDefault = isset($field['Default']) ? (string) $field['Default'] : null; $fExtra = (string) $field['Extra']; $sql = $this->db->quoteName($fName) . ' ' . $fType; if ($fNull === 'NO') { if ($fDefault === null || \in_array($fType, $blobs, true)) { $sql .= ' NOT NULL'; } else { // TODO Don't quote numeric values. $sql .= ' NOT NULL DEFAULT ' . $this->db->quote($fDefault); } } else { if ($fDefault === null) { $sql .= ' DEFAULT NULL'; } else { // TODO Don't quote numeric values. $sql .= ' DEFAULT ' . $this->db->quote($fDefault); } } if ($fExtra) { $sql .= ' ' . strtoupper($fExtra); } return $sql; }
php
protected function getColumnSql(\SimpleXMLElement $field) { // TODO Incorporate into parent class and use $this. $blobs = array('text', 'smalltext', 'mediumtext', 'largetext'); $fName = (string) $field['Field']; $fType = (string) $field['Type']; $fNull = (string) $field['Null']; $fDefault = isset($field['Default']) ? (string) $field['Default'] : null; $fExtra = (string) $field['Extra']; $sql = $this->db->quoteName($fName) . ' ' . $fType; if ($fNull === 'NO') { if ($fDefault === null || \in_array($fType, $blobs, true)) { $sql .= ' NOT NULL'; } else { // TODO Don't quote numeric values. $sql .= ' NOT NULL DEFAULT ' . $this->db->quote($fDefault); } } else { if ($fDefault === null) { $sql .= ' DEFAULT NULL'; } else { // TODO Don't quote numeric values. $sql .= ' DEFAULT ' . $this->db->quote($fDefault); } } if ($fExtra) { $sql .= ' ' . strtoupper($fExtra); } return $sql; }
[ "protected", "function", "getColumnSql", "(", "\\", "SimpleXMLElement", "$", "field", ")", "{", "// TODO Incorporate into parent class and use $this.", "$", "blobs", "=", "array", "(", "'text'", ",", "'smalltext'", ",", "'mediumtext'", ",", "'largetext'", ")", ";", ...
Get the SQL syntax for a single column that would be included in a table create or alter statement. @param \SimpleXMLElement $field The XML field definition. @return string @since 1.0
[ "Get", "the", "SQL", "syntax", "for", "a", "single", "column", "that", "would", "be", "included", "in", "a", "table", "create", "or", "alter", "statement", "." ]
90a6b42fec66f735e5e871d1fb2a8202c2a3216f
https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Mysqli/MysqliImporter.php#L277-L321
train
joomla-framework/database
src/Sqlsrv/SqlsrvDriver.php
SqlsrvDriver.renameConstraints
protected function renameConstraints($constraints = array(), $prefix = null, $backup = null) { $this->connect(); foreach ($constraints as $constraint) { $this->setQuery('sp_rename ' . $constraint . ',' . str_replace($prefix, $backup, $constraint)); $this->execute(); } }
php
protected function renameConstraints($constraints = array(), $prefix = null, $backup = null) { $this->connect(); foreach ($constraints as $constraint) { $this->setQuery('sp_rename ' . $constraint . ',' . str_replace($prefix, $backup, $constraint)); $this->execute(); } }
[ "protected", "function", "renameConstraints", "(", "$", "constraints", "=", "array", "(", ")", ",", "$", "prefix", "=", "null", ",", "$", "backup", "=", "null", ")", "{", "$", "this", "->", "connect", "(", ")", ";", "foreach", "(", "$", "constraints", ...
Rename constraints. @param array $constraints Array(strings) of table constraints @param string $prefix A string @param string $backup A string @return void @since 1.0
[ "Rename", "constraints", "." ]
90a6b42fec66f735e5e871d1fb2a8202c2a3216f
https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Sqlsrv/SqlsrvDriver.php#L206-L215
train
joomla-framework/database
src/Sqlsrv/SqlsrvDriver.php
SqlsrvDriver.checkFieldExists
protected function checkFieldExists($table, $field) { $this->connect(); $table = $this->replacePrefix((string) $table); $this->setQuery( "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '$table' AND COLUMN_NAME = '$field' ORDER BY ORDINAL_POSITION" ); if ($this->loadResult()) { return true; } return false; }
php
protected function checkFieldExists($table, $field) { $this->connect(); $table = $this->replacePrefix((string) $table); $this->setQuery( "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '$table' AND COLUMN_NAME = '$field' ORDER BY ORDINAL_POSITION" ); if ($this->loadResult()) { return true; } return false; }
[ "protected", "function", "checkFieldExists", "(", "$", "table", ",", "$", "field", ")", "{", "$", "this", "->", "connect", "(", ")", ";", "$", "table", "=", "$", "this", "->", "replacePrefix", "(", "(", "string", ")", "$", "table", ")", ";", "$", "...
Method to check and see if a field exists in a table. @param string $table The table in which to verify the field. @param string $field The field to verify. @return boolean True if the field exists in the table. @since 1.0
[ "Method", "to", "check", "and", "see", "if", "a", "field", "exists", "in", "a", "table", "." ]
90a6b42fec66f735e5e871d1fb2a8202c2a3216f
https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Sqlsrv/SqlsrvDriver.php#L1056-L1071
train
joomla-framework/database
src/Sqlsrv/SqlsrvDriver.php
SqlsrvDriver.limit
protected function limit($sql, $limit, $offset) { $orderBy = stristr($sql, 'ORDER BY'); if ($orderBy === null || empty($orderBy)) { $orderBy = 'ORDER BY (select 0)'; } $sql = str_ireplace($orderBy, '', $sql); $rowNumberText = ',ROW_NUMBER() OVER (' . $orderBy . ') AS RowNumber FROM '; $sql = preg_replace('/\\s+FROM/', '\\1 ' . $rowNumberText . ' ', $sql, 1); $sql = 'SELECT TOP ' . $this->limit . ' * FROM (' . $sql . ') _myResults WHERE RowNumber > ' . $this->offset; return $sql; }
php
protected function limit($sql, $limit, $offset) { $orderBy = stristr($sql, 'ORDER BY'); if ($orderBy === null || empty($orderBy)) { $orderBy = 'ORDER BY (select 0)'; } $sql = str_ireplace($orderBy, '', $sql); $rowNumberText = ',ROW_NUMBER() OVER (' . $orderBy . ') AS RowNumber FROM '; $sql = preg_replace('/\\s+FROM/', '\\1 ' . $rowNumberText . ' ', $sql, 1); $sql = 'SELECT TOP ' . $this->limit . ' * FROM (' . $sql . ') _myResults WHERE RowNumber > ' . $this->offset; return $sql; }
[ "protected", "function", "limit", "(", "$", "sql", ",", "$", "limit", ",", "$", "offset", ")", "{", "$", "orderBy", "=", "stristr", "(", "$", "sql", ",", "'ORDER BY'", ")", ";", "if", "(", "$", "orderBy", "===", "null", "||", "empty", "(", "$", "...
Method to wrap an SQL statement to provide a LIMIT and OFFSET behavior for scrolling through a result set. @param string $sql The SQL statement to process. @param integer $limit The maximum affected rows to set. @param integer $offset The affected row offset to set. @return string The processed SQL statement. @since 1.0
[ "Method", "to", "wrap", "an", "SQL", "statement", "to", "provide", "a", "LIMIT", "and", "OFFSET", "behavior", "for", "scrolling", "through", "a", "result", "set", "." ]
90a6b42fec66f735e5e871d1fb2a8202c2a3216f
https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Sqlsrv/SqlsrvDriver.php#L1084-L1101
train
joomla-framework/database
src/DatabaseQuery.php
DatabaseQuery.extendWhere
public function extendWhere($outerGlue, $conditions, $innerGlue = 'AND') { // Replace the current WHERE with a new one which has the old one as an unnamed child. $this->where = new Query\QueryElement('WHERE', $this->where->setName('()'), " $outerGlue "); // Append the new conditions as a new unnamed child. $this->where->append(new Query\QueryElement('()', $conditions, " $innerGlue ")); return $this; }
php
public function extendWhere($outerGlue, $conditions, $innerGlue = 'AND') { // Replace the current WHERE with a new one which has the old one as an unnamed child. $this->where = new Query\QueryElement('WHERE', $this->where->setName('()'), " $outerGlue "); // Append the new conditions as a new unnamed child. $this->where->append(new Query\QueryElement('()', $conditions, " $innerGlue ")); return $this; }
[ "public", "function", "extendWhere", "(", "$", "outerGlue", ",", "$", "conditions", ",", "$", "innerGlue", "=", "'AND'", ")", "{", "// Replace the current WHERE with a new one which has the old one as an unnamed child.", "$", "this", "->", "where", "=", "new", "Query", ...
Extend the WHERE clause with a single condition or an array of conditions, with a potentially different logical operator from the one in the current WHERE clause. Usage: $query->where(array('a = 1', 'b = 2'))->extendWhere('XOR', array('c = 3', 'd = 4')); will produce: WHERE ((a = 1 AND b = 2) XOR (c = 3 AND d = 4) @param string $outerGlue The glue by which to join the conditions to the current WHERE conditions. @param mixed $conditions A string or array of WHERE conditions. @param string $innerGlue The glue by which to join the conditions. Defaults to AND. @return DatabaseQuery Returns this object to allow chaining. @since 1.3.0
[ "Extend", "the", "WHERE", "clause", "with", "a", "single", "condition", "or", "an", "array", "of", "conditions", "with", "a", "potentially", "different", "logical", "operator", "from", "the", "one", "in", "the", "current", "WHERE", "clause", "." ]
90a6b42fec66f735e5e871d1fb2a8202c2a3216f
https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/DatabaseQuery.php#L1524-L1533
train
joomla-framework/database
src/DatabaseQuery.php
DatabaseQuery.unionDistinct
public function unionDistinct($query, $glue = '') { $distinct = true; // Apply the distinct flag to the union. return $this->union($query, $distinct, $glue); }
php
public function unionDistinct($query, $glue = '') { $distinct = true; // Apply the distinct flag to the union. return $this->union($query, $distinct, $glue); }
[ "public", "function", "unionDistinct", "(", "$", "query", ",", "$", "glue", "=", "''", ")", "{", "$", "distinct", "=", "true", ";", "// Apply the distinct flag to the union.", "return", "$", "this", "->", "union", "(", "$", "query", ",", "$", "distinct", "...
Add a query to UNION DISTINCT with the current query. Simply a proxy to Union with the Distinct clause. Usage: $query->unionDistinct('SELECT name FROM #__foo') @param DatabaseQuery|string $query The DatabaseQuery object or string to union. @param string $glue The glue by which to join the conditions. @return DatabaseQuery Returns this object to allow chaining. @since 1.0
[ "Add", "a", "query", "to", "UNION", "DISTINCT", "with", "the", "current", "query", ".", "Simply", "a", "proxy", "to", "Union", "with", "the", "Distinct", "clause", "." ]
90a6b42fec66f735e5e871d1fb2a8202c2a3216f
https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/DatabaseQuery.php#L1698-L1704
train
joomla-framework/database
src/Postgresql/PostgresqlDriver.php
PostgresqlDriver.getQuery
public function getQuery($new = false, $asObj = false) { if ($new) { // Make sure we have a query class for this driver. if (!class_exists('\\Joomla\\Database\\Postgresql\\PostgresqlQuery')) { throw new UnsupportedAdapterException('\\Joomla\\Database\\Postgresql\\PostgresqlQuery Class not found.'); } $this->queryObject = new PostgresqlQuery($this); return $this->queryObject; } if ($asObj) { return $this->queryObject; } return $this->sql; }
php
public function getQuery($new = false, $asObj = false) { if ($new) { // Make sure we have a query class for this driver. if (!class_exists('\\Joomla\\Database\\Postgresql\\PostgresqlQuery')) { throw new UnsupportedAdapterException('\\Joomla\\Database\\Postgresql\\PostgresqlQuery Class not found.'); } $this->queryObject = new PostgresqlQuery($this); return $this->queryObject; } if ($asObj) { return $this->queryObject; } return $this->sql; }
[ "public", "function", "getQuery", "(", "$", "new", "=", "false", ",", "$", "asObj", "=", "false", ")", "{", "if", "(", "$", "new", ")", "{", "// Make sure we have a query class for this driver.", "if", "(", "!", "class_exists", "(", "'\\\\Joomla\\\\Database\\\\P...
Get the current or query, or new DatabaseQuery object. @param boolean $new False to return the last query set, True to return a new Query object. @param boolean $asObj False to return last query as string, true to get Postgresql query object. @return PostgresqlQuery The current query object or a new object extending the Query class. @since 1.0 @throws \RuntimeException
[ "Get", "the", "current", "or", "query", "or", "new", "DatabaseQuery", "object", "." ]
90a6b42fec66f735e5e871d1fb2a8202c2a3216f
https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Postgresql/PostgresqlDriver.php#L375-L396
train
joomla-framework/database
src/Postgresql/PostgresqlDriver.php
PostgresqlDriver.getStringPositionSql
public function getStringPositionSql($substring, $string) { $this->connect(); $query = "SELECT POSITION( $substring IN $string )"; $this->setQuery($query); $position = $this->loadRow(); return $position['position']; }
php
public function getStringPositionSql($substring, $string) { $this->connect(); $query = "SELECT POSITION( $substring IN $string )"; $this->setQuery($query); $position = $this->loadRow(); return $position['position']; }
[ "public", "function", "getStringPositionSql", "(", "$", "substring", ",", "$", "string", ")", "{", "$", "this", "->", "connect", "(", ")", ";", "$", "query", "=", "\"SELECT POSITION( $substring IN $string )\"", ";", "$", "this", "->", "setQuery", "(", "$", "...
Get the substring position inside a string @param string $substring The string being sought @param string $string The string/column being searched @return integer The position of $substring in $string @since 1.0
[ "Get", "the", "substring", "position", "inside", "a", "string" ]
90a6b42fec66f735e5e871d1fb2a8202c2a3216f
https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Postgresql/PostgresqlDriver.php#L1323-L1332
train
joomla-framework/database
src/Postgresql/PostgresqlDriver.php
PostgresqlDriver.releaseTransactionSavepoint
public function releaseTransactionSavepoint($savepointName) { $this->connect(); $this->setQuery('RELEASE SAVEPOINT ' . $this->quoteName($this->escape($savepointName))); $this->execute(); }
php
public function releaseTransactionSavepoint($savepointName) { $this->connect(); $this->setQuery('RELEASE SAVEPOINT ' . $this->quoteName($this->escape($savepointName))); $this->execute(); }
[ "public", "function", "releaseTransactionSavepoint", "(", "$", "savepointName", ")", "{", "$", "this", "->", "connect", "(", ")", ";", "$", "this", "->", "setQuery", "(", "'RELEASE SAVEPOINT '", ".", "$", "this", "->", "quoteName", "(", "$", "this", "->", ...
Method to release a savepoint. @param string $savepointName Savepoint's name to release @return void @since 1.0
[ "Method", "to", "release", "a", "savepoint", "." ]
90a6b42fec66f735e5e871d1fb2a8202c2a3216f
https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Postgresql/PostgresqlDriver.php#L1476-L1481
train
joomla-framework/database
src/Postgresql/PostgresqlDriver.php
PostgresqlDriver.transactionSavepoint
public function transactionSavepoint($savepointName) { $this->connect(); $this->setQuery('SAVEPOINT ' . $this->quoteName($this->escape($savepointName))); $this->execute(); }
php
public function transactionSavepoint($savepointName) { $this->connect(); $this->setQuery('SAVEPOINT ' . $this->quoteName($this->escape($savepointName))); $this->execute(); }
[ "public", "function", "transactionSavepoint", "(", "$", "savepointName", ")", "{", "$", "this", "->", "connect", "(", ")", ";", "$", "this", "->", "setQuery", "(", "'SAVEPOINT '", ".", "$", "this", "->", "quoteName", "(", "$", "this", "->", "escape", "("...
Method to create a savepoint. @param string $savepointName Savepoint's name to create @return void @since 1.0
[ "Method", "to", "create", "a", "savepoint", "." ]
90a6b42fec66f735e5e871d1fb2a8202c2a3216f
https://github.com/joomla-framework/database/blob/90a6b42fec66f735e5e871d1fb2a8202c2a3216f/src/Postgresql/PostgresqlDriver.php#L1492-L1497
train
webcomm/magento-boilerplate
src/app/code/community/Webcomm/MagentoBoilerplate/Helper/Resource/Setup.php
Webcomm_MagentoBoilerplate_Helper_Resource_Setup.removeConfigData
public function removeConfigData($path) { $values = Mage::getModel('core/config_data') ->getCollection() ->addFieldToFilter('path', $path); foreach ($values as $value) { $value->delete(); } return $this; }
php
public function removeConfigData($path) { $values = Mage::getModel('core/config_data') ->getCollection() ->addFieldToFilter('path', $path); foreach ($values as $value) { $value->delete(); } return $this; }
[ "public", "function", "removeConfigData", "(", "$", "path", ")", "{", "$", "values", "=", "Mage", "::", "getModel", "(", "'core/config_data'", ")", "->", "getCollection", "(", ")", "->", "addFieldToFilter", "(", "'path'", ",", "$", "path", ")", ";", "forea...
Remove config data with the given path. These may be a string that matches the key to remove, or an array suitable to be passed to Magento's query builder instead. @param mixed $path @return void
[ "Remove", "config", "data", "with", "the", "given", "path", ".", "These", "may", "be", "a", "string", "that", "matches", "the", "key", "to", "remove", "or", "an", "array", "suitable", "to", "be", "passed", "to", "Magento", "s", "query", "builder", "inste...
02e09af4520e6dc44bb74928dc79ac20c8fe801e
https://github.com/webcomm/magento-boilerplate/blob/02e09af4520e6dc44bb74928dc79ac20c8fe801e/src/app/code/community/Webcomm/MagentoBoilerplate/Helper/Resource/Setup.php#L13-L24
train
webcomm/magento-boilerplate
src/app/code/community/Webcomm/MagentoBoilerplate/Helper/Data.php
Webcomm_MagentoBoilerplate_Helper_Data.getAsset
protected function getAsset($name) { $manifest = $this->getAssetsManifest(); if (array_key_exists($name, $manifest)) { return $manifest[$name]; } return $name; }
php
protected function getAsset($name) { $manifest = $this->getAssetsManifest(); if (array_key_exists($name, $manifest)) { return $manifest[$name]; } return $name; }
[ "protected", "function", "getAsset", "(", "$", "name", ")", "{", "$", "manifest", "=", "$", "this", "->", "getAssetsManifest", "(", ")", ";", "if", "(", "array_key_exists", "(", "$", "name", ",", "$", "manifest", ")", ")", "{", "return", "$", "manifest...
Get an asset by name, utilising the manifest where possibel. @param string $name @return string
[ "Get", "an", "asset", "by", "name", "utilising", "the", "manifest", "where", "possibel", "." ]
02e09af4520e6dc44bb74928dc79ac20c8fe801e
https://github.com/webcomm/magento-boilerplate/blob/02e09af4520e6dc44bb74928dc79ac20c8fe801e/src/app/code/community/Webcomm/MagentoBoilerplate/Helper/Data.php#L38-L47
train
webcomm/magento-boilerplate
src/app/code/community/Webcomm/MagentoBoilerplate/Helper/Data.php
Webcomm_MagentoBoilerplate_Helper_Data.getAssetsManifest
protected function getAssetsManifest() { if ($this->assetsManifest === null) { $assetsJsonFile = Mage::getDesign()->getSkinBaseDir().'/rev-manifest.json'; if (file_exists($assetsJsonFile)) { $this->assetsManifest = json_decode(file_get_contents($assetsJsonFile), true); } else { $this->assetsManifest = []; } } return $this->assetsManifest; }
php
protected function getAssetsManifest() { if ($this->assetsManifest === null) { $assetsJsonFile = Mage::getDesign()->getSkinBaseDir().'/rev-manifest.json'; if (file_exists($assetsJsonFile)) { $this->assetsManifest = json_decode(file_get_contents($assetsJsonFile), true); } else { $this->assetsManifest = []; } } return $this->assetsManifest; }
[ "protected", "function", "getAssetsManifest", "(", ")", "{", "if", "(", "$", "this", "->", "assetsManifest", "===", "null", ")", "{", "$", "assetsJsonFile", "=", "Mage", "::", "getDesign", "(", ")", "->", "getSkinBaseDir", "(", ")", ".", "'/rev-manifest.json...
Get the assets manifest payload, lazily-loading the contents of the file. @return array
[ "Get", "the", "assets", "manifest", "payload", "lazily", "-", "loading", "the", "contents", "of", "the", "file", "." ]
02e09af4520e6dc44bb74928dc79ac20c8fe801e
https://github.com/webcomm/magento-boilerplate/blob/02e09af4520e6dc44bb74928dc79ac20c8fe801e/src/app/code/community/Webcomm/MagentoBoilerplate/Helper/Data.php#L54-L67
train
albertcht/lumen-testing
src/Concerns/RefreshDatabase.php
RefreshDatabase.beginDatabaseTransaction
public function beginDatabaseTransaction() { $database = $this->app->make('db'); foreach ($this->connectionsToTransact() as $name) { $connection = $database->connection($name); $dispatcher = $connection->getEventDispatcher(); $connection->unsetEventDispatcher(); $connection->beginTransaction(); $connection->setEventDispatcher($dispatcher); } $this->beforeApplicationDestroyed(function () use ($database) { foreach ($this->connectionsToTransact() as $name) { $connection = $database->connection($name); $dispatcher = $connection->getEventDispatcher(); $connection->unsetEventDispatcher(); $connection->rollback(); $connection->setEventDispatcher($dispatcher); $connection->disconnect(); } }); }
php
public function beginDatabaseTransaction() { $database = $this->app->make('db'); foreach ($this->connectionsToTransact() as $name) { $connection = $database->connection($name); $dispatcher = $connection->getEventDispatcher(); $connection->unsetEventDispatcher(); $connection->beginTransaction(); $connection->setEventDispatcher($dispatcher); } $this->beforeApplicationDestroyed(function () use ($database) { foreach ($this->connectionsToTransact() as $name) { $connection = $database->connection($name); $dispatcher = $connection->getEventDispatcher(); $connection->unsetEventDispatcher(); $connection->rollback(); $connection->setEventDispatcher($dispatcher); $connection->disconnect(); } }); }
[ "public", "function", "beginDatabaseTransaction", "(", ")", "{", "$", "database", "=", "$", "this", "->", "app", "->", "make", "(", "'db'", ")", ";", "foreach", "(", "$", "this", "->", "connectionsToTransact", "(", ")", "as", "$", "name", ")", "{", "$"...
Begin a database transaction on the testing database. @return void
[ "Begin", "a", "database", "transaction", "on", "the", "testing", "database", "." ]
02d787bf233583e766e32b528855af8166c6ffb2
https://github.com/albertcht/lumen-testing/blob/02d787bf233583e766e32b528855af8166c6ffb2/src/Concerns/RefreshDatabase.php#L66-L90
train
albertcht/lumen-testing
src/Concerns/InteractsWithDatabase.php
InteractsWithDatabase.assertSoftDeleted
protected function assertSoftDeleted($table, array $data, $connection = null) { $this->assertThat( $table, new SoftDeletedInDatabase($this->getConnection($connection), $data) ); return $this; }
php
protected function assertSoftDeleted($table, array $data, $connection = null) { $this->assertThat( $table, new SoftDeletedInDatabase($this->getConnection($connection), $data) ); return $this; }
[ "protected", "function", "assertSoftDeleted", "(", "$", "table", ",", "array", "$", "data", ",", "$", "connection", "=", "null", ")", "{", "$", "this", "->", "assertThat", "(", "$", "table", ",", "new", "SoftDeletedInDatabase", "(", "$", "this", "->", "g...
Assert the given record has been deleted. @param string $table @param array $data @param string $connection @return $this
[ "Assert", "the", "given", "record", "has", "been", "deleted", "." ]
02d787bf233583e766e32b528855af8166c6ffb2
https://github.com/albertcht/lumen-testing/blob/02d787bf233583e766e32b528855af8166c6ffb2/src/Concerns/InteractsWithDatabase.php#L43-L50
train
albertcht/lumen-testing
src/Concerns/InteractsWithDatabase.php
InteractsWithDatabase.getConnection
protected function getConnection($connection = null) { $database = $this->app->make('db'); $connection = $connection ?: $database->getDefaultConnection(); return $database->connection($connection); }
php
protected function getConnection($connection = null) { $database = $this->app->make('db'); $connection = $connection ?: $database->getDefaultConnection(); return $database->connection($connection); }
[ "protected", "function", "getConnection", "(", "$", "connection", "=", "null", ")", "{", "$", "database", "=", "$", "this", "->", "app", "->", "make", "(", "'db'", ")", ";", "$", "connection", "=", "$", "connection", "?", ":", "$", "database", "->", ...
Get the database connection. @param string|null $connection @return \Illuminate\Database\Connection
[ "Get", "the", "database", "connection", "." ]
02d787bf233583e766e32b528855af8166c6ffb2
https://github.com/albertcht/lumen-testing/blob/02d787bf233583e766e32b528855af8166c6ffb2/src/Concerns/InteractsWithDatabase.php#L58-L65
train
albertcht/lumen-testing
src/Concerns/MakesHttpRequests.php
MakesHttpRequests.withHeader
public function withHeader(string $name, string $value) { $this->defaultHeaders[$name] = $value; return $this; }
php
public function withHeader(string $name, string $value) { $this->defaultHeaders[$name] = $value; return $this; }
[ "public", "function", "withHeader", "(", "string", "$", "name", ",", "string", "$", "value", ")", "{", "$", "this", "->", "defaultHeaders", "[", "$", "name", "]", "=", "$", "value", ";", "return", "$", "this", ";", "}" ]
Add a header to be sent with the request. @param string $name @param string $value @return $this
[ "Add", "a", "header", "to", "be", "sent", "with", "the", "request", "." ]
02d787bf233583e766e32b528855af8166c6ffb2
https://github.com/albertcht/lumen-testing/blob/02d787bf233583e766e32b528855af8166c6ffb2/src/Concerns/MakesHttpRequests.php#L54-L59
train
albertcht/lumen-testing
src/Concerns/MakesHttpRequests.php
MakesHttpRequests.withMiddleware
public function withMiddleware($middleware = null) { if (is_null($middleware)) { unset($this->app['middleware.disable']); return $this; } foreach ((array) $middleware as $abstract) { unset($this->app[$abstract]); } return $this; }
php
public function withMiddleware($middleware = null) { if (is_null($middleware)) { unset($this->app['middleware.disable']); return $this; } foreach ((array) $middleware as $abstract) { unset($this->app[$abstract]); } return $this; }
[ "public", "function", "withMiddleware", "(", "$", "middleware", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "middleware", ")", ")", "{", "unset", "(", "$", "this", "->", "app", "[", "'middleware.disable'", "]", ")", ";", "return", "$", "this...
Enable the given middleware for the test. @param string|array $middleware @return $this
[ "Enable", "the", "given", "middleware", "for", "the", "test", "." ]
02d787bf233583e766e32b528855af8166c6ffb2
https://github.com/albertcht/lumen-testing/blob/02d787bf233583e766e32b528855af8166c6ffb2/src/Concerns/MakesHttpRequests.php#L118-L131
train
albertcht/lumen-testing
src/Concerns/MakesHttpRequests.php
MakesHttpRequests.get
public function get($uri, array $headers = []) { $server = $this->transformHeadersToServerVars($headers); return $this->call('GET', $uri, [], [], [], $server); }
php
public function get($uri, array $headers = []) { $server = $this->transformHeadersToServerVars($headers); return $this->call('GET', $uri, [], [], [], $server); }
[ "public", "function", "get", "(", "$", "uri", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "$", "server", "=", "$", "this", "->", "transformHeadersToServerVars", "(", "$", "headers", ")", ";", "return", "$", "this", "->", "call", "(", "'GET...
Visit the given URI with a GET request. @param string $uri @param array $headers @return TestResponse
[ "Visit", "the", "given", "URI", "with", "a", "GET", "request", "." ]
02d787bf233583e766e32b528855af8166c6ffb2
https://github.com/albertcht/lumen-testing/blob/02d787bf233583e766e32b528855af8166c6ffb2/src/Concerns/MakesHttpRequests.php#L163-L168
train
albertcht/lumen-testing
src/Concerns/MakesHttpRequests.php
MakesHttpRequests.post
public function post($uri, array $data = [], array $headers = []) { $server = $this->transformHeadersToServerVars($headers); return $this->call('POST', $uri, $data, [], [], $server); }
php
public function post($uri, array $data = [], array $headers = []) { $server = $this->transformHeadersToServerVars($headers); return $this->call('POST', $uri, $data, [], [], $server); }
[ "public", "function", "post", "(", "$", "uri", ",", "array", "$", "data", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "$", "server", "=", "$", "this", "->", "transformHeadersToServerVars", "(", "$", "headers", ")", ";", "r...
Visit the given URI with a POST request. @param string $uri @param array $data @param array $headers @return TestResponse
[ "Visit", "the", "given", "URI", "with", "a", "POST", "request", "." ]
02d787bf233583e766e32b528855af8166c6ffb2
https://github.com/albertcht/lumen-testing/blob/02d787bf233583e766e32b528855af8166c6ffb2/src/Concerns/MakesHttpRequests.php#L190-L195
train
albertcht/lumen-testing
src/Concerns/MakesHttpRequests.php
MakesHttpRequests.put
public function put($uri, array $data = [], array $headers = []) { $server = $this->transformHeadersToServerVars($headers); return $this->call('PUT', $uri, $data, [], [], $server); }
php
public function put($uri, array $data = [], array $headers = []) { $server = $this->transformHeadersToServerVars($headers); return $this->call('PUT', $uri, $data, [], [], $server); }
[ "public", "function", "put", "(", "$", "uri", ",", "array", "$", "data", "=", "[", "]", ",", "array", "$", "headers", "=", "[", "]", ")", "{", "$", "server", "=", "$", "this", "->", "transformHeadersToServerVars", "(", "$", "headers", ")", ";", "re...
Visit the given URI with a PUT request. @param string $uri @param array $data @param array $headers @return TestResponse
[ "Visit", "the", "given", "URI", "with", "a", "PUT", "request", "." ]
02d787bf233583e766e32b528855af8166c6ffb2
https://github.com/albertcht/lumen-testing/blob/02d787bf233583e766e32b528855af8166c6ffb2/src/Concerns/MakesHttpRequests.php#L218-L223
train
albertcht/lumen-testing
src/Concerns/MakesHttpRequests.php
MakesHttpRequests.prepareUrlForRequest
protected function prepareUrlForRequest($uri) { if (Str::startsWith($uri, '/')) { $uri = substr($uri, 1); } if (! Str::startsWith($uri, 'http')) { $uri = ($this->baseUrl ?? config('app.url')) . '/' . $uri; } return trim($uri, '/'); }
php
protected function prepareUrlForRequest($uri) { if (Str::startsWith($uri, '/')) { $uri = substr($uri, 1); } if (! Str::startsWith($uri, 'http')) { $uri = ($this->baseUrl ?? config('app.url')) . '/' . $uri; } return trim($uri, '/'); }
[ "protected", "function", "prepareUrlForRequest", "(", "$", "uri", ")", "{", "if", "(", "Str", "::", "startsWith", "(", "$", "uri", ",", "'/'", ")", ")", "{", "$", "uri", "=", "substr", "(", "$", "uri", ",", "1", ")", ";", "}", "if", "(", "!", "...
Turn the given URI into a fully qualified URL. @param string $uri @return string
[ "Turn", "the", "given", "URI", "into", "a", "fully", "qualified", "URL", "." ]
02d787bf233583e766e32b528855af8166c6ffb2
https://github.com/albertcht/lumen-testing/blob/02d787bf233583e766e32b528855af8166c6ffb2/src/Concerns/MakesHttpRequests.php#L372-L383
train
albertcht/lumen-testing
src/Concerns/MakesHttpRequests.php
MakesHttpRequests.followRedirects
protected function followRedirects($response) { while ($response->isRedirect()) { $response = $this->get($response->headers->get('Location')); } $this->followRedirects = false; return $response; }
php
protected function followRedirects($response) { while ($response->isRedirect()) { $response = $this->get($response->headers->get('Location')); } $this->followRedirects = false; return $response; }
[ "protected", "function", "followRedirects", "(", "$", "response", ")", "{", "while", "(", "$", "response", "->", "isRedirect", "(", ")", ")", "{", "$", "response", "=", "$", "this", "->", "get", "(", "$", "response", "->", "headers", "->", "get", "(", ...
Follow a redirect chain until a non-redirect is received. @param \Illuminate\Http\Response $response @return \Illuminate\Http\Response
[ "Follow", "a", "redirect", "chain", "until", "a", "non", "-", "redirect", "is", "received", "." ]
02d787bf233583e766e32b528855af8166c6ffb2
https://github.com/albertcht/lumen-testing/blob/02d787bf233583e766e32b528855af8166c6ffb2/src/Concerns/MakesHttpRequests.php#L448-L457
train
OXID-eSales/paypal
Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php
SetExpressCheckoutRequestBuilder.getPayPalConfig
public function getPayPalConfig() { if (!$this->payPalConfig) { /** @var \OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException $exception */ $exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException::class); throw $exception; } return $this->payPalConfig; }
php
public function getPayPalConfig() { if (!$this->payPalConfig) { /** @var \OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException $exception */ $exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException::class); throw $exception; } return $this->payPalConfig; }
[ "public", "function", "getPayPalConfig", "(", ")", "{", "if", "(", "!", "$", "this", "->", "payPalConfig", ")", "{", "/** @var \\OxidEsales\\PayPalModule\\Core\\Exception\\PayPalMissingParameterException $exception */", "$", "exception", "=", "oxNew", "(", "\\", "OxidEsal...
Returns config object. @return \OxidEsales\PayPalModule\Core\Config @throws \OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException
[ "Returns", "config", "object", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php#L168-L177
train
OXID-eSales/paypal
Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php
SetExpressCheckoutRequestBuilder.getBasket
public function getBasket() { if (is_null($this->basket)) { /** @var \OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException $exception */ $exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException::class); throw $exception; } return $this->basket; }
php
public function getBasket() { if (is_null($this->basket)) { /** @var \OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException $exception */ $exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException::class); throw $exception; } return $this->basket; }
[ "public", "function", "getBasket", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "basket", ")", ")", "{", "/** @var \\OxidEsales\\PayPalModule\\Core\\Exception\\PayPalMissingParameterException $exception */", "$", "exception", "=", "oxNew", "(", "\\", "...
Returns basket object. @return \OxidEsales\Eshop\Application\Model\Basket @throws \OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException
[ "Returns", "basket", "object", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php#L196-L205
train
OXID-eSales/paypal
Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php
SetExpressCheckoutRequestBuilder.getLang
public function getLang() { if (is_null($this->lang)) { $this->lang = $this->getPayPalConfig()->getLang(); } return $this->lang; }
php
public function getLang() { if (is_null($this->lang)) { $this->lang = $this->getPayPalConfig()->getLang(); } return $this->lang; }
[ "public", "function", "getLang", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "lang", ")", ")", "{", "$", "this", "->", "lang", "=", "$", "this", "->", "getPayPalConfig", "(", ")", "->", "getLang", "(", ")", ";", "}", "return", "$...
Returns Language object. @return \OxidEsales\Eshop\Core\Language
[ "Returns", "Language", "object", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php#L242-L249
train
OXID-eSales/paypal
Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php
SetExpressCheckoutRequestBuilder.buildExpressCheckoutRequest
public function buildExpressCheckoutRequest() { $this->addBaseParams(); $this->addCallBackUrl(); $this->addBasketParams(); $this->addDescriptionParams(); $this->turnOffShippingAddressCollection(); $this->setMaximumOrderAmount(); if ($this->getShowCartInPayPal()) { $this->addBasketItemParams(); } else { $this->addBasketGrandTotalParams(); } $this->addAddressParams(); return $this->getPayPalRequest(); }
php
public function buildExpressCheckoutRequest() { $this->addBaseParams(); $this->addCallBackUrl(); $this->addBasketParams(); $this->addDescriptionParams(); $this->turnOffShippingAddressCollection(); $this->setMaximumOrderAmount(); if ($this->getShowCartInPayPal()) { $this->addBasketItemParams(); } else { $this->addBasketGrandTotalParams(); } $this->addAddressParams(); return $this->getPayPalRequest(); }
[ "public", "function", "buildExpressCheckoutRequest", "(", ")", "{", "$", "this", "->", "addBaseParams", "(", ")", ";", "$", "this", "->", "addCallBackUrl", "(", ")", ";", "$", "this", "->", "addBasketParams", "(", ")", ";", "$", "this", "->", "addDescripti...
Builds PayPal request for express checkout. @return \OxidEsales\PayPalModule\Model\PayPalRequest\PayPalRequest
[ "Builds", "PayPal", "request", "for", "express", "checkout", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php#L356-L373
train
OXID-eSales/paypal
Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php
SetExpressCheckoutRequestBuilder.buildStandardCheckoutRequest
public function buildStandardCheckoutRequest() { $this->addBaseParams(); $this->addBasketParams(); $this->addDescriptionParams(); $this->disableSelectingDifferentAddressInPayPal(); $this->setMaximumOrderAmount(); if ($this->getShowCartInPayPal()) { $this->addBasketItemParams(); } else { $this->addBasketGrandTotalParams(); } $this->addAddressParams(); return $this->getPayPalRequest(); }
php
public function buildStandardCheckoutRequest() { $this->addBaseParams(); $this->addBasketParams(); $this->addDescriptionParams(); $this->disableSelectingDifferentAddressInPayPal(); $this->setMaximumOrderAmount(); if ($this->getShowCartInPayPal()) { $this->addBasketItemParams(); } else { $this->addBasketGrandTotalParams(); } $this->addAddressParams(); return $this->getPayPalRequest(); }
[ "public", "function", "buildStandardCheckoutRequest", "(", ")", "{", "$", "this", "->", "addBaseParams", "(", ")", ";", "$", "this", "->", "addBasketParams", "(", ")", ";", "$", "this", "->", "addDescriptionParams", "(", ")", ";", "$", "this", "->", "disab...
Builds PayPal request for standard checkout. @return \OxidEsales\PayPalModule\Model\PayPalRequest\PayPalRequest
[ "Builds", "PayPal", "request", "for", "standard", "checkout", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php#L380-L396
train
OXID-eSales/paypal
Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php
SetExpressCheckoutRequestBuilder.addBaseParams
public function addBaseParams() { $request = $this->getPayPalRequest(); $payPalConfig = $this->getPayPalConfig(); $request->setParameter("CALLBACKVERSION", "84.0"); $request->setParameter("LOCALECODE", $this->getLang()->translateString("OEPAYPAL_LOCALE")); // enabled guest buy (Buyer does not need to create a PayPal account to check out) $request->setParameter("SOLUTIONTYPE", ($payPalConfig->isGuestBuyEnabled() ? "Sole" : "Mark")); $request->setParameter("BRANDNAME", $payPalConfig->getBrandName()); $request->setParameter("CARTBORDERCOLOR", $payPalConfig->getBorderColor()); $request->setParameter("RETURNURL", $this->getReturnUrl()); $request->setParameter("CANCELURL", $this->getCancelUrl()); if ($logoImage = $payPalConfig->getLogoUrl()) { $request->setParameter("LOGOIMG", $logoImage); } $request->setParameter("PAYMENTREQUEST_0_PAYMENTACTION", $this->getTransactionMode()); }
php
public function addBaseParams() { $request = $this->getPayPalRequest(); $payPalConfig = $this->getPayPalConfig(); $request->setParameter("CALLBACKVERSION", "84.0"); $request->setParameter("LOCALECODE", $this->getLang()->translateString("OEPAYPAL_LOCALE")); // enabled guest buy (Buyer does not need to create a PayPal account to check out) $request->setParameter("SOLUTIONTYPE", ($payPalConfig->isGuestBuyEnabled() ? "Sole" : "Mark")); $request->setParameter("BRANDNAME", $payPalConfig->getBrandName()); $request->setParameter("CARTBORDERCOLOR", $payPalConfig->getBorderColor()); $request->setParameter("RETURNURL", $this->getReturnUrl()); $request->setParameter("CANCELURL", $this->getCancelUrl()); if ($logoImage = $payPalConfig->getLogoUrl()) { $request->setParameter("LOGOIMG", $logoImage); } $request->setParameter("PAYMENTREQUEST_0_PAYMENTACTION", $this->getTransactionMode()); }
[ "public", "function", "addBaseParams", "(", ")", "{", "$", "request", "=", "$", "this", "->", "getPayPalRequest", "(", ")", ";", "$", "payPalConfig", "=", "$", "this", "->", "getPayPalConfig", "(", ")", ";", "$", "request", "->", "setParameter", "(", "\"...
Sets base parameters to request.
[ "Sets", "base", "parameters", "to", "request", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php#L401-L421
train
OXID-eSales/paypal
Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php
SetExpressCheckoutRequestBuilder.addCallBackUrl
public function addCallBackUrl() { $request = $this->getPayPalRequest(); $request->setParameter("CALLBACK", $this->getCallbackUrl()); $request->setParameter("CALLBACKTIMEOUT", 6); }
php
public function addCallBackUrl() { $request = $this->getPayPalRequest(); $request->setParameter("CALLBACK", $this->getCallbackUrl()); $request->setParameter("CALLBACKTIMEOUT", 6); }
[ "public", "function", "addCallBackUrl", "(", ")", "{", "$", "request", "=", "$", "this", "->", "getPayPalRequest", "(", ")", ";", "$", "request", "->", "setParameter", "(", "\"CALLBACK\"", ",", "$", "this", "->", "getCallbackUrl", "(", ")", ")", ";", "$"...
Adds callback parameters to request.
[ "Adds", "callback", "parameters", "to", "request", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php#L426-L432
train
OXID-eSales/paypal
Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php
SetExpressCheckoutRequestBuilder.addBasketParams
public function addBasketParams() { $request = $this->getPayPalRequest(); $basket = $this->getBasket(); $virtualBasket = $basket->isVirtualPayPalBasket(); // only downloadable products? missing getter on oxBasket yet $request->setParameter("NOSHIPPING", $virtualBasket ? "1" : "0"); if ($virtualBasket) { $request->setParameter("REQCONFIRMSHIPPING", "0"); } // passing basket VAT (tax) value. It is required as in Net mode articles are without VAT, but basket is with VAT. // PayPal need this value to check if all articles sum match basket sum. if ($basket->isCalculationModeNetto()) { $request->setParameter("PAYMENTREQUEST_0_TAXAMT", $this->formatFloat($basket->getPayPalBasketVatValue())); } $request->setParameter("PAYMENTREQUEST_0_AMT", $this->formatFloat($basket->getPrice()->getBruttoPrice())); $request->setParameter("PAYMENTREQUEST_0_CURRENCYCODE", $basket->getBasketCurrency()->name); $request->setParameter("PAYMENTREQUEST_0_ITEMAMT", $this->formatFloat($basket->getSumOfCostOfAllItemsPayPalBasket())); $request->setParameter("PAYMENTREQUEST_0_SHIPPINGAMT", $this->formatFloat($basket->getDeliveryCosts())); $request->setParameter("PAYMENTREQUEST_0_SHIPDISCAMT", $this->formatFloat($basket->getDiscountSumPayPalBasket() * -1)); $delivery = oxNew(\OxidEsales\Eshop\Application\Model\DeliverySet::class); $deliveryName = ($delivery->load($basket->getShippingId())) ? $delivery->oxdeliveryset__oxtitle->value : "#1"; $request->setParameter("L_SHIPPINGOPTIONISDEFAULT0", "true"); $request->setParameter("L_SHIPPINGOPTIONNAME0", $deliveryName); $request->setParameter("L_SHIPPINGOPTIONAMOUNT0", $this->formatFloat($basket->getDeliveryCosts())); }
php
public function addBasketParams() { $request = $this->getPayPalRequest(); $basket = $this->getBasket(); $virtualBasket = $basket->isVirtualPayPalBasket(); // only downloadable products? missing getter on oxBasket yet $request->setParameter("NOSHIPPING", $virtualBasket ? "1" : "0"); if ($virtualBasket) { $request->setParameter("REQCONFIRMSHIPPING", "0"); } // passing basket VAT (tax) value. It is required as in Net mode articles are without VAT, but basket is with VAT. // PayPal need this value to check if all articles sum match basket sum. if ($basket->isCalculationModeNetto()) { $request->setParameter("PAYMENTREQUEST_0_TAXAMT", $this->formatFloat($basket->getPayPalBasketVatValue())); } $request->setParameter("PAYMENTREQUEST_0_AMT", $this->formatFloat($basket->getPrice()->getBruttoPrice())); $request->setParameter("PAYMENTREQUEST_0_CURRENCYCODE", $basket->getBasketCurrency()->name); $request->setParameter("PAYMENTREQUEST_0_ITEMAMT", $this->formatFloat($basket->getSumOfCostOfAllItemsPayPalBasket())); $request->setParameter("PAYMENTREQUEST_0_SHIPPINGAMT", $this->formatFloat($basket->getDeliveryCosts())); $request->setParameter("PAYMENTREQUEST_0_SHIPDISCAMT", $this->formatFloat($basket->getDiscountSumPayPalBasket() * -1)); $delivery = oxNew(\OxidEsales\Eshop\Application\Model\DeliverySet::class); $deliveryName = ($delivery->load($basket->getShippingId())) ? $delivery->oxdeliveryset__oxtitle->value : "#1"; $request->setParameter("L_SHIPPINGOPTIONISDEFAULT0", "true"); $request->setParameter("L_SHIPPINGOPTIONNAME0", $deliveryName); $request->setParameter("L_SHIPPINGOPTIONAMOUNT0", $this->formatFloat($basket->getDeliveryCosts())); }
[ "public", "function", "addBasketParams", "(", ")", "{", "$", "request", "=", "$", "this", "->", "getPayPalRequest", "(", ")", ";", "$", "basket", "=", "$", "this", "->", "getBasket", "(", ")", ";", "$", "virtualBasket", "=", "$", "basket", "->", "isVir...
Sets basket parameters to request.
[ "Sets", "basket", "parameters", "to", "request", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php#L466-L497
train
OXID-eSales/paypal
Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php
SetExpressCheckoutRequestBuilder.addDescriptionParams
public function addDescriptionParams() { $basket = $this->getBasket(); $config = $this->getPayPalConfig(); $request = $this->getPayPalRequest(); // description $shopNameFull = $config->getBrandName(); $shopName = substr($shopNameFull, 0, 70); if ($shopNameFull != $shopName) { $shopName .= "..."; } $subj = sprintf($this->getLang()->translateString("OEPAYPAL_ORDER_SUBJECT"), $shopName, $basket->getFPrice(), $basket->getBasketCurrency()->name); $request->setParameter("PAYMENTREQUEST_0_DESC", $subj); $request->setParameter("PAYMENTREQUEST_0_CUSTOM", $subj); }
php
public function addDescriptionParams() { $basket = $this->getBasket(); $config = $this->getPayPalConfig(); $request = $this->getPayPalRequest(); // description $shopNameFull = $config->getBrandName(); $shopName = substr($shopNameFull, 0, 70); if ($shopNameFull != $shopName) { $shopName .= "..."; } $subj = sprintf($this->getLang()->translateString("OEPAYPAL_ORDER_SUBJECT"), $shopName, $basket->getFPrice(), $basket->getBasketCurrency()->name); $request->setParameter("PAYMENTREQUEST_0_DESC", $subj); $request->setParameter("PAYMENTREQUEST_0_CUSTOM", $subj); }
[ "public", "function", "addDescriptionParams", "(", ")", "{", "$", "basket", "=", "$", "this", "->", "getBasket", "(", ")", ";", "$", "config", "=", "$", "this", "->", "getPayPalConfig", "(", ")", ";", "$", "request", "=", "$", "this", "->", "getPayPalR...
Sets transaction description parameters.
[ "Sets", "transaction", "description", "parameters", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php#L502-L518
train
OXID-eSales/paypal
Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php
SetExpressCheckoutRequestBuilder.addBasketItemParams
public function addBasketItemParams() { $basket = $this->getBasket(); $lang = $this->getLang(); $request = $this->getPayPalRequest(); $pos = 0; foreach ($basket->getContents() as $basketItem) { $request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", \OxidEsales\Eshop\Core\Str::getStr()->html_entity_decode($basketItem->getTitle())); $request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basketItem->getUnitPrice()->getPrice())); $request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", (int) $basketItem->getAmount()); $request->setParameter("L_PAYMENTREQUEST_0_ITEMURL{$pos}", $basketItem->getLink()); $basketProduct = $basketItem->getArticle(); $request->setParameter("L_PAYMENTREQUEST_0_NUMBER{$pos}", $basketProduct->oxarticles__oxartnum->value); $pos++; } //adding payment costs as product if ($basket->getPayPalPaymentCosts() > 0) { $paymentTitle = $lang->translateString("OEPAYPAL_SURCHARGE") . " " . $lang->translateString("OEPAYPAL_TYPE_OF_PAYMENT"); $request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", $paymentTitle); $request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basket->getPayPalPaymentCosts())); $request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", 1); $pos++; } //adding wrapping as product if ($basket->getPayPalWrappingCosts() > 0) { $request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", $lang->translateString("OEPAYPAL_GIFTWRAPPER")); $request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basket->getPayPalWrappingCosts())); $request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", 1); $pos++; } //adding greeting card as product if ($basket->getPayPalGiftCardCosts() > 0) { $request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", $lang->translateString("OEPAYPAL_GREETING_CARD")); $request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basket->getPayPalGiftCardCosts())); $request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", 1); $pos++; } }
php
public function addBasketItemParams() { $basket = $this->getBasket(); $lang = $this->getLang(); $request = $this->getPayPalRequest(); $pos = 0; foreach ($basket->getContents() as $basketItem) { $request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", \OxidEsales\Eshop\Core\Str::getStr()->html_entity_decode($basketItem->getTitle())); $request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basketItem->getUnitPrice()->getPrice())); $request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", (int) $basketItem->getAmount()); $request->setParameter("L_PAYMENTREQUEST_0_ITEMURL{$pos}", $basketItem->getLink()); $basketProduct = $basketItem->getArticle(); $request->setParameter("L_PAYMENTREQUEST_0_NUMBER{$pos}", $basketProduct->oxarticles__oxartnum->value); $pos++; } //adding payment costs as product if ($basket->getPayPalPaymentCosts() > 0) { $paymentTitle = $lang->translateString("OEPAYPAL_SURCHARGE") . " " . $lang->translateString("OEPAYPAL_TYPE_OF_PAYMENT"); $request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", $paymentTitle); $request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basket->getPayPalPaymentCosts())); $request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", 1); $pos++; } //adding wrapping as product if ($basket->getPayPalWrappingCosts() > 0) { $request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", $lang->translateString("OEPAYPAL_GIFTWRAPPER")); $request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basket->getPayPalWrappingCosts())); $request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", 1); $pos++; } //adding greeting card as product if ($basket->getPayPalGiftCardCosts() > 0) { $request->setParameter("L_PAYMENTREQUEST_0_NAME{$pos}", $lang->translateString("OEPAYPAL_GREETING_CARD")); $request->setParameter("L_PAYMENTREQUEST_0_AMT{$pos}", $this->formatFloat($basket->getPayPalGiftCardCosts())); $request->setParameter("L_PAYMENTREQUEST_0_QTY{$pos}", 1); $pos++; } }
[ "public", "function", "addBasketItemParams", "(", ")", "{", "$", "basket", "=", "$", "this", "->", "getBasket", "(", ")", ";", "$", "lang", "=", "$", "this", "->", "getLang", "(", ")", ";", "$", "request", "=", "$", "this", "->", "getPayPalRequest", ...
Sets basket items parameters to request.
[ "Sets", "basket", "items", "parameters", "to", "request", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php#L523-L569
train
OXID-eSales/paypal
Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php
SetExpressCheckoutRequestBuilder.addBasketGrandTotalParams
public function addBasketGrandTotalParams() { $basket = $this->getBasket(); $request = $this->getPayPalRequest(); $request->setParameter("L_PAYMENTREQUEST_0_NAME0", $this->getLang()->translateString("OEPAYPAL_GRAND_TOTAL")); $request->setParameter("L_PAYMENTREQUEST_0_AMT0", $this->formatFloat($basket->getSumOfCostOfAllItemsPayPalBasket())); $request->setParameter("L_PAYMENTREQUEST_0_QTY0", 1); }
php
public function addBasketGrandTotalParams() { $basket = $this->getBasket(); $request = $this->getPayPalRequest(); $request->setParameter("L_PAYMENTREQUEST_0_NAME0", $this->getLang()->translateString("OEPAYPAL_GRAND_TOTAL")); $request->setParameter("L_PAYMENTREQUEST_0_AMT0", $this->formatFloat($basket->getSumOfCostOfAllItemsPayPalBasket())); $request->setParameter("L_PAYMENTREQUEST_0_QTY0", 1); }
[ "public", "function", "addBasketGrandTotalParams", "(", ")", "{", "$", "basket", "=", "$", "this", "->", "getBasket", "(", ")", ";", "$", "request", "=", "$", "this", "->", "getPayPalRequest", "(", ")", ";", "$", "request", "->", "setParameter", "(", "\"...
Sets basket Grand Total params to request.
[ "Sets", "basket", "Grand", "Total", "params", "to", "request", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/SetExpressCheckoutRequestBuilder.php#L574-L582
train
OXID-eSales/paypal
Core/ModelDbGateway.php
ModelDbGateway.getDb
protected function getDb() { return \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC); }
php
protected function getDb() { return \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC); }
[ "protected", "function", "getDb", "(", ")", "{", "return", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "DatabaseProvider", "::", "getDb", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "DatabaseProvider", "::", "FETCH_MODE_ASSOC", ")", ...
Returns data base resource. @return \OxidEsales\Eshop\Core\Database\Adapter\DatabaseInterface
[ "Returns", "data", "base", "resource", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/ModelDbGateway.php#L36-L39
train
OXID-eSales/paypal
Model/PaymentValidator.php
PaymentValidator.getPayment
public function getPayment() { if (is_null($this->payment)) { $payPalPayment = oxNew(\OxidEsales\Eshop\Application\Model\Payment::class); $payPalPayment->load('oxidpaypal'); $this->setPayment($payPalPayment); } return $this->payment; }
php
public function getPayment() { if (is_null($this->payment)) { $payPalPayment = oxNew(\OxidEsales\Eshop\Application\Model\Payment::class); $payPalPayment->load('oxidpaypal'); $this->setPayment($payPalPayment); } return $this->payment; }
[ "public", "function", "getPayment", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "payment", ")", ")", "{", "$", "payPalPayment", "=", "oxNew", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Application", "\\", "Model", "\\", "Payment", ...
Payment object getter @return \OxidEsales\Eshop\Application\Model\Payment
[ "Payment", "object", "getter" ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PaymentValidator.php#L159-L168
train
OXID-eSales/paypal
Model/PaymentValidator.php
PaymentValidator.isPaymentActive
public function isPaymentActive() { $result = false; if ($payPalPayment = $this->getPayment()) { $result = $payPalPayment->oxpayments__oxactive->value ? true : false; } return $result; }
php
public function isPaymentActive() { $result = false; if ($payPalPayment = $this->getPayment()) { $result = $payPalPayment->oxpayments__oxactive->value ? true : false; } return $result; }
[ "public", "function", "isPaymentActive", "(", ")", "{", "$", "result", "=", "false", ";", "if", "(", "$", "payPalPayment", "=", "$", "this", "->", "getPayment", "(", ")", ")", "{", "$", "result", "=", "$", "payPalPayment", "->", "oxpayments__oxactive", "...
Checks if PayPal payment is active @return boolean
[ "Checks", "if", "PayPal", "payment", "is", "active" ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PaymentValidator.php#L175-L183
train
OXID-eSales/paypal
Model/PaymentValidator.php
PaymentValidator.isPaymentValid
public function isPaymentValid() { $isValid = $this->isPaymentActive(); if ($isValid && !is_null($this->getPrice())) { $isValid = $this->checkPriceRange() && $this->checkMinOrderPrice(); } $user = $this->getUser(); if ($isValid && $user && $user->hasAccount()) { $isValid = $this->checkUserGroup(); } if ($isValid && $user && $this->getCheckCountry()) { $isValid = $this->checkUserCountry(); } return $isValid; }
php
public function isPaymentValid() { $isValid = $this->isPaymentActive(); if ($isValid && !is_null($this->getPrice())) { $isValid = $this->checkPriceRange() && $this->checkMinOrderPrice(); } $user = $this->getUser(); if ($isValid && $user && $user->hasAccount()) { $isValid = $this->checkUserGroup(); } if ($isValid && $user && $this->getCheckCountry()) { $isValid = $this->checkUserCountry(); } return $isValid; }
[ "public", "function", "isPaymentValid", "(", ")", "{", "$", "isValid", "=", "$", "this", "->", "isPaymentActive", "(", ")", ";", "if", "(", "$", "isValid", "&&", "!", "is_null", "(", "$", "this", "->", "getPrice", "(", ")", ")", ")", "{", "$", "isV...
Checks if payment is valid according to config, user and basket amount. @return boolean
[ "Checks", "if", "payment", "is", "valid", "according", "to", "config", "user", "and", "basket", "amount", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PaymentValidator.php#L191-L209
train
OXID-eSales/paypal
Model/PaymentValidator.php
PaymentValidator.checkPriceRange
protected function checkPriceRange() { $isValid = true; $payPalPayment = $this->getPayment(); if ($payPalPayment->oxpayments__oxfromamount->value != 0 || $payPalPayment->oxpayments__oxtoamount->value != 0 ) { $cur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject(); $price = $this->getPrice() / $cur->rate; $isValid = (($price >= $payPalPayment->oxpayments__oxfromamount->value) && ($price <= $payPalPayment->oxpayments__oxtoamount->value)); } return $isValid; }
php
protected function checkPriceRange() { $isValid = true; $payPalPayment = $this->getPayment(); if ($payPalPayment->oxpayments__oxfromamount->value != 0 || $payPalPayment->oxpayments__oxtoamount->value != 0 ) { $cur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject(); $price = $this->getPrice() / $cur->rate; $isValid = (($price >= $payPalPayment->oxpayments__oxfromamount->value) && ($price <= $payPalPayment->oxpayments__oxtoamount->value)); } return $isValid; }
[ "protected", "function", "checkPriceRange", "(", ")", "{", "$", "isValid", "=", "true", ";", "$", "payPalPayment", "=", "$", "this", "->", "getPayment", "(", ")", ";", "if", "(", "$", "payPalPayment", "->", "oxpayments__oxfromamount", "->", "value", "!=", ...
Checks if basket price is inside payment price range If range is not set check returns true @return bool
[ "Checks", "if", "basket", "price", "is", "inside", "payment", "price", "range", "If", "range", "is", "not", "set", "check", "returns", "true" ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PaymentValidator.php#L217-L234
train
OXID-eSales/paypal
Model/PaymentValidator.php
PaymentValidator.checkMinOrderPrice
protected function checkMinOrderPrice() { $isValid = true; if ($minOrderPrice = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('iMinOrderPrice')) { $isValid = $this->getPrice() > $minOrderPrice; } return $isValid; }
php
protected function checkMinOrderPrice() { $isValid = true; if ($minOrderPrice = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('iMinOrderPrice')) { $isValid = $this->getPrice() > $minOrderPrice; } return $isValid; }
[ "protected", "function", "checkMinOrderPrice", "(", ")", "{", "$", "isValid", "=", "true", ";", "if", "(", "$", "minOrderPrice", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getConfig", "(", ")", "->", "getConfigParam", "(...
Checks if basket price is higher than minimum order price If min price is not set check returns true @return bool
[ "Checks", "if", "basket", "price", "is", "higher", "than", "minimum", "order", "price", "If", "min", "price", "is", "not", "set", "check", "returns", "true" ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PaymentValidator.php#L242-L251
train
OXID-eSales/paypal
Model/PaymentValidator.php
PaymentValidator.checkUserCountry
protected function checkUserCountry() { $isValid = true; $payPalPayment = $this->getPayment(); $countries = $payPalPayment->getCountries(); if ($countries) { $isValid = false; foreach ($countries as $countryId) { if ($countryId === $this->getShippingCountryId()) { $isValid = true; break; } } } return $isValid; }
php
protected function checkUserCountry() { $isValid = true; $payPalPayment = $this->getPayment(); $countries = $payPalPayment->getCountries(); if ($countries) { $isValid = false; foreach ($countries as $countryId) { if ($countryId === $this->getShippingCountryId()) { $isValid = true; break; } } } return $isValid; }
[ "protected", "function", "checkUserCountry", "(", ")", "{", "$", "isValid", "=", "true", ";", "$", "payPalPayment", "=", "$", "this", "->", "getPayment", "(", ")", ";", "$", "countries", "=", "$", "payPalPayment", "->", "getCountries", "(", ")", ";", "if...
Checks if user country is among payment countries If payment countries are not set returns true @return bool
[ "Checks", "if", "user", "country", "is", "among", "payment", "countries", "If", "payment", "countries", "are", "not", "set", "returns", "true" ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PaymentValidator.php#L259-L277
train
OXID-eSales/paypal
Model/PaymentValidator.php
PaymentValidator.checkUserGroup
protected function checkUserGroup() { $isValid = true; $payPalPayment = $this->getPayment(); $groups = $payPalPayment->getGroups(); if ($groups && $groups->count() > 0) { $isValid = $this->isUserAssignedToGroup($groups); } return $isValid; }
php
protected function checkUserGroup() { $isValid = true; $payPalPayment = $this->getPayment(); $groups = $payPalPayment->getGroups(); if ($groups && $groups->count() > 0) { $isValid = $this->isUserAssignedToGroup($groups); } return $isValid; }
[ "protected", "function", "checkUserGroup", "(", ")", "{", "$", "isValid", "=", "true", ";", "$", "payPalPayment", "=", "$", "this", "->", "getPayment", "(", ")", ";", "$", "groups", "=", "$", "payPalPayment", "->", "getGroups", "(", ")", ";", "if", "("...
Checks if user belongs group that is assigned to payment If payment does not have any groups assigned returns true @return bool
[ "Checks", "if", "user", "belongs", "group", "that", "is", "assigned", "to", "payment", "If", "payment", "does", "not", "have", "any", "groups", "assigned", "returns", "true" ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PaymentValidator.php#L285-L297
train
OXID-eSales/paypal
Model/PaymentValidator.php
PaymentValidator.isUserAssignedToGroup
protected function isUserAssignedToGroup($groups) { $isValid = false; $user = $this->getUser(); foreach ($groups as $group) { if ($user->inGroup($group->getId())) { $isValid = true; break; } } return $isValid; }
php
protected function isUserAssignedToGroup($groups) { $isValid = false; $user = $this->getUser(); foreach ($groups as $group) { if ($user->inGroup($group->getId())) { $isValid = true; break; } } return $isValid; }
[ "protected", "function", "isUserAssignedToGroup", "(", "$", "groups", ")", "{", "$", "isValid", "=", "false", ";", "$", "user", "=", "$", "this", "->", "getUser", "(", ")", ";", "foreach", "(", "$", "groups", "as", "$", "group", ")", "{", "if", "(", ...
Checks whether user is assigned to given groups array. @param \OxidEsales\Eshop\Core\Model\ListModel $groups @return bool
[ "Checks", "whether", "user", "is", "assigned", "to", "given", "groups", "array", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PaymentValidator.php#L306-L319
train
OXID-eSales/paypal
Model/PaymentValidator.php
PaymentValidator.getShippingCountryId
protected function getShippingCountryId() { $user = $this->getUser(); if ($user->getSelectedAddressId()) { $countryId = $user->getSelectedAddress()->oxaddress__oxcountryid->value; } else { $countryId = $user->oxuser__oxcountryid->value; } return $countryId; }
php
protected function getShippingCountryId() { $user = $this->getUser(); if ($user->getSelectedAddressId()) { $countryId = $user->getSelectedAddress()->oxaddress__oxcountryid->value; } else { $countryId = $user->oxuser__oxcountryid->value; } return $countryId; }
[ "protected", "function", "getShippingCountryId", "(", ")", "{", "$", "user", "=", "$", "this", "->", "getUser", "(", ")", ";", "if", "(", "$", "user", "->", "getSelectedAddressId", "(", ")", ")", "{", "$", "countryId", "=", "$", "user", "->", "getSelec...
Returns shipping country ID. @return string
[ "Returns", "shipping", "country", "ID", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PaymentValidator.php#L326-L336
train
OXID-eSales/paypal
Model/ArticleToExpressCheckoutValidator.php
ArticleToExpressCheckoutValidator.isArticleValid
public function isArticleValid() { $valid = true; if ($this->isArticleAmountZero() || $this->isSameItemInBasket()) { $valid = false; } return $valid; }
php
public function isArticleValid() { $valid = true; if ($this->isArticleAmountZero() || $this->isSameItemInBasket()) { $valid = false; } return $valid; }
[ "public", "function", "isArticleValid", "(", ")", "{", "$", "valid", "=", "true", ";", "if", "(", "$", "this", "->", "isArticleAmountZero", "(", ")", "||", "$", "this", "->", "isSameItemInBasket", "(", ")", ")", "{", "$", "valid", "=", "false", ";", ...
Method returns if article valid @return bool
[ "Method", "returns", "if", "article", "valid" ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/ArticleToExpressCheckoutValidator.php#L88-L96
train
OXID-eSales/paypal
Model/ArticleToExpressCheckoutValidator.php
ArticleToExpressCheckoutValidator.isSameItemInBasket
protected function isSameItemInBasket() { $basketContents = $this->getBasket()->getContents(); foreach ($basketContents as $basketItem) { if ($this->isArticleParamsEqual($basketItem)) { return true; } } return false; }
php
protected function isSameItemInBasket() { $basketContents = $this->getBasket()->getContents(); foreach ($basketContents as $basketItem) { if ($this->isArticleParamsEqual($basketItem)) { return true; } } return false; }
[ "protected", "function", "isSameItemInBasket", "(", ")", "{", "$", "basketContents", "=", "$", "this", "->", "getBasket", "(", ")", "->", "getContents", "(", ")", ";", "foreach", "(", "$", "basketContents", "as", "$", "basketItem", ")", "{", "if", "(", "...
Check if same article is in basket. @return bool
[ "Check", "if", "same", "article", "is", "in", "basket", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/ArticleToExpressCheckoutValidator.php#L103-L113
train
OXID-eSales/paypal
Model/ArticleToExpressCheckoutValidator.php
ArticleToExpressCheckoutValidator.isArticleParamsEqual
protected function isArticleParamsEqual($basketItem) { return ($basketItem->getProductId() == $this->getItemToValidate()->getArticleId() && $basketItem->getPersParams() == $this->getItemToValidate()->getPersistParam() && $basketItem->getSelList() == $this->getItemToValidate()->getSelectList()); }
php
protected function isArticleParamsEqual($basketItem) { return ($basketItem->getProductId() == $this->getItemToValidate()->getArticleId() && $basketItem->getPersParams() == $this->getItemToValidate()->getPersistParam() && $basketItem->getSelList() == $this->getItemToValidate()->getSelectList()); }
[ "protected", "function", "isArticleParamsEqual", "(", "$", "basketItem", ")", "{", "return", "(", "$", "basketItem", "->", "getProductId", "(", ")", "==", "$", "this", "->", "getItemToValidate", "(", ")", "->", "getArticleId", "(", ")", "&&", "$", "basketIte...
Checks if Article params equals with current items params. @param \OxidEsales\Eshop\Application\Model\BasketItem $basketItem @return bool
[ "Checks", "if", "Article", "params", "equals", "with", "current", "items", "params", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/ArticleToExpressCheckoutValidator.php#L122-L127
train
OXID-eSales/paypal
Model/OrderPaymentStatusCalculator.php
OrderPaymentStatusCalculator.getStatus
public function getStatus() { if (is_null($this->getOrder())) { return; } $status = $this->getOrderPaymentStatusFinal(); if (is_null($status)) { $status = $this->getOrderPaymentStatusPaymentValid(); } if (is_null($status)) { $status = $this->getOrderPaymentStatusPayments(); } return $status; }
php
public function getStatus() { if (is_null($this->getOrder())) { return; } $status = $this->getOrderPaymentStatusFinal(); if (is_null($status)) { $status = $this->getOrderPaymentStatusPaymentValid(); } if (is_null($status)) { $status = $this->getOrderPaymentStatusPayments(); } return $status; }
[ "public", "function", "getStatus", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "getOrder", "(", ")", ")", ")", "{", "return", ";", "}", "$", "status", "=", "$", "this", "->", "getOrderPaymentStatusFinal", "(", ")", ";", "if", "(", ...
Returns order payment status which should be set after order creation or IPN. @return string|null
[ "Returns", "order", "payment", "status", "which", "should", "be", "set", "after", "order", "creation", "or", "IPN", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/OrderPaymentStatusCalculator.php#L115-L131
train
OXID-eSales/paypal
Model/OrderPaymentStatusCalculator.php
OrderPaymentStatusCalculator.getSuggestStatus
public function getSuggestStatus($action) { if (is_null($this->getOrder())) { return; } $status = $this->getOrderPaymentStatusPaymentValid(); if (is_null($status)) { $status = $this->getStatusByAction($action); } return $status; }
php
public function getSuggestStatus($action) { if (is_null($this->getOrder())) { return; } $status = $this->getOrderPaymentStatusPaymentValid(); if (is_null($status)) { $status = $this->getStatusByAction($action); } return $status; }
[ "public", "function", "getSuggestStatus", "(", "$", "action", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "getOrder", "(", ")", ")", ")", "{", "return", ";", "}", "$", "status", "=", "$", "this", "->", "getOrderPaymentStatusPaymentValid", "("...
Returns order suggestion for payment status on given action and on given payment. @param string $action - action with order payment: void, refund, capture, refund_partial, capture_partial @return string|null
[ "Returns", "order", "suggestion", "for", "payment", "status", "on", "given", "action", "and", "on", "given", "payment", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/OrderPaymentStatusCalculator.php#L140-L152
train
OXID-eSales/paypal
Model/OrderPaymentStatusCalculator.php
OrderPaymentStatusCalculator.getOrderPaymentStatusFinal
protected function getOrderPaymentStatusFinal() { $status = null; if ($this->isOrderPaymentStatusFinal()) { $status = $this->getOrder()->getPaymentStatus(); } return $status; }
php
protected function getOrderPaymentStatusFinal() { $status = null; if ($this->isOrderPaymentStatusFinal()) { $status = $this->getOrder()->getPaymentStatus(); } return $status; }
[ "protected", "function", "getOrderPaymentStatusFinal", "(", ")", "{", "$", "status", "=", "null", ";", "if", "(", "$", "this", "->", "isOrderPaymentStatusFinal", "(", ")", ")", "{", "$", "status", "=", "$", "this", "->", "getOrder", "(", ")", "->", "getP...
Returns order payment status if order has final status. @return string|null
[ "Returns", "order", "payment", "status", "if", "order", "has", "final", "status", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/OrderPaymentStatusCalculator.php#L159-L167
train
OXID-eSales/paypal
Model/OrderPaymentStatusCalculator.php
OrderPaymentStatusCalculator.getOrderPaymentStatusPaymentValid
protected function getOrderPaymentStatusPaymentValid() { $status = null; $orderPayment = $this->getOrderPayment(); if (isset($orderPayment) && !$orderPayment->getIsValid()) { $status = 'failed'; } return $status; }
php
protected function getOrderPaymentStatusPaymentValid() { $status = null; $orderPayment = $this->getOrderPayment(); if (isset($orderPayment) && !$orderPayment->getIsValid()) { $status = 'failed'; } return $status; }
[ "protected", "function", "getOrderPaymentStatusPaymentValid", "(", ")", "{", "$", "status", "=", "null", ";", "$", "orderPayment", "=", "$", "this", "->", "getOrderPayment", "(", ")", ";", "if", "(", "isset", "(", "$", "orderPayment", ")", "&&", "!", "$", ...
Returns order payment status by checking if set payment is valid. @return string|null
[ "Returns", "order", "payment", "status", "by", "checking", "if", "set", "payment", "is", "valid", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/OrderPaymentStatusCalculator.php#L174-L183
train
OXID-eSales/paypal
Model/OrderPaymentStatusCalculator.php
OrderPaymentStatusCalculator.getOrderPaymentStatusPayments
protected function getOrderPaymentStatusPayments() { $status = 'completed'; $paymentList = $this->getOrder()->getPaymentList(); if ($paymentList->hasPendingPayment()) { $status = 'pending'; } elseif ($paymentList->hasFailedPayment()) { $status = 'failed'; } return $status; }
php
protected function getOrderPaymentStatusPayments() { $status = 'completed'; $paymentList = $this->getOrder()->getPaymentList(); if ($paymentList->hasPendingPayment()) { $status = 'pending'; } elseif ($paymentList->hasFailedPayment()) { $status = 'failed'; } return $status; }
[ "protected", "function", "getOrderPaymentStatusPayments", "(", ")", "{", "$", "status", "=", "'completed'", ";", "$", "paymentList", "=", "$", "this", "->", "getOrder", "(", ")", "->", "getPaymentList", "(", ")", ";", "if", "(", "$", "paymentList", "->", "...
Returns order payment status calculated from existing payments. @return string|null
[ "Returns", "order", "payment", "status", "calculated", "from", "existing", "payments", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/OrderPaymentStatusCalculator.php#L190-L202
train
OXID-eSales/paypal
Model/OrderPaymentStatusCalculator.php
OrderPaymentStatusCalculator.getStatusByAction
protected function getStatusByAction($action) { $status = null; switch ($action) { case 'void': $status = $this->getSuggestStatusOnVoid(); break; case 'refund_partial': case 'reauthorize': $status = $this->getOrder()->getPaymentStatus(); break; case 'refund': case 'capture': case 'capture_partial': $status = 'completed'; break; default: $status = 'completed'; } return $status; }
php
protected function getStatusByAction($action) { $status = null; switch ($action) { case 'void': $status = $this->getSuggestStatusOnVoid(); break; case 'refund_partial': case 'reauthorize': $status = $this->getOrder()->getPaymentStatus(); break; case 'refund': case 'capture': case 'capture_partial': $status = 'completed'; break; default: $status = 'completed'; } return $status; }
[ "protected", "function", "getStatusByAction", "(", "$", "action", ")", "{", "$", "status", "=", "null", ";", "switch", "(", "$", "action", ")", "{", "case", "'void'", ":", "$", "status", "=", "$", "this", "->", "getSuggestStatusOnVoid", "(", ")", ";", ...
Returns order suggestion for payment status on given action. @param string $action performed action. @return string
[ "Returns", "order", "suggestion", "for", "payment", "status", "on", "given", "action", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/OrderPaymentStatusCalculator.php#L211-L232
train
OXID-eSales/paypal
Controller/Admin/DeliverySetMain.php
DeliverySetMain.render
public function render() { $template = parent::render(); $deliverySetId = $this->getEditObjectId(); if ($deliverySetId != "-1" && isset($deliverySetId)) { /** @var \OxidEsales\PayPalModule\Core\Config $config */ $config = oxNew(\OxidEsales\PayPalModule\Core\Config::class); $isPayPalDefaultMobilePayment = ($deliverySetId == $config->getMobileECDefaultShippingId()); $this->_aViewData['isPayPalDefaultMobilePayment'] = $isPayPalDefaultMobilePayment; } return $template; }
php
public function render() { $template = parent::render(); $deliverySetId = $this->getEditObjectId(); if ($deliverySetId != "-1" && isset($deliverySetId)) { /** @var \OxidEsales\PayPalModule\Core\Config $config */ $config = oxNew(\OxidEsales\PayPalModule\Core\Config::class); $isPayPalDefaultMobilePayment = ($deliverySetId == $config->getMobileECDefaultShippingId()); $this->_aViewData['isPayPalDefaultMobilePayment'] = $isPayPalDefaultMobilePayment; } return $template; }
[ "public", "function", "render", "(", ")", "{", "$", "template", "=", "parent", "::", "render", "(", ")", ";", "$", "deliverySetId", "=", "$", "this", "->", "getEditObjectId", "(", ")", ";", "if", "(", "$", "deliverySetId", "!=", "\"-1\"", "&&", "isset"...
Add default PayPal mobile payment. @return string
[ "Add", "default", "PayPal", "mobile", "payment", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/Admin/DeliverySetMain.php#L36-L51
train
OXID-eSales/paypal
Controller/Admin/DeliverySetMain.php
DeliverySetMain.save
public function save() { parent::save(); $config = \OxidEsales\Eshop\Core\Registry::getConfig(); /** @var \OxidEsales\PayPalModule\Core\Config $payPalConfig */ $payPalConfig = oxNew(\OxidEsales\PayPalModule\Core\Config::class); $deliverySetId = $this->getEditObjectId(); $deliverySetMarked = (bool) $config->getRequestParameter('isPayPalDefaultMobilePayment'); $mobileECDefaultShippingId = $payPalConfig->getMobileECDefaultShippingId(); if ($deliverySetMarked && $deliverySetId != $mobileECDefaultShippingId) { $this->saveECDefaultShippingId($config, $deliverySetId, $payPalConfig); } elseif (!$deliverySetMarked && $deliverySetId == $mobileECDefaultShippingId) { $this->saveECDefaultShippingId($config, '', $payPalConfig); } }
php
public function save() { parent::save(); $config = \OxidEsales\Eshop\Core\Registry::getConfig(); /** @var \OxidEsales\PayPalModule\Core\Config $payPalConfig */ $payPalConfig = oxNew(\OxidEsales\PayPalModule\Core\Config::class); $deliverySetId = $this->getEditObjectId(); $deliverySetMarked = (bool) $config->getRequestParameter('isPayPalDefaultMobilePayment'); $mobileECDefaultShippingId = $payPalConfig->getMobileECDefaultShippingId(); if ($deliverySetMarked && $deliverySetId != $mobileECDefaultShippingId) { $this->saveECDefaultShippingId($config, $deliverySetId, $payPalConfig); } elseif (!$deliverySetMarked && $deliverySetId == $mobileECDefaultShippingId) { $this->saveECDefaultShippingId($config, '', $payPalConfig); } }
[ "public", "function", "save", "(", ")", "{", "parent", "::", "save", "(", ")", ";", "$", "config", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getConfig", "(", ")", ";", "/** @var \\OxidEsales\\PayPalModule\\Core\\Config $pay...
Saves default PayPal mobile payment.
[ "Saves", "default", "PayPal", "mobile", "payment", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/Admin/DeliverySetMain.php#L56-L73
train
OXID-eSales/paypal
Controller/Admin/DeliverySetMain.php
DeliverySetMain.saveECDefaultShippingId
protected function saveECDefaultShippingId($config, $shippingId, $payPalConfig) { $payPalModuleId = 'module:' . $payPalConfig->getModuleId(); $config->saveShopConfVar('string', 'sOEPayPalMECDefaultShippingId', $shippingId, null, $payPalModuleId); }
php
protected function saveECDefaultShippingId($config, $shippingId, $payPalConfig) { $payPalModuleId = 'module:' . $payPalConfig->getModuleId(); $config->saveShopConfVar('string', 'sOEPayPalMECDefaultShippingId', $shippingId, null, $payPalModuleId); }
[ "protected", "function", "saveECDefaultShippingId", "(", "$", "config", ",", "$", "shippingId", ",", "$", "payPalConfig", ")", "{", "$", "payPalModuleId", "=", "'module:'", ".", "$", "payPalConfig", "->", "getModuleId", "(", ")", ";", "$", "config", "->", "s...
Save default shipping id. @param \OxidEsales\Eshop\Core\Config $config Config object to save. @param string $shippingId Shipping id. @param \OxidEsales\PayPalModule\Core\Config $payPalConfig PayPal config.
[ "Save", "default", "shipping", "id", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/Admin/DeliverySetMain.php#L82-L86
train
OXID-eSales/paypal
Model/Action/Handler/OrderRefundActionHandler.php
OrderRefundActionHandler.getPayPalRequest
public function getPayPalRequest() { if (is_null($this->payPalRequest)) { $requestBuilder = $this->getPayPalRequestBuilder(); $data = $this->getData(); $requestBuilder->setTransactionId($data->getTransactionId()); $requestBuilder->setAmount($data->getAmount(), $data->getCurrency()); $requestBuilder->setRefundType($data->getType()); $requestBuilder->setComment($data->getComment()); $this->payPalRequest = $requestBuilder->getRequest(); } return $this->payPalRequest; }
php
public function getPayPalRequest() { if (is_null($this->payPalRequest)) { $requestBuilder = $this->getPayPalRequestBuilder(); $data = $this->getData(); $requestBuilder->setTransactionId($data->getTransactionId()); $requestBuilder->setAmount($data->getAmount(), $data->getCurrency()); $requestBuilder->setRefundType($data->getType()); $requestBuilder->setComment($data->getComment()); $this->payPalRequest = $requestBuilder->getRequest(); } return $this->payPalRequest; }
[ "public", "function", "getPayPalRequest", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "payPalRequest", ")", ")", "{", "$", "requestBuilder", "=", "$", "this", "->", "getPayPalRequestBuilder", "(", ")", ";", "$", "data", "=", "$", "this",...
Returns PayPal request; initiates if not set @return \OxidEsales\PayPalModule\Model\PayPalRequest\PayPalRequest
[ "Returns", "PayPal", "request", ";", "initiates", "if", "not", "set" ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Action/Handler/OrderRefundActionHandler.php#L54-L70
train
OXID-eSales/paypal
Controller/StandardDispatcher.php
StandardDispatcher.getTransactionMode
protected function getTransactionMode($basket) { $transactionMode = $this->getPayPalConfig()->getTransactionMode(); if ($transactionMode == "Automatic") { $outOfStockValidator = new \OxidEsales\PayPalModule\Model\OutOfStockValidator(); $outOfStockValidator->setBasket($basket); $outOfStockValidator->setEmptyStockLevel($this->getPayPalConfig()->getEmptyStockLevel()); $transactionMode = ($outOfStockValidator->hasOutOfStockArticles()) ? "Authorization" : "Sale"; return $transactionMode; } return $transactionMode; }
php
protected function getTransactionMode($basket) { $transactionMode = $this->getPayPalConfig()->getTransactionMode(); if ($transactionMode == "Automatic") { $outOfStockValidator = new \OxidEsales\PayPalModule\Model\OutOfStockValidator(); $outOfStockValidator->setBasket($basket); $outOfStockValidator->setEmptyStockLevel($this->getPayPalConfig()->getEmptyStockLevel()); $transactionMode = ($outOfStockValidator->hasOutOfStockArticles()) ? "Authorization" : "Sale"; return $transactionMode; } return $transactionMode; }
[ "protected", "function", "getTransactionMode", "(", "$", "basket", ")", "{", "$", "transactionMode", "=", "$", "this", "->", "getPayPalConfig", "(", ")", "->", "getTransactionMode", "(", ")", ";", "if", "(", "$", "transactionMode", "==", "\"Automatic\"", ")", ...
Returns transaction mode. @param \OxidEsales\Eshop\Application\Model\Basket $basket @return string
[ "Returns", "transaction", "mode", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/StandardDispatcher.php#L102-L117
train
OXID-eSales/paypal
Controller/StandardDispatcher.php
StandardDispatcher.getReturnUrl
protected function getReturnUrl() { $controllerKey = \OxidEsales\Eshop\Core\Registry::getControllerClassNameResolver()->getIdByClassName(get_class()); return $this->getSession()->processUrl($this->getBaseUrl() . "&cl=" . $controllerKey . "&fnc=getExpressCheckoutDetails"); }
php
protected function getReturnUrl() { $controllerKey = \OxidEsales\Eshop\Core\Registry::getControllerClassNameResolver()->getIdByClassName(get_class()); return $this->getSession()->processUrl($this->getBaseUrl() . "&cl=" . $controllerKey . "&fnc=getExpressCheckoutDetails"); }
[ "protected", "function", "getReturnUrl", "(", ")", "{", "$", "controllerKey", "=", "\\", "OxidEsales", "\\", "Eshop", "\\", "Core", "\\", "Registry", "::", "getControllerClassNameResolver", "(", ")", "->", "getIdByClassName", "(", "get_class", "(", ")", ")", "...
Returns RETURN URL @return string
[ "Returns", "RETURN", "URL" ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/StandardDispatcher.php#L164-L168
train
OXID-eSales/paypal
Core/ShopLogo.php
ShopLogo.getResize
protected function getResize() { $resize = false; $imagePath = $this->getImagePath(); if ($imagePath) { $imageSize = $this->getImageSize($imagePath); if ($imageSize['width'] > $this->getWidth() || $imageSize['height'] > $this->getHeight() ) { $resize = true; } } return $resize; }
php
protected function getResize() { $resize = false; $imagePath = $this->getImagePath(); if ($imagePath) { $imageSize = $this->getImageSize($imagePath); if ($imageSize['width'] > $this->getWidth() || $imageSize['height'] > $this->getHeight() ) { $resize = true; } } return $resize; }
[ "protected", "function", "getResize", "(", ")", "{", "$", "resize", "=", "false", ";", "$", "imagePath", "=", "$", "this", "->", "getImagePath", "(", ")", ";", "if", "(", "$", "imagePath", ")", "{", "$", "imageSize", "=", "$", "this", "->", "getImage...
Calculates if logo should be resized. @return bool
[ "Calculates", "if", "logo", "should", "be", "resized", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/ShopLogo.php#L150-L165
train
OXID-eSales/paypal
Core/ShopLogo.php
ShopLogo.getResizedImageName
protected function getResizedImageName() { $resizedImageName = ""; if ($this->getImageName()) { $resizedImageName = $this->_suffix . $this->getImageName(); } return $resizedImageName; }
php
protected function getResizedImageName() { $resizedImageName = ""; if ($this->getImageName()) { $resizedImageName = $this->_suffix . $this->getImageName(); } return $resizedImageName; }
[ "protected", "function", "getResizedImageName", "(", ")", "{", "$", "resizedImageName", "=", "\"\"", ";", "if", "(", "$", "this", "->", "getImageName", "(", ")", ")", "{", "$", "resizedImageName", "=", "$", "this", "->", "_suffix", ".", "$", "this", "->"...
Gives new name for image to be resized. @return string
[ "Gives", "new", "name", "for", "image", "to", "be", "resized", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/ShopLogo.php#L232-L240
train
OXID-eSales/paypal
Core/ShopLogo.php
ShopLogo.getShopLogoUrl
public function getShopLogoUrl() { $imagePath = $this->getImageUrl(); $resizedImagePath = $this->getResizedImageUrl(); if ($this->getResize()) { $shopLogoPath = $resizedImagePath; if (!$this->fileExists($resizedImagePath)) { if (!$this->resizeImage()) { // fallback to original image if can not be resized $shopLogoPath = $imagePath; } } } else { $shopLogoPath = $imagePath; } return $shopLogoPath; }
php
public function getShopLogoUrl() { $imagePath = $this->getImageUrl(); $resizedImagePath = $this->getResizedImageUrl(); if ($this->getResize()) { $shopLogoPath = $resizedImagePath; if (!$this->fileExists($resizedImagePath)) { if (!$this->resizeImage()) { // fallback to original image if can not be resized $shopLogoPath = $imagePath; } } } else { $shopLogoPath = $imagePath; } return $shopLogoPath; }
[ "public", "function", "getShopLogoUrl", "(", ")", "{", "$", "imagePath", "=", "$", "this", "->", "getImageUrl", "(", ")", ";", "$", "resizedImagePath", "=", "$", "this", "->", "getResizedImageUrl", "(", ")", ";", "if", "(", "$", "this", "->", "getResize"...
Get logo image path for PayPal express checkout. @return string
[ "Get", "logo", "image", "path", "for", "PayPal", "express", "checkout", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/ShopLogo.php#L316-L335
train
OXID-eSales/paypal
Core/ShopLogo.php
ShopLogo.resizeImage
protected function resizeImage() { $resized = false; if ($utilsPic = $this->getImageHandler()) { // checks if image can be resized, and resizes the image if ($utilsPic->resizeImage($this->getImagePath(), $this->getResizedImagePath(), $this->getWidth(), $this->getHeight())) { $resized = true; } } return $resized; }
php
protected function resizeImage() { $resized = false; if ($utilsPic = $this->getImageHandler()) { // checks if image can be resized, and resizes the image if ($utilsPic->resizeImage($this->getImagePath(), $this->getResizedImagePath(), $this->getWidth(), $this->getHeight())) { $resized = true; } } return $resized; }
[ "protected", "function", "resizeImage", "(", ")", "{", "$", "resized", "=", "false", ";", "if", "(", "$", "utilsPic", "=", "$", "this", "->", "getImageHandler", "(", ")", ")", "{", "// checks if image can be resized, and resizes the image", "if", "(", "$", "ut...
Resizes logo if needed to the size provided Returns false when image does'nt exist, or can't be resized Returns original image name when image is within boundaries Returns resized image name when image is too large than defined @return bool
[ "Resizes", "logo", "if", "needed", "to", "the", "size", "provided", "Returns", "false", "when", "image", "does", "nt", "exist", "or", "can", "t", "be", "resized", "Returns", "original", "image", "name", "when", "image", "is", "within", "boundaries", "Returns...
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/ShopLogo.php#L374-L386
train
OXID-eSales/paypal
Controller/OrderController.php
OrderController.getOrder
protected function getOrder() { $order = oxNew(\OxidEsales\Eshop\Application\Model\Order::class); $order->load($this->getSession()->getVariable('sess_challenge')); return $order; }
php
protected function getOrder() { $order = oxNew(\OxidEsales\Eshop\Application\Model\Order::class); $order->load($this->getSession()->getVariable('sess_challenge')); return $order; }
[ "protected", "function", "getOrder", "(", ")", "{", "$", "order", "=", "oxNew", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Application", "\\", "Model", "\\", "Order", "::", "class", ")", ";", "$", "order", "->", "load", "(", "$", "this", "->", "g...
Returns current order object @return \OxidEsales\Eshop\Application\Model\Order
[ "Returns", "current", "order", "object" ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/OrderController.php#L92-L98
train
OXID-eSales/paypal
Controller/OrderController.php
OrderController.getNextStep
protected function getNextStep($success) { $nextStep = parent::_getNextStep($success); // Detecting PayPal & loading order & execute payment only if go wrong if ($this->isPayPal() && ($success == \OxidEsales\Eshop\Application\Model\Order::ORDER_STATE_PAYMENTERROR)) { $payPalType = (int) $this->getSession()->getVariable("oepaypal"); $nextStep = ($payPalType == 2) ? "basket" : "order"; } return $nextStep; }
php
protected function getNextStep($success) { $nextStep = parent::_getNextStep($success); // Detecting PayPal & loading order & execute payment only if go wrong if ($this->isPayPal() && ($success == \OxidEsales\Eshop\Application\Model\Order::ORDER_STATE_PAYMENTERROR)) { $payPalType = (int) $this->getSession()->getVariable("oepaypal"); $nextStep = ($payPalType == 2) ? "basket" : "order"; } return $nextStep; }
[ "protected", "function", "getNextStep", "(", "$", "success", ")", "{", "$", "nextStep", "=", "parent", "::", "_getNextStep", "(", "$", "success", ")", ";", "// Detecting PayPal & loading order & execute payment only if go wrong", "if", "(", "$", "this", "->", "isPay...
Checks if order payment is PayPal and redirects to payment processing part. @param int $success order state @return string
[ "Checks", "if", "order", "payment", "is", "PayPal", "and", "redirects", "to", "payment", "processing", "part", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/OrderController.php#L107-L118
train
OXID-eSales/paypal
Core/Curl.php
Curl.getHeader
public function getHeader() { if (is_null($this->header)) { $host = $this->getHost(); $header = array(); $header[] = 'POST /cgi-bin/webscr HTTP/1.1'; $header[] = 'Content-Type: application/x-www-form-urlencoded'; if (isset($host)) { $header[] = 'Host: ' . $host; } $header[] = 'Connection: close'; $this->setHeader($header); } return $this->header; }
php
public function getHeader() { if (is_null($this->header)) { $host = $this->getHost(); $header = array(); $header[] = 'POST /cgi-bin/webscr HTTP/1.1'; $header[] = 'Content-Type: application/x-www-form-urlencoded'; if (isset($host)) { $header[] = 'Host: ' . $host; } $header[] = 'Connection: close'; $this->setHeader($header); } return $this->header; }
[ "public", "function", "getHeader", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "header", ")", ")", "{", "$", "host", "=", "$", "this", "->", "getHost", "(", ")", ";", "$", "header", "=", "array", "(", ")", ";", "$", "header", "...
Forms header from host. @return array
[ "Forms", "header", "from", "host", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Curl.php#L140-L157
train
OXID-eSales/paypal
Core/Curl.php
Curl.setUrlToCall
public function setUrlToCall($urlToCall) { if (false === filter_var($urlToCall, FILTER_VALIDATE_URL)) { /** * @var \OxidEsales\PayPalModule\Core\Exception\PayPalException $exception */ $exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalException::class, 'URL to call is not valid.'); throw $exception; } $this->urlToCall = $urlToCall; }
php
public function setUrlToCall($urlToCall) { if (false === filter_var($urlToCall, FILTER_VALIDATE_URL)) { /** * @var \OxidEsales\PayPalModule\Core\Exception\PayPalException $exception */ $exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalException::class, 'URL to call is not valid.'); throw $exception; } $this->urlToCall = $urlToCall; }
[ "public", "function", "setUrlToCall", "(", "$", "urlToCall", ")", "{", "if", "(", "false", "===", "filter_var", "(", "$", "urlToCall", ",", "FILTER_VALIDATE_URL", ")", ")", "{", "/**\n * @var \\OxidEsales\\PayPalModule\\Core\\Exception\\PayPalException $exceptio...
Set PayPal URL to call. @param string $urlToCall PayPal URL to call. @throws \OxidEsales\PayPalModule\Core\Exception\PayPalException if url is not valid
[ "Set", "PayPal", "URL", "to", "call", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Curl.php#L275-L285
train
OXID-eSales/paypal
Core/Curl.php
Curl.setOptions
protected function setOptions() { foreach ($this->getEnvironmentParameters() as $name => $value) { $this->setOption(constant($name), $value); } $this->setOption(CURLOPT_HTTPHEADER, $this->getHeader()); $this->setOption(CURLOPT_URL, $this->getUrlToCall()); $this->setOption(CURLOPT_POSTFIELDS, $this->getQuery()); }
php
protected function setOptions() { foreach ($this->getEnvironmentParameters() as $name => $value) { $this->setOption(constant($name), $value); } $this->setOption(CURLOPT_HTTPHEADER, $this->getHeader()); $this->setOption(CURLOPT_URL, $this->getUrlToCall()); $this->setOption(CURLOPT_POSTFIELDS, $this->getQuery()); }
[ "protected", "function", "setOptions", "(", ")", "{", "foreach", "(", "$", "this", "->", "getEnvironmentParameters", "(", ")", "as", "$", "name", "=>", "$", "value", ")", "{", "$", "this", "->", "setOption", "(", "constant", "(", "$", "name", ")", ",",...
Set Curl Parameters.
[ "Set", "Curl", "Parameters", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Curl.php#L340-L349
train
OXID-eSales/paypal
Core/Curl.php
Curl.curlExecute
protected function curlExecute() { $response = curl_exec($this->getResource()); $curlErrorNumber = $this->getErrorNumber(); if ($curlErrorNumber) { /** * @var \OxidEsales\PayPalModule\Core\Exception\PayPalException $exception */ $exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalException::class, 'Curl error: ' . $curlErrorNumber); throw $exception; } return $response; }
php
protected function curlExecute() { $response = curl_exec($this->getResource()); $curlErrorNumber = $this->getErrorNumber(); if ($curlErrorNumber) { /** * @var \OxidEsales\PayPalModule\Core\Exception\PayPalException $exception */ $exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalException::class, 'Curl error: ' . $curlErrorNumber); throw $exception; } return $response; }
[ "protected", "function", "curlExecute", "(", ")", "{", "$", "response", "=", "curl_exec", "(", "$", "this", "->", "getResource", "(", ")", ")", ";", "$", "curlErrorNumber", "=", "$", "this", "->", "getErrorNumber", "(", ")", ";", "if", "(", "$", "curlE...
Wrapper function to be mocked for testing. @return string @throws \OxidEsales\PayPalModule\Core\Exception\PayPalException on curl errors
[ "Wrapper", "function", "to", "be", "mocked", "for", "testing", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Curl.php#L369-L383
train
OXID-eSales/paypal
Core/Curl.php
Curl.parseResponse
protected function parseResponse($response) { $result = []; // processing results parse_str($response, $result); // stripping slashes $result = array_map(array($this, 'decode'), $result); return $result; }
php
protected function parseResponse($response) { $result = []; // processing results parse_str($response, $result); // stripping slashes $result = array_map(array($this, 'decode'), $result); return $result; }
[ "protected", "function", "parseResponse", "(", "$", "response", ")", "{", "$", "result", "=", "[", "]", ";", "// processing results", "parse_str", "(", "$", "response", ",", "$", "result", ")", ";", "// stripping slashes", "$", "result", "=", "array_map", "(...
Parse curl response and strip it to safe form. @param string $response curl response. @return array
[ "Parse", "curl", "response", "and", "strip", "it", "to", "safe", "form", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Curl.php#L400-L411
train
OXID-eSales/paypal
Core/Logger.php
Logger.log
public function log($logData) { $handle = fopen($this->getLogFilePath(), "a+"); if ($handle !== false) { if (is_string($logData)) { parse_str($logData, $result); } else { $result = $logData; } if (is_array($result)) { foreach ($result as $key => $value) { if (is_string($value)) { $result[$key] = urldecode($value); } } } fwrite($handle, "======================= " . $this->getTitle() . " [" . date("Y-m-d H:i:s") . "] ======================= #\n\n"); fwrite($handle, "SESS ID: " . $this->getLoggerSessionId() . "\n"); fwrite($handle, trim(var_export($result, true)) . "\n\n"); fclose($handle); } //resetting log title $this->setTitle(''); }
php
public function log($logData) { $handle = fopen($this->getLogFilePath(), "a+"); if ($handle !== false) { if (is_string($logData)) { parse_str($logData, $result); } else { $result = $logData; } if (is_array($result)) { foreach ($result as $key => $value) { if (is_string($value)) { $result[$key] = urldecode($value); } } } fwrite($handle, "======================= " . $this->getTitle() . " [" . date("Y-m-d H:i:s") . "] ======================= #\n\n"); fwrite($handle, "SESS ID: " . $this->getLoggerSessionId() . "\n"); fwrite($handle, trim(var_export($result, true)) . "\n\n"); fclose($handle); } //resetting log title $this->setTitle(''); }
[ "public", "function", "log", "(", "$", "logData", ")", "{", "$", "handle", "=", "fopen", "(", "$", "this", "->", "getLogFilePath", "(", ")", ",", "\"a+\"", ")", ";", "if", "(", "$", "handle", "!==", "false", ")", "{", "if", "(", "is_string", "(", ...
Writes log message. @param mixed $logData logger data
[ "Writes", "log", "message", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Logger.php#L98-L124
train
OXID-eSales/paypal
Core/PayPalCheckValidator.php
PayPalCheckValidator.isPayPalCheckValid
public function isPayPalCheckValid() { $newBasketAmount = $this->getNewBasketAmount(); $prevBasketAmount = $this->getOldBasketAmount(); // check only if new price is different and bigger than old price if ($newBasketAmount > $prevBasketAmount) { return false; } return true; }
php
public function isPayPalCheckValid() { $newBasketAmount = $this->getNewBasketAmount(); $prevBasketAmount = $this->getOldBasketAmount(); // check only if new price is different and bigger than old price if ($newBasketAmount > $prevBasketAmount) { return false; } return true; }
[ "public", "function", "isPayPalCheckValid", "(", ")", "{", "$", "newBasketAmount", "=", "$", "this", "->", "getNewBasketAmount", "(", ")", ";", "$", "prevBasketAmount", "=", "$", "this", "->", "getOldBasketAmount", "(", ")", ";", "// check only if new price is dif...
Returns if order should be rechecked by PayPal @return bool
[ "Returns", "if", "order", "should", "be", "rechecked", "by", "PayPal" ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/PayPalCheckValidator.php#L49-L59
train
OXID-eSales/paypal
Controller/PaymentController.php
PaymentController.isConfirmedByPayPal
public function isConfirmedByPayPal($basket) { $oldBasketAmount = $this->getSession()->getVariable("oepaypal-basketAmount"); if (!$oldBasketAmount) { return false; } $payPalCheckValidator = oxNew(\OxidEsales\PayPalModule\Core\PayPalCheckValidator::class); $payPalCheckValidator->setNewBasketAmount($basket->getPrice()->getBruttoPrice()); $payPalCheckValidator->setOldBasketAmount($oldBasketAmount); return $payPalCheckValidator->isPayPalCheckValid(); }
php
public function isConfirmedByPayPal($basket) { $oldBasketAmount = $this->getSession()->getVariable("oepaypal-basketAmount"); if (!$oldBasketAmount) { return false; } $payPalCheckValidator = oxNew(\OxidEsales\PayPalModule\Core\PayPalCheckValidator::class); $payPalCheckValidator->setNewBasketAmount($basket->getPrice()->getBruttoPrice()); $payPalCheckValidator->setOldBasketAmount($oldBasketAmount); return $payPalCheckValidator->isPayPalCheckValid(); }
[ "public", "function", "isConfirmedByPayPal", "(", "$", "basket", ")", "{", "$", "oldBasketAmount", "=", "$", "this", "->", "getSession", "(", ")", "->", "getVariable", "(", "\"oepaypal-basketAmount\"", ")", ";", "if", "(", "!", "$", "oldBasketAmount", ")", "...
Detects if current payment was already successfully processed by PayPal @param \OxidEsales\Eshop\Application\Model\Basket $basket basket object @return bool
[ "Detects", "if", "current", "payment", "was", "already", "successfully", "processed", "by", "PayPal" ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/PaymentController.php#L59-L71
train
OXID-eSales/paypal
Core/Model.php
Model.delete
public function delete($id = null) { if (!is_null($id)) { $this->setId($id); } return $this->getDbGateway()->delete($this->getId()); }
php
public function delete($id = null) { if (!is_null($id)) { $this->setId($id); } return $this->getDbGateway()->delete($this->getId()); }
[ "public", "function", "delete", "(", "$", "id", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "id", ")", ")", "{", "$", "this", "->", "setId", "(", "$", "id", ")", ";", "}", "return", "$", "this", "->", "getDbGateway", "(", ")", ...
Delete model data from db. @param string $id model id @return bool
[ "Delete", "model", "data", "from", "db", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Model.php#L133-L140
train
OXID-eSales/paypal
Core/Model.php
Model.load
public function load($id = null) { if (!is_null($id)) { $this->setId($id); } $this->isLoaded = false; $data = $this->getDbGateway()->load($this->getId()); if ($data) { $this->setData($data); $this->isLoaded = true; } return $this->isLoaded(); }
php
public function load($id = null) { if (!is_null($id)) { $this->setId($id); } $this->isLoaded = false; $data = $this->getDbGateway()->load($this->getId()); if ($data) { $this->setData($data); $this->isLoaded = true; } return $this->isLoaded(); }
[ "public", "function", "load", "(", "$", "id", "=", "null", ")", "{", "if", "(", "!", "is_null", "(", "$", "id", ")", ")", "{", "$", "this", "->", "setId", "(", "$", "id", ")", ";", "}", "$", "this", "->", "isLoaded", "=", "false", ";", "$", ...
Method for loading model, if loaded returns true. @param string $id model id @return bool
[ "Method", "for", "loading", "model", "if", "loaded", "returns", "true", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Model.php#L149-L163
train
OXID-eSales/paypal
Model/OrderManager.php
OrderManager.getOrder
public function getOrder() { if ($this->order === null) { $orderPayment = $this->getOrderPayment(); $order = $this->getOrderFromPayment($orderPayment); $this->setOrder($order); } return $this->order; }
php
public function getOrder() { if ($this->order === null) { $orderPayment = $this->getOrderPayment(); $order = $this->getOrderFromPayment($orderPayment); $this->setOrder($order); } return $this->order; }
[ "public", "function", "getOrder", "(", ")", "{", "if", "(", "$", "this", "->", "order", "===", "null", ")", "{", "$", "orderPayment", "=", "$", "this", "->", "getOrderPayment", "(", ")", ";", "$", "order", "=", "$", "this", "->", "getOrderFromPayment",...
Create object \OxidEsales\PayPalModule\Model\PayPalOrder. If Order is not set, create order from Order Payment. @return \OxidEsales\PayPalModule\Model\PayPalOrder
[ "Create", "object", "\\", "OxidEsales", "\\", "PayPalModule", "\\", "Model", "\\", "PayPalOrder", ".", "If", "Order", "is", "not", "set", "create", "order", "from", "Order", "Payment", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/OrderManager.php#L85-L94
train
OXID-eSales/paypal
Model/OrderManager.php
OrderManager.getOrderPaymentStatusCalculator
public function getOrderPaymentStatusCalculator() { if (is_null($this->orderPaymentStatusCalculator)) { $orderPaymentStatusCalculator = oxNew(\OxidEsales\PayPalModule\Model\OrderPaymentStatusCalculator::class); $this->setOrderPaymentStatusCalculator($orderPaymentStatusCalculator); } return $this->orderPaymentStatusCalculator; }
php
public function getOrderPaymentStatusCalculator() { if (is_null($this->orderPaymentStatusCalculator)) { $orderPaymentStatusCalculator = oxNew(\OxidEsales\PayPalModule\Model\OrderPaymentStatusCalculator::class); $this->setOrderPaymentStatusCalculator($orderPaymentStatusCalculator); } return $this->orderPaymentStatusCalculator; }
[ "public", "function", "getOrderPaymentStatusCalculator", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "orderPaymentStatusCalculator", ")", ")", "{", "$", "orderPaymentStatusCalculator", "=", "oxNew", "(", "\\", "OxidEsales", "\\", "PayPalModule", "...
Returns \OxidEsales\PayPalModule\Model\OrderPaymentStatusCalculator. @return \OxidEsales\PayPalModule\Model\OrderPaymentStatusCalculator
[ "Returns", "\\", "OxidEsales", "\\", "PayPalModule", "\\", "Model", "\\", "OrderPaymentStatusCalculator", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/OrderManager.php#L111-L119
train
OXID-eSales/paypal
Model/OrderManager.php
OrderManager.getOrderPaymentListCalculator
public function getOrderPaymentListCalculator() { if (is_null($this->orderPaymentListCalculator)) { $orderPaymentListCalculator = oxNew(\OxidEsales\PayPalModule\Model\OrderPaymentListCalculator::class); $this->setOrderPaymentListCalculator($orderPaymentListCalculator); } return $this->orderPaymentListCalculator; }
php
public function getOrderPaymentListCalculator() { if (is_null($this->orderPaymentListCalculator)) { $orderPaymentListCalculator = oxNew(\OxidEsales\PayPalModule\Model\OrderPaymentListCalculator::class); $this->setOrderPaymentListCalculator($orderPaymentListCalculator); } return $this->orderPaymentListCalculator; }
[ "public", "function", "getOrderPaymentListCalculator", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "orderPaymentListCalculator", ")", ")", "{", "$", "orderPaymentListCalculator", "=", "oxNew", "(", "\\", "OxidEsales", "\\", "PayPalModule", "\\", ...
Returns \OxidEsales\PayPalModule\Model\OrderPaymentListCalculator. @return \OxidEsales\PayPalModule\Model\OrderPaymentListCalculator
[ "Returns", "\\", "OxidEsales", "\\", "PayPalModule", "\\", "Model", "\\", "OrderPaymentListCalculator", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/OrderManager.php#L136-L144
train
OXID-eSales/paypal
Model/OrderManager.php
OrderManager.updateOrderStatus
public function updateOrderStatus() { $orderUpdated = false; $order = $this->getOrder(); if (!is_null($order)) { $orderPayment = $this->getOrderPayment(); $order = $this->recalculateAmounts($order); $newOrderStatus = $this->calculateOrderStatus($orderPayment, $order); $this->persistNewOrderStatus($order, $newOrderStatus); $orderUpdated = true; } return $orderUpdated; }
php
public function updateOrderStatus() { $orderUpdated = false; $order = $this->getOrder(); if (!is_null($order)) { $orderPayment = $this->getOrderPayment(); $order = $this->recalculateAmounts($order); $newOrderStatus = $this->calculateOrderStatus($orderPayment, $order); $this->persistNewOrderStatus($order, $newOrderStatus); $orderUpdated = true; } return $orderUpdated; }
[ "public", "function", "updateOrderStatus", "(", ")", "{", "$", "orderUpdated", "=", "false", ";", "$", "order", "=", "$", "this", "->", "getOrder", "(", ")", ";", "if", "(", "!", "is_null", "(", "$", "order", ")", ")", "{", "$", "orderPayment", "=", ...
Update order manager to status get from order status calculator. @return bool
[ "Update", "order", "manager", "to", "status", "get", "from", "order", "status", "calculator", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/OrderManager.php#L151-L165
train
OXID-eSales/paypal
Model/OrderManager.php
OrderManager.calculateOrderStatus
protected function calculateOrderStatus($orderPayment, $order) { $orderPaymentStatusCalculator = $this->getOrderPaymentStatusCalculator(); $orderPaymentStatusCalculator->setOrderPayment($orderPayment); $orderPaymentStatusCalculator->setOrder($order); $newOrderStatus = $orderPaymentStatusCalculator->getStatus(); return $newOrderStatus; }
php
protected function calculateOrderStatus($orderPayment, $order) { $orderPaymentStatusCalculator = $this->getOrderPaymentStatusCalculator(); $orderPaymentStatusCalculator->setOrderPayment($orderPayment); $orderPaymentStatusCalculator->setOrder($order); $newOrderStatus = $orderPaymentStatusCalculator->getStatus(); return $newOrderStatus; }
[ "protected", "function", "calculateOrderStatus", "(", "$", "orderPayment", ",", "$", "order", ")", "{", "$", "orderPaymentStatusCalculator", "=", "$", "this", "->", "getOrderPaymentStatusCalculator", "(", ")", ";", "$", "orderPaymentStatusCalculator", "->", "setOrderP...
Wrapper for order payment calculator. @param \OxidEsales\PayPalModule\Model\OrderPayment $orderPayment Order payment to set to calculator. @param \OxidEsales\PayPalModule\Model\PayPalOrder $order Order to be set to validator. @return null|string
[ "Wrapper", "for", "order", "payment", "calculator", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/OrderManager.php#L200-L209
train
OXID-eSales/paypal
Model/OrderManager.php
OrderManager.getOrderFromPayment
protected function getOrderFromPayment($orderPayment) { $orderId = null; $order = null; if (!is_null($orderPayment)) { $orderId = $orderPayment->getOrderId(); } if (!is_null($orderId)) { $order = oxNew(\OxidEsales\PayPalModule\Model\PayPalOrder::class); $order->setOrderId($orderId); $order->load(); } return $order; }
php
protected function getOrderFromPayment($orderPayment) { $orderId = null; $order = null; if (!is_null($orderPayment)) { $orderId = $orderPayment->getOrderId(); } if (!is_null($orderId)) { $order = oxNew(\OxidEsales\PayPalModule\Model\PayPalOrder::class); $order->setOrderId($orderId); $order->load(); } return $order; }
[ "protected", "function", "getOrderFromPayment", "(", "$", "orderPayment", ")", "{", "$", "orderId", "=", "null", ";", "$", "order", "=", "null", ";", "if", "(", "!", "is_null", "(", "$", "orderPayment", ")", ")", "{", "$", "orderId", "=", "$", "orderPa...
Load order by order id from order payment. @param \OxidEsales\PayPalModule\Model\OrderPayment $orderPayment order payment to get order id. @return \OxidEsales\PayPalModule\Model\PayPalOrder|null
[ "Load", "order", "by", "order", "id", "from", "order", "payment", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/OrderManager.php#L230-L244
train
OXID-eSales/paypal
Model/OrderPaymentList.php
OrderPaymentList.hasPaymentWithStatus
protected function hasPaymentWithStatus($status) { $hasStatus = false; $payments = $this->getArray(); foreach ($payments as $payment) { if ($status == $payment->getStatus()) { $hasStatus = true; break; } } return $hasStatus; }
php
protected function hasPaymentWithStatus($status) { $hasStatus = false; $payments = $this->getArray(); foreach ($payments as $payment) { if ($status == $payment->getStatus()) { $hasStatus = true; break; } } return $hasStatus; }
[ "protected", "function", "hasPaymentWithStatus", "(", "$", "status", ")", "{", "$", "hasStatus", "=", "false", ";", "$", "payments", "=", "$", "this", "->", "getArray", "(", ")", ";", "foreach", "(", "$", "payments", "as", "$", "payment", ")", "{", "if...
Check if list has payment with defined status. @param string $status Payment status. @return bool
[ "Check", "if", "list", "has", "payment", "with", "defined", "status", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/OrderPaymentList.php#L115-L128
train
OXID-eSales/paypal
Model/PayPalRequest/PayPalRequestBuilder.php
PayPalRequestBuilder.getRequest
public function getRequest() { if ($this->request === null) { $this->request = oxNew(\OxidEsales\PayPalModule\Model\PayPalRequest\PayPalRequest::class); } return $this->request; }
php
public function getRequest() { if ($this->request === null) { $this->request = oxNew(\OxidEsales\PayPalModule\Model\PayPalRequest\PayPalRequest::class); } return $this->request; }
[ "public", "function", "getRequest", "(", ")", "{", "if", "(", "$", "this", "->", "request", "===", "null", ")", "{", "$", "this", "->", "request", "=", "oxNew", "(", "\\", "OxidEsales", "\\", "PayPalModule", "\\", "Model", "\\", "PayPalRequest", "\\", ...
Return request object. @return \OxidEsales\PayPalModule\Model\PayPalRequest\PayPalRequest
[ "Return", "request", "object", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/PayPalRequestBuilder.php#L107-L114
train
OXID-eSales/paypal
Core/FullName.php
FullName.split
protected function split($fullName) { $names = explode(" ", trim($fullName), 2); $this->firstName = trim($names[0]); $this->lastName = trim($names[1]); }
php
protected function split($fullName) { $names = explode(" ", trim($fullName), 2); $this->firstName = trim($names[0]); $this->lastName = trim($names[1]); }
[ "protected", "function", "split", "(", "$", "fullName", ")", "{", "$", "names", "=", "explode", "(", "\" \"", ",", "trim", "(", "$", "fullName", ")", ",", "2", ")", ";", "$", "this", "->", "firstName", "=", "trim", "(", "$", "names", "[", "0", "]...
Split user full name to first name and second name. @param string $fullName
[ "Split", "user", "full", "name", "to", "first", "name", "and", "second", "name", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/FullName.php#L72-L78
train
OXID-eSales/paypal
Model/Action/Data/OrderCaptureActionData.php
OrderCaptureActionData.getAmount
public function getAmount() { $amount = $this->getRequest()->getRequestParameter('capture_amount'); return $amount ? $amount : $this->getOrder()->getPayPalOrder()->getRemainingOrderSum(); }
php
public function getAmount() { $amount = $this->getRequest()->getRequestParameter('capture_amount'); return $amount ? $amount : $this->getOrder()->getPayPalOrder()->getRemainingOrderSum(); }
[ "public", "function", "getAmount", "(", ")", "{", "$", "amount", "=", "$", "this", "->", "getRequest", "(", ")", "->", "getRequestParameter", "(", "'capture_amount'", ")", ";", "return", "$", "amount", "?", "$", "amount", ":", "$", "this", "->", "getOrde...
returns action amount @return string
[ "returns", "action", "amount" ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Action/Data/OrderCaptureActionData.php#L44-L49
train
OXID-eSales/paypal
Model/PaymentGateway.php
PaymentGateway.getPayPalOxOrder
public function getPayPalOxOrder() { if (is_null($this->payPalOxOrder)) { $order = oxNew(\OxidEsales\Eshop\Application\Model\Order::class); $order->loadPayPalOrder(); $this->setPayPalOxOrder($order); } return $this->payPalOxOrder; }
php
public function getPayPalOxOrder() { if (is_null($this->payPalOxOrder)) { $order = oxNew(\OxidEsales\Eshop\Application\Model\Order::class); $order->loadPayPalOrder(); $this->setPayPalOxOrder($order); } return $this->payPalOxOrder; }
[ "public", "function", "getPayPalOxOrder", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "payPalOxOrder", ")", ")", "{", "$", "order", "=", "oxNew", "(", "\\", "OxidEsales", "\\", "Eshop", "\\", "Application", "\\", "Model", "\\", "Order", ...
Gets order. @return \OxidEsales\Eshop\Application\Model\Order
[ "Gets", "order", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PaymentGateway.php#L68-L77
train
OXID-eSales/paypal
Model/PaymentGateway.php
PaymentGateway.doExpressCheckoutPayment
public function doExpressCheckoutPayment() { $success = false; $order = $this->getPayPalOrder(); try { // updating order state if ($order) { $order->oePayPalUpdateOrderNumber(); $session = $this->getSession(); $basket = $session->getBasket(); $transactionMode = $this->getTransactionMode($basket); $builder = oxNew(\OxidEsales\PayPalModule\Model\PayPalRequest\DoExpressCheckoutPaymentRequestBuilder::class); $builder->setPayPalConfig($this->getPayPalConfig()); $builder->setSession($session); $builder->setBasket($basket); $builder->setTransactionMode($transactionMode); $builder->setUser($this->getPayPalUser()); $builder->setOrder($order); $request = $builder->buildRequest(); $payPalService = $this->getPayPalCheckoutService(); $result = $payPalService->doExpressCheckoutPayment($request); $order->finalizePayPalOrder( $result, $session->getBasket(), $transactionMode ); $success = true; } else { /** * @var $exception \OxidEsales\Eshop\Core\Exception\StandardException */ $exception = oxNew(\OxidEsales\Eshop\Core\Exception\StandardException::class, 'OEPAYPAL_ORDER_ERROR'); throw $exception; } } catch (\OxidEsales\Eshop\Core\Exception\StandardException $exception) { // deleting order on error if ($order) { $order->deletePayPalOrder(); } $this->_iLastErrorNo = \OxidEsales\Eshop\Application\Model\Order::ORDER_STATE_PAYMENTERROR; $utilsView = \OxidEsales\Eshop\Core\Registry::getUtilsView(); $utilsView->addErrorToDisplay($exception); } return $success; }
php
public function doExpressCheckoutPayment() { $success = false; $order = $this->getPayPalOrder(); try { // updating order state if ($order) { $order->oePayPalUpdateOrderNumber(); $session = $this->getSession(); $basket = $session->getBasket(); $transactionMode = $this->getTransactionMode($basket); $builder = oxNew(\OxidEsales\PayPalModule\Model\PayPalRequest\DoExpressCheckoutPaymentRequestBuilder::class); $builder->setPayPalConfig($this->getPayPalConfig()); $builder->setSession($session); $builder->setBasket($basket); $builder->setTransactionMode($transactionMode); $builder->setUser($this->getPayPalUser()); $builder->setOrder($order); $request = $builder->buildRequest(); $payPalService = $this->getPayPalCheckoutService(); $result = $payPalService->doExpressCheckoutPayment($request); $order->finalizePayPalOrder( $result, $session->getBasket(), $transactionMode ); $success = true; } else { /** * @var $exception \OxidEsales\Eshop\Core\Exception\StandardException */ $exception = oxNew(\OxidEsales\Eshop\Core\Exception\StandardException::class, 'OEPAYPAL_ORDER_ERROR'); throw $exception; } } catch (\OxidEsales\Eshop\Core\Exception\StandardException $exception) { // deleting order on error if ($order) { $order->deletePayPalOrder(); } $this->_iLastErrorNo = \OxidEsales\Eshop\Application\Model\Order::ORDER_STATE_PAYMENTERROR; $utilsView = \OxidEsales\Eshop\Core\Registry::getUtilsView(); $utilsView->addErrorToDisplay($exception); } return $success; }
[ "public", "function", "doExpressCheckoutPayment", "(", ")", "{", "$", "success", "=", "false", ";", "$", "order", "=", "$", "this", "->", "getPayPalOrder", "(", ")", ";", "try", "{", "// updating order state", "if", "(", "$", "order", ")", "{", "$", "ord...
Executes "DoExpressCheckoutPayment" to PayPal @return bool
[ "Executes", "DoExpressCheckoutPayment", "to", "PayPal" ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PaymentGateway.php#L107-L160
train
OXID-eSales/paypal
Model/PayPalRequest/DoExpressCheckoutPaymentRequestBuilder.php
DoExpressCheckoutPaymentRequestBuilder.getOrder
public function getOrder() { if (is_null($this->order)) { /** @var \OxidEsales\PayPalModule\Core\Exception\PayPalResponseException $exception */ $exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalResponseException::class, 'OEPAYPAL_ORDER_ERROR'); throw $exception; } return $this->order; }
php
public function getOrder() { if (is_null($this->order)) { /** @var \OxidEsales\PayPalModule\Core\Exception\PayPalResponseException $exception */ $exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalResponseException::class, 'OEPAYPAL_ORDER_ERROR'); throw $exception; } return $this->order; }
[ "public", "function", "getOrder", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "order", ")", ")", "{", "/** @var \\OxidEsales\\PayPalModule\\Core\\Exception\\PayPalResponseException $exception */", "$", "exception", "=", "oxNew", "(", "\\", "OxidEsales...
Tries to return basket object, but if fails throws exception. @return \OxidEsales\Eshop\Application\Model\Order @throws \OxidEsales\PayPalModule\Core\Exception\PayPalResponseException
[ "Tries", "to", "return", "basket", "object", "but", "if", "fails", "throws", "exception", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/DoExpressCheckoutPaymentRequestBuilder.php#L160-L169
train
OXID-eSales/paypal
Model/PayPalRequest/DoExpressCheckoutPaymentRequestBuilder.php
DoExpressCheckoutPaymentRequestBuilder.getLang
public function getLang() { if ($this->lang === null) { $this->lang = $this->getPayPalConfig()->getLang(); } return $this->lang; }
php
public function getLang() { if ($this->lang === null) { $this->lang = $this->getPayPalConfig()->getLang(); } return $this->lang; }
[ "public", "function", "getLang", "(", ")", "{", "if", "(", "$", "this", "->", "lang", "===", "null", ")", "{", "$", "this", "->", "lang", "=", "$", "this", "->", "getPayPalConfig", "(", ")", "->", "getLang", "(", ")", ";", "}", "return", "$", "th...
Returns request object. @return \OxidEsales\Eshop\Core\Language
[ "Returns", "request", "object", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/DoExpressCheckoutPaymentRequestBuilder.php#L206-L213
train
OXID-eSales/paypal
Model/PayPalRequest/DoExpressCheckoutPaymentRequestBuilder.php
DoExpressCheckoutPaymentRequestBuilder.getUser
public function getUser() { if (is_null($this->user)) { /** * @var \OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException $exception */ $exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException::class); throw $exception; } return $this->user; }
php
public function getUser() { if (is_null($this->user)) { /** * @var \OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException $exception */ $exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException::class); throw $exception; } return $this->user; }
[ "public", "function", "getUser", "(", ")", "{", "if", "(", "is_null", "(", "$", "this", "->", "user", ")", ")", "{", "/**\n * @var \\OxidEsales\\PayPalModule\\Core\\Exception\\PayPalMissingParameterException $exception\n */", "$", "exception", "=", "...
Returns User object @return \OxidEsales\Eshop\Application\Model\User @throws \OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException
[ "Returns", "User", "object" ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/DoExpressCheckoutPaymentRequestBuilder.php#L252-L263
train
OXID-eSales/paypal
Model/PayPalRequest/DoExpressCheckoutPaymentRequestBuilder.php
DoExpressCheckoutPaymentRequestBuilder.addBaseParams
public function addBaseParams() { $order = $this->getOrder(); $config = $this->getPayPalConfig(); $basket = $this->getBasket(); $session = $this->getSession(); $lang = $this->getLang(); $request = $this->getRequest(); $request->setParameter("TOKEN", $session->getVariable("oepaypal-token")); $request->setParameter("PAYERID", $session->getVariable("oepaypal-payerId")); $request->setParameter("PAYMENTREQUEST_0_PAYMENTACTION", $this->getTransactionMode()); $request->setParameter("PAYMENTREQUEST_0_AMT", $this->formatFloat($basket->getPrice()->getBruttoPrice())); $request->setParameter("PAYMENTREQUEST_0_CURRENCYCODE", $basket->getBasketCurrency()->name); // IPN notify URL for PayPal if (!$config->suppressIPNCallbackUrl()) { $request->setParameter("PAYMENTREQUEST_0_NOTIFYURL", $config->getIPNCallbackUrl()); } // payment description $subj = sprintf($lang->translateString("OEPAYPAL_ORDER_CONF_SUBJECT"), $order->oxorder__oxordernr->value); $request->setParameter("PAYMENTREQUEST_0_DESC", $subj); $request->setParameter("PAYMENTREQUEST_0_CUSTOM", $subj); // Please do not change this place. // It is important to guarantee the future development of this OXID eShop extension and to keep it free of charge. // Thanks! $request->setParameter("BUTTONSOURCE", $config->getPartnerCode()); }
php
public function addBaseParams() { $order = $this->getOrder(); $config = $this->getPayPalConfig(); $basket = $this->getBasket(); $session = $this->getSession(); $lang = $this->getLang(); $request = $this->getRequest(); $request->setParameter("TOKEN", $session->getVariable("oepaypal-token")); $request->setParameter("PAYERID", $session->getVariable("oepaypal-payerId")); $request->setParameter("PAYMENTREQUEST_0_PAYMENTACTION", $this->getTransactionMode()); $request->setParameter("PAYMENTREQUEST_0_AMT", $this->formatFloat($basket->getPrice()->getBruttoPrice())); $request->setParameter("PAYMENTREQUEST_0_CURRENCYCODE", $basket->getBasketCurrency()->name); // IPN notify URL for PayPal if (!$config->suppressIPNCallbackUrl()) { $request->setParameter("PAYMENTREQUEST_0_NOTIFYURL", $config->getIPNCallbackUrl()); } // payment description $subj = sprintf($lang->translateString("OEPAYPAL_ORDER_CONF_SUBJECT"), $order->oxorder__oxordernr->value); $request->setParameter("PAYMENTREQUEST_0_DESC", $subj); $request->setParameter("PAYMENTREQUEST_0_CUSTOM", $subj); // Please do not change this place. // It is important to guarantee the future development of this OXID eShop extension and to keep it free of charge. // Thanks! $request->setParameter("BUTTONSOURCE", $config->getPartnerCode()); }
[ "public", "function", "addBaseParams", "(", ")", "{", "$", "order", "=", "$", "this", "->", "getOrder", "(", ")", ";", "$", "config", "=", "$", "this", "->", "getPayPalConfig", "(", ")", ";", "$", "basket", "=", "$", "this", "->", "getBasket", "(", ...
Sets basic parameters to request.
[ "Sets", "basic", "parameters", "to", "request", "." ]
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/DoExpressCheckoutPaymentRequestBuilder.php#L333-L362
train
OXID-eSales/paypal
Model/IPNPaymentCreator.php
IPNPaymentCreator.handleOrderPayment
public function handleOrderPayment($requestOrderPayment) { $return = null; $authId = $this->getRequest()->getRequestParameter(self::PAYPAL_IPN_AUTH_ID); $transactionEntity = $this->getRequest()->getRequestParameter(self::PAYPAL_IPN_TRANSACTION_ENTITY); $parentTransactionId = $this->getRequest()->getRequestParameter(self::PAYPAL_IPN_PARENT_TRANSACTION_ID); $orderPaymentAuthorization = $this->loadOrderPayment($authId); $orderPaymentParent = $this->loadOrderPayment($parentTransactionId); $orderId = $orderPaymentParent->getOrderId(); if ((self::HANDLE_TRANSACTION_ENTITY == $transactionEntity) && $orderId) { $requestOrderPayment->setOrderId($orderId); $requestOrderPayment->save(); $requestOrderPayment = $this->addRequestPaymentComment($requestOrderPayment); if (\OxidEsales\PayPalModule\Model\IPNRequestPaymentSetter::REFUND_ACTION == $requestOrderPayment->getAction()) { $this->updateParentTransactionRefundAmount($orderPaymentParent, $requestOrderPayment->getAmount()); } if ((\OxidEsales\PayPalModule\Model\IPNRequestPaymentSetter::AUTHORIZATION_ACTION == $orderPaymentAuthorization->getAction()) && ($orderId == $orderPaymentAuthorization->getOrderId()) ) { $this->updateOrderPaymentAuthorizationStatus($orderPaymentAuthorization); } $return = $requestOrderPayment; } return $return; }
php
public function handleOrderPayment($requestOrderPayment) { $return = null; $authId = $this->getRequest()->getRequestParameter(self::PAYPAL_IPN_AUTH_ID); $transactionEntity = $this->getRequest()->getRequestParameter(self::PAYPAL_IPN_TRANSACTION_ENTITY); $parentTransactionId = $this->getRequest()->getRequestParameter(self::PAYPAL_IPN_PARENT_TRANSACTION_ID); $orderPaymentAuthorization = $this->loadOrderPayment($authId); $orderPaymentParent = $this->loadOrderPayment($parentTransactionId); $orderId = $orderPaymentParent->getOrderId(); if ((self::HANDLE_TRANSACTION_ENTITY == $transactionEntity) && $orderId) { $requestOrderPayment->setOrderId($orderId); $requestOrderPayment->save(); $requestOrderPayment = $this->addRequestPaymentComment($requestOrderPayment); if (\OxidEsales\PayPalModule\Model\IPNRequestPaymentSetter::REFUND_ACTION == $requestOrderPayment->getAction()) { $this->updateParentTransactionRefundAmount($orderPaymentParent, $requestOrderPayment->getAmount()); } if ((\OxidEsales\PayPalModule\Model\IPNRequestPaymentSetter::AUTHORIZATION_ACTION == $orderPaymentAuthorization->getAction()) && ($orderId == $orderPaymentAuthorization->getOrderId()) ) { $this->updateOrderPaymentAuthorizationStatus($orderPaymentAuthorization); } $return = $requestOrderPayment; } return $return; }
[ "public", "function", "handleOrderPayment", "(", "$", "requestOrderPayment", ")", "{", "$", "return", "=", "null", ";", "$", "authId", "=", "$", "this", "->", "getRequest", "(", ")", "->", "getRequestParameter", "(", "self", "::", "PAYPAL_IPN_AUTH_ID", ")", ...
Handling of IPN data that has not yet a paypal order payment entry in shop database. Checks if information from IPN is relevant for Shop. That is the case if the related PayPal parent transaction can be found in table oepaypal_orderpayments. If data is relevant, we need to - create paypal order payment, store it in database and return it. - if it is a refund, update the parent transaction's refunded amount - update authorization status (can be Pending, In Progress, Completed) @param \OxidEsales\PayPalModule\Model\OrderPayment $requestOrderPayment @return \OxidEsales\PayPalModule\Model\OrderPayment|null
[ "Handling", "of", "IPN", "data", "that", "has", "not", "yet", "a", "paypal", "order", "payment", "entry", "in", "shop", "database", ".", "Checks", "if", "information", "from", "IPN", "is", "relevant", "for", "Shop", ".", "That", "is", "the", "case", "if"...
ca9adba6e8312062449b53e7bda4a513c6b8c250
https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/IPNPaymentCreator.php#L87-L116
train