1.1.0 • Published 4 months ago

lemonway v1.1.0

Weekly downloads
17
License
MIT
Repository
github
Last release
4 months ago

Lemonway SDK

Usage

Create a new wallet and credit it by card

var Lemonway = require('lemonway');

var lemonway = new Lemonway(login, pass, JSONEndpoint);

lemonway.Wallet.create(ip, {
  id: id,
  email: client.mail,
  firstName: client.firstName,
  lastName: client.lastName,
  birthdate: client.birthdate
}).then(function (wallet) {
  return wallet.moneyIn(ip, {
    amount: amount,
    cardNumber: client.cardNumber,
    cardCrypto: client.cardCrypto,
    cardDate: client.cardDate,
    autoCommission: true
  });
}).then(function (transaction) {
  ...
});

Get a wallet and credit it by card using 3D Secure

var Lemonway = require('lemonway');

var lemonway = new Lemonway(login, pass, JSONEndpoint);

lemonway.Wallet.get(req, walletId)
  .then(function (wallet) {
    return wallet.moneyIn3DInit(req, {
      amount: amount,
      cardNumber: client.cardNumber,
      cardCrypto: client.cardCrypto,
      cardDate: client.cardDate,
      autoCommission: true,
      returnUrl: 'https://your-service/your-return-path'
    });
}).spread(function (acs, transaction) {
  // redirect the client to acs.actionUrl
});

List input transactions

var Lemonway = require('lemonway');

var lemonway = new Lemonway(login, pass, JSONEndpoint);

lemonway.Transaction.list(req)
  .then(function (transactions) {
    ...
  });

Upload a KYC File

var Lemonway = require('lemonway');

var lemonway = new Lemonway(login, pass, JSONEndpoint, WebkitURL);

lemonway.Wallet.get(req, walletId)
  .then(function (wallet) {
    return wallet.uploadFile(req, {
      fileName: 'RIB.png',
      type: 'RIB',
      filePath: './test/wallet/RIB.png'
    });
  });

API

Lemonway(login, pass, JSONEndpoint, webKitUrl) -> lemonway

Create a new lemonway instance

argtyperequireddescription
loginstringtrueyour lemonway login
passstringtrueyour lemonway password
JSONEndpointstringtrueyour lemonway JSON endpoint
webKitUrlstringtrueyour lemonway webkit Url

lemonway.Wallet.create(ip, opts) -> Promise<wallet>

Create a new Wallet and return a promise that resolve to the new wallet

argtyperequireddescription
optsobjecttrue
opts.idstringtrueexternal id (must be unique)
opts.emailstringtrueclient email address (must be unique)
opts.firstNamestringtrueclient first name
opts.lastNamestringtrueclient last name
opts.titlestringfalseclient title (can be M, F, J or U)
opts.streetstringfalse
opts.postCodestringfalse
opts.citystringfalseclient city of residence
opts.countrystringfalseclient country of residence
opts.phoneNumberstringfalse
opts.mobileNumberstringfalse
opts.birthdatestringfalseformat DD/MM/YYYY
opts.isCompanyboolfalse
opts.companyNamestringfalse
opts.companyWebsitestringfalse
opts.companyDescriptionstringfalse
opts.companyIdentificationNumberstringfalse
opts.isDebtorstringfalse
opts.nationalitystringfalse
opts.birthCitystringfalse
opts.birthCountrystringfalse
opts.payerOrBeneficiaryboolfalse
opts.isOneTimeCustomerboolfalse

lemonway.Wallet.update(ip, wallet, opts) -> Promise<wallet>

Update a wallet and return a promise to the updated wallet

argtyperequireddescription
walletWallet or stringtrueCan be a wallet instance or just a wallet id
optsobjecttrue
opts.emailstringtrueclient email address
opts.firstNamestringtrueclient first name
opts.lastNamestringtrueclient last name
opts.titlestringfalseclient title (can be M, F, J or U)
opts.streetstringfalse
opts.postCodestringfalse
opts.citystringfalseclient city of residence
opts.countrystringfalseclient country of residence
opts.phoneNumberstringfalse
opts.mobileNumberstringfalse
opts.birthdatestringfalseformat DD/MM/YYYY
opts.isCompanyboolfalse
opts.companyNamestringfalse
opts.companyWebsitestringfalse
opts.companyDescriptionstringfalse
opts.companyIdentificationNumberstringfalse
opts.isDebtorstringfalse
opts.nationalitystringfalse
opts.birthCitystringfalse
opts.birthCountrystringfalse

lemonway.Wallet.get(ip, id) -> Promise<{ wallet, documents: [], ibans: [], sddMandates: [], creditCards: [] }>

Get a wallet and its attached data by id

argtyperequireddescription
idstringtruewallet id

lemonway.Wallet.list(ip, opts) -> Promise<[wallet]>

List wallet where amount changed after 'from'

argtyperequireddescription
opts.fromdatefalsedefault to 0

lemonway.Wallet.uploadFile(ip, wallet, opts) -> Promise<document>

Upload a KYC file to Lemonway

argtyperequireddescription
walletid or wallettruea wallet or a wallet id
opts.fileNamestringtrue
opts.typestringtruethe file type, can be ID from identity documents, PROOF_OF_ADDRESS, RIB or KBIS
opts.filestring or buffertruea string of a base64 file content or a node buffer, optional if filePath is set
opts.filePathstringtruethe path to the file to upload, optional if file is set

lemonway.Wallet.listKyc(ip, opts) -> Promise<[{wallet, documents: [document], ibans: [iban], sddMandates: [sddMandate]}]>

List kyc

argtyperequireddescription
ipstringtrueorigin ip
opts.fromdatefalsedate to list from, default to 0

lemonway.Wallet.getWalletTransHistory(ip, wallet, opts) -> Promise<[transaction]>

List the wallet transaction history

argtyperequireddescription
opts.fromdatefalsedate to list from, default to 0
opts.todatefalsedate to list until, default to now

lemonway.Wallet.moneyIn(ip, wallet, opts) -> Promise<transaction>

Credit a wallet via credit card WITHOUT 3D secure

argtyperequireddescription
walletid or wallettruea wallet or a wallet id
opts.cardNumberstringtrue
opts.cardCryptostringtrue
opts.cardExpirationstringtrue
opts.amountfloattrueThe amount to be credited
opts.commissionfloatfalseThe commission amount, default to 0
opts.autoCommissionbooltrue
opts.isPreAuthboolfalse
opts.delayedDaysintfalse
opts.tokenstringfalsean optional id token

lemonway.Wallet.moneyIn3DInit(ip, wallet, opts) -> Promise<{acs, transaction}>

Credit a wallet via credit card with 3D secure

argtyperequireddescription
walletid or wallettruea wallet or a wallet id
opts.cardNumberstringtrue
opts.cardCryptostringtrue
opts.cardExpirationstringtrue
opts.amountfloattrueThe amount to be credited
opts.commissionfloatfalseThe commission amount, default to 0
opts.autoCommissionbooltrue
opts.tokenstringfalsean optional id token
opts.returnUrlstringtruereturn URL after the Atos 3D secure process

lemonway.Transaction.moneyIn3DConfirm(ip, transaction, opts) -> Promise<{acs, transaction}>

Confirm a 3D secure payment process

argtyperequireddescription
transactionid or transactiontruea transaction or a transaction id
opts.isPreAuthboolfalse
opts.delayedDaysintfalse

lemonway.Transaction.moneyIn3DAuthenticate(ip, transaction) -> Promise<moneyIn>

Confirm that a transaction was done with 3D secure enabled

argtyperequireddescription
walletid or wallettruea wallet or a wallet id
opts.isPreAuthboolfalse
opts.delayedDaysintfalse

lemonway.Wallet.registerCard(ip, wallet, opts) -> Promise<card>

Attach a card to a wallet

argtyperequireddescription
walletid or wallettruea wallet or a wallet id
opts.cardNumberstringtrue
opts.cardCryptostringtrue
opts.cardExpirationstringtrue

lemonway.Wallet.unregisterCard(ip, wallet, card) -> Promise<card>

Detach a card from wallet

argtyperequireddescription
walletid or wallettruea wallet or a wallet id
cardid or cardtruea card or a card id

lemonway.Wallet.moneyInWithCardId(ip, wallet, card, opts) -> Promise<transaction>

Credit a wallet via a registered card

argtyperequireddescription
walletid or wallettruea wallet or a wallet id
cardid or cardtruea card or a card id
opts.amountfloattrueamount to credit
opts.commissionfloatfalse
opts.messagefloatfalse
opts.autoCommissionbooltrue
opts.isPreAuthbooltrue
opts.delayedDaysintfalse
opts.tokenstringfalse

lemonway.Transaction.moneyInValidate(ip, transaction) -> Promise<transaction>

Validate a pre-auth transaction

argtyperequireddescription
transactionid or transactiontruea transaction or a transaction id

lemonway.Wallet.registerSDDMandate(ip, wallet, opts) -> Promise<sddMandate>

Register a debit mandate

argtyperequireddescription
walletid or wallettruea wallet or a wallet id
opts.holderstringtruethe bank account holder
opts.bicstringtrueBIC code
opts.ibanstringtrue
opts.isRecurringbooltrue
opts.streetstringfalsemandatory to sign a mandate
opts.postCodestringfalsemandatory to sign a mandate
opts.citystringfalsemandatory to sign a mandate
opts.countrystringfalsemandatory to sign a mandate
opts.mandateLanguagestringfalsemandate language, can be 'fr', 'es' or 'de', default to 'fr'

lemonway.Wallet.unregisterSDDMandate(ip, wallet, mandate) -> Promise<sddMandate>

Unregister a mandate

argtyperequireddescription
walletid or wallettruea wallet or a wallet id
mandateid or mandatetruea mandate or a mandate id

lemonway.Wallet.signDocumentInit(ip, wallet, mandate, opts) -> Promise<{token, redirectUrl}>

Init a document signature, return a redirectUrl to which you should redirect you client

argtyperequireddescription
walletid or wallettruea wallet or a wallet id
mandateid or mandatetruea mandate or a mandate id
mobileNumberstringtruethe client mobile number, is mandatory since the client will receive a confirmation code via SMS
returnUrlstringtruethe client will be redirected to this URL in case of success
errorUrlstringtruethe client will be redirected to this URL in case of failure

lemonway.Wallet.moneyInSddInit(ip, wallet, mandate, opts) -> Promise<transaction>

Credit a wallet via a previously signed sdd mandate

argtyperequireddescription
walletid or wallettruea wallet or a wallet id
mandateid or mandatetruea mandate or a mandate id
amountfloattrue
commissionfloatfalse
autoCommissionbooltrue
collectionDatedatefalsedefault to now

lemonway.Wallet.moneyInChequeInit(ip, wallet, opts) -> Promise<transaction>

Pre-register a cheque, you still have to send the document to Lemonway

argtyperequireddescription
walletid or wallettruea wallet or a wallet id
amountfloattrue
commissionfloatfalse
autoCommissionbooltrue

lemonway.Wallet.registerIBAN(ip, wallet, opts) -> Promise<iban>

Attach an iban to a wallet

argtyperequireddescription
walletid or wallettruea wallet or a wallet id
holderstringtrueiban holder
bicstringfalsenot mandatory if its a french iban
ibanstringtrue
dom1stringfalse
dom2stringfalse
commentstringfalse

lemonway.Wallet.moneyOut(ip, wallet, iban, opts) -> Promise<transaction>

Attach an iban to a wallet

argtyperequireddescription
walletid or wallettruea wallet or a wallet id
ibanid or wallettruean iban or an iban id
amountfloattrue
commissionfloatfalse
autoCommissionbooltrue
messagestringfalse

lemonway.Wallet.sendPayment(ip, fromWallet, toWallet, opts) -> Promise<transaction>

P2P payment, send a payment from a wallet to another wallet

argtyperequireddescription
fromWalletid or wallettruea wallet or a wallet id
toWalletid or wallettruea wallet or a wallet id
amountfloattrue
messagestringfalse
scheduleDatedatefalse
privateDatastringfalseadditional data

lemonway.Transaction.get(ip, id, opts) -> Promise<transaction>

Get a transaction by id

argtyperequireddescription
idstringtruepayment id
optsobjecttrue
opts.walletIpstringtrueClient ip
opts.walletUastringfalseClient user agent

lemonway.Transaction.list(ip, opts) -> Promise<[transaction]>

lemonway.Transaction.list(ip, opts) -> Promise<[transaction]>

List input transaction

argtyperequireddescription
optsobjectfalse
opts.beforedatefalse
opts.afterdatefalse

lemonway.MoneyIn.get(ip, id, opts) -> Promise<moneyIn>

lemonway.MoneyIn.get(ip, id, opts) -> Promise<moneyIn>

Get a money in

argtyperequireddescription
idstringtruewallet id
optsobjecttrue
opts.walletIpstringtrueClient ip
opts.walletUastringfalseClient user agent

lemonway.MoneyOut.get(ip, id, opts) -> Promise<moneyOut>

lemonway.MoneyOut.get(ip, id, opts) -> Promise<moneyOut>

Get a money out

argtyperequireddescription
idstringtruewallet id
optsobjecttrue
opts.walletIpstringtrueClient ip
opts.walletUastringfalseClient user agent

lemonway.Wallet.list(ip, opts) -> Promise<[wallet, ...]>

lemonway.Wallet.list(ip, opts) -> Promise<[wallet, ...]>

List wallets

argtyperequireddescription
optsobjecttrue
opts.walletIpstringtrueClient ip
opts.walletUastringfalseClient user agent

lemonway.Wallet.registerCard(ip, wallet, opts) -> Promise<card>

lemonway.Wallet.registerCard(ip, wallet, opts) -> Promise<card>

Register and link a card to a wallet

argtyperequireddescription
walletWallet or stringtrueCan be a wallet instance or just a wallet id
optsobjecttrue
opts.walletIpstringtrueClient ip
opts.walletUastringfalseClient user agent
opts.cardNumberstringtrue
opts.cardCodestringtrue
opts.cardDatestringtrue

lemonway.Wallet.unregisterCard(ip, wallet, card, opts) -> Promise<card>

lemonway.Wallet.unregisterCard(ip, wallet, card, opts) -> Promise<card>

Unregister and link a card to a wallet

argtyperequireddescription
walletWallet or stringtrueCan be a wallet instance or just a wallet id
cardCard or stringtrueCan be a card instance or just a card id
optsobjecttrue
opts.walletIpstringtrueClient ip
opts.walletUastringfalseClient user agent

lemonway.getWizypayAds(ip, opts) -> Promise<[[wizypayOffer], [wizypayAd]]>

lemonway.getWizypayAds(ip, opts) -> Promise<[[wizypayOffer], [wizypayAd]]>

Get wizypay ads

argtyperequireddescription
optsobjecttrue
opts.walletIpstringtrueClient ip
opts.walletUastringfalseClient user agent

Models

Wallet

  • id -> string
  • lemonWayId -> string
  • balance -> float
  • name -> string
  • email -> string
  • status -> string
  • blocked -> string
  • method -> string
  • documents -> [Document]
  • ibans -> [IBAN]
  • sddMandates -> [SDDMandate]
  • update -> (opts) -> Promise<Wallet>
  • updateStatus -> (opts) -> Promise<Wallet>
  • moneyIn -> (opts) -> Promise<Transaction>
  • moneyIn3DInit -> (opts) -> Promise<Transaction>
  • registerCard -> (opts) -> Promise<Card>
  • unregisterCard -> (card) -> Promise<Card>
  • moneyInWithCardId -> (card, opts) -> Promise<Transaction>
  • registerIBAN -> (opts) -> Promise<IBAN>
  • registerSDDMandate -> (opts) -> Promise<mandate>
  • moneyInSDDInit -> (mandate, opts) -> Promise<transaction>
  • moneyInChequeInit -> (opts) -> Promise<transaction>
  • moneyOut -> (iban, opts) -> Promise<transaction>
  • sendPayment -> (toWallet, opts) -> Promise<transaction>
  • createVCC -> (opts) -> Promise<{transaction, vcc}>
  • uploadFile -> (opts) -> Promise<Document>
  • listTransactions -> (opts) -> Promise<[transaction]>

ACS

  • actionUrl -> string|undefined
  • actionMethod -> string|undefined
  • pareqFieldName -> string|undefined
  • pareqFieldValue -> string|undefined
  • termurlFieldName -> string|undefined
  • mdFieldName -> string|undefined
  • mdFieldValue -> string|undefined
  • mpiResult -> string|undefined

Card

  • id -> string
  • is3DSecure -> boolean|undefined
  • country -> string|undefined
  • authorizationNumber -> string|undefined
  • cardNumber -> string|undefined
  • expirationDate -> string|undefined

Document

  • id -> string
  • status -> string|undefined
  • type -> string|undefined
  • validityDate -> string|undefined

IBAN

  • id -> string
  • status -> string|undefined
  • iban -> string
  • swift -> string
  • holder -> string

MoneyIn

  • id -> string
  • O3DCode -> string|undefined

SDDMandate

  • id -> string
  • status -> string
  • iban -> string
  • swift -> string

Transaction

  • id -> string
  • date -> Date|undefined
  • debitedWallet -> string|undefined
  • creditedWallet -> string|undefined
  • amountDebited -> number|undefined
  • amountCredited -> number|undefined
  • fee -> number|undefined
  • amazonGiftCode -> string|undefined
  • message -> string|undefined
  • status -> string|undefined
  • IBANUsed -> string|undefined
  • lemonwayMessage -> string|undefined
  • bankReference -> string|undefined
  • virtualCreditCard -> VirtualCreditCard|undefined
  • moneyIn -> MoneyIn|undefined
  • card -> Card|undefined
  • extra -> object|undefined
  • extra.is3DSecure -> boolean|undefined
  • extra.country -> string|undefined
  • extra.authorizationNumber -> string|undefined
  • iban -> IBAN|undefined
  • getPaymentDetails -> (userInfo) -> Promise<Transaction>

VirtualCreditCard

  • id -> string|undefined
  • number -> string|undefined
  • expirationDate -> string|undefined
  • cvx -> string|undefined
1.1.0

4 months ago

1.0.0

5 months ago

0.12.0

1 year ago

0.11.0

1 year ago

0.10.1

2 years ago

0.10.0

2 years ago

0.9.1

3 years ago

0.9.0

3 years ago

0.8.0

4 years ago

0.7.0

4 years ago

0.6.1

4 years ago

0.6.0

4 years ago

0.5.0

4 years ago

0.4.0

4 years ago

0.3.0

5 years ago

0.2.14

7 years ago

0.2.13

7 years ago

0.2.12

7 years ago

0.2.11

8 years ago

0.2.10

8 years ago

0.2.9

8 years ago

0.2.8

8 years ago

0.2.7

8 years ago

0.2.6

8 years ago

0.2.5

8 years ago

0.2.4

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.0

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.1

8 years ago