ref #72069
coupon code format change Adding text translations Code corrections legal entity check has been corrected
This commit is contained in:
parent
919c4a6633
commit
5245ef56b8
14 changed files with 273 additions and 72 deletions
|
@ -449,31 +449,112 @@ msgid "Loyalty program"
|
|||
msgstr "Programa de fidelización"
|
||||
|
||||
msgid "Activate program loyalty"
|
||||
msgstr "Activar el programa de fidelización"
|
||||
msgstr "Activar programa de fidelización"
|
||||
|
||||
msgid "Enable this setting for activate program loyalty on site"
|
||||
msgstr "Active esta opción para activar el programa de fidelización en el sitio web"
|
||||
msgstr "Activa esta configuración para activar programa de fidelización en la página web"
|
||||
|
||||
msgid "Terms of loyalty program"
|
||||
msgstr "Condiciones del programa de fidelidad"
|
||||
msgstr "Condiciones del programa de fidelización"
|
||||
|
||||
msgid "Insert the terms and conditions of the loyalty program"
|
||||
msgstr "Inserte las condiciones de participación en el programa de fidelidad"
|
||||
msgstr "Introduce las condiciones del programa de fidelización"
|
||||
|
||||
msgid "Conditions of personal data processing"
|
||||
msgstr "Condiciones del tratamiento de datos personales"
|
||||
msgstr "Condiciones de procesamiento de datos personales"
|
||||
|
||||
msgid "Insert the terms and conditions for processing personal data"
|
||||
msgstr "Inserte las condiciones para el tratamiento de datos personales"
|
||||
msgstr "Introduce las condiciones para el procesamiento de datos personales"
|
||||
|
||||
msgid "To activate the loyalty program it is necessary to activate the <a href='?page=wc-settings'>'enable use of coupons option'</a>"
|
||||
msgstr "Para activar el programa de fidelización es necesario activar la opción <a href='?page=wc-settings'>'habilitar uso de cupones'</a>."
|
||||
msgstr "Para activar el programa de fidelización es necesario activar la opción <a href='?page=wc-settings'>'habilitar el uso de cupones'</a>"
|
||||
|
||||
msgid "Bonus account"
|
||||
msgstr "Cuenta de bonos"
|
||||
|
||||
msgid "Participation ID: "
|
||||
msgstr "ID de participación: "
|
||||
|
||||
msgid "Current level: "
|
||||
msgstr "Nivel actual: "
|
||||
|
||||
msgid "Bonuses on the account: "
|
||||
msgstr "Bonos en la cuenta: "
|
||||
|
||||
msgid "Bonus card number: "
|
||||
msgstr "Número de tarjeta de bonos: "
|
||||
|
||||
msgid "Date of registration: "
|
||||
msgstr "Fecha de registro: "
|
||||
|
||||
msgid "Current level rules"
|
||||
msgstr "Reglas del nivel actual"
|
||||
|
||||
msgid "Required amount of purchases to move to the next level: "
|
||||
msgstr "Cantidad de compras necesarias para pasar al siguiente nivel: "
|
||||
|
||||
msgid "Activate participation in the loyalty program"
|
||||
msgstr "Activar participación en el programa de fidelización"
|
||||
|
||||
msgid "Send"
|
||||
msgstr "Enviar"
|
||||
|
||||
msgid "To register in the loyalty program, fill in the form:"
|
||||
msgstr "Para registrarse en el programa de fidelización, rellena el formulario:"
|
||||
|
||||
msgid " I agree with "
|
||||
msgstr " Estoy de acuerdo con "
|
||||
|
||||
msgid "loyalty program terms"
|
||||
msgstr "términos del programa de fidelización"
|
||||
|
||||
msgid "terms of personal data processing"
|
||||
msgstr "términos de procesamiento de datos personales"
|
||||
|
||||
msgid "Phone"
|
||||
msgstr "Teléfono"
|
||||
|
||||
msgid "Error while registering in the loyalty program. Try again later"
|
||||
msgstr "Error al registrarse en el programa de fidelización. Inténtalo de nuevo más tarde"
|
||||
|
||||
msgid "The card is not linked"
|
||||
msgstr "La tarjeta no está vinculada"
|
||||
|
||||
msgid "Error while retrieving data. Try again later"
|
||||
msgstr "Error al recuperar los datos. Inténtalo de nuevo más tarde"
|
||||
|
||||
msgid "Error when activating the loyalty program. Try again later"
|
||||
msgstr "Error al activar el programa de fidelización. Inténtalo de nuevo más tarde"
|
||||
|
||||
msgid "Enter the correct phone number"
|
||||
msgstr "Introduce el número de teléfono correcto"
|
||||
|
||||
msgid "Close"
|
||||
msgstr "Cerrar"
|
||||
|
||||
msgid "Ordinary products: accrual of 1 bonus for each %s %s"
|
||||
msgstr "Productos ordinarios: acumulación de 1 bono por cada %s %s"
|
||||
|
||||
msgid "Promotional products: accrual of 1 bonus for each %s %s"
|
||||
msgstr "Productos promocionales: acumulación de 1 bono por cada %s %s"
|
||||
|
||||
msgid "Ordinary products: bonus accrual in the amount of %s%% of the purchase amount"
|
||||
msgstr "Productos ordinarios: acumulación de bonos en la cantidad de %s%% de la suma de la compra"
|
||||
|
||||
msgid "Promotional products: bonus accrual in the amount of %s%% of the purchase amount"
|
||||
msgstr "Productos promocionales: acumulación de bonos en la cantidad de %s%% de la suma de la compra"
|
||||
|
||||
msgid "Ordinary products: %s%% discount"
|
||||
msgstr "Productos ordinarios: %s%% de descuento"
|
||||
|
||||
msgid "Promotional products: %s%% discount"
|
||||
msgstr "Productos promocionales: %s%% de descuento"
|
||||
|
||||
msgid "Uploading services"
|
||||
msgstr "Descarga de servicios"
|
||||
msgstr "Subida de servicios"
|
||||
|
||||
msgid "Goods with the 'virtual' option enabled will be uploaded to Simla as services"
|
||||
msgstr "Los bienes con la opción 'virtual' activada se cargarán en Simla como servicios"
|
||||
msgstr "Los productos con la opción 'virtual' activada se subirán a Simla como servicios"
|
||||
|
||||
msgid "User not found in the system"
|
||||
msgstr "Usuario no encontrado en el sistema"
|
||||
|
@ -482,19 +563,28 @@ msgid "Error when searching for participation in loyalty programs"
|
|||
msgstr "Error al buscar la participación en programas de fidelización"
|
||||
|
||||
msgid "No active participation in the loyalty program was detected"
|
||||
msgstr "No se detectó ninguna participación activa en el programa de fidelización"
|
||||
msgstr "No se detectó la participación activa en el programa de fidelización"
|
||||
|
||||
msgid "No bonuses for debiting"
|
||||
msgstr "Sin bonificaciones por adeudo"
|
||||
msgstr "No hay bonos para debitar"
|
||||
|
||||
msgid "Loyalty program not found"
|
||||
msgstr "Programa de fidelización no encontrado"
|
||||
|
||||
msgid "Loyalty program is not active"
|
||||
msgstr "El programa de fidelización no está activo"
|
||||
msgstr "Programa de fidelización no está activo"
|
||||
|
||||
msgid "Loyalty program blocked"
|
||||
msgstr "Programa de fidelización bloqueado"
|
||||
|
||||
msgid "This user is a corporate person"
|
||||
msgstr "Este usuario es una persona jurídica"
|
||||
|
||||
msgid "It is possible to write off"
|
||||
msgstr "Es posible debitar"
|
||||
|
||||
msgid "bonuses"
|
||||
msgstr "bonos"
|
||||
|
||||
msgid "Your coupon:"
|
||||
msgstr "Tu cupón:"
|
||||
|
|
|
@ -572,10 +572,10 @@ msgid "Error when searching for participation in loyalty programs"
|
|||
msgstr "Ошибка при поиске участия в программах лояльности"
|
||||
|
||||
msgid "No active participation in the loyalty program was detected"
|
||||
msgstr "Активного участия в программе лояльности не обнаружено"
|
||||
msgstr "Не обнаружено активного участия в программе лояльности"
|
||||
|
||||
msgid "No bonuses for debiting"
|
||||
msgstr "Бонусы на списание отсутствуют"
|
||||
msgstr "Нет бонусов для списания"
|
||||
|
||||
msgid "Loyalty program not found"
|
||||
msgstr "Программа лояльности не найдена"
|
||||
|
|
|
@ -104,7 +104,7 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||
add_action('woocommerce_new_order', [$this, 'create_order'], 11, 1);
|
||||
|
||||
|
||||
if (isset($this->settings['loyalty']) && $this->settings['loyalty'] === static::YES) {
|
||||
if (isLoyaltyActivate($this->settings)) {
|
||||
add_action('wp_ajax_register_customer_loyalty', [$this, 'register_customer_loyalty']);
|
||||
add_action('wp_ajax_activate_customer_loyalty', [$this, 'activate_customer_loyalty']);
|
||||
add_action('init', [$this, 'add_loyalty_endpoint'], 11, 1);
|
||||
|
@ -118,8 +118,8 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||
add_action('woocommerce_after_cart_item_quantity_update', [$this, 'refresh_loyalty_coupon'], 11, 1);
|
||||
add_action('woocommerce_cart_item_removed', [$this, 'refresh_loyalty_coupon'], 11, 1);
|
||||
add_action('woocommerce_before_cart_empted', [$this, 'clear_loyalty_coupon'], 11, 1);
|
||||
add_action('woocommerce_removed_coupon', [$this, 'removed_coupon'], 11, 1);
|
||||
add_action('woocommerce_applied_coupon', [$this, 'applied_coupon'], 11, 1);
|
||||
add_action('woocommerce_removed_coupon', [$this, 'remove_coupon'], 11, 1);
|
||||
add_action('woocommerce_applied_coupon', [$this, 'apply_coupon'], 11, 1);
|
||||
}
|
||||
|
||||
// Subscribed hooks
|
||||
|
@ -721,7 +721,7 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||
}
|
||||
}
|
||||
|
||||
public function removed_coupon($couponCode)
|
||||
public function remove_coupon($couponCode)
|
||||
{
|
||||
try {
|
||||
if (!$this->loyalty->deleteLoyaltyCoupon($couponCode)) {
|
||||
|
@ -732,7 +732,7 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||
}
|
||||
}
|
||||
|
||||
public function applied_coupon($couponCode)
|
||||
public function apply_coupon($couponCode)
|
||||
{
|
||||
try {
|
||||
if (!$this->loyalty->isLoyaltyCoupon($couponCode)) {
|
||||
|
|
|
@ -111,7 +111,7 @@ if (!class_exists('WC_Retailcrm_Loyalty')) :
|
|||
}
|
||||
}
|
||||
|
||||
private function getDiscountLp($cartItems, $site, $customerId)
|
||||
private function getDiscountLoyalty($cartItems, $site, $customerId)
|
||||
{
|
||||
$order = [
|
||||
'site' => $site,
|
||||
|
@ -235,7 +235,7 @@ if (!class_exists('WC_Retailcrm_Loyalty')) :
|
|||
return null;
|
||||
}
|
||||
|
||||
$lpDiscountSum = $this->getDiscountLp($woocommerce->cart->get_cart(), $site, $customerId);
|
||||
$lpDiscountSum = $this->getDiscountLoyalty($woocommerce->cart->get_cart(), $site, $customerId);
|
||||
|
||||
if ($lpDiscountSum === 0) {
|
||||
return null;
|
||||
|
@ -256,7 +256,7 @@ if (!class_exists('WC_Retailcrm_Loyalty')) :
|
|||
$coupon->set_usage_limit(0);
|
||||
$coupon->set_amount($lpDiscountSum);
|
||||
$coupon->set_email_restrictions($woocommerce->customer->get_email());
|
||||
$coupon->set_code('pl' . mt_rand());//TODO pl to loyalty
|
||||
$coupon->set_code('loyalty' . mt_rand());
|
||||
$coupon->save();
|
||||
|
||||
if ($refreshCoupon) {
|
||||
|
@ -307,7 +307,7 @@ if (!class_exists('WC_Retailcrm_Loyalty')) :
|
|||
|
||||
public function isLoyaltyCoupon($couponCode): bool
|
||||
{
|
||||
return preg_match('/^pl\d+$/m', $couponCode) === 1;
|
||||
return preg_match('/^loyalty\d+$/m', $couponCode) === 1;
|
||||
}
|
||||
|
||||
public function getCouponLoyalty($email)
|
||||
|
@ -318,7 +318,7 @@ if (!class_exists('WC_Retailcrm_Loyalty')) :
|
|||
$wpdb->prepare(
|
||||
"SELECT posts.post_name code FROM {$wpdb->prefix}posts AS posts
|
||||
LEFT JOIN {$wpdb->prefix}postmeta AS postmeta ON posts.ID = postmeta.post_id
|
||||
WHERE posts.post_type = 'shop_coupon' AND posts.post_name LIKE 'pl%'
|
||||
WHERE posts.post_type = 'shop_coupon' AND posts.post_name LIKE 'loyalty%'
|
||||
AND postmeta.meta_key = 'customer_email' AND postmeta.meta_value LIKE %s",
|
||||
'%' . $email . '%'
|
||||
), ARRAY_A
|
||||
|
@ -333,35 +333,32 @@ if (!class_exists('WC_Retailcrm_Loyalty')) :
|
|||
foreach ($coupons as $coupon) {
|
||||
$code = $coupon->get_code();
|
||||
|
||||
if (preg_match('/^pl\d+$/m', $code) !== 1) {
|
||||
continue;
|
||||
if ($this->isLoyaltyCoupon($code)) {
|
||||
$discountLp = $coupon->get_discount();
|
||||
$wcOrder->remove_coupon($code);
|
||||
$objectCoupon = new WC_Coupon($code);
|
||||
$objectCoupon->delete(true);
|
||||
|
||||
$wcOrder->recalculate_coupons();
|
||||
break;
|
||||
}
|
||||
|
||||
$discountLp = $coupon->get_discount();
|
||||
$wcOrder->remove_coupon($code);
|
||||
$objectCoupon = new WC_Coupon($code);
|
||||
$objectCoupon->delete(true);
|
||||
|
||||
$wcOrder->recalculate_coupons();
|
||||
break;
|
||||
}
|
||||
|
||||
return $discountLp;
|
||||
}
|
||||
|
||||
public function isValidUser($wcUser)
|
||||
public function isValidOrder($wcUser, $wcOrder)
|
||||
{
|
||||
if (!$wcUser
|
||||
return !(!$wcUser
|
||||
|| (
|
||||
isset($this->settings['corporate_enabled'])
|
||||
&& $this->settings['corporate_enabled'] === WC_Retailcrm_Base::YES
|
||||
&& !empty($wcUser->get_shipping_company())
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
&& (
|
||||
!empty($wcUser->get_billing_company())
|
||||
|| !empty($wcOrder->get_billing_company())
|
||||
)
|
||||
))
|
||||
;
|
||||
}
|
||||
|
||||
public function applyLoyaltyDiscount($wcOrder, $discountLp, $createdOrder)
|
||||
|
@ -395,7 +392,7 @@ if (!class_exists('WC_Retailcrm_Loyalty')) :
|
|||
|
||||
foreach ($items as $item) {
|
||||
$externalId = $item['externalIds'][0]['value'];
|
||||
$externalId = preg_replace('/^\d+\_/m', '', $externalId);//TODO проверить типы товаров
|
||||
$externalId = preg_replace('/^\d+\_/m', '', $externalId);
|
||||
|
||||
if (isset($wcItems[(int) $externalId])) {
|
||||
$discountLoyaltyTotal = 0;
|
||||
|
|
|
@ -67,9 +67,7 @@ if (!class_exists('WC_Retailcrm_Orders')) :
|
|||
$this->orders = $orders;
|
||||
$this->order_payment = $order_payment;
|
||||
|
||||
if (isset($this->retailcrm_settings['loyalty'])
|
||||
&& $this->retailcrm_settings['loyalty'] === WC_Retailcrm_Base::YES
|
||||
) {
|
||||
if (isLoyaltyActivate($retailcrm_settings)) {
|
||||
$this->loyalty = new WC_Retailcrm_Loyalty($retailcrm, $retailcrm_settings);
|
||||
}
|
||||
|
||||
|
@ -102,9 +100,10 @@ if (!class_exists('WC_Retailcrm_Orders')) :
|
|||
$discountLp = $this->loyalty->deleteLoyaltyCouponInOrder($wcOrder);
|
||||
$wcUser = $wcOrder->get_user();
|
||||
|
||||
if (!$this->loyalty->isValidUser($wcUser) && $discountLp > 0) {
|
||||
if (!$this->loyalty->isValidOrder($wcUser, $wcOrder) && $discountLp > 0) {
|
||||
writeBaseLogs('The user does not meet the requirements for working with the loyalty program. Order Id: ' . $orderId);
|
||||
wp_die();//TODO удаление скидки вместо отмены заказа.
|
||||
|
||||
$discountLp = 0;
|
||||
} else {
|
||||
$privilegeType = 'loyalty_level';
|
||||
}
|
||||
|
|
|
@ -202,3 +202,8 @@ function useHpos()
|
|||
return class_exists(Automattic\WooCommerce\Utilities\OrderUtil::class)
|
||||
&& Automattic\WooCommerce\Utilities\OrderUtil::custom_orders_table_usage_is_enabled();
|
||||
}
|
||||
|
||||
function isLoyaltyActivate($settings)
|
||||
{
|
||||
return isset($settings['loyalty']) && $settings['loyalty'] === WC_Retailcrm_Base::YES;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ if (!class_exists('WC_Retailcrm_Loyalty_Validator')) :
|
|||
|
||||
protected $isActiveCorp;
|
||||
|
||||
public $crmUser;
|
||||
public $customer;
|
||||
|
||||
public $loyaltyAccount;
|
||||
|
||||
|
@ -33,7 +33,7 @@ if (!class_exists('WC_Retailcrm_Loyalty_Validator')) :
|
|||
{
|
||||
try {
|
||||
$this->checkUser($userId);
|
||||
$this->checkLoyaltyAccount($this->crmUser['id']);
|
||||
$this->checkLoyaltyAccount($this->customer['id']);
|
||||
$this->checkActiveLoyalty($this->loyaltyAccount['loyalty']['id']);
|
||||
|
||||
return true;
|
||||
|
@ -59,19 +59,19 @@ if (!class_exists('WC_Retailcrm_Loyalty_Validator')) :
|
|||
|
||||
$customer = new WC_Customer($userId);
|
||||
|
||||
if ($this->isActiveCorp === WC_Retailcrm_Base::YES && !empty($customer->get_shipping_company())) {
|
||||
if ($this->isActiveCorp === WC_Retailcrm_Base::YES && !empty($customer->get_billing_company())) {
|
||||
throw new ValidatorException($this->isCorporateUser, 400);
|
||||
}
|
||||
|
||||
$this->crmUser = $responseUser['customer'];
|
||||
$this->customer = $responseUser['customer'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ValidatorException
|
||||
*/
|
||||
private function checkLoyaltyAccount($crmUserId)
|
||||
private function checkLoyaltyAccount($customerId)
|
||||
{
|
||||
$filter['customerId'] = $crmUserId;
|
||||
$filter['customerId'] = $customerId;
|
||||
$responseLoyalty = $this->apiClient->getLoyaltyAccountList($filter);
|
||||
|
||||
if (!$responseLoyalty->isSuccessful() || !$responseLoyalty->offsetExists('loyaltyAccounts')) {
|
||||
|
|
|
@ -199,7 +199,54 @@ return [
|
|||
"La moneda del sitio web es distinto a la tienda del CRM. Para el funcionamiento correcto de la integración, las monedas del CMS y CRM deben coincid",
|
||||
"Uploading services" => "Descarga de servicios",
|
||||
"Goods with the 'virtual' option enabled will be uploaded to Simla as services" =>
|
||||
"Los bienes con la opción 'virtual' activada se cargarán en Simla como servicios"
|
||||
"Los bienes con la opción 'virtual' activada se cargarán en Simla como servicios",
|
||||
"Loyalty program" => "Programa de fidelización",
|
||||
"Activate program loyalty" => "Activar programa de fidelización",
|
||||
"Enable this setting for activate program loyalty on site" => "Activa esta configuración para activar el programa de fidelización en la página web",
|
||||
"Terms of loyalty program" => "Condiciones del programa de fidelización",
|
||||
"Insert the terms and conditions of the loyalty program" => "Inserte las condiciones del programa de fidelización",
|
||||
"Conditions of personal data processing" => "Condiciones de procesamiento de datos personales",
|
||||
"Insert the terms and conditions for processing personal data" => "Inserte las condiciones para el procesamiento de datos personales",
|
||||
"To activate the loyalty program it is necessary to activate the <a href='?page=wc-settings'>'enable use of coupons option'</a>" =>
|
||||
"Para activar el programa de fidelización es necesario activar la opción <a href='?page=wc-settings'>'habilitar el uso de cupones'</a>",
|
||||
"Bonus account" => "Cuenta de bonificación",
|
||||
"Participation ID: " => "ID de participación: ",
|
||||
"Current level: " => "Nivel actual: ",
|
||||
"Bonuses on the account: " => "Bonificaciones en la cuenta: ",
|
||||
"Bonus card number: " => "Número de tarjeta de bonificación: ",
|
||||
"Date of registration: " => "Fecha de registro: ",
|
||||
"Current level rules" => "Reglas del nivel actual",
|
||||
"Required amount of purchases to move to the next level: " => "Cantidad de compras necesarias para pasar al siguiente nivel: ",
|
||||
"Activate participation in the loyalty program" => "Activar participación en el programa de fidelización",
|
||||
"Send" => "Enviar",
|
||||
"To register in the loyalty program, fill in the form:" => "Para registrarse en el programa de fidelización, rellene el formulario:",
|
||||
" I agree with " => " Acepto ",
|
||||
"loyalty program terms" => "términos del programa de fidelización",
|
||||
"terms of personal data processing" => "términos de procesamiento de datos personales",
|
||||
"Phone" => "Teléfono",
|
||||
"Error while registering in the loyalty program. Try again later" => "Error al registrarse en el programa de fidelización. Inténtalo de nuevo más tarde",
|
||||
"The card is not linked" => "La tarjeta no está vinculada",
|
||||
"Error while retrieving data. Try again later" => "Error al recuperar los datos. Inténtalo de nuevo más tarde",
|
||||
"Error when activating the loyalty program. Try again later" => "Error al activar el programa de fidelización. Inténtalo de nuevo más tarde",
|
||||
"Enter the correct phone number" => "Introduce el número de teléfono correcto",
|
||||
"Close" => "Cerrar",
|
||||
"Ordinary products: accrual of 1 bonus for each %s %s" => "Productos ordinarios: acumulación de 1 bonificación por cada %s %s",
|
||||
"Promotional products: accrual of 1 bonus for each %s %s" => "Productos promocionales: acumulación de 1 bonificación por cada %s %s",
|
||||
"Ordinary products: bonus accrual in the amount of %s%% of the purchase amount" => "Productos ordinarios: acumulación de bonificación en la cantidad de %s%% del monto de la compra",
|
||||
"Promotional products: bonus accrual in the amount of %s%% of the purchase amount" => "Productos promocionales: acumulación de bonificación en la cantidad de %s%% del monto de la compra",
|
||||
"Ordinary products: %s%% discount" => "Productos ordinarios: descuento del %s%%",
|
||||
"Promotional products: %s%% discount" => "Productos promocionales: descuento del %s%%",
|
||||
"User not found in the system" => "Usuario no encontrado en el sistema",
|
||||
"Error when searching for participation in loyalty programs" => "Error al buscar la participación en programas de fidelización",
|
||||
"No active participation in the loyalty program was detected" => "No se detectó participación activa en el programa de fidelización",
|
||||
"No bonuses for debiting" => "No hay bonificaciones para debitar",
|
||||
"Loyalty program not found" => "Programa de fidelización no encontrado",
|
||||
"Loyalty program is not active" => "El programa de fidelización no está activo",
|
||||
"Loyalty program blocked" => "Programa de fidelización bloqueado",
|
||||
"This user is a corporate person" => "Este usuario es una persona jurídica",
|
||||
"It is possible to write off" => "Es posible debitar",
|
||||
"bonuses" => "bonificaciones",
|
||||
"Your coupon:" => "Tu cupón:",
|
||||
],
|
||||
"language" => "es",
|
||||
"x-generator" => "GlotPress/2.4.0-alpha",
|
||||
|
|
Binary file not shown.
|
@ -198,7 +198,54 @@ return [
|
|||
"Валюта сайта отличается от валюты магазина в CRM. Для корректной работы интеграции, валюты в CRM и CMS должны совпадать",
|
||||
"Uploading services" => "Выгрузка услуг",
|
||||
"Goods with the 'virtual' option enabled will be uploaded to Simla as services" =>
|
||||
"Товары с включенной опцией 'виртуальные' будут выгружаться в CRM как услуги"
|
||||
"Товары с включенной опцией 'виртуальные' будут выгружаться в CRM как услуги",
|
||||
"Loyalty program" => "Программа лояльности",
|
||||
"Activate program loyalty" => "Активировать программу лояльности",
|
||||
"Enable this setting for activate program loyalty on site" => "Активируйте эту настройку для активации программы лояльности на сайте",
|
||||
"Terms of loyalty program" => "Условия программы лояльности",
|
||||
"Insert the terms and conditions of the loyalty program" => "Вставьте условия участия в программе лояльности",
|
||||
"Conditions of personal data processing" => "Условия обработки персональных данных",
|
||||
"Insert the terms and conditions for processing personal data" => "Вставьте условия обработки персональных данных",
|
||||
"To activate the loyalty program it is necessary to activate the <a href='?page=wc-settings'>'enable use of coupons option'</a>" =>
|
||||
"Для активации программы лояльности необходимо активировать опцию <a href='?page=wc-settings'>'включить использование купонов'</a>",
|
||||
"Bonus account" => "Бонусный счет",
|
||||
"Participation ID: " => "ID участия: ",
|
||||
"Current level: " => "Текущий уровень: ",
|
||||
"Bonuses on the account: " => "Бонусов на счету: ",
|
||||
"Bonus card number: " => "Номер бонусной карты: ",
|
||||
"Date of registration: " => "Дата регистрации: ",
|
||||
"Current level rules" => "Правила текущего уровня",
|
||||
"Required amount of purchases to move to the next level: " => "Необходимая сумма покупок для перехода на следующий уровень: ",
|
||||
"Activate participation in the loyalty program" => "Активировать участие в программе лояльности",
|
||||
"Send" => "Отправить",
|
||||
"To register in the loyalty program, fill in the form:" => "Для регистрации в программе лояльности заполните форму:",
|
||||
" I agree with " => " Я согласен с ",
|
||||
"loyalty program terms" => "условиями программы лояльности",
|
||||
"terms of personal data processing" => "условиями обработки персональных данных",
|
||||
"Phone" => "Телефон",
|
||||
"Error while registering in the loyalty program. Try again later" => "Ошибка при регистрации в программе лояльности. Попробуйте позже",
|
||||
"The card is not linked" => "Карта не привязана",
|
||||
"Error while retrieving data. Try again later" => "Ошибка при получении данных. Попробуйте позже",
|
||||
"Error when activating the loyalty program. Try again later" => "Ошибка при активации программы лояльности. Попробуйте позже",
|
||||
"Enter the correct phone number" => "Введите корректный номер телефона",
|
||||
"Close" => "Закрыть",
|
||||
"Ordinary products: accrual of 1 bonus for each %s %s" => "Обычные товары: начисление 1 бонуса за каждые %s %s",
|
||||
"Promotional products: accrual of 1 bonus for each %s %s" => "Акционные товары: начисление 1 бонуса за каждые %s %s",
|
||||
"Ordinary products: bonus accrual in the amount of %s%% of the purchase amount" => "Обычные товары: начисление бонуса в размере %s%% от суммы покупки",
|
||||
"Promotional products: bonus accrual in the amount of %s%% of the purchase amount" => "Акционные товары: начисление бонуса в размере %s%% от суммы покупки",
|
||||
"Ordinary products: %s%% discount" => "Обычные товары: скидка %s%%",
|
||||
"Promotional products: %s%% discount" => "Акционные товары: скидка %s%%",
|
||||
"User not found in the system" => "Пользователь не найден в системе",
|
||||
"Error when searching for participation in loyalty programs" => "Ошибка при поиске участия в программах лояльности",
|
||||
"No active participation in the loyalty program was detected" => "Не обнаружено активного участия в программе лояльности",
|
||||
"No bonuses for debiting" => "Нет бонусов для списания",
|
||||
"Loyalty program not found" => "Программа лояльности не найдена",
|
||||
"Loyalty program is not active" => "Программа лояльности не активна",
|
||||
"Loyalty program blocked" => "Программа лояльности заблокирована",
|
||||
"This user is a corporate person" => "Этот пользователь является корпоративным лицом",
|
||||
"It is possible to write off" => "Возможно списать",
|
||||
"bonuses" => "бонусов",
|
||||
"Your coupon:" => "Ваш купон:",
|
||||
],
|
||||
"language" => "ru",
|
||||
"x-generator" => "GlotPress/2.4.0-alpha",
|
||||
|
|
Binary file not shown.
|
@ -221,7 +221,7 @@ class DataLoyaltyRetailCrm
|
|||
{
|
||||
return [
|
||||
[
|
||||
'code' => 'pl49844894548',
|
||||
'code' => 'loyalty49844894548',
|
||||
'expected' => true
|
||||
],
|
||||
[
|
||||
|
@ -269,22 +269,33 @@ class DataLoyaltyRetailCrm
|
|||
[
|
||||
'customer' => $users[0],
|
||||
'corporate_enabled' => 'yes',
|
||||
'expected' => true
|
||||
'expected' => true,
|
||||
'orderCorporate' => false
|
||||
],
|
||||
[
|
||||
'customer' => $users[1],
|
||||
'corporate_enabled' => 'yes',
|
||||
'expected' => false
|
||||
'expected' => false,
|
||||
'orderCorporate' => false
|
||||
],
|
||||
[
|
||||
'customer' => $users[1],
|
||||
'corporate_enabled' => 'no',
|
||||
'expected' => true
|
||||
'expected' => true,
|
||||
'orderCorporate' => false
|
||||
],
|
||||
[
|
||||
'customer' => null,
|
||||
'corporate_enabled' => 'yes',
|
||||
'expected' => false
|
||||
'expected' => false,
|
||||
'orderCorporate' => false
|
||||
|
||||
],
|
||||
[
|
||||
'customer' => $users[0],
|
||||
'corporate_enabled' => 'yes',
|
||||
'expected' => false,
|
||||
'orderCorporate' => true
|
||||
]
|
||||
];
|
||||
}
|
||||
|
@ -309,7 +320,7 @@ class DataLoyaltyRetailCrm
|
|||
$customer1->set_password('password');
|
||||
$customer1->set_billing_phone('89000000000');
|
||||
$customer1->set_date_created(date('Y-m-d H:i:s'));
|
||||
$customer1->set_shipping_company('OOO TEST');
|
||||
$customer1->set_billing_company('OOO TEST');
|
||||
$customer1->save();
|
||||
|
||||
return [$customer, $customer1];
|
||||
|
@ -322,7 +333,7 @@ class DataLoyaltyRetailCrm
|
|||
$coupon->set_usage_limit(0);
|
||||
$coupon->set_amount(100);
|
||||
$coupon->set_email_restrictions($email1);
|
||||
$coupon->set_code('pl' . mt_rand());
|
||||
$coupon->set_code('loyalty' . mt_rand());
|
||||
$coupon->save();
|
||||
|
||||
$coupon1 = new WC_Coupon();
|
||||
|
@ -330,7 +341,7 @@ class DataLoyaltyRetailCrm
|
|||
$coupon1->set_usage_limit(0);
|
||||
$coupon1->set_amount(100);
|
||||
$coupon1->set_email_restrictions($email2);
|
||||
$coupon1->set_code('pl' . mt_rand());
|
||||
$coupon1->set_code('loyalty' . mt_rand());
|
||||
$coupon1->save();
|
||||
|
||||
return [$coupon, $coupon1];
|
||||
|
|
|
@ -89,7 +89,7 @@ class WC_Retailcrm_Loyalty_Test extends WC_Retailcrm_Test_Case_Helper
|
|||
/**
|
||||
* @dataProvider DataLoyaltyRetailCrm::getDataCalculation()
|
||||
*/
|
||||
public function testGetDiscountLp($response, $expected)
|
||||
public function testGetDiscountLoyalty($response, $expected)
|
||||
{
|
||||
$responseMock = new WC_Retailcrm_Response(200, json_encode($response));
|
||||
$this->setMockResponse($this->apiMock, 'calculateDiscountLoyalty', $responseMock);
|
||||
|
@ -98,7 +98,7 @@ class WC_Retailcrm_Loyalty_Test extends WC_Retailcrm_Test_Case_Helper
|
|||
|
||||
$this->loyalty = new WC_Retailcrm_Loyalty($this->apiMock, []);
|
||||
|
||||
$method = $this->getPrivateMethod('getDiscountLp', $this->loyalty);
|
||||
$method = $this->getPrivateMethod('getDiscountLoyalty', $this->loyalty);
|
||||
|
||||
$discount = $method->invokeArgs($this->loyalty, [$cartItems, 'test', 1]);
|
||||
$this->assertEquals($expected, $discount);
|
||||
|
@ -119,11 +119,16 @@ class WC_Retailcrm_Loyalty_Test extends WC_Retailcrm_Test_Case_Helper
|
|||
/**
|
||||
* @dataProvider DataLoyaltyRetailCrm::dataValidUser();
|
||||
*/
|
||||
public function testIsValidUser($customer, $corporate_enabled, $expected)
|
||||
public function testIsValidOrder($customer, $corporate_enabled, $expected, $orderCorporate)
|
||||
{
|
||||
$this->loyalty = new WC_Retailcrm_Loyalty($this->apiMock, ['corporate_enabled' => $corporate_enabled]);
|
||||
$wcOrder = new WC_Order();
|
||||
|
||||
$this->assertEquals($expected, $this->loyalty->isValidUser($customer));
|
||||
if ($orderCorporate) {
|
||||
$wcOrder->set_billing_company('OOO TEST');
|
||||
}
|
||||
|
||||
$this->assertEquals($expected, $this->loyalty->isValidOrder($customer, $wcOrder));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -238,7 +243,7 @@ class WC_Retailcrm_Loyalty_Test extends WC_Retailcrm_Test_Case_Helper
|
|||
$coupon->set_usage_limit(0);
|
||||
$coupon->set_amount('50');
|
||||
$coupon->set_email_restrictions($user->get_email());
|
||||
$coupon->set_code('pl' . mt_rand());
|
||||
$coupon->set_code('loyalty' . mt_rand());
|
||||
$coupon->save();
|
||||
$cart->apply_coupon($coupon->get_code());
|
||||
|
||||
|
@ -285,7 +290,7 @@ class WC_Retailcrm_Loyalty_Test extends WC_Retailcrm_Test_Case_Helper
|
|||
$coupon->set_usage_limit(0);
|
||||
$coupon->set_amount('50');
|
||||
$coupon->set_email_restrictions($user->get_email());
|
||||
$coupon->set_code('pl' . mt_rand());
|
||||
$coupon->set_code('loyalty' . mt_rand());
|
||||
$coupon->save();
|
||||
|
||||
$wcOrder = wc_create_order([
|
||||
|
|
|
@ -29,7 +29,7 @@ class WC_Retailcrm_Loyalty_Validator_Test extends WC_Retailcrm_Test_Case_Helper
|
|||
$this->corpClient->set_password('password');
|
||||
$this->corpClient->set_billing_phone('89000000000');
|
||||
$this->corpClient->set_date_created(date('Y-m-d H:i:s'));
|
||||
$this->corpClient->set_shipping_company('TEST COMPANY');
|
||||
$this->corpClient->set_billing_company('TEST COMPANY');
|
||||
$this->corpClient->save();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue