Esempio n. 1
0
def deposit_result(request):
    if not request.method == 'POST':
        return HttpResponse('no')

    retval = 'error'
    if request.POST.get('m_operation_id', None) and request.POST.get('m_sign', None):

        arHash = (
            request.POST['m_operation_id'],
            request.POST['m_operation_ps'],
            request.POST['m_operation_date'],
            request.POST['m_operation_pay_date'],
            request.POST['m_shop'],
            request.POST['m_orderid'],
            request.POST['m_amount'],
            request.POST['m_curr'],
            request.POST['m_desc'],
            request.POST['m_status'],
            settings.PAYEER_SHOP_KEY
        )
        order_id = request.POST.get('m_orderid')
        sign_hash = hashlib.sha256(':'.join(arHash).encode('utf-8')).hexdigest().upper()
        if request.POST.get('m_sign') == sign_hash and request.POST.get('m_status') == 'success':
            retval = order_id + '|success'
            tr = Transaction.objects.get(pk=int(request.POST.get('m_orderid')))
            if tr.amount == Decimal(request.POST.get('m_amount')) and tr.ps == NAME and not tr.is_ended:
                transaction = UserTransaction()
                transaction.do_transaction_deposit(tr.user, tr, request.POST.get('m_operation_id'))
            else:
                retval = order_id + "|error"
        else:
            retval = order_id + "|error"

    return HttpResponse(retval)
Esempio n. 2
0
def deposit_result(request):
    if not request.method == 'POST':
        return HttpResponse('no')

    retval = 'error'
    if request.POST.get('m_operation_id', None) and request.POST.get(
            'm_sign', None):

        arHash = (request.POST['m_operation_id'],
                  request.POST['m_operation_ps'],
                  request.POST['m_operation_date'],
                  request.POST['m_operation_pay_date'], request.POST['m_shop'],
                  request.POST['m_orderid'], request.POST['m_amount'],
                  request.POST['m_curr'], request.POST['m_desc'],
                  request.POST['m_status'], settings.PAYEER_SHOP_KEY)
        order_id = request.POST.get('m_orderid')
        sign_hash = hashlib.sha256(
            ':'.join(arHash).encode('utf-8')).hexdigest().upper()
        if request.POST.get('m_sign') == sign_hash and request.POST.get(
                'm_status') == 'success':
            retval = order_id + '|success'
            tr = Transaction.objects.get(pk=int(request.POST.get('m_orderid')))
            if tr.amount == Decimal(request.POST.get(
                    'm_amount')) and tr.ps == NAME and not tr.is_ended:
                transaction = UserTransaction()
                transaction.do_transaction_deposit(
                    tr.user, tr, request.POST.get('m_operation_id'))
            else:
                retval = order_id + "|error"
        else:
            retval = order_id + "|error"

    return HttpResponse(retval)
Esempio n. 3
0
def deposit_result(request):
    if not request.method == 'POST':
        return HttpResponse('no')

    outhash = hashlib.md5('{}:{}:{}:USD:{}:{}:{}:{}'.format(
        request.POST.get('PAYMENT_ID'),
        settings.PM_WALLET,
        request.POST.get('PAYMENT_AMOUNT'),
        request.POST.get('PAYMENT_BATCH_NUM'),
        request.POST.get('PAYER_ACCOUNT'),
        hashlib.md5(settings.PM_PASSPHRASE.encode('utf-8')).hexdigest().upper(),
        request.POST.get('TIMESTAMPGMT')).encode('utf-8')).hexdigest()

    if str(outhash).upper() == str(request.POST.get('V2_HASH')).upper():
        tr = Transaction.objects.get(pk=int(request.POST.get('PAYMENT_ID')))
        if tr.amount == Decimal(request.POST.get('PAYMENT_AMOUNT')) and tr.ps == NAME and not tr.is_ended:
            transaction = UserTransaction()
            transaction.do_transaction_deposit(tr.user, tr, request.POST['PAYMENT_BATCH_NUM'])

    return HttpResponse('ok')