cmcic

Payments module for CIC bank, Credit Mutuel and OBC Bank

npm install cmcic
8 downloads in the last week
14 downloads in the last month

CMCIC

Build Status Coverage Status Dependency Status NPM version

NPM

How-to use

var cmcic = require('cmcic');

var tpe = new cmcic.tpe({
    CMCIC_TPE: 'tpeid',
    CMCIC_CODESOCIETE: 'societykey',
    CMCIC_CLE: '1234567890abcdef',
    CMCIC_BANK: 'CIC',
    CMCIC_LNG: 'FR',
    CMCIC_CURRENCY: 'EUR',
    CMCIC_URL_RETOUR: '/url/return',
    CMCIC_URLOK: '/url/ok',
    CMCIC_URLKO: '/url/ko'
});

var t = {
    email: 'exemple@exemple.fr',
    amount: 300,
    reference: 'qwerty'
};

var trans = new cmcic.transaction(tpe, t);

// if you use expressjs

res.send(trans.form('paimentid', true));

On your return url (still with expressjs)

var ret = tpe.checkTransactionReturn((req.method == 'POST')? req.body : req.query);
if (ret.status) {
    console.error('Payment is ok');
    res.send(tpe.RETURN_OK);
} else {
    console.error('Payment is fail : ', ret.motifrefus );
    res.send(tpe.RETURN_NOTOK);
}

Tips

For handle different kind of payment with the same TPE, you can use the 'texte-libre' field ! You can use 'texte-libre' field like an object, it ll be stringified/parsed for you.

Coding Style

  • tabulation (4 width)
  • JsHint

TODO

https://github.com/PierrickP/cmcic/issues?labels=new-feature&page=1&state=open

License

Under MIT license, feel free to contribuate with fork and PR !

npm loves you