diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index aebe0d1..f546d57 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -41,12 +41,30 @@ jobs: username: ${{ secrets.SSH_USER }} password: ${{ secrets.SSH_PASSWORD }} script: | - cd /root/hshop/ + cd /root/hshop/ || { echo "ERROR: دایرکتوری پیدا نشد"; exit 1; } - docker compose down --remove-orphans --timeout 60 + docker compose down --remove-orphans --timeout 10 - docker compose up --build --detach --remove-orphans - - docker image prune -af - - docker compose ps \ No newline at end of file + docker compose up --build --detach || { echo "ERROR: ارور در بیلد"; exit 1; } + + - name: display active containers + uses: appleboy/ssh-action@v0.1.6 + with: + host: ${{ secrets.SERVER_HOST }} + username: ${{ secrets.SSH_USER }} + password: ${{ secrets.SSH_PASSWORD }} + script: | + cd /root/hshop/ || { echo "ERROR: دایرکتوری پیدا نشد"; exit 1; } + docker compose ps + + - name: clean up server + uses: appleboy/ssh-action@v0.1.6 + with: + host: ${{ secrets.SERVER_HOST }} + username: ${{ secrets.SSH_USER }} + password: ${{ secrets.SSH_PASSWORD }} + script: | + + docker image prune -af --filter "until=48h" || { echo "ERROR: ارور در پاک کردن images";} + + docker builder prune -af --filter "until=48h" || { echo "ERROR: ارور در پاک کردن builder cache";} diff --git a/backend/account/views.py b/backend/account/views.py index 9799d2d..30687e8 100644 --- a/backend/account/views.py +++ b/backend/account/views.py @@ -43,10 +43,6 @@ class SendOTPView(APIView): Code: {otp}""" sms_api = ghasedak_sms.Ghasedak(api_key="1227eaaddcba72bcb0169b37032cf16ae9ac6ed8b3b7c2768b74e2ee351d1b52gyRe3AGomZRPTNEd") - # response = sms_api.send_single_sms(ghasedak_sms.SendSingleSmsInput(message=message, receptor=phone, line_number='30005006006908', send_date='', client_reference_id='')) - # print(response) - - response = sms_api.send_single_sms( ghasedak_sms.SendSingleSmsInput( @@ -57,8 +53,6 @@ Code: {otp}""" ) ) - # response = sms_api.send_otp_sms(otp_input) - if response['statusCode'] == 200: return Response({'detail': f'OTP sent successfully {otp}'}, status=status.HTTP_200_OK) else: diff --git a/backend/core/settings/base.py b/backend/core/settings/base.py index ababbb6..4710cfd 100644 --- a/backend/core/settings/base.py +++ b/backend/core/settings/base.py @@ -241,19 +241,19 @@ AWS_S3_OBJECT_PARAMETERS = { AZ_IRANIAN_BANK_GATEWAYS = { "GATEWAYS": { - "ZARINPAL": { - "MERCHANT_CODE": "9cf93a18-dc99-4e6c-8873-d37a8190a027", - "SANDBOX": 0, + "ZIBAL": { + "MERCHANT_CODE": "zibal", + "SANDBOX": True }, }, "IS_SAMPLE_FORM_ENABLE": True, - "DEFAULT": "ZARINPAL", + "DEFAULT": "ZIBAL", "CURRENCY": "IRT", "TRACKING_CODE_QUERY_PARAM": "tc", "TRACKING_CODE_LENGTH": 16, "SETTING_VALUE_READER_CLASS": "azbankgateways.readers.DefaultReader", "BANK_PRIORITIES": [ - "ZARINPAL", + "ZIBAL", ], "IS_SAFE_GET_GATEWAY_PAYMENT": False # better to be True } \ No newline at end of file diff --git a/backend/core/settings/unfold_conf.py b/backend/core/settings/unfold_conf.py index 3f4deba..23bf662 100644 --- a/backend/core/settings/unfold_conf.py +++ b/backend/core/settings/unfold_conf.py @@ -32,7 +32,7 @@ UNFOLD = { lambda request: static("rtl.css"), ], - "BORDER_RADIUS": "20px", + "BORDER_RADIUS": "8px", "SHOW_HISTORY": True, "SHOW_VIEW_ON_SITE": True, "ENVIRONMENT": "core.settings.environment_callback", @@ -47,7 +47,7 @@ UNFOLD = { "500": "115 115 115", "600": "82 82 82", "700": "64 64 64", - "800": "38 38 38", + "800": "42 42 42", "900": "23 23 23", "950": "10 10 10" }, diff --git a/backend/core/static/fonts.css b/backend/core/static/fonts.css index be4ee56..0f1458f 100644 --- a/backend/core/static/fonts.css +++ b/backend/core/static/fonts.css @@ -1,88 +1,51 @@ @layer base { @font-face { - font-family: "IRANYekanXVF"; - src: url("./fonts/IranYekanX/IRANYekanX-Thin.woff2"); - font-weight: 100; - font-style: normal; - font-display: swap; - } - @font-face { - font-family: "IRANYekanXVF"; - src: url("./fonts/IranYekanX/IRANYekanX-UltraLight.woff2"); - font-weight: 200; - font-style: normal; - font-display: swap; - } - - @font-face { - font-family: "IRANYekanXVF"; - src: url("./fonts/IranYekanX/IRANYekanX-Light.woff2"); + font-family: "Peyda"; + src: url("./fonts/peyda/300-PeydaWeb-Light-fanum.woff2"); font-weight: 300; font-style: normal; font-display: swap; } @font-face { - font-family: "IRANYekanXVF"; - src: url("./fonts/IranYekanX/IRANYekanX-Regular.woff2"); + font-family: "Peyda"; + src: url("./fonts/peyda/400-PeydaWeb-Regular-fanum.woff2"); font-weight: 400; font-style: normal; font-display: swap; } @font-face { - font-family: "IRANYekanXVF"; - src: url("./fonts/IranYekanX/IRANYekanX-Medium.woff2"); + font-family: "Peyda"; + src: url("./fonts/peyda/500-PeydaWeb-Medium-fanum.woff2"); font-weight: 500; font-style: normal; font-display: swap; } @font-face { - font-family: "IRANYekanXVF"; - src: url("./fonts/IranYekanX/IRANYekanX-DemiBold.woff2"); + font-family: "Peyda"; + src: url("./fonts/peyda/600-PeydaWeb-SemiBold-fanum.woff2"); font-weight: 600; font-style: normal; font-display: swap; } @font-face { - font-family: "IRANYekanXVF"; - src: url("./fonts/IranYekanX/IRANYekanX-Bold.woff2"); + font-family: "Peyda"; + src: url("./fonts/peyda/700-PeydaWeb-Bold-fanum.woff2"); font-weight: 700; font-style: normal; font-display: swap; } - @font-face { - font-family: "IRANYekanXVF"; - src: url("./fonts/IranYekanX/IRANYekanX-ExtraBold.woff2"); - font-weight: 800; - font-style: normal; - font-display: swap; - } @font-face { - font-family: "IRANYekanXVF"; - src: url("./fonts/IranYekanX/IRANYekanX-Black.woff2"); + font-family: "Peyda"; + src: url("./fonts/peyda/900-PeydaWeb-Black-fanum.woff2"); font-weight: 900; font-style: normal; font-display: swap; } - @font-face { - font-family: "IRANYekanXVF"; - src: url("./fonts/IranYekanX/IRANYekanX-ExtraBlack.woff2"); - font-weight: 950; - font-style: normal; - font-display: swap; - } - - @font-face { - font-family: "IRANYekanXVF"; - src: url("./fonts/IranYekanX/IRANYekanX-Heavy.woff2"); - font-weight: 1000; - font-style: normal; - font-display: swap; - } } \ No newline at end of file diff --git a/backend/core/static/fonts/peyda/300-PeydaWeb-Light-fanum.woff2 b/backend/core/static/fonts/peyda/300-PeydaWeb-Light-fanum.woff2 new file mode 100644 index 0000000..f5b4ab1 Binary files /dev/null and b/backend/core/static/fonts/peyda/300-PeydaWeb-Light-fanum.woff2 differ diff --git a/backend/core/static/fonts/peyda/400-PeydaWeb-Regular-fanum.woff2 b/backend/core/static/fonts/peyda/400-PeydaWeb-Regular-fanum.woff2 new file mode 100644 index 0000000..8f44c17 Binary files /dev/null and b/backend/core/static/fonts/peyda/400-PeydaWeb-Regular-fanum.woff2 differ diff --git a/backend/core/static/fonts/peyda/500-PeydaWeb-Medium-fanum.woff2 b/backend/core/static/fonts/peyda/500-PeydaWeb-Medium-fanum.woff2 new file mode 100644 index 0000000..386406e Binary files /dev/null and b/backend/core/static/fonts/peyda/500-PeydaWeb-Medium-fanum.woff2 differ diff --git a/backend/core/static/fonts/peyda/600-PeydaWeb-SemiBold-fanum.woff2 b/backend/core/static/fonts/peyda/600-PeydaWeb-SemiBold-fanum.woff2 new file mode 100644 index 0000000..e8d4288 Binary files /dev/null and b/backend/core/static/fonts/peyda/600-PeydaWeb-SemiBold-fanum.woff2 differ diff --git a/backend/core/static/fonts/peyda/700-PeydaWeb-Bold-fanum.woff2 b/backend/core/static/fonts/peyda/700-PeydaWeb-Bold-fanum.woff2 new file mode 100644 index 0000000..39401a4 Binary files /dev/null and b/backend/core/static/fonts/peyda/700-PeydaWeb-Bold-fanum.woff2 differ diff --git a/backend/core/static/fonts/peyda/900-PeydaWeb-Black-fanum.woff2 b/backend/core/static/fonts/peyda/900-PeydaWeb-Black-fanum.woff2 new file mode 100644 index 0000000..ffb7859 Binary files /dev/null and b/backend/core/static/fonts/peyda/900-PeydaWeb-Black-fanum.woff2 differ diff --git a/backend/core/static/fonts_iran_yekan_cashe.css b/backend/core/static/fonts_iran_yekan_cashe.css new file mode 100644 index 0000000..be4ee56 --- /dev/null +++ b/backend/core/static/fonts_iran_yekan_cashe.css @@ -0,0 +1,88 @@ +@layer base { + @font-face { + font-family: "IRANYekanXVF"; + src: url("./fonts/IranYekanX/IRANYekanX-Thin.woff2"); + font-weight: 100; + font-style: normal; + font-display: swap; + } + @font-face { + font-family: "IRANYekanXVF"; + src: url("./fonts/IranYekanX/IRANYekanX-UltraLight.woff2"); + font-weight: 200; + font-style: normal; + font-display: swap; + } + + @font-face { + font-family: "IRANYekanXVF"; + src: url("./fonts/IranYekanX/IRANYekanX-Light.woff2"); + font-weight: 300; + font-style: normal; + font-display: swap; + } + + @font-face { + font-family: "IRANYekanXVF"; + src: url("./fonts/IranYekanX/IRANYekanX-Regular.woff2"); + font-weight: 400; + font-style: normal; + font-display: swap; + } + + @font-face { + font-family: "IRANYekanXVF"; + src: url("./fonts/IranYekanX/IRANYekanX-Medium.woff2"); + font-weight: 500; + font-style: normal; + font-display: swap; + } + + @font-face { + font-family: "IRANYekanXVF"; + src: url("./fonts/IranYekanX/IRANYekanX-DemiBold.woff2"); + font-weight: 600; + font-style: normal; + font-display: swap; + } + + @font-face { + font-family: "IRANYekanXVF"; + src: url("./fonts/IranYekanX/IRANYekanX-Bold.woff2"); + font-weight: 700; + font-style: normal; + font-display: swap; + } + + @font-face { + font-family: "IRANYekanXVF"; + src: url("./fonts/IranYekanX/IRANYekanX-ExtraBold.woff2"); + font-weight: 800; + font-style: normal; + font-display: swap; + } + + @font-face { + font-family: "IRANYekanXVF"; + src: url("./fonts/IranYekanX/IRANYekanX-Black.woff2"); + font-weight: 900; + font-style: normal; + font-display: swap; + } + + @font-face { + font-family: "IRANYekanXVF"; + src: url("./fonts/IranYekanX/IRANYekanX-ExtraBlack.woff2"); + font-weight: 950; + font-style: normal; + font-display: swap; + } + + @font-face { + font-family: "IRANYekanXVF"; + src: url("./fonts/IranYekanX/IRANYekanX-Heavy.woff2"); + font-weight: 1000; + font-style: normal; + font-display: swap; + } +} \ No newline at end of file diff --git a/backend/core/static/override.css b/backend/core/static/override.css index 5b4aa51..1015eac 100644 --- a/backend/core/static/override.css +++ b/backend/core/static/override.css @@ -1,3 +1,3 @@ *:not(span){ - font-family: 'IRANYekanXVF' !important; + font-family: 'Peyda' !important; } \ No newline at end of file diff --git a/backend/order/signals.py b/backend/order/signals.py index 7d53ab5..63cacc1 100644 --- a/backend/order/signals.py +++ b/backend/order/signals.py @@ -1,6 +1,8 @@ from django.db.models.signals import pre_save from django.dispatch import receiver from .models import OrderModel +from account.models import PushSubscription +import ghasedak_sms @receiver(pre_save, sender=OrderModel) def order_status_changed(sender, instance, **kwargs): @@ -9,10 +11,36 @@ def order_status_changed(sender, instance, **kwargs): if previous.status != instance.status: send_change_status_notif(instance) + send_change_status_sms(instance) -def send_change_status_notif(order): - pass + +def send_change_status_notif(instance): + user_subs = PushSubscription.objects.filter(user=instance.user) + for user_sub in user_subs: + try: + user_sub.send_notif(f'سفارش شما به {instance.get_status_display()} تغییر کرد', f'سفارش شما به {instance.get_status_display()} تغییر کرد', ProductImageModel.objects.all().first().image.url) + except: + print('log later send notif error') + + +def send_change_status_sms(instance): + sms_api = ghasedak_sms.Ghasedak(api_key="1227eaaddcba72bcb0169b37032cf16ae9ac6ed8b3b7c2768b74e2ee351d1b52gyRe3AGomZRPTNEd") + + + response = sms_api.send_single_sms( + ghasedak_sms.SendSingleSmsInput( + message=f'سفارش شما به {instance.get_status_display()} تغییر کرد', + receptor=instance.user.phone, + line_number='30005006004095', + client_reference_id=str(instance.user.pk) + ) + ) + if response['statusCode'] == 200: + print('done log later') + else: + print(f'error: {response}') + def update_cart_price_fields(order): pass diff --git a/backend/order/views.py b/backend/order/views.py index 5e32129..4dcab70 100644 --- a/backend/order/views.py +++ b/backend/order/views.py @@ -202,7 +202,7 @@ class PaymentView(APIView): factory = bankfactories.BankFactory() try: bank = ( - factory.create(bank_models.BankType.ZARINPAL) + factory.auto_create() ) bank.set_request(request) bank.set_amount(amount) @@ -220,7 +220,6 @@ class PaymentView(APIView): except AZBankGatewaysException as e: print(e) return Response({'error': str(e)}, status=status.HTTP_400_BAD_REQUEST) - return Response({'gateway_url': bank.redirect_url}, status=status.HTTP_200_OK) diff --git a/backend/product/serializers.py b/backend/product/serializers.py index e5890f8..984b8f0 100644 --- a/backend/product/serializers.py +++ b/backend/product/serializers.py @@ -73,7 +73,7 @@ class ProductVariantSerialzier(serializers.ModelSerializer): return item['quantity'] return 0 - def get_pirce(self, obj): + def get_price(self, obj): return f'{obj.price:,.0f} تومان' diff --git a/frontend/app.vue b/frontend/app.vue index a73cb04..d570ea3 100644 --- a/frontend/app.vue +++ b/frontend/app.vue @@ -35,6 +35,6 @@ const closeModal = () => { /> - + diff --git a/frontend/assets/css/fonts/morabba.css b/frontend/assets/css/fonts/morabba.css index d609e04..914f6ee 100644 --- a/frontend/assets/css/fonts/morabba.css +++ b/frontend/assets/css/fonts/morabba.css @@ -1,7 +1,7 @@ @layer base { @font-face { font-family: "Morabba"; - src: url("/fonts/Morabba/IRANYekanX-UltraLight.woff2"); + src: url("/fonts/Morabba/Morabba-UltraLight.woff2"); font-weight: 200; font-style: normal; font-display: swap; diff --git a/frontend/components/cart/delivery/AddressModal.vue b/frontend/components/cart/delivery/AddressModal.vue index 5b2aff8..c8a33f5 100644 --- a/frontend/components/cart/delivery/AddressModal.vue +++ b/frontend/components/cart/delivery/AddressModal.vue @@ -109,7 +109,7 @@ watch( (newValue) => { if (!isEditing.value) { addressData.value.phone = - newValue == "بله" ? account.value?.phone : ""; + newValue == "بله" ? account.value!.phone : ""; } }, { diff --git a/frontend/components/cart/global/CartSummary.vue b/frontend/components/cart/global/CartSummary.vue index 8ed8a79..fe35394 100644 --- a/frontend/components/cart/global/CartSummary.vue +++ b/frontend/components/cart/global/CartSummary.vue @@ -21,18 +21,17 @@ const discountCode = ref(cart.value?.discount_code?.code || ""); const { mutateAsync: submitDiscountCode, - isPending: submitDiscountCodeIsPending, + isPending: submitDiscountCodeIsPending } = useSubmitDiscountCode(); const { mutateAsync: deleteDiscountCode, - isPending: deleteDiscountCodeIsPending, + isPending: deleteDiscountCodeIsPending } = useDeleteDiscountCode(); // computed -const nextPage: ComputedRef<{ name: string; label: string } | undefined> = - computed(() => route.meta.nextPage); +const nextPage = computed(() => route.meta.nextPage as { name: string; label: string } | undefined); const hasSubmittedDiscountCode = computed(() => !!cart.value?.discount_code); @@ -49,11 +48,11 @@ const handleSubmitDiscountCode = () => { addToast({ message: "خطایی در ثبت کد تخفیف رخ داد", options: { - status: "error", - }, + status: "error" + } }); discountCode.value = ""; - }, + } } ); }; @@ -68,11 +67,11 @@ const handleDeleteDiscountCode = () => { addToast({ message: "خطایی در حذف کد تخفیف رخ داد", options: { - status: "error", - }, + status: "error" + } }); discountCode.value = ""; - }, + } }); }; diff --git a/frontend/components/cart/global/MinimalCartItem.vue b/frontend/components/cart/global/MinimalCartItem.vue index 679f628..b31d185 100644 --- a/frontend/components/cart/global/MinimalCartItem.vue +++ b/frontend/components/cart/global/MinimalCartItem.vue @@ -27,7 +27,7 @@ const { isLoading: cartImageIsLoading } = useImage({ v-if="!cartImageIsLoading" class="size-[3.5rem] shrink-0 rounded-100 border border-gray-300 overflow-hidden" > - product +