| 1 |
# Part of Odoo. See LICENSE file for full copyright and licensing details. |
| 2 |
|
| 3 |
import werkzeug |
| 4 |
|
| 5 |
from odoo import http |
| 6 |
from odoo.addons.portal.controllers.portal import CustomerPortal |
| 7 |
from odoo.exceptions import AccessError, MissingError |
| 8 |
|
| 9 |
|
| 10 |
class EcpayInvoiceController(http.Controller): |
| 11 |
@http.route("/invoice/ecpay/agreed_invoice_allowance/<int:invoice_id>", type="http", methods=['POST'], auth="public", csrf=False) |
| 12 |
def agreed_invoice_allowance(self, invoice_id, access_token=None, **kwargs): |
| 13 |
try: |
| 14 |
invoice = CustomerPortal._document_check_access(self, 'account.move', invoice_id, access_token) |
| 15 |
except (AccessError, MissingError): |
| 16 |
raise werkzeug.exceptions.NotFound |
| 17 |
if invoice: |
| 18 |
invoice.l10n_tw_edi_refund_state = "agreed" if kwargs["RtnCode"] == "1" else "disagreed" |
| 19 |
return "200" |