Exemplo n.º 1
0
def three_ds_verify_signed(request):
    pa_res = request.GET.get('PaRes', '')
    merchant_data = _decrypt_and_decode_merchant_data(request.GET.get('MD', ''))

    response = Realex.verify_signed(amount=merchant_data['amount'],
                                    currency=merchant_data['currency'],
                                    pares=pa_res,
                                    sha1hash=merchant_data['sha1hash'],
                                    order_id=merchant_data['order_id'])

    if response['realex_result_code'] == '00' and (response['status'] == 'Y' or response['status'] == 'A'):
        response = Realex.create_charge(
            amount=merchant_data['amount'],
            currency=merchant_data['currency'],
            card_holder_name=merchant_data['card_holder_name'],
            card_number=merchant_data['card_number'],
            cvv=merchant_data['cvv'],
            expiry_month=merchant_data['expiry_month'],
            expiry_year=merchant_data['expiry_year'],
            card_type=merchant_data['card_type'],
            cavv=response['cavv'],
            xid=response['xid'],
            eci=response['eci']
        )
        return render(request, "index.html", response)

    return render(request, "index.html", response)
Exemplo n.º 2
0
def three_d_secure(request):
    request_body = request.body
    response = Realex.verify_enrolled(amount=request.POST['amount'],
                                      currency=request.POST['currency'],
                                      card_holder_name=request.POST['card_holder_name'],
                                      card_number=request.POST['card_number'],
                                      expiry_month=request.POST['expiry_month'],
                                      expiry_year=request.POST['expiry_year'],
                                      card_type=request.POST['card_type'])

    if response['enrolled'] == 'Y':
        response = Realex.redirect_to_secure_site(third_party_url=response['url'],
                                                  pareq=response['pareq'],
                                                  merchant_data=_encrypt_and_encode_merchant_data(request_body,
                                                                                                  response),
                                                  request_id='tp_python_realex_example')
        return HttpResponse(response.text)
    else:
        return HttpResponse(json.dumps(response), content_type="application/json")
Exemplo n.º 3
0
def auth(request):
    response = Realex.create_charge(
        amount=request.POST['amount'],
        currency=request.POST['currency'],
        card_holder_name=request.POST['card_holder_name'],
        card_number=request.POST['card_number'],
        cvv=request.POST['cvv'],
        expiry_month=request.POST['expiry_month'],
        expiry_year=request.POST['expiry_year'],
        card_type=request.POST['card_type'])
    return HttpResponse(json.dumps(response), content_type="application/json")