Major refactor of commerce models: restructured Carrier, Payment, and DiscountCode models, improved order total calculation, and integrated Zasilkovna and Stripe logic. Added new configuration Django app for shop settings, updated Zasilkovna and Stripe models, and fixed Zasilkovna client WSDL URL. Removed unused serializers and views in commerce, and registered new apps in settings.
25 lines
865 B
Python
25 lines
865 B
Python
from django.db import models
|
|
|
|
# Create your models here.
|
|
|
|
#TODO: logika a interakce bude na stripu (třeba aktualizovaní objednávky na zaplacenou apod.)
|
|
|
|
class StripePayment(models.Model):
|
|
STATUS_CHOICES = [
|
|
("pending", "Pending"),
|
|
("paid", "Paid"),
|
|
("failed", "Failed"),
|
|
("cancelled", "Cancelled"),
|
|
]
|
|
|
|
amount = models.DecimalField(max_digits=10, decimal_places=2)
|
|
currency = models.CharField(max_length=10, default="czk")
|
|
status = models.CharField(max_length=20, choices=STATUS_CHOICES, default="pending")
|
|
|
|
stripe_session_id = models.CharField(max_length=255, blank=True, null=True)
|
|
stripe_payment_intent = models.CharField(max_length=255, blank=True, null=True)
|
|
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
|
|
def __str__(self):
|
|
return f"Order {self.id} - {self.status}" |