# -​*- coding: utf-8 -*​-
YOUR_API_KEY = 'YOUR_API_KEY'
BANK_USERNAME = '******'
BANK_PASSWORD = '******'

import time
import sys
import paybook.sdk as paybook_sdk
try:
    paybook_sdk.Paybook(YOUR_API_KEY)
    user_list = paybook_sdk.User.get()
    user = user_list[0]
    print user.name + ' ' + user.id_user
    session = paybook_sdk.Session(user=user)
    print session.token
    bank_site = None
    sites = paybook_sdk.Catalogues.get_sites(session=session)
    for site in sites:
        print 'Bank site: ' + site.name + ' ' + site.id_site
        if site.name == 'SuperNET Particulares':
            bank_site = site
    CREDENTIALS = {
        'username': BANK_USERNAME,
        'password': BANK_PASSWORD
    }  #End of CREDENTIALS
    bank_credentials = paybook_sdk.Credentials(
        session=session,
        id_site='572930c4784806060f8b456b',
        credentials=CREDENTIALS)
    print 'Esperando validacion de credenciales ... '
    status_102_or_401 = None
Beispiel #2
0
# -​*- coding: utf-8 -*​-

import paybook
import paybook.sdk as paybook_sdk

try:
    INDENT = '   '
    PAYBOOK_API_KEY = 'YOUR_API_KEY'
    ID_USER = '******'

    step = 0

    print str(step) + '. Inicializar SDK con API KEY correcta:'
    paybook_sdk.Paybook(PAYBOOK_API_KEY)
    print INDENT + 'ok'
    step += 1

    print str(
        step
    ) + '. Crear un usuario a partir de id_user (consultar usuario existente)'
    session_user = paybook_sdk.User(id_user=ID_USER)
    print INDENT + 'username: '******' id_user: '******'. Crear una sesión para el usuario del paso 8'
    session = paybook_sdk.Session(session_user)
    print INDENT + 'token: ' + str(session.token)
    step += 1

    print str(step) + '. Verificar la sesión (debe ser valida)'
    session_verified = session.verify()
Beispiel #3
0
from json import dumps
import json
from flask import Flask, Response
from flask import request
from flask_cors import CORS, cross_origin
import logging
import utilities as _Utilities
import endpoints
import paybook
import paybook.sdk as paybook_sdk

cmd_params = _Utilities.get_cmd_params(sys.argv[1:])
paybook_api_key = cmd_params['api_key']
# database_path = cmd_params['database']

paybook_sdk.Paybook(paybook_api_key,print_calls=False)
print '\nSetting API Key to: ' + str(paybook_api_key)
print 'Server started successfully\n'
print 'Enjoy your Paybook SYNC experience V_0.1 \\0/\n\n'

# App:
app = Flask(__name__,static_folder='public')
CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'
app.secret_key = os.urandom(24)
logger = _Utilities.setup_logger('app')

@app.route('/', methods=['GET'])
def index():
	print 'endpoints.index'
	return endpoints.index()
Beispiel #4
0
    TEST_SITE_NAME = 'CIEC'  #For testing with SAT
    CREDENTIALS = {
        'rfc': 'SOME_RFC',
        'password': '******'
    }  #End of CREDENTIALS

    step = 0

    print '\n ******* PAYBOOK PYTHON LIBRARY UNIT TESTING SCRIPT ***** \n'

    step += 1

    print '\n -> INIT \n'

    print str(step) + '. Inicializar SDK con API KEY incorrecta:'
    paybook_sdk.Paybook('hola')
    print INDENT + 'ok'
    step += 1

    print str(step) + '. Hacer una llamada al API '
    try:
        user_list = paybook_sdk.User.get()
    except paybook_sdk.Error as error:
        print INDENT + 'error: ' + str(error.code) + ' ' + error.message
    step += 1

    print str(step) + '. Inicializar SDK con API KEY correcta:'
    paybook_sdk.Paybook(PAYBOOK_API_KEY)
    print INDENT + 'ok'
    step += 1
Beispiel #5
0
from json import dumps
import json
from flask import Flask, Response
from flask import request
from flask_cors import CORS, cross_origin
import logging
import utilities as _Utilities
import endpoints
import paybook
import paybook.sdk as paybook_sdk

cmd_params = _Utilities.get_cmd_params(sys.argv[1:])
paybook_api_key = cmd_params['api_key']
# database_path = cmd_params['database']

paybook_sdk.Paybook(paybook_api_key)
print '\nSetting API Key to: ' + str(paybook_api_key)
print 'Server started successfully\n'
print 'Enjoy your Paybook SYNC experience V_0.1 \\0/\n\n'

# App:
app = Flask(__name__, static_folder='public')
CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'
app.secret_key = os.urandom(24)
logger = _Utilities.setup_logger('app')


@app.route('/', methods=['GET'])
def index():
    print 'endpoints.index'
 def __init__(self):
     paybook_sdk.Paybook(API_KEY)
Beispiel #7
0
# -​*- coding: utf-8 -*​-
YOUR_API_KEY = 'YOUR_API_KEY'
RFC = 'YOUR_RFC'
CIEC = 'YOUR_CIEC'
import time
import sys
import paybook.sdk as paybook
try:
    paybook.Paybook(YOUR_API_KEY)
    user = paybook.User(name='MY_USER')
    my_users = paybook.User.get()
    for user in my_users:
        print user.name
    session = paybook.Session(user)
    print 'Session token: ' + session.token
    session_verified = session.verify()
    print 'Session verified: ' + str(session_verified)
    sat_site = None
    sites = paybook.Catalogues.get_sites(session=session)
    for site in sites:
        print site.name.encode('utf-8')
        if site.name == 'CIEC':
            sat_site = site
    print 'SAT site: ' + sat_site.id_site + ' ' + sat_site.id_site
    credentials_data = {'rfc': RFC, 'password': CIEC}
    sat_credentials = paybook.Credentials(session=session,
                                          id_site=sat_site.id_site,
                                          credentials=credentials_data)
    print sat_credentials.username
    sat_sync_completed = False
    while not sat_sync_completed: