コード例 #1
0
def login_action():
    j_header_http = {
        #'Authorization':''
    }

    datosUsuario = {
        'USUARIO': request.POST.user.strip(),
        'CLAVE': request.POST.pwd.strip()
    }

    tpc = TodoPagoConnector(j_header_http, str(request.POST.mode.strip()))
    result = tpc.getCredentials(datosUsuario)
    print(result)

    arrSecurity = str(result["Credentials"]["APIKey"]).split(' ')

    if result["Credentials"]["resultado"]["codigoResultado"] == 0:
        response.set_header(
            'Set-Cookie',
            'merchandid=' + str(result["Credentials"]["merchantId"]))
        response.add_header('Set-Cookie', 'security=' + arrSecurity[1])
        response.add_header('Set-Cookie',
                            'mode=' + str(request.POST.mode.strip()))
        return (
            "<p><strong>getCredentials</strong> correcto.<div></div><a href='/list'>Continuar</a></p>"
        )
    else:
        return ("<p>Error en el login.</p><p>mensajeResultado: </p><pre>" +
                str(result["Credentials"]["resultado"]["mensajeResultado"]) +
                "</pre>")
コード例 #2
0
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
コード例 #3
0
def getstatus():
	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'
	}
	
	optionsGS = {
		'MERCHANT': str(operacion["MERCHANT"]),
		'OPERATIONID': str(operacion["OPERATIONID"]),
	}


	tpc = TodoPagoConnector(j_header_http, result[2])
	result = tpc.getByOperationId(optionsGS)

	output = template('getstatus', result=result)
	return output
コード例 #4
0
ファイル: main_support.py プロジェクト: bmya/SDK-Python
def configCommand():
    j_header_http = {'Authorization': configAuthorization.get()}

    j_wsdls = {
        'Authorize': configAuthorizationWSDL.get(),
        'Operations': configOperationsWSDL.get(),
        'PaymentMethods': configPaymentMethodsWSDL.get()
    }
    global tpc
    tpc = TodoPagoConnector(j_header_http, j_wsdls, configEndpoint.get())
コード例 #5
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		
コード例 #6
0
ファイル: test.py プロジェクト: germanponce/website
	"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"
}

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))				

コード例 #7
0
ファイル: prueba.py プロジェクト: Nassty/SDK-Python
    "MERCHANT": "305",
    "OPERATIONID": "ABCDEF-1234-12221-FDE1-00000200",
    "CURRENCYCODE": "032",
    "AMOUNT": "50",
}

optionsGAA = {
    "Security": "1234567890ABCDEF1234567890ABCDEF",
    "Merchant": "305",
    "RequestKey": "8496472a-8c87-e35b-dcf2-94d5e31eb12f",
    "AnswerKey": "8496472a-8c87-e35b-dcf2-94d5e31eb12f",
}

optionsGAPM = {"MERCHANT": "305"}
optionsGS = {"MERCHANT": "305", "OPERATIONID": "141120084707"}

j_header_http = {"Authorization": "PRISMA 912EC803B2CE49E4A541068D495AB570"}

j_wsdls = {
    "Operations": "http://localhost:8280/services/Operations?wsdl",
    "Authorize": "http://localhost:8280/services/Authorize?wsdl",
    "PaymentMethods": "http://localhost:8280/services/PaymentMethods?wsdl",
}


tpc = TodoPagoConnector(j_header_http, j_wsdls, "http://localhost:8280/services/")
print tpc.sendAuthorizeRequest(optionsSAR_comercio, optionsSAR_operacion)
print tpc.getAuthorizeAnswer(optionsGAA)
print tpc.getAllPaymentMethods(optionsGAPM)
print tpc.getStatus(optionsGS)
コード例 #8
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 ------------------------------------ "
コード例 #9
0
ファイル: prueba.py プロジェクト: guillermoluced/SDK-Python
    "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")

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))
コード例 #10
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
コード例 #11
0
ファイル: prueba2.py プロジェクト: odoo-modules/addons9
import requests
from todopagoconnector import TodoPagoConnector
from user import User

user = User("Gustavo", "123")
print user.getData()

tp = TodoPagoConnector(None, "test")
print tp._end_point_rest
コード例 #12
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))
コード例 #13
0
ファイル: prueba.py プロジェクト: gustavoghioldi/sdk-py
    'OPERATIONID': "ABCDEF-1234-12221-FDE1-00000200",
    'CURRENCYCODE': "032",
    'AMOUNT': "50"
}

optionsGAA = {
    'Security': '1234567890ABCDEF1234567890ABCDEF',
    'Merchant': "305",
    'RequestKey': '8496472a-8c87-e35b-dcf2-94d5e31eb12f',
    'AnswerKey': '8496472a-8c87-e35b-dcf2-94d5e31eb12f'
}

optionsGAPM = {'MERCHANT': '305'}
optionsGS = {'MERCHANT': '305', 'OPERATIONID': '141120084707'}

j_header_http = {
    'Authorization': 'PRISMA 912EC803B2CE49E4A541068D495AB570',
}

j_wsdls = {
    'Operations': 'http://localhost:8280/services/Operations?wsdl',
    'Authorize': 'http://localhost:8280/services/Authorize?wsdl',
    'PaymentMethods': 'http://localhost:8280/services/PaymentMethods?wsdl'
}

tpc = TodoPagoConnector(j_header_http, j_wsdls,
                        'http://localhost:8280/services/')
print tpc.sendAuthorizeRequest(optionsSAR_comercio, optionsSAR_operacion)
print tpc.getAuthorizeAnswer(optionsGAA)
print tpc.getAllPaymentMethods(optionsGAPM)
print tpc.getStatus(optionsGS)
コード例 #14
0
ファイル: prueba.py プロジェクト: TodoPago/SDK-Python
"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))