Commit 95c13e13 by taufikyu

perbaikan qris, va model

1 parent af0493f2
......@@ -131,7 +131,9 @@ class BJBQRIS(KodeModel, Base):
cek = cek_parameter(parameter)
if not cek:
return False
expdate = datetime_from_str(values['expired_date'])
if expdate > datetime.combine(date.today(),time(20,59,59)):
expdate = ymdhms(datetime.combine(date.today(),time(20,59,59)))
data = dict(
client_type = values['client_type'],
invoice_no = str(values['invoice_no']),
......@@ -154,6 +156,34 @@ class BJBQRIS(KodeModel, Base):
pass
saved = cls.save(datava)
return saved
@classmethod
def cancel_qris(cls, values, parameter):
cek = cek_parameter(parameter)
if not cek:
return False
row = cls.query().filter(cls.invoice_no==values['invoice_no'],cls.status=='0').all()
qrisnum = [r.va_number for r in row]
data = dict(
va_number = values['va_number'],
client_type = values['client_type'],
invoice_no = values['invoice_no'],
product_code = values['product_code'],
description = values['description'],
customer_name = values['customer_name'],
customer_email = values['customer_email'],
customer_phone = values['customer_phone'],
amount = str(values['amount']),
va_type = 'q'
)
datava = send_rpc(parameter, 'cancel', data)
if not datava:
return False
datava['status'] = '4'
saved = DBSession.query(cls).filter(cls.va_number.in_(qrisnum)).\
update({cls.status: '4'}, synchronize_session='fetch')
return saved
def send_rpc(parameter, method, data):
headers = json_rpc_header(parameter['bjbqris_user'],parameter['bjbqris_key'])
......
......@@ -118,7 +118,9 @@ class BJBVA(KodeModel, Base):
cek = cek_parameter(parameter)
if not cek:
return False
expdate = datetime_from_str(values['expired_date'])
if expdate > datetime.combine(date.today(),time(20,59,59)):
expdate = ymdhms(datetime.combine(date.today(),time(20,59,59)))
data = dict(
client_type = values['client_type'],
invoice_no = values['invoice_no'],
......@@ -150,6 +152,9 @@ class BJBVA(KodeModel, Base):
if 'expired_date' in values and isinstance(values['expired_date'], datetime):
values['expired_date'] = ymdhms(values['expired_date'])
expdate = datetime_from_str(values['expired_date'])
if expdate > datetime.combine(date.today(),time(20,59,59)):
expdate = ymdhms(datetime.combine(date.today(),time(20,59,59)))
data = dict(
va_number = values['va_number'],
invoice_no = values['invoice_no'],
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!