예제 #1
0
파일: test.py 프로젝트: germanponce/website
	"CSMDD15": "",
	"CSMDD16": "",
	"CSITPRODUCTCODE": "electronic_good",
	"CSITPRODUCTDESCRIPTION": "NOTEBOOK L845 SP4304LA DF TOSHIBA",
	"CSITPRODUCTNAME": "NOTEBOOK L845 SP4304LA DF TOSHIBA",
	"CSITPRODUCTSKU": "LEVJNSL36GN",
	"CSITTOTALAMOUNT": "1254.40",
	"CSITQUANTITY": "1",
	"CSITUNITPRICE": "1254.40"
}

tpc = TodoPagoConnector(j_header_http, "test")

print('--------------------- SAR RESPONSE ---------------------')

resultSAR = tpc.sendAuthorize(optionsSAR_comercio, optionsSAR_operacion)

encoding = sys.stdout.encoding

if (encoding == None):
	encoding = "cp850"

#show service result
for k, val in resultSAR.items():
	print(str(k)+": "+ str(val))				


print('--------------------- GAA RESPONSE ---------------------')

#Datos de comercio
optionsAnswer = {
예제 #2
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 ------------------------------------ "
예제 #3
0
파일: prueba.py 프로젝트: bmya/SDK-Python
"STSTATE": "D",
"STSTREET1": "San Martin 123",
"CSMDD12": "",
"CSMDD13": "",
"CSMDD14": "",
"CSMDD15": "",
"CSMDD16": "",
"CSITPRODUCTCODE": "electronic_good",
"CSITPRODUCTDESCRIPTION": "NOTEBOOK L845 SP4304LA DF TOSHIBA",
"CSITPRODUCTNAME": "NOTEBOOK L845 SP4304LA DF TOSHIBA",
"CSITPRODUCTSKU": "LEVJNSL36GN",
"CSITTOTALAMOUNT": "1254.40",
"CSITQUANTITY": "1",
"CSITUNITPRICE": "1254.40"
}



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

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


tpc = TodoPagoConnector(j_header_http, "test")
print (tpc.sendAuthorize(optionsSAR_comercio, optionsSAR_operacion))
예제 #4
0
def sar():
    conn = sqlite3.connect('operaciones.db')
    c = conn.cursor()
    c.execute("SELECT data, security, mode, id FROM operacion where id = ?",
              (request.GET.id.strip(), ))
    result = c.fetchone()
    c.close()

    operacion = json.loads(result[0])

    optionsSAR_comercio = {
        "Security": str(result[1]),
        "EncodingMethod": "XML",
        "URL_OK": str(operacion["URL_OK"]),
        "URL_ERROR": str(operacion["URL_ERROR"]),
        "EMAILCLIENTE": str(operacion["EMAILCLIENTE"])
    }
    print(optionsSAR_comercio)

    optionsSAR_operacion = {
        "MERCHANT": str(operacion["MERCHANT"]),
        "OPERATIONID": str(operacion["OPERATIONID"]),
        "CURRENCYCODE": str(operacion["CURRENCYCODE"]),
        "AMOUNT": str(operacion["AMOUNT"]),
        "MININSTALLMENTS": str(operacion["MININSTALLMENTS"]),
        "MAXINSTALLMENTS": str(operacion["MAXINSTALLMENTS"]),
        "CSBTCITY": str(operacion["CSBTCITY"]),
        "CSSTCITY": str(operacion["CSSTCITY"]),
        "CSMDD6": "",
        "CSBTCOUNTRY": str(operacion["CSBTCOUNTRY"]),
        "CSSTCOUNTRY": str(operacion["CSSTCOUNTRY"]),
        "CSBTEMAIL": str(operacion["CSBTEMAIL"]),
        "CSSTEMAIL": str(operacion["CSSTEMAIL"]),
        "CSBTFIRSTNAME": str(operacion["CSBTFIRSTNAME"]),
        "CSSTFIRSTNAME": str(operacion["CSSTFIRSTNAME"]),
        "CSBTLASTNAME": str(operacion["CSBTLASTNAME"]),
        "CSSTLASTNAME": str(operacion["CSSTLASTNAME"]),
        "CSBTPHONENUMBER": str(operacion["CSBTPHONENUMBER"]),
        "CSSTPHONENUMBER": str(operacion["CSSTPHONENUMBER"]),
        "CSBTPOSTALCODE": str(operacion["CSBTPOSTALCODE"]),
        "CSSTPOSTALCODE": str(operacion["CSSTPOSTALCODE"]),
        "CSBTSTATE": str(operacion["CSBTSTATE"]),
        "CSSTSTATE": str(operacion["CSSTSTATE"]),
        "CSBTSTREET1": str(operacion["CSBTSTREET1"]),
        "CSSTSTREET1": str(operacion["CSSTSTREET1"]),
        "CSBTSTREET2": str(operacion["CSBTSTREET2"]),
        "CSSTSTREET2": str(operacion["CSBTSTREET2"]),
        "CSBTCUSTOMERID": str(operacion["CSBTCUSTOMERID"]),
        "CSBTIPADDRESS": str(operacion["CSBTIPADDRESS"]),
        "CSPTCURRENCY": str(operacion["CSPTCURRENCY"]),
        "CSPTGRANDTOTALAMOUNT": str(operacion["CSPTGRANDTOTALAMOUNT"]),
        "CSMDD7": str(operacion["CSMDD7"]),
        "CSMDD8": str(operacion["CSMDD8"]),
        "CSMDD9": str(operacion["CSMDD9"]),
        "CSMDD10": str(operacion["CSMDD10"]),
        "CSMDD11": str(operacion["CSMDD11"]),
        "STCITY": str(operacion["CSSTCITY"]),
        "STCOUNTRY": str(operacion["CSSTCOUNTRY"]),
        "STEMAIL": str(operacion["CSSTEMAIL"]),
        "STFIRSTNAME": str(operacion["CSSTFIRSTNAME"]),
        "STLASTNAME": str(operacion["CSSTLASTNAME"]),
        "STPHONENUMBER": str(operacion["CSSTPHONENUMBER"]),
        "STPOSTALCODE": str(operacion["CSSTPOSTALCODE"]),
        "STSTATE": str(operacion["CSSTSTATE"]),
        "STSTREET1": str(operacion["CSSTSTREET1"]),
        "CSMDD12": str(operacion["CSMDD12"]),
        "CSMDD13": str(operacion["CSMDD13"]),
        "CSMDD14": str(operacion["CSMDD14"]),
        "CSMDD15": str(operacion["CSMDD15"]),
        "CSMDD16": str(operacion["CSMDD16"]),
        "CSITPRODUCTCODE": str(operacion["CSITPRODUCTCODE"]),
        "CSITPRODUCTDESCRIPTION": str(operacion["CSITPRODUCTDESCRIPTION"]),
        "CSITPRODUCTNAME": str(operacion["CSITPRODUCTNAME"]),
        "CSITPRODUCTSKU": str(operacion["CSITPRODUCTSKU"]),
        "CSITTOTALAMOUNT": str(operacion["CSITTOTALAMOUNT"]),
        "CSITQUANTITY": str(operacion["CSITQUANTITY"]),
        "CSITUNITPRICE": str(operacion["CSITUNITPRICE"])
    }

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

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

    tpc = TodoPagoConnector(j_header_http, result[2])

    result = tpc.sendAuthorize(optionsSAR_comercio, optionsSAR_operacion)

    #encoding = sys.stdout.encoding
    #if (encoding is None):
    #	encoding = "cp850"
    #for k, val in result.iteritems():
    #	if (isinstance(val, int)):
    #		strval = str(val)
    #		print(k + " : " + strval.encode(encoding))
    #	else:
    #		print(k + " : " + val.encode(encoding))

    #Guarda respuesta
    conn = sqlite3.connect('operaciones.db')
    c = conn.cursor()
    c.execute(
        "UPDATE operacion SET response_SAR=?, request_key=?, url_request=?, public_request_key=?, status='Sar correcto' WHERE id=?",
        (json.dumps(optionsSAR_operacion), result['RequestKey'],
         result['URL_Request'], result['PublicRequestKey'],
         request.GET.id.strip()))
    conn.commit()
    c.close()

    output = template('sar', statusCode=result['StatusCode'], result=result)
    return output
예제 #5
0
"CSITTOTALAMOUNT": "1254.40",
"CSITQUANTITY": "1",
"CSITUNITPRICE": "1254.40"
}



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

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


tpc = TodoPagoConnector(j_header_http, "test")

result = tpc.sendAuthorize(optionsSAR_comercio, optionsSAR_operacion)

encoding = sys.stdout.encoding
if (encoding is None):
	encoding = "cp850"
for k, val in result.iteritems():
	if (isinstance(val, int)):
		strval = str(val)
		print(k + " : " + strval.encode(encoding))
	else:
		print(k + " : " + val.encode(encoding))