예제 #1
0
def devolucion_total():
	conn = sqlite3.connect('operaciones.db')
	c = conn.cursor()
	c.execute("SELECT data, security, mode, id, request_key, answer_key FROM operacion where id = ?", (request.POST.id.strip(),))
	result = c.fetchone()

	operacion = json.loads(result[0])

	j_header_http = {
		'Authorization': 'TODOPAGO '+str(result[1])
	}

	j_wsdls = {
		'Operations': 'Operations',
		'Authorize': 'Authorize'
	}
	

	#Devolucion parcial
	if request.POST.parcial.strip():
		tipoDevolucion='Parcial'
		optionsVoid = {
		    "Security": str(result[1]),
		    "Merchant": str(operacion["MERCHANT"]),
		    "RequestKey": str(result[4]),
		    "Amount": str(request.POST.amount.strip())
		}

		tpc = TodoPagoConnector(j_header_http, result[2])
		result = tpc.returnRequest(optionsVoid)

	#Devolucion total
	else:
		tipoDevolucion='total'
		optionsVoid = {
		    "Security": str(result[1]),
		    "Merchant": str(operacion["MERCHANT"]),
		    "RequestKey": str(result[4])
		}
		tpc = TodoPagoConnector(j_header_http, result[2])
		result = tpc.voidRequest(optionsVoid)
	
	output = template('devolver', statusCode=result['StatusCode'], tipoDevolucion=tipoDevolucion, result=result)
	return output		
예제 #2
0
파일: test.py 프로젝트: germanponce/website
responGOBI = tpc.getByOperationId(optionsGOBI)

print(responGOBI)



print('--------------------- DEVOLUCIONES ---------------------')

optionsReturnRequest = {
	"Merchant": "2153",
	"Security": "f3d8b72c94ab4a06be2ef7c95490f7d3",
	"RequestKey": "a2fc7d9e-7c7d-8a55-5322-cecb593160d3",
	"AMOUNT": "1.00"
}

responseReturnRequest = tpc.returnRequest(optionsReturnRequest)

print(responseReturnRequest)



print('--------------------- ANULACION ---------------------')

optionsVoidRequest = {
	"Merchant": "2153",
	"Security": "f3d8b72c94ab4a06be2ef7c95490f7d3",
	"RequestKey": "a2fc7d9e-7c7d-8a55-5322-cecb593160d3"
}

responseVoidRequest = tpc.voidRequest(optionsVoidRequest)
예제 #3
0
optionsGS = {'MERCHANT': '2658', 'OPERATIONID': '8000'}

optionsGBRDT = {
    'MERCHANT': '2866',
    'STARTDATE': '2015-11-01',
    'ENDDATE': '2015-12-10',
    'PAGENUMBER': '1'
}

j_header_http = {'Authorization': 'TODOPAGO 1540601877EB2059EF50240E46ABD10E'}

j_wsdls = {'Operations': 'Operations', 'Authorize': 'Authorize'}

userCredenciales = {'USUARIO': "*****@*****.**", 'CLAVE': "contrasena"}

tpc = TodoPagoConnector(j_header_http, "test")
print(tpc.sendAuthorize(optionsSAR_comercio, optionsSAR_operacion))
print "\n\r ------------------------------------ "
print tpc.getAuthorize(optionsGAA)
print "\n\r ------------------------------------ "
print tpc.returnRequest(optionsRR)
print "\n\r ------------------------------------ "
print tpc.voidRequest(optionsVR)
print "\n\r ------------------------------------ "
print tpc.getByOperationId(optionsGS)
print "\n\r ------------------------------------ "
print tpc.getByRangeDateTime(optionsGBRDT)
print "\n\r ------------------------------------ "
print tpc.getCredentials(userCredenciales)
print "\n\r ------------------------------------ "