Commit 032f3130 authored by Edouard Lambert's avatar Edouard Lambert Committed by Vincent A

[swile] rename lunchr to swile

parent a060c8c3
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .module import LunchrModule from .module import SwileModule
__all__ = ['LunchrModule'] __all__ = ['SwileModule']
...@@ -34,13 +34,13 @@ from weboob.browser.browsers import APIBrowser ...@@ -34,13 +34,13 @@ from weboob.browser.browsers import APIBrowser
from weboob.capabilities.bank import Account, Transaction from weboob.capabilities.bank import Account, Transaction
class LunchrBrowser(APIBrowser): class SwileBrowser(APIBrowser):
BASEURL = 'https://api.lunchr.fr' BASEURL = 'https://customer-api.swile.co'
def __init__(self, login, password, *args, **kwargs): def __init__(self, login, password, *args, **kwargs):
"""LunchrBrowser needs login and password to fetch Lunchr API""" """SwileBrowser needs login and password to fetch Swile API"""
super(LunchrBrowser, self).__init__(*args, **kwargs) super(SwileBrowser, self).__init__(*args, **kwargs)
# self.session.headers are the HTTP headers for Lunchr API requests # self.session.headers are the HTTP headers for Swile API requests
self.session.headers['x-api-key'] = '644a4ef497286a229aaf8205c2dc12a9086310a8' self.session.headers['x-api-key'] = '644a4ef497286a229aaf8205c2dc12a9086310a8'
self.session.headers['x-lunchr-app-version'] = 'b6c6ca66c79ca059222779fe8f1ac98c8485b9f0' self.session.headers['x-lunchr-app-version'] = 'b6c6ca66c79ca059222779fe8f1ac98c8485b9f0'
self.session.headers['x-lunchr-platform'] = 'web' self.session.headers['x-lunchr-platform'] = 'web'
...@@ -53,7 +53,7 @@ class LunchrBrowser(APIBrowser): ...@@ -53,7 +53,7 @@ class LunchrBrowser(APIBrowser):
} }
def _auth(self): def _auth(self):
"""Authenticate to Lunchr API using self.credentials. """Authenticate to Swile API using self.credentials.
If authentication succeeds, authorization header is set in self.headers If authentication succeeds, authorization header is set in self.headers
and response's json payload is returned unwrapped into dictionary. and response's json payload is returned unwrapped into dictionary.
""" """
...@@ -74,7 +74,7 @@ class LunchrBrowser(APIBrowser): ...@@ -74,7 +74,7 @@ class LunchrBrowser(APIBrowser):
account = Account(id=Dict('id')(json)) account = Account(id=Dict('id')(json))
account.number = account.id account.number = account.id
# weboob.capabilities.bank.BaseAccount # weboob.capabilities.bank.BaseAccount
account.bank_name = 'Lunchr' account.bank_name = 'Swile'
account.type = Account.TYPE_CHECKING account.type = Account.TYPE_CHECKING
...@@ -139,7 +139,7 @@ class LunchrBrowser(APIBrowser): ...@@ -139,7 +139,7 @@ class LunchrBrowser(APIBrowser):
transaction.rdate = DateTime(Dict('created_at'))(payment) transaction.rdate = DateTime(Dict('created_at'))(payment)
types = { types = {
'ORDER': Transaction.TYPE_CARD, # order on lunchr website 'ORDER': Transaction.TYPE_CARD, # order on swile website
'LUNCHR_CARD_PAYMENT': Transaction.TYPE_CARD, # pay in shop 'LUNCHR_CARD_PAYMENT': Transaction.TYPE_CARD, # pay in shop
'MEAL_VOUCHER_CREDIT': Transaction.TYPE_DEPOSIT, 'MEAL_VOUCHER_CREDIT': Transaction.TYPE_DEPOSIT,
# type can be null for refunds # type can be null for refunds
......
...@@ -23,20 +23,20 @@ from weboob.tools.backend import Module, BackendConfig ...@@ -23,20 +23,20 @@ from weboob.tools.backend import Module, BackendConfig
from weboob.tools.value import ValueBackendPassword from weboob.tools.value import ValueBackendPassword
from weboob.capabilities.bank import CapBank from weboob.capabilities.bank import CapBank
from .browser import LunchrBrowser from .browser import SwileBrowser
__all__ = ['LunchrModule'] __all__ = ['SwileModule']
class LunchrModule(Module, CapBank): class SwileModule(Module, CapBank):
NAME = 'lunchr' NAME = 'swile'
DESCRIPTION = 'Lunchr' DESCRIPTION = 'Swile'
MAINTAINER = 'Roger Philibert' MAINTAINER = 'Roger Philibert'
EMAIL = 'roger.philibert@gmail.com' EMAIL = 'roger.philibert@gmail.com'
LICENSE = 'LGPLv3+' LICENSE = 'LGPLv3+'
VERSION = '2.1' VERSION = '2.1'
BROWSER = LunchrBrowser BROWSER = SwileBrowser
CONFIG = BackendConfig( CONFIG = BackendConfig(
ValueBackendPassword('login', label='E-mail', masked=False), ValueBackendPassword('login', label='E-mail', masked=False),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment