paytechuz 0.3.1__py3-none-any.whl → 0.3.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of paytechuz might be problematic. Click here for more details.

paytechuz/__init__.py CHANGED
@@ -5,7 +5,7 @@ This library provides a unified interface for working with Payme, Click, and Atm
5
5
  payment systems in Uzbekistan. It supports Django, Flask, and FastAPI.
6
6
  """
7
7
 
8
- __version__ = '0.3.1'
8
+ __version__ = '0.3.2'
9
9
 
10
10
  # Import framework integrations - these imports are used to check availability
11
11
  # of frameworks, not for direct usage
@@ -73,6 +73,12 @@ class PaymentTransaction(models.Model):
73
73
  self.save()
74
74
  return self
75
75
 
76
+ def mark_as_cancelled_during_init(self, reason):
77
+ self.state = self.CANCELLED_DURING_INIT
78
+ self.cancelled_at = timezone.now()
79
+ self.reason = reason
80
+ self.save()
81
+
76
82
  def mark_as_cancelled(self, reason=None):
77
83
  """
78
84
  Mark the transaction as cancelled.
@@ -434,13 +434,19 @@ class PaymeWebhook(View):
434
434
  f"Transaction {transaction_id} not found"
435
435
  ) from None
436
436
 
437
+ print(transaction.state, reason)
438
+
437
439
  # Check if transaction is already cancelled
438
440
  if transaction.state == PaymentTransaction.CANCELLED:
439
441
  # If transaction is already cancelled, return the existing data
440
442
  return self._cancel_response(transaction)
441
443
 
442
- # Use the mark_as_cancelled method to properly store the reason
443
- transaction.mark_as_cancelled(reason=reason)
444
+ if transaction.state == PaymentTransaction.INITIATING:
445
+ transaction.mark_as_cancelled_during_init(reason=reason)
446
+
447
+ else:
448
+ # Use the mark_as_cancelled method to properly store the reason
449
+ transaction.mark_as_cancelled(reason=reason)
444
450
 
445
451
  # Call the event method
446
452
  self.cancelled_payment(params, transaction)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: paytechuz
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Unified Python package for Uzbekistan payment gateways (Payme, Click, Atmos)
5
5
  Home-page: https://github.com/Muhammadali-Akbarov/paytechuz
6
6
  Author: Muhammadali Akbarov
@@ -1,4 +1,4 @@
1
- paytechuz/__init__.py,sha256=te3Ao8uvuOI6bl9Uq1HsNfmztVZ9c_uvqi3gdODFkEE,1916
1
+ paytechuz/__init__.py,sha256=uWgnlJCeEyLr6Nl54y8yVKo0nzvzjsJ6nfwcc1Kdbx8,1916
2
2
  paytechuz/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  paytechuz/core/base.py,sha256=Es6eEGNgDjQJe-kEJVAHSAh8AWbgtIuQMm0xn7qfjl4,2549
4
4
  paytechuz/core/constants.py,sha256=hzCy5Kc8HVSDhXxNgObbJ2e9SYcXTYL3qky_q0tlpHU,2305
@@ -23,10 +23,10 @@ paytechuz/integrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
23
23
  paytechuz/integrations/django/__init__.py,sha256=fNs4c2IWpCe78-_Yvgz59TdKbHiYRYDkLR33QOBf-Ok,356
24
24
  paytechuz/integrations/django/admin.py,sha256=6fs6GiKcdc-hGlLxJ0BthY7TFo_2RVVJRhQwhxMroCY,2664
25
25
  paytechuz/integrations/django/apps.py,sha256=Q9wG2osL7_Ip2BcAkq7lmmhu4UKJAg6UtSsSq_RgHlc,640
26
- paytechuz/integrations/django/models.py,sha256=EInAti6LZlf7t1kiTSceV-xQZ-hNcVe8qzem2yjOWh4,5742
26
+ paytechuz/integrations/django/models.py,sha256=ze-yzGBYN3sAXFClT6xjEzRN3ihepPVPDcm_qgdvM40,5936
27
27
  paytechuz/integrations/django/signals.py,sha256=VtNYEAnu13wi9PqadEaCU9LY_k2tY26AS4bnPIAqw7M,1319
28
28
  paytechuz/integrations/django/views.py,sha256=KFiuMcr4BtMbzbrW_RbIkv0-Fk214WIWWwaStscArzs,4149
29
- paytechuz/integrations/django/webhooks.py,sha256=j5f4BbOQaFniK26RTQW7KlM90KFOioCUwjBjJQCdkek,36646
29
+ paytechuz/integrations/django/webhooks.py,sha256=7cEDnlFoMIwInjor2ob7qEtgSpzXm1rgbQTobHY3zac,36843
30
30
  paytechuz/integrations/django/migrations/0001_initial.py,sha256=SWHIUuwq91crzaxa9v1UK0kay8CxsjUo6t4bqg7j0Gw,1896
31
31
  paytechuz/integrations/django/migrations/0002_alter_paymenttransaction_gateway.py,sha256=XiZx5urgfhXxra3W_KWksQ1LbaDOs3sjPn4w0T2cW50,457
32
32
  paytechuz/integrations/django/migrations/__init__.py,sha256=KLQ5NdjOMLDS21-u3b_g08G1MjPMMhG95XI_N8m4FSo,41
@@ -34,7 +34,7 @@ paytechuz/integrations/fastapi/__init__.py,sha256=DLnhAZQZf2ghu8BuFFfE7FzbNKWQQ2
34
34
  paytechuz/integrations/fastapi/models.py,sha256=9IqrsndIVuIDwDbijZ89biJxEWQASXRBfWVShxgerAc,5113
35
35
  paytechuz/integrations/fastapi/routes.py,sha256=t8zbqhMZsaJmEvMDgmF-NoRmbqksfX_AvIrx-3kCjg8,37845
36
36
  paytechuz/integrations/fastapi/schemas.py,sha256=PgRqviJiD4-u3_CIkUOX8R7L8Yqn8L44WLte7968G0E,3887
37
- paytechuz-0.3.1.dist-info/METADATA,sha256=5mtAMGPdOCQ9Tophk_QBPcADUCC2Pjtv5wegmPk_5JM,13096
38
- paytechuz-0.3.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
39
- paytechuz-0.3.1.dist-info/top_level.txt,sha256=oloyKGNVj9Z2h3wpKG5yPyTlpdpWW0-CWr-j-asCWBc,10
40
- paytechuz-0.3.1.dist-info/RECORD,,
37
+ paytechuz-0.3.2.dist-info/METADATA,sha256=_FSKa283Yfh2Do-6ypaWsCoePSt0kHTwdmNvQEv4_rQ,13096
38
+ paytechuz-0.3.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
39
+ paytechuz-0.3.2.dist-info/top_level.txt,sha256=oloyKGNVj9Z2h3wpKG5yPyTlpdpWW0-CWr-j-asCWBc,10
40
+ paytechuz-0.3.2.dist-info/RECORD,,