def paylane(request): amount = 1 response= None if request.method == 'POST': form = CreditCardForm(request.POST) if form.is_valid(): data = form.cleaned_data credit_card = CreditCard(**data) merchant = get_gateway("paylane") customer = PaylanePaymentCustomer() customer.name = "%s %s" %(data['first_name'], data['last_name']) customer.email = "*****@*****.**" customer.ip_address = "127.0.0.1" options = {} address = PaylanePaymentCustomerAddress() address.street_house = 'Av. 24 de Julho, 1117' address.city = 'Lisbon' address.zip_code = '1700-000' address.country_code = 'PT' customer.address = address options['customer'] = customer options['product'] = {} response = merchant.purchase(amount, credit_card, options = options) else: form = CreditCardForm(initial=GATEWAY_INITIAL['paylane']) return render(request, 'app/index.html', {'form': form, 'amount':amount, 'response':response, 'title':'Paylane Gateway'})
def paylane(request): amount = 1 response = None if request.method == 'POST': form = CreditCardForm(request.POST) if form.is_valid(): data = form.cleaned_data credit_card = CreditCard(**data) merchant = get_gateway("paylane") customer = PaylanePaymentCustomer() customer.name = "%s %s" % (data['first_name'], data['last_name']) customer.email = "*****@*****.**" customer.ip_address = "127.0.0.1" options = {} address = PaylanePaymentCustomerAddress() address.street_house = 'Av. 24 de Julho, 1117' address.city = 'Lisbon' address.zip_code = '1700-000' address.country_code = 'PT' customer.address = address options['customer'] = customer options['product'] = {} response = merchant.purchase(amount, credit_card, options=options) else: form = CreditCardForm(initial=GATEWAY_INITIAL['paylane']) return render( request, 'app/index.html', { 'form': form, 'amount': amount, 'response': response, 'title': 'Paylane Gateway' })