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 @@
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
from weboob.capabilities.bank import Account, Transaction
class LunchrBrowser(APIBrowser):
BASEURL = 'https://api.lunchr.fr'
class SwileBrowser(APIBrowser):
BASEURL = 'https://customer-api.swile.co'
def __init__(self, login, password, *args, **kwargs):
"""LunchrBrowser needs login and password to fetch Lunchr API"""
super(LunchrBrowser, self).__init__(*args, **kwargs)
# self.session.headers are the HTTP headers for Lunchr API requests
"""SwileBrowser needs login and password to fetch Swile API"""
super(SwileBrowser, self).__init__(*args, **kwargs)
# self.session.headers are the HTTP headers for Swile API requests
self.session.headers['x-api-key'] = '644a4ef497286a229aaf8205c2dc12a9086310a8'
self.session.headers['x-lunchr-app-version'] = 'b6c6ca66c79ca059222779fe8f1ac98c8485b9f0'
self.session.headers['x-lunchr-platform'] = 'web'
......@@ -53,7 +53,7 @@ class LunchrBrowser(APIBrowser):
}
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
and response's json payload is returned unwrapped into dictionary.
"""
......@@ -74,7 +74,7 @@ class LunchrBrowser(APIBrowser):
account = Account(id=Dict('id')(json))
account.number = account.id
# weboob.capabilities.bank.BaseAccount
account.bank_name = 'Lunchr'
account.bank_name = 'Swile'
account.type = Account.TYPE_CHECKING
......@@ -139,7 +139,7 @@ class LunchrBrowser(APIBrowser):
transaction.rdate = DateTime(Dict('created_at'))(payment)
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
'MEAL_VOUCHER_CREDIT': Transaction.TYPE_DEPOSIT,
# type can be null for refunds
......
......@@ -23,20 +23,20 @@ from weboob.tools.backend import Module, BackendConfig
from weboob.tools.value import ValueBackendPassword
from weboob.capabilities.bank import CapBank
from .browser import LunchrBrowser
from .browser import SwileBrowser
__all__ = ['LunchrModule']
__all__ = ['SwileModule']
class LunchrModule(Module, CapBank):
NAME = 'lunchr'
DESCRIPTION = 'Lunchr'
class SwileModule(Module, CapBank):
NAME = 'swile'
DESCRIPTION = 'Swile'
MAINTAINER = 'Roger Philibert'
EMAIL = 'roger.philibert@gmail.com'
LICENSE = 'LGPLv3+'
VERSION = '2.1'
BROWSER = LunchrBrowser
BROWSER = SwileBrowser
CONFIG = BackendConfig(
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