mirror of
https://github.com/OCA/bank-statement-import.git
synced 2025-01-20 12:37:43 +02:00
[ADD] account_statement_import_online_gocardless
This module provides online bank statements from GoCardless Bank Account Data, which provides a free API for connecting and getting transactions for bank accounts. TT45760 Co-Authored-By: Christopher Ormaza <chris.ormaza@forgeflow.com> Co-Authored-By: Jordi Ballester <jordi.ballester@forgeflow.com>
This commit is contained in:
committed by
Enric Tobella
parent
b92378f878
commit
29f1ace32e
@@ -0,0 +1,35 @@
|
||||
# Copyright 2022 ForgeFlow S.L.
|
||||
# Copyright 2023 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
import werkzeug
|
||||
from werkzeug.urls import url_encode
|
||||
|
||||
from odoo import http
|
||||
from odoo.http import request
|
||||
|
||||
|
||||
class GocardlessController(http.Controller):
|
||||
@http.route("/gocardless/response", type="http", auth="public", csrf=False)
|
||||
def gocardless_response(self, **post):
|
||||
Provider = request.env["online.bank.statement.provider"].sudo()
|
||||
current_provider = Provider.search(
|
||||
[("gocardless_requisition_ref", "=", post["ref"])]
|
||||
)
|
||||
params = {
|
||||
"action": request.env.ref(
|
||||
"account_statement_import_online.online_bank_statement_provider_action"
|
||||
).id,
|
||||
"model": "online.bank.statement.provider",
|
||||
}
|
||||
if current_provider:
|
||||
current_provider._gocardless_finish_requisition()
|
||||
params.update(
|
||||
{
|
||||
"view_type": "form",
|
||||
"id": current_provider.id,
|
||||
}
|
||||
)
|
||||
else:
|
||||
params["view_type"] = "list"
|
||||
return werkzeug.utils.redirect("/web#" + url_encode(params), 303)
|
||||
Reference in New Issue
Block a user