def gaa(): conn = sqlite3.connect('operaciones.db') c = conn.cursor() c.execute( "SELECT data, security, mode, id, request_key, answer_key FROM operacion where id = ?", (request.GET.id.strip(), )) result = c.fetchone() operacion = json.loads(result[0]) j_header_http = {'Authorization': 'TODOPAGO ' + str(result[1])} j_wsdls = {'Operations': 'Operations', 'Authorize': 'Authorize'} optionsGAA = { 'Security': str(result[1]), 'Merchant': str(operacion["MERCHANT"]), 'RequestKey': str(result[4]), 'AnswerKey': str(result[5]) } print(optionsGAA) tpc = TodoPagoConnector(j_header_http, result[2]) result = tpc.getAuthorize(optionsGAA) c.execute("UPDATE operacion set status=? WHERE id=?", ('GAA correcto', request.GET.id.strip())) conn.commit() output = template('gaa', statusCode=result['StatusCode'], result=result) return output
#show service result for k, val in resultSAR.items(): print(str(k)+": "+ str(val)) print('--------------------- GAA RESPONSE ---------------------') #Datos de comercio optionsAnswer = { "Security": "f3d8b72c94ab4a06be2ef7c95490f7d3", "Merchant": "2153", "RequestKey": "a2fc7d9e-7c7d-8a55-5322-cecb593160d3", "AnswerKey": "2ac51ee1-1e34-19aa-61bc-3c80407fbbc3" } resultGAA = tpc.getAuthorize(optionsAnswer) print(resultGAA) print('--------------------- ALLPAYMENTMETHODS ---------------------') optionsPaymentMethods = { "MERCHANT": "12541" } resultGetOperationById = tpc.getAllPaymentMethods(optionsPaymentMethods) print(resultGetOperationById)
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 ------------------------------------ "