コード例 #1
0
def cekSesiSemester(tipesemester, npm):
    tahunangkatan=int(kelas.getTahunAngkatanWithStudentID(npm))
    tahunsekarang=int(datetime.now().strftime('%Y'))
    selisihtahun=tahunsekarang-tahunangkatan
    if tipesemester == '1':
        selisihtahun+=0.5
        sesisemester=selisihtahun/0.5
    else:
        selisihtahun+=1
        sesisemester=selisihtahun/0.5
    return str(sesisemester)
コード例 #2
0
def replymsg(driver, data):
    npm, nama = kelas.getNpmandNameMahasiswa(data[0])
    datava = getDataPayment(npm)
    if datava:
        datenow = datetime.date(datetime.now()).strftime('%d-%m-%Y')
        yearnow = datetime.date(datetime.now()).strftime('%Y')
        trxid = datava['trx_id']
        npm = app.cekNpmInTrxID(trxid)
        tipesemester = app.cekTipeSemester(trxid)
        tahunid = f'{yearnow}{tipesemester}'
        prodiid = f'{npm[0]}{npm[3]}'
        virtual_account = datava['virtual_account']
        customer_name = datava['customer_name']
        trx_amount = datava['trx_amount']
        payment_amount = datava['payment_amount']
        cumulative_payment_amount = datava['cumulative_payment_amount']
        payment_ntb = datava['payment_ntb']
        datetime_payment = datava['datetime_payment']
        datetime_payment_iso8601 = datava['datetime_payment_iso8601']
        ws = app.openfile().active
        prodi_singkatan = app.getProdiSingkatanFromProdiID(
            kelas.getProdiIDwithStudentID(npm)).lower()
        tingkat = f"tk{int(datetime.now().strftime('%Y')) - int(kelas.getTahunAngkatanWithStudentID(npm)) + 1}"
        angkatan = kelas.getTahunAngkatanWithStudentID(npm)
        key = f'{prodi_singkatan}{tingkat}{angkatan}'
        default_amount_payment = app.getDataDefault(key, ws)
        message = f'Hai haiiiii kamu sudah transfer pembayaran semester yaaaa dengan\n\n*NPM: {npm}*\n*Nama: {customer_name}*\n*Virtual Account: {virtual_account}*\n*Tanggal: {datetime_payment}*\n*Jumlah Transfer: {app.floatToRupiah(payment_amount)}*\n*Total Sudah Bayar: {app.floatToRupiah(cumulative_payment_amount)}*\n*Total Harus Bayar: {app.floatToRupiah(trx_amount)}*\n*Sisa Yang Harus Dibayar: {app.floatToRupiah(float(int(trx_amount)-int(cumulative_payment_amount)))}*'
        if int(trx_amount) > int(default_amount_payment):
            amount_tunggakan = int(trx_amount) - int(default_amount_payment)
            fifty_percent_default_payment = int(default_amount_payment) / 2
            minimum_payment = int(amount_tunggakan) + int(
                fifty_percent_default_payment)
        else:
            minimum_payment = int(trx_amount) / 2
        app.openfile().close()
        if float(cumulative_payment_amount) >= float(minimum_payment):
            if app.cekSudahAdaKHS(npm, tahunid, 'A'):
                app.updateBiayaKHS(npm, tahunid,
                                   trx_amount - cumulative_payment_amount)
                message += f'\n\nterima kasih yaaa sudah bayar semester, semangat kuliahnya kakaaaa......'
            else:
                message += f'\n\nKamu *sudah bisa* isi KRS yaaa coba cek di *SIAP* yaaa...., #BOTNAME# ucapkan terima kasihhhh dan jangan salah saat isi KRS yaaa....'
                message = message.replace('#BOTNAME#', config.bot_name)
                app.insertnewKHS(npm, tahunid, prodiid,
                                 app.cekSesiSemester(tipesemester, npm),
                                 trx_amount - cumulative_payment_amount)
        else:
            message += f'\n\nYahhhh kamu *belum bisa* isi KRS nihhhh coba *buat surat* lalu *ajukan ke pihak BAUK* agar kamu bisa isi KRS..... Suratnya udah {config.bot_name} kirim ke *{kelas.getStudentEmail(npm)}*'
            surat_va.makePdfAndSendToEmail(npm)
        msgreply = message
    else:
        msgreply = 'kamu belum ada transfer'
    return msgreply
コード例 #3
0
def paymentSpp(npm):
    prodi_singkatan = app.getProdiSingkatanFromProdiID(kelas.getProdiIDwithStudentID(npm)).lower()
    tingkat = f"tk{int(kelas.getTahunID()[:-1]) - int(kelas.getTahunAngkatanWithStudentID(npm)) + 1}"
    angkatan = kelas.getTahunAngkatanWithStudentID(npm)
    payment_spp = getSPP(npm)
    if angkatan == '2020':
        return f'*DATA VIRTUAL ACCOUNT BNI SPP (Semester Ganjil 2020/2021)*\n\n' \
                   f'*Kode Transaksi: {payment_spp["trx_id"]}*\n' \
                   f'*Virtual Account: {payment_spp["virtual_account"]}*\n' \
                   f'Status Virtual Account: Aktif\n' \
                   f'Customer Name: {payment_spp["customer_name"]}\n' \
                   f'Customer Email: {payment_spp["customer_email"]}\n' \
                   f'Customer Phone Number: {payment_spp["customer_phone"]}\n' \
                   f'Jumlah Tagihan: {app.floatToRupiah(float(payment_spp["trx_amount"]))}\n'
    key = f'{prodi_singkatan}{tingkat}{angkatan}'
    ws = app.openfile().active
    biaya_pokok_spp = app.getDataDefault(key, ws)
    app.openfile().close()
    try:
        if biaya_pokok_spp:
            biaya_pokok_spp=int(biaya_pokok_spp)
        else:
            if prodi_singkatan[:2] == 'd4':
                biaya_pokok_spp = 2500000
            elif prodi_singkatan[:2] == 'd3':
                biaya_pokok_spp = 2000000
            else:
                biaya_pokok_spp = int(biaya_pokok_spp)
        if int(payment_spp['trx_amount']) > int(biaya_pokok_spp):
            tunggakan = float(int(payment_spp['trx_amount']) - int(biaya_pokok_spp))
            amount_tunggakan = int(payment_spp["trx_amount"]) - int(biaya_pokok_spp)
            fifty_percent_default_payment = int(biaya_pokok_spp) * (75/100)
            minimum_payment = int(amount_tunggakan) + int(fifty_percent_default_payment)
        else:
            tunggakan = float(0)
            potongan = int(biaya_pokok_spp) - int(payment_spp['trx_amount'])
            minimum_payment = (int(biaya_pokok_spp) - int(potongan)) * (75/100)
        if datetime.now() < payment_spp['expired_date']:
            msgreply = f'*DATA VIRTUAL ACCOUNT BNI SPP (Semester Genap 2020/2021)*\n\n' \
                       f'*Kode Transaksi: {payment_spp["trx_id"]}*\n' \
                       f'*Virtual Account: {payment_spp["virtual_account"]}*\n' \
                       f'Status Virtual Account: Aktif\n' \
                       f'Customer Name: {payment_spp["customer_name"]}\n' \
                       f'Customer Email: {payment_spp["customer_email"]}\n' \
                       f'Customer Phone Number: {payment_spp["customer_phone"]}\n' \
                       f'Biaya Paket SPP Per Semester: {app.floatToRupiah(float(biaya_pokok_spp))}\n' \
                       f'Biaya Tunggakan SPP: {app.floatToRupiah(tunggakan)}\n' \
                       f'Jumlah Tagihan: {app.floatToRupiah(float(payment_spp["trx_amount"]))}\n'
        else:
            msgreply = f'*DATA SPP TIDAK ADA*\n\n'
    except Exception as error:
        msgreply = f'Nomor Hp kamu Benerin dulu dongggg yang bener baru {config.bot_name} kasih liat datanya....\nATAU\nData kamu belum diupload..\n\n'
    return msgreply
コード例 #4
0
def replymsg(driver, data):
    npm, nama_mahasiswa, prodi_id, phonenumber, email, penasehat_akademik = getDataMahasiswa(
        data[0])
    virtual_account, customer_name, customer_email, customer_phone, trx_amount = getDataVaforMahasiswa(
        data[0])
    ws = app.openfile().active
    prodi_singkatan = app.getProdiSingkatanFromProdiID(
        kelas.getProdiIDwithStudentID(npm)).lower()
    tingkat = f"tk{int(datetime.now().strftime('%Y')) - int(kelas.getTahunAngkatanWithStudentID(npm)) + 1}"
    angkatan = kelas.getTahunAngkatanWithStudentID(npm)
    key = f'{prodi_singkatan}{tingkat}{angkatan}'
    biaya_pokok_spp = app.getDataDefault(key, ws)
    if trx_amount > biaya_pokok_spp:
        tunggakan = float(int(trx_amount) - int(biaya_pokok_spp))
        lima_puluh_persen_spp = int(biaya_pokok_spp / 2)
        minimum_pembayaran = tunggakan + lima_puluh_persen_spp
    else:
        tunggakan = float(0)
        minimum_pembayaran = int(biaya_pokok_spp / 2)
    app.openfile().close()
    ayah, ibu, handphoneortu = getNamaOrangTua(npm)
    msgreply=f'*BIODATA MAHASISWA*\n' \
             f'NPM: {npm}\n' \
             f'Nama: {nama_mahasiswa}\n' \
             f'Prodi: {kelas.getProdiNameWithStudentID(npm)}\n' \
             f'Nomor Handphone: {phonenumber}\n' \
             f'E-mail: {email}\n' \
             f'Dosen Wali: {kelas.getNamaDosen(penasehat_akademik)}\n' \
             f'Nama Orang Tua/Wali: {ayah} (Ayah) | {ibu} (Ibu)\n' \
             f'No HP orang Tua/Wali: {handphoneortu}\n\n' \
             f'*DATA VIRTUAL ACCOUNT BNI (Semester Ganjil 2020/2021)*\n' \
             f'Virtual Account: {virtual_account}\n' \
             f'Status Virtual Account: Aktif\n' \
             f'Customer Name: {customer_name}\n' \
             f'Customer Email: {customer_email}\n' \
             f'Customer Phone Number: {customer_phone}\n' \
             f'Biaya Pokok SPP: {app.floatToRupiah(float(biaya_pokok_spp))}\n' \
             f'Biaya Tunggakan SPP: {app.floatToRupiah(tunggakan)}\n' \
             f'Biaya Paket SPP Per Semester: {app.floatToRupiah(float(trx_amount))}\n' \
             f'Biaya Minimal Pembayaran: {app.floatToRupiah(float(trx_amount)/2)}\n' \
             f'Batas KRS: 12 Oktober 2020 - 16 Oktober 2020\n\n'\
             f'*CATATAN:* Untuk mempercepat layanan KRS Realtime *(langsung bayar langsung aktif dan bisa isi KRS)* anda diwajibkan melakukan pembayaran SPP menggunakan account VA anda, apabila pembayaran SPP tidak menggunakan account VA atau menggunakan metode transfer ke rekening YPBPI atau Giro Pos maka pengisian KRS dan aktivasi membutuhkan waktu 2 s.d 4 hari untuk mengecek bukti validasi pembayaran anda. Mohon kerjasamanya.'
    return msgreply
コード例 #5
0
def replymsg(driver, data):
    msgreply = ''
    npms = kelas.getStudentIdFromParentPhoneNumber(data[0])
    for npm in npms:
        npm = npm[0]
        nama = kelas.getStudentNameOnly(npm)
        for trx_id in getTrxIDList(npm):
            trx_id = trx_id[0]
            payment = getDataPembayaran(trx_id)
            kode_transaksi = trx_id
            judul_transaksi = trx_id.split('-')[1]
            virtual_account = payment['virtual_account']
            customer_name = payment['customer_name']
            trx_amount = payment['trx_amount']
            payment_amount = payment['payment_amount']
            cumulative_payment_amount = payment['cumulative_payment_amount']
            datetime_payment = payment['datetime_payment']
            percentage = ''
            if 'SPP' in trx_id:
                npm = app.cekNpmInTrxID(trx_id)
                ws = app.openfile().active
                prodi_singkatan = app.getProdiSingkatanFromProdiID(
                    kelas.getProdiIDwithStudentID(npm)).lower()
                tingkat = f"tk{int(kelas.getTahunID()[:-1]) - int(kelas.getTahunAngkatanWithStudentID(npm)) + 1}"
                angkatan = kelas.getTahunAngkatanWithStudentID(npm)
                if angkatan == '2020':
                    pass
                else:
                    key = f'{prodi_singkatan}{tingkat}{angkatan}'
                    default_amount_payment = app.getDataDefault(key, ws)
                    if int(trx_amount) > int(default_amount_payment):
                        amount_tunggakan = int(trx_amount) - int(
                            default_amount_payment)
                        transfer_spp = int(cumulative_payment_amount) - int(
                            amount_tunggakan)
                        percentage = float(
                            int(transfer_spp) /
                            int(default_amount_payment)) * 100
                    else:
                        potongan = int(default_amount_payment) - int(
                            trx_amount)
                        cumulative_payment_amount += potongan
                        transfer_spp = int(cumulative_payment_amount)
                        percentage = float(
                            int(transfer_spp) /
                            int(default_amount_payment)) * 100
                    app.openfile().close()
            if angkatan == '2020':
                msgreply += f'Jenis Pembayaran: *{judul_transaksi}*\n' \
                            f'Kode Transaksi: *{kode_transaksi}*\n' \
                            f'Virtual Account: *{virtual_account}*\n' \
                            f'Nama Pelanggan: *{customer_name}*\n' \
                            f'Jumlah Yang Harus Dibayar: *{app.floatToRupiah(float(trx_amount))}*\n' \
                            f'Jumlah Transfer: *{app.floatToRupiah(float(payment_amount))}*\n' \
                            f'Total Transfer: *{app.floatToRupiah(float(cumulative_payment_amount))}*\n' \
                            f'Tanggal dan Jam Transfer: *{datetime_payment}*\n\n'
            else:
                msgreply += f'Jenis Pembayaran: *{judul_transaksi}*\n' \
                            f'Kode Transaksi: *{kode_transaksi}*\n' \
                            f'Virtual Account: *{virtual_account}*\n' \
                            f'Nama Pelanggan: *{customer_name}*\n' \
                            f'Jumlah Yang Harus Dibayar: *{app.floatToRupiah(float(trx_amount))}*\n' \
                            f'Jumlah Transfer: *{app.floatToRupiah(float(payment_amount))}*\n' \
                            f'Total Transfer: *{app.floatToRupiah(float(cumulative_payment_amount))}*\n' \
                            f'Tanggal dan Jam Transfer: *{datetime_payment}*\n' \
                            f'Persentase Pembayaran SPP: {round(percentage)}%\n\n'
    return msgreply
コード例 #6
0
def callback_api_va(token):
    try:
        datenow = datetime.date(datetime.now()).strftime('%d-%m-%Y')
        yearnow=datetime.date(datetime.now()).strftime('%Y')
        req=request.json
        trxid=req['trx_id']
        npm=cekNpmInTrxID(trxid)
        tipesemester=cekTipeSemester(trxid)
        tahunid=f'{yearnow}{tipesemester}'
        prodiid=f'{npm[0]}{npm[3]}'
        virtual_account=req['virtual_account']
        customer_name=req['customer_name']
        trx_amount=req['trx_amount']
        payment_amount=req['payment_amount']
        cumulative_payment_amount=req['cumulative_payment_amount']
        payment_ntb=req['payment_ntb']
        datetime_payment=req['datetime_payment']
        datetime_payment_iso8601=req['datetime_payment_iso8601']
        resultpasscode, status = decryptToken(config.key_va, config.iv_va, token)
        if 'SPP' in trxid.split('-'):
            if status:
                passcodetrxid=resultpasscode.split(';')[0].replace('\n', '').replace(' ', '')
                passcodevirtualaccount=resultpasscode.split(';')[1].replace('\n', '').replace(' ', '')
                passcodedatetime=resultpasscode.split(';')[2].replace('\n', '').replace(' ', '')
                if passcodetrxid == trxid and passcodevirtualaccount == virtual_account and passcodedatetime == datenow:
                    message = f'Hai haiiiii kamu sudah transfer pembayaran semester yaaaa dengan{config.whatsapp_api_lineBreak}{config.whatsapp_api_lineBreak}*NPM: {npm}*{config.whatsapp_api_lineBreak}*Nama: {customer_name}*{config.whatsapp_api_lineBreak}*Virtual Account: {virtual_account}*{config.whatsapp_api_lineBreak}*Tanggal: {datetime_payment}*{config.whatsapp_api_lineBreak}*Jumlah Transfer: {floatToRupiah(payment_amount)}*{config.whatsapp_api_lineBreak}*Total Sudah Bayar: {floatToRupiah(cumulative_payment_amount)}*{config.whatsapp_api_lineBreak}*Total Harus Bayar: {floatToRupiah(trx_amount)}*'
                    ws = openfile().active
                    prodi_singkatan = getProdiSingkatanFromProdiID(kelas.getProdiIDwithStudentID(npm)).lower()
                    tingkat = f"tk{int(datetime.now().strftime('%Y')) - int(kelas.getTahunAngkatanWithStudentID(npm)) + 1}"
                    angkatan = kelas.getTahunAngkatanWithStudentID(npm)
                    key = f'{prodi_singkatan}{tingkat}{angkatan}'
                    default_amount_payment = getDataDefault(key, ws)
                    if int(trx_amount) > int(default_amount_payment):
                        amount_tunggakan = int(trx_amount) - int(default_amount_payment)
                        fifty_percent_default_payment = int(default_amount_payment) / 2
                        minimum_payment = int(amount_tunggakan) + int(fifty_percent_default_payment)
                    else:
                        minimum_payment = int(trx_amount) / 2
                    openfile().close()
                    if float(cumulative_payment_amount) >= float(minimum_payment):
                        if cekSudahAdaKHS(npm, tahunid, 'A'):
                            updateBiayaKHS(npm, tahunid, trx_amount-cumulative_payment_amount)
                            message += f'{config.whatsapp_api_lineBreak}{config.whatsapp_api_lineBreak}terima kasih yaaa sudah bayar semester, semangat kuliahnya kakaaaa......'
                        else:
                            message += f'{config.whatsapp_api_lineBreak}{config.whatsapp_api_lineBreak}Kamu *sudah bisa* isi KRS yaaa coba cek di *SIAP* yaaa...., #BOTNAME# ucapkan terima kasihhhh dan jangan salah saat isi KRS yaaa....'
                            message = message.replace('#BOTNAME#', config.bot_name)
                            insertnewKHS(npm, tahunid, prodiid, cekSesiSemester(tipesemester, npm), trx_amount-cumulative_payment_amount)
                        wa.setOutbox(kelas.getHandphoneMahasiswa(npm), message)
                        return make_response(jsonify(
                            {
                                "message": "success",
                                "status": "krs otomatis"
                            }
                        ), 200)
                    else:
                        message+=f'{config.whatsapp_api_lineBreak}{config.whatsapp_api_lineBreak}Yahhhh kamu *belum bisa* isi KRS nihhhh coba *buat surat* lalu *ajukan ke pihak BAUK* agar kamu bisa isi KRS..... Suratnya udah {config.bot_name} kirim ke *{kelas.getStudentEmail(npm)}*'
                        wa.setOutbox(kelas.getHandphoneMahasiswa(npm), message)
                        tes=surat_va.makePdfAndSendToEmail(npm)
                        return make_response(jsonify(
                            {
                                "message": "success",
                                "status": "kirim whatsapp bikin surat"
                            }
                        ), 200)
                else:
                    return make_response(jsonify({'message': 'bad token'}), 401)
            else:
                return make_response(jsonify({'message': 'bad token'}), 401)
        else:
            return make_response(jsonify({'message': 'not spp'}), 200)
    except Exception as e:
        return {
            "code": 404,
            "message": f"ERROR={e}"
        }
コード例 #7
0
def replymsg(driver, data):
    npm, nama = kelas.getNpmandNameMahasiswa(data[0])
    datava = getDataPayment(npm)
    if datava:
        datenow = datetime.date(datetime.now()).strftime('%d-%m-%Y')
        yearnow = datetime.date(datetime.now()).strftime('%Y')
        trxid = datava['trx_id']
        npm = app.cekNpmInTrxID(trxid)
        tipesemester = app.cekTipeSemester(trxid)
        tahunid = f'{yearnow}{tipesemester}'
        prodiid = getProdiIDfromNPM(npm)
        if prodiid == '64':
            prodiid = '54'
        virtual_account = datava['virtual_account']
        customer_name = datava['customer_name']
        trx_amount = datava['trx_amount']
        payment_amount = datava['payment_amount']
        cumulative_payment_amount = datava['cumulative_payment_amount']
        payment_ntb = datava['payment_ntb']
        datetime_payment = datava['datetime_payment']
        datetime_payment_iso8601 = datava['datetime_payment_iso8601']
        ws = app.openfile().active
        prodi_singkatan = app.getProdiSingkatanFromProdiID(
            kelas.getProdiIDwithStudentID(npm)).lower()
        tingkat = f"tk{int(kelas.getTahunID()[:-1]) - int(kelas.getTahunAngkatanWithStudentID(npm)) + 1}"
        angkatan = kelas.getTahunAngkatanWithStudentID(npm)
        message = f'Hai haiiiii kamu sudah transfer pembayaran semester yaaaa dengan\n\n*NPM: {npm}*\n*Nama: {customer_name}*\n*Virtual Account: {virtual_account}*\n*Tanggal: {datetime_payment}*\n*Jumlah Transfer: {app.floatToRupiah(payment_amount)}*\n*Total Sudah Bayar: {app.floatToRupiah(cumulative_payment_amount)}*\n*Total Harus Bayar: {app.floatToRupiah(trx_amount)}*\n*Sisa Yang Harus Dibayar: {app.floatToRupiah(float(int(trx_amount)-int(cumulative_payment_amount)))}*'
        if str(angkatan) == '2020':
            biaya_sisa = trx_amount - cumulative_payment_amount
            if biaya_sisa <= 0:
                percentage = 100
            else:
                percentage = 75
            app.updateBiayaKHS(npm, kelas.getTahunID(), biaya_sisa, percentage)
            message += f'\n\nterima kasih yaaa sudah bayar semester, semangat kuliahnya kakaaaa......'
            return message
            # return f'Mohon maaf untuk angkatan {angkatan}, sementara waktu verifikasi keuangan *BELUM* dapat dilakukan silahkan *VERIFIKASI KEMBALI SETELAH* tanggal *4 Desember 2020*.'
        key = f'{prodi_singkatan}{tingkat}{angkatan}'
        default_amount_payment = app.getDataDefault(key, ws)
        if default_amount_payment:
            default_amount_payment = int(default_amount_payment)
        else:
            if prodi_singkatan[:2] == 'd4':
                default_amount_payment = 2500000
            elif prodi_singkatan[:2] == 'd3':
                default_amount_payment = 2000000
            else:
                default_amount_payment = int(default_amount_payment)
        message = f'Hai haiiiii kamu sudah transfer pembayaran semester yaaaa dengan\n\n*NPM: {npm}*\n*Nama: {customer_name}*\n*Virtual Account: {virtual_account}*\n*Tanggal: {datetime_payment}*\n*Jumlah Transfer: {app.floatToRupiah(payment_amount)}*\n*Total Sudah Bayar: {app.floatToRupiah(cumulative_payment_amount)}*\n*Total Harus Bayar: {app.floatToRupiah(trx_amount)}*\n*Sisa Yang Harus Dibayar: {app.floatToRupiah(float(int(trx_amount)-int(cumulative_payment_amount)))}*'
        if int(trx_amount) > int(default_amount_payment):
            amount_tunggakan = int(trx_amount) - int(default_amount_payment)
            fifty_percent_default_payment = int(default_amount_payment) / 2
            minimum_payment = int(amount_tunggakan) + int(
                fifty_percent_default_payment)
            transfer_spp = int(cumulative_payment_amount) - int(
                amount_tunggakan)
            percentage = int(
                float(int(transfer_spp) / int(default_amount_payment)) * 100)
        else:
            potongan = int(default_amount_payment) - int(trx_amount)
            minimum_payment = int(default_amount_payment) / 2
            cumulative_payment_amount += potongan
            transfer_spp = int(cumulative_payment_amount)
            percentage = int(
                float(int(transfer_spp) / int(default_amount_payment)) * 100)
        if percentage >= 75 and percentage <= 100:
            if percentage == 100:
                percentage = 100
            else:
                percentage = 75
        else:
            percentage = 0
        app.openfile().close()
        if float(cumulative_payment_amount) >= float(minimum_payment):
            if app.cekSudahAdaKHS(npm, kelas.getTahunID(), 'A'):
                app.updateBiayaKHS(npm, kelas.getTahunID(),
                                   trx_amount - cumulative_payment_amount,
                                   percentage)
                message += f'\n\nterima kasih yaaa sudah bayar semester, semangat kuliahnya kakaaaa......'
            else:
                message += f'\n\nKamu *sudah bisa* isi KRS yaaa coba cek di *SIAP* yaaa...., #BOTNAME# ucapkan terima kasihhhh dan jangan salah saat isi KRS yaaa....'
                message = message.replace('#BOTNAME#', config.bot_name)
                app.insertnewKHS(npm, kelas.getTahunID(), prodiid,
                                 app.cekSesiSemester(tipesemester, npm),
                                 trx_amount - cumulative_payment_amount,
                                 percentage)
        else:
            message += f'\n\nYahhhh kamu *belum bisa* isi KRS nihhhh coba *buat surat* lalu *ajukan ke pihak BAUK* agar kamu bisa isi KRS..... Suratnya udah {config.bot_name} kirim ke *{kelas.getStudentEmail(npm)}*'
            surat_va.makePdfAndSendToEmail(npm)
        msgreply = message
    else:
        msgreply = 'kamu belum ada transfer'
    return msgreply
コード例 #8
0
def paymentSpp(npm):
    prodi_singkatan = app.getProdiSingkatanFromProdiID(kelas.getProdiIDwithStudentID(npm)).lower()
    tingkat = f"tk{int(kelas.getTahunID()[:-1]) - int(kelas.getTahunAngkatanWithStudentID(npm)) + 1}"
    angkatan = kelas.getTahunAngkatanWithStudentID(npm)
    key = f'{prodi_singkatan}{tingkat}{angkatan}'
    ws = app.openfile().active
    biaya_pokok_spp = app.getDataDefault(key, ws)
    app.openfile().close()
    payment_spp=cek_biodata_va_mahasiswa.getSPP(npm)
    try:
        if biaya_pokok_spp:
            biaya_pokok_spp=int(biaya_pokok_spp)
        else:
            if prodi_singkatan[:2] == 'd4':
                biaya_pokok_spp = 2500000
            elif prodi_singkatan[:2] == 'd3':
                biaya_pokok_spp = 2000000
            else:
                biaya_pokok_spp = int(biaya_pokok_spp)
        if int(payment_spp['trx_amount']) > int(biaya_pokok_spp):
            tunggakan = float(int(payment_spp['trx_amount']) - int(biaya_pokok_spp))
            amount_tunggakan = int(payment_spp["trx_amount"]) - int(biaya_pokok_spp)
            fifty_percent_default_payment = int(biaya_pokok_spp) * (75/100)
            minimum_payment = int(amount_tunggakan) + int(fifty_percent_default_payment)
        else:
            tunggakan = float(0)
            potongan = int(biaya_pokok_spp) - int(payment_spp['trx_amount'])
            minimum_payment = (int(biaya_pokok_spp) - int(potongan)) * (75/100)
        msgreply=''
        percentage = ''
        trx_id=payment_spp['trx_id']
        trx_amount=payment_spp['trx_amount']
        cumulative_payment_amount=payment_spp['trx_amount']
        if 'SPP' in trx_id:
            npm = app.cekNpmInTrxID(trx_id)
            ws = app.openfile().active
            prodi_singkatan = app.getProdiSingkatanFromProdiID(kelas.getProdiIDwithStudentID(npm)).lower()
            tingkat = f"tk{int(kelas.getTahunID()[:-1]) - int(kelas.getTahunAngkatanWithStudentID(npm)) + 1}"
            angkatan = kelas.getTahunAngkatanWithStudentID(npm)
            if angkatan == '2020':
                return f'*DATA VIRTUAL ACCOUNT BNI SPP (Semester Ganjil 2020/2021)*\n\n' \
                            f'*Kode Transaksi: {payment_spp["trx_id"]}*\n' \
                            f'*Virtual Account: {payment_spp["virtual_account"]}*\n' \
                            f'Status Virtual Account: Aktif\n' \
                            f'Customer Name: {payment_spp["customer_name"]}\n' \
                            f'Customer Email: {payment_spp["customer_email"]}\n' \
                            f'Customer Phone Number: {payment_spp["customer_phone"]}\n' \
                            f'Jumlah Tagihan: {app.floatToRupiah(float(payment_spp["trx_amount"]))}\n' \
                            f'Mohon *lunasi tagihan sesuai nominal* diatas agar dapat *melaksanakan UTS* sesuai *syarat dan ketentuan* bidang keuangan\n\n'
            key = f'{prodi_singkatan}{tingkat}{angkatan}'
            default_amount_payment = app.getDataDefault(key, ws)
            if int(trx_amount) > int(default_amount_payment):
                amount_tunggakan = int(trx_amount) - int(default_amount_payment)
                transfer_spp = int(cumulative_payment_amount) - int(amount_tunggakan)
                percentage = float(int(transfer_spp) / int(default_amount_payment)) * 100
            else:
                potongan = int(default_amount_payment) - int(trx_amount)
                cumulative_payment_amount += potongan
                transfer_spp = int(cumulative_payment_amount)
                percentage = float(int(transfer_spp) / int(default_amount_payment)) * 100
            app.openfile().close()
        if datetime.now() < payment_spp['expired_date']:
            msgreply = f'*DATA VIRTUAL ACCOUNT BNI SPP (Semester Genap 2020/2021)*\n\n' \
                        f'*Kode Transaksi: {payment_spp["trx_id"]}*\n' \
                        f'*Virtual Account: {payment_spp["virtual_account"]}*\n' \
                        f'Status Virtual Account: Aktif\n' \
                        f'Customer Name: {payment_spp["customer_name"]}\n' \
                        f'Customer Email: {payment_spp["customer_email"]}\n' \
                        f'Customer Phone Number: {payment_spp["customer_phone"]}\n' \
                        f'Biaya Paket SPP Per Semester: {app.floatToRupiah(float(biaya_pokok_spp))}\n' \
                        f'Biaya Tunggakan SPP: {app.floatToRupiah(tunggakan)}\n' \
                        f'Jumlah Tagihan: {app.floatToRupiah(float(payment_spp["trx_amount"]))}\n'
    except Exception as error:
        msgreply = f'ERROR: {error}\n\n'
    return msgreply