本文整理汇总了Python中pysimplesoap.client.SoapClient.getTransaccionesNoConfirmadas方法的典型用法代码示例。如果您正苦于以下问题:Python SoapClient.getTransaccionesNoConfirmadas方法的具体用法?Python SoapClient.getTransaccionesNoConfirmadas怎么用?Python SoapClient.getTransaccionesNoConfirmadas使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pysimplesoap.client.SoapClient
的用法示例。
在下文中一共展示了SoapClient.getTransaccionesNoConfirmadas方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestTrazamed
# 需要导入模块: from pysimplesoap.client import SoapClient [as 别名]
# 或者: from pysimplesoap.client.SoapClient import getTransaccionesNoConfirmadas [as 别名]
class TestTrazamed(unittest.TestCase):
def setUp(self):
self.client = SoapClient(
wsdl = WSDL,
cache = None,
ns="tzmed",
soap_ns="soapenv",
soap_server="jetty", # needed to handle list
trace = "--trace" in sys.argv)
# fix location (localhost:9050 is erroneous in the WSDL)
self.client.services['IWebServiceService']['ports']['IWebServicePort']['location'] = LOCATION
# Set WSSE security credentials
self.client['wsse:Security'] = {
'wsse:UsernameToken': {
'wsse:Username': 'testwservice',
'wsse:Password': 'testwservicepsw',
}
}
def test_send_medicamentos(self):
#self.client.help("sendMedicamentos")
# Create the complex type (medicament data transfer object):
medicamentosDTO = dict(
f_evento=datetime.datetime.now().strftime("%d/%m/%Y"),
h_evento=datetime.datetime.now().strftime("%H:%M"),
gln_origen="9999999999918", gln_destino="glnws",
n_remito="1234", n_factura="1234",
vencimiento=(datetime.datetime.now() +
datetime.timedelta(30)).strftime("%d/%m/%Y"),
gtin="GTIN1", lote=datetime.datetime.now().strftime("%Y"),
numero_serial=int(time.time()),
id_obra_social=None, id_evento=134,
cuit_origen="20267565393", cuit_destino="20267565393",
apellido="Reingart", nombres="Mariano",
tipo_docmento="96", n_documento="26756539", sexo="M",
direccion="Saraza", numero="1234", piso="", depto="",
localidad="Hurlingham", provincia="Buenos Aires",
n_postal="1688", fecha_nacimiento="01/01/2000",
telefono="5555-5555",
)
# Call the webservice to inform a medicament:
res = self.client.sendMedicamentos(
arg0=medicamentosDTO,
arg1='pruebasws',
arg2='pruebasws',
)
# Analyze the response:
ret = res['return']
self.assertIsInstance(ret['codigoTransaccion'], unicode)
self.assertEqual(ret['resultado'], True)
def test_send_medicamentos_dh_serie(self):
self.client.help("sendMedicamentosDHSerie")
# Create the complex type (medicament data transfer object):
medicamentosDTODHSerie = dict(
f_evento=datetime.datetime.now().strftime("%d/%m/%Y"),
h_evento=datetime.datetime.now().strftime("%H:%M"),
gln_origen="9999999999918", gln_destino="glnws",
n_remito="1234", n_factura="1234",
vencimiento=(datetime.datetime.now() +
datetime.timedelta(30)).strftime("%d/%m/%Y"),
gtin="GTIN1", lote=datetime.datetime.now().strftime("%Y"),
desde_numero_serial=10,
hasta_numero_serial=0,
id_obra_social=None, id_evento=134,
)
# Call the webservice to inform a medicament:
res = self.client.sendMedicamentosDHSerie(
arg0=medicamentosDTODHSerie,
arg1='pruebasws',
arg2='pruebasws',
)
# Analyze the response:
ret = res['return']
# Check the results:
self.assertIsInstance(ret['codigoTransaccion'], unicode)
self.assertEqual(ret['errores'][0]['_c_error'], '3004')
self.assertEqual(ret['errores'][0]['_d_error'], "El campo Hasta Nro Serial debe ser mayor o igual al campo Desde Nro Serial.")
self.assertEqual(ret['resultado'], False)
def test_get_transacciones_no_confirmadas(self):
# Call the webservice to query all the un-confirmed transactions:
res = self.client.getTransaccionesNoConfirmadas(
arg0='pruebasws',
arg1='pruebasws',
)
# Analyze the response:
#.........这里部分代码省略.........
示例2: TestTrazamed
# 需要导入模块: from pysimplesoap.client import SoapClient [as 别名]
# 或者: from pysimplesoap.client.SoapClient import getTransaccionesNoConfirmadas [as 别名]
#.........这里部分代码省略.........
lote=datetime.datetime.now().strftime("%Y"),
numero_serial=int(time.time()),
id_obra_social=None,
id_evento=134,
cuit_origen="20267565393",
cuit_destino="20267565393",
apellido="Reingart",
nombres="Mariano",
tipo_documento="96",
n_documento="26756539",
sexo="M",
direccion="Saraza",
numero="1234",
piso="",
depto="",
localidad="Hurlingham",
provincia="Buenos Aires",
n_postal="1688",
fecha_nacimiento="01/01/2000",
telefono="5555-5555",
)
# Call the webservice to inform a medicament:
res = self.client.sendMedicamentos(arg0=medicamentosDTO, arg1="pruebasws", arg2="pruebasws")
# Analyze the response:
ret = res["return"]
self.assertIsInstance(ret["codigoTransaccion"], basestring)
self.assertEqual(ret["resultado"], True)
def test_send_medicamentos_dh_serie(self):
self.client.help("sendMedicamentosDHSerie")
# Create the complex type (medicament data transfer object):
medicamentosDTODHSerie = dict(
f_evento=datetime.datetime.now().strftime("%d/%m/%Y"),
h_evento=datetime.datetime.now().strftime("%H:%M"),
gln_origen="9999999999918",
gln_destino="glnws",
n_remito="1234",
n_factura="1234",
vencimiento=(datetime.datetime.now() + datetime.timedelta(30)).strftime("%d/%m/%Y"),
gtin="GTIN1",
lote=datetime.datetime.now().strftime("%Y"),
desde_numero_serial=int(time.time()) + 1,
hasta_numero_serial=int(time.time()) - 1,
id_obra_social=None,
id_evento=134,
)
# Call the webservice to inform a medicament:
res = self.client.sendMedicamentosDHSerie(arg0=medicamentosDTODHSerie, arg1="pruebasws", arg2="pruebasws")
# Analyze the response:
ret = res["return"]
# Check the results:
self.assertIsInstance(ret["codigoTransaccion"], basestring)
self.assertEqual(ret["errores"][0]["_c_error"], "3004")
self.assertEqual(
ret["errores"][0]["_d_error"], "El campo Hasta Nro Serial debe ser mayor o igual al campo Desde Nro Serial."
)
self.assertEqual(ret["resultado"], False)
def test_get_transacciones_no_confirmadas(self):
# Call the webservice to query all the un-confirmed transactions:
res = self.client.getTransaccionesNoConfirmadas(
arg0="pruebasws", arg1="pruebasws", arg10="01/01/2013", arg11="31/12/2013"
)
# Analyze the response:
ret = res["return"]
# Check the results (a list should be returned):
self.assertIsInstance(ret["list"], list)
for transaccion_plain_ws in ret["list"]:
# each item of the list is a dict (transaccionPlainWS complex type):
# {'_f_evento': u'20/06/2012', '_numero_serial': u'04', ...}
# check the keys returned in the complex type:
for key in [
"_f_evento",
"_f_transaccion",
"_lote",
"_numero_serial",
"_razon_social_destino",
"_gln_destino",
"_n_remito",
"_vencimiento",
"_d_evento",
"_id_transaccion_global",
"_razon_social_origen",
"_n_factura",
"_gln_origen",
"_id_transaccion",
"_gtin",
"_nombre",
]:
self.assertIn(key, transaccion_plain_ws)
示例3: __init__
# 需要导入模块: from pysimplesoap.client import SoapClient [as 别名]
# 或者: from pysimplesoap.client.SoapClient import getTransaccionesNoConfirmadas [as 别名]
#.........这里部分代码省略.........
kwargs = {}
if p_id_transaccion_global is not None:
kwargs['arg2'] = p_id_transaccion_global
if id_agente_informador is not None:
kwargs['arg3'] = id_agente_informador
if id_agente_origen is not None:
kwargs['arg4'] = id_agente_origen
if id_agente_destino is not None:
kwargs['arg5'] = id_agente_destino
if id_medicamento is not None:
kwargs['arg6'] = id_medicamento
if id_evento is not None:
kwargs['arg7'] = id_evento
if fecha_desde_op is not None:
kwargs['arg8'] = fecha_desde_op
if fecha_hasta_op is not None:
kwargs['arg9'] = fecha_hasta_op
if fecha_desde_t is not None:
kwargs['arg10'] = fecha_desde_t
if fecha_hasta_t is not None:
kwargs['arg11'] = fecha_hasta_t
if fecha_desde_v is not None:
kwargs['arg12'] = fecha_desde_v
if fecha_hasta_v is not None:
kwargs['arg13'] = fecha_hasta_v
if n_remito is not None:
kwargs['arg14'] = n_remito
if n_factura is not None:
kwargs['arg15'] = n_factura
if estado is not None:
kwargs['arg16'] = estado
# llamo al webservice
res = self.client.getTransaccionesNoConfirmadas(
arg0=usuario,
arg1=password,
**kwargs
)
ret = res['return']
if ret:
self.__analizar_errores(ret)
self.CantPaginas = ret.get('cantPaginas')
self.HayError = ret.get('hay_error')
self.TransaccionPlainWS = [it for it in ret.get('list', [])]
return True
def LeerTransaccion(self):
"Recorro TransaccionPlainWS devuelto por GetTransaccionesNoConfirmadas"
# usar GetParametro para consultar el valor retornado por el webservice
if self.TransaccionPlainWS:
# extraigo el primer item
self.params = self.TransaccionPlainWS.pop(0)
return True
else:
# limpio los parámetros
self.params = {}
return False
def LeerError(self):
"Recorro los errores devueltos y devuelvo el primero si existe"
if self.Errores:
# extraigo el primer item
er = self.Errores.pop(0)
return er