first commit

This commit is contained in:
2024-10-25 14:16:28 +02:00
commit 925276dbb2
33795 changed files with 4780077 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
<?php
/**
* Class Przelewy24OrderDescriptionHelper
*
* @author Przelewy24
* @copyright Przelewy24
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Class Przelewy24OrderDescriptionHelper
*/
class Przelewy24OrderDescriptionHelper
{
/**
* @param string $orderTranslated
* @param string $suffix
* @param Przelewy24PaymentData $paymentData
* @param string $fallbackName fallback when order is made after payment
*
* @return string
*/
public static function buildDescription($orderTranslated, $suffix, $paymentData, $fallbackName = '')
{
$orderReference = $paymentData->getOrderReference();
$getFirstOrderId = $paymentData->getFirstOrderId();
$orderNumberSuffix = ('1' === Configuration::get('P24_ORDER_TITLE_ID' . $suffix))
? $paymentData->getOrderReference()
: $paymentData->getFirstOrderId();
if (empty($orderReference) && empty($getFirstOrderId)) {
return $fallbackName;
}
return $orderTranslated . ' ' . $orderNumberSuffix;
}
public static function buildDescriptionConfigured($orderTranslated, $cartTranslated, $suffix, $paymentData)
{
if ($paymentData->orderExists()) {
$orderNumberSuffix = ('1' === Configuration::get('P24_ORDER_TITLE_ID' . $suffix))
? $paymentData->getOrderReference()
: $paymentData->getFirstOrderId();
return $orderTranslated . ' ' . $orderNumberSuffix;
} else {
return $cartTranslated . ' ' . $paymentData->getCart()->id;
}
}
}