Ejemplo n.º 1
0
    def test_adyen_data_acquisition(self):
        
        user_data = UserData(tef_account="inexistent", city="city", address="street", 
                             postal_code="28282", country="BR", phone="28282", email="*****@*****.**")
        
        initial_payment_url(user_data)
        
        gw = PaymentGateway.objects.get(name="ADYEN")
        
        master_infos = MasterInformation.objects.filter(tef_account=user_data.tef_account, 
                                                        gateway__country=user_data.country)
        
        self.assertEqual(len(master_infos), 1)

        master_info = master_infos[0]
        
        self.assertEqual(master_info.gateway, gw)
        self.assertEqual(master_info.tef_account, user_data.tef_account)
        self.assertEqual(master_info.email, user_data.email)
        self.assertEqual(master_info.status, 'PENDING')
Ejemplo n.º 2
0
def acquire_redirect(request):

    if request.method == "POST":

        params = request.POST.get

        token = params("token", None)

        url = initial_payment_url(token)

        return HttpResponseRedirect(url)
    else:
        return HttpResponse("<h1>Invalid Method</h1>", status=405)
Ejemplo n.º 3
0
def acquire(request):
    
    if request.method == 'POST': 
        
        form = AcquireForm(request.POST) 
        
        if form.is_valid(): 
                        
            url = initial_payment_url(form)
            
            return HttpResponseRedirect(url)
    else:
        form = AcquireForm() 

    return render(request, 'acquire.html', {
        'form': form,
    })
Ejemplo n.º 4
0
def acquire(request):

    if request.method == 'POST':

        form = AcquireForm(request.POST)

        if form.is_valid():

            url = initial_payment_url(form)

            return HttpResponseRedirect(url)
    else:
        form = AcquireForm()

    return render(request, 'acquire.html', {
        'form': form,
    })