From 0312b882e1ad5596e823943924d1b284d5592b14 Mon Sep 17 00:00:00 2001 From: Nikita Kiselev Date: Sat, 3 Jan 2026 12:13:57 +0300 Subject: [PATCH] fix: correctly work with telecart customers without usernames --- ...ill_empty_usernames_in_telecart_customers.php | 16 ++++++++++++++++ .../src/Services/TelecartCustomerService.php | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 module/oc_telegram_shop/upload/oc_telegram_shop/database/migrations/20260103000000_fill_empty_usernames_in_telecart_customers.php diff --git a/module/oc_telegram_shop/upload/oc_telegram_shop/database/migrations/20260103000000_fill_empty_usernames_in_telecart_customers.php b/module/oc_telegram_shop/upload/oc_telegram_shop/database/migrations/20260103000000_fill_empty_usernames_in_telecart_customers.php new file mode 100644 index 0000000..a09dccf --- /dev/null +++ b/module/oc_telegram_shop/upload/oc_telegram_shop/database/migrations/20260103000000_fill_empty_usernames_in_telecart_customers.php @@ -0,0 +1,16 @@ +database->statement($sql); + } +}; + diff --git a/module/oc_telegram_shop/upload/oc_telegram_shop/src/Services/TelecartCustomerService.php b/module/oc_telegram_shop/upload/oc_telegram_shop/src/Services/TelecartCustomerService.php index 1edcb6c..4802068 100755 --- a/module/oc_telegram_shop/upload/oc_telegram_shop/src/Services/TelecartCustomerService.php +++ b/module/oc_telegram_shop/upload/oc_telegram_shop/src/Services/TelecartCustomerService.php @@ -71,7 +71,7 @@ class TelecartCustomerService { return [ 'telegram_user_id' => $telegramUserId, - 'username' => Arr::get($telegramUserData, 'username'), + 'username' => Arr::get($telegramUserData, 'username', $telegramUserId), 'first_name' => Arr::get($telegramUserData, 'first_name'), 'last_name' => Arr::get($telegramUserData, 'last_name'), 'language_code' => Arr::get($telegramUserData, 'language_code'),