many fixes
This commit is contained in:
@@ -457,3 +457,43 @@ class PaymentMethodConfig(models.Model):
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.country_code} - {self.get_payment_method_display()}"
|
||||
|
||||
|
||||
class AccountPaymentMethod(AccountBaseModel):
|
||||
"""
|
||||
Account-scoped payment methods (Stripe/PayPal/manual bank/wallet).
|
||||
Only metadata/refs are stored here; no secrets.
|
||||
"""
|
||||
PAYMENT_METHOD_CHOICES = [
|
||||
('stripe', 'Stripe'),
|
||||
('paypal', 'PayPal'),
|
||||
('bank_transfer', 'Bank Transfer'),
|
||||
('local_wallet', 'Local Wallet'),
|
||||
]
|
||||
|
||||
type = models.CharField(max_length=50, choices=PAYMENT_METHOD_CHOICES, db_index=True)
|
||||
display_name = models.CharField(max_length=100, help_text="User-visible label", default='')
|
||||
is_default = models.BooleanField(default=False, db_index=True)
|
||||
is_enabled = models.BooleanField(default=True, db_index=True)
|
||||
is_verified = models.BooleanField(default=False, db_index=True)
|
||||
country_code = models.CharField(max_length=2, blank=True, default='', help_text="ISO-2 country code (optional)")
|
||||
|
||||
# Manual/bank/local wallet details (non-sensitive metadata)
|
||||
instructions = models.TextField(blank=True, default='')
|
||||
metadata = models.JSONField(default=dict, blank=True, help_text="Provider references or display metadata")
|
||||
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
class Meta:
|
||||
app_label = 'billing'
|
||||
db_table = 'igny8_account_payment_methods'
|
||||
ordering = ['-is_default', 'display_name', 'id']
|
||||
indexes = [
|
||||
models.Index(fields=['account', 'is_default']),
|
||||
models.Index(fields=['account', 'type']),
|
||||
]
|
||||
unique_together = [['account', 'display_name']]
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.account_id} - {self.display_name} ({self.type})"
|
||||
|
||||
Reference in New Issue
Block a user