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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
OXID-eSales/paypal | Model/IPNPaymentCreator.php | IPNPaymentCreator.updateOrderPaymentAuthorizationStatus | private function updateOrderPaymentAuthorizationStatus($orderPaymentAuthorization)
{
$authStatus = $this->getRequest()->getRequestParameter(self::PAYPAL_IPN_AUTH_STATUS);
if ($authStatus) {
$orderPaymentAuthorization->setStatus($authStatus);
$orderPaymentAuthorization->save();
}
} | php | private function updateOrderPaymentAuthorizationStatus($orderPaymentAuthorization)
{
$authStatus = $this->getRequest()->getRequestParameter(self::PAYPAL_IPN_AUTH_STATUS);
if ($authStatus) {
$orderPaymentAuthorization->setStatus($authStatus);
$orderPaymentAuthorization->save();
}
} | [
"private",
"function",
"updateOrderPaymentAuthorizationStatus",
"(",
"$",
"orderPaymentAuthorization",
")",
"{",
"$",
"authStatus",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"getRequestParameter",
"(",
"self",
"::",
"PAYPAL_IPN_AUTH_STATUS",
")",
";",
"i... | The status of the related authorization transaction might have changed.
We need to update that transaction status as well if we got a value in IPN request data.
@param \OxidEsales\PayPalModule\Model\OrderPayment $orderPaymentAuthorization Authorization PayPal order payment | [
"The",
"status",
"of",
"the",
"related",
"authorization",
"transaction",
"might",
"have",
"changed",
".",
"We",
"need",
"to",
"update",
"that",
"transaction",
"status",
"as",
"well",
"if",
"we",
"got",
"a",
"value",
"in",
"IPN",
"request",
"data",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/IPNPaymentCreator.php#L136-L144 | train |
OXID-eSales/paypal | Model/IPNPaymentCreator.php | IPNPaymentCreator.addRequestPaymentComment | private function addRequestPaymentComment($paypalOrderPayment)
{
$request = $this->getRequest();
$memo = $request->getRequestParameter(self::PAYPAL_IPN_MEMO);
if ($memo) {
$comment = oxNew(\OxidEsales\PayPalModule\Model\OrderPaymentComment::class);
$comment->setComment($memo);
$paypalOrderPayment->addComment($comment);
if (0 < $paypalOrderPayment->getId()) {
$paypalOrderPayment->save();
}
}
return $paypalOrderPayment;
} | php | private function addRequestPaymentComment($paypalOrderPayment)
{
$request = $this->getRequest();
$memo = $request->getRequestParameter(self::PAYPAL_IPN_MEMO);
if ($memo) {
$comment = oxNew(\OxidEsales\PayPalModule\Model\OrderPaymentComment::class);
$comment->setComment($memo);
$paypalOrderPayment->addComment($comment);
if (0 < $paypalOrderPayment->getId()) {
$paypalOrderPayment->save();
}
}
return $paypalOrderPayment;
} | [
"private",
"function",
"addRequestPaymentComment",
"(",
"$",
"paypalOrderPayment",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
";",
"$",
"memo",
"=",
"$",
"request",
"->",
"getRequestParameter",
"(",
"self",
"::",
"PAYPAL_IPN_MEMO... | Add comment for request payment if comment exists.
Function must only be called when the payment object this
comment is related to is already stored in the database and has an oxid.
Comment will be immediately saved to database.
@param \OxidEsales\PayPalModule\Model\OrderPayment $paypalOrderPayment
@return \OxidEsales\PayPalModule\Model\OrderPayment | [
"Add",
"comment",
"for",
"request",
"payment",
"if",
"comment",
"exists",
".",
"Function",
"must",
"only",
"be",
"called",
"when",
"the",
"payment",
"object",
"this",
"comment",
"is",
"related",
"to",
"is",
"already",
"stored",
"in",
"the",
"database",
"and"... | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/IPNPaymentCreator.php#L171-L185 | train |
OXID-eSales/paypal | Model/IPNProcessor.php | IPNProcessor.getPaymentBuilder | public function getPaymentBuilder()
{
if (is_null($this->paymentBuilder)) {
$this->paymentBuilder = oxNew(\OxidEsales\PayPalModule\Model\IPNPaymentBuilder::class);
}
return $this->paymentBuilder;
} | php | public function getPaymentBuilder()
{
if (is_null($this->paymentBuilder)) {
$this->paymentBuilder = oxNew(\OxidEsales\PayPalModule\Model\IPNPaymentBuilder::class);
}
return $this->paymentBuilder;
} | [
"public",
"function",
"getPaymentBuilder",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"paymentBuilder",
")",
")",
"{",
"$",
"this",
"->",
"paymentBuilder",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"PayPalModule",
"\\",
"Model",
"\\",
... | Creates \OxidEsales\PayPalModule\Model\IPNPaymentBuilder, sets if it was not set and than returns it.
@return \OxidEsales\PayPalModule\Model\IPNPaymentBuilder | [
"Creates",
"\\",
"OxidEsales",
"\\",
"PayPalModule",
"\\",
"Model",
"\\",
"IPNPaymentBuilder",
"sets",
"if",
"it",
"was",
"not",
"set",
"and",
"than",
"returns",
"it",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/IPNProcessor.php#L101-L108 | train |
OXID-eSales/paypal | Model/IPNProcessor.php | IPNProcessor.getOrderManager | public function getOrderManager()
{
if (is_null($this->orderManager)) {
$this->orderManager = oxNew(\OxidEsales\PayPalModule\Model\OrderManager::class);
}
return $this->orderManager;
} | php | public function getOrderManager()
{
if (is_null($this->orderManager)) {
$this->orderManager = oxNew(\OxidEsales\PayPalModule\Model\OrderManager::class);
}
return $this->orderManager;
} | [
"public",
"function",
"getOrderManager",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"orderManager",
")",
")",
"{",
"$",
"this",
"->",
"orderManager",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"PayPalModule",
"\\",
"Model",
"\\",
"Ord... | Returns order manager.
@return \OxidEsales\PayPalModule\Model\OrderManager | [
"Returns",
"order",
"manager",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/IPNProcessor.php#L125-L132 | train |
OXID-eSales/paypal | Model/IPNProcessor.php | IPNProcessor.process | public function process()
{
$lang = $this->getLang();
$request = $this->getRequest();
$paymentBuilder = $this->getPaymentBuilder();
$payPalOrderManager = $this->getOrderManager();
// Create Payment from Request.
$paymentBuilder->setLang($lang);
$paymentBuilder->setRequest($request);
$orderPayment = $paymentBuilder->buildPayment();
$payPalOrderManager->setOrderPayment($orderPayment);
$processSuccess = $payPalOrderManager->updateOrderStatus();
return $processSuccess;
} | php | public function process()
{
$lang = $this->getLang();
$request = $this->getRequest();
$paymentBuilder = $this->getPaymentBuilder();
$payPalOrderManager = $this->getOrderManager();
// Create Payment from Request.
$paymentBuilder->setLang($lang);
$paymentBuilder->setRequest($request);
$orderPayment = $paymentBuilder->buildPayment();
$payPalOrderManager->setOrderPayment($orderPayment);
$processSuccess = $payPalOrderManager->updateOrderStatus();
return $processSuccess;
} | [
"public",
"function",
"process",
"(",
")",
"{",
"$",
"lang",
"=",
"$",
"this",
"->",
"getLang",
"(",
")",
";",
"$",
"request",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
";",
"$",
"paymentBuilder",
"=",
"$",
"this",
"->",
"getPaymentBuilder",
"(... | Initiate payment status changes according to IPN information.
@return bool | [
"Initiate",
"payment",
"status",
"changes",
"according",
"to",
"IPN",
"information",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/IPNProcessor.php#L139-L155 | train |
OXID-eSales/paypal | Controller/Dispatcher.php | Dispatcher.getBaseUrl | protected function getBaseUrl()
{
$session = $this->getSession();
$url = \OxidEsales\Eshop\Core\Registry::getConfig()->getSslShopUrl() . "index.php?lang=" . \OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage() . "&sid=" . $session->getId() . "&rtoken=" . $session->getRemoteAccessToken();
$url .= "&shp=" . \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId();
return $url;
} | php | protected function getBaseUrl()
{
$session = $this->getSession();
$url = \OxidEsales\Eshop\Core\Registry::getConfig()->getSslShopUrl() . "index.php?lang=" . \OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage() . "&sid=" . $session->getId() . "&rtoken=" . $session->getRemoteAccessToken();
$url .= "&shp=" . \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId();
return $url;
} | [
"protected",
"function",
"getBaseUrl",
"(",
")",
"{",
"$",
"session",
"=",
"$",
"this",
"->",
"getSession",
"(",
")",
";",
"$",
"url",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getSslSho... | Returns base url, which is used to construct Callback, Return and Cancel Urls
@return string | [
"Returns",
"base",
"url",
"which",
"is",
"used",
"to",
"construct",
"Callback",
"Return",
"and",
"Cancel",
"Urls"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/Dispatcher.php#L115-L122 | train |
OXID-eSales/paypal | Controller/Dispatcher.php | Dispatcher.getPayPalOrder | protected function getPayPalOrder()
{
$order = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
if ($order->loadPayPalOrder()) {
return $order;
}
} | php | protected function getPayPalOrder()
{
$order = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
if ($order->loadPayPalOrder()) {
return $order;
}
} | [
"protected",
"function",
"getPayPalOrder",
"(",
")",
"{",
"$",
"order",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
"\\",
"Order",
"::",
"class",
")",
";",
"if",
"(",
"$",
"order",
"->",
"loadPayPalOrder",
"(... | Returns PayPal order object
@return \OxidEsales\Eshop\Application\Model\Order|null | [
"Returns",
"PayPal",
"order",
"object"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/Dispatcher.php#L129-L135 | train |
OXID-eSales/paypal | Controller/Dispatcher.php | Dispatcher.getPayPalPayment | protected function getPayPalPayment()
{
$userPayment = null;
if (($order = $this->getPayPalOrder())) {
$userPayment = oxNew(\OxidEsales\Eshop\Application\Model\UserPayment::class);
$userPayment->load($order->oxorder__oxpaymentid->value);
}
return $userPayment;
} | php | protected function getPayPalPayment()
{
$userPayment = null;
if (($order = $this->getPayPalOrder())) {
$userPayment = oxNew(\OxidEsales\Eshop\Application\Model\UserPayment::class);
$userPayment->load($order->oxorder__oxpaymentid->value);
}
return $userPayment;
} | [
"protected",
"function",
"getPayPalPayment",
"(",
")",
"{",
"$",
"userPayment",
"=",
"null",
";",
"if",
"(",
"(",
"$",
"order",
"=",
"$",
"this",
"->",
"getPayPalOrder",
"(",
")",
")",
")",
"{",
"$",
"userPayment",
"=",
"oxNew",
"(",
"\\",
"OxidEsales"... | Returns PayPal payment object
@return \OxidEsales\Eshop\Application\Model\Payment|null | [
"Returns",
"PayPal",
"payment",
"object"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/Dispatcher.php#L142-L152 | train |
OXID-eSales/paypal | Model/PayPalOrder.php | PayPalOrder.setPaymentStatus | public function setPaymentStatus($status, \OxidEsales\Eshop\Application\Model\Order $order = null)
{
$this->setValue('oepaypal_paymentstatus', $status);
// if payment completed, set order paid
if ($status == \OxidEsales\PayPalModule\Model\PayPalOrder::PAYPAL_ORDER_STATE_COMPLETED) {
if (is_null($order)) {
$order = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
$order->load($this->getOrderId());
}
$order->markOrderPaid();
}
} | php | public function setPaymentStatus($status, \OxidEsales\Eshop\Application\Model\Order $order = null)
{
$this->setValue('oepaypal_paymentstatus', $status);
// if payment completed, set order paid
if ($status == \OxidEsales\PayPalModule\Model\PayPalOrder::PAYPAL_ORDER_STATE_COMPLETED) {
if (is_null($order)) {
$order = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
$order->load($this->getOrderId());
}
$order->markOrderPaid();
}
} | [
"public",
"function",
"setPaymentStatus",
"(",
"$",
"status",
",",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
"\\",
"Order",
"$",
"order",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setValue",
"(",
"'oepaypal_paymentstatus'",
",",... | Set payment status.
@param string $status
@param \OxidEsales\Eshop\Application\Model\Order $order Shop order object | [
"Set",
"payment",
"status",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalOrder.php#L195-L207 | train |
OXID-eSales/paypal | Model/PayPalOrder.php | PayPalOrder.getPaymentStatus | public function getPaymentStatus()
{
$state = $this->getValue('oepaypal_paymentstatus');
if (empty($state)) {
$state = self::PAYPAL_ORDER_STATE_COMPLETED;
}
return $state;
} | php | public function getPaymentStatus()
{
$state = $this->getValue('oepaypal_paymentstatus');
if (empty($state)) {
$state = self::PAYPAL_ORDER_STATE_COMPLETED;
}
return $state;
} | [
"public",
"function",
"getPaymentStatus",
"(",
")",
"{",
"$",
"state",
"=",
"$",
"this",
"->",
"getValue",
"(",
"'oepaypal_paymentstatus'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"state",
")",
")",
"{",
"$",
"state",
"=",
"self",
"::",
"PAYPAL_ORDER_STA... | Get payment status.
@return string | [
"Get",
"payment",
"status",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalOrder.php#L214-L222 | train |
OXID-eSales/paypal | Model/PayPalOrder.php | PayPalOrder.addPayment | public function addPayment(\OxidEsales\PayPalModule\Model\OrderPayment $payment)
{
$paymentList = $this->getPaymentList();
$paymentList->addPayment($payment);
$this->setPaymentList(null);
} | php | public function addPayment(\OxidEsales\PayPalModule\Model\OrderPayment $payment)
{
$paymentList = $this->getPaymentList();
$paymentList->addPayment($payment);
$this->setPaymentList(null);
} | [
"public",
"function",
"addPayment",
"(",
"\\",
"OxidEsales",
"\\",
"PayPalModule",
"\\",
"Model",
"\\",
"OrderPayment",
"$",
"payment",
")",
"{",
"$",
"paymentList",
"=",
"$",
"this",
"->",
"getPaymentList",
"(",
")",
";",
"$",
"paymentList",
"->",
"addPayme... | Adds new payment.
@param \OxidEsales\PayPalModule\Model\OrderPayment $payment order payment | [
"Adds",
"new",
"payment",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalOrder.php#L279-L284 | train |
OXID-eSales/paypal | Model/PayPalOrder.php | PayPalOrder.getPaymentList | public function getPaymentList()
{
if (is_null($this->paymentList)) {
$paymentList = oxNew(\OxidEsales\PayPalModule\Model\OrderPaymentList::class);
$paymentList->load($this->getOrderId());
$this->setPaymentList($paymentList);
}
return $this->paymentList;
} | php | public function getPaymentList()
{
if (is_null($this->paymentList)) {
$paymentList = oxNew(\OxidEsales\PayPalModule\Model\OrderPaymentList::class);
$paymentList->load($this->getOrderId());
$this->setPaymentList($paymentList);
}
return $this->paymentList;
} | [
"public",
"function",
"getPaymentList",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"paymentList",
")",
")",
"{",
"$",
"paymentList",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"PayPalModule",
"\\",
"Model",
"\\",
"OrderPaymentList",
"::... | Return order payment list.
@return \OxidEsales\PayPalModule\Model\OrderPaymentList | [
"Return",
"order",
"payment",
"list",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalOrder.php#L305-L314 | train |
OXID-eSales/paypal | Model/OrderPaymentActionManager.php | OrderPaymentActionManager.getAvailableActions | protected function getAvailableActions($paymentAction, $paymentStatus)
{
$actions = $this->availableActions[$paymentAction][$paymentStatus];
return $actions ? $actions : array();
} | php | protected function getAvailableActions($paymentAction, $paymentStatus)
{
$actions = $this->availableActions[$paymentAction][$paymentStatus];
return $actions ? $actions : array();
} | [
"protected",
"function",
"getAvailableActions",
"(",
"$",
"paymentAction",
",",
"$",
"paymentStatus",
")",
"{",
"$",
"actions",
"=",
"$",
"this",
"->",
"availableActions",
"[",
"$",
"paymentAction",
"]",
"[",
"$",
"paymentStatus",
"]",
";",
"return",
"$",
"a... | Returns available actions for given payment action
@param string $paymentAction
@param string $paymentStatus
@return array | [
"Returns",
"available",
"actions",
"for",
"given",
"payment",
"action"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/OrderPaymentActionManager.php#L77-L82 | train |
OXID-eSales/paypal | Model/Action/Data/OrderRefundActionData.php | OrderRefundActionData.getAmount | public function getAmount()
{
$amount = $this->getRequest()->getRequestParameter('refund_amount');
return $amount ? $amount : $this->getPaymentBeingRefunded()->getRemainingRefundAmount();
} | php | public function getAmount()
{
$amount = $this->getRequest()->getRequestParameter('refund_amount');
return $amount ? $amount : $this->getPaymentBeingRefunded()->getRemainingRefundAmount();
} | [
"public",
"function",
"getAmount",
"(",
")",
"{",
"$",
"amount",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"getRequestParameter",
"(",
"'refund_amount'",
")",
";",
"return",
"$",
"amount",
"?",
"$",
"amount",
":",
"$",
"this",
"->",
"getPayme... | Returns amount to refund.
@return float | [
"Returns",
"amount",
"to",
"refund",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Action/Data/OrderRefundActionData.php#L59-L64 | train |
OXID-eSales/paypal | Model/Action/Data/OrderRefundActionData.php | OrderRefundActionData.getPaymentBeingRefunded | public function getPaymentBeingRefunded()
{
if (is_null($this->paymentBeingRefunded)) {
$this->paymentBeingRefunded = oxNew(\OxidEsales\PayPalModule\Model\OrderPayment::class);
$this->paymentBeingRefunded->loadByTransactionId($this->getTransactionId());
}
return $this->paymentBeingRefunded;
} | php | public function getPaymentBeingRefunded()
{
if (is_null($this->paymentBeingRefunded)) {
$this->paymentBeingRefunded = oxNew(\OxidEsales\PayPalModule\Model\OrderPayment::class);
$this->paymentBeingRefunded->loadByTransactionId($this->getTransactionId());
}
return $this->paymentBeingRefunded;
} | [
"public",
"function",
"getPaymentBeingRefunded",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"paymentBeingRefunded",
")",
")",
"{",
"$",
"this",
"->",
"paymentBeingRefunded",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"PayPalModule",
"\\",
... | Returns payment to refund.
@return \OxidEsales\PayPalModule\Model\OrderPayment | [
"Returns",
"payment",
"to",
"refund",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Action/Data/OrderRefundActionData.php#L81-L89 | train |
OXID-eSales/paypal | Model/OrderPayment.php | OrderPayment.loadByTransactionId | public function loadByTransactionId($transactionId)
{
$result = false;
$data = $this->getDbGateway()->loadByTransactionId($transactionId);
if ($data) {
$this->setData($data);
$result = true;
}
return $result;
} | php | public function loadByTransactionId($transactionId)
{
$result = false;
$data = $this->getDbGateway()->loadByTransactionId($transactionId);
if ($data) {
$this->setData($data);
$result = true;
}
return $result;
} | [
"public",
"function",
"loadByTransactionId",
"(",
"$",
"transactionId",
")",
"{",
"$",
"result",
"=",
"false",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"getDbGateway",
"(",
")",
"->",
"loadByTransactionId",
"(",
"$",
"transactionId",
")",
";",
"if",
"(",
... | Load payment data by given transaction id
@param string $transactionId transaction id
@return bool | [
"Load",
"payment",
"data",
"by",
"given",
"transaction",
"id"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/OrderPayment.php#L293-L303 | train |
OXID-eSales/paypal | Core/Caller.php | Caller.getCurl | public function getCurl()
{
if (is_null($this->curl)) {
$curl = oxNew(\OxidEsales\PayPalModule\Core\Curl::class);
$this->setCurl($curl);
}
return $this->curl;
} | php | public function getCurl()
{
if (is_null($this->curl)) {
$curl = oxNew(\OxidEsales\PayPalModule\Core\Curl::class);
$this->setCurl($curl);
}
return $this->curl;
} | [
"public",
"function",
"getCurl",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"curl",
")",
")",
"{",
"$",
"curl",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"PayPalModule",
"\\",
"Core",
"\\",
"Curl",
"::",
"class",
")",
";",
"$",... | Returns curl instance
@return \OxidEsales\PayPalModule\Core\Curl | [
"Returns",
"curl",
"instance"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Caller.php#L85-L93 | train |
OXID-eSales/paypal | Core/Caller.php | Caller.call | public function call($methodName = null)
{
$this->setMethod($methodName);
$curl = $this->getCurl();
$curl->setParameters($this->getParameters());
$this->log($this->getParameters(), 'Request to PayPal');
$response = $curl->execute();
$this->log($response, 'Response from PayPal');
$this->validateResponse($response);
return $response;
} | php | public function call($methodName = null)
{
$this->setMethod($methodName);
$curl = $this->getCurl();
$curl->setParameters($this->getParameters());
$this->log($this->getParameters(), 'Request to PayPal');
$response = $curl->execute();
$this->log($response, 'Response from PayPal');
$this->validateResponse($response);
return $response;
} | [
"public",
"function",
"call",
"(",
"$",
"methodName",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"setMethod",
"(",
"$",
"methodName",
")",
";",
"$",
"curl",
"=",
"$",
"this",
"->",
"getCurl",
"(",
")",
";",
"$",
"curl",
"->",
"setParameters",
"(",
"... | Calls given remote PayPal method.
@param string $methodName .
@return array | [
"Calls",
"given",
"remote",
"PayPal",
"method",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Caller.php#L133-L149 | train |
OXID-eSales/paypal | Core/Caller.php | Caller.validateResponse | protected function validateResponse($response)
{
if ('Failure' == $response['ACK']) {
/**
* @var \OxidEsales\PayPalModule\Core\Exception\PayPalResponseException $exception
*/
$exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalResponseException::class, $response['L_LONGMESSAGE0'], $response['L_ERRORCODE0']);
throw $exception;
}
} | php | protected function validateResponse($response)
{
if ('Failure' == $response['ACK']) {
/**
* @var \OxidEsales\PayPalModule\Core\Exception\PayPalResponseException $exception
*/
$exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalResponseException::class, $response['L_LONGMESSAGE0'], $response['L_ERRORCODE0']);
throw $exception;
}
} | [
"protected",
"function",
"validateResponse",
"(",
"$",
"response",
")",
"{",
"if",
"(",
"'Failure'",
"==",
"$",
"response",
"[",
"'ACK'",
"]",
")",
"{",
"/**\n * @var \\OxidEsales\\PayPalModule\\Core\\Exception\\PayPalResponseException $exception\n */",
... | Validates response from PayPal errors.
@param array $response
@throws \OxidEsales\PayPalModule\Core\Exception\PayPalResponseException if response has error from PayPal | [
"Validates",
"response",
"from",
"PayPal",
"errors",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Caller.php#L170-L179 | train |
OXID-eSales/paypal | Core/Caller.php | Caller.getCallBackResponse | public function getCallBackResponse($methodName)
{
$this->setParameter("METHOD", $methodName);
$curl = $this->getCurl();
$curl->setParameters($this->getParameters());
$request = $curl->getQuery();
$this->log($request, 'Callback response from eShop to PayPal');
return $request;
} | php | public function getCallBackResponse($methodName)
{
$this->setParameter("METHOD", $methodName);
$curl = $this->getCurl();
$curl->setParameters($this->getParameters());
$request = $curl->getQuery();
$this->log($request, 'Callback response from eShop to PayPal');
return $request;
} | [
"public",
"function",
"getCallBackResponse",
"(",
"$",
"methodName",
")",
"{",
"$",
"this",
"->",
"setParameter",
"(",
"\"METHOD\"",
",",
"$",
"methodName",
")",
";",
"$",
"curl",
"=",
"$",
"this",
"->",
"getCurl",
"(",
")",
";",
"$",
"curl",
"->",
"se... | Outputs given request data.
@param string $methodName
@return string | [
"Outputs",
"given",
"request",
"data",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Caller.php#L188-L199 | train |
OXID-eSales/paypal | Core/Caller.php | Caller.log | public function log($value, $title = '')
{
if (!is_null($this->getLogger())) {
$this->getLogger()->setTitle($title);
$this->getLogger()->log($value);
}
} | php | public function log($value, $title = '')
{
if (!is_null($this->getLogger())) {
$this->getLogger()->setTitle($title);
$this->getLogger()->log($value);
}
} | [
"public",
"function",
"log",
"(",
"$",
"value",
",",
"$",
"title",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"getLogger",
"(",
")",
")",
")",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"setTitle",
"(",
"$... | Logs given request and responds parameters to log file.
@param mixed $value request / response parameters
@param string $title section title in log file | [
"Logs",
"given",
"request",
"and",
"responds",
"parameters",
"to",
"log",
"file",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Caller.php#L207-L213 | train |
OXID-eSales/paypal | Core/Caller.php | Caller.setRequest | public function setRequest(\OxidEsales\PayPalModule\Model\PayPalRequest\PayPalRequest $request)
{
$this->setParameters($request->getData());
} | php | public function setRequest(\OxidEsales\PayPalModule\Model\PayPalRequest\PayPalRequest $request)
{
$this->setParameters($request->getData());
} | [
"public",
"function",
"setRequest",
"(",
"\\",
"OxidEsales",
"\\",
"PayPalModule",
"\\",
"Model",
"\\",
"PayPalRequest",
"\\",
"PayPalRequest",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"setParameters",
"(",
"$",
"request",
"->",
"getData",
"(",
")",
")",... | Set parameter from request.
@param \OxidEsales\PayPalModule\Model\PayPalRequest\PayPalRequest $request request | [
"Set",
"parameter",
"from",
"request",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Caller.php#L220-L223 | train |
OXID-eSales/paypal | Core/Events.php | Events.addPaymentMethod | public static function addPaymentMethod()
{
$paymentDescriptions = array(
'en' => '<div>When selecting this payment method you are being redirected to PayPal where you can login into your account or open a new account. In PayPal you are able to authorize the payment. As soon you have authorized the payment, you are again redirected to our shop where you can confirm your order.</div> <div style="margin-top: 5px">Only after confirming the order, transfer of money takes place.</div>',
'de' => '<div>Bei Auswahl der Zahlungsart PayPal werden Sie im nächsten Schritt zu PayPal weitergeleitet. Dort können Sie sich in Ihr PayPal-Konto einloggen oder ein neues PayPal-Konto eröffnen und die Zahlung autorisieren. Sobald Sie Ihre Daten für die Zahlung bestätigt haben, werden Sie automatisch wieder zurück in den Shop geleitet, um die Bestellung abzuschließen.</div> <div style="margin-top: 5px">Erst dann wird die Zahlung ausgeführt.</div>'
);
$payment = oxNew(\OxidEsales\Eshop\Application\Model\Payment::class);
if (!$payment->load('oxidpaypal')) {
$payment->setId('oxidpaypal');
$payment->oxpayments__oxactive = new \OxidEsales\Eshop\Core\Field(1);
$payment->oxpayments__oxdesc = new \OxidEsales\Eshop\Core\Field('PayPal');
$payment->oxpayments__oxaddsum = new \OxidEsales\Eshop\Core\Field(0);
$payment->oxpayments__oxaddsumtype = new \OxidEsales\Eshop\Core\Field('abs');
$payment->oxpayments__oxfromboni = new \OxidEsales\Eshop\Core\Field(0);
$payment->oxpayments__oxfromamount = new \OxidEsales\Eshop\Core\Field(0);
$payment->oxpayments__oxtoamount = new \OxidEsales\Eshop\Core\Field(10000);
$language = \OxidEsales\Eshop\Core\Registry::getLang();
$languages = $language->getLanguageIds();
foreach ($paymentDescriptions as $languageAbbreviation => $description) {
$languageId = array_search($languageAbbreviation, $languages);
if ($languageId !== false) {
$payment->setLanguage($languageId);
$payment->oxpayments__oxlongdesc = new \OxidEsales\Eshop\Core\Field($description);
$payment->save();
}
}
}
} | php | public static function addPaymentMethod()
{
$paymentDescriptions = array(
'en' => '<div>When selecting this payment method you are being redirected to PayPal where you can login into your account or open a new account. In PayPal you are able to authorize the payment. As soon you have authorized the payment, you are again redirected to our shop where you can confirm your order.</div> <div style="margin-top: 5px">Only after confirming the order, transfer of money takes place.</div>',
'de' => '<div>Bei Auswahl der Zahlungsart PayPal werden Sie im nächsten Schritt zu PayPal weitergeleitet. Dort können Sie sich in Ihr PayPal-Konto einloggen oder ein neues PayPal-Konto eröffnen und die Zahlung autorisieren. Sobald Sie Ihre Daten für die Zahlung bestätigt haben, werden Sie automatisch wieder zurück in den Shop geleitet, um die Bestellung abzuschließen.</div> <div style="margin-top: 5px">Erst dann wird die Zahlung ausgeführt.</div>'
);
$payment = oxNew(\OxidEsales\Eshop\Application\Model\Payment::class);
if (!$payment->load('oxidpaypal')) {
$payment->setId('oxidpaypal');
$payment->oxpayments__oxactive = new \OxidEsales\Eshop\Core\Field(1);
$payment->oxpayments__oxdesc = new \OxidEsales\Eshop\Core\Field('PayPal');
$payment->oxpayments__oxaddsum = new \OxidEsales\Eshop\Core\Field(0);
$payment->oxpayments__oxaddsumtype = new \OxidEsales\Eshop\Core\Field('abs');
$payment->oxpayments__oxfromboni = new \OxidEsales\Eshop\Core\Field(0);
$payment->oxpayments__oxfromamount = new \OxidEsales\Eshop\Core\Field(0);
$payment->oxpayments__oxtoamount = new \OxidEsales\Eshop\Core\Field(10000);
$language = \OxidEsales\Eshop\Core\Registry::getLang();
$languages = $language->getLanguageIds();
foreach ($paymentDescriptions as $languageAbbreviation => $description) {
$languageId = array_search($languageAbbreviation, $languages);
if ($languageId !== false) {
$payment->setLanguage($languageId);
$payment->oxpayments__oxlongdesc = new \OxidEsales\Eshop\Core\Field($description);
$payment->save();
}
}
}
} | [
"public",
"static",
"function",
"addPaymentMethod",
"(",
")",
"{",
"$",
"paymentDescriptions",
"=",
"array",
"(",
"'en'",
"=>",
"'<div>When selecting this payment method you are being redirected to PayPal where you can login into your account or open a new account. In PayPal you are able... | Add PayPal payment method set EN and DE long descriptions | [
"Add",
"PayPal",
"payment",
"method",
"set",
"EN",
"and",
"DE",
"long",
"descriptions"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Events.php#L54-L83 | train |
OXID-eSales/paypal | Core/Events.php | Events.isPayPalActiveOnSubShops | public static function isPayPalActiveOnSubShops()
{
$active = false;
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$extensionChecker = oxNew(\OxidEsales\PayPalModule\Core\ExtensionChecker::class);
$shops = $config->getShopIds();
$activeShopId = $config->getShopId();
foreach ($shops as $shopId) {
if ($shopId != $activeShopId) {
$extensionChecker->setShopId($shopId);
$extensionChecker->setExtensionId('oepaypal');
if ($extensionChecker->isActive()) {
$active = true;
break;
}
}
}
return $active;
} | php | public static function isPayPalActiveOnSubShops()
{
$active = false;
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$extensionChecker = oxNew(\OxidEsales\PayPalModule\Core\ExtensionChecker::class);
$shops = $config->getShopIds();
$activeShopId = $config->getShopId();
foreach ($shops as $shopId) {
if ($shopId != $activeShopId) {
$extensionChecker->setShopId($shopId);
$extensionChecker->setExtensionId('oepaypal');
if ($extensionChecker->isActive()) {
$active = true;
break;
}
}
}
return $active;
} | [
"public",
"static",
"function",
"isPayPalActiveOnSubShops",
"(",
")",
"{",
"$",
"active",
"=",
"false",
";",
"$",
"config",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
";",
"$",
"extensionChecker",
"... | Check if PayPal is used for sub-shops.
@return bool | [
"Check",
"if",
"PayPal",
"is",
"used",
"for",
"sub",
"-",
"shops",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Events.php#L90-L110 | train |
OXID-eSales/paypal | Core/Events.php | Events.disablePaymentMethod | public static function disablePaymentMethod()
{
$payment = oxNew(\OxidEsales\Eshop\Application\Model\Payment::class);
if ($payment->load('oxidpaypal')) {
$payment->oxpayments__oxactive = new \OxidEsales\Eshop\Core\Field(0);
$payment->save();
}
} | php | public static function disablePaymentMethod()
{
$payment = oxNew(\OxidEsales\Eshop\Application\Model\Payment::class);
if ($payment->load('oxidpaypal')) {
$payment->oxpayments__oxactive = new \OxidEsales\Eshop\Core\Field(0);
$payment->save();
}
} | [
"public",
"static",
"function",
"disablePaymentMethod",
"(",
")",
"{",
"$",
"payment",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
"\\",
"Payment",
"::",
"class",
")",
";",
"if",
"(",
"$",
"payment",
"->",
"l... | Disables PayPal payment method | [
"Disables",
"PayPal",
"payment",
"method"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Events.php#L115-L122 | train |
OXID-eSales/paypal | Core/Events.php | Events.enablePayPalRDFA | public static function enablePayPalRDFA()
{
// If PayPal activated on other sub shops do not change global RDF setting.
if ('EE' == \OxidEsales\Eshop\Core\Registry::getConfig()->getEdition() && self::isPayPalActiveOnSubShops()) {
return;
}
$query = "INSERT IGNORE INTO `oxobject2payment` (`OXID`, `OXPAYMENTID`, `OXOBJECTID`, `OXTYPE`) VALUES('oepaypalrdfa', 'oxidpaypal', 'PayPal', 'rdfapayment')";
\OxidEsales\Eshop\Core\DatabaseProvider::getDb()->execute($query);
} | php | public static function enablePayPalRDFA()
{
// If PayPal activated on other sub shops do not change global RDF setting.
if ('EE' == \OxidEsales\Eshop\Core\Registry::getConfig()->getEdition() && self::isPayPalActiveOnSubShops()) {
return;
}
$query = "INSERT IGNORE INTO `oxobject2payment` (`OXID`, `OXPAYMENTID`, `OXOBJECTID`, `OXTYPE`) VALUES('oepaypalrdfa', 'oxidpaypal', 'PayPal', 'rdfapayment')";
\OxidEsales\Eshop\Core\DatabaseProvider::getDb()->execute($query);
} | [
"public",
"static",
"function",
"enablePayPalRDFA",
"(",
")",
"{",
"// If PayPal activated on other sub shops do not change global RDF setting.",
"if",
"(",
"'EE'",
"==",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"... | Enables PayPal RDF
@return null | [
"Enables",
"PayPal",
"RDF"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Events.php#L184-L193 | train |
OXID-eSales/paypal | Core/Events.php | Events.addMissingFieldsOnUpdate | public static function addMissingFieldsOnUpdate()
{
$dbMetaDataHandler = oxNew(\OxidEsales\Eshop\Core\DbMetaDataHandler::class);
$tableFields = array(
'oepaypal_order' => 'OEPAYPAL_TIMESTAMP',
'oepaypal_orderpayments' => 'OEPAYPAL_TIMESTAMP',
'oepaypal_orderpaymentcomments' => 'OEPAYPAL_TIMESTAMP',
);
foreach ($tableFields as $tableName => $fieldName) {
if (!$dbMetaDataHandler->fieldExists($fieldName, $tableName)) {
\OxidEsales\Eshop\Core\DatabaseProvider::getDb()->execute(
"ALTER TABLE `" . $tableName
. "` ADD `" . $fieldName . "` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP;"
);
}
}
} | php | public static function addMissingFieldsOnUpdate()
{
$dbMetaDataHandler = oxNew(\OxidEsales\Eshop\Core\DbMetaDataHandler::class);
$tableFields = array(
'oepaypal_order' => 'OEPAYPAL_TIMESTAMP',
'oepaypal_orderpayments' => 'OEPAYPAL_TIMESTAMP',
'oepaypal_orderpaymentcomments' => 'OEPAYPAL_TIMESTAMP',
);
foreach ($tableFields as $tableName => $fieldName) {
if (!$dbMetaDataHandler->fieldExists($fieldName, $tableName)) {
\OxidEsales\Eshop\Core\DatabaseProvider::getDb()->execute(
"ALTER TABLE `" . $tableName
. "` ADD `" . $fieldName . "` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP;"
);
}
}
} | [
"public",
"static",
"function",
"addMissingFieldsOnUpdate",
"(",
")",
"{",
"$",
"dbMetaDataHandler",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DbMetaDataHandler",
"::",
"class",
")",
";",
"$",
"tableFields",
"=",
"array",
"(",
... | Add missing field if it activates on old DB | [
"Add",
"missing",
"field",
"if",
"it",
"activates",
"on",
"old",
"DB"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Events.php#L208-L226 | train |
OXID-eSales/paypal | Core/Events.php | Events.onDeactivate | public static function onDeactivate()
{
// If PayPal activated on other sub shops do not remove payment method and RDF setting
if ('EE' == \OxidEsales\Eshop\Core\Registry::getConfig()->getEdition() && self::isPayPalActiveOnSubShops()) {
return;
}
self::disablePaymentMethod();
self::disablePayPalRDFA();
self::deleteSessionBasket();
} | php | public static function onDeactivate()
{
// If PayPal activated on other sub shops do not remove payment method and RDF setting
if ('EE' == \OxidEsales\Eshop\Core\Registry::getConfig()->getEdition() && self::isPayPalActiveOnSubShops()) {
return;
}
self::disablePaymentMethod();
self::disablePayPalRDFA();
self::deleteSessionBasket();
} | [
"public",
"static",
"function",
"onDeactivate",
"(",
")",
"{",
"// If PayPal activated on other sub shops do not remove payment method and RDF setting",
"if",
"(",
"'EE'",
"==",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
"... | Execute action on deactivate event
@return null | [
"Execute",
"action",
"on",
"deactivate",
"event"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Events.php#L305-L314 | train |
OXID-eSales/paypal | Model/IPNPaymentBuilder.php | IPNPaymentBuilder.getOrderPaymentSetter | public function getOrderPaymentSetter()
{
if (is_null($this->payPalIPNPaymentSetter)) {
$payPalIPNPaymentSetter = oxNew(\OxidEsales\PayPalModule\Model\IPNRequestPaymentSetter::class);
$this->setOrderPaymentSetter($payPalIPNPaymentSetter);
}
return $this->payPalIPNPaymentSetter;
} | php | public function getOrderPaymentSetter()
{
if (is_null($this->payPalIPNPaymentSetter)) {
$payPalIPNPaymentSetter = oxNew(\OxidEsales\PayPalModule\Model\IPNRequestPaymentSetter::class);
$this->setOrderPaymentSetter($payPalIPNPaymentSetter);
}
return $this->payPalIPNPaymentSetter;
} | [
"public",
"function",
"getOrderPaymentSetter",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"payPalIPNPaymentSetter",
")",
")",
"{",
"$",
"payPalIPNPaymentSetter",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"PayPalModule",
"\\",
"Model",
"\\"... | Creates and sets \OxidEsales\PayPalModule\Model\IPNRequestPaymentSetter object if it was not set.
@return \OxidEsales\PayPalModule\Model\IPNRequestPaymentSetter | [
"Creates",
"and",
"sets",
"\\",
"OxidEsales",
"\\",
"PayPalModule",
"\\",
"Model",
"\\",
"IPNRequestPaymentSetter",
"object",
"if",
"it",
"was",
"not",
"set",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/IPNPaymentBuilder.php#L62-L70 | train |
OXID-eSales/paypal | Model/IPNPaymentBuilder.php | IPNPaymentBuilder.getOrderPaymentValidator | public function getOrderPaymentValidator()
{
if (is_null($this->payPalIPNPaymentValidator)) {
$payPalIPNPaymentValidator = oxNew(\OxidEsales\PayPalModule\Model\IPNPaymentValidator::class);
$this->setOrderPaymentValidator($payPalIPNPaymentValidator);
}
return $this->payPalIPNPaymentValidator;
} | php | public function getOrderPaymentValidator()
{
if (is_null($this->payPalIPNPaymentValidator)) {
$payPalIPNPaymentValidator = oxNew(\OxidEsales\PayPalModule\Model\IPNPaymentValidator::class);
$this->setOrderPaymentValidator($payPalIPNPaymentValidator);
}
return $this->payPalIPNPaymentValidator;
} | [
"public",
"function",
"getOrderPaymentValidator",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"payPalIPNPaymentValidator",
")",
")",
"{",
"$",
"payPalIPNPaymentValidator",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"PayPalModule",
"\\",
"Model... | Creates and sets \OxidEsales\PayPalModule\Model\IPNPaymentValidator object if it was not set.
@return \OxidEsales\PayPalModule\Model\IPNPaymentValidator | [
"Creates",
"and",
"sets",
"\\",
"OxidEsales",
"\\",
"PayPalModule",
"\\",
"Model",
"\\",
"IPNPaymentValidator",
"object",
"if",
"it",
"was",
"not",
"set",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/IPNPaymentBuilder.php#L87-L95 | train |
OXID-eSales/paypal | Model/IPNPaymentBuilder.php | IPNPaymentBuilder.getPaymentCreator | public function getPaymentCreator()
{
if (is_null($this->payPalIPNPaymentCreator)) {
$payPalIPNPaymentCreator = oxNew(\OxidEsales\PayPalModule\Model\IPNPaymentCreator::class);
$payPalIPNPaymentCreator->setRequest($this->getRequest());
$this->setPaymentCreator($payPalIPNPaymentCreator);
}
return $this->payPalIPNPaymentCreator;
} | php | public function getPaymentCreator()
{
if (is_null($this->payPalIPNPaymentCreator)) {
$payPalIPNPaymentCreator = oxNew(\OxidEsales\PayPalModule\Model\IPNPaymentCreator::class);
$payPalIPNPaymentCreator->setRequest($this->getRequest());
$this->setPaymentCreator($payPalIPNPaymentCreator);
}
return $this->payPalIPNPaymentCreator;
} | [
"public",
"function",
"getPaymentCreator",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"payPalIPNPaymentCreator",
")",
")",
"{",
"$",
"payPalIPNPaymentCreator",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"PayPalModule",
"\\",
"Model",
"\\",
... | Creates and sets \OxidEsales\PayPalModule\Model\IPNPaymentCreator object if it was not set.
@return \OxidEsales\PayPalModule\Model\IPNPaymentCreator | [
"Creates",
"and",
"sets",
"\\",
"OxidEsales",
"\\",
"PayPalModule",
"\\",
"Model",
"\\",
"IPNPaymentCreator",
"object",
"if",
"it",
"was",
"not",
"set",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/IPNPaymentBuilder.php#L112-L121 | train |
OXID-eSales/paypal | Model/IPNPaymentBuilder.php | IPNPaymentBuilder.buildPayment | public function buildPayment()
{
$return = null;
// Setter forms request payment from request parameters.
$requestOrderPayment = $this->prepareRequestOrderPayment();
// Create order payment from database to check if it match created from request.
$orderPayment = $this->loadOrderPayment($requestOrderPayment->getTransactionId());
// Only need validate if there is order in database.
// If request payment do not have matching payment with order return null.
if ($orderPayment->getOrderId()) {
// Validator change request payment by adding information if it is valid.
$orderPayment = $this->addPaymentValidationInformation($requestOrderPayment, $orderPayment);
$orderPayment = $this->changePaymentStatusInfo($requestOrderPayment, $orderPayment);
$orderPayment->save();
$return = $orderPayment;
} else {
//IPN request might be for a transaction that does not yet exist in the shop database.
$paymentCreator = $this->getPaymentCreator();
$return = $paymentCreator->handleOrderPayment($requestOrderPayment);
}
return $return;
} | php | public function buildPayment()
{
$return = null;
// Setter forms request payment from request parameters.
$requestOrderPayment = $this->prepareRequestOrderPayment();
// Create order payment from database to check if it match created from request.
$orderPayment = $this->loadOrderPayment($requestOrderPayment->getTransactionId());
// Only need validate if there is order in database.
// If request payment do not have matching payment with order return null.
if ($orderPayment->getOrderId()) {
// Validator change request payment by adding information if it is valid.
$orderPayment = $this->addPaymentValidationInformation($requestOrderPayment, $orderPayment);
$orderPayment = $this->changePaymentStatusInfo($requestOrderPayment, $orderPayment);
$orderPayment->save();
$return = $orderPayment;
} else {
//IPN request might be for a transaction that does not yet exist in the shop database.
$paymentCreator = $this->getPaymentCreator();
$return = $paymentCreator->handleOrderPayment($requestOrderPayment);
}
return $return;
} | [
"public",
"function",
"buildPayment",
"(",
")",
"{",
"$",
"return",
"=",
"null",
";",
"// Setter forms request payment from request parameters.",
"$",
"requestOrderPayment",
"=",
"$",
"this",
"->",
"prepareRequestOrderPayment",
"(",
")",
";",
"// Create order payment from... | Create payment from given request.
@return \OxidEsales\PayPalModule\Model\OrderPayment|null | [
"Create",
"payment",
"from",
"given",
"request",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/IPNPaymentBuilder.php#L168-L193 | train |
OXID-eSales/paypal | Model/IPNPaymentBuilder.php | IPNPaymentBuilder.loadOrderPayment | protected function loadOrderPayment($transactionId)
{
$orderPayment = oxNew(\OxidEsales\PayPalModule\Model\OrderPayment::class);
$orderPayment->loadByTransactionId($transactionId);
return $orderPayment;
} | php | protected function loadOrderPayment($transactionId)
{
$orderPayment = oxNew(\OxidEsales\PayPalModule\Model\OrderPayment::class);
$orderPayment->loadByTransactionId($transactionId);
return $orderPayment;
} | [
"protected",
"function",
"loadOrderPayment",
"(",
"$",
"transactionId",
")",
"{",
"$",
"orderPayment",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"PayPalModule",
"\\",
"Model",
"\\",
"OrderPayment",
"::",
"class",
")",
";",
"$",
"orderPayment",
"->",
"loadBy... | Load order payment from transaction id.
@param string $transactionId transaction id to load object.
@return \OxidEsales\PayPalModule\Model\OrderPayment|null | [
"Load",
"order",
"payment",
"from",
"transaction",
"id",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/IPNPaymentBuilder.php#L202-L208 | train |
OXID-eSales/paypal | Model/IPNPaymentBuilder.php | IPNPaymentBuilder.prepareRequestOrderPayment | protected function prepareRequestOrderPayment()
{
$requestOrderPayment = oxNew(\OxidEsales\PayPalModule\Model\OrderPayment::class);
$request = $this->getRequest();
$requestPaymentSetter = $this->getOrderPaymentSetter();
$requestPaymentSetter->setRequest($request);
$requestPaymentSetter->setRequestOrderPayment($requestOrderPayment);
$requestOrderPayment = $requestPaymentSetter->getRequestOrderPayment();
return $requestOrderPayment;
} | php | protected function prepareRequestOrderPayment()
{
$requestOrderPayment = oxNew(\OxidEsales\PayPalModule\Model\OrderPayment::class);
$request = $this->getRequest();
$requestPaymentSetter = $this->getOrderPaymentSetter();
$requestPaymentSetter->setRequest($request);
$requestPaymentSetter->setRequestOrderPayment($requestOrderPayment);
$requestOrderPayment = $requestPaymentSetter->getRequestOrderPayment();
return $requestOrderPayment;
} | [
"protected",
"function",
"prepareRequestOrderPayment",
"(",
")",
"{",
"$",
"requestOrderPayment",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"PayPalModule",
"\\",
"Model",
"\\",
"OrderPayment",
"::",
"class",
")",
";",
"$",
"request",
"=",
"$",
"this",
"->",... | Wrapper to set parameters to order payment from request.
@return \OxidEsales\PayPalModule\Model\OrderPayment | [
"Wrapper",
"to",
"set",
"parameters",
"to",
"order",
"payment",
"from",
"request",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/IPNPaymentBuilder.php#L215-L227 | train |
OXID-eSales/paypal | Model/IPNPaymentBuilder.php | IPNPaymentBuilder.addPaymentValidationInformation | protected function addPaymentValidationInformation($requestOrderPayment, $orderPayment)
{
$lang = $this->getLang();
$paymentValidator = $this->getOrderPaymentValidator();
$paymentValidator->setRequestOrderPayment($requestOrderPayment);
$paymentValidator->setOrderPayment($orderPayment);
$paymentValidator->setLang($lang);
$paymentIsValid = $paymentValidator->isValid();
if (!$paymentIsValid) {
$orderPayment->setIsValid($paymentIsValid);
$comment = oxNew(\OxidEsales\PayPalModule\Model\OrderPaymentComment::class);
$comment->setComment($paymentValidator->getValidationFailureMessage());
$orderPayment->addComment($comment);
}
return $orderPayment;
} | php | protected function addPaymentValidationInformation($requestOrderPayment, $orderPayment)
{
$lang = $this->getLang();
$paymentValidator = $this->getOrderPaymentValidator();
$paymentValidator->setRequestOrderPayment($requestOrderPayment);
$paymentValidator->setOrderPayment($orderPayment);
$paymentValidator->setLang($lang);
$paymentIsValid = $paymentValidator->isValid();
if (!$paymentIsValid) {
$orderPayment->setIsValid($paymentIsValid);
$comment = oxNew(\OxidEsales\PayPalModule\Model\OrderPaymentComment::class);
$comment->setComment($paymentValidator->getValidationFailureMessage());
$orderPayment->addComment($comment);
}
return $orderPayment;
} | [
"protected",
"function",
"addPaymentValidationInformation",
"(",
"$",
"requestOrderPayment",
",",
"$",
"orderPayment",
")",
"{",
"$",
"lang",
"=",
"$",
"this",
"->",
"getLang",
"(",
")",
";",
"$",
"paymentValidator",
"=",
"$",
"this",
"->",
"getOrderPaymentValid... | Adds payment validation information.
@param \OxidEsales\PayPalModule\Model\OrderPayment $requestOrderPayment
@param \OxidEsales\PayPalModule\Model\OrderPayment $orderPayment
@return \OxidEsales\PayPalModule\Model\OrderPayment | [
"Adds",
"payment",
"validation",
"information",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/IPNPaymentBuilder.php#L237-L255 | train |
OXID-eSales/paypal | Core/IpnConfig.php | IpnConfig.getPayPalIpnHost | public function getPayPalIpnHost()
{
if (empty($this->payPalIpnHost)) {
$this->payPalIpnHost = self::OEPAYPAL_IPN_HOST;
}
return $this->payPalIpnHost;
} | php | public function getPayPalIpnHost()
{
if (empty($this->payPalIpnHost)) {
$this->payPalIpnHost = self::OEPAYPAL_IPN_HOST;
}
return $this->payPalIpnHost;
} | [
"public",
"function",
"getPayPalIpnHost",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"payPalIpnHost",
")",
")",
"{",
"$",
"this",
"->",
"payPalIpnHost",
"=",
"self",
"::",
"OEPAYPAL_IPN_HOST",
";",
"}",
"return",
"$",
"this",
"->",
"payPa... | Returns PayPal IPN host.
@return string | [
"Returns",
"PayPal",
"IPN",
"host",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/IpnConfig.php#L155-L162 | train |
OXID-eSales/paypal | Core/IpnConfig.php | IpnConfig.getIpnHost | public function getIpnHost()
{
if ($this->getPayPalConfig()->isSandboxEnabled()) {
$url = $this->getPayPalSandboxIpnHost();
} else {
$url = $this->getPayPalIpnHost();
}
return $url;
} | php | public function getIpnHost()
{
if ($this->getPayPalConfig()->isSandboxEnabled()) {
$url = $this->getPayPalSandboxIpnHost();
} else {
$url = $this->getPayPalIpnHost();
}
return $url;
} | [
"public",
"function",
"getIpnHost",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getPayPalConfig",
"(",
")",
"->",
"isSandboxEnabled",
"(",
")",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"getPayPalSandboxIpnHost",
"(",
")",
";",
"}",
"else",
"{",
... | Returns PayPal OR PayPal IPN sandbox host.
@return string | [
"Returns",
"PayPal",
"OR",
"PayPal",
"IPN",
"sandbox",
"host",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/IpnConfig.php#L193-L202 | train |
OXID-eSales/paypal | Core/IpnConfig.php | IpnConfig.getPayPalIpnUrl | public function getPayPalIpnUrl()
{
if (empty($this->payPalIpnUrl)) {
$this->payPalIpnUrl = self::OEPAYPAL_IPN_CALLBACK_URL;
}
return $this->payPalIpnUrl;
} | php | public function getPayPalIpnUrl()
{
if (empty($this->payPalIpnUrl)) {
$this->payPalIpnUrl = self::OEPAYPAL_IPN_CALLBACK_URL;
}
return $this->payPalIpnUrl;
} | [
"public",
"function",
"getPayPalIpnUrl",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"payPalIpnUrl",
")",
")",
"{",
"$",
"this",
"->",
"payPalIpnUrl",
"=",
"self",
"::",
"OEPAYPAL_IPN_CALLBACK_URL",
";",
"}",
"return",
"$",
"this",
"->",
"... | IPN Url getter
@return string | [
"IPN",
"Url",
"getter"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/IpnConfig.php#L219-L226 | train |
OXID-eSales/paypal | Core/IpnConfig.php | IpnConfig.getPayPalSandboxIpnUrl | public function getPayPalSandboxIpnUrl()
{
if (empty($this->payPalSandboxIpnUrl)) {
$this->payPalSandboxIpnUrl = self::OEPAYPAL_SANDBOX_IPN_CALLBACK_URL;
}
return $this->payPalSandboxIpnUrl;
} | php | public function getPayPalSandboxIpnUrl()
{
if (empty($this->payPalSandboxIpnUrl)) {
$this->payPalSandboxIpnUrl = self::OEPAYPAL_SANDBOX_IPN_CALLBACK_URL;
}
return $this->payPalSandboxIpnUrl;
} | [
"public",
"function",
"getPayPalSandboxIpnUrl",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"payPalSandboxIpnUrl",
")",
")",
"{",
"$",
"this",
"->",
"payPalSandboxIpnUrl",
"=",
"self",
"::",
"OEPAYPAL_SANDBOX_IPN_CALLBACK_URL",
";",
"}",
"return",... | PayPal sandbox IPN url getter
@return string | [
"PayPal",
"sandbox",
"IPN",
"url",
"getter"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/IpnConfig.php#L243-L250 | train |
OXID-eSales/paypal | Core/IpnConfig.php | IpnConfig.getPayPalConfig | protected function getPayPalConfig()
{
if (is_null($this->payPalConfig)) {
$this->payPalConfig = oxNew(\OxidEsales\PayPalModule\Core\Config::class);
}
return $this->payPalConfig;
} | php | protected function getPayPalConfig()
{
if (is_null($this->payPalConfig)) {
$this->payPalConfig = oxNew(\OxidEsales\PayPalModule\Core\Config::class);
}
return $this->payPalConfig;
} | [
"protected",
"function",
"getPayPalConfig",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"payPalConfig",
")",
")",
"{",
"$",
"this",
"->",
"payPalConfig",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"PayPalModule",
"\\",
"Core",
"\\",
"C... | Getter for oepaypal config.
@return \OxidEsales\PayPalModule\Core\Config | [
"Getter",
"for",
"oepaypal",
"config",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/IpnConfig.php#L283-L290 | train |
OXID-eSales/paypal | Model/Action/OrderAction.php | OrderAction.getDate | public function getDate()
{
$utilsDate = \OxidEsales\Eshop\Core\Registry::getUtilsDate();
return date('Y-m-d H:i:s', $utilsDate->getTime());
} | php | public function getDate()
{
$utilsDate = \OxidEsales\Eshop\Core\Registry::getUtilsDate();
return date('Y-m-d H:i:s', $utilsDate->getTime());
} | [
"public",
"function",
"getDate",
"(",
")",
"{",
"$",
"utilsDate",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getUtilsDate",
"(",
")",
";",
"return",
"date",
"(",
"'Y-m-d H:i:s'",
",",
"$",
"utilsDate",
"->",
"getTime",
... | Returns formatted date
@return string | [
"Returns",
"formatted",
"date"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Action/OrderAction.php#L82-L87 | train |
OXID-eSales/paypal | Core/ExtensionChecker.php | ExtensionChecker.getShopId | public function getShopId()
{
if (is_null($this->shopId)) {
$this->setShopId(\OxidEsales\Eshop\Core\Registry::getConfig()->getShopId());
}
return $this->shopId;
} | php | public function getShopId()
{
if (is_null($this->shopId)) {
$this->setShopId(\OxidEsales\Eshop\Core\Registry::getConfig()->getShopId());
}
return $this->shopId;
} | [
"public",
"function",
"getShopId",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"shopId",
")",
")",
"{",
"$",
"this",
"->",
"setShopId",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
"... | Return shop id
@return string | [
"Return",
"shop",
"id"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/ExtensionChecker.php#L58-L65 | train |
OXID-eSales/paypal | Core/ExtensionChecker.php | ExtensionChecker.getConfigValue | protected function getConfigValue($configName)
{
$db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$configKey = $config->getConfigParam('sConfigKey');
$select = "SELECT DECODE( `oxvarvalue` , " . $db->quote($configKey) . " ) AS `oxvarvalue` " .
"FROM `oxconfig` WHERE `oxvarname` = " . $db->quote($configName) . " AND `oxshopid` = " . $db->quote($this->getShopId());
return unserialize($db->getOne($select));
} | php | protected function getConfigValue($configName)
{
$db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$config = \OxidEsales\Eshop\Core\Registry::getConfig();
$configKey = $config->getConfigParam('sConfigKey');
$select = "SELECT DECODE( `oxvarvalue` , " . $db->quote($configKey) . " ) AS `oxvarvalue` " .
"FROM `oxconfig` WHERE `oxvarname` = " . $db->quote($configName) . " AND `oxshopid` = " . $db->quote($this->getShopId());
return unserialize($db->getOne($select));
} | [
"protected",
"function",
"getConfigValue",
"(",
"$",
"configName",
")",
"{",
"$",
"db",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
")",
";",
"$",
"config",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"... | Return config value
@param string $configName - config parameter name were stored arrays od extended classes
@return array | [
"Return",
"config",
"value"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/ExtensionChecker.php#L114-L124 | train |
OXID-eSales/paypal | Core/ExtensionChecker.php | ExtensionChecker.isActive | public function isActive()
{
$moduleId = $this->getExtensionId();
$moduleIsActive = false;
$modules = $this->getExtendedClasses();
if (is_array($modules)) {
// Check if module was ever installed.
$moduleExists = false;
foreach ($modules as $extendPath) {
if (false !== strpos($extendPath, '/' . $moduleId . '/')) {
$moduleExists = true;
break;
}
}
// If module exists, check if it is not disabled.
if ($moduleExists) {
$disabledModules = $this->getDisabledModules();
if (!(is_array($disabledModules) && in_array($moduleId, $disabledModules))) {
$moduleIsActive = true;
}
}
}
return $moduleIsActive;
} | php | public function isActive()
{
$moduleId = $this->getExtensionId();
$moduleIsActive = false;
$modules = $this->getExtendedClasses();
if (is_array($modules)) {
// Check if module was ever installed.
$moduleExists = false;
foreach ($modules as $extendPath) {
if (false !== strpos($extendPath, '/' . $moduleId . '/')) {
$moduleExists = true;
break;
}
}
// If module exists, check if it is not disabled.
if ($moduleExists) {
$disabledModules = $this->getDisabledModules();
if (!(is_array($disabledModules) && in_array($moduleId, $disabledModules))) {
$moduleIsActive = true;
}
}
}
return $moduleIsActive;
} | [
"public",
"function",
"isActive",
"(",
")",
"{",
"$",
"moduleId",
"=",
"$",
"this",
"->",
"getExtensionId",
"(",
")",
";",
"$",
"moduleIsActive",
"=",
"false",
";",
"$",
"modules",
"=",
"$",
"this",
"->",
"getExtendedClasses",
"(",
")",
";",
"if",
"(",... | Check if module is active.
@return bool | [
"Check",
"if",
"module",
"is",
"active",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/ExtensionChecker.php#L131-L158 | train |
OXID-eSales/paypal | Model/IPNRequestValidator.php | IPNRequestValidator.getValidationFailureMessage | public function getValidationFailureMessage()
{
$payPalRequest = $this->getPayPalRequest();
$payPalResponse = $this->getPayPalResponse();
$shopOwnerUserName = $this->getShopOwnerUserName();
$receiverEmailPayPal = $payPalRequest[self::RECEIVER_EMAIL];
$validationMessage = array(
'Shop owner' => (string) $shopOwnerUserName,
'PayPal ID' => (string) $receiverEmailPayPal,
'PayPal ACK' => ($payPalResponse->isPayPalAck() ? 'VERIFIED' : 'NOT VERIFIED'),
'PayPal Full Request' => print_r($payPalRequest, true),
'PayPal Full Response' => print_r($payPalResponse->getData(), true),
);
return $validationMessage;
} | php | public function getValidationFailureMessage()
{
$payPalRequest = $this->getPayPalRequest();
$payPalResponse = $this->getPayPalResponse();
$shopOwnerUserName = $this->getShopOwnerUserName();
$receiverEmailPayPal = $payPalRequest[self::RECEIVER_EMAIL];
$validationMessage = array(
'Shop owner' => (string) $shopOwnerUserName,
'PayPal ID' => (string) $receiverEmailPayPal,
'PayPal ACK' => ($payPalResponse->isPayPalAck() ? 'VERIFIED' : 'NOT VERIFIED'),
'PayPal Full Request' => print_r($payPalRequest, true),
'PayPal Full Response' => print_r($payPalResponse->getData(), true),
);
return $validationMessage;
} | [
"public",
"function",
"getValidationFailureMessage",
"(",
")",
"{",
"$",
"payPalRequest",
"=",
"$",
"this",
"->",
"getPayPalRequest",
"(",
")",
";",
"$",
"payPalResponse",
"=",
"$",
"this",
"->",
"getPayPalResponse",
"(",
")",
";",
"$",
"shopOwnerUserName",
"=... | Returns validation failure messages.
@return array | [
"Returns",
"validation",
"failure",
"messages",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/IPNRequestValidator.php#L122-L138 | train |
OXID-eSales/paypal | Model/IPNRequestValidator.php | IPNRequestValidator.isValid | public function isValid()
{
$payPalRequest = $this->getPayPalRequest();
$payPalResponse = $this->getPayPalResponse();
$shopOwnerUserName = $this->getShopOwnerUserName();
$receiverEmailPayPal = $payPalRequest[self::RECEIVER_EMAIL];
return ($payPalResponse->isPayPalAck() && $receiverEmailPayPal == $shopOwnerUserName);
} | php | public function isValid()
{
$payPalRequest = $this->getPayPalRequest();
$payPalResponse = $this->getPayPalResponse();
$shopOwnerUserName = $this->getShopOwnerUserName();
$receiverEmailPayPal = $payPalRequest[self::RECEIVER_EMAIL];
return ($payPalResponse->isPayPalAck() && $receiverEmailPayPal == $shopOwnerUserName);
} | [
"public",
"function",
"isValid",
"(",
")",
"{",
"$",
"payPalRequest",
"=",
"$",
"this",
"->",
"getPayPalRequest",
"(",
")",
";",
"$",
"payPalResponse",
"=",
"$",
"this",
"->",
"getPayPalResponse",
"(",
")",
";",
"$",
"shopOwnerUserName",
"=",
"$",
"this",
... | Validate if IPN request from PayPal and to correct shop.
@return bool | [
"Validate",
"if",
"IPN",
"request",
"from",
"PayPal",
"and",
"to",
"correct",
"shop",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/IPNRequestValidator.php#L145-L153 | train |
OXID-eSales/paypal | Model/IPNPaymentValidator.php | IPNPaymentValidator.getValidationFailureMessage | public function getValidationFailureMessage()
{
$requestPayment = $this->getRequestOrderPayment();
$orderPayment = $this->getOrderPayment();
$currencyPayPal = $requestPayment->getCurrency();
$pricePayPal = $requestPayment->getAmount();
$currencyPayment = $orderPayment->getCurrency();
$amountPayment = $orderPayment->getAmount();
$lang = $this->getLang();
$validationMessage = $lang->translateString('OEPAYPAL_PAYMENT_INFORMATION') . ': ' . $amountPayment . ' ' . $currencyPayment . '. ' . $lang->translateString('OEPAYPAL_INFORMATION') . ': ' . $pricePayPal . ' ' . $currencyPayPal . '.';
return $validationMessage;
} | php | public function getValidationFailureMessage()
{
$requestPayment = $this->getRequestOrderPayment();
$orderPayment = $this->getOrderPayment();
$currencyPayPal = $requestPayment->getCurrency();
$pricePayPal = $requestPayment->getAmount();
$currencyPayment = $orderPayment->getCurrency();
$amountPayment = $orderPayment->getAmount();
$lang = $this->getLang();
$validationMessage = $lang->translateString('OEPAYPAL_PAYMENT_INFORMATION') . ': ' . $amountPayment . ' ' . $currencyPayment . '. ' . $lang->translateString('OEPAYPAL_INFORMATION') . ': ' . $pricePayPal . ' ' . $currencyPayPal . '.';
return $validationMessage;
} | [
"public",
"function",
"getValidationFailureMessage",
"(",
")",
"{",
"$",
"requestPayment",
"=",
"$",
"this",
"->",
"getRequestOrderPayment",
"(",
")",
";",
"$",
"orderPayment",
"=",
"$",
"this",
"->",
"getOrderPayment",
"(",
")",
";",
"$",
"currencyPayPal",
"=... | Returns validation failure message.
@return string | [
"Returns",
"validation",
"failure",
"message",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/IPNPaymentValidator.php#L115-L130 | train |
OXID-eSales/paypal | Model/IPNPaymentValidator.php | IPNPaymentValidator.isValid | public function isValid()
{
$requestPayment = $this->getRequestOrderPayment();
$orderPayment = $this->getOrderPayment();
$currencyPayPal = $requestPayment->getCurrency();
$pricePayPal = $requestPayment->getAmount();
$currencyPayment = $orderPayment->getCurrency();
$amountPayment = $orderPayment->getAmount();
return ($currencyPayPal == $currencyPayment && $pricePayPal == $amountPayment);
} | php | public function isValid()
{
$requestPayment = $this->getRequestOrderPayment();
$orderPayment = $this->getOrderPayment();
$currencyPayPal = $requestPayment->getCurrency();
$pricePayPal = $requestPayment->getAmount();
$currencyPayment = $orderPayment->getCurrency();
$amountPayment = $orderPayment->getAmount();
return ($currencyPayPal == $currencyPayment && $pricePayPal == $amountPayment);
} | [
"public",
"function",
"isValid",
"(",
")",
"{",
"$",
"requestPayment",
"=",
"$",
"this",
"->",
"getRequestOrderPayment",
"(",
")",
";",
"$",
"orderPayment",
"=",
"$",
"this",
"->",
"getOrderPayment",
"(",
")",
";",
"$",
"currencyPayPal",
"=",
"$",
"request... | Check if PayPal response fits payment information.
@return bool | [
"Check",
"if",
"PayPal",
"response",
"fits",
"payment",
"information",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/IPNPaymentValidator.php#L137-L149 | train |
OXID-eSales/paypal | Controller/FrontendController.php | FrontendController.getRequest | public function getRequest()
{
if (is_null($this->request)) {
$this->request = oxNew(\OxidEsales\PayPalModule\Core\Request::class);
}
return $this->request;
} | php | public function getRequest()
{
if (is_null($this->request)) {
$this->request = oxNew(\OxidEsales\PayPalModule\Core\Request::class);
}
return $this->request;
} | [
"public",
"function",
"getRequest",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"request",
")",
")",
"{",
"$",
"this",
"->",
"request",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"PayPalModule",
"\\",
"Core",
"\\",
"Request",
"::",
... | Return request object
@return \OxidEsales\PayPalModule\Core\Request | [
"Return",
"request",
"object"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/FrontendController.php#L48-L55 | train |
OXID-eSales/paypal | Controller/FrontendController.php | FrontendController.getLogger | public function getLogger()
{
if (is_null($this->logger)) {
$this->logger = oxNew(\OxidEsales\PayPalModule\Core\Logger::class);
$this->logger->setLoggerSessionId($this->getSession()->getId());
}
return $this->logger;
} | php | public function getLogger()
{
if (is_null($this->logger)) {
$this->logger = oxNew(\OxidEsales\PayPalModule\Core\Logger::class);
$this->logger->setLoggerSessionId($this->getSession()->getId());
}
return $this->logger;
} | [
"public",
"function",
"getLogger",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"logger",
")",
")",
"{",
"$",
"this",
"->",
"logger",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"PayPalModule",
"\\",
"Core",
"\\",
"Logger",
"::",
"cl... | Return PayPal logger
@return \OxidEsales\PayPalModule\Core\Logger | [
"Return",
"PayPal",
"logger"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/FrontendController.php#L62-L70 | train |
OXID-eSales/paypal | Model/Order.php | Order.loadPayPalOrder | public function loadPayPalOrder()
{
$orderId = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("sess_challenge");
// if order is not created yet - generating it
if ($orderId === null) {
$orderId = \OxidEsales\Eshop\Core\UtilsObject::getInstance()->generateUID();
$this->setId($orderId);
$this->save();
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable("sess_challenge", $orderId);
}
return $this->load($orderId);
} | php | public function loadPayPalOrder()
{
$orderId = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("sess_challenge");
// if order is not created yet - generating it
if ($orderId === null) {
$orderId = \OxidEsales\Eshop\Core\UtilsObject::getInstance()->generateUID();
$this->setId($orderId);
$this->save();
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable("sess_challenge", $orderId);
}
return $this->load($orderId);
} | [
"public",
"function",
"loadPayPalOrder",
"(",
")",
"{",
"$",
"orderId",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getSession",
"(",
")",
"->",
"getVariable",
"(",
"\"sess_challenge\"",
")",
";",
"// if order is not created ye... | Loads order associated with current PayPal order
@return bool | [
"Loads",
"order",
"associated",
"with",
"current",
"PayPal",
"order"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Order.php#L49-L62 | train |
OXID-eSales/paypal | Model/Order.php | Order.oePayPalUpdateOrderNumber | public function oePayPalUpdateOrderNumber()
{
if ($this->oxorder__oxordernr->value) {
$updated = (bool) oxNew(\OxidEsales\Eshop\Core\Counter::class)->update($this->_getCounterIdent(), $this->oxorder__oxordernr->value);
} else {
$updated = $this->_setNumber();
}
return $updated;
} | php | public function oePayPalUpdateOrderNumber()
{
if ($this->oxorder__oxordernr->value) {
$updated = (bool) oxNew(\OxidEsales\Eshop\Core\Counter::class)->update($this->_getCounterIdent(), $this->oxorder__oxordernr->value);
} else {
$updated = $this->_setNumber();
}
return $updated;
} | [
"public",
"function",
"oePayPalUpdateOrderNumber",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"oxorder__oxordernr",
"->",
"value",
")",
"{",
"$",
"updated",
"=",
"(",
"bool",
")",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Co... | Updates order number.
@return bool | [
"Updates",
"order",
"number",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Order.php#L69-L78 | train |
OXID-eSales/paypal | Model/Order.php | Order.deletePayPalOrder | public function deletePayPalOrder()
{
$result = false;
if ($this->loadPayPalOrder()) {
$this->getPayPalOrder()->delete();
$result = $this->delete();
}
return $result;
} | php | public function deletePayPalOrder()
{
$result = false;
if ($this->loadPayPalOrder()) {
$this->getPayPalOrder()->delete();
$result = $this->delete();
}
return $result;
} | [
"public",
"function",
"deletePayPalOrder",
"(",
")",
"{",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"loadPayPalOrder",
"(",
")",
")",
"{",
"$",
"this",
"->",
"getPayPalOrder",
"(",
")",
"->",
"delete",
"(",
")",
";",
"$",
"resul... | Delete order created by current PayPal ordering process
@return bool | [
"Delete",
"order",
"created",
"by",
"current",
"PayPal",
"ordering",
"process"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Order.php#L85-L95 | train |
OXID-eSales/paypal | Model/Order.php | Order.delete | public function delete($oxId = null)
{
$this->getPayPalOrder($oxId)->delete();
return parent::delete($oxId);
} | php | public function delete($oxId = null)
{
$this->getPayPalOrder($oxId)->delete();
return parent::delete($oxId);
} | [
"public",
"function",
"delete",
"(",
"$",
"oxId",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"getPayPalOrder",
"(",
"$",
"oxId",
")",
"->",
"delete",
"(",
")",
";",
"return",
"parent",
"::",
"delete",
"(",
"$",
"oxId",
")",
";",
"}"
] | Delete order together with PayPal order data.
@param string $oxId
@return bool | [
"Delete",
"order",
"together",
"with",
"PayPal",
"order",
"data",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Order.php#L104-L109 | train |
OXID-eSales/paypal | Model/Order.php | Order.setPaymentInfoPayPalOrder | protected function setPaymentInfoPayPalOrder($transactionId)
{
// set transaction ID and payment date to order
$db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$query = 'update oxorder set oxtransid=' . $db->quote($transactionId) . ' where oxid=' . $db->quote($this->getId());
$db->execute($query);
//updating order object
$this->oxorder__oxtransid = new \OxidEsales\Eshop\Core\Field($transactionId);
} | php | protected function setPaymentInfoPayPalOrder($transactionId)
{
// set transaction ID and payment date to order
$db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$query = 'update oxorder set oxtransid=' . $db->quote($transactionId) . ' where oxid=' . $db->quote($this->getId());
$db->execute($query);
//updating order object
$this->oxorder__oxtransid = new \OxidEsales\Eshop\Core\Field($transactionId);
} | [
"protected",
"function",
"setPaymentInfoPayPalOrder",
"(",
"$",
"transactionId",
")",
"{",
"// set transaction ID and payment date to order",
"$",
"db",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
")",
";",
"$"... | Updates order transaction status, ID and date.
@param string $transactionId Order transaction ID | [
"Updates",
"order",
"transaction",
"status",
"ID",
"and",
"date",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Order.php#L116-L126 | train |
OXID-eSales/paypal | Model/Order.php | Order.finalizePayPalOrder | public function finalizePayPalOrder($result, $basket, $transactionMode)
{
$utilsDate = \OxidEsales\Eshop\Core\Registry::getUtilsDate();
$date = date('Y-m-d H:i:s', $utilsDate->getTime());
// set order status, transaction ID and payment date to order
$this->setPaymentInfoPayPalOrder($result->getTransactionId());
$currency = $result->getCurrencyCode();
if (!$currency) {
$currency = $this->getOrderCurrency()->name;
}
// PayPal order info
$payPalOrder = $this->getPayPalOrder();
$payPalOrder->setOrderId($this->getId());
$payPalOrder->setPaymentStatus('pending');
$payPalOrder->setTransactionMode($transactionMode);
$payPalOrder->setCurrency($currency);
$payPalOrder->setTotalOrderSum($basket->getPrice()->getBruttoPrice());
if ($transactionMode == 'Sale') {
$payPalOrder->setCapturedAmount($basket->getPrice()->getBruttoPrice());
}
$payPalOrder->save();
$orderPayment = oxNew(\OxidEsales\PayPalModule\Model\OrderPayment::class);
$orderPayment->setTransactionId($result->getTransactionId());
$orderPayment->setCorrelationId($result->getCorrelationId());
$orderPayment->setDate($date);
$orderPayment->setAction(($transactionMode == 'Sale') ? 'capture' : 'authorization');
$orderPayment->setStatus($result->getPaymentStatus());
$orderPayment->setAmount($result->getAmount());
$orderPayment->setCurrency($result->getCurrencyCode());
//Adding payment information
$paymentList = $this->getPayPalOrder()->getPaymentList();
$paymentList->addPayment($orderPayment);
//setting order payment status after
$paymentStatusCalculator = oxNew(\OxidEsales\PayPalModule\Model\OrderPaymentStatusCalculator::class);
$paymentStatusCalculator->setOrder($this->getPayPalOrder());
$this->getPayPalOrder()->setPaymentStatus($paymentStatusCalculator->getStatus(), $this);
$this->getPayPalOrder()->save();
//clear PayPal identification
$this->getSession()->deleteVariable('oepaypal');
$this->getSession()->deleteVariable("oepaypal-payerId");
$this->getSession()->deleteVariable("oepaypal-userId");
$this->getSession()->deleteVariable('oepaypal-basketAmount');
} | php | public function finalizePayPalOrder($result, $basket, $transactionMode)
{
$utilsDate = \OxidEsales\Eshop\Core\Registry::getUtilsDate();
$date = date('Y-m-d H:i:s', $utilsDate->getTime());
// set order status, transaction ID and payment date to order
$this->setPaymentInfoPayPalOrder($result->getTransactionId());
$currency = $result->getCurrencyCode();
if (!$currency) {
$currency = $this->getOrderCurrency()->name;
}
// PayPal order info
$payPalOrder = $this->getPayPalOrder();
$payPalOrder->setOrderId($this->getId());
$payPalOrder->setPaymentStatus('pending');
$payPalOrder->setTransactionMode($transactionMode);
$payPalOrder->setCurrency($currency);
$payPalOrder->setTotalOrderSum($basket->getPrice()->getBruttoPrice());
if ($transactionMode == 'Sale') {
$payPalOrder->setCapturedAmount($basket->getPrice()->getBruttoPrice());
}
$payPalOrder->save();
$orderPayment = oxNew(\OxidEsales\PayPalModule\Model\OrderPayment::class);
$orderPayment->setTransactionId($result->getTransactionId());
$orderPayment->setCorrelationId($result->getCorrelationId());
$orderPayment->setDate($date);
$orderPayment->setAction(($transactionMode == 'Sale') ? 'capture' : 'authorization');
$orderPayment->setStatus($result->getPaymentStatus());
$orderPayment->setAmount($result->getAmount());
$orderPayment->setCurrency($result->getCurrencyCode());
//Adding payment information
$paymentList = $this->getPayPalOrder()->getPaymentList();
$paymentList->addPayment($orderPayment);
//setting order payment status after
$paymentStatusCalculator = oxNew(\OxidEsales\PayPalModule\Model\OrderPaymentStatusCalculator::class);
$paymentStatusCalculator->setOrder($this->getPayPalOrder());
$this->getPayPalOrder()->setPaymentStatus($paymentStatusCalculator->getStatus(), $this);
$this->getPayPalOrder()->save();
//clear PayPal identification
$this->getSession()->deleteVariable('oepaypal');
$this->getSession()->deleteVariable("oepaypal-payerId");
$this->getSession()->deleteVariable("oepaypal-userId");
$this->getSession()->deleteVariable('oepaypal-basketAmount');
} | [
"public",
"function",
"finalizePayPalOrder",
"(",
"$",
"result",
",",
"$",
"basket",
",",
"$",
"transactionMode",
")",
"{",
"$",
"utilsDate",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getUtilsDate",
"(",
")",
";",
"$",
... | Finalizes PayPal order.
@param \OxidEsales\PayPalModule\Model\Response\ResponseDoExpressCheckoutPayment $result PayPal results array.
@param \OxidEsales\Eshop\Application\Model\Basket $basket Basket object.
@param string $transactionMode Transaction mode Sale|Authorization. | [
"Finalizes",
"PayPal",
"order",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Order.php#L135-L184 | train |
OXID-eSales/paypal | Model/Order.php | Order._setOrderStatus | protected function _setOrderStatus($status)
{
$paymentTypeObject = $this->getPaymentType();
$paymentType = $paymentTypeObject ? $paymentTypeObject->getFieldData('oxpaymentsid') : null;
if ($paymentType != 'oxidpaypal' || $status != self::OEPAYPAL_TRANSACTION_STATUS_OK) {
parent::_setOrderStatus($status);
}
} | php | protected function _setOrderStatus($status)
{
$paymentTypeObject = $this->getPaymentType();
$paymentType = $paymentTypeObject ? $paymentTypeObject->getFieldData('oxpaymentsid') : null;
if ($paymentType != 'oxidpaypal' || $status != self::OEPAYPAL_TRANSACTION_STATUS_OK) {
parent::_setOrderStatus($status);
}
} | [
"protected",
"function",
"_setOrderStatus",
"(",
"$",
"status",
")",
"{",
"$",
"paymentTypeObject",
"=",
"$",
"this",
"->",
"getPaymentType",
"(",
")",
";",
"$",
"paymentType",
"=",
"$",
"paymentTypeObject",
"?",
"$",
"paymentTypeObject",
"->",
"getFieldData",
... | Paypal specific status checking.
If status comes as OK, lets check real paypal payment state,
and if really ok, so lets set it, otherwise dont change status.
@param string $status order transaction status | [
"Paypal",
"specific",
"status",
"checking",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Order.php#L194-L201 | train |
OXID-eSales/paypal | Model/Order.php | Order.markOrderPaid | public function markOrderPaid()
{
parent::_setOrderStatus(self::OEPAYPAL_TRANSACTION_STATUS_OK);
$db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$utilsDate = \OxidEsales\Eshop\Core\Registry::getUtilsDate();
$date = date('Y-m-d H:i:s', $utilsDate->getTime());
$query = 'update oxorder set oxpaid=? where oxid=?';
$db->execute($query, array($date, $this->getId()));
//updating order object
$this->oxorder__oxpaid = new \OxidEsales\Eshop\Core\Field($date);
} | php | public function markOrderPaid()
{
parent::_setOrderStatus(self::OEPAYPAL_TRANSACTION_STATUS_OK);
$db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$utilsDate = \OxidEsales\Eshop\Core\Registry::getUtilsDate();
$date = date('Y-m-d H:i:s', $utilsDate->getTime());
$query = 'update oxorder set oxpaid=? where oxid=?';
$db->execute($query, array($date, $this->getId()));
//updating order object
$this->oxorder__oxpaid = new \OxidEsales\Eshop\Core\Field($date);
} | [
"public",
"function",
"markOrderPaid",
"(",
")",
"{",
"parent",
"::",
"_setOrderStatus",
"(",
"self",
"::",
"OEPAYPAL_TRANSACTION_STATUS_OK",
")",
";",
"$",
"db",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(... | Update order oxpaid to current time. | [
"Update",
"order",
"oxpaid",
"to",
"current",
"time",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Order.php#L206-L219 | train |
OXID-eSales/paypal | Model/Order.php | Order.getPayPalOrder | public function getPayPalOrder($oxId = null)
{
if (is_null($this->payPalOrder)) {
$orderId = is_null($oxId) ? $this->getId() : $oxId;
$order = oxNew(\OxidEsales\PayPalModule\Model\PayPalOrder::class);
$order->load($orderId);
$this->payPalOrder = $order;
}
return $this->payPalOrder;
} | php | public function getPayPalOrder($oxId = null)
{
if (is_null($this->payPalOrder)) {
$orderId = is_null($oxId) ? $this->getId() : $oxId;
$order = oxNew(\OxidEsales\PayPalModule\Model\PayPalOrder::class);
$order->load($orderId);
$this->payPalOrder = $order;
}
return $this->payPalOrder;
} | [
"public",
"function",
"getPayPalOrder",
"(",
"$",
"oxId",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"payPalOrder",
")",
")",
"{",
"$",
"orderId",
"=",
"is_null",
"(",
"$",
"oxId",
")",
"?",
"$",
"this",
"->",
"getId",
"("... | Returns PayPal order object.
@param string $oxId
@return \OxidEsales\PayPalModule\Model\PayPalOrder|null | [
"Returns",
"PayPal",
"order",
"object",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Order.php#L257-L267 | train |
OXID-eSales/paypal | Model/Order.php | Order.isPayPalPaymentValid | protected function isPayPalPaymentValid($user, $basketPrice, $shippingId)
{
$valid = true;
$payPalPayment = oxNew(\OxidEsales\Eshop\Application\Model\Payment::class);
$payPalPayment->load('oxidpaypal');
if (!$payPalPayment->isValidPayment(null, null, $user, $basketPrice, $shippingId)) {
$valid = $this->isEmptyPaymentValid($user, $basketPrice, $shippingId);
}
return $valid;
} | php | protected function isPayPalPaymentValid($user, $basketPrice, $shippingId)
{
$valid = true;
$payPalPayment = oxNew(\OxidEsales\Eshop\Application\Model\Payment::class);
$payPalPayment->load('oxidpaypal');
if (!$payPalPayment->isValidPayment(null, null, $user, $basketPrice, $shippingId)) {
$valid = $this->isEmptyPaymentValid($user, $basketPrice, $shippingId);
}
return $valid;
} | [
"protected",
"function",
"isPayPalPaymentValid",
"(",
"$",
"user",
",",
"$",
"basketPrice",
",",
"$",
"shippingId",
")",
"{",
"$",
"valid",
"=",
"true",
";",
"$",
"payPalPayment",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"... | Checks whether PayPal payment is available.
@param object $user
@param double $basketPrice
@param string $shippingId
@return bool | [
"Checks",
"whether",
"PayPal",
"payment",
"is",
"available",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Order.php#L298-L309 | train |
OXID-eSales/paypal | Model/Order.php | Order.isEmptyPaymentValid | protected function isEmptyPaymentValid($user, $basketPrice, $shippingId)
{
$valid = true;
$emptyPayment = oxNew(\OxidEsales\Eshop\Application\Model\Payment::class);
$emptyPayment->load('oxempty');
if (!$emptyPayment->isValidPayment(null, null, $user, $basketPrice, $shippingId)) {
$valid = false;
}
return $valid;
} | php | protected function isEmptyPaymentValid($user, $basketPrice, $shippingId)
{
$valid = true;
$emptyPayment = oxNew(\OxidEsales\Eshop\Application\Model\Payment::class);
$emptyPayment->load('oxempty');
if (!$emptyPayment->isValidPayment(null, null, $user, $basketPrice, $shippingId)) {
$valid = false;
}
return $valid;
} | [
"protected",
"function",
"isEmptyPaymentValid",
"(",
"$",
"user",
",",
"$",
"basketPrice",
",",
"$",
"shippingId",
")",
"{",
"$",
"valid",
"=",
"true",
";",
"$",
"emptyPayment",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\... | Checks whether Empty payment is available.
@param object $user
@param double $basketPrice
@param string $shippingId
@return bool | [
"Checks",
"whether",
"Empty",
"payment",
"is",
"available",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Order.php#L320-L331 | train |
OXID-eSales/paypal | Model/IPNRequestPaymentSetter.php | IPNRequestPaymentSetter.prepareOrderPayment | protected function prepareOrderPayment($requestOrderPayment)
{
$request = $this->getRequest();
$requestOrderPayment->setStatus($request->getRequestParameter(self::PAYPAL_PAYMENT_STATUS));
$requestOrderPayment->setTransactionId($request->getRequestParameter(self::PAYPAL_TRANSACTION_ID));
$requestOrderPayment->setCurrency($request->getRequestParameter(self::MC_CURRENCY));
$requestOrderPayment->setAmount($this->getAmount());
$requestOrderPayment->setAction($this->getAction());
$correlationId = $request->getRequestParameter(self::CORRELATION_ID);
if (!$correlationId) {
$correlationId = $request->getRequestParameter(self::IPN_TRACK_ID);
}
$requestOrderPayment->setCorrelationId($correlationId);
$date = 0 < strlen($request->getRequestParameter(self::PAYMENT_DATE)) ?
date('Y-m-d H:i:s', strtotime($request->getRequestParameter(self::PAYMENT_DATE))) : null;
$requestOrderPayment->setDate($date);
} | php | protected function prepareOrderPayment($requestOrderPayment)
{
$request = $this->getRequest();
$requestOrderPayment->setStatus($request->getRequestParameter(self::PAYPAL_PAYMENT_STATUS));
$requestOrderPayment->setTransactionId($request->getRequestParameter(self::PAYPAL_TRANSACTION_ID));
$requestOrderPayment->setCurrency($request->getRequestParameter(self::MC_CURRENCY));
$requestOrderPayment->setAmount($this->getAmount());
$requestOrderPayment->setAction($this->getAction());
$correlationId = $request->getRequestParameter(self::CORRELATION_ID);
if (!$correlationId) {
$correlationId = $request->getRequestParameter(self::IPN_TRACK_ID);
}
$requestOrderPayment->setCorrelationId($correlationId);
$date = 0 < strlen($request->getRequestParameter(self::PAYMENT_DATE)) ?
date('Y-m-d H:i:s', strtotime($request->getRequestParameter(self::PAYMENT_DATE))) : null;
$requestOrderPayment->setDate($date);
} | [
"protected",
"function",
"prepareOrderPayment",
"(",
"$",
"requestOrderPayment",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
";",
"$",
"requestOrderPayment",
"->",
"setStatus",
"(",
"$",
"request",
"->",
"getRequestParameter",
"(",
... | Prepare PayPal payment. Fill up with request values.
@param \OxidEsales\PayPalModule\Model\OrderPayment $requestOrderPayment order to set params. | [
"Prepare",
"PayPal",
"payment",
".",
"Fill",
"up",
"with",
"request",
"values",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/IPNRequestPaymentSetter.php#L118-L137 | train |
OXID-eSales/paypal | Model/IPNRequestPaymentSetter.php | IPNRequestPaymentSetter.getAction | protected function getAction()
{
$action = self::CAPTURE_ACTION;
$request = $this->getRequest();
$rawAmount = $request->getRequestParameter(self::MC_GROSS);
$status = $request->getRequestParameter(self::PAYPAL_PAYMENT_STATUS);
if ((0 > $rawAmount) && (self::PAYPAL_STATUS_REFUND_DONE == $status)) {
$action = self::REFUND_ACTION;
}
return $action;
} | php | protected function getAction()
{
$action = self::CAPTURE_ACTION;
$request = $this->getRequest();
$rawAmount = $request->getRequestParameter(self::MC_GROSS);
$status = $request->getRequestParameter(self::PAYPAL_PAYMENT_STATUS);
if ((0 > $rawAmount) && (self::PAYPAL_STATUS_REFUND_DONE == $status)) {
$action = self::REFUND_ACTION;
}
return $action;
} | [
"protected",
"function",
"getAction",
"(",
")",
"{",
"$",
"action",
"=",
"self",
"::",
"CAPTURE_ACTION",
";",
"$",
"request",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
";",
"$",
"rawAmount",
"=",
"$",
"request",
"->",
"getRequestParameter",
"(",
"s... | Get PayPal action from request, we might have a refund.
@return string | [
"Get",
"PayPal",
"action",
"from",
"request",
"we",
"might",
"have",
"a",
"refund",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/IPNRequestPaymentSetter.php#L144-L156 | train |
OXID-eSales/paypal | Model/IPNRequestPaymentSetter.php | IPNRequestPaymentSetter.getAmount | protected function getAmount()
{
$request = $this->getRequest();
return !is_null($request->getRequestParameter(self::MC_GROSS)) ? abs($request->getRequestParameter(self::MC_GROSS)) : null;
} | php | protected function getAmount()
{
$request = $this->getRequest();
return !is_null($request->getRequestParameter(self::MC_GROSS)) ? abs($request->getRequestParameter(self::MC_GROSS)) : null;
} | [
"protected",
"function",
"getAmount",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
";",
"return",
"!",
"is_null",
"(",
"$",
"request",
"->",
"getRequestParameter",
"(",
"self",
"::",
"MC_GROSS",
")",
")",
"?",
"abs",
"... | Get amount from request.
@return number | [
"Get",
"amount",
"from",
"request",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/IPNRequestPaymentSetter.php#L163-L167 | train |
OXID-eSales/paypal | Model/Action/OrderActionFactory.php | OrderActionFactory.createAction | public function createAction($action)
{
$method = "get" . ucfirst($action) . "Action";
if (!method_exists($this, $method)) {
/** @var \OxidEsales\PayPalModule\Core\Exception\PayPalInvalidActionException $exception */
$exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalInvalidActionException::class);
throw $exception;
}
return $this->$method();
} | php | public function createAction($action)
{
$method = "get" . ucfirst($action) . "Action";
if (!method_exists($this, $method)) {
/** @var \OxidEsales\PayPalModule\Core\Exception\PayPalInvalidActionException $exception */
$exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalInvalidActionException::class);
throw $exception;
}
return $this->$method();
} | [
"public",
"function",
"createAction",
"(",
"$",
"action",
")",
"{",
"$",
"method",
"=",
"\"get\"",
".",
"ucfirst",
"(",
"$",
"action",
")",
".",
"\"Action\"",
";",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"this",
",",
"$",
"method",
")",
")",
"{",
... | Creates action object by given action name.
@param string $action
@return object
@throws \OxidEsales\PayPalModule\Core\Exception\PayPalInvalidActionException | [
"Creates",
"action",
"object",
"by",
"given",
"action",
"name",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Action/OrderActionFactory.php#L80-L91 | train |
OXID-eSales/paypal | Model/Action/OrderActionFactory.php | OrderActionFactory.getCaptureAction | public function getCaptureAction()
{
$order = $this->getOrder();
$request = $this->getRequest();
$data = oxNew(\OxidEsales\PayPalModule\Model\Action\Data\OrderCaptureActionData::class, $request, $order);
$handler = oxNew(\OxidEsales\PayPalModule\Model\Action\Handler\OrderCaptureActionHandler::class, $data);
$reauthorizeData = oxNew(\OxidEsales\PayPalModule\Model\Action\Data\OrderReauthorizeActionData::class, $request, $order);
$reauthorizeHandler = oxNew(\OxidEsales\PayPalModule\Model\Action\Handler\OrderReauthorizeActionHandler::class, $reauthorizeData);
$action = oxNew(\OxidEsales\PayPalModule\Model\Action\OrderCaptureAction::class, $handler, $order->getPayPalOrder(), $reauthorizeHandler);
return $action;
} | php | public function getCaptureAction()
{
$order = $this->getOrder();
$request = $this->getRequest();
$data = oxNew(\OxidEsales\PayPalModule\Model\Action\Data\OrderCaptureActionData::class, $request, $order);
$handler = oxNew(\OxidEsales\PayPalModule\Model\Action\Handler\OrderCaptureActionHandler::class, $data);
$reauthorizeData = oxNew(\OxidEsales\PayPalModule\Model\Action\Data\OrderReauthorizeActionData::class, $request, $order);
$reauthorizeHandler = oxNew(\OxidEsales\PayPalModule\Model\Action\Handler\OrderReauthorizeActionHandler::class, $reauthorizeData);
$action = oxNew(\OxidEsales\PayPalModule\Model\Action\OrderCaptureAction::class, $handler, $order->getPayPalOrder(), $reauthorizeHandler);
return $action;
} | [
"public",
"function",
"getCaptureAction",
"(",
")",
"{",
"$",
"order",
"=",
"$",
"this",
"->",
"getOrder",
"(",
")",
";",
"$",
"request",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
";",
"$",
"data",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
... | Returns capture action object
@return \OxidEsales\PayPalModule\Model\Action\OrderCaptureAction | [
"Returns",
"capture",
"action",
"object"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Action/OrderActionFactory.php#L98-L112 | train |
OXID-eSales/paypal | Model/Action/OrderActionFactory.php | OrderActionFactory.getRefundAction | public function getRefundAction()
{
$order = $this->getOrder();
$data = oxNew(\OxidEsales\PayPalModule\Model\Action\Data\OrderRefundActionData::class, $this->getRequest(), $order);
$handler = oxNew(\OxidEsales\PayPalModule\Model\Action\Handler\OrderRefundActionHandler::class, $data);
$action = oxNew(\OxidEsales\PayPalModule\Model\Action\OrderRefundAction::class, $handler, $order->getPayPalOrder());
return $action;
} | php | public function getRefundAction()
{
$order = $this->getOrder();
$data = oxNew(\OxidEsales\PayPalModule\Model\Action\Data\OrderRefundActionData::class, $this->getRequest(), $order);
$handler = oxNew(\OxidEsales\PayPalModule\Model\Action\Handler\OrderRefundActionHandler::class, $data);
$action = oxNew(\OxidEsales\PayPalModule\Model\Action\OrderRefundAction::class, $handler, $order->getPayPalOrder());
return $action;
} | [
"public",
"function",
"getRefundAction",
"(",
")",
"{",
"$",
"order",
"=",
"$",
"this",
"->",
"getOrder",
"(",
")",
";",
"$",
"data",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"PayPalModule",
"\\",
"Model",
"\\",
"Action",
"\\",
"Data",
"\\",
"Order... | Returns refund action object
@return \OxidEsales\PayPalModule\Model\Action\OrderRefundAction | [
"Returns",
"refund",
"action",
"object"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Action/OrderActionFactory.php#L119-L128 | train |
OXID-eSales/paypal | Model/Action/OrderActionFactory.php | OrderActionFactory.getVoidAction | public function getVoidAction()
{
$order = $this->getOrder();
$data = oxNew(\OxidEsales\PayPalModule\Model\Action\Data\OrderVoidActionData::class, $this->getRequest(), $order);
$handler = oxNew(\OxidEsales\PayPalModule\Model\Action\Handler\OrderVoidActionHandler::class, $data);
$action = oxNew(\OxidEsales\PayPalModule\Model\Action\OrderVoidAction::class, $handler, $order->getPayPalOrder());
return $action;
} | php | public function getVoidAction()
{
$order = $this->getOrder();
$data = oxNew(\OxidEsales\PayPalModule\Model\Action\Data\OrderVoidActionData::class, $this->getRequest(), $order);
$handler = oxNew(\OxidEsales\PayPalModule\Model\Action\Handler\OrderVoidActionHandler::class, $data);
$action = oxNew(\OxidEsales\PayPalModule\Model\Action\OrderVoidAction::class, $handler, $order->getPayPalOrder());
return $action;
} | [
"public",
"function",
"getVoidAction",
"(",
")",
"{",
"$",
"order",
"=",
"$",
"this",
"->",
"getOrder",
"(",
")",
";",
"$",
"data",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"PayPalModule",
"\\",
"Model",
"\\",
"Action",
"\\",
"Data",
"\\",
"OrderVo... | Returns void action object
@return \OxidEsales\PayPalModule\Model\Action\OrderVoidAction | [
"Returns",
"void",
"action",
"object"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Action/OrderActionFactory.php#L135-L144 | train |
OXID-eSales/paypal | Model/OrderPaymentCommentList.php | OrderPaymentCommentList.getDbGateway | protected function getDbGateway()
{
if (is_null($this->dbGateway)) {
$this->setDbGateway(oxNew(\OxidEsales\PayPalModule\Model\DbGateways\OrderPaymentCommentDbGateway::class));
}
return $this->dbGateway;
} | php | protected function getDbGateway()
{
if (is_null($this->dbGateway)) {
$this->setDbGateway(oxNew(\OxidEsales\PayPalModule\Model\DbGateways\OrderPaymentCommentDbGateway::class));
}
return $this->dbGateway;
} | [
"protected",
"function",
"getDbGateway",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"dbGateway",
")",
")",
"{",
"$",
"this",
"->",
"setDbGateway",
"(",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"PayPalModule",
"\\",
"Model",
"\\",
"DbGate... | Returns DB gateway. If it's not set- creates object and sets.
@return oePayPalPayPalDbGateway | [
"Returns",
"DB",
"gateway",
".",
"If",
"it",
"s",
"not",
"set",
"-",
"creates",
"object",
"and",
"sets",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/OrderPaymentCommentList.php#L66-L73 | train |
OXID-eSales/paypal | Model/PayPalRequest/GetExpressCheckoutDetailsRequestBuilder.php | GetExpressCheckoutDetailsRequestBuilder.getSession | public function getSession()
{
if (!$this->session) {
/**
* @var \OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException $exception
*/
$exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException::class);
throw $exception;
}
return $this->session;
} | php | public function getSession()
{
if (!$this->session) {
/**
* @var \OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException $exception
*/
$exception = oxNew(\OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException::class);
throw $exception;
}
return $this->session;
} | [
"public",
"function",
"getSession",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"session",
")",
"{",
"/**\n * @var \\OxidEsales\\PayPalModule\\Core\\Exception\\PayPalMissingParameterException $exception\n */",
"$",
"exception",
"=",
"oxNew",
"(",... | Returns Session.
@return \OxidEsales\Eshop\Core\Session
@throws \OxidEsales\PayPalModule\Core\Exception\PayPalMissingParameterException | [
"Returns",
"Session",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/GetExpressCheckoutDetailsRequestBuilder.php#L84-L95 | train |
OXID-eSales/paypal | Model/PayPalRequest/GetExpressCheckoutDetailsRequestBuilder.php | GetExpressCheckoutDetailsRequestBuilder.buildRequest | public function buildRequest()
{
$request = $this->getPayPalRequest();
$request->setParameter('TOKEN', $this->getSession()->getVariable('oepaypal-token'));
return $request;
} | php | public function buildRequest()
{
$request = $this->getPayPalRequest();
$request->setParameter('TOKEN', $this->getSession()->getVariable('oepaypal-token'));
return $request;
} | [
"public",
"function",
"buildRequest",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"getPayPalRequest",
"(",
")",
";",
"$",
"request",
"->",
"setParameter",
"(",
"'TOKEN'",
",",
"$",
"this",
"->",
"getSession",
"(",
")",
"->",
"getVariable",
"("... | Builds Request.
@return \OxidEsales\PayPalModule\Model\PayPalRequest\PayPalRequest | [
"Builds",
"Request",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/PayPalRequest/GetExpressCheckoutDetailsRequestBuilder.php#L102-L108 | train |
OXID-eSales/paypal | Controller/ExpressCheckoutDispatcher.php | ExpressCheckoutDispatcher.processCallBack | public function processCallBack()
{
$payPalService = $this->getPayPalCheckoutService();
$this->setParamsForCallbackResponse($payPalService);
$request = $payPalService->callbackResponse();
\OxidEsales\Eshop\Core\Registry::getUtils()->showMessageAndExit($request);
} | php | public function processCallBack()
{
$payPalService = $this->getPayPalCheckoutService();
$this->setParamsForCallbackResponse($payPalService);
$request = $payPalService->callbackResponse();
\OxidEsales\Eshop\Core\Registry::getUtils()->showMessageAndExit($request);
} | [
"public",
"function",
"processCallBack",
"(",
")",
"{",
"$",
"payPalService",
"=",
"$",
"this",
"->",
"getPayPalCheckoutService",
"(",
")",
";",
"$",
"this",
"->",
"setParamsForCallbackResponse",
"(",
"$",
"payPalService",
")",
";",
"$",
"request",
"=",
"$",
... | Processes PayPal callback | [
"Processes",
"PayPal",
"callback"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/ExpressCheckoutDispatcher.php#L38-L44 | train |
OXID-eSales/paypal | Controller/ExpressCheckoutDispatcher.php | ExpressCheckoutDispatcher.getCancelUrl | protected function getCancelUrl()
{
$cancelURLFromRequest = $this->getRequest()->getRequestParameter('oePayPalCancelURL');
$cancelUrl = $this->getSession()->processUrl($this->getBaseUrl() . "&cl=basket");
if ($cancelURLFromRequest) {
$cancelUrl = html_entity_decode(urldecode($cancelURLFromRequest));
} elseif ($requestedControllerKey = $this->getRequestedControllerKey()) {
$cancelUrl = $this->getSession()->processUrl($this->getBaseUrl() . '&cl=' . $requestedControllerKey);
}
return $cancelUrl;
} | php | protected function getCancelUrl()
{
$cancelURLFromRequest = $this->getRequest()->getRequestParameter('oePayPalCancelURL');
$cancelUrl = $this->getSession()->processUrl($this->getBaseUrl() . "&cl=basket");
if ($cancelURLFromRequest) {
$cancelUrl = html_entity_decode(urldecode($cancelURLFromRequest));
} elseif ($requestedControllerKey = $this->getRequestedControllerKey()) {
$cancelUrl = $this->getSession()->processUrl($this->getBaseUrl() . '&cl=' . $requestedControllerKey);
}
return $cancelUrl;
} | [
"protected",
"function",
"getCancelUrl",
"(",
")",
"{",
"$",
"cancelURLFromRequest",
"=",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"getRequestParameter",
"(",
"'oePayPalCancelURL'",
")",
";",
"$",
"cancelUrl",
"=",
"$",
"this",
"->",
"getSession",
"(",... | Returns CANCEL URL
@return string | [
"Returns",
"CANCEL",
"URL"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/ExpressCheckoutDispatcher.php#L256-L268 | train |
OXID-eSales/paypal | Controller/ExpressCheckoutDispatcher.php | ExpressCheckoutDispatcher.getCallBackUser | protected function getCallBackUser($data)
{
// simulating user object
$user = oxNew(\OxidEsales\Eshop\Application\Model\User::class);
$user->initializeUserForCallBackPayPalUser($data);
return $user;
} | php | protected function getCallBackUser($data)
{
// simulating user object
$user = oxNew(\OxidEsales\Eshop\Application\Model\User::class);
$user->initializeUserForCallBackPayPalUser($data);
return $user;
} | [
"protected",
"function",
"getCallBackUser",
"(",
"$",
"data",
")",
"{",
"// simulating user object",
"$",
"user",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
"\\",
"User",
"::",
"class",
")",
";",
"$",
"user",
... | Initialize new user from user data.
@param array $data User data array.
@return \OxidEsales\Eshop\Application\Model\User | [
"Initialize",
"new",
"user",
"from",
"user",
"data",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/ExpressCheckoutDispatcher.php#L305-L312 | train |
OXID-eSales/paypal | Controller/ExpressCheckoutDispatcher.php | ExpressCheckoutDispatcher.setParamsForCallbackResponse | protected function setParamsForCallbackResponse($payPalService)
{
//logging request from PayPal
$logger = $this->getLogger();
$logger->setTitle("CALLBACK REQUEST FROM PAYPAL");
$logger->log(http_build_query($_REQUEST, "", "&"));
// initializing user..
$user = $this->getCallBackUser($_REQUEST);
// unknown country?
if (!$this->getUserShippingCountryId($user)) {
$logger = $this->getLogger();
$logger->log("Callback error: NO SHIPPING COUNTRY ID");
// unknown country - no delivery
$this->setPayPalIsNotAvailable($payPalService);
return;
}
//basket
$basket = $this->getSession()->getBasket();
// get possible delivery sets
$delSetList = $this->getDeliverySetList($user);
//no shipping methods for user country
if (!count($delSetList)) {
$logger = $this->getLogger();
$logger->log("Callback error: NO DELIVERY LIST SET");
$this->setPayPalIsNotAvailable($payPalService);
return;
}
$deliverySetList = $this->makeUniqueNames($delSetList);
// checking if PayPal is valid payment for selected user country
if (!$this->isPaymentValidForUserCountry($user)) {
$logger->log("Callback error: NOT VALID COUNTRY ID");
// PayPal payment is not possible for user country
$this->setPayPalIsNotAvailable($payPalService);
return;
}
$this->getSession()->setVariable('oepaypal-oxDelSetList', $deliverySetList);
$totalDeliveries = $this->setDeliverySetListForCallbackResponse($payPalService, $deliverySetList, $user, $basket);
// if none of deliveries contain PayPal - disabling PayPal
if ($totalDeliveries == 0) {
$logger->log("Callback error: DELIVERY SET LIST HAS NO PAYPAL");
$this->setPayPalIsNotAvailable($payPalService);
return;
}
$payPalService->setParameter("OFFERINSURANCEOPTION", "false");
} | php | protected function setParamsForCallbackResponse($payPalService)
{
//logging request from PayPal
$logger = $this->getLogger();
$logger->setTitle("CALLBACK REQUEST FROM PAYPAL");
$logger->log(http_build_query($_REQUEST, "", "&"));
// initializing user..
$user = $this->getCallBackUser($_REQUEST);
// unknown country?
if (!$this->getUserShippingCountryId($user)) {
$logger = $this->getLogger();
$logger->log("Callback error: NO SHIPPING COUNTRY ID");
// unknown country - no delivery
$this->setPayPalIsNotAvailable($payPalService);
return;
}
//basket
$basket = $this->getSession()->getBasket();
// get possible delivery sets
$delSetList = $this->getDeliverySetList($user);
//no shipping methods for user country
if (!count($delSetList)) {
$logger = $this->getLogger();
$logger->log("Callback error: NO DELIVERY LIST SET");
$this->setPayPalIsNotAvailable($payPalService);
return;
}
$deliverySetList = $this->makeUniqueNames($delSetList);
// checking if PayPal is valid payment for selected user country
if (!$this->isPaymentValidForUserCountry($user)) {
$logger->log("Callback error: NOT VALID COUNTRY ID");
// PayPal payment is not possible for user country
$this->setPayPalIsNotAvailable($payPalService);
return;
}
$this->getSession()->setVariable('oepaypal-oxDelSetList', $deliverySetList);
$totalDeliveries = $this->setDeliverySetListForCallbackResponse($payPalService, $deliverySetList, $user, $basket);
// if none of deliveries contain PayPal - disabling PayPal
if ($totalDeliveries == 0) {
$logger->log("Callback error: DELIVERY SET LIST HAS NO PAYPAL");
$this->setPayPalIsNotAvailable($payPalService);
return;
}
$payPalService->setParameter("OFFERINSURANCEOPTION", "false");
} | [
"protected",
"function",
"setParamsForCallbackResponse",
"(",
"$",
"payPalService",
")",
"{",
"//logging request from PayPal",
"$",
"logger",
"=",
"$",
"this",
"->",
"getLogger",
"(",
")",
";",
"$",
"logger",
"->",
"setTitle",
"(",
"\"CALLBACK REQUEST FROM PAYPAL\"",
... | Sets parameters to PayPal callback
@param \OxidEsales\PayPalModule\Core\PayPalService $payPalService PayPal service
@return null | [
"Sets",
"parameters",
"to",
"PayPal",
"callback"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/ExpressCheckoutDispatcher.php#L321-L384 | train |
OXID-eSales/paypal | Controller/ExpressCheckoutDispatcher.php | ExpressCheckoutDispatcher.setDeliverySetListForCallbackResponse | protected function setDeliverySetListForCallbackResponse($payPalService, $deliverySetList, $user, $basket)
{
$maxDeliveryAmount = $this->getPayPalConfig()->getMaxPayPalDeliveryAmount();
$cur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject();
$basketPrice = $basket->getPriceForPayment() / $cur->rate;
$actShipSet = $basket->getShippingId();
$hasActShipSet = false;
$cnt = 0;
// VAT for delivery will be calculated always
$delVATPercent = $basket->getAdditionalServicesVatPercent();
foreach ($deliverySetList as $delSetId => $delSetName) {
// checking if PayPal is valid payment for selected delivery set
if (!$this->isPayPalInDeliverySet($delSetId, $basketPrice, $user)) {
continue;
}
$deliveryListProvider = oxNew(\OxidEsales\Eshop\Application\Model\DeliveryList::class);
$deliveryList = array();
// list of active delivery costs
if ($deliveryListProvider->hasDeliveries($basket, $user, $this->getUserShippingCountryId($user), $delSetId)) {
$deliveryList = $deliveryListProvider->getDeliveryList($basket, $user, $this->getUserShippingCountryId($user), $delSetId);
}
if (count($deliveryList) > 0) {
$price = 0;
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('bl_perfLoadDelivery')) {
foreach ($deliveryList as $delivery) {
$price += $delivery->getDeliveryPrice($delVATPercent)->getBruttoPrice();
}
}
if ($price <= $maxDeliveryAmount) {
$payPalService->setParameter("L_SHIPPINGOPTIONNAME{$cnt}", \OxidEsales\Eshop\Core\Str::getStr()->html_entity_decode($delSetName));
$payPalService->setParameter("L_SHIPPINGOPTIONLABEL{$cnt}", \OxidEsales\Eshop\Core\Registry::getLang()->translateString("OEPAYPAL_PRICE"));
$payPalService->setParameter("L_SHIPPINGOPTIONAMOUNT{$cnt}", $this->formatFloat($price));
//setting active delivery set
if ($delSetId == $actShipSet) {
$hasActShipSet = true;
$payPalService->setParameter("L_SHIPPINGOPTIONISDEFAULT{$cnt}", "true");
} else {
$payPalService->setParameter("L_SHIPPINGOPTIONISDEFAULT{$cnt}", "false");
}
if ($basket->isCalculationModeNetto()) {
$payPalService->setParameter("L_TAXAMT{$cnt}", $this->formatFloat($basket->getPayPalBasketVatValue()));
} else {
$payPalService->setParameter("L_TAXAMT{$cnt}", $this->formatFloat(0));
}
}
$cnt++;
}
}
//checking if active delivery set was set - if not, setting first in the list
if ($cnt > 0 && !$hasActShipSet) {
$payPalService->setParameter("L_SHIPPINGOPTIONISDEFAULT0", "true");
}
return $cnt;
} | php | protected function setDeliverySetListForCallbackResponse($payPalService, $deliverySetList, $user, $basket)
{
$maxDeliveryAmount = $this->getPayPalConfig()->getMaxPayPalDeliveryAmount();
$cur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject();
$basketPrice = $basket->getPriceForPayment() / $cur->rate;
$actShipSet = $basket->getShippingId();
$hasActShipSet = false;
$cnt = 0;
// VAT for delivery will be calculated always
$delVATPercent = $basket->getAdditionalServicesVatPercent();
foreach ($deliverySetList as $delSetId => $delSetName) {
// checking if PayPal is valid payment for selected delivery set
if (!$this->isPayPalInDeliverySet($delSetId, $basketPrice, $user)) {
continue;
}
$deliveryListProvider = oxNew(\OxidEsales\Eshop\Application\Model\DeliveryList::class);
$deliveryList = array();
// list of active delivery costs
if ($deliveryListProvider->hasDeliveries($basket, $user, $this->getUserShippingCountryId($user), $delSetId)) {
$deliveryList = $deliveryListProvider->getDeliveryList($basket, $user, $this->getUserShippingCountryId($user), $delSetId);
}
if (count($deliveryList) > 0) {
$price = 0;
if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('bl_perfLoadDelivery')) {
foreach ($deliveryList as $delivery) {
$price += $delivery->getDeliveryPrice($delVATPercent)->getBruttoPrice();
}
}
if ($price <= $maxDeliveryAmount) {
$payPalService->setParameter("L_SHIPPINGOPTIONNAME{$cnt}", \OxidEsales\Eshop\Core\Str::getStr()->html_entity_decode($delSetName));
$payPalService->setParameter("L_SHIPPINGOPTIONLABEL{$cnt}", \OxidEsales\Eshop\Core\Registry::getLang()->translateString("OEPAYPAL_PRICE"));
$payPalService->setParameter("L_SHIPPINGOPTIONAMOUNT{$cnt}", $this->formatFloat($price));
//setting active delivery set
if ($delSetId == $actShipSet) {
$hasActShipSet = true;
$payPalService->setParameter("L_SHIPPINGOPTIONISDEFAULT{$cnt}", "true");
} else {
$payPalService->setParameter("L_SHIPPINGOPTIONISDEFAULT{$cnt}", "false");
}
if ($basket->isCalculationModeNetto()) {
$payPalService->setParameter("L_TAXAMT{$cnt}", $this->formatFloat($basket->getPayPalBasketVatValue()));
} else {
$payPalService->setParameter("L_TAXAMT{$cnt}", $this->formatFloat(0));
}
}
$cnt++;
}
}
//checking if active delivery set was set - if not, setting first in the list
if ($cnt > 0 && !$hasActShipSet) {
$payPalService->setParameter("L_SHIPPINGOPTIONISDEFAULT0", "true");
}
return $cnt;
} | [
"protected",
"function",
"setDeliverySetListForCallbackResponse",
"(",
"$",
"payPalService",
",",
"$",
"deliverySetList",
",",
"$",
"user",
",",
"$",
"basket",
")",
"{",
"$",
"maxDeliveryAmount",
"=",
"$",
"this",
"->",
"getPayPalConfig",
"(",
")",
"->",
"getMax... | Sets delivery sets parameters to PayPal callback
@param \OxidEsales\PayPalModule\Core\PayPalService $payPalService PayPal service.
@param array $deliverySetList Delivery list.
@param \OxidEsales\Eshop\Application\Model\User $user User object.
@param \OxidEsales\Eshop\Application\Model\Basket $basket Basket object.
@return int Total amount of deliveries | [
"Sets",
"delivery",
"sets",
"parameters",
"to",
"PayPal",
"callback"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/ExpressCheckoutDispatcher.php#L396-L461 | train |
OXID-eSales/paypal | Controller/ExpressCheckoutDispatcher.php | ExpressCheckoutDispatcher.makeUniqueNames | public function makeUniqueNames($deliverySetList)
{
$result = array();
$nameCounts = array();
foreach ($deliverySetList as $deliverySet) {
$deliverySetName = trim($deliverySet->oxdeliveryset__oxtitle->value);
if (isset($nameCounts[$deliverySetName])) {
$nameCounts[$deliverySetName] += 1;
} else {
$nameCounts[$deliverySetName] = 1;
}
$suffix = ($nameCounts[$deliverySetName] > 1) ? " (" . $nameCounts[$deliverySetName] . ")" : '';
$result[$deliverySet->oxdeliveryset__oxid->value] = $deliverySetName . $suffix;
}
return $result;
} | php | public function makeUniqueNames($deliverySetList)
{
$result = array();
$nameCounts = array();
foreach ($deliverySetList as $deliverySet) {
$deliverySetName = trim($deliverySet->oxdeliveryset__oxtitle->value);
if (isset($nameCounts[$deliverySetName])) {
$nameCounts[$deliverySetName] += 1;
} else {
$nameCounts[$deliverySetName] = 1;
}
$suffix = ($nameCounts[$deliverySetName] > 1) ? " (" . $nameCounts[$deliverySetName] . ")" : '';
$result[$deliverySet->oxdeliveryset__oxid->value] = $deliverySetName . $suffix;
}
return $result;
} | [
"public",
"function",
"makeUniqueNames",
"(",
"$",
"deliverySetList",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"$",
"nameCounts",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"deliverySetList",
"as",
"$",
"deliverySet",
")",
"{",
"$",
... | Makes delivery set array with unique names
@param array $deliverySetList delivery list
@return array | [
"Makes",
"delivery",
"set",
"array",
"with",
"unique",
"names"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/ExpressCheckoutDispatcher.php#L470-L489 | train |
OXID-eSales/paypal | Controller/ExpressCheckoutDispatcher.php | ExpressCheckoutDispatcher.extractShippingId | protected function extractShippingId($shippingOptionName, $user)
{
$result = null;
$charset = $this->getPayPalConfig()->getCharset();
$shippingOptionName = htmlentities(html_entity_decode($shippingOptionName, ENT_QUOTES, $charset), ENT_QUOTES, $charset);
$name = trim(str_replace(\OxidEsales\Eshop\Core\Registry::getLang()->translateString("OEPAYPAL_PRICE"), "", $shippingOptionName));
$deliverySetList = $this->getSession()->getVariable("oepaypal-oxDelSetList");
if (!$deliverySetList) {
$delSetList = $this->getDeliverySetList($user);
$deliverySetList = $this->makeUniqueNames($delSetList);
}
if (is_array($deliverySetList)) {
$flipped = array_flip($deliverySetList);
$result = $flipped[$name];
}
return $result;
} | php | protected function extractShippingId($shippingOptionName, $user)
{
$result = null;
$charset = $this->getPayPalConfig()->getCharset();
$shippingOptionName = htmlentities(html_entity_decode($shippingOptionName, ENT_QUOTES, $charset), ENT_QUOTES, $charset);
$name = trim(str_replace(\OxidEsales\Eshop\Core\Registry::getLang()->translateString("OEPAYPAL_PRICE"), "", $shippingOptionName));
$deliverySetList = $this->getSession()->getVariable("oepaypal-oxDelSetList");
if (!$deliverySetList) {
$delSetList = $this->getDeliverySetList($user);
$deliverySetList = $this->makeUniqueNames($delSetList);
}
if (is_array($deliverySetList)) {
$flipped = array_flip($deliverySetList);
$result = $flipped[$name];
}
return $result;
} | [
"protected",
"function",
"extractShippingId",
"(",
"$",
"shippingOptionName",
",",
"$",
"user",
")",
"{",
"$",
"result",
"=",
"null",
";",
"$",
"charset",
"=",
"$",
"this",
"->",
"getPayPalConfig",
"(",
")",
"->",
"getCharset",
"(",
")",
";",
"$",
"shipp... | Extracts shipping id from given parameter
@param string $shippingOptionName Shipping option name, which comes from PayPal.
@param \OxidEsales\Eshop\Application\Model\User $user User object.
@return string | [
"Extracts",
"shipping",
"id",
"from",
"given",
"parameter"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/ExpressCheckoutDispatcher.php#L514-L537 | train |
OXID-eSales/paypal | Controller/ExpressCheckoutDispatcher.php | ExpressCheckoutDispatcher.initializeUserData | protected function initializeUserData($details)
{
$userEmail = $details->getEmail();
$loggedUser = $this->getUser();
if ($loggedUser) {
$userEmail = $loggedUser->oxuser__oxusername->value;
}
$user = oxNew(\OxidEsales\Eshop\Application\Model\User::class);
if ($userId = $user->isRealPayPalUser($userEmail)) {
// if user exist
$user->load($userId);
if (!$loggedUser) {
if (!$user->isSamePayPalUser($details)) {
/**
* @var $exception \OxidEsales\Eshop\Core\Exception\StandardException
*/
$exception = oxNew(\OxidEsales\Eshop\Core\Exception\StandardException::class);
$exception->setMessage('OEPAYPAL_ERROR_USER_ADDRESS');
throw $exception;
}
} elseif (!$user->isSameAddressUserPayPalUser($details) || !$user->isSameAddressPayPalUser($details)) {
// user has selected different address in PayPal (not equal with usr shop address)
// so adding PayPal address as new user address to shop user account
$this->createUserAddress($details, $userId);
} else {
// removing custom shipping address ID from session as user uses billing
// address for shipping
$this->getSession()->deleteVariable('deladrid');
}
} else {
$user->createPayPalUser($details);
}
$this->getSession()->setVariable('usr', $user->getId());
return $user;
} | php | protected function initializeUserData($details)
{
$userEmail = $details->getEmail();
$loggedUser = $this->getUser();
if ($loggedUser) {
$userEmail = $loggedUser->oxuser__oxusername->value;
}
$user = oxNew(\OxidEsales\Eshop\Application\Model\User::class);
if ($userId = $user->isRealPayPalUser($userEmail)) {
// if user exist
$user->load($userId);
if (!$loggedUser) {
if (!$user->isSamePayPalUser($details)) {
/**
* @var $exception \OxidEsales\Eshop\Core\Exception\StandardException
*/
$exception = oxNew(\OxidEsales\Eshop\Core\Exception\StandardException::class);
$exception->setMessage('OEPAYPAL_ERROR_USER_ADDRESS');
throw $exception;
}
} elseif (!$user->isSameAddressUserPayPalUser($details) || !$user->isSameAddressPayPalUser($details)) {
// user has selected different address in PayPal (not equal with usr shop address)
// so adding PayPal address as new user address to shop user account
$this->createUserAddress($details, $userId);
} else {
// removing custom shipping address ID from session as user uses billing
// address for shipping
$this->getSession()->deleteVariable('deladrid');
}
} else {
$user->createPayPalUser($details);
}
$this->getSession()->setVariable('usr', $user->getId());
return $user;
} | [
"protected",
"function",
"initializeUserData",
"(",
"$",
"details",
")",
"{",
"$",
"userEmail",
"=",
"$",
"details",
"->",
"getEmail",
"(",
")",
";",
"$",
"loggedUser",
"=",
"$",
"this",
"->",
"getUser",
"(",
")",
";",
"if",
"(",
"$",
"loggedUser",
")"... | Creates new or returns session user
@param \OxidEsales\PayPalModule\Model\Response\ResponseGetExpressCheckoutDetails $details
@throws \OxidEsales\Eshop\Core\Exception\StandardException
@return \OxidEsales\Eshop\Application\Model\User | [
"Creates",
"new",
"or",
"returns",
"session",
"user"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/ExpressCheckoutDispatcher.php#L548-L586 | train |
OXID-eSales/paypal | Controller/ExpressCheckoutDispatcher.php | ExpressCheckoutDispatcher.createUserAddress | protected function createUserAddress($details, $userId)
{
$address = oxNew(\OxidEsales\Eshop\Application\Model\Address::class);
return $address->createPayPalAddress($details, $userId);
} | php | protected function createUserAddress($details, $userId)
{
$address = oxNew(\OxidEsales\Eshop\Application\Model\Address::class);
return $address->createPayPalAddress($details, $userId);
} | [
"protected",
"function",
"createUserAddress",
"(",
"$",
"details",
",",
"$",
"userId",
")",
"{",
"$",
"address",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
"\\",
"Address",
"::",
"class",
")",
";",
"return",
... | Creates user address and sets address id into session
@param \OxidEsales\PayPalModule\Model\Response\ResponseGetExpressCheckoutDetails $details User address info.
@param string $userId User id.
@return bool | [
"Creates",
"user",
"address",
"and",
"sets",
"address",
"id",
"into",
"session"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/ExpressCheckoutDispatcher.php#L596-L601 | train |
OXID-eSales/paypal | Controller/ExpressCheckoutDispatcher.php | ExpressCheckoutDispatcher.isPaymentValidForUserCountry | protected function isPaymentValidForUserCountry($user)
{
$payment = oxNew(\OxidEsales\Eshop\Application\Model\Payment::class);
$payment->load("oxidpaypal");
$paymentCountries = $payment->getCountries();
if (!is_array($paymentCountries) || empty($paymentCountries)) {
// not assigned to any country - valid to all countries
return true;
}
return in_array($this->getUserShippingCountryId($user), $paymentCountries);
} | php | protected function isPaymentValidForUserCountry($user)
{
$payment = oxNew(\OxidEsales\Eshop\Application\Model\Payment::class);
$payment->load("oxidpaypal");
$paymentCountries = $payment->getCountries();
if (!is_array($paymentCountries) || empty($paymentCountries)) {
// not assigned to any country - valid to all countries
return true;
}
return in_array($this->getUserShippingCountryId($user), $paymentCountries);
} | [
"protected",
"function",
"isPaymentValidForUserCountry",
"(",
"$",
"user",
")",
"{",
"$",
"payment",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
"\\",
"Payment",
"::",
"class",
")",
";",
"$",
"payment",
"->",
"... | Checking if PayPal payment is available in user country
@param \OxidEsales\Eshop\Application\Model\User $user User object.
@return boolean | [
"Checking",
"if",
"PayPal",
"payment",
"is",
"available",
"in",
"user",
"country"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/ExpressCheckoutDispatcher.php#L610-L622 | train |
OXID-eSales/paypal | Controller/ExpressCheckoutDispatcher.php | ExpressCheckoutDispatcher.isPayPalInDeliverySet | protected function isPayPalInDeliverySet($delSetId, $basketPrice, $user)
{
$paymentList = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\PaymentList::class);
$paymentList = $paymentList->getPaymentList($delSetId, $basketPrice, $user);
if (is_array($paymentList) && array_key_exists("oxidpaypal", $paymentList)) {
return true;
}
return false;
} | php | protected function isPayPalInDeliverySet($delSetId, $basketPrice, $user)
{
$paymentList = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\PaymentList::class);
$paymentList = $paymentList->getPaymentList($delSetId, $basketPrice, $user);
if (is_array($paymentList) && array_key_exists("oxidpaypal", $paymentList)) {
return true;
}
return false;
} | [
"protected",
"function",
"isPayPalInDeliverySet",
"(",
"$",
"delSetId",
",",
"$",
"basketPrice",
",",
"$",
"user",
")",
"{",
"$",
"paymentList",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"get",
"(",
"\\",
"OxidEsales",
"... | Checks if selected delivery set has PayPal payment.
@param string $delSetId Delivery set ID.
@param double $basketPrice Basket price.
@param \OxidEsales\Eshop\Application\Model\User $user User object.
@return boolean | [
"Checks",
"if",
"selected",
"delivery",
"set",
"has",
"PayPal",
"payment",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/ExpressCheckoutDispatcher.php#L633-L643 | train |
OXID-eSales/paypal | Controller/ExpressCheckoutDispatcher.php | ExpressCheckoutDispatcher.getDeliverySetList | protected function getDeliverySetList($user)
{
$delSetList = oxNew(\OxidEsales\Eshop\Application\Model\DeliverySetList::class);
return $delSetList->getDeliverySetList($user, $this->getUserShippingCountryId($user));
} | php | protected function getDeliverySetList($user)
{
$delSetList = oxNew(\OxidEsales\Eshop\Application\Model\DeliverySetList::class);
return $delSetList->getDeliverySetList($user, $this->getUserShippingCountryId($user));
} | [
"protected",
"function",
"getDeliverySetList",
"(",
"$",
"user",
")",
"{",
"$",
"delSetList",
"=",
"oxNew",
"(",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Application",
"\\",
"Model",
"\\",
"DeliverySetList",
"::",
"class",
")",
";",
"return",
"$",
"delSetLi... | Get delivery set list for PayPal callback
@param \OxidEsales\Eshop\Application\Model\User $user User object.
@return array | [
"Get",
"delivery",
"set",
"list",
"for",
"PayPal",
"callback"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/ExpressCheckoutDispatcher.php#L664-L669 | train |
OXID-eSales/paypal | Controller/ExpressCheckoutDispatcher.php | ExpressCheckoutDispatcher.getUserShippingCountryId | protected function getUserShippingCountryId($user)
{
if ($user->getSelectedAddressId() && $user->getSelectedAddress()) {
$countryId = $user->getSelectedAddress()->oxaddress__oxcountryid->value;
} else {
$countryId = $user->oxuser__oxcountryid->value;
}
return $countryId;
} | php | protected function getUserShippingCountryId($user)
{
if ($user->getSelectedAddressId() && $user->getSelectedAddress()) {
$countryId = $user->getSelectedAddress()->oxaddress__oxcountryid->value;
} else {
$countryId = $user->oxuser__oxcountryid->value;
}
return $countryId;
} | [
"protected",
"function",
"getUserShippingCountryId",
"(",
"$",
"user",
")",
"{",
"if",
"(",
"$",
"user",
"->",
"getSelectedAddressId",
"(",
")",
"&&",
"$",
"user",
"->",
"getSelectedAddress",
"(",
")",
")",
"{",
"$",
"countryId",
"=",
"$",
"user",
"->",
... | Returns user shipping address country id.
@param \OxidEsales\Eshop\Application\Model\User $user
@return string | [
"Returns",
"user",
"shipping",
"address",
"country",
"id",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Controller/ExpressCheckoutDispatcher.php#L678-L687 | train |
OXID-eSales/paypal | Core/Config.php | Config.getPayPalHost | public function getPayPalHost()
{
$host = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sPayPalHost');
if ($host) {
$this->setPayPalHost($host);
}
return $this->payPalHost;
} | php | public function getPayPalHost()
{
$host = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sPayPalHost');
if ($host) {
$this->setPayPalHost($host);
}
return $this->payPalHost;
} | [
"public",
"function",
"getPayPalHost",
"(",
")",
"{",
"$",
"host",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getConfigParam",
"(",
"'sPayPalHost'",
")",
";",
"if",
"(",
"$",
"host",
")",
... | Returns PayPal host.
@return string | [
"Returns",
"PayPal",
"host",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Config.php#L153-L161 | train |
OXID-eSales/paypal | Core/Config.php | Config.getHost | public function getHost()
{
if ($this->isSandboxEnabled()) {
$url = $this->getPayPalSandboxHost();
} else {
$url = $this->getPayPalHost();
}
return $url;
} | php | public function getHost()
{
if ($this->isSandboxEnabled()) {
$url = $this->getPayPalSandboxHost();
} else {
$url = $this->getPayPalHost();
}
return $url;
} | [
"public",
"function",
"getHost",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSandboxEnabled",
"(",
")",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"getPayPalSandboxHost",
"(",
")",
";",
"}",
"else",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
... | Returns PayPal OR PayPal sandbox host.
@return string | [
"Returns",
"PayPal",
"OR",
"PayPal",
"sandbox",
"host",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Config.php#L193-L202 | train |
OXID-eSales/paypal | Core/Config.php | Config.getPayPalApiUrl | public function getPayPalApiUrl()
{
$url = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sPayPalApiUrl');
if ($url) {
$this->setPayPalApiUrl($url);
}
return $this->payPalApiUrl;
} | php | public function getPayPalApiUrl()
{
$url = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sPayPalApiUrl');
if ($url) {
$this->setPayPalApiUrl($url);
}
return $this->payPalApiUrl;
} | [
"public",
"function",
"getPayPalApiUrl",
"(",
")",
"{",
"$",
"url",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getConfigParam",
"(",
"'sPayPalApiUrl'",
")",
";",
"if",
"(",
"$",
"url",
")",... | Api Url getter
@return string | [
"Api",
"Url",
"getter"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Config.php#L219-L227 | train |
OXID-eSales/paypal | Core/Config.php | Config.getPayPalSandboxApiUrl | public function getPayPalSandboxApiUrl()
{
$url = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sPayPalSandboxApiUrl');
if ($url) {
$this->setPayPalSandboxApiUrl($url);
}
return $this->payPalSandboxApiUrl;
} | php | public function getPayPalSandboxApiUrl()
{
$url = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sPayPalSandboxApiUrl');
if ($url) {
$this->setPayPalSandboxApiUrl($url);
}
return $this->payPalSandboxApiUrl;
} | [
"public",
"function",
"getPayPalSandboxApiUrl",
"(",
")",
"{",
"$",
"url",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getConfigParam",
"(",
"'sPayPalSandboxApiUrl'",
")",
";",
"if",
"(",
"$",
... | PayPal sandbox api url getter
@return string | [
"PayPal",
"sandbox",
"api",
"url",
"getter"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Config.php#L244-L252 | train |
OXID-eSales/paypal | Core/Config.php | Config.getUrl | public function getUrl()
{
if ($this->isSandboxEnabled()) {
$url = $this->getPayPalSandboxUrl();
} else {
$url = $this->getPayPalUrl();
}
return $url;
} | php | public function getUrl()
{
if ($this->isSandboxEnabled()) {
$url = $this->getPayPalSandboxUrl();
} else {
$url = $this->getPayPalUrl();
}
return $url;
} | [
"public",
"function",
"getUrl",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSandboxEnabled",
"(",
")",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"getPayPalSandboxUrl",
"(",
")",
";",
"}",
"else",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"... | Get PayPal url.
@return string | [
"Get",
"PayPal",
"url",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Config.php#L325-L334 | train |
OXID-eSales/paypal | Core/Config.php | Config.getPayPalCommunicationUrl | public function getPayPalCommunicationUrl($token = null, $userAction = 'continue')
{
return $this->getUrl() . '&cmd=_express-checkout&token=' . (string) $token . '&useraction=' . (string) $userAction;
} | php | public function getPayPalCommunicationUrl($token = null, $userAction = 'continue')
{
return $this->getUrl() . '&cmd=_express-checkout&token=' . (string) $token . '&useraction=' . (string) $userAction;
} | [
"public",
"function",
"getPayPalCommunicationUrl",
"(",
"$",
"token",
"=",
"null",
",",
"$",
"userAction",
"=",
"'continue'",
")",
"{",
"return",
"$",
"this",
"->",
"getUrl",
"(",
")",
".",
"'&cmd=_express-checkout&token='",
".",
"(",
"string",
")",
"$",
"to... | Returns redirect url.
@param string $token token to append to redirect url.
@param string $userAction checkout button action - continue (standard checkout) or commit (express checkout)
@return string | [
"Returns",
"redirect",
"url",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Config.php#L570-L573 | train |
OXID-eSales/paypal | Core/Config.php | Config.getLogoUrl | public function getLogoUrl()
{
$logoUrl = false;
$logoName = $this->getLogoImageName();
if (!empty($logoName)) {
$logo = oxNew(\OxidEsales\PayPalModule\Core\ShopLogo::class);
$logo->setImageDir(\OxidEsales\Eshop\Core\Registry::getConfig()->getImageDir());
$logo->setImageDirUrl(\OxidEsales\Eshop\Core\Registry::getConfig()->getImageUrl());
$logo->setImageName($logoName);
$logo->setImageHandler(\OxidEsales\Eshop\Core\Registry::getUtilsPic());
$logoUrl = $logo->getShopLogoUrl();
}
return $logoUrl;
} | php | public function getLogoUrl()
{
$logoUrl = false;
$logoName = $this->getLogoImageName();
if (!empty($logoName)) {
$logo = oxNew(\OxidEsales\PayPalModule\Core\ShopLogo::class);
$logo->setImageDir(\OxidEsales\Eshop\Core\Registry::getConfig()->getImageDir());
$logo->setImageDirUrl(\OxidEsales\Eshop\Core\Registry::getConfig()->getImageUrl());
$logo->setImageName($logoName);
$logo->setImageHandler(\OxidEsales\Eshop\Core\Registry::getUtilsPic());
$logoUrl = $logo->getShopLogoUrl();
}
return $logoUrl;
} | [
"public",
"function",
"getLogoUrl",
"(",
")",
"{",
"$",
"logoUrl",
"=",
"false",
";",
"$",
"logoName",
"=",
"$",
"this",
"->",
"getLogoImageName",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"logoName",
")",
")",
"{",
"$",
"logo",
"=",
"oxNew... | Get logo Url based on selected settings
Returns shop url, or false
@return string|bool | [
"Get",
"logo",
"Url",
"based",
"on",
"selected",
"settings",
"Returns",
"shop",
"url",
"or",
"false"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Config.php#L582-L599 | train |
OXID-eSales/paypal | Core/Config.php | Config.getMaxPayPalDeliveryAmount | public function getMaxPayPalDeliveryAmount()
{
$maxDeliveryAmount = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('dMaxPayPalDeliveryAmount');
if (!$maxDeliveryAmount) {
$maxDeliveryAmount = $this->maxDeliveryAmount;
}
return $maxDeliveryAmount;
} | php | public function getMaxPayPalDeliveryAmount()
{
$maxDeliveryAmount = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('dMaxPayPalDeliveryAmount');
if (!$maxDeliveryAmount) {
$maxDeliveryAmount = $this->maxDeliveryAmount;
}
return $maxDeliveryAmount;
} | [
"public",
"function",
"getMaxPayPalDeliveryAmount",
"(",
")",
"{",
"$",
"maxDeliveryAmount",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getConfigParam",
"(",
"'dMaxPayPalDeliveryAmount'",
")",
";",
... | Returns max delivery amount.
@return integer | [
"Returns",
"max",
"delivery",
"amount",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Config.php#L704-L712 | train |
OXID-eSales/paypal | Core/Config.php | Config.getPartnerCode | public function getPartnerCode()
{
$facts = new \OxidEsales\Facts\Facts();
$key = $this->isShortcutPayment() ? self::PARTNERCODE_SHORTCUT_KEY : $facts->getEdition();
return $this->partnerCodes[$key];
} | php | public function getPartnerCode()
{
$facts = new \OxidEsales\Facts\Facts();
$key = $this->isShortcutPayment() ? self::PARTNERCODE_SHORTCUT_KEY : $facts->getEdition();
return $this->partnerCodes[$key];
} | [
"public",
"function",
"getPartnerCode",
"(",
")",
"{",
"$",
"facts",
"=",
"new",
"\\",
"OxidEsales",
"\\",
"Facts",
"\\",
"Facts",
"(",
")",
";",
"$",
"key",
"=",
"$",
"this",
"->",
"isShortcutPayment",
"(",
")",
"?",
"self",
"::",
"PARTNERCODE_SHORTCUT_... | 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!
@return string partner code. | [
"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!"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Config.php#L721-L727 | train |
OXID-eSales/paypal | Core/Config.php | Config.getLogoImageName | protected function getLogoImageName()
{
$option = $this->getParameter('sOEPayPalLogoImageOption');
switch ($option) {
case 'shopLogo':
$logo = $this->getParameter('sShopLogo');
break;
case 'customLogo':
$logo = $this->getParameter('sOEPayPalCustomShopLogoImage');
break;
case 'noLogo':
default:
$logo = '';
return $logo;
}
return $logo;
} | php | protected function getLogoImageName()
{
$option = $this->getParameter('sOEPayPalLogoImageOption');
switch ($option) {
case 'shopLogo':
$logo = $this->getParameter('sShopLogo');
break;
case 'customLogo':
$logo = $this->getParameter('sOEPayPalCustomShopLogoImage');
break;
case 'noLogo':
default:
$logo = '';
return $logo;
}
return $logo;
} | [
"protected",
"function",
"getLogoImageName",
"(",
")",
"{",
"$",
"option",
"=",
"$",
"this",
"->",
"getParameter",
"(",
"'sOEPayPalLogoImageOption'",
")",
";",
"switch",
"(",
"$",
"option",
")",
"{",
"case",
"'shopLogo'",
":",
"$",
"logo",
"=",
"$",
"this"... | Returns logo image name according to parameter
@return mixed|string | [
"Returns",
"logo",
"image",
"name",
"according",
"to",
"parameter"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Config.php#L756-L774 | train |
OXID-eSales/paypal | Core/Config.php | Config.isShortcutPayment | protected function isShortcutPayment()
{
$trigger = (int) \OxidEsales\Eshop\Core\Registry::getSession()->getVariable(self::OEPAYPAL_TRIGGER_NAME);
return (bool) ($trigger == self::OEPAYPAL_SHORTCUT);
} | php | protected function isShortcutPayment()
{
$trigger = (int) \OxidEsales\Eshop\Core\Registry::getSession()->getVariable(self::OEPAYPAL_TRIGGER_NAME);
return (bool) ($trigger == self::OEPAYPAL_SHORTCUT);
} | [
"protected",
"function",
"isShortcutPayment",
"(",
")",
"{",
"$",
"trigger",
"=",
"(",
"int",
")",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getSession",
"(",
")",
"->",
"getVariable",
"(",
"self",
"::",
"OEPAYPAL_TRIGGER_NAME... | Was the payment triggered by shortcut button or not?
@return bool | [
"Was",
"the",
"payment",
"triggered",
"by",
"shortcut",
"button",
"or",
"not?"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Core/Config.php#L801-L805 | train |
OXID-eSales/paypal | Model/Address.php | Address.createPayPalAddress | public function createPayPalAddress($details, $userId)
{
$addressData = $this->prepareDataPayPalAddress($details);
if ($addressId = $this->existPayPalAddress($addressData)) {
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable("deladrid", $addressId);
} else {
$this->oxaddress__oxuserid = new \OxidEsales\Eshop\Core\Field($userId);
$this->oxaddress__oxfname = new \OxidEsales\Eshop\Core\Field($addressData['oxfname']);
$this->oxaddress__oxlname = new \OxidEsales\Eshop\Core\Field($addressData['oxlname']);
$this->oxaddress__oxstreet = new \OxidEsales\Eshop\Core\Field($addressData['oxstreet']);
$this->oxaddress__oxstreetnr = new \OxidEsales\Eshop\Core\Field($addressData['oxstreetnr']);
$this->oxaddress__oxaddinfo = new \OxidEsales\Eshop\Core\Field($addressData['oxaddinfo']);
$this->oxaddress__oxcity = new \OxidEsales\Eshop\Core\Field($addressData['oxcity']);
$this->oxaddress__oxcountryid = new \OxidEsales\Eshop\Core\Field($addressData['oxcountryid']);
$this->oxaddress__oxstateid = new \OxidEsales\Eshop\Core\Field($addressData['oxstateid']);
$this->oxaddress__oxzip = new \OxidEsales\Eshop\Core\Field($addressData['oxzip']);
$this->oxaddress__oxfon = new \OxidEsales\Eshop\Core\Field($addressData['oxfon']);
$this->save();
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable("deladrid", $this->getId());
}
} | php | public function createPayPalAddress($details, $userId)
{
$addressData = $this->prepareDataPayPalAddress($details);
if ($addressId = $this->existPayPalAddress($addressData)) {
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable("deladrid", $addressId);
} else {
$this->oxaddress__oxuserid = new \OxidEsales\Eshop\Core\Field($userId);
$this->oxaddress__oxfname = new \OxidEsales\Eshop\Core\Field($addressData['oxfname']);
$this->oxaddress__oxlname = new \OxidEsales\Eshop\Core\Field($addressData['oxlname']);
$this->oxaddress__oxstreet = new \OxidEsales\Eshop\Core\Field($addressData['oxstreet']);
$this->oxaddress__oxstreetnr = new \OxidEsales\Eshop\Core\Field($addressData['oxstreetnr']);
$this->oxaddress__oxaddinfo = new \OxidEsales\Eshop\Core\Field($addressData['oxaddinfo']);
$this->oxaddress__oxcity = new \OxidEsales\Eshop\Core\Field($addressData['oxcity']);
$this->oxaddress__oxcountryid = new \OxidEsales\Eshop\Core\Field($addressData['oxcountryid']);
$this->oxaddress__oxstateid = new \OxidEsales\Eshop\Core\Field($addressData['oxstateid']);
$this->oxaddress__oxzip = new \OxidEsales\Eshop\Core\Field($addressData['oxzip']);
$this->oxaddress__oxfon = new \OxidEsales\Eshop\Core\Field($addressData['oxfon']);
$this->save();
\OxidEsales\Eshop\Core\Registry::getSession()->setVariable("deladrid", $this->getId());
}
} | [
"public",
"function",
"createPayPalAddress",
"(",
"$",
"details",
",",
"$",
"userId",
")",
"{",
"$",
"addressData",
"=",
"$",
"this",
"->",
"prepareDataPayPalAddress",
"(",
"$",
"details",
")",
";",
"if",
"(",
"$",
"addressId",
"=",
"$",
"this",
"->",
"e... | Creates user shipping address from PayPal data and set to session.
@param \OxidEsales\PayPalModule\Model\Response\ResponseGetExpressCheckoutDetails $details PayPal data.
@param string $userId user id. | [
"Creates",
"user",
"shipping",
"address",
"from",
"PayPal",
"data",
"and",
"set",
"to",
"session",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Address.php#L37-L59 | train |
OXID-eSales/paypal | Model/Address.php | Address.checkRequiredFieldsPayPalAddress | protected function checkRequiredFieldsPayPalAddress($addressData)
{
$reqFields = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aMustFillFields');
$result = true;
foreach ($reqFields as $field) {
if (strpos($field, 'oxaddress__') === 0 && empty($addressData[str_replace('oxaddress__', '', $field)])) {
return false;
}
}
return $result;
} | php | protected function checkRequiredFieldsPayPalAddress($addressData)
{
$reqFields = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aMustFillFields');
$result = true;
foreach ($reqFields as $field) {
if (strpos($field, 'oxaddress__') === 0 && empty($addressData[str_replace('oxaddress__', '', $field)])) {
return false;
}
}
return $result;
} | [
"protected",
"function",
"checkRequiredFieldsPayPalAddress",
"(",
"$",
"addressData",
")",
"{",
"$",
"reqFields",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"Registry",
"::",
"getConfig",
"(",
")",
"->",
"getConfigParam",
"(",
"'aMustFillFields'",... | Check required fields.
@param array $addressData - PayPal data.
@return bool | [
"Check",
"required",
"fields",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Address.php#L107-L120 | train |
OXID-eSales/paypal | Model/Address.php | Address.existPayPalAddress | protected function existPayPalAddress($addressData)
{
$db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$query = "SELECT `oxid` FROM `oxaddress` WHERE 1 ";
$query .= " AND `oxfname` = " . $db->quote($addressData['oxfname']);
$query .= " AND `oxlname` = " . $db->quote($addressData['oxlname']);
$query .= " AND `oxstreet` = " . $db->quote($addressData['oxstreet']);
$query .= " AND `oxstreetnr` = " . $db->quote($addressData['oxstreetnr']);
$query .= " AND `oxcity` = " . $db->quote($addressData['oxcity']);
$query .= " AND `oxcountryid` = " . $db->quote($addressData['oxcountryid']);
$query .= " AND `oxstateid` = " . $db->quote($addressData['oxstateid']);
$query .= " AND `oxzip` = " . $db->quote($addressData['oxzip']);
$query .= " AND `oxfon` = " . $db->quote($addressData['oxfon']);
if ($addressId = $db->getOne($query)) {
return $addressId;
}
return false;
} | php | protected function existPayPalAddress($addressData)
{
$db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
$query = "SELECT `oxid` FROM `oxaddress` WHERE 1 ";
$query .= " AND `oxfname` = " . $db->quote($addressData['oxfname']);
$query .= " AND `oxlname` = " . $db->quote($addressData['oxlname']);
$query .= " AND `oxstreet` = " . $db->quote($addressData['oxstreet']);
$query .= " AND `oxstreetnr` = " . $db->quote($addressData['oxstreetnr']);
$query .= " AND `oxcity` = " . $db->quote($addressData['oxcity']);
$query .= " AND `oxcountryid` = " . $db->quote($addressData['oxcountryid']);
$query .= " AND `oxstateid` = " . $db->quote($addressData['oxstateid']);
$query .= " AND `oxzip` = " . $db->quote($addressData['oxzip']);
$query .= " AND `oxfon` = " . $db->quote($addressData['oxfon']);
if ($addressId = $db->getOne($query)) {
return $addressId;
}
return false;
} | [
"protected",
"function",
"existPayPalAddress",
"(",
"$",
"addressData",
")",
"{",
"$",
"db",
"=",
"\\",
"OxidEsales",
"\\",
"Eshop",
"\\",
"Core",
"\\",
"DatabaseProvider",
"::",
"getDb",
"(",
")",
";",
"$",
"query",
"=",
"\"SELECT `oxid` FROM `oxaddress` WHERE ... | Checks if exists PayPal address.
@param array $addressData
@return bool|string | [
"Checks",
"if",
"exists",
"PayPal",
"address",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Address.php#L129-L149 | train |
OXID-eSales/paypal | Model/Address.php | Address.splitShipToStreetPayPalAddress | public function splitShipToStreetPayPalAddress($shipToStreet)
{
$address = array();
$shipToStreet = trim($shipToStreet);
// checking if street number is at the end of the address
preg_match("/(.*\S)\s+(\d+\s*\S*)$/", $shipToStreet, $address);
// checking if street name and number was found
if (!empty($address[1]) && $address[2]) {
$address['street'] = $address[1];
$address['streetnr'] = $address[2];
return $address;
}
// checking if street number is at the begining of the address
preg_match("/(\d+\S*)\s+(.*)$/", $shipToStreet, $address);
// checking if street name and number was found
if (!empty($address[1]) && $address[2]) {
$address['street'] = $address[2];
$address['streetnr'] = $address[1];
return $address;
}
// it is not possible to resolve address, so assign it without any parsing
$address['street'] = $shipToStreet;
$address['streetnr'] = "";
return $address;
} | php | public function splitShipToStreetPayPalAddress($shipToStreet)
{
$address = array();
$shipToStreet = trim($shipToStreet);
// checking if street number is at the end of the address
preg_match("/(.*\S)\s+(\d+\s*\S*)$/", $shipToStreet, $address);
// checking if street name and number was found
if (!empty($address[1]) && $address[2]) {
$address['street'] = $address[1];
$address['streetnr'] = $address[2];
return $address;
}
// checking if street number is at the begining of the address
preg_match("/(\d+\S*)\s+(.*)$/", $shipToStreet, $address);
// checking if street name and number was found
if (!empty($address[1]) && $address[2]) {
$address['street'] = $address[2];
$address['streetnr'] = $address[1];
return $address;
}
// it is not possible to resolve address, so assign it without any parsing
$address['street'] = $shipToStreet;
$address['streetnr'] = "";
return $address;
} | [
"public",
"function",
"splitShipToStreetPayPalAddress",
"(",
"$",
"shipToStreet",
")",
"{",
"$",
"address",
"=",
"array",
"(",
")",
";",
"$",
"shipToStreet",
"=",
"trim",
"(",
"$",
"shipToStreet",
")",
";",
"// checking if street number is at the end of the address",
... | Split street nr from address
@param string $shipToStreet address string
@return array | [
"Split",
"street",
"nr",
"from",
"address"
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/Address.php#L158-L190 | train |
OXID-eSales/paypal | Model/OutOfStockValidator.php | OutOfStockValidator.hasOutOfStockArticles | public function hasOutOfStockArticles()
{
$result = false;
$basketContents = $this->getBasket()->getContents();
foreach ($basketContents as $basketItem) {
$article = $basketItem->getArticle();
if (($article->getStockAmount() - $basketItem->getAmount()) < $this->getEmptyStockLevel()) {
$result = true;
break;
}
}
return $result;
} | php | public function hasOutOfStockArticles()
{
$result = false;
$basketContents = $this->getBasket()->getContents();
foreach ($basketContents as $basketItem) {
$article = $basketItem->getArticle();
if (($article->getStockAmount() - $basketItem->getAmount()) < $this->getEmptyStockLevel()) {
$result = true;
break;
}
}
return $result;
} | [
"public",
"function",
"hasOutOfStockArticles",
"(",
")",
"{",
"$",
"result",
"=",
"false",
";",
"$",
"basketContents",
"=",
"$",
"this",
"->",
"getBasket",
"(",
")",
"->",
"getContents",
"(",
")",
";",
"foreach",
"(",
"$",
"basketContents",
"as",
"$",
"b... | Checks if basket has Articles that are out of stock.
@return bool | [
"Checks",
"if",
"basket",
"has",
"Articles",
"that",
"are",
"out",
"of",
"stock",
"."
] | ca9adba6e8312062449b53e7bda4a513c6b8c250 | https://github.com/OXID-eSales/paypal/blob/ca9adba6e8312062449b53e7bda4a513c6b8c250/Model/OutOfStockValidator.php#L88-L103 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.