Commit 86a04410 by Owo Sugiana

Tambah Kota Bogor

1 parent bb7b099c
0.4 2021-06-14
--------------
- Tambah Kota Bogor
- Tidak ada lagi tabel terkait ISO8583 karena itu ranah paket
opensipkd-iso8583-bjb.
0.3.4 2021-06-14
----------------
- Parameter default.do_payment() tidak lagi memuat angka bit ISO8583
......
......@@ -15,8 +15,6 @@ from .customer import CustomerMixin
from .perolehan import PerolehanMixin
from .invoice import InvoiceMixin
from .payment import BasePaymentMixin
from .iso_payment import IsoPaymentMixin
from .iso_reversal import IsoReversalMixin
Base = declarative_base()
......@@ -52,12 +50,3 @@ class Invoice(InvoiceMixin, Base):
class Payment(BasePaymentMixin, Base):
pass
class IsoPayment(IsoPaymentMixin, Base):
pass
class IsoReversal(IsoReversalMixin, Base):
__table_args__ = dict(schema=None)
id = Column(Integer, ForeignKey('bphtb_payment.id'), primary_key=True)
......@@ -7,27 +7,25 @@ from .customer import CustomerMixin
from .perolehan import PerolehanMixin
from .invoice import InvoiceMixin
from .payment import PaymentMixin
from .iso_payment import IsoPaymentMixin
from .iso_reversal import IsoReversalMixin
Base = declarative_base()
class Provinsi(ProvinsiMixin, Base):
pass
__table_args__ = dict(schema=None)
class Kabupaten(KabupatenMixin, Base):
pass
__table_args__ = dict(schema=None)
class Kecamatan(KecamatanMixin, Base):
pass
__table_args__ = dict(schema=None)
class Kelurahan(KelurahanMixin, Base):
pass
__table_args__ = dict(schema=None)
class Customer(CustomerMixin, Base):
......@@ -44,11 +42,3 @@ class Invoice(InvoiceMixin, Base):
class Payment(PaymentMixin, Base):
pass
class IsoPayment(IsoPaymentMixin, Base):
__table_args__ = dict(schema='bphtb')
class IsoReversal(IsoReversalMixin, Base):
__table_args__ = dict(schema='bphtb')
......@@ -11,8 +11,6 @@ from .customer import CustomerMixin
from .perolehan import PerolehanMixin
from .invoice import InvoiceMixin
from .payment import PaymentMixin
from .iso_payment import IsoPaymentMixin
from .iso_reversal import IsoReversalMixin
Base = declarative_base()
......@@ -48,11 +46,3 @@ class Invoice(InvoiceMixin, Base):
class Payment(PaymentMixin, Base):
pass
class IsoPayment(IsoPaymentMixin, Base):
pass
class IsoReversal(IsoReversalMixin, Base):
pass
from datetime import datetime
from sqlalchemy import (
Column,
Integer,
DateTime,
String,
Date,
ForeignKey,
)
from sqlalchemy.ext.declarative import declared_attr
class IsoPaymentMixin:
@declared_attr
def __tablename__(self):
return 'bphtb_payment'
@declared_attr
def __table_args__(self):
return dict(schema='bphtb')
@declared_attr
def id(self):
return Column(
Integer, ForeignKey('bphtb.bphtb_bank.id'), primary_key=True)
@declared_attr
def tgl(self):
return Column(
DateTime(timezone=True), nullable=False, default=datetime.now)
@declared_attr
def iso_request(self):
return Column(String(1024), nullable=False)
@declared_attr
def transmission(self):
return Column(DateTime(timezone=True), nullable=False)
@declared_attr
def settlement(self):
return Column(Date, nullable=False)
@declared_attr
def stan(self):
return Column(Integer, nullable=False)
@declared_attr
def invoice_id(self):
return Column(
Integer, ForeignKey('bphtb.bphtb_sspd.id'), nullable=False)
@declared_attr
def invoice_no(self):
return Column(String(32), nullable=False)
@declared_attr
def ntb(self):
return Column(String(32), nullable=False)
@declared_attr
def ntp(self):
return Column(String(32), nullable=False, unique=True)
@declared_attr
def bank_id(self):
return Column(Integer)
@declared_attr
def channel_id(self):
return Column(Integer)
@declared_attr
def bank_ip(self):
return Column(String(15), nullable=False)
from datetime import datetime
from sqlalchemy import (
Column,
Integer,
DateTime,
String,
ForeignKey,
)
from sqlalchemy.ext.declarative import declared_attr
class IsoReversalMixin:
@declared_attr
def __tablename__(self):
return 'bphtb_reversal'
@declared_attr
def __table_args__(self):
return dict(schema='bphtb')
@declared_attr
def id(self):
return Column(
Integer, ForeignKey('bphtb.bphtb_payment.id'), primary_key=True)
@declared_attr
def tgl(self):
return Column(DateTime(
timezone=True), nullable=False, default=datetime.now)
@declared_attr
def iso_request(self):
return Column(String(1024), nullable=False)
......@@ -7,8 +7,6 @@ from .customer import CustomerMixin
from .perolehan import PerolehanMixin
from .invoice import InvoiceMixin
from .payment import PaymentMixin
from .iso_payment import IsoPaymentMixin
from .iso_reversal import IsoReversalMixin
Base = declarative_base()
......@@ -44,11 +42,3 @@ class Invoice(InvoiceMixin, Base):
class Payment(PaymentMixin, Base):
pass
class IsoPayment(IsoPaymentMixin, Base):
__table_args__ = dict(schema='bphtb')
class IsoReversal(IsoReversalMixin, Base):
pass
......@@ -8,8 +8,6 @@ from .customer import CustomerMixin
from .perolehan import PerolehanMixin
from .invoice import InvoiceMixin
from .payment import PaymentMixin
from .iso_payment import IsoPaymentMixin
from .iso_reversal import IsoReversalMixin
Base = declarative_base()
......@@ -54,11 +52,3 @@ class Invoice(InvoiceMixin, Base):
class Payment(PaymentMixin, Base):
pass
class IsoPayment(IsoPaymentMixin, Base):
pass
class IsoReversal(IsoReversalMixin, Base):
pass
from datetime import (
date,
datetime,
)
from sqlalchemy import func
from opensipkd.hitung import (
hitung_denda,
round_up,
)
from opensipkd.string import FixLength
from ..default import (
Inquiry as BaseInquiry,
Reversal as BaseReversal,
AvailableInvoice as BaseAvailableInvoice,
)
from opensipkd.bphtb.models.bogor_kota import (
Invoice,
Payment,
Customer,
Kecamatan,
Kelurahan,
)
from .structure import (
INVOICE_ID,
INVOICE_ID_LENGTH,
)
class Inquiry(BaseInquiry):
kecamatan_model = Kecamatan
kelurahan_model = Kelurahan
invoice_model = Invoice
payment_model = Payment
customer_model = Customer
invoice_id_structure = INVOICE_ID
invoice_id_length = INVOICE_ID_LENGTH
class Reversal(BaseReversal):
invoice_id_structure = INVOICE_ID
invoice_id_length = INVOICE_ID_LENGTH
class AvailableInvoice(BaseAvailableInvoice):
inquiry_cls = Inquiry
invoice_id_structure = INVOICE_ID
INVOICE_ID = [
['Tahun', 4, 'N'],
['SSPD No', 6, 'N'],
['Kode', 2, 'N'],
]
INVOICE_ID_LENGTH = 0
for nama, size, tipe in INVOICE_ID:
INVOICE_ID_LENGTH += size
# Ini adalah komponen Kode pada Invoice ID tergolong kurang bayar
KODE_KURANG_BAYAR = ['2', '4']
......@@ -2,7 +2,6 @@
from datetime import (
date,
datetime,
time,
)
from sqlalchemy import func
from opensipkd.hitung import (
......@@ -36,13 +35,15 @@ class Common:
invoice_model = Invoice
payment_model = Payment
customer_model = Customer
invoice_id_structure = INVOICE_ID
invoice_id_length = INVOICE_ID_LENGTH
def __init__(self, invoice_id):
self.invoice_id = invoice_id
self.invoice = None
if len(invoice_id) != INVOICE_ID_LENGTH:
if len(invoice_id) != self.invoice_id_length:
return
self.invoice_struct = FixLength(INVOICE_ID)
self.invoice_struct = FixLength(self.invoice_id_structure)
self.invoice_struct.set_raw(invoice_id)
self.tahun = self.invoice_struct['Tahun']
self.tahun = int(self.tahun)
......@@ -116,7 +117,7 @@ class Inquiry(Common):
self.total = self.tagihan + self.denda - self.discount
def hitung_denda(self):
if self.kode not in KODE_KURANG_BAYAR:
if self.kode in KODE_KURANG_BAYAR:
return
if isinstance(self.tgl_bayar, datetime):
tgl_bayar = self.tgl_bayar.date()
......@@ -309,6 +310,7 @@ class Reversal(Common):
class AvailableInvoice(BaseAvailableInvoice):
invoice_model = Invoice
inquiry_cls = Inquiry
invoice_id_structure = INVOICE_ID
def get_query(self):
db_session = get_db_session()
......@@ -327,7 +329,7 @@ class AvailableInvoice(BaseAvailableInvoice):
return q.order_by(self.invoice_model.id.desc())
def get_message(self, row):
invoice_id_struct = FixLength(INVOICE_ID)
invoice_id_struct = FixLength(self.invoice_id_structure)
invoice_id_struct['Tahun'] = row.tahun
invoice_id_struct['Kode'] = row.kode.zfill(2)
invoice_id_struct['SSPD No'] = row.no_sspd
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!