From 16d1b3c954d754557d6f587e219c181555e8b99a Mon Sep 17 00:00:00 2001 From: Pablo Moreno Date: Mon, 23 Mar 2026 13:25:56 +0100 Subject: [PATCH] fix: minor adjustments --- ...ter_shopsettings_shared_secret_and_more.py | 23 +++++++++++++++++ shop/models.py | 13 +++++++--- uv.lock | 25 +++++++------------ 3 files changed, 42 insertions(+), 19 deletions(-) create mode 100644 shop/migrations/0004_alter_shopsettings_shared_secret_and_more.py diff --git a/shop/migrations/0004_alter_shopsettings_shared_secret_and_more.py b/shop/migrations/0004_alter_shopsettings_shared_secret_and_more.py new file mode 100644 index 0000000..96ccffa --- /dev/null +++ b/shop/migrations/0004_alter_shopsettings_shared_secret_and_more.py @@ -0,0 +1,23 @@ +# Generated by Django 6.0.2 on 2026-03-23 12:22 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('shop', '0003_alter_productimage_options'), + ] + + operations = [ + migrations.AlterField( + model_name='shopsettings', + name='shared_secret', + field=models.CharField(max_length=100, verbose_name='clave de Redsys'), + ), + migrations.AlterField( + model_name='shopsettings', + name='terminal', + field=models.CharField(max_length=8, verbose_name='terminal'), + ), + ] diff --git a/shop/models.py b/shop/models.py index a1cb03a..9f85a05 100644 --- a/shop/models.py +++ b/shop/models.py @@ -310,7 +310,11 @@ class OrderLine(TimestampedModel): def create_order_code(*args, **kwargs): - return timezone.now().isoformat().replace('-', '').replace('T', '').replace(':', '').replace('.', '')[:-5] + return timezone.now().isoformat()\ + .replace('-', '')\ + .replace('T', '')\ + .replace(':', '')\ + .replace('.', '')[:-5] class Order(TimestampedModel): @@ -318,6 +322,7 @@ class Order(TimestampedModel): STATUS_PENDING = 'PEN', _('pendiente de pago') STATUS_PAID = 'PAI', _('pagado') STATUS_RETURNED = 'RTN', _('devuelto') + STATUS_RETURNED_PARTIAL = 'PRT', _('devuelto parcialmente') STATUS_ERROR = 'ERR', _('Error') class ShippingStatuses(models.TextChoices): @@ -516,6 +521,8 @@ class Payment(models.Model): class ShopSettings(SingletonModel): debug = models.BooleanField(default=True, verbose_name=_('Modo depuración')) + + # Redsys merchant_code = models.CharField( max_length=9, blank=False, @@ -528,8 +535,8 @@ class ShopSettings(SingletonModel): choices=CURRENCY_CODES, verbose_name=_('Código de moneda'), ) # 978 == EURO - terminal = models.CharField(max_length=8, verbose_name=_('Terminal')) - shared_secret = models.CharField(max_length=100, verbose_name=_('Clave de Redsys')) + terminal = models.CharField(max_length=8, verbose_name=_('terminal')) + shared_secret = models.CharField(max_length=100, verbose_name=_('clave de Redsys')) tpv_domain = models.URLField(max_length=128, blank=True, null=True, verbose_name=_('dominio del tpv')) class Meta: diff --git a/uv.lock b/uv.lock index adbc384..74da4ac 100644 --- a/uv.lock +++ b/uv.lock @@ -768,22 +768,15 @@ wheels = [ ] [[package]] -name = "psycopg2-binary" -version = "2.9.10" +name = "psycopg" +version = "3.3.3" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/cb/0e/bdc8274dc0585090b4e3432267d7be4dfbfd8971c0fa59167c711105a6bf/psycopg2-binary-2.9.10.tar.gz", hash = "sha256:4b3df0e6990aa98acda57d983942eff13d824135fe2250e6522edaa782a06de2", size = 385764 } +dependencies = [ + { name = "tzdata", marker = "sys_platform == 'win32'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/d3/b6/379d0a960f8f435ec78720462fd94c4863e7a31237cf81bf76d0af5883bf/psycopg-3.3.3.tar.gz", hash = "sha256:5e9a47458b3c1583326513b2556a2a9473a1001a56c9efe9e587245b43148dd9", size = 165624 } wheels = [ - { url = "https://files.pythonhosted.org/packages/3e/30/d41d3ba765609c0763505d565c4d12d8f3c79793f0d0f044ff5a28bf395b/psycopg2_binary-2.9.10-cp313-cp313-macosx_12_0_x86_64.whl", hash = "sha256:26540d4a9a4e2b096f1ff9cce51253d0504dca5a85872c7f7be23be5a53eb18d", size = 3044699 }, - { url = "https://files.pythonhosted.org/packages/35/44/257ddadec7ef04536ba71af6bc6a75ec05c5343004a7ec93006bee66c0bc/psycopg2_binary-2.9.10-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:e217ce4d37667df0bc1c397fdcd8de5e81018ef305aed9415c3b093faaeb10fb", size = 3275245 }, - { url = "https://files.pythonhosted.org/packages/1b/11/48ea1cd11de67f9efd7262085588790a95d9dfcd9b8a687d46caf7305c1a/psycopg2_binary-2.9.10-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:245159e7ab20a71d989da00f280ca57da7641fa2cdcf71749c193cea540a74f7", size = 2851631 }, - { url = "https://files.pythonhosted.org/packages/62/e0/62ce5ee650e6c86719d621a761fe4bc846ab9eff8c1f12b1ed5741bf1c9b/psycopg2_binary-2.9.10-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3c4ded1a24b20021ebe677b7b08ad10bf09aac197d6943bfe6fec70ac4e4690d", size = 3082140 }, - { url = "https://files.pythonhosted.org/packages/27/ce/63f946c098611f7be234c0dd7cb1ad68b0b5744d34f68062bb3c5aa510c8/psycopg2_binary-2.9.10-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3abb691ff9e57d4a93355f60d4f4c1dd2d68326c968e7db17ea96df3c023ef73", size = 3264762 }, - { url = "https://files.pythonhosted.org/packages/43/25/c603cd81402e69edf7daa59b1602bd41eb9859e2824b8c0855d748366ac9/psycopg2_binary-2.9.10-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8608c078134f0b3cbd9f89b34bd60a943b23fd33cc5f065e8d5f840061bd0673", size = 3020967 }, - { url = "https://files.pythonhosted.org/packages/5f/d6/8708d8c6fca531057fa170cdde8df870e8b6a9b136e82b361c65e42b841e/psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:230eeae2d71594103cd5b93fd29d1ace6420d0b86f4778739cb1a5a32f607d1f", size = 2872326 }, - { url = "https://files.pythonhosted.org/packages/ce/ac/5b1ea50fc08a9df82de7e1771537557f07c2632231bbab652c7e22597908/psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:bb89f0a835bcfc1d42ccd5f41f04870c1b936d8507c6df12b7737febc40f0909", size = 2822712 }, - { url = "https://files.pythonhosted.org/packages/c4/fc/504d4503b2abc4570fac3ca56eb8fed5e437bf9c9ef13f36b6621db8ef00/psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:f0c2d907a1e102526dd2986df638343388b94c33860ff3bbe1384130828714b1", size = 2920155 }, - { url = "https://files.pythonhosted.org/packages/b2/d1/323581e9273ad2c0dbd1902f3fb50c441da86e894b6e25a73c3fda32c57e/psycopg2_binary-2.9.10-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:f8157bed2f51db683f31306aa497311b560f2265998122abe1dce6428bd86567", size = 2959356 }, - { url = "https://files.pythonhosted.org/packages/08/50/d13ea0a054189ae1bc21af1d85b6f8bb9bbc5572991055d70ad9006fe2d6/psycopg2_binary-2.9.10-cp313-cp313-win_amd64.whl", hash = "sha256:27422aa5f11fbcd9b18da48373eb67081243662f9b46e6fd07c3eb46e4535142", size = 2569224 }, + { url = "https://files.pythonhosted.org/packages/c8/5b/181e2e3becb7672b502f0ed7f16ed7352aca7c109cfb94cf3878a9186db9/psycopg-3.3.3-py3-none-any.whl", hash = "sha256:f96525a72bcfade6584ab17e89de415ff360748c766f0106959144dcbb38c698", size = 212768 }, ] [[package]] @@ -966,7 +959,7 @@ dependencies = [ { name = "gonk" }, { name = "ipython" }, { name = "pillow" }, - { name = "psycopg2-binary" }, + { name = "psycopg" }, { name = "pydes" }, { name = "pytailwindcss" }, { name = "redis" }, @@ -1006,7 +999,7 @@ requires-dist = [ { name = "gonk", specifier = "==0.6.1" }, { name = "ipython", specifier = "==8.16.1" }, { name = "pillow", specifier = "==11.0.0" }, - { name = "psycopg2-binary", specifier = "==2.9.10" }, + { name = "psycopg", specifier = "==3.3.3" }, { name = "pydes", specifier = "==2.0.1" }, { name = "pytailwindcss", specifier = "==0.2.0" }, { name = "redis", specifier = "==4.5.4" },