From 29a1ac9d37c7a89405dc4a6cf4aa6b5f54a6a605 Mon Sep 17 00:00:00 2001 From: Swino4ka Date: Sat, 6 Apr 2024 19:40:04 +0200 Subject: [PATCH 1/5] Referral creation on page load, api things --- .../src/assets/js/Profile/Referrals.js | 33 +++++++++++ luckydiamond/src/components/ReferalModal.vue | 8 ++- luckydiamond/src/pages/ProfilePage.vue | 55 ++++++++++++++++++- 3 files changed, 93 insertions(+), 3 deletions(-) create mode 100644 luckydiamond/src/assets/js/Profile/Referrals.js diff --git a/luckydiamond/src/assets/js/Profile/Referrals.js b/luckydiamond/src/assets/js/Profile/Referrals.js new file mode 100644 index 0000000..2f1bc4f --- /dev/null +++ b/luckydiamond/src/assets/js/Profile/Referrals.js @@ -0,0 +1,33 @@ +import { BackendApiUrl } from '@/properties/Сonfig.js'; +import { GetCookie } from "@/assets/js/storage/CookieStorage"; +export async function GetReferralData () { + + const myHeaders = new Headers(); + myHeaders.append("Content-Type", "application/json"); + myHeaders.append("Cookie", "ARRAffinity=a6e48b9e9d2653435be7b61998d8624b44115214104213d6c8b8c526cc56dc70; ARRAffinitySameSite=a6e48b9e9d2653435be7b61998d8624b44115214104213d6c8b8c526cc56dc70"); + + const userData = { + searchToken: GetCookie("SearchToken"), + authtoken: GetCookie("AUTHTOKEN"), + }; + + const raw = JSON.stringify({ + "userCredentials": { + "searchToken": userData.searchToken, + "authtoken": userData.authtoken + } + }); + + const response = await fetch(`${BackendApiUrl}/PromoCode/GetReferralInfo`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: raw, + redirect: "follow" + }); + + return await response.json(); + + +} \ No newline at end of file diff --git a/luckydiamond/src/components/ReferalModal.vue b/luckydiamond/src/components/ReferalModal.vue index be5873d..9e91a23 100644 --- a/luckydiamond/src/components/ReferalModal.vue +++ b/luckydiamond/src/components/ReferalModal.vue @@ -12,7 +12,7 @@ class="deposit-input deposit-text referal-icon-diamond deposit-icon__input" >
-

Ваш реферальный код

+

{{ referralCode }}

import "@/assets/css/ComponentsStyles/payments-modal.css"; + import {GetReferralData} from "@/assets/js/Profile/Referrals"; export default { + data () { + return{ + ReferralData: GetReferralData + } + }, props: ["payments"], methods: { closeModal() { diff --git a/luckydiamond/src/pages/ProfilePage.vue b/luckydiamond/src/pages/ProfilePage.vue index 005286d..fb64343 100644 --- a/luckydiamond/src/pages/ProfilePage.vue +++ b/luckydiamond/src/pages/ProfilePage.vue @@ -90,7 +90,7 @@ export default { arrayHistory: [], } }, - + emits: ['notificationremove'], mounted() { this.checkWindowSize() @@ -100,6 +100,57 @@ export default { this.RemoveWindowListener() }, created() { + + const myHeaders = new Headers(); + myHeaders.append("Content-Type", "application/json"); + myHeaders.append("Cookie", "ARRAffinity=a6e48b9e9d2653435be7b61998d8624b44115214104213d6c8b8c526cc56dc70; ARRAffinitySameSite=a6e48b9e9d2653435be7b61998d8624b44115214104213d6c8b8c526cc56dc70"); + + const userData = { + searchToken: GetCookie("SearchToken"), + authtoken: GetCookie("AUTHTOKEN"), + }; + + const raw = JSON.stringify({ + "userCredentials": { + "searchToken": userData.searchToken, + "authtoken": userData.authtoken + } + }); + + const requestOptions = { + method: "POST", + headers: myHeaders, + body: raw, + redirect: "follow" + }; + + fetch("https://spsystemcore20231122004605.azurewebsites.net/api/PromoCode/GetReferralInfo", requestOptions) + .then((response) => response.text()) + .then((result) => { + console.log(result); + if (result == "\"The Referral is not created\"") { + const raw = JSON.stringify({ + "userCredentials": { + "searchToken": userData.searchToken, + "authtoken": userData.authtoken + } + }); + + const requestOptions = { + method: "POST", + headers: myHeaders, + body: raw, + redirect: "follow" + }; + + fetch("https://spsystemcore20231122004605.azurewebsites.net/api/PromoCode/CreateReferal", requestOptions) + .then((response) => response.text()) + .then((result) => console.log(result)) + .catch((error) => console.error(error)); + } + }) + .catch((error) => console.error(error)); + axios.post('https://spsystemcore20231122004605.azurewebsites.net/api/Payment/GetPaymentHistory', { searchToken: GetCookie('SearchToken'), authtoken: GetCookie('AUTHTOKEN') @@ -140,7 +191,7 @@ export default { this.payments = false this.openRef = false }, - referalClick() { + referalClick() { this.openModal = false this.openRef = true }, From 4154d3dba663ff0de7b3ee684a03750544fc4b8a Mon Sep 17 00:00:00 2001 From: rafael1209 Date: Sat, 6 Apr 2024 21:06:19 +0300 Subject: [PATCH 2/5] Update ReferalModal.vue connected referral system --- luckydiamond/src/components/ReferalModal.vue | 122 ++++++++----------- 1 file changed, 48 insertions(+), 74 deletions(-) diff --git a/luckydiamond/src/components/ReferalModal.vue b/luckydiamond/src/components/ReferalModal.vue index 9e91a23..04b15c0 100644 --- a/luckydiamond/src/components/ReferalModal.vue +++ b/luckydiamond/src/components/ReferalModal.vue @@ -1,102 +1,76 @@ - - \ No newline at end of file + }, +}; + From 82b32794b838158cf9b63c5027c22ae9f6628d63 Mon Sep 17 00:00:00 2001 From: Swino4ka Date: Sat, 6 Apr 2024 20:43:17 +0200 Subject: [PATCH 3/5] Referalls done (waiting backend for payment) --- luckydiamond/src/components/ReferalModal.vue | 107 +++++++++++++------ 1 file changed, 72 insertions(+), 35 deletions(-) diff --git a/luckydiamond/src/components/ReferalModal.vue b/luckydiamond/src/components/ReferalModal.vue index 04b15c0..7fc6441 100644 --- a/luckydiamond/src/components/ReferalModal.vue +++ b/luckydiamond/src/components/ReferalModal.vue @@ -6,45 +6,82 @@
-

Ошибка с суммой депозита

+

Ошибка с суммой депозита

+
+
+
+

Ваш реферальный код

+ +
+
+

Доступно к выводу

+ + +
+
    +
  • + +
  • +
-
-
-

{{ referralData.referralCode }}

- -
-
-

Доступно к выводу

- - -
-
    -
  • - -
  • -
-
-
-

Всего привели рефералов

-
- -
-
-
-

Подтвердите согласие!

-
- -
-

Вы подтверждаете правильность введенных данных при создании вывода.

- -

Перед пополнение прочитайте политику конфиденциальности и пользовательское соглашение.

+
+

Всего привели рефералов

+
+
+
+

Подтвердите согласие!

+
+ +
+

+ Вы подтверждаете правильность введенных данных при создании вывода. +

+ +

+ Перед пополнение прочитайте политику конфиденциальности и + пользовательское соглашение. +

+
+
+
-