Created
March 15, 2016 19:15
-
-
Save Verurteilt/28d01e235315d71a86fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from django.db import models | |
import base64 | |
from Simoba.bancos.models import Moneda | |
from django.contrib.auth.models import User | |
class CuentaMercado(models.Model): | |
_client_id = models.TextField() | |
_client_secret = models.TextField() | |
success_url = models.TextField() | |
pending_url = models.TextField() | |
failure_url = models.TextField() | |
cuenta_banco = models.ForeignKey('bancos.CuentaBanco') | |
def get_client_id(self): | |
return self.desencripta_rsa(self._client_id) | |
def set_client_id(self, client_id): | |
self._client_id = base64.encodestring(client_id) | |
client_id = property(get_client_id, set_client_id) | |
def get_client_secret(self): | |
return self.desencripta_rsa(self._client_secret) | |
def set_client_secret(self, client_secret): | |
self._client_secret = base64.encodestring(client_secret) | |
client_secret = property(get_client_secret, set_client_secret) | |
def desencripta_rsa(self, data): | |
from General.utils import desencripta_rsa | |
return desencripta_rsa(base64.decodestring(data)) | |
class Transaction(models.Model): | |
cuenta_mercado = models.ForeignKey(CuentaMercado) | |
id_pago = models.TextField(null=True) | |
extra_info = models.TextField(null=True) | |
pref_id = models.CharField(unique=True, max_length=100, null=True) | |
producto_servicio = models.CharField(max_length=100, null=True) | |
matricula = models.CharField(max_length=100) | |
usuario = models.ForeignKey(User) | |
campus = models.CharField(max_length=100, null=True) | |
nivel = models.CharField(max_length=100, null=True) | |
licenciatura = models.CharField(max_length=100, null=True) | |
site_id = models.CharField(max_length=30, null=True) | |
date_created = models.DateTimeField(auto_now_add=True) | |
date_approved = models.DateTimeField(null=True) | |
last_modified = models.DateTimeField(null=True) | |
collector_id = models.CharField(max_length=10, null=True) | |
payer_id = models.CharField(max_length=30,null=True) | |
payer_email = models.CharField(max_length=100,null=True) | |
payer_firstname = models.CharField(max_length=100,null=True) | |
payer_lastname = models.CharField(max_length=100,null=True) | |
payer_nickname = models.CharField(max_length=100,null=True) | |
order_id = models.CharField(max_length=100,null=True) | |
external_reference = models.CharField(null=True, max_length=50) | |
reason = models.TextField(null=True) | |
transaction_amount = models.DecimalField(max_digits=14,decimal_places = 2,null=True) | |
currency_id = models.CharField(max_length=10,null=True) | |
total_paid_amount = models.DecimalField(max_digits=14,decimal_places = 2,null=True) | |
fee = models.DecimalField(max_digits=14,decimal_places = 2,null=True) | |
shipping_cost = models.DecimalField(max_digits=14,decimal_places = 2,null=True) | |
net_received_amount = models.DecimalField(max_digits=14,decimal_places = 2,null=True) | |
status = models.CharField(max_length=50,null=True) | |
status_detail= models.CharField(max_length=50,null=True) | |
payment_type= models.CharField(max_length=50,null=True) | |
payment_method_id = models.CharField(max_length=50,null=True) | |
installments = models.IntegerField(null=True) | |
money_release_date = models.DateTimeField(null=True) | |
operation_type = models.CharField(max_length=50,null=True) | |
monto_intento_pagar = models.DecimalField(max_digits=14,decimal_places = 2,null=True) | |
exception = models.TextField(null=True) | |
moneda = models.ForeignKey(Moneda) | |
referencia_pago = models.CharField(max_length=100, null=True) | |
periodo = models.CharField(max_length=100, null=True) | |
procesado = models.BooleanField(default=False) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment