class ObuCustomer(db_pylang.Model): __tablename__ = "m_obu_customer" id = db_pylang.Column(db_pylang.BIGINT, primary_key=True, nullable=False, autoincrement=True) customer_id = db_pylang.Column(db_pylang.BIGINT, db_pylang.ForeignKey('m_customer.id'), nullable=False) obu_id = db_pylang.Column(db_pylang.BIGINT, db_pylang.ForeignKey('m_obu.id'), nullable=False) sequence = db_pylang.Column(db_pylang.Integer, nullable=False) status = db_pylang.Column(db_pylang.Enum(Status), nullable=False) created_datetime = db_pylang.Column( db_pylang.DateTime(timezone=True), server_default=db_pylang.func.now(), nullable=False ) # db_pylang.func.now => will be using the db_pylang.DateTime from server updated_datetime = db_pylang.Column( db_pylang.DateTime(timezone=True), server_default=db_pylang.func.now(), onupdate=db_pylang.func.now(), nullable=False ) # will be updated everytime there is update to this table obu = db_pylang.relationship(Obu, lazy='joined') def __init__(self, obu, sequence, status): self.obu = obu self.sequence = sequence self.status = status
class TransactionSummary(db_pylang.Model): __tablename__ = 'r_trans_summary_h' id = db_pylang.Column(db_pylang.BIGINT, primary_key=True, autoincrement=True) wallet_customer_id = db_pylang.Column( db_pylang.BIGINT, db_pylang.ForeignKey('m_wallet_customer.id')) transaction_type_id = db_pylang.Column( db_pylang.BIGINT, db_pylang.ForeignKey('m_transaction_type.id')) transaction_datetime = db_pylang.Column(db_pylang.DateTime(timezone=True), nullable=False) transaction_location = db_pylang.Column(db_pylang.String, nullable=False) transaction_amount = db_pylang.Column(db_pylang.Numeric, nullable=False) total_fee = db_pylang.Column(db_pylang.Numeric, nullable=False) total_amount = db_pylang.Column(db_pylang.Numeric, nullable=False) trans_recon_flag = db_pylang.Column(Enum(ReconFlag), nullable=False) trace_number = db_pylang.Column(db_pylang.String, nullable=False) created_datetime = db_pylang.Column( db_pylang.DateTime(timezone=True), server_default=db_pylang.func.now(), nullable=False ) # db_pylang.func.now => will be using the db_pylang.DateTime from server updated_datetime = db_pylang.Column( db_pylang.DateTime(timezone=True), server_default=db_pylang.func.now(), onupdate=db_pylang.func.now(), nullable=False ) # will be updated everytime there is update to this table transaction_type = relationship("TransactionType", backref=backref("r_trans_summary_h")) wallet_customer = relationship("WalletCustomer", backref=backref("r_trans_summary_h")) def __init__(self, transaction_type, transaction_datetime, transaction_location, transaction_amount, total_fee, total_amount, trans_recon_flag, trace_number, wallet_customer): self.transaction_type = transaction_type self.transaction_datetime = transaction_datetime self.transaction_location = transaction_location self.transaction_amount = transaction_amount self.total_fee = total_fee self.total_amount = total_amount self.trans_recon_flag = trans_recon_flag self.trace_number = trace_number self.wallet_customer = wallet_customer
class WalletCustomer(db_pylang.Model): __tablename__ = "m_wallet_customer" id = db_pylang.Column(db_pylang.BIGINT, primary_key=True, autoincrement=True) customer_id = db_pylang.Column(db_pylang.BIGINT, db_pylang.ForeignKey('m_customer.id'), nullable=False) wallet_id = db_pylang.Column(db_pylang.BIGINT, db_pylang.ForeignKey('m_wallet.id'), nullable=False) sequence = db_pylang.Column(db_pylang.Integer, nullable=False) issuer_code = db_pylang.Column(db_pylang.String, nullable=False) account_no_cid = db_pylang.Column(db_pylang.String, nullable=False) account_type = db_pylang.Column(db_pylang.String, nullable=False) status = db_pylang.Column(db_pylang.Enum(Status), nullable=False, default=Status.ACTIVE) default_sof_flag = db_pylang.Column(db_pylang.Enum(SOF), nullable=False, default=SOF.NOT_DEFAULT) balance = db_pylang.Column(db_pylang.Numeric, nullable=False) created_datetime = db_pylang.Column( db_pylang.DateTime(timezone=True), server_default=db_pylang.func.now(), nullable=False ) # db_pylang.func.now => will be using the db_pylang.DateTime from server updated_datetime = db_pylang.Column( db_pylang.DateTime(timezone=True), server_default=db_pylang.func.now(), onupdate=db_pylang.func.now(), nullable=False ) # will be updated everytime there is update to this table wallet = db_pylang.relationship(Wallet, lazy='joined') def __init__(self, wallet, sequence, issuer_code, account_no_cid, account_type, status, default_sof_flag, balance): self.wallet = wallet self.sequence = sequence self.issuer_code = issuer_code self.account_no_cid = account_no_cid self.account_type = account_type self.status = status self.default_sof_flag = default_sof_flag self.balance = balance
class OrganizationCommunication(db_pylang.Model): __tablename__ = "m_org_communication" id = db_pylang.Column(db_pylang.BIGINT, primary_key=True, autoincrement=True) organization_id = db_pylang.Column( db_pylang.BIGINT, db_pylang.ForeignKey('m_organization.id'), nullable=False) drc_ip_address = db_pylang.Column(db_pylang.String, nullable=False) prod_ip_address = db_pylang.Column(db_pylang.String, nullable=False) communication_method = db_pylang.Column(db_pylang.String, nullable=False) source_method = db_pylang.Column(db_pylang.String, nullable=False) cryptographic_type = db_pylang.Column(db_pylang.String, nullable=False) secret_key = db_pylang.Column(db_pylang.String, nullable=False) public_key = db_pylang.Column(db_pylang.String, nullable=False) ssl_certificate = db_pylang.Column(db_pylang.String, nullable=False) default_flag = db_pylang.Column(Enum(DefaultFlag), nullable=False) created_datetime = db_pylang.Column( db_pylang.DateTime(timezone=True), server_default=db_pylang.func.now(), nullable=False ) # db_pylang.func.now => will be using the db_pylang.DateTime from server updated_datetime = db_pylang.Column( db_pylang.DateTime(timezone=True), server_default=db_pylang.func.now(), onupdate=db_pylang.func.now(), nullable=False ) # will be updated everytime there is update to this table organization = relationship("Organization", backref=backref("m_org_communication", uselist=False)) def __init__(self, organization, drc_ip_address, prod_ip_address, communication_method, source_method, cryptographic_type, secret_key, public_key, ssl_certificate, default_flag): self.organization = organization self.drc_ip_address = drc_ip_address, self.prod_ip_address = prod_ip_address self.communication_method = communication_method self.source_method = source_method self.cryptographic_type = cryptographic_type self.secret_key = secret_key self.public_key = public_key self.ssl_certificate = ssl_certificate self.default_flag = default_flag
class TransactionType(db_pylang.Model): __tablename__ = "m_transaction_type" id = db_pylang.Column(db_pylang.BIGINT, primary_key=True, autoincrement=True) organization_id = db_pylang.Column( db_pylang.BIGINT, db_pylang.ForeignKey('m_organization.id'), nullable=False) fee_schema_id = db_pylang.Column(db_pylang.BIGINT, nullable=False) sequence = db_pylang.Column(db_pylang.Integer, nullable=False) trx_name = db_pylang.Column(db_pylang.String, nullable=False) recon_schedule_id = db_pylang.Column(db_pylang.BIGINT, nullable=False) settlement_id = db_pylang.Column(db_pylang.BIGINT, nullable=False) created_datetime = db_pylang.Column( db_pylang.DateTime(timezone=True), server_default=db_pylang.func.now(), nullable=False ) # db_pylang.func.now => will be using the db_pylang.DateTime from server updated_datetime = db_pylang.Column( db_pylang.DateTime(timezone=True), server_default=db_pylang.func.now(), onupdate=db_pylang.func.now(), nullable=False ) # will be updated everytime there is update to this table organization = relationship("Organization", backref=backref("m_transaction_type", uselist=False)) def __init__(self, organization, fee_schema_id, sequence, trx_name, recon_schedule_id, settlement_id): self.organization = organization self.fee_schema_id = fee_schema_id self.sequence = sequence self.trx_name = trx_name self.recon_schedule_id = recon_schedule_id self.settlement_id = settlement_id