diff --git a/README.md b/README.md index c4bba2b..a4866cf 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ Support Group - Telegram
YouTube - Watch Video
This MVP project helps to implement payme-pkg. +

@@ -20,18 +21,19 @@ Pay link is a simple interface that provides pay-link functionality. - `/payments/merchant/` includes all merchant methods that tests on Payme Sandbox # Installation -* 1 - clone repo - - ```git clone https://github.com/PayTechUz/payme-sample.git``` -* 2 - create a virtual environment and activate - - ```pip3 install virtualenv``` - - ```virtualenv venv``` - - ```venv\Scripts\activate```(windows) or ```source venv/bin/activate```(unix-based systems) -* 3 - cd into project "cd payme-sample" -* 4 - Install dependencies - - ```pip3 install -r requirements.txt``` -* 5 - Set your environment variables - - ```cp .env-sample .env``` -* 6 - Run tests and app - - ```python3 manage.py test``` - - ```python3 manage.py migrate``` - - ```python3 manage.py runserver``` + +- 1 - clone repo + - `git clone https://github.com/PayTechUz/payme-sample.git` +- 2 - create a virtual environment and activate + - `pip3 install virtualenv` + - `virtualenv venv` + - `venv\Scripts\activate`(windows) or `source venv/bin/activate`(unix-based systems) +- 3 - cd into project "cd payme-sample" +- 4 - Install dependencies + - `pip3 install -r requirements.txt` +- 5 - Set your environment variables + - `cp .env-sample .env` +- 6 - Run tests and app + - `python3 manage.py test` + - `python3 manage.py migrate` + - `python3 manage.py runserver` diff --git a/apps/shop/migrations/0001_initial.py b/apps/shop/migrations/0001_initial.py index bd9030d..19a4c08 100644 --- a/apps/shop/migrations/0001_initial.py +++ b/apps/shop/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 4.2.4 on 2023-08-24 08:20 +# Generated by Django 4.2.4 on 2023-09-09 08:08 from django.db import migrations, models import django.db.models.deletion @@ -13,14 +13,21 @@ class Migration(migrations.Migration): ] operations = [ + migrations.CreateModel( + name='Product', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('image', models.TextField()), + ('items', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='payme.item')), + ], + ), migrations.CreateModel( name='CustomOrderModel', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('created_at', models.DateTimeField(auto_now_add=True)), - ('updated_at', models.DateTimeField(auto_now=True)), - ('amount', models.FloatField(blank=True, null=True)), - ('user_id', models.IntegerField(blank=True, null=True)), + ('full_name', models.CharField(max_length=40)), + ('phone_number', models.CharField(max_length=24)), + ('wants_at', models.DateTimeField(blank=True, null=True)), ('detail', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='payme.orderdetail')), ], options={ diff --git a/apps/shop/migrations/0002_remove_customordermodel_amount_and_more.py b/apps/shop/migrations/0002_remove_customordermodel_amount_and_more.py deleted file mode 100644 index 2cfd817..0000000 --- a/apps/shop/migrations/0002_remove_customordermodel_amount_and_more.py +++ /dev/null @@ -1,25 +0,0 @@ -# Generated by Django 4.2.4 on 2023-08-25 15:46 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('shop', '0001_initial'), - ] - - operations = [ - migrations.RemoveField( - model_name='customordermodel', - name='amount', - ), - migrations.RemoveField( - model_name='customordermodel', - name='created_at', - ), - migrations.RemoveField( - model_name='customordermodel', - name='updated_at', - ), - ] diff --git a/apps/shop/migrations/0003_remove_customordermodel_user_id_and_more.py b/apps/shop/migrations/0003_remove_customordermodel_user_id_and_more.py deleted file mode 100644 index 5357cab..0000000 --- a/apps/shop/migrations/0003_remove_customordermodel_user_id_and_more.py +++ /dev/null @@ -1,26 +0,0 @@ -# Generated by Django 4.2.4 on 2023-08-26 07:15 - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('shop', '0002_remove_customordermodel_amount_and_more'), - ] - - operations = [ - migrations.RemoveField( - model_name='customordermodel', - name='user_id', - ), - migrations.AddField( - model_name='customordermodel', - name='user', - field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), - preserve_default=False, - ), - ] diff --git a/apps/shop/migrations/0004_product.py b/apps/shop/migrations/0004_product.py deleted file mode 100644 index 19c8c7b..0000000 --- a/apps/shop/migrations/0004_product.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 4.2.4 on 2023-08-26 15:36 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('payme', '0003_alter_merchattransactionsmodel_options'), - ('shop', '0003_remove_customordermodel_user_id_and_more'), - ] - - operations = [ - migrations.CreateModel( - name='Product', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('image', models.TextField()), - ('items', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='payme.item')), - ], - ), - ] diff --git a/apps/shop/migrations/0005_remove_customordermodel_user_and_more.py b/apps/shop/migrations/0005_remove_customordermodel_user_and_more.py deleted file mode 100644 index 9521d38..0000000 --- a/apps/shop/migrations/0005_remove_customordermodel_user_and_more.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 4.2.4 on 2023-08-27 03:53 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('shop', '0004_product'), - ] - - operations = [ - migrations.RemoveField( - model_name='customordermodel', - name='user', - ), - migrations.AddField( - model_name='customordermodel', - name='phone_number', - field=models.CharField(default=1, max_length=24), - preserve_default=False, - ), - ] diff --git a/apps/shop/migrations/0006_customordermodel_full_name_customordermodel_product.py b/apps/shop/migrations/0006_customordermodel_full_name_customordermodel_product.py deleted file mode 100644 index 3b452c1..0000000 --- a/apps/shop/migrations/0006_customordermodel_full_name_customordermodel_product.py +++ /dev/null @@ -1,26 +0,0 @@ -# Generated by Django 4.2.4 on 2023-08-27 06:51 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('shop', '0005_remove_customordermodel_user_and_more'), - ] - - operations = [ - migrations.AddField( - model_name='customordermodel', - name='full_name', - field=models.CharField(default=1, max_length=40), - preserve_default=False, - ), - migrations.AddField( - model_name='customordermodel', - name='product', - field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='shop.product'), - preserve_default=False, - ), - ] diff --git a/apps/shop/migrations/0007_remove_customordermodel_product.py b/apps/shop/migrations/0007_remove_customordermodel_product.py deleted file mode 100644 index 56e3c00..0000000 --- a/apps/shop/migrations/0007_remove_customordermodel_product.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 4.2.4 on 2023-08-27 07:01 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('shop', '0006_customordermodel_full_name_customordermodel_product'), - ] - - operations = [ - migrations.RemoveField( - model_name='customordermodel', - name='product', - ), - ] diff --git a/apps/shop/migrations/0008_customordermodel_wants_at.py b/apps/shop/migrations/0008_customordermodel_wants_at.py deleted file mode 100644 index 4903020..0000000 --- a/apps/shop/migrations/0008_customordermodel_wants_at.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.2.4 on 2023-08-27 16:40 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('shop', '0007_remove_customordermodel_product'), - ] - - operations = [ - migrations.AddField( - model_name='customordermodel', - name='wants_at', - field=models.DateTimeField(blank=True, null=True), - ), - ] diff --git a/apps/shop/models.py b/apps/shop/models.py index 77f7505..ca476d0 100644 --- a/apps/shop/models.py +++ b/apps/shop/models.py @@ -9,18 +9,10 @@ class Product(models.Model): image = models.TextField() def __str__(self): - amount = self.items.price / 100 - formatted_number = '{:,}'.format(amount) - return f"{self.items.title} - {formatted_number} UZS" + return self.items.__str__() class CustomOrderModel(BaseOrder): - # user = models.ForeignKey(User, on_delete=models.CASCADE) full_name = models.CharField(max_length=40) phone_number = models.CharField(max_length=24) wants_at = models.DateTimeField(null=True, blank=True) - - def __str__(self): - amount = self.amount / 100 - formatted_number = '{:,}'.format(amount) - return f"ORDER ID: {self.id} - AMOUNT: {formatted_number} UZS" diff --git a/requirements.txt b/requirements.txt index 235f85e..7fc1b55 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ drf-yasg==1.21.5 environs==9.5.0 flake8==6.0.0 -payme-pkg @ git+https://github.com/PayTechUz/payme-pkg@03b86d382954797a75217f15cf52d567f1cb6e84 +payme-pkg @ git+https://github.com/PayTechUz/payme-pkg@b6b5ee01566918a7bee10aa6ff6581f662968364 pip-chill==1.0.1