Coder Social home page Coder Social logo

adriens / tickets-resto-nc-sdk Goto Github PK

View Code? Open in Web Editor NEW
1.0 5.0 5.0 208 KB

Implémentation Java de l'API de https://www.neocarte.nc

License: GNU Lesser General Public License v3.0

Java 100.00%
tickets restaurant nouvelle-caledonie api sdk java nc htmlunit

tickets-resto-nc-sdk's Introduction

Build Status Join the chat at https://gitter.im/tickets-resto-nc-api/Lobby

tickets-resto-nc-sdk

Implémentation Java de l'API du site Web des tickets restaurants de Nouvelle-Calédonie (https://www.neocarte.nc).

Actuellement il n'existe pas d'API pour interagir avec ce sîte Web : cela est maintenant possible.

Application mobile

Use case

Pour recuperer les datas, tout simplement :

        String login = "xxxxxxxxx";
        String password = "xxxxxx";
           
        TicketsRestaurantsServiceWrapper wrap = new TicketsRestaurantsServiceWrapper(login, password, ServiceType.BOTH);
	// now deal with with account, credit, transactions ;-p
	logger.info("################################################");
	logger.info("Solde (XPF) : " + wrap.getAccountBalance());
	logger.info("Employeur : " + wrap.getAccountEmployeer());
	logger.info("Beneficiaire : " + wrap.getAccountName());
	logger.info("################################################");

	// Listing transactions
	logger.info("################################################");
	logger.info("Transactions :\n");
	Iterator<Transaction> iter = wrap.getTransactions().iterator();

	while (iter.hasNext()) {
	    logger.info(iter.next().toString());
        }
	logger.info("################################################");

Output :

################################################
Solde (XPF) : 21310
Employeur : MAIRIE DE NOUMEA
Beneficiaire : MR ADRIEN SALES
Transactions :

Date : Mon Apr 24 00:00:00 SBT 2017 (Recharge)
Date : Fri Apr 14 00:00:00 SBT 2017 (Transaction CHAMPION N'GEA)
Date : Tue Apr 04 00:00:00 SBT 2017 (Transaction CHAMPION N'GEA)
Date : Fri Mar 31 00:00:00 SBT 2017 (Recharge)
Date : Wed Mar 29 00:00:00 SBT 2017 (Recharge)
################################################


Récupération des affiliés

ArrayList<Affilie> affilies = TicketsRestaurantsServiceWrapper.getAffilies();
Iterator<Affilie> affIter = affilies.iterator();
Affilie aff = new Affilie();
            
logger.info("Affilies :\n");
while(affIter.hasNext()){
    aff =  affIter.next();
    logger.info(aff.toString());
}

Use this lib in your project

Follow jitpack instructions, see https://jitpack.io/#adriens/tickets-resto-nc-api

Motivations

  • Deal with htmlunit
  • Deal with Apache POI
  • Discover advanced features of Google Spreadsheets : dashboatd, reporting, mobile apps based on spreadsheets, ...
  • Getting fun as we gain the power on the data

tickets-resto-nc-sdk's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tickets-resto-nc-sdk's Issues

Cleanup logs

remove sysouts
setup debug, info warn and error logs level

Problème de synchro et impossible de se reconnecter à l'appli

Hello :)

Depuis mi-août la synchro ne marche plus et lorsque j'essaie de me reconnecter à l'appli j'ai le message d'erreur suivant : "Mot de passe ou identifiant incorrect".

Sur le site http://www.ticketrestaurant.nc/ ma connexion fonctionne très bien, le seul changement c'est ce message d'information :

tickets-resto-nc

Je me connecte toujours avec l'identifiant à 7 chiffres et j'ai testé avec 2 cartes TR différentes sur 2 appareils différents, le résultat est le même.

D'avance merci :)
Ioana

Implement unit tests

...to monitor that the SDK is still OK with web site
Build should be also croned on Travis to ckeck this on a daily basis

test :

  • solde
  • transaction
  • partners list
  • pdf of partners

Fichier login/mdp à externaliser

Pour le main de la classe Main.java, il faudrait pouvoir passer en paramètre un fichier de propriété du login/mdp. Ce fichier sera ajouté au gitgnore afin de ne pas etre commité.

Gérer le proxy dans le classes de l'api

Actuellement, pour que ça marche derrière le proxy, il faut dans le main (ou dans la jvm) positionner les variables

            System.setProperty("http.proxyHost", "proxyweb");
            System.setProperty("http.proxyPort", "3128");
            
            System.setProperty("http.proxyUser", "salad74");
            System.setProperty("http.proxyPassword", "xxxxxxxx");

Export xslsx Affilie > typer la colonne en formule

public class HyperlinkFormula {
    public static void main(String[] args) throws IOException {
    	HSSFWorkbook wb = new HSSFWorkbook();
        HSSFSheet sheet = wb.createSheet("new sheet");
        HSSFRow row = sheet.createRow(0);

        HSSFCell cell = row.createCell(0);
        cell.setCellType(CellType.FORMULA);
        cell.setCellFormula("HYPERLINK(\"http://127.0.0.1:8080/toto/truc/index.html?test=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\", \"test\")");

        FileOutputStream fileOut = new FileOutputStream("workbook.xls");
        wb.write(fileOut);
        fileOut.close();
        wb.close();
    }
}

Incohérences entre solde et transactions

Lorsque l'on caclule le solde à partir des transactions, le résultat ne matche pas du tout.
Il faut comprendre pourquoi, ça ressemble à un bug sur le site des tickets restaurants

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.