diff --git a/account_payment_plaid/README.rst b/account_payment_plaid/README.rst new file mode 100644 index 000000000000..9faf07306e72 --- /dev/null +++ b/account_payment_plaid/README.rst @@ -0,0 +1,108 @@ +===================== +Account Payment Plaid +===================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:815525549c46556e7fa6a37a49653162624972fbba8a8888ed314f8841007cba + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github + :target: https://github.com/OCA/bank-payment/tree/14.0/account_payment_plaid + :alt: OCA/bank-payment +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/bank-payment-14-0/bank-payment-14-0-account_payment_plaid + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/bank-payment&target_branch=14.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This addon allow pay your bills with plaid platform using the ACH transfer method. +Do you need plaid account for use this module. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Using the Plaid API for bank transfers on production or development environment: + +#. Go to "Settings" > "Plaid". +#. Add your Plaid credentials. +#. Synchronize with Plaid. +#. Select your bank account. +#. Go to "Contacts" and add the plaid client id for the contact. +#. Go to your invoice and click on "Pay with Plaid" button.\nYou can see the button if the bill is confirmed.\nWhen you click on the button, you will see a confirmation window. +#. When you confirm the payment and the confirmation window\nis closed you can see the transfer in "Settings" > "Technical" > "Plaid" > "Transfer". +#. When the transfer is done, you can see the bill as paid and the payment create on odoo. + +If you are using the sandbox environment for testing, +do you need to use the simulation method for simulate the transfer. +This method only works with the sandbox environment. +You can found this method on "Settings" > "Technical" > "Plaid" > "Transfer". + +#. Select the transfer that you want to simulate. +#. Click on "Simulate Transfer" button. +#. Select the command that you want to simulate. + * "Simulate Transfer" : This command create a event on sandbox environment.\nDo you need this event for check the status of the transfer on Odoo. + * "Simulate transfer ledger available" : This command simulate converting pending balance\nto available balance for all originators in the Sandbox environment. +#. Click on "Confirm" button. + +This addon use the cron for check the status of the transfer on Plaid and update the bill and payment. +If you need more information about Plaid, please visit the `Plaid website `_ or `Plaid Docs Transfer `_. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Binhex + +Contributors +~~~~~~~~~~~~ + +* `Binhex _` + + * Adasat Torres de León + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/bank-payment `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_payment_plaid/__init__.py b/account_payment_plaid/__init__.py new file mode 100644 index 000000000000..134df274351c --- /dev/null +++ b/account_payment_plaid/__init__.py @@ -0,0 +1,2 @@ +from . import wizard +from . import models diff --git a/account_payment_plaid/__manifest__.py b/account_payment_plaid/__manifest__.py new file mode 100644 index 000000000000..6ed1f4dcd175 --- /dev/null +++ b/account_payment_plaid/__manifest__.py @@ -0,0 +1,27 @@ +# Copyright 2024 Binhex - Adasat Torres de León. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Account Payment Plaid", + "version": "14.0.1.0.0", + "category": "Connector", + "website": "https://github.com/OCA/bank-payment", + "author": "Binhex, Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": ["base", "account", "purchase"], + "data": [ + "security/ir.model.access.csv", + "views/assets.xml", + "views/account_move_views.xml", + "views/res_partner_views.xml", + "views/res_config_settings_views.xml", + "views/plaid_account_views.xml", + "views/plaid_transfer_views.xml", + "wizard/account_payment_plaid_wizard_views.xml", + "wizard/plaid_transfer_sandbox_simulation_wizard_views.xml", + "data/sync_transfer_events_cron.xml", + "data/payment_method_data.xml", + ], + "external_dependencies": { + "python": ["plaid-python"], + }, +} diff --git a/account_payment_plaid/data/payment_method_data.xml b/account_payment_plaid/data/payment_method_data.xml new file mode 100644 index 000000000000..3a400642d96d --- /dev/null +++ b/account_payment_plaid/data/payment_method_data.xml @@ -0,0 +1,10 @@ + + + + + Plaid + plaid + outbound + + + diff --git a/account_payment_plaid/data/sync_transfer_events_cron.xml b/account_payment_plaid/data/sync_transfer_events_cron.xml new file mode 100644 index 000000000000..ac651f3e8759 --- /dev/null +++ b/account_payment_plaid/data/sync_transfer_events_cron.xml @@ -0,0 +1,16 @@ + + + + + Sync Transfer Events + + 1 + minutes + -1 + code + + model.cron_sync_transfer_events() + + + + diff --git a/account_payment_plaid/models/__init__.py b/account_payment_plaid/models/__init__.py new file mode 100644 index 000000000000..b439ef490cee --- /dev/null +++ b/account_payment_plaid/models/__init__.py @@ -0,0 +1,7 @@ +from . import plaid_interface +from . import plaid_account +from . import plaid_transfer +from . import res_company +from . import res_config_settings +from . import res_partner +from . import account_move diff --git a/account_payment_plaid/models/account_move.py b/account_payment_plaid/models/account_move.py new file mode 100644 index 000000000000..1f48465678ae --- /dev/null +++ b/account_payment_plaid/models/account_move.py @@ -0,0 +1,24 @@ +from odoo import _, models + + +class AccountMove(models.Model): + + _inherit = "account.move" + + def action_payment_with_plaid_wizard(self): + return { + "type": "ir.actions.act_window", + "name": _("Payment with Plaid"), + "res_model": "account.payment.plaid.wizard", + "view_mode": "form", + "view_type": "form", + "context": { + "default_partner_id": self.partner_id.id, + "default_account_move_id": self.id, + "default_amount": self.amount_total, + "default_currency_id": self.currency_id.id, + "default_description": self.name, + "default_company_id": self.company_id.id, + }, + "target": "new", + } diff --git a/account_payment_plaid/models/plaid_account.py b/account_payment_plaid/models/plaid_account.py new file mode 100644 index 000000000000..12a81552f024 --- /dev/null +++ b/account_payment_plaid/models/plaid_account.py @@ -0,0 +1,16 @@ +from odoo import fields, models + + +class PlaidAccount(models.Model): + _name = "plaid.account" + + name = fields.Char(string="Name", required=True) + account = fields.Char(string="Account ID", required=True) + currency_id = fields.Many2one("res.currency", string="Currency") + official_name = fields.Char(string="Official Name") + type = fields.Char(string="Type") + mask = fields.Char(string="Mask") + subtype = fields.Char(string="Subtype") + company_id = fields.Many2one( + comodel_name="res.company", default=lambda self: self.env.company.id + ) diff --git a/account_payment_plaid/models/plaid_interface.py b/account_payment_plaid/models/plaid_interface.py new file mode 100644 index 000000000000..24430bc55517 --- /dev/null +++ b/account_payment_plaid/models/plaid_interface.py @@ -0,0 +1,170 @@ +# Copyright 2024 Binhex - Adasat Torres de León. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +import logging + +from odoo import _, models +from odoo.exceptions import ValidationError + +_logger = logging.getLogger(__name__) +try: + import plaid + from plaid.api import plaid_api + from plaid.model.accounts_get_request import AccountsGetRequest + from plaid.model.ach_class import ACHClass + from plaid.model.country_code import CountryCode + from plaid.model.item_public_token_exchange_request import ( + ItemPublicTokenExchangeRequest, + ) + from plaid.model.link_token_create_request import LinkTokenCreateRequest + from plaid.model.link_token_create_request_user import LinkTokenCreateRequestUser + from plaid.model.products import Products + from plaid.model.sandbox_transfer_simulate_request import ( + SandboxTransferSimulateRequest, + ) + from plaid.model.transfer_authorization_create_request import ( + TransferAuthorizationCreateRequest, + ) + from plaid.model.transfer_authorization_user_in_request import ( + TransferAuthorizationUserInRequest, + ) + from plaid.model.transfer_create_request import TransferCreateRequest + from plaid.model.transfer_event_sync_request import TransferEventSyncRequest + from plaid.model.transfer_failure import TransferFailure + from plaid.model.transfer_network import TransferNetwork + from plaid.model.transfer_type import TransferType +except (ImportError, IOError) as err: + _logger.debug(err) + + +class PlaidInterface(models.AbstractModel): + _name = "plaid.interface" + _description = "Plaid Interface" + + def _get_host(self, host): + if host == "sand": + return plaid.Environment.Sandbox + if host == "prod": + return plaid.Environment.Production + return False + + def _client(self, client_id, secret, host): + configuration = plaid.Configuration( + host=self._get_host(host), + api_key={ + "clientId": client_id or "", + "secret": secret or "", + }, + ) + try: + return plaid_api.PlaidApi(plaid.ApiClient(configuration)) + except plaid.ApiException as e: + raise ValidationError(_("Error getting client api: %s") % e.body) from e + + def _link(self, client, language, country_code, company_name, products): + request = LinkTokenCreateRequest( + products=[Products(product) for product in products], + client_name=company_name, + country_codes=[CountryCode(country_code)], + language=language, + user=LinkTokenCreateRequestUser(client_user_id="client"), + ) + try: + response = client.link_token_create(request) + except plaid.ApiException as e: + raise ValidationError(_("Error getting link token: %s") % e.body) from e + return response.to_dict()["link_token"] + + def _login(self, client, public_token): + request = ItemPublicTokenExchangeRequest(public_token=public_token) + try: + response = client.item_public_token_exchange(request) + except plaid.ApiException as e: + raise ValidationError(_("Error getting access token: %s") % e.body) from e + return response["access_token"] + + def _get_accounts(self, client, access_token): + request = AccountsGetRequest(access_token=access_token) + try: + response = client.accounts_get(request) + except plaid.ApiException as e: + raise ValidationError(_("Error getting accounts: %s") % e.body) from e + return response.to_dict()["accounts"] + + def _transfer_auth(self, client, access_token, account_id, partner_id, amount): + request = TransferAuthorizationCreateRequest( + access_token=access_token, + account_id=account_id, + originator_client_id=partner_id.plaid_client_id, + type=TransferType("credit"), + amount=amount, + network=TransferNetwork("ach"), + user=TransferAuthorizationUserInRequest(legal_name=partner_id.name), + ach_class=ACHClass("ppd"), + ) + + try: + response = client.transfer_authorization_create(request) + except plaid.ApiException as e: + raise ValidationError(_("Error getting transfer auth: %s") % e.body) from e + response_dict = response.to_dict()["authorization"] + return { + "authorization_id": response_dict["id"], + "decision": response_dict["decision"], + "decision_rationale": response_dict["decision_rationale"], + } + + def _transfer( + self, client, access_token, account_id, authorization_id, description + ): + request = TransferCreateRequest( + access_token=access_token, + account_id=account_id, + authorization_id=authorization_id, + description=description, + ) + try: + response = client.transfer_create(request) + except plaid.ApiException as e: + raise ValidationError(_("Error creating transfer: %s") % e.body) from e + return response.to_dict()["transfer"] + + def _sync_transfer_events(self, client): + request = TransferEventSyncRequest(after_id=4, count=25) + try: + response = client.transfer_event_sync(request) + except plaid.ApiException as e: + raise ValidationError( + _("Error syncing transfer events: %s") % e.body + ) from e + return response.to_dict()["transfer_events"] + + ############################ + # Sandbox Transfer Methods # + ############################ + + def _sandbox_simulate_transfer(self, client, transfer_id, event_type, failure): + if event_type == "failed": + request = SandboxTransferSimulateRequest( + transfer_id=transfer_id, + event_type=event_type, + failure_reason=TransferFailure( + description=failure, + ), + ) + else: + request = SandboxTransferSimulateRequest( + transfer_id=transfer_id, + event_type=event_type, + ) + + try: + client.sandbox_transfer_simulate(request) + except plaid.ApiException as e: + raise ValidationError(_("Error simulating transfer: %s") % e.body) from e + + def _sandbox_transfer_ledger_simulate_available(self, client): + try: + client.sandbox_transfer_ledger_simulate_available({}) + except plaid.ApiException as e: + raise ValidationError(_("Error simulating transfer: %s") % e.body) from e diff --git a/account_payment_plaid/models/plaid_transfer.py b/account_payment_plaid/models/plaid_transfer.py new file mode 100644 index 000000000000..e347af7ec4d4 --- /dev/null +++ b/account_payment_plaid/models/plaid_transfer.py @@ -0,0 +1,94 @@ +import logging + +from odoo import _, api, fields, models + +TRANSFER_STATE = [ + ("cancelled", _("Cancelled")), + ("pending", _("Pending")), + ("failed", _("Failed")), + ("posted", _("Posted")), + ("settled", _("Completed")), +] + +_logger = logging.getLogger(__name__) + + +class PlaidTransfer(models.Model): + _name = "plaid.transfer" + _order = "create_date desc" + + name = fields.Char(string="Name") + description = fields.Char(string="Description") + amount = fields.Float(string="Amount") + state = fields.Selection(selection=TRANSFER_STATE, string="State") + currency_id = fields.Many2one("res.currency", string="Currency") + company_id = fields.Many2one( + "res.company", + string="Company", + default=lambda self: self.env.user.company_id.id, + ) + host = fields.Selection(related="company_id.plaid_host", string="Host") + ref = fields.Char(string="Reference") + account_move_id = fields.Many2one("account.move", string="Account Move") + + def action_sandbox_simulation(self): + return { + "name": _("Plaid Transfer Sandbox Simulation"), + "type": "ir.actions.act_window", + "res_model": "plaid.transfer.sandbox.simulation.wizard", + "view_mode": "form", + "target": "new", + "context": { + "default_transfer_id": self.id, + "default_company_id": self.company_id.id, + }, + } + + @api.model + def cron_sync_transfer_events(self): + PlaidInterface = self.env["plaid.interface"] + PaymentRegister = self.env["account.payment.register"].sudo() + client = PlaidInterface._client( + self.env.user.company_id.plaid_client_id, + self.env.user.company_id.plaid_secret, + self.env.user.company_id.plaid_host, + ) + events = PlaidInterface._sync_transfer_events(client) + + events_per_type = {} + for event in events: + if event["event_type"] not in events_per_type.keys(): + events_per_type[event["event_type"]] = [] + + if event["transfer_id"] not in [ + transfer + for list_transfer in events_per_type.values() + for transfer in list_transfer + ]: + events_per_type[event["event_type"]].append(event["transfer_id"]) + + for event_type, events in events_per_type.items(): + transfer_ids = self.search( + [("name", "in", events), ("state", "!=", "settled")] + ) + if transfer_ids: + transfer_ids.write({"state": event_type}) + if event_type == "settled": + + for transfer in transfer_ids: + PaymentRegister.with_context( + active_model="account.move", + active_ids=transfer.account_move_id.ids, + dont_redirect_to_payments=True, + ).create( + { + "payment_date": transfer.account_move_id.invoice_date, + "communication": transfer.account_move_id.name, + "amount": transfer.account_move_id.amount_total, + "payment_method_id": self.env.ref( + "account_payment_plaid.account_payment_method_plaid_out" + ).id, + } + ).action_create_payments() + + return True diff --git a/account_payment_plaid/models/res_company.py b/account_payment_plaid/models/res_company.py new file mode 100644 index 000000000000..15e9cd2ea94a --- /dev/null +++ b/account_payment_plaid/models/res_company.py @@ -0,0 +1,62 @@ +from odoo import _, api, fields, models + + +class ResCompany(models.Model): + _inherit = "res.company" + + plaid_client_id = fields.Char(string="Client ID") + plaid_secret = fields.Char(string="Secret") + plaid_host = fields.Selection( + string="Host", + selection=[ + ("sand", _("Sandbox")), + ("prod", _("Production")), + ], + default="sand", + ) + plaid_access_token = fields.Char(string="Access Token") + + plaid_account_id = fields.Many2one( + string="Account ID", comodel_name="plaid.account", ondelete="set null" + ) + + @api.model + def save_access_token(self, public_token, company_id): + company_id = self.env["res.company"].browse(company_id) + plaid_interface = self.env["plaid.interface"] + client = plaid_interface._client( + company_id.plaid_client_id, company_id.plaid_secret, company_id.plaid_host + ) + company_id.plaid_access_token = plaid_interface._login(client, public_token) + company_id._generate_plaid_accounts() + + def _prepare_account_vals(self, vals): + currency_id = self.env["res.currency"].search( + [("name", "=", vals["balances"]["iso_currency_code"])] + ) + + return { + "name": vals["name"], + "account": vals["account_id"], + "currency_id": currency_id.id if currency_id else False, + "official_name": vals["official_name"], + "type": vals["type"], + "mask": vals["mask"], + "subtype": vals["subtype"], + } + + def _create_plaid_accounts(self, accounts): + PlaidAccount = self.env["plaid.account"] + PlaidAccount.search([]).unlink() + for account in accounts: + PlaidAccount.create(self._prepare_account_vals(account)) + + def _generate_plaid_accounts(self): + plaid_interface = self.env["plaid.interface"] + client = plaid_interface._client( + self.plaid_client_id, + self.plaid_secret, + self.plaid_host, + ) + accounts = plaid_interface._get_accounts(client, self.plaid_access_token) + self._create_plaid_accounts(accounts) diff --git a/account_payment_plaid/models/res_config_settings.py b/account_payment_plaid/models/res_config_settings.py new file mode 100644 index 000000000000..7fe89303ff2f --- /dev/null +++ b/account_payment_plaid/models/res_config_settings.py @@ -0,0 +1,72 @@ +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + company_id = fields.Many2one( + "res.company", + string="Company", + default=lambda self: self.env.company, + required=True, + readonly=True, + ondelete="cascade", + ) + + plaid_client_id = fields.Char( + readonly=False, + related="company_id.plaid_client_id", + string="Client ID", + config_parameter="plaid_connector.plaid_client_id", + ) + + plaid_secret = fields.Char( + string="Secret", + readonly=False, + related="company_id.plaid_secret", + config_parameter="plaid_connector.plaid_secret", + ) + plaid_host = fields.Selection( + string="Host", + readonly=False, + default="sand", + related="company_id.plaid_host", + config_parameter="plaid_connector.plaid_host", + ) + + plaid_access_token = fields.Char( + related="company_id.plaid_access_token", string="Access Token" + ) + + plaid_account_id = fields.Many2one( + related="company_id.plaid_account_id", + string="Account ID", + readonly=False, + ) + + def action_sync_with_plaid(self): + plaid_interface = self.env["plaid.interface"] + client = plaid_interface._client( + self.plaid_client_id, self.plaid_secret, self.plaid_host + ) + lang = self.env["res.lang"].search([("code", "=", self.env.user.lang)]).iso_code + company_name = self.env.user.company_id.name + country_code = self.env.user.company_id.country_id.code + link_token = plaid_interface._link( + client=client, + language=lang, + country_code=country_code, + company_name=company_name, + products=["auth", "transfer"], + ) + return { + "type": "ir.actions.client", + "tag": "plaid_login", + "params": { + "call_model": "res.company", + "call_method": "save_access_token", + "token": link_token, + "object_id": self.env.user.company_id.id, + }, + "target": "new", + } diff --git a/account_payment_plaid/models/res_partner.py b/account_payment_plaid/models/res_partner.py new file mode 100644 index 000000000000..c895f824f2a5 --- /dev/null +++ b/account_payment_plaid/models/res_partner.py @@ -0,0 +1,7 @@ +from odoo import fields, models + + +class ResPartner(models.Model): + _inherit = "res.partner" + + plaid_client_id = fields.Char(string="client ID", unique=True) diff --git a/account_payment_plaid/readme/CONTRIBUTORS.rst b/account_payment_plaid/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..f13efa350723 --- /dev/null +++ b/account_payment_plaid/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `Binhex _` + + * Adasat Torres de León diff --git a/account_payment_plaid/readme/DESCRIPTION.rst b/account_payment_plaid/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..6f76b3bbd34a --- /dev/null +++ b/account_payment_plaid/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This addon allow pay your bills with plaid platform using the ACH transfer method. +Do you need plaid account for use this module. diff --git a/account_payment_plaid/readme/USAGE.rst b/account_payment_plaid/readme/USAGE.rst new file mode 100644 index 000000000000..f100ee3e191d --- /dev/null +++ b/account_payment_plaid/readme/USAGE.rst @@ -0,0 +1,25 @@ +Using the Plaid API for bank transfers on production or development environment: + +#. Go to "Settings" > "Plaid". +#. Add your Plaid credentials. +#. Synchronize with Plaid. +#. Select your bank account. +#. Go to "Contacts" and add the plaid client id for the contact. +#. Go to your invoice and click on "Pay with Plaid" button.\nYou can see the button if the bill is confirmed.\nWhen you click on the button, you will see a confirmation window. +#. When you confirm the payment and the confirmation window\nis closed you can see the transfer in "Settings" > "Technical" > "Plaid" > "Transfer". +#. When the transfer is done, you can see the bill as paid and the payment create on odoo. + +If you are using the sandbox environment for testing, +do you need to use the simulation method for simulate the transfer. +This method only works with the sandbox environment. +You can found this method on "Settings" > "Technical" > "Plaid" > "Transfer". + +#. Select the transfer that you want to simulate. +#. Click on "Simulate Transfer" button. +#. Select the command that you want to simulate. + * "Simulate Transfer" : This command create a event on sandbox environment.\nDo you need this event for check the status of the transfer on Odoo. + * "Simulate transfer ledger available" : This command simulate converting pending balance\nto available balance for all originators in the Sandbox environment. +#. Click on "Confirm" button. + +This addon use the cron for check the status of the transfer on Plaid and update the bill and payment. +If you need more information about Plaid, please visit the `Plaid website `_ or `Plaid Docs Transfer `_. diff --git a/account_payment_plaid/security/ir.model.access.csv b/account_payment_plaid/security/ir.model.access.csv new file mode 100644 index 000000000000..3ffd5f290e4e --- /dev/null +++ b/account_payment_plaid/security/ir.model.access.csv @@ -0,0 +1,8 @@ +id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink + +access_account_payment_plaid_wizard,account.payment.plaid.wizard,model_account_payment_plaid_wizard,base.group_user,1,1,1,1 +access_plaid_account_user,access.plaid.account.user,model_plaid_account,base.group_user,1,0,0,0 +access_plaid_account_system,access.plaid.account.system,model_plaid_account,base.group_system,1,1,1,1 +access_plaid_transfer_user,access.plaid.transfer.user,model_plaid_transfer,base.group_user,1,1,1,0 +access_plaid_transfer_system,access.plaid.transfer.system,model_plaid_transfer,base.group_system,1,1,1,1 +access_plaid_transfer_sandbox_simulate_wizard,access.plaid.transfer.sandbox.simulate.wizard,model_plaid_transfer_sandbox_simulation_wizard,base.group_user,1,1,1,1 diff --git a/account_payment_plaid/static/description/icon.png b/account_payment_plaid/static/description/icon.png new file mode 100644 index 000000000000..3a0328b516c4 Binary files /dev/null and b/account_payment_plaid/static/description/icon.png differ diff --git a/account_payment_plaid/static/description/index.html b/account_payment_plaid/static/description/index.html new file mode 100644 index 000000000000..0e5c8b883e83 --- /dev/null +++ b/account_payment_plaid/static/description/index.html @@ -0,0 +1,453 @@ + + + + + +Account Payment Plaid + + + +
+

Account Payment Plaid

+ + +

Beta License: AGPL-3 OCA/bank-payment Translate me on Weblate Try me on Runboat

+

This addon allow pay your bills with plaid platform using the ACH transfer method. +Do you need plaid account for use this module.

+

Table of contents

+ +
+

Usage

+

Using the Plaid API for bank transfers on production or development environment:

+
    +
  1. Go to “Settings” > “Plaid”.
  2. +
  3. Add your Plaid credentials.
  4. +
  5. Synchronize with Plaid.
  6. +
  7. Select your bank account.
  8. +
  9. Go to “Contacts” and add the plaid client id for the contact.
  10. +
  11. Go to your invoice and click on “Pay with Plaid” button.nYou can see the button if the bill is confirmed.nWhen you click on the button, you will see a confirmation window.
  12. +
  13. When you confirm the payment and the confirmation windownis closed you can see the transfer in “Settings” > “Technical” > “Plaid” > “Transfer”.
  14. +
  15. When the transfer is done, you can see the bill as paid and the payment create on odoo.
  16. +
+

If you are using the sandbox environment for testing, +do you need to use the simulation method for simulate the transfer. +This method only works with the sandbox environment. +You can found this method on “Settings” > “Technical” > “Plaid” > “Transfer”.

+
    +
  1. Select the transfer that you want to simulate.
  2. +
  3. Click on “Simulate Transfer” button.
  4. +
  5. Select the command that you want to simulate. +* “Simulate Transfer” : This command create a event on sandbox environment.nDo you need this event for check the status of the transfer on Odoo. +* “Simulate transfer ledger available” : This command simulate converting pending balancento available balance for all originators in the Sandbox environment.
  6. +
  7. Click on “Confirm” button.
  8. +
+

This addon use the cron for check the status of the transfer on Plaid and update the bill and payment. +If you need more information about Plaid, please visit the Plaid website or Plaid Docs Transfer.

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Binhex
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/bank-payment project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/account_payment_plaid/static/src/js/plaid_integration.js b/account_payment_plaid/static/src/js/plaid_integration.js new file mode 100644 index 000000000000..7f04528e1ceb --- /dev/null +++ b/account_payment_plaid/static/src/js/plaid_integration.js @@ -0,0 +1,22 @@ +/* global Plaid */ +odoo.define("account_payment_plaid.plaid_integration", function (require) { + "use strict"; + var core = require("web.core"); + var rpc = require("web.rpc"); + + async function plaidLogin(env, action) { + const handler = Plaid.create({ + onSuccess: (public_token) => { + rpc.query({ + model: action.params.call_model, + method: action.params.call_method, + args: [public_token, action.params.object_id], + }); + }, + token: action.params.token, + }); + handler.open(); + } + + core.action_registry.add("plaid_login", plaidLogin); +}); diff --git a/account_payment_plaid/static/src/lib/link/v2/stable/link-initialize.js b/account_payment_plaid/static/src/lib/link/v2/stable/link-initialize.js new file mode 100644 index 000000000000..11eb5cfdc869 --- /dev/null +++ b/account_payment_plaid/static/src/lib/link/v2/stable/link-initialize.js @@ -0,0 +1,10999 @@ +var Plaid = (function (t) { + function webpackJsonpCallback(r) { + for (var i, a, u = r[0], l = r[1], d = 0, p = []; d < u.length; d++) + (a = u[d]), + Object.prototype.hasOwnProperty.call(o, a) && o[a] && p.push(o[a][0]), + (o[a] = 0); + for (i in l) Object.prototype.hasOwnProperty.call(l, i) && (t[i] = l[i]); + for (c && c(r); p.length; ) p.shift()(); + } + var r = {}, + o = {32: 0, 7: 0}; + function __webpack_require__(o) { + if (r[o]) return r[o].exports; + var i = (r[o] = {i: o, l: !1, exports: {}}); + + return ( + t[o].call(i.exports, i, i.exports, __webpack_require__), (i.l = !0), i.exports + ); + } + (__webpack_require__.e = function requireEnsure(t) { + var r = [], + i = o[t]; + if (0 !== i) + if (i) r.push(i[2]); + else { + var a = new Promise(function (r, a) { + i = o[t] = [r, a]; + }); + r.push((i[2] = a)); + var u, + c = document.createElement("script"); + (c.charset = "utf-8"), + (c.timeout = 120), + __webpack_require__.nc && c.setAttribute("nonce", __webpack_require__.nc), + (c.src = (function jsonpScriptSrc(t) { + return ( + __webpack_require__.p + + "" + + ({ + 11: "vendors~LazyLink~web3Bridge", + 17: "CBWalletWeb3", + 18: "CBWalletWeb3Storage", + 21: "MEWConnectClient", + 23: "WCV2Web3", + 24: "WCWeb3", + 26: "chainUtilities", + 28: "ethers", + 39: "vendors~CBWalletWeb3", + 42: "vendors~TrezorProvider", + 43: "vendors~WCV2Web3", + 44: "vendors~WCWeb3", + 45: "vendors~ethers", + 48: "web3Bridge", + }[t] || t) + + ".js" + ); + })(t)); + var l = new Error(); + u = function (r) { + (c.onerror = c.onload = null), clearTimeout(d); + var i = o[t]; + if (0 !== i) { + if (i) { + var a = r && ("load" === r.type ? "missing" : r.type), + u = r && r.target && r.target.src; + (l.message = "Loading chunk " + t + " failed.\n(" + a + ": " + u + ")"), + (l.name = "ChunkLoadError"), + (l.type = a), + (l.request = u), + i[1](l); + } + o[t] = void 0; + } + }; + var d = setTimeout(function () { + u({type: "timeout", target: c}); + }, 12e4); + (c.onerror = c.onload = u), document.head.appendChild(c); + } + return Promise.all(r); + }), + (__webpack_require__.m = t), + (__webpack_require__.c = r), + (__webpack_require__.d = function (t, r, o) { + __webpack_require__.o(t, r) || + Object.defineProperty(t, r, {enumerable: !0, get: o}); + }), + (__webpack_require__.r = function (t) { + "undefined" != typeof Symbol && + Symbol.toStringTag && + Object.defineProperty(t, Symbol.toStringTag, {value: "Module"}), + Object.defineProperty(t, "__esModule", {value: !0}); + }), + (__webpack_require__.t = function (t, r) { + if ((1 & r && (t = __webpack_require__(t)), 8 & r)) return t; + if (4 & r && "object" == typeof t && t && t.__esModule) return t; + var o = Object.create(null); + if ( + (__webpack_require__.r(o), + Object.defineProperty(o, "default", {enumerable: !0, value: t}), + 2 & r && "string" != typeof t) + ) + for (var i in t) + __webpack_require__.d( + o, + i, + function (r) { + return t[r]; + }.bind(null, i) + ); + return o; + }), + (__webpack_require__.n = function (t) { + var r = + t && t.__esModule + ? function getDefault() { + return t.default; + } + : function getModuleExports() { + return t; + }; + return __webpack_require__.d(r, "a", r), r; + }), + (__webpack_require__.o = function (t, r) { + return Object.prototype.hasOwnProperty.call(t, r); + }), + (__webpack_require__.p = "/link/2.0.1951/"), + (__webpack_require__.oe = function (t) { + throw (console.error(t), t); + }); + var i = (window.webpackJsonpPlaid = window.webpackJsonpPlaid || []), + a = i.push.bind(i); + (i.push = webpackJsonpCallback), (i = i.slice()); + for (var u = 0; u < i.length; u++) webpackJsonpCallback(i[u]); + var c = a; + return __webpack_require__((__webpack_require__.s = 1489)); +})([ + , + function (t, r, o) { + "use strict"; + var i = o(5), + a = o(15), + u = o(43).f; + i( + {target: "Object", stat: !0, forced: Object.defineProperty !== u, sham: !a}, + {defineProperty: u} + ); + }, + function (t, r) { + (t.exports = function _interopRequireDefault(t) { + return t && t.__esModule ? t : {default: t}; + }), + (t.exports.__esModule = !0), + (t.exports.default = t.exports); + }, + function (t, r, o) { + "use strict"; + var i = o(199), + a = o(40), + u = o(349); + i || a(Object.prototype, "toString", u, {unsafe: !0}); + }, + , + function (t, r, o) { + "use strict"; + var i = o(13), + a = o(94).f, + u = o(81), + c = o(40), + l = o(196), + d = o(222), + p = o(144); + t.exports = function (t, r) { + var o, + v, + h, + y, + _, + g = t.target, + b = t.global, + E = t.stat; + if ((o = b ? i : E ? i[g] || l(g, {}) : i[g] && i[g].prototype)) + for (v in r) { + if ( + ((y = r[v]), + (h = t.dontCallGetSet ? (_ = a(o, v)) && _.value : o[v]), + !p(b ? v : g + (E ? "." : "#") + v, t.forced) && void 0 !== h) + ) { + if (typeof y == typeof h) continue; + d(y, h); + } + (t.sham || (h && h.sham)) && u(y, "sham", !0), c(o, v, y, t); + } + }; + }, + function (t, r, o) { + "use strict"; + t.exports = function (t) { + try { + return !!t(); + } catch (t) { + return !0; + } + }; + }, + function (t, r, o) { + "use strict"; + var i = o(147), + a = Function.prototype, + u = a.call, + c = i && a.bind.bind(u, u); + t.exports = i + ? c + : function (t) { + return function () { + return u.apply(t, arguments); + }; + }; + }, + function (t, r, o) { + var i = o(275); + (t.exports = function _defineProperty(t, r, o) { + return ( + (r = i(r)) in t + ? Object.defineProperty(t, r, { + value: o, + enumerable: !0, + configurable: !0, + writable: !0, + }) + : (t[r] = o), + t + ); + }), + (t.exports.__esModule = !0), + (t.exports.default = t.exports); + }, + function (t, r, o) { + "use strict"; + var i = o(50), + a = o(179), + u = o(125), + c = o(46), + l = o(43).f, + d = o(226), + p = o(178), + v = o(60), + h = o(15), + y = "Array Iterator", + _ = c.set, + g = c.getterFor(y); + t.exports = d( + Array, + "Array", + function (t, r) { + _(this, {type: y, target: i(t), index: 0, kind: r}); + }, + function () { + var t = g(this), + r = t.target, + o = t.index++; + if (!r || o >= r.length) return (t.target = void 0), p(void 0, !0); + switch (t.kind) { + case "keys": + return p(o, !1); + case "values": + return p(r[o], !1); + } + return p([o, r[o]], !1); + }, + "values" + ); + var b = (u.Arguments = u.Array); + if ((a("keys"), a("values"), a("entries"), !v && h && "values" !== b.name)) + try { + l(b, "name", {value: "values"}); + } catch (t) {} + }, + function (t, r, o) { + "use strict"; + var i = o(204).charAt, + a = o(32), + u = o(46), + c = o(226), + l = o(178), + d = "String Iterator", + p = u.set, + v = u.getterFor(d); + c( + String, + "String", + function (t) { + p(this, {type: d, string: a(t), index: 0}); + }, + function next() { + var t, + r = v(this), + o = r.string, + a = r.index; + return a >= o.length + ? l(void 0, !0) + : ((t = i(o, a)), (r.index += t.length), l(t, !1)); + } + ); + }, + function (t, r) { + function _typeof(r) { + return ( + (t.exports = _typeof = + "function" == typeof Symbol && "symbol" == typeof Symbol.iterator + ? function (t) { + return typeof t; + } + : function (t) { + return t && + "function" == typeof Symbol && + t.constructor === Symbol && + t !== Symbol.prototype + ? "symbol" + : typeof t; + }), + (t.exports.__esModule = !0), + (t.exports.default = t.exports), + _typeof(r) + ); + } + (t.exports = _typeof), (t.exports.__esModule = !0), (t.exports.default = t.exports); + }, + function (t, r, o) { + "use strict"; + var i = o(5), + a = o(6), + u = o(50), + c = o(94).f, + l = o(15); + i( + { + target: "Object", + stat: !0, + forced: + !l || + a(function () { + c(1); + }), + sham: !l, + }, + { + getOwnPropertyDescriptor: function getOwnPropertyDescriptor(t, r) { + return c(u(t), r); + }, + } + ); + }, + function (t, r, o) { + "use strict"; + (function (r) { + var check = function (t) { + return t && t.Math === Math && t; + }; + t.exports = + check("object" == typeof globalThis && globalThis) || + check("object" == typeof window && window) || + check("object" == typeof self && self) || + check("object" == typeof r && r) || + check("object" == typeof this && this) || + (function () { + return this; + })() || + Function("return this")(); + }).call(this, o(114)); + }, + function (t, r, o) { + "use strict"; + var i = o(13), + a = o(254), + u = o(255), + c = o(9), + l = o(81), + d = o(70), + p = o(17)("iterator"), + v = c.values, + handlePrototype = function (t, r) { + if (t) { + if (t[p] !== v) + try { + l(t, p, v); + } catch (r) { + t[p] = v; + } + if ((d(t, r, !0), a[r])) + for (var o in c) + if (t[o] !== c[o]) + try { + l(t, o, c[o]); + } catch (r) { + t[o] = c[o]; + } + } + }; + for (var h in a) handlePrototype(i[h] && i[h].prototype, h); + handlePrototype(u, "DOMTokenList"); + }, + function (t, r, o) { + "use strict"; + var i = o(6); + t.exports = !i(function () { + return ( + 7 !== + Object.defineProperty({}, 1, { + get: function () { + return 7; + }, + })[1] + ); + }); + }, + , + function (t, r, o) { + "use strict"; + var i = o(13), + a = o(105), + u = o(31), + c = o(149), + l = o(104), + d = o(246), + p = i.Symbol, + v = a("wks"), + h = d ? p.for || p : (p && p.withoutSetter) || c; + t.exports = function (t) { + return u(v, t) || (v[t] = l && u(p, t) ? p[t] : h("Symbol." + t)), v[t]; + }; + }, + function (t, r, o) { + "use strict"; + var i = o(13), + a = o(254), + u = o(255), + c = o(334), + l = o(81), + handlePrototype = function (t) { + if (t && t.forEach !== c) + try { + l(t, "forEach", c); + } catch (r) { + t.forEach = c; + } + }; + for (var d in a) a[d] && handlePrototype(i[d] && i[d].prototype); + handlePrototype(u); + }, + function (t, r, o) { + "use strict"; + var i = "object" == typeof document && document.all; + t.exports = + void 0 === i && void 0 !== i + ? function (t) { + return "function" == typeof t || t === i; + } + : function (t) { + return "function" == typeof t; + }; + }, + , + function (t, r, o) { + "use strict"; + var i = o(5), + a = o(49), + u = o(138); + i( + { + target: "Object", + stat: !0, + forced: o(6)(function () { + u(1); + }), + }, + { + keys: function keys(t) { + return u(a(t)); + }, + } + ); + }, + function (t, r, o) { + "use strict"; + o(342), o(344), o(345), o(86), o(347); + }, + function (t, r, o) { + "use strict"; + var i = o(147), + a = Function.prototype.call; + t.exports = i + ? a.bind(a) + : function () { + return a.apply(a, arguments); + }; + }, + function (t, r, o) { + "use strict"; + var i = o(5), + a = o(88).filter; + i( + {target: "Array", proto: !0, forced: !o(159)("filter")}, + { + filter: function filter(t) { + return a(this, t, arguments.length > 1 ? arguments[1] : void 0); + }, + } + ); + }, + function (t, r, o) { + "use strict"; + var i = o(5), + a = o(198); + i({target: "RegExp", proto: !0, forced: /./.exec !== a}, {exec: a}); + }, + function (t, r, o) { + var i = o(338), + a = o(350), + u = o(283), + c = o(339); + (t.exports = function _slicedToArray(t, r) { + return i(t) || a(t, r) || u(t, r) || c(); + }), + (t.exports.__esModule = !0), + (t.exports.default = t.exports); + }, + function (t, r, o) { + "use strict"; + var i = o(5), + a = o(88).map; + i( + {target: "Array", proto: !0, forced: !o(159)("map")}, + { + map: function map(t) { + return a(this, t, arguments.length > 1 ? arguments[1] : void 0); + }, + } + ); + }, + , + function (t, r, o) { + "use strict"; + o(352); + }, + function (t, r, o) { + "use strict"; + var i = o(19); + t.exports = function (t) { + return "object" == typeof t ? null !== t : i(t); + }; + }, + function (t, r, o) { + "use strict"; + var i = o(7), + a = o(49), + u = i({}.hasOwnProperty); + t.exports = + Object.hasOwn || + function hasOwn(t, r) { + return u(a(t), r); + }; + }, + function (t, r, o) { + "use strict"; + var i = o(109), + a = String; + t.exports = function (t) { + if ("Symbol" === i(t)) + throw new TypeError("Cannot convert a Symbol value to a string"); + return a(t); + }; + }, + function (t, r, o) { + "use strict"; + var i = o(5), + a = o(15), + u = o(200).f; + i( + {target: "Object", stat: !0, forced: Object.defineProperties !== u, sham: !a}, + {defineProperties: u} + ); + }, + function (t, r, o) { + "use strict"; + var i = o(30), + a = String, + u = TypeError; + t.exports = function (t) { + if (i(t)) return t; + throw new u(a(t) + " is not an object"); + }; + }, + function (t, r, o) { + "use strict"; + var i = o(5), + a = o(15), + u = o(244), + c = o(50), + l = o(94), + d = o(146); + i( + {target: "Object", stat: !0, sham: !a}, + { + getOwnPropertyDescriptors: function getOwnPropertyDescriptors(t) { + for (var r, o, i = c(t), a = l.f, p = u(i), v = {}, h = 0; p.length > h; ) + void 0 !== (o = a(i, (r = p[h++]))) && d(v, r, o); + return v; + }, + } + ); + }, + , + function (t, r, o) { + "use strict"; + var i = o(5), + a = o(6), + u = o(143), + c = o(30), + l = o(49), + d = o(63), + p = o(305), + v = o(146), + h = o(220), + y = o(159), + _ = o(17), + g = o(113), + b = _("isConcatSpreadable"), + E = + g >= 51 || + !a(function () { + var t = []; + return (t[b] = !1), t.concat()[0] !== t; + }), + isConcatSpreadable = function (t) { + if (!c(t)) return !1; + var r = t[b]; + return void 0 !== r ? !!r : u(t); + }; + i( + {target: "Array", proto: !0, arity: 1, forced: !E || !y("concat")}, + { + concat: function concat(t) { + var r, + o, + i, + a, + u, + c = l(this), + y = h(c, 0), + _ = 0; + for (r = -1, i = arguments.length; r < i; r++) + if (isConcatSpreadable((u = -1 === r ? c : arguments[r]))) + for (a = d(u), p(_ + a), o = 0; o < a; o++, _++) o in u && v(y, _, u[o]); + else p(_ + 1), v(y, _++, u); + return (y.length = _), y; + }, + } + ); + }, + , + , + function (t, r, o) { + "use strict"; + var i = o(19), + a = o(43), + u = o(240), + c = o(196); + t.exports = function (t, r, o, l) { + l || (l = {}); + var d = l.enumerable, + p = void 0 !== l.name ? l.name : r; + if ((i(o) && u(o, p, l), l.global)) d ? (t[r] = o) : c(r, o); + else { + try { + l.unsafe ? t[r] && (d = !0) : delete t[r]; + } catch (t) {} + d + ? (t[r] = o) + : a.f(t, r, { + value: o, + enumerable: !1, + configurable: !l.nonConfigurable, + writable: !l.nonWritable, + }); + } + return t; + }; + }, + , + , + function (t, r, o) { + "use strict"; + var i = o(15), + a = o(247), + u = o(248), + c = o(34), + l = o(182), + d = TypeError, + p = Object.defineProperty, + v = Object.getOwnPropertyDescriptor, + h = "enumerable", + y = "configurable", + _ = "writable"; + r.f = i + ? u + ? function defineProperty(t, r, o) { + if ( + (c(t), + (r = l(r)), + c(o), + "function" == typeof t && + "prototype" === r && + "value" in o && + _ in o && + !o.writable) + ) { + var i = v(t, r); + i && + i.writable && + ((t[r] = o.value), + (o = { + configurable: y in o ? o.configurable : i.configurable, + enumerable: h in o ? o.enumerable : i.enumerable, + writable: !1, + })); + } + return p(t, r, o); + } + : p + : function defineProperty(t, r, o) { + if ((c(t), (r = l(r)), c(o), a)) + try { + return p(t, r, o); + } catch (t) {} + if ("get" in o || "set" in o) throw new d("Accessors not supported"); + return "value" in o && (t[r] = o.value), t; + }; + }, + function (t, r, o) { + "use strict"; + var i = o(15), + a = o(136).EXISTS, + u = o(7), + c = o(73), + l = Function.prototype, + d = u(l.toString), + p = /function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/, + v = u(p.exec); + i && + !a && + c(l, "name", { + configurable: !0, + get: function () { + try { + return v(p, d(this))[1]; + } catch (t) { + return ""; + } + }, + }); + }, + , + function (t, r, o) { + "use strict"; + var i, + a, + u, + c = o(249), + l = o(13), + d = o(30), + p = o(81), + v = o(31), + h = o(195), + y = o(160), + _ = o(124), + g = "Object already initialized", + b = l.TypeError, + E = l.WeakMap; + if (c || h.state) { + var m = h.state || (h.state = new E()); + (m.get = m.get), + (m.has = m.has), + (m.set = m.set), + (i = function (t, r) { + if (m.has(t)) throw new b(g); + return (r.facade = t), m.set(t, r), r; + }), + (a = function (t) { + return m.get(t) || {}; + }), + (u = function (t) { + return m.has(t); + }); + } else { + var w = y("state"); + (_[w] = !0), + (i = function (t, r) { + if (v(t, w)) throw new b(g); + return (r.facade = t), p(t, w, r), r; + }), + (a = function (t) { + return v(t, w) ? t[w] : {}; + }), + (u = function (t) { + return v(t, w); + }); + } + t.exports = { + set: i, + get: a, + has: u, + enforce: function (t) { + return u(t) ? a(t) : i(t, {}); + }, + getterFor: function (t) { + return function (r) { + var o; + if (!d(r) || (o = a(r)).type !== t) + throw new b("Incompatible receiver, " + t + " required"); + return o; + }; + }, + }; + }, + , + , + function (t, r, o) { + "use strict"; + var i = o(56), + a = Object; + t.exports = function (t) { + return a(i(t)); + }; + }, + function (t, r, o) { + "use strict"; + var i = o(123), + a = o(56); + t.exports = function (t) { + return i(a(t)); + }; + }, + function (t, r, o) { + "use strict"; + var i = o(7), + a = i({}.toString), + u = i("".slice); + t.exports = function (t) { + return u(a(t), 8, -1); + }; + }, + function (t, r, o) { + "use strict"; + var i = o(5), + a = o(143), + u = o(166), + c = o(30), + l = o(203), + d = o(63), + p = o(50), + v = o(146), + h = o(17), + y = o(159), + _ = o(89), + g = y("slice"), + b = h("species"), + E = Array, + m = Math.max; + i( + {target: "Array", proto: !0, forced: !g}, + { + slice: function slice(t, r) { + var o, + i, + h, + y = p(this), + g = d(y), + w = l(t, g), + S = l(void 0 === r ? g : r, g); + if ( + a(y) && + ((o = y.constructor), + ((u(o) && (o === E || a(o.prototype))) || (c(o) && null === (o = o[b]))) && + (o = void 0), + o === E || void 0 === o) + ) + return _(y, w, S); + for (i = new (void 0 === o ? E : o)(m(S - w, 0)), h = 0; w < S; w++, h++) + w in y && v(i, h, y[w]); + return (i.length = h), i; + }, + } + ); + }, + , + , + function (t, r, o) { + "use strict"; + var i = o(136).PROPER, + a = o(40), + u = o(34), + c = o(32), + l = o(6), + d = o(241), + p = "toString", + v = RegExp.prototype, + h = v.toString, + y = l(function () { + return "/a/b" !== h.call({source: "a", flags: "b"}); + }), + _ = i && h.name !== p; + (y || _) && + a( + v, + p, + function toString() { + var t = u(this); + return "/" + c(t.source) + "/" + c(d(t)); + }, + {unsafe: !0} + ); + }, + function (t, r, o) { + "use strict"; + var i = o(67), + a = TypeError; + t.exports = function (t) { + if (i(t)) throw new a("Can't call method on " + t); + return t; + }; + }, + , + function (t, r, o) { + "use strict"; + o(25); + var i, + a, + u = o(5), + c = o(23), + l = o(19), + d = o(34), + p = o(32), + v = + ((i = !1), + ((a = /[ac]/).exec = function () { + return (i = !0), /./.exec.apply(this, arguments); + }), + !0 === a.test("abc") && i), + h = /./.test; + u( + {target: "RegExp", proto: !0, forced: !v}, + { + test: function (t) { + var r = d(this), + o = p(t), + i = r.exec; + if (!l(i)) return c(h, r, o); + var a = c(i, r, o); + return null !== a && (d(a), !0); + }, + } + ); + }, + , + function (t, r, o) { + "use strict"; + t.exports = !1; + }, + function (t, r, o) { + "use strict"; + var i = o(13), + a = o(19), + aFunction = function (t) { + return a(t) ? t : void 0; + }; + t.exports = function (t, r) { + return arguments.length < 2 ? aFunction(i[t]) : i[t] && i[t][r]; + }; + }, + , + function (t, r, o) { + "use strict"; + var i = o(112); + t.exports = function (t) { + return i(t.length); + }; + }, + function (t, r, o) { + "use strict"; + var i = o(19), + a = o(110), + u = TypeError; + t.exports = function (t) { + if (i(t)) return t; + throw new u(a(t) + " is not a function"); + }; + }, + , + function (t, r, o) { + "use strict"; + var i = o(156), + a = o(23), + u = o(7), + c = o(175), + l = o(6), + d = o(34), + p = o(19), + v = o(67), + h = o(99), + y = o(112), + _ = o(32), + g = o(56), + b = o(212), + E = o(98), + m = o(337), + w = o(174), + S = o(17)("replace"), + O = Math.max, + x = Math.min, + I = u([].concat), + P = u([].push), + T = u("".indexOf), + A = u("".slice), + R = "$0" === "a".replace(/./, "$0"), + N = !!/./[S] && "" === /./[S]("a", "$0"); + c( + "replace", + function (t, r, o) { + var u = N ? "$" : "$0"; + return [ + function replace(t, o) { + var i = g(this), + u = v(t) ? void 0 : E(t, S); + return u ? a(u, t, i, o) : a(r, _(i), t, o); + }, + function (t, a) { + var c = d(this), + l = _(t); + if ("string" == typeof a && -1 === T(a, u) && -1 === T(a, "$<")) { + var v = o(r, c, l, a); + if (v.done) return v.value; + } + var g = p(a); + g || (a = _(a)); + var E, + S = c.global; + S && ((E = c.unicode), (c.lastIndex = 0)); + for (var R, N = []; null !== (R = w(c, l)) && (P(N, R), S); ) { + "" === _(R[0]) && (c.lastIndex = b(l, y(c.lastIndex), E)); + } + for (var L, C = "", k = 0, M = 0; M < N.length; M++) { + for ( + var j, + U = _((R = N[M])[0]), + W = O(x(h(R.index), l.length), 0), + D = [], + V = 1; + V < R.length; + V++ + ) + P(D, void 0 === (L = R[V]) ? L : String(L)); + var K = R.groups; + if (g) { + var B = I([U], D, W, l); + void 0 !== K && P(B, K), (j = _(i(a, void 0, B))); + } else j = m(U, l, W, D, K, a); + W >= k && ((C += A(l, k, W) + j), (k = W + U.length)); + } + return C + A(l, k); + }, + ]; + }, + !!l(function () { + var t = /./; + return ( + (t.exec = function () { + var t = []; + return (t.groups = {a: "7"}), t; + }), + "7" !== "".replace(t, "$") + ); + }) || + !R || + N + ); + }, + function (t, r, o) { + "use strict"; + t.exports = function (t) { + return null == t; + }; + }, + , + , + function (t, r, o) { + "use strict"; + var i = o(43).f, + a = o(31), + u = o(17)("toStringTag"); + t.exports = function (t, r, o) { + t && !o && (t = t.prototype), + t && !a(t, u) && i(t, u, {configurable: !0, value: r}); + }; + }, + , + , + function (t, r, o) { + "use strict"; + var i = o(240), + a = o(43); + t.exports = function (t, r, o) { + return ( + o.get && i(o.get, r, {getter: !0}), + o.set && i(o.set, r, {setter: !0}), + a.f(t, r, o) + ); + }; + }, + , + function (t, r, o) { + "use strict"; + var i = o(5), + a = o(7), + u = o(123), + c = o(50), + l = o(134), + d = a([].join); + i( + {target: "Array", proto: !0, forced: u !== Object || !l("join", ",")}, + { + join: function join(t) { + return d(c(this), void 0 === t ? "," : t); + }, + } + ); + }, + , + , + function (t, r, o) { + "use strict"; + var i = o(7); + t.exports = i({}.isPrototypeOf); + }, + function (t, r, o) { + "use strict"; + var i = o(5), + a = o(15), + u = o(13), + c = o(7), + l = o(31), + d = o(19), + p = o(78), + v = o(32), + h = o(73), + y = o(222), + _ = u.Symbol, + g = _ && _.prototype; + if (a && d(_) && (!("description" in g) || void 0 !== _().description)) { + var b = {}, + E = function Symbol() { + var t = + arguments.length < 1 || void 0 === arguments[0] + ? void 0 + : v(arguments[0]), + r = p(g, this) ? new _(t) : void 0 === t ? _() : _(t); + return "" === t && (b[r] = !0), r; + }; + y(E, _), (E.prototype = g), (g.constructor = E); + var m = "Symbol(description detection)" === String(_("description detection")), + w = c(g.valueOf), + S = c(g.toString), + O = /^Symbol\((.*)\)[^)]+$/, + x = c("".replace), + I = c("".slice); + h(g, "description", { + configurable: !0, + get: function description() { + var t = w(this); + if (l(b, t)) return ""; + var r = S(t), + o = m ? I(r, 7, -1) : x(r, O, "$1"); + return "" === o ? void 0 : o; + }, + }), + i({global: !0, constructor: !0, forced: !0}, {Symbol: E}); + } + }, + , + function (t, r, o) { + "use strict"; + var i = o(15), + a = o(43), + u = o(97); + t.exports = i + ? function (t, r, o) { + return a.f(t, r, u(1, o)); + } + : function (t, r, o) { + return (t[r] = o), t; + }; + }, + function (t, r, o) { + "use strict"; + var i, + a = o(34), + u = o(200), + c = o(197), + l = o(124), + d = o(269), + p = o(167), + v = o(160), + h = v("IE_PROTO"), + EmptyConstructor = function () {}, + scriptTag = function (t) { + return ""), + t.close(), + createDict = t.F; + i--; + + ) + delete createDict.prototype[u[i]]; + return createDict(); + }; + t.exports = + Object.create || + function create(t, r) { + var o; + return ( + null !== t + ? ((Empty.prototype = i(t)), + (o = new Empty()), + (Empty.prototype = null), + (o[c] = t)) + : (o = createDict()), + void 0 === r ? o : a(o, r) + ); + }; + }, + function (t, r, o) { + var i = o(728), + a = o(721), + u = o(497), + c = o(1131), + l = o(524), + d = o(1385), + p = Object.getOwnPropertyDescriptor; + r.f = o(427) + ? p + : function getOwnPropertyDescriptor(t, r) { + if (((t = u(t)), (r = c(r, !0)), d)) + try { + return p(t, r); + } catch (t) {} + if (l(t, r)) return a(!i.f.call(t, r), t[r]); + }; + }, + function (t, r) { + t.exports = function (t) { + if (null == t) throw TypeError("Can't call method on " + t); + return t; + }; + }, + function (t, r, o) { + t.exports = o(1430); + }, + function (t, r, o) { + var i = o(483); + t.exports = function (t, r) { + if (!i(t)) return t; + var o, a; + if (r && "function" == typeof (o = t.toString) && !i((a = o.call(t)))) return a; + if ("function" == typeof (o = t.valueOf) && !i((a = o.call(t)))) return a; + if (!r && "function" == typeof (o = t.toString) && !i((a = o.call(t)))) return a; + throw TypeError("Can't convert object to primitive value"); + }; + }, + function (t, r, o) { + var i = o(323), + a = o(425), + u = "__core-js_shared__", + c = a[u] || (a[u] = {}); + (t.exports = function (t, r) { + return c[t] || (c[t] = void 0 !== r ? r : {}); + })("versions", []).push({ + version: i.version, + mode: o(1107) ? "pure" : "global", + copyright: "© 2020 Denis Pushkarev (zloirock.ru)", + }); + }, + function (t, r, o) { + var i = o(425), + a = o(323), + u = o(1107), + c = o(1112), + l = o(434).f; + t.exports = function (t) { + var r = a.Symbol || (a.Symbol = u ? {} : i.Symbol || {}); + "_" == t.charAt(0) || t in r || l(r, t, {value: c.f(t)}); + }; + }, + function (t, r) { + var o = Math.ceil, + i = Math.floor; + t.exports = function (t) { + return isNaN((t = +t)) ? 0 : (t > 0 ? i : o)(t); + }; + }, + function (t, r, o) { + var i = o(1132)("keys"), + a = o(1111); + t.exports = function (t) { + return i[t] || (i[t] = a(t)); + }; + }, + function (t, r) { + t.exports = + "constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split( + "," + ); + }, + function (t, r, o) { + var i = o(1386), + a = o(1136).concat("length", "prototype"); + r.f = + Object.getOwnPropertyNames || + function getOwnPropertyNames(t) { + return i(t, a); + }; + }, + function (t, r, o) { + "use strict"; + var i = o(1107), + a = o(405), + u = o(1143), + c = o(525), + l = o(722), + d = o(1440), + p = o(1108), + v = o(1420), + h = o(426)("iterator"), + y = !([].keys && "next" in [].keys()), + _ = "keys", + g = "values", + returnThis = function () { + return this; + }; + t.exports = function (t, r, o, b, E, m, w) { + d(o, r, b); + var S, + O, + x, + getMethod = function (t) { + if (!y && t in A) return A[t]; + switch (t) { + case _: + return function keys() { + return new o(this, t); + }; + case g: + return function values() { + return new o(this, t); + }; + } + return function entries() { + return new o(this, t); + }; + }, + I = r + " Iterator", + P = E == g, + T = !1, + A = t.prototype, + R = A[h] || A["@@iterator"] || (E && A[E]), + N = R || getMethod(E), + L = E ? (P ? getMethod("entries") : N) : void 0, + C = ("Array" == r && A.entries) || R; + if ( + (C && + (x = v(C.call(new t()))) !== Object.prototype && + x.next && + (p(x, I, !0), i || "function" == typeof x[h] || c(x, h, returnThis)), + P && + R && + R.name !== g && + ((T = !0), + (N = function values() { + return R.call(this); + })), + (i && !w) || (!y && !T && A[h]) || c(A, h, N), + (l[r] = N), + (l[I] = returnThis), + E) + ) + if ( + ((S = {values: P ? N : getMethod(g), keys: m ? N : getMethod(_), entries: L}), + w) + ) + for (O in S) O in A || u(A, O, S[O]); + else a(a.P + a.F * (y || T), r, S); + return S; + }; + }, + function (t, r, o) { + var i = o(525); + t.exports = function (t, r, o) { + for (var a in r) o && t[a] ? (t[a] = r[a]) : i(t, a, r[a]); + return t; + }; + }, + function (t, r) { + t.exports = function (t, r, o, i) { + if (!(t instanceof r) || (void 0 !== i && i in t)) + throw TypeError(o + ": incorrect invocation!"); + return t; + }; + }, + , + , + function (t, r, o) { + t.exports = o(525); + }, + function (t, r, o) { + var i = o(1126); + t.exports = Object("z").propertyIsEnumerable(0) + ? Object + : function (t) { + return "String" == i(t) ? t.split("") : Object(t); + }; + }, + function (t, r, o) { + var i = o(1126); + t.exports = + Array.isArray || + function isArray(t) { + return "Array" == i(t); + }; + }, + function (t, r, o) { + t.exports = o(1438); + }, + function (t, r, o) { + "use strict"; + var i = o(425), + a = o(405), + u = o(734), + c = o(595), + l = o(525), + d = o(1139), + p = o(723), + v = o(1140), + h = o(483), + y = o(1108), + _ = o(434).f, + g = o(1158)(0), + b = o(427); + t.exports = function (t, r, o, E, m, w) { + var S = i[t], + O = S, + x = m ? "set" : "add", + I = O && O.prototype, + P = {}; + return ( + b && + "function" == typeof O && + (w || + (I.forEach && + !c(function () { + new O().entries().next(); + }))) + ? ((O = r(function (r, o) { + v(r, O, t, "_c"), (r._c = new S()), null != o && p(o, m, r[x], r); + })), + g( + "add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON".split( + "," + ), + function (t) { + var r = "add" == t || "set" == t; + !(t in I) || + (w && "clear" == t) || + l(O.prototype, t, function (o, i) { + if ((v(this, O, t), !r && w && !h(o))) return "get" == t && void 0; + var a = this._c[t](0 === o ? 0 : o, i); + return r ? this : a; + }); + } + ), + w || + _(O.prototype, "size", { + get: function () { + return this._c.size; + }, + })) + : ((O = E.getConstructor(r, t, m, x)), d(O.prototype, o), (u.NEED = !0)), + y(O, t), + (P[t] = O), + a(a.G + a.W + a.F, P), + w || E.setStrong(O, t, m), + O + ); + }; + }, + function (t, r, o) { + "use strict"; + var i = o(405); + t.exports = function (t) { + i(i.S, t, { + of: function of() { + for (var t = arguments.length, r = new Array(t); t--; ) r[t] = arguments[t]; + return new this(r); + }, + }); + }; + }, + function (t, r, o) { + "use strict"; + var i = o(405), + a = o(1379), + u = o(665), + c = o(723); + t.exports = function (t) { + i(i.S, t, { + from: function from(t) { + var r, + o, + i, + l, + d = arguments[1]; + return ( + a(this), + (r = void 0 !== d) && a(d), + null == t + ? new this() + : ((o = []), + r + ? ((i = 0), + (l = u(d, arguments[2], 2)), + c(t, !1, function (t) { + o.push(l(t, i++)); + })) + : c(t, !1, o.push, o), + new this(o)) + ); + }, + }); + }; + }, + , + , + , + , + , + , + , + , + function (t, r, o) { + var i = o(665), + a = o(1144), + u = o(666), + c = o(1113), + l = o(1443); + t.exports = function (t, r) { + var o = 1 == t, + d = 2 == t, + p = 3 == t, + v = 4 == t, + h = 6 == t, + y = 5 == t || h, + _ = r || l; + return function (r, l, g) { + for ( + var b, + E, + m = u(r), + w = a(m), + S = i(l, g, 3), + O = c(w.length), + x = 0, + I = o ? _(r, O) : d ? _(r, 0) : void 0; + O > x; + x++ + ) + if ((y || x in w) && ((E = S((b = w[x]), x, m)), t)) + if (o) I[x] = E; + else if (E) + switch (t) { + case 3: + return !0; + case 5: + return b; + case 6: + return x; + case 2: + I.push(b); + } + else if (v) return !1; + return h ? -1 : p || v ? v : I; + }; + }; + }, + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + function (t, r, o) { + "use strict"; + var i = o(495); + o(1), o(3), o(18), Object.defineProperty(r, "__esModule", {value: !0}); + var a = { + getMetaViewport: !0, + isInlineStylesheetSupported: !0, + isMetaViewportSet: !0, + }; + (r.isMetaViewportSet = r.isInlineStylesheetSupported = r.getMetaViewport = void 0), + o(25), + o(58); + var u = o(1397); + i(u).forEach(function (t) { + "default" !== t && + "__esModule" !== t && + (Object.prototype.hasOwnProperty.call(a, t) || + (t in r && r[t] === u[t]) || + Object.defineProperty(r, t, { + enumerable: !0, + get: function get() { + return u[t]; + }, + })); + }); + var c = function getMetaViewport() { + var t = document.querySelectorAll('meta[name="viewport"]'); + if (0 === t.length) return ""; + var r = t[t.length - 1].getAttribute("content"); + return String(r); + }; + r.getMetaViewport = c; + r.isInlineStylesheetSupported = function isInlineStylesheetSupported() { + try { + var t = "link-stylesheet-test-".concat(Math.floor(100 * Math.random())), + r = document.createElement("div"); + r.id = t; + var o = document.createElement("style"); + o.textContent = "#".concat(t, " { width: 100px; height: 100px; }"); + var i = document.body; + i.appendChild(r), i.appendChild(o); + var a = 100 === r.offsetWidth; + return i.removeChild(r), i.removeChild(o), a; + } catch (t) { + return !1; + } + }; + r.isMetaViewportSet = function isMetaViewportSet() { + return /device-width/.test(c()); + }; + }, + function (t, r, o) { + "use strict"; + o(1); + var i = o(493); + Object.defineProperty(r, "__esModule", {value: !0}), + (r.FLEX_LINK_HTML_PATH = r.CREATE_PARAMETERS = void 0), + Object.defineProperty(r, "LINK_CLIENT_CORS_ORIGIN", { + enumerable: !0, + get: function get() { + return u.LINK_CLIENT_CORS_ORIGIN; + }, + }), + Object.defineProperty(r, "LINK_CLIENT_STABLE_URL", { + enumerable: !0, + get: function get() { + return u.LINK_CLIENT_STABLE_URL; + }, + }), + Object.defineProperty(r, "LINK_CLIENT_URL", { + enumerable: !0, + get: function get() { + return u.LINK_CLIENT_URL; + }, + }), + Object.defineProperty(r, "LINK_HTML_PATH", { + enumerable: !0, + get: function get() { + return u.LINK_HTML_PATH; + }, + }), + Object.defineProperty(r, "PLAID_INTERNAL_NAMESPACE", { + enumerable: !0, + get: function get() { + return u.PLAID_INTERNAL_NAMESPACE; + }, + }), + o(37); + var a = i(o(1501)), + u = o(231); + r.FLEX_LINK_HTML_PATH = "/flink.html"; + var c = [].concat((0, a.default)(u.CREATE_PARAMETERS), [ + "apiVersion", + "clientName", + "configUserId", + "configUserTags", + "countryCodes", + "customizations", + "depositSwitchToken", + "experimentVariants", + "forceIframe", + "hostedLinkVersion", + "isEmbedded", + "isSimpleIntegration", + "key", + "language", + "linkCustomizationName", + "longtail", + "longTail", + "oauthNonce", + "oauthStateId", + "oauthRedirectUri", + "onResult", + "paymentToken", + "product", + "accountSubtypes", + "selectAccount", + "noLoadingState", + "useMobileWindow", + "user", + "userLegalName", + "userEmailAddress", + "userPhoneNumber", + "webhook", + "workflowVersionOverride", + ]); + r.CREATE_PARAMETERS = c; + }, + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + , + function (t, r, o) { + "use strict"; + o(1), + Object.defineProperty(r, "__esModule", {value: !0}), + (r.ProviderRpcErrorCode = r.ChainTypes = void 0); + var i = (function (t) { + return ( + (t[(t.ACCOUNT_ACCESS_REJECTED = 4001)] = "ACCOUNT_ACCESS_REJECTED"), + (t[(t.ACCOUNT_ACCESS_ALREADY_REQUESTED = -32002)] = + "ACCOUNT_ACCESS_ALREADY_REQUESTED"), + (t[(t.UNAUTHORIZED = 4100)] = "UNAUTHORIZED"), + (t[(t.INVALID_PARAMS = -32602)] = "INVALID_PARAMS"), + (t[(t.UNSUPPORTED_METHOD = 4200)] = "UNSUPPORTED_METHOD"), + (t[(t.DISCONNECTED = 4900)] = "DISCONNECTED"), + (t[(t.CHAIN_DISCONNECTED = 4901)] = "CHAIN_DISCONNECTED"), + (t[(t.CHAIN_NOT_ADDED = 4902)] = "CHAIN_NOT_ADDED"), + (t[(t.DOES_NOT_EXIST = -32601)] = "DOES_NOT_EXIST"), + (t[(t.METAMASK_NETWORK_SWITCH_DISCONNECT = 1013)] = + "METAMASK_NETWORK_SWITCH_DISCONNECT"), + t + ); + })({}); + r.ProviderRpcErrorCode = i; + var a = (function (t) { + return ( + (t[(t.Unknown = 0)] = "Unknown"), + (t[(t.EVM = 1)] = "EVM"), + (t[(t.Solana = 2)] = "Solana"), + t + ); + })({}); + r.ChainTypes = a; + }, + function (t, r) { + t.exports = function (t) { + if ("function" != typeof t) throw TypeError(t + " is not a function!"); + return t; + }; + }, + function (t, r, o) { + t.exports = o(1458); + }, + function (t, r, o) { + var i = o(483), + a = o(425).document, + u = i(a) && i(a.createElement); + t.exports = function (t) { + return u ? a.createElement(t) : {}; + }; + }, + function (t, r, o) { + var i = o(1126), + a = o(426)("toStringTag"), + u = + "Arguments" == + i( + (function () { + return arguments; + })() + ); + t.exports = function (t) { + var r, o, c; + return void 0 === t + ? "Undefined" + : null === t + ? "Null" + : "string" == + typeof (o = (function (t, r) { + try { + return t[r]; + } catch (t) {} + })((r = Object(t)), a)) + ? o + : u + ? i(r) + : "Object" == (c = i(r)) && "function" == typeof r.callee + ? "Arguments" + : c; + }; + }, + function (t, r, o) { + var i = o(405), + a = o(323), + u = o(595); + t.exports = function (t, r) { + var o = (a.Object || {})[t] || Object[t], + c = {}; + (c[t] = r(o)), + i( + i.S + + i.F * + u(function () { + o(1); + }), + "Object", + c + ); + }; + }, + function (t, r, o) { + "use strict"; + var i = o(425), + a = o(524), + u = o(427), + c = o(405), + l = o(1143), + d = o(734).KEY, + p = o(595), + v = o(1132), + h = o(1108), + y = o(1111), + _ = o(426), + g = o(1112), + b = o(1133), + E = o(1431), + m = o(1145), + w = o(523), + S = o(483), + O = o(666), + x = o(497), + I = o(1131), + P = o(721), + T = o(1127), + A = o(1435), + R = o(1128), + N = o(1116), + L = o(434), + C = o(667), + k = R.f, + M = L.f, + j = A.f, + U = i.Symbol, + W = i.JSON, + D = W && W.stringify, + V = _("_hidden"), + K = _("toPrimitive"), + B = {}.propertyIsEnumerable, + H = v("symbol-registry"), + q = v("symbols"), + z = v("op-symbols"), + G = Object.prototype, + Q = "function" == typeof U && !!N.f, + X = i.QObject, + Y = !X || !X.prototype || !X.prototype.findChild, + J = + u && + p(function () { + return ( + 7 != + T( + M({}, "a", { + get: function () { + return M(this, "a", {value: 7}).a; + }, + }) + ).a + ); + }) + ? function (t, r, o) { + var i = k(G, r); + i && delete G[r], M(t, r, o), i && t !== G && M(G, r, i); + } + : M, + wrap = function (t) { + var r = (q[t] = T(U.prototype)); + return (r._k = t), r; + }, + $ = + Q && "symbol" == typeof U.iterator + ? function (t) { + return "symbol" == typeof t; + } + : function (t) { + return t instanceof U; + }, + Z = function defineProperty(t, r, o) { + return ( + t === G && Z(z, r, o), + w(t), + (r = I(r, !0)), + w(o), + a(q, r) + ? (o.enumerable + ? (a(t, V) && t[V][r] && (t[V][r] = !1), + (o = T(o, {enumerable: P(0, !1)}))) + : (a(t, V) || M(t, V, P(1, {})), (t[V][r] = !0)), + J(t, r, o)) + : M(t, r, o) + ); + }, + ee = function defineProperties(t, r) { + w(t); + for (var o, i = E((r = x(r))), a = 0, u = i.length; u > a; ) + Z(t, (o = i[a++]), r[o]); + return t; + }, + te = function propertyIsEnumerable(t) { + var r = B.call(this, (t = I(t, !0))); + return ( + !(this === G && a(q, t) && !a(z, t)) && + (!(r || !a(this, t) || !a(q, t) || (a(this, V) && this[V][t])) || r) + ); + }, + ne = function getOwnPropertyDescriptor(t, r) { + if (((t = x(t)), (r = I(r, !0)), t !== G || !a(q, r) || a(z, r))) { + var o = k(t, r); + return !o || !a(q, r) || (a(t, V) && t[V][r]) || (o.enumerable = !0), o; + } + }, + re = function getOwnPropertyNames(t) { + for (var r, o = j(x(t)), i = [], u = 0; o.length > u; ) + a(q, (r = o[u++])) || r == V || r == d || i.push(r); + return i; + }, + oe = function getOwnPropertySymbols(t) { + for (var r, o = t === G, i = j(o ? z : x(t)), u = [], c = 0; i.length > c; ) + !a(q, (r = i[c++])) || (o && !a(G, r)) || u.push(q[r]); + return u; + }; + Q || + ((U = function Symbol() { + if (this instanceof U) throw TypeError("Symbol is not a constructor!"); + var t = y(arguments.length > 0 ? arguments[0] : void 0), + $set = function (r) { + this === G && $set.call(z, r), + a(this, V) && a(this[V], t) && (this[V][t] = !1), + J(this, t, P(1, r)); + }; + return u && Y && J(G, t, {configurable: !0, set: $set}), wrap(t); + }), + l(U.prototype, "toString", function toString() { + return this._k; + }), + (R.f = ne), + (L.f = Z), + (o(1137).f = A.f = re), + (o(728).f = te), + (N.f = oe), + u && !o(1107) && l(G, "propertyIsEnumerable", te, !0), + (g.f = function (t) { + return wrap(_(t)); + })), + c(c.G + c.W + c.F * !Q, {Symbol: U}); + for ( + var ie = + "hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split( + "," + ), + ae = 0; + ie.length > ae; + + ) + _(ie[ae++]); + for (var ue = C(_.store), ce = 0; ue.length > ce; ) b(ue[ce++]); + c(c.S + c.F * !Q, "Symbol", { + for: function (t) { + return a(H, (t += "")) ? H[t] : (H[t] = U(t)); + }, + keyFor: function keyFor(t) { + if (!$(t)) throw TypeError(t + " is not a symbol!"); + for (var r in H) if (H[r] === t) return r; + }, + useSetter: function () { + Y = !0; + }, + useSimple: function () { + Y = !1; + }, + }), + c(c.S + c.F * !Q, "Object", { + create: function create(t, r) { + return void 0 === r ? T(t) : ee(T(t), r); + }, + defineProperty: Z, + defineProperties: ee, + getOwnPropertyDescriptor: ne, + getOwnPropertyNames: re, + getOwnPropertySymbols: oe, + }); + var se = p(function () { + N.f(1); + }); + c(c.S + c.F * se, "Object", { + getOwnPropertySymbols: function getOwnPropertySymbols(t) { + return N.f(O(t)); + }, + }), + W && + c( + c.S + + c.F * + (!Q || + p(function () { + var t = U(); + return ( + "[null]" != D([t]) || "{}" != D({a: t}) || "{}" != D(Object(t)) + ); + })), + "JSON", + { + stringify: function stringify(t) { + for (var r, o, i = [t], a = 1; arguments.length > a; ) + i.push(arguments[a++]); + if (((o = r = i[1]), (S(r) || void 0 !== t) && !$(t))) + return ( + m(r) || + (r = function (t, r) { + if (("function" == typeof o && (r = o.call(this, t, r)), !$(r))) + return r; + }), + (i[1] = r), + D.apply(W, i) + ); + }, + } + ), + U.prototype[K] || o(525)(U.prototype, K, U.prototype.valueOf), + h(U, "Symbol"), + h(Math, "Math", !0), + h(i.JSON, "JSON", !0); + }, + function (t, r, o) { + t.exports = + !o(427) && + !o(595)(function () { + return ( + 7 != + Object.defineProperty(o(1381)("div"), "a", { + get: function () { + return 7; + }, + }).a + ); + }); + }, + function (t, r, o) { + var i = o(524), + a = o(497), + u = o(1432)(!1), + c = o(1135)("IE_PROTO"); + t.exports = function (t, r) { + var o, + l = a(t), + d = 0, + p = []; + for (o in l) o != c && i(l, o) && p.push(o); + for (; r.length > d; ) i(l, (o = r[d++])) && (~u(p, o) || p.push(o)); + return p; + }; + }, + function (t, r) { + t.exports = function (t, r) { + return {value: r, done: !!t}; + }; + }, + function (t, r, o) { + var i = o(523); + t.exports = function (t, r, o, a) { + try { + return a ? r(i(o)[0], o[1]) : r(o); + } catch (r) { + var u = t.return; + throw (void 0 !== u && i(u.call(t)), r); + } + }; + }, + function (t, r, o) { + var i = o(722), + a = o(426)("iterator"), + u = Array.prototype; + t.exports = function (t) { + return void 0 !== t && (i.Array === t || u[a] === t); + }; + }, + function (t, r, o) { + var i = o(1382), + a = o(426)("iterator"), + u = o(722); + t.exports = o(323).getIteratorMethod = function (t) { + if (null != t) return t[a] || t["@@iterator"] || u[i(t)]; + }; + }, + function (t, r, o) { + "use strict"; + var i = o(434), + a = o(721); + t.exports = function (t, r, o) { + r in t ? i.f(t, r, a(0, o)) : (t[r] = o); + }; + }, + function (t, r, o) { + "use strict"; + var i = o(434).f, + a = o(1127), + u = o(1139), + c = o(665), + l = o(1140), + d = o(723), + p = o(1138), + v = o(1387), + h = o(1426), + y = o(427), + _ = o(734).fastKey, + g = o(668), + b = y ? "_s" : "size", + getEntry = function (t, r) { + var o, + i = _(r); + if ("F" !== i) return t._i[i]; + for (o = t._f; o; o = o.n) if (o.k == r) return o; + }; + t.exports = { + getConstructor: function (t, r, o, p) { + var v = t(function (t, i) { + l(t, v, r, "_i"), + (t._t = r), + (t._i = a(null)), + (t._f = void 0), + (t._l = void 0), + (t[b] = 0), + null != i && d(i, o, t[p], t); + }); + return ( + u(v.prototype, { + clear: function clear() { + for (var t = g(this, r), o = t._i, i = t._f; i; i = i.n) + (i.r = !0), i.p && (i.p = i.p.n = void 0), delete o[i.i]; + (t._f = t._l = void 0), (t[b] = 0); + }, + delete: function (t) { + var o = g(this, r), + i = getEntry(o, t); + if (i) { + var a = i.n, + u = i.p; + delete o._i[i.i], + (i.r = !0), + u && (u.n = a), + a && (a.p = u), + o._f == i && (o._f = a), + o._l == i && (o._l = u), + o[b]--; + } + return !!i; + }, + forEach: function forEach(t) { + g(this, r); + for ( + var o, i = c(t, arguments.length > 1 ? arguments[1] : void 0, 3); + (o = o ? o.n : this._f); + + ) + for (i(o.v, o.k, this); o && o.r; ) o = o.p; + }, + has: function has(t) { + return !!getEntry(g(this, r), t); + }, + }), + y && + i(v.prototype, "size", { + get: function () { + return g(this, r)[b]; + }, + }), + v + ); + }, + def: function (t, r, o) { + var i, + a, + u = getEntry(t, r); + return ( + u + ? (u.v = o) + : ((t._l = u = + {i: (a = _(r, !0)), k: r, v: o, p: (i = t._l), n: void 0, r: !1}), + t._f || (t._f = u), + i && (i.n = u), + t[b]++, + "F" !== a && (t._i[a] = u)), + t + ); + }, + getEntry: getEntry, + setStrong: function (t, r, o) { + p( + t, + r, + function (t, o) { + (this._t = g(t, r)), (this._k = o), (this._l = void 0); + }, + function () { + for (var t = this, r = t._k, o = t._l; o && o.r; ) o = o.p; + return t._t && (t._l = o = o ? o.n : t._t._f) + ? v(0, "keys" == r ? o.k : "values" == r ? o.v : [o.k, o.v]) + : ((t._t = void 0), v(1)); + }, + o ? "entries" : "values", + !o, + !0 + ), + h(r); + }, + }; + }, + function (t, r, o) { + var i = o(1382), + a = o(1464); + t.exports = function (t) { + return function toJSON() { + if (i(this) != t) throw TypeError(t + "#toJSON isn't generic"); + return a(this); + }; + }; + }, + , + , + function (t, r, o) { + "use strict"; + o(24), o(3), o(18), o(33), o(1); + var i = o(527), + a = o(495), + u = o(591), + c = o(590), + l = o(664), + d = o(1118), + p = o(493); + Object.defineProperty(r, "__esModule", {value: !0}), + (r.create = void 0), + o(118), + o(25), + o(66); + var v = p(o(588)), + h = p(o(1380)), + y = o(1498), + _ = o(1399), + g = _interopRequireWildcard(o(1179)), + b = _interopRequireWildcard(o(1401)), + E = o(100), + m = o(1418), + w = o(1402), + S = p(o(223)); + function _getRequireWildcardCache(t) { + if ("function" != typeof d) return null; + var r = new d(), + o = new d(); + return (_getRequireWildcardCache = function _getRequireWildcardCache(t) { + return t ? o : r; + })(t); + } + function _interopRequireWildcard(t, r) { + if (!r && t && t.__esModule) return t; + if (null === t || ("object" !== i(t) && "function" != typeof t)) + return {default: t}; + var o = _getRequireWildcardCache(r); + if (o && o.has(t)) return o.get(t); + var a = {}, + u = Object.defineProperty && c; + for (var l in t) + if ("default" !== l && Object.prototype.hasOwnProperty.call(t, l)) { + var d = u ? c(t, l) : null; + d && (d.get || d.set) ? Object.defineProperty(a, l, d) : (a[l] = t[l]); + } + return (a.default = t), o && o.set(t, a), a; + } + function ownKeys(t, r) { + var o = a(t); + if (u) { + var i = u(t); + r && + (i = i.filter(function (r) { + return c(t, r).enumerable; + })), + o.push.apply(o, i); + } + return o; + } + function _objectSpread(t) { + for (var r = 1; r < arguments.length; r++) { + var o = null != arguments[r] ? arguments[r] : {}; + r % 2 + ? ownKeys(Object(o), !0).forEach(function (r) { + (0, v.default)(t, r, o[r]); + }) + : l + ? Object.defineProperties(t, l(o)) + : ownKeys(Object(o)).forEach(function (r) { + Object.defineProperty(t, r, c(o, r)); + }); + } + return t; + } + r.create = function create(t) { + var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + return ( + (r.detectedWeb3WalletIds = (0, m.getInstalledWalletPlugins)( + r.web3ValidChains && r.web3ValidChains[0] + )), + (r.version = E.VERSION), + (0, y.create)(t, r) + ); + }; + (b.hooks.getConfig = function (t, r) { + return (function getConfig(t) { + var r = t.apiVersion, + o = t.clientName, + i = t.configUserId, + a = t.configUserTags, + u = t.countryCodes, + c = t.customizations, + l = t.depositSwitchToken, + d = t.embeddedOpenLinkConfiguration, + p = t.embeddedWorkflowSessionId, + v = t.embeddedComponentConfiguration, + h = t.env, + y = t.experimentVariants, + _ = t.forceDarkMode, + b = t.hostedLinkVersion, + E = t.institutionContactMessagingInstitutions, + m = t.isEagerStart, + w = t.isEmbedded, + O = t.isPrivacyPortalItemAdd, + x = t.isSimpleIntegration, + I = t.isUsingWalletOnboardCallback, + P = t.key, + T = t.language, + A = t.linkOpenId, + R = t.linkCustomizationName, + N = t.logInternalAnalytics, + L = t.oauthNonce, + C = t.oauthRedirectUri, + k = t.oauthStateId, + M = t.onEvent, + j = t.onResult, + U = t.onExit, + W = t.onLoad, + D = t.paymentToken, + V = t.product, + K = t.receivedRedirectUri, + B = t.accountSubtypes, + H = t.selectAccount, + q = t.noLoadingState, + z = t.token, + G = t.useMockFingerprint, + Q = t.user, + X = t.userLegalName, + Y = t.userEmailAddress, + J = t.userPhoneNumber, + $ = t.webhook, + Z = t.workflowVersionOverride, + ee = t.detectedWeb3WalletIds, + te = t.web3ValidChains, + ne = t.version; + return { + apiVersion: r, + clientName: o, + configUserId: i, + configUserTags: a, + countryCodes: u, + customizations: c, + depositSwitchToken: l, + embeddedOpenLinkConfiguration: d, + embeddedComponentConfiguration: v, + embeddedWorkflowSessionId: p, + env: h, + experimentVariants: y, + forceIframe: !0, + forceDarkMode: _, + hostedLinkVersion: b, + institutionContactMessagingInstitutions: E, + isPrivacyPortalItemAdd: O, + isEagerStart: null != m && m, + isEmbedded: w, + isParentInlineStylesheetSupported: g.isInlineStylesheetSupported(), + isParentMetaViewportSet: g.isMetaViewportSet(), + isSimpleIntegration: !0 === x, + isUsingOnEventCallback: "function" == typeof M, + isUsingOnResultCallback: "function" == typeof j, + isUsingOnExitCallback: "function" == typeof U, + isUsingOnLoadCallback: "function" == typeof W, + isUsingWalletOnboardCallback: I, + key: P, + language: T, + linkCustomizationName: R, + linkOpenId: null != A ? A : (0, S.default)(), + logInternalAnalytics: !0 === N, + oauthNonce: L, + oauthRedirectUri: C, + oauthStateId: k, + parentMetaViewport: g.getMetaViewport(), + paymentToken: D, + product: V, + receivedRedirectUri: K, + accountSubtypes: B, + selectAccount: !0 === H, + noLoadingState: q, + token: z, + useMockFingerprint: G, + user: Q, + userLegalName: X, + userEmailAddress: Y, + userPhoneNumber: J, + version: ne, + webhook: $, + workflowVersionOverride: Z, + detectedWeb3WalletIds: ee, + web3ValidChains: te, + isLinkWebSdk: void 0, + linkSdkVersion: void 0, + }; + })( + _objectSpread( + _objectSpread({}, t), + {}, + { + isUsingWalletOnboardCallback: !!r.onProviderSuccess, + workflowVersionOverride: r.workflowVersionOverride, + detectedWeb3WalletIds: r.detectedWeb3WalletIds, + isEagerStart: r.isEagerStart, + version: r.version, + web3ValidChains: r.web3ValidChains, + forceDarkMode: r.forceDarkMode, + embeddedWorkflowSessionId: r.embeddedWorkflowSessionId, + embeddedOpenLinkConfiguration: r.embeddedOpenLinkConfiguration, + useMockFingerprint: r.useMockFingerprint, + } + ) + ); + }), + (b.hooks.getQueryParameters = function getQueryParameters(t) { + var r = t.countryCodes, + o = t.embeddedComponentConfiguration, + i = t.env, + a = t.experimentVariants, + u = t.key, + c = t.token, + l = t.language, + d = t.linkCustomizationName, + p = t.origin, + v = t.product, + y = t.accountSubtypes, + _ = t.uniqueId, + g = t.oauthStateId, + b = t.noLoadingState, + E = t.version, + m = t.hostedLinkVersion, + w = t.linkOpenId; + return { + countryCodes: r, + embeddedComponentConfiguration: null == o ? void 0 : (0, h.default)(o), + env: i, + experimentVariants: null == a ? void 0 : (0, h.default)(a), + isLinkInitialize: !0, + key: u, + token: c, + language: l, + linkCustomizationName: d, + origin: p, + product: v, + accountSubtypes: (0, h.default)(y), + uniqueId: _, + version: E, + oauthStateId: g, + noLoadingState: b, + hostedLinkVersion: m, + linkOpenId: w, + isLinkWebSdk: void 0, + linkSdkVersion: void 0, + }; + }), + (b.hooks.validateCreateOptions = w.validateCreateOptions), + (b.hooks.updateLinkURL = function (t, r) { + if ("1.1.0" === r.hostedLinkVersion) { + if (-1 !== t.indexOf("cdn.plaid.com")) + return t.replace("cdn.plaid.com", "secure.plaid.com"); + if (-1 !== t.indexOf("cdn-testing.plaid.com")) + return t.replace("cdn-testing.plaid.com", "secure-testing.plaid.com"); + } + return t; + }), + (b.hooks.emitLinkOpen = _.emitLinkOpen); + }, + function (t, r, o) { + "use strict"; + o(52), o(44), o(95), o(58), o(22), o(79), o(93), o(29), o(1), o(12); + var i = o(2), + a = o(11); + Object.defineProperty(r, "__esModule", {value: !0}), + (r.uuid = + r.sendMessage = + r.queryStringFromQueryParameters = + r.getWindowOrigin = + r.getUniqueId = + r.default = + r.createMessageEventListener = + r.buildLinkUrl = + void 0); + var u = i(o(26)); + o(37), o(235), o(86), o(9), o(3), o(10), o(14), o(108), o(121), o(55), o(25), o(66); + var c = (function _interopRequireWildcard(t, r) { + if (!r && t && t.__esModule) return t; + if (null === t || ("object" !== a(t) && "function" != typeof t)) + return {default: t}; + var o = _getRequireWildcardCache(r); + if (o && o.has(t)) return o.get(t); + var i = {}, + u = Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var c in t) + if ("default" !== c && Object.prototype.hasOwnProperty.call(t, c)) { + var l = u ? Object.getOwnPropertyDescriptor(t, c) : null; + l && (l.get || l.set) ? Object.defineProperty(i, c, l) : (i[c] = t[c]); + } + (i.default = t), o && o.set(t, i); + return i; + })(o(231)); + function _getRequireWildcardCache(t) { + if ("function" != typeof WeakMap) return null; + var r = new WeakMap(), + o = new WeakMap(); + return (_getRequireWildcardCache = function _getRequireWildcardCache(t) { + return t ? o : r; + })(t); + } + function _createForOfIteratorHelper(t, r) { + var o = ("undefined" != typeof Symbol && t[Symbol.iterator]) || t["@@iterator"]; + if (!o) { + if ( + Array.isArray(t) || + (o = (function _unsupportedIterableToArray(t, r) { + if (!t) return; + if ("string" == typeof t) return _arrayLikeToArray(t, r); + var o = Object.prototype.toString.call(t).slice(8, -1); + "Object" === o && t.constructor && (o = t.constructor.name); + if ("Map" === o || "Set" === o) return Array.from(t); + if ("Arguments" === o || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)) + return _arrayLikeToArray(t, r); + })(t)) || + (r && t && "number" == typeof t.length) + ) { + o && (t = o); + var i = 0, + a = function F() {}; + return { + s: a, + n: function n() { + return i >= t.length ? {done: !0} : {done: !1, value: t[i++]}; + }, + e: function e(t) { + throw t; + }, + f: a, + }; + } + throw new TypeError( + "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." + ); + } + var u, + c = !0, + l = !1; + return { + s: function s() { + o = o.call(t); + }, + n: function n() { + var t = o.next(); + return (c = t.done), t; + }, + e: function e(t) { + (l = !0), (u = t); + }, + f: function f() { + try { + c || null == o.return || o.return(); + } finally { + if (l) throw u; + } + }, + }; + } + function _arrayLikeToArray(t, r) { + (null == r || r > t.length) && (r = t.length); + for (var o = 0, i = new Array(r); o < r; o++) i[o] = t[o]; + return i; + } + r.buildLinkUrl = function buildLinkUrl(t) { + var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : c, + o = p(t), + i = + r.LINK_CLIENT_STABLE_URL.length > 0 + ? r.LINK_CLIENT_STABLE_URL + : r.LINK_CLIENT_URL, + a = r.LINK_HTML_PATH; + return "".concat(i).concat(a, "?").concat(o); + }; + var l, + d = + ((l = 0), + function () { + return (l += 1), String(l); + }); + r.getUniqueId = d; + r.getWindowOrigin = function getWindowOrigin() { + return null != window.location.origin + ? window.location.origin + : window.location.protocol + + "//" + + window.location.hostname + + (window.location.port ? ":" + window.location.port : ""); + }; + r.sendMessage = function sendMessage(t) { + var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : void 0; + return function (o) { + var i = Object.assign({}, o, { + action: "".concat(c.PLAID_INTERNAL_NAMESPACE, "::").concat(o.action), + }); + t.postMessage(JSON.stringify(i), r || c.LINK_CLIENT_CORS_ORIGIN); + }; + }; + r.createMessageEventListener = function createMessageEventListener(t, r, o) { + return function (i) { + var a = (function parseJSON(t) { + try { + return JSON.parse(t); + } catch (t) { + return {}; + } + })(i.data); + for (var u in o) + if (a.action === "".concat(t, "-").concat(r, "::").concat(u)) return o[u](a); + }; + }; + var p = function queryStringFromQueryParameters(t) { + for ( + var r = new URLSearchParams(), o = 0, i = Object.entries(t); + o < i.length; + o++ + ) { + var a = (0, u.default)(i[o], 2), + c = a[0], + l = a[1]; + if (null != l) + if (Array.isArray(l)) { + if (l.length > 0) { + var d, + p = _createForOfIteratorHelper(l); + try { + for (p.s(); !(d = p.n()).done; ) { + var v = d.value; + null != v && r.append(c, v); + } + } catch (t) { + p.e(t); + } finally { + p.f(); + } + } + } else "boolean" == typeof l ? r.append(c, String(l)) : r.append(c, l); + } + return r.toString(); + }; + r.queryStringFromQueryParameters = p; + var v = function uuid() { + var t = window.crypto || window.msCrypto; + return null != t && "randomUUID" in t + ? t.randomUUID() + : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (t) { + var r = (16 * Math.random()) | 0; + return ("x" === t ? r : (3 & r) | 8).toString(16); + }); + }; + r.uuid = v; + var h = v; + r.default = h; + }, + function (t, r, o) { + "use strict"; + o(1), + Object.defineProperty(r, "__esModule", {value: !0}), + (r.messageHandlerExtensions = r.hooks = void 0); + r.messageHandlerExtensions = {}; + r.hooks = { + getConfig: null, + getQueryParameters: null, + validateCreateOptions: null, + updateLinkURL: null, + emitLinkOpen: null, + }; + }, + function (t, r, o) { + "use strict"; + o(1), + Object.defineProperty(r, "__esModule", {value: !0}), + (r.emitLinkOpen = void 0); + var i = o(231); + r.emitLinkOpen = function emitLinkOpen(t) { + var r = document.createElement("iframe"); + (r.id = "plaid-link-open-iframe"), + (r.title = "Plaid Link Open"), + (r.src = t), + (r.allow = "camera ".concat(i.LINK_IFRAME_FEATURE_POLICY_URLS, ";")), + r.setAttribute("sandbox", i.LINK_IFRAME_SANDBOX_PERMISSIONS), + (r.width = "100%"), + (r.height = "100%"), + (r.style.position = "fixed"), + (r.style.top = "0"), + (r.style.left = "0"), + (r.style.right = "0"), + (r.style.bottom = "0"), + (r.style.zIndex = "9999999999"), + (r.style.borderWidth = "0"), + (r.style.display = "none"), + (r.style.overflowX = "hidden"), + (r.style.overflowY = "auto"), + (r.onload = function () { + r.parentNode && r.parentNode.removeChild(r); + }), + document.body.appendChild(r); + }; + }, + function (t, r, o) { + "use strict"; + o(1); + var i = o(2); + Object.defineProperty(r, "__esModule", {value: !0}), + (r.validateExitOptions = r.validateCreateOptions = void 0); + var a = i(o(11)); + o(118); + var u = o(231), + c = function getValidationHandlers(t) { + var r = t.env; + return { + error: function error(t) { + if ("production" !== r) throw new Error(t); + }, + warn: function warn(t) { + "production" !== r && console.warn(t); + }, + }; + }; + r.validateCreateOptions = function validateCreateOptions(t) { + var r = c(t).error; + !(function validateCreateKeys(t) { + var r = c(t).warn; + for (var o in t) + u.CREATE_PARAMETERS.indexOf(o) < 0 && + r( + "Invalid Link parameter: ".concat( + o, + " is not a valid Plaid.create() parameter" + ) + ); + })(t), + "function" != typeof t.onSuccess && r("Invalid onSuccess function"), + null == t.receivedRedirectUri && + null == t.token && + r("Missing Link parameter. Link requires a token to be provided."); + }; + r.validateExitOptions = function validateExitOptions(t, r) { + var o = c(t).error; + return ( + null == r || + ("object" !== (0, a.default)(r) && + o("Invalid exit parameter, must be an Object")), + null + ); + }; + }, + function (t, r, o) { + "use strict"; + var i = o(495); + o(1), o(3), o(18), Object.defineProperty(r, "__esModule", {value: !0}); + var a = o(1398); + i(a).forEach(function (t) { + "default" !== t && + "__esModule" !== t && + ((t in r && r[t] === a[t]) || + Object.defineProperty(r, t, { + enumerable: !0, + get: function get() { + return a[t]; + }, + })); + }); + }, + function (t, r, o) { + "use strict"; + o(1), + Object.defineProperty(r, "__esModule", {value: !0}), + (r.validateEmbeddedComponentConfiguration = r.validateCreateOptions = void 0), + o(118); + var i = o(1180), + a = function getValidationHandlers(t) { + var r = t.env; + return { + error: function error(t) { + if ("production" !== r) throw new Error(t); + }, + warn: function warn(t) { + "production" !== r && console.warn(t); + }, + }; + }; + r.validateCreateOptions = function validateCreateOptions(t) { + var r = a(t), + o = r.error, + u = r.warn; + !(function validateCreateKeys(t) { + var r = a(t).warn; + for (var o in t) + i.CREATE_PARAMETERS.indexOf(o) < 0 && + r( + "Invalid Link parameter: ".concat( + o, + " is not a valid Plaid.create() parameter" + ) + ); + })(t), + "function" != typeof t.onSuccess && o("Invalid onSuccess function"), + void 0 !== t.forceIframe && + u( + "The forceIframe option has been deprecated. Link will use an iframe by default when possible." + ), + null == t.key && + null == t.token && + null == t.receivedRedirectUri && + o( + "Missing Link parameter. Link requires a key, token, or received redirect URI to be provided." + ); + }; + r.validateEmbeddedComponentConfiguration = + function validateEmbeddedComponentConfiguration(t) { + switch (null == t ? void 0 : t.type) { + case "button": + return {button_component_configuration: {}}; + case "mini_card": + return {mini_card_component_configuration: {}}; + case "institution_select": + return {institution_select_component_configuration: {}}; + case "chip": + return {chip_component_configuration: {}}; + } + return null; + }; + }, + function (t, r) { + (t.exports = function _arrayLikeToArray(t, r) { + (null == r || r > t.length) && (r = t.length); + for (var o = 0, i = new Array(r); o < r; o++) i[o] = t[o]; + return i; + }), + (t.exports.__esModule = !0), + (t.exports.default = t.exports); + }, + , + , + , + , + , + , + , + , + , + , + , + function (t, r, o) { + "use strict"; + o(1), + Object.defineProperty(r, "__esModule", {value: !0}), + (r.default = function determineChainTypeFromChainId(t) { + var r = t.split(":"); + if (r.length < 2) + return "0x" === t.substring(0, 2) ? i.ChainTypes.EVM : i.ChainTypes.Unknown; + switch (r[0]) { + case "solana": + return i.ChainTypes.Solana; + case "eip155": + case "EIP155": + return i.ChainTypes.EVM; + default: + return i.ChainTypes.Unknown; + } + }); + var i = o(1378); + }, + , + function (t, r, o) { + t.exports = o(1453); + }, + function (t, r, o) { + "use strict"; + var i = o(1117), + a = o(1130), + u = o(1146); + o(52), o(44), o(25), o(58), o(1); + var c = o(493); + Object.defineProperty(r, "__esModule", {value: !0}), + (r.getProviderByChainType = + r.getInstalledWalletPlugins = + r.getEIP1193ProviderByWalletBrandId = + void 0); + var l = c(o(527)), + d = c(o(588)), + p = c(o(1419)), + v = c(o(1467)), + h = c(o(1471)), + y = c(o(1117)); + o(210), o(3), o(55), o(18), o(24), o(120); + var _, + g, + b, + E = o(1421), + m = c(o(395)), + w = o(1378), + S = c(o(1415)); + function _createForOfIteratorHelper(t, r) { + var o = (void 0 !== a && t[u]) || t["@@iterator"]; + if (!o) { + if ( + Array.isArray(t) || + (o = (function _unsupportedIterableToArray(t, r) { + if (!t) return; + if ("string" == typeof t) return _arrayLikeToArray(t, r); + var o = Object.prototype.toString.call(t).slice(8, -1); + "Object" === o && t.constructor && (o = t.constructor.name); + if ("Map" === o || "Set" === o) return i(t); + if ("Arguments" === o || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)) + return _arrayLikeToArray(t, r); + })(t)) || + (r && t && "number" == typeof t.length) + ) { + o && (t = o); + var c = 0, + l = function F() {}; + return { + s: l, + n: function n() { + return c >= t.length ? {done: !0} : {done: !1, value: t[c++]}; + }, + e: function e(t) { + throw t; + }, + f: l, + }; + } + throw new TypeError( + "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." + ); + } + var d, + p = !0, + v = !1; + return { + s: function s() { + o = o.call(t); + }, + n: function n() { + var t = o.next(); + return (p = t.done), t; + }, + e: function e(t) { + (v = !0), (d = t); + }, + f: function f() { + try { + p || null == o.return || o.return(); + } finally { + if (v) throw d; + } + }, + }; + } + function _arrayLikeToArray(t, r) { + (null == r || r > t.length) && (r = t.length); + for (var o = 0, i = new Array(r); o < r; o++) i[o] = t[o]; + return i; + } + var O = [ + "isMetaMask", + "isBraveWallet", + "isCoinbaseWallet", + "isCoinbaseBrowser", + "isRabby", + "__XDEFI", + "isXDEFI", + "isGamestop", + "isBitKeep", + "isBitKeepChrome", + "isMathWallet", + "isTokenary", + "isTally", + "isAlphaWallet", + "isBitpie", + "isBlockWallet", + "isExodus", + "isHbWallet", + "isImToken", + "isLiquality", + "isTrust", + "isTrustWallet", + "isOneInchIOSWallet", + "isOneInchAndroidWallet", + "isTokenPocket", + "isMEWwallet", + "isSequence", + "isDfox", + "isDeficonnectProvider", + "isPhantom", + "isSolflare", + "isGlow", + ].sort(), + x = new p.default( + (0, v.default)( + ((_ = {isMetaMask: "wallet_347"}), + (0, d.default)(_, ["isBraveWallet", "isMetaMask"].toString(), "wallet_375"), + (0, d.default)(_, ["isBraveWallet", "isPhantom"].toString(), "wallet_375"), + (0, d.default)(_, ["__XDEFI", "isXDEFI"].toString(), "wallet_343"), + (0, d.default)(_, ["__XDEFI", "isMetaMask"].toString(), "wallet_343"), + (0, d.default)(_, ["isMetaMask", "isRabby"].toString(), "wallet_353"), + (0, d.default)( + _, + ["isBitKeep", "isBitKeepChrome", "isMetaMask"].toString(), + "wallet_354" + ), + (0, d.default)(_, ["isMathWallet", "isMetaMask"].toString(), "wallet_349"), + (0, d.default)(_, ["isMetaMask", "isTokenary"].toString(), "wallet_351"), + (0, d.default)( + _, + ["isDeficonnectProvider", "isMetaMask"].toString(), + "wallet_356" + ), + (0, d.default)(_, "isCoinbaseWallet", "wallet_374"), + (0, d.default)(_, "isGamestop", "wallet_344"), + (0, d.default)(_, "isTally", "wallet_345"), + (0, d.default)(_, "isBlockWallet", "wallet_340"), + (0, d.default)(_, "isLiquality", "wallet_342"), + (0, d.default)( + _, + ["isDfox", "isMetaMask", "isTokenPocket"].toString(), + "wallet_348" + ), + (0, d.default)(_, ["isTrust", "isTrustWallet"].toString(), "wallet_355"), + (0, d.default)(_, "isPhantom", "wallet_420"), + (0, d.default)(_, ["isPhantom", "isGlow"].toString(), "wallet_411"), + _) + ) + ), + I = [ + { + walletId: "wallet_374", + brandId: "wallet_236", + providerPath: ["coinbaseWalletExtension"], + injectedProviderChainType: w.ChainTypes.EVM, + }, + { + walletId: "wallet_432", + brandId: "wallet_236", + providerPath: ["coinbaseSolana"], + injectedProviderChainType: w.ChainTypes.Solana, + }, + { + walletId: "wallet_345", + brandId: "wallet_233", + providerPath: ["tally"], + injectedProviderChainType: w.ChainTypes.EVM, + }, + { + walletId: "wallet_347", + brandId: "wallet_4", + injectedProviderChainType: w.ChainTypes.EVM, + }, + { + walletId: "wallet_354", + brandId: "wallet_126", + providerPath: ["bitkeep", "ethereum"], + injectedProviderChainType: w.ChainTypes.EVM, + }, + { + walletId: "wallet_344", + brandId: "wallet_232", + providerPath: ["gamestop"], + injectedProviderChainType: w.ChainTypes.EVM, + }, + { + walletId: "wallet_343", + brandId: "wallet_231", + injectedProviderChainType: w.ChainTypes.EVM, + }, + { + walletId: "wallet_349", + brandId: "wallet_13", + injectedProviderChainType: w.ChainTypes.EVM, + }, + { + walletId: "wallet_348", + brandId: "wallet_11", + injectedProviderChainType: w.ChainTypes.EVM, + }, + { + walletId: "wallet_353", + brandId: "wallet_70", + injectedProviderChainType: w.ChainTypes.EVM, + }, + { + walletId: "wallet_340", + brandId: "wallet_229", + injectedProviderChainType: w.ChainTypes.EVM, + }, + { + walletId: "wallet_341", + brandId: "wallet_129", + providerPath: ["exodus", "ethereum"], + injectedProviderChainType: w.ChainTypes.EVM, + }, + { + walletId: "wallet_342", + brandId: "wallet_230", + injectedProviderChainType: w.ChainTypes.EVM, + }, + { + walletId: "wallet_375", + brandId: "wallet_237", + injectedProviderChainType: w.ChainTypes.EVM, + }, + { + walletId: "wallet_375", + brandId: "wallet_237", + providerPath: ["braveSolana"], + injectedProviderChainType: w.ChainTypes.Solana, + }, + { + walletId: "wallet_355", + brandId: "wallet_2", + providerPath: ["trustwallet"], + injectedProviderChainType: w.ChainTypes.EVM, + }, + { + walletId: "wallet_355", + brandId: "wallet_2", + providerPath: ["trustwallet", "solana"], + injectedProviderChainType: w.ChainTypes.Solana, + }, + { + walletId: "wallet_356", + brandId: "wallet_6", + providerPath: ["deficonnectProvider"], + injectedProviderChainType: w.ChainTypes.EVM, + }, + { + walletId: "wallet_426", + brandId: "wallet_273", + providerPath: ["solflare"], + injectedProviderChainType: w.ChainTypes.Solana, + }, + { + walletId: "wallet_411", + brandId: "wallet_264", + providerPath: ["glowSolana"], + injectedProviderChainType: w.ChainTypes.Solana, + }, + ], + P = new p.default( + (0, v.default)( + ((g = {isMetaMask: "wallet_358", isCoinbaseWallet: "wallet_374"}), + (0, d.default)( + g, + ["isCoinbaseBrowser", "isCoinbaseWallet"].toString(), + "wallet_372" + ), + (0, d.default)(g, "isAlphaWallet", "wallet_364"), + (0, d.default)(g, "isBitpie", "wallet_368"), + (0, d.default)(g, "isHbWallet", "wallet_362"), + (0, d.default)(g, "isImToken", "wallet_359"), + (0, d.default)(g, "isTrust", "wallet_365"), + (0, d.default)( + g, + ["isMetaMask", "isOneInchAndroidWallet", "isOneInchIOSWallet"].toString(), + "wallet_361" + ), + (0, d.default)(g, ["isMathWallet", "isMetaMask"].toString(), "wallet_370"), + (0, d.default)(g, ["isBitKeep", "isMetaMask"].toString(), "wallet_371"), + (0, d.default)( + g, + ["isMetaMask", "isTokenPocket", "isTrust"].toString(), + "wallet_360" + ), + (0, d.default)( + g, + ["isMEWwallet", "isMetaMask", "isTrust"].toString(), + "wallet_376" + ), + (0, d.default)(g, "isPhantom", "wallet_433"), + g) + ) + ), + T = new p.default( + (0, v.default)( + ((b = {}), + (0, d.default)(b, w.ChainTypes.EVM, function () { + return window.ethereum; + }), + (0, d.default)(b, w.ChainTypes.Solana, function () { + return window.solana; + }), + b) + ) + ), + A = function getProviderByChainType(t) { + var r = T.get(t.toString()); + if (void 0 !== r) return r(); + }; + r.getProviderByChainType = A; + r.getInstalledWalletPlugins = function getInstalledWalletPlugins(t) { + var r = new h.default(), + o = t ? (0, S.default)(t) : w.ChainTypes.EVM, + i = (0, m.default)().isMobile; + i || + I.forEach(function (t) { + N(t) && t.injectedProviderChainType === o && r.add(t.walletId); + }); + var a = A(o); + if (a) { + var u, + c = _createForOfIteratorHelper(null != a && a.providers ? a.providers : [a]); + try { + var l = function _loop() { + var t = u.value, + o = []; + O.forEach(function (r) { + !0 === t[r] && o.push(r); + }); + var a = i ? P.get(o.toString()) : x.get(o.toString()); + (a && r.has(a)) || + r.add( + a || + (i ? E.UnidentifiedMobileBrowserWallet : E.UnidentifiedPluginWallet) + ); + }; + for (c.s(); !(u = c.n()).done; ) l(); + } catch (t) { + c.e(t); + } finally { + c.f(); + } + } + return ( + r.size > 1 && r.delete("wallet_353"), + r.size > 1 && + (r.delete(E.UnidentifiedMobileBrowserWallet), + r.delete(E.UnidentifiedPluginWallet)), + (0, y.default)(r) + ); + }; + r.getEIP1193ProviderByWalletBrandId = function getEIP1193ProviderByWalletBrandId( + t + ) { + var r = I.filter(function (r) { + return r.brandId === t; + }), + o = (0, m.default)().isMobile; + return 1 !== r.length || o ? window.ethereum : R(r[0]); + }; + var R = function getEIP1193ProviderFromProviderPath(t) { + var r = window.ethereum; + if (t.providerPath || r) { + if (t.providerPath) { + var o = N(t); + return o || void 0; + } + if (r) { + var i, + a = _createForOfIteratorHelper(r.providers ? r.providers : [r]); + try { + var u = function _loop2() { + var r = i.value, + o = []; + if ( + (O.forEach(function (t) { + !0 === r[t] && o.push(t); + }), + x.get(o.toString()) === t.walletId) + ) + return {v: r}; + }; + for (a.s(); !(i = a.n()).done; ) { + var c = u(); + if ("object" === (0, l.default)(c)) return c.v; + } + } catch (t) { + a.e(t); + } finally { + a.f(); + } + } + } + }, + N = function findProvider(t) { + var r; + return null == t || null === (r = t.providerPath) || void 0 === r + ? void 0 + : r.reduce(function (t, r) { + if (t) return t[r]; + }, window); + }; + }, + function (t, r, o) { + t.exports = o(1461); + }, + function (t, r, o) { + var i = o(524), + a = o(666), + u = o(1135)("IE_PROTO"), + c = Object.prototype; + t.exports = + Object.getPrototypeOf || + function (t) { + return ( + (t = a(t)), + i(t, u) + ? t[u] + : "function" == typeof t.constructor && t instanceof t.constructor + ? t.constructor.prototype + : t instanceof Object + ? c + : null + ); + }; + }, + function (t, r, o) { + "use strict"; + o(1), + Object.defineProperty(r, "__esModule", {value: !0}), + (r.WalletConnectBrand = + r.UnidentifiedWalletBrand = + r.UnidentifiedPluginWallet = + r.UnidentifiedMobileBrowserWallet = + r.TrustWalletBrandId = + void 0); + r.UnidentifiedWalletBrand = "wallet_240"; + r.UnidentifiedMobileBrowserWallet = "wallet_380"; + r.UnidentifiedPluginWallet = "wallet_381"; + r.WalletConnectBrand = "wallet_235"; + r.TrustWalletBrandId = "wallet_2"; + }, + , + function (t, r, o) { + var i = o(425).document; + t.exports = i && i.documentElement; + }, + function (t, r, o) { + var i = o(527).default, + a = o(1455); + (t.exports = function _toPropertyKey(t) { + var r = a(t, "string"); + return "symbol" === i(r) ? r : String(r); + }), + (t.exports.__esModule = !0), + (t.exports.default = t.exports); + }, + function (t, r, o) { + var i = o(426)("iterator"), + a = !1; + try { + var u = [7][i](); + (u.return = function () { + a = !0; + }), + Array.from(u, function () { + throw 2; + }); + } catch (t) {} + t.exports = function (t, r) { + if (!r && !a) return !1; + var o = !1; + try { + var u = [7], + c = u[i](); + (c.next = function () { + return {done: (o = !0)}; + }), + (u[i] = function () { + return c; + }), + t(u); + } catch (t) {} + return o; + }; + }, + function (t, r, o) { + "use strict"; + var i = o(425), + a = o(323), + u = o(434), + c = o(427), + l = o(426)("species"); + t.exports = function (t) { + var r = "function" == typeof a[t] ? a[t] : i[t]; + c && + r && + !r[l] && + u.f(r, l, { + configurable: !0, + get: function () { + return this; + }, + }); + }; + }, + , + , + , + function (t, r, o) { + o(1384), o(1114), o(1436), o(1437), (t.exports = o(323).Symbol); + }, + function (t, r, o) { + var i = o(667), + a = o(1116), + u = o(728); + t.exports = function (t) { + var r = i(t), + o = a.f; + if (o) + for (var c, l = o(t), d = u.f, p = 0; l.length > p; ) + d.call(t, (c = l[p++])) && r.push(c); + return r; + }; + }, + function (t, r, o) { + var i = o(497), + a = o(1113), + u = o(1433); + t.exports = function (t) { + return function (r, o, c) { + var l, + d = i(r), + p = a(d.length), + v = u(c, p); + if (t && o != o) { + for (; p > v; ) if ((l = d[v++]) != l) return !0; + } else for (; p > v; v++) if ((t || v in d) && d[v] === o) return t || v || 0; + return !t && -1; + }; + }; + }, + function (t, r, o) { + var i = o(1134), + a = Math.max, + u = Math.min; + t.exports = function (t, r) { + return (t = i(t)) < 0 ? a(t + r, 0) : u(t, r); + }; + }, + function (t, r, o) { + var i = o(434), + a = o(523), + u = o(667); + t.exports = o(427) + ? Object.defineProperties + : function defineProperties(t, r) { + a(t); + for (var o, c = u(r), l = c.length, d = 0; l > d; ) + i.f(t, (o = c[d++]), r[o]); + return t; + }; + }, + function (t, r, o) { + var i = o(497), + a = o(1137).f, + u = {}.toString, + c = + "object" == typeof window && window && Object.getOwnPropertyNames + ? Object.getOwnPropertyNames(window) + : []; + t.exports.f = function getOwnPropertyNames(t) { + return c && "[object Window]" == u.call(t) + ? (function (t) { + try { + return a(t); + } catch (t) { + return c.slice(); + } + })(t) + : a(i(t)); + }; + }, + function (t, r, o) { + o(1133)("asyncIterator"); + }, + function (t, r, o) { + o(1133)("observable"); + }, + function (t, r, o) { + o(1109), o(1115), (t.exports = o(1112).f("iterator")); + }, + function (t, r, o) { + var i = o(1134), + a = o(1129); + t.exports = function (t) { + return function (r, o) { + var u, + c, + l = String(a(r)), + d = i(o), + p = l.length; + return d < 0 || d >= p + ? t + ? "" + : void 0 + : (u = l.charCodeAt(d)) < 55296 || + u > 56319 || + d + 1 === p || + (c = l.charCodeAt(d + 1)) < 56320 || + c > 57343 + ? t + ? l.charAt(d) + : u + : t + ? l.slice(d, d + 2) + : c - 56320 + ((u - 55296) << 10) + 65536; + }; + }; + }, + function (t, r, o) { + "use strict"; + var i = o(1127), + a = o(721), + u = o(1108), + c = {}; + o(525)(c, o(426)("iterator"), function () { + return this; + }), + (t.exports = function (t, r, o) { + (t.prototype = i(c, {next: a(1, o)})), u(t, r + " Iterator"); + }); + }, + function (t, r, o) { + "use strict"; + var i = o(1442), + a = o(1387), + u = o(722), + c = o(497); + (t.exports = o(1138)( + Array, + "Array", + function (t, r) { + (this._t = c(t)), (this._i = 0), (this._k = r); + }, + function () { + var t = this._t, + r = this._k, + o = this._i++; + return !t || o >= t.length + ? ((this._t = void 0), a(1)) + : a(0, "keys" == r ? o : "values" == r ? t[o] : [o, t[o]]); + }, + "values" + )), + (u.Arguments = u.Array), + i("keys"), + i("values"), + i("entries"); + }, + function (t, r) { + t.exports = function () {}; + }, + function (t, r, o) { + var i = o(1444); + t.exports = function (t, r) { + return new (i(t))(r); + }; + }, + function (t, r, o) { + var i = o(483), + a = o(1145), + u = o(426)("species"); + t.exports = function (t) { + var r; + return ( + a(t) && + ("function" != typeof (r = t.constructor) || + (r !== Array && !a(r.prototype)) || + (r = void 0), + i(r) && null === (r = r[u]) && (r = void 0)), + void 0 === r ? Array : r + ); + }; + }, + function (t, r, o) { + o(1446); + var i = o(323).Object; + t.exports = function getOwnPropertyDescriptor(t, r) { + return i.getOwnPropertyDescriptor(t, r); + }; + }, + function (t, r, o) { + var i = o(497), + a = o(1128).f; + o(1383)("getOwnPropertyDescriptor", function () { + return function getOwnPropertyDescriptor(t, r) { + return a(i(t), r); + }; + }); + }, + function (t, r, o) { + o(1448), (t.exports = o(323).Object.keys); + }, + function (t, r, o) { + var i = o(666), + a = o(667); + o(1383)("keys", function () { + return function keys(t) { + return a(i(t)); + }; + }); + }, + function (t, r, o) { + o(1384), (t.exports = o(323).Object.getOwnPropertySymbols); + }, + function (t, r, o) { + o(1451), (t.exports = o(323).Object.getOwnPropertyDescriptors); + }, + function (t, r, o) { + var i = o(405), + a = o(1452), + u = o(497), + c = o(1128), + l = o(1391); + i(i.S, "Object", { + getOwnPropertyDescriptors: function getOwnPropertyDescriptors(t) { + for (var r, o, i = u(t), d = c.f, p = a(i), v = {}, h = 0; p.length > h; ) + void 0 !== (o = d(i, (r = p[h++]))) && l(v, r, o); + return v; + }, + }); + }, + function (t, r, o) { + var i = o(1137), + a = o(1116), + u = o(523), + c = o(425).Reflect; + t.exports = + (c && c.ownKeys) || + function ownKeys(t) { + var r = i.f(u(t)), + o = a.f; + return o ? r.concat(o(t)) : r; + }; + }, + function (t, r, o) { + o(1454); + var i = o(323).Object; + t.exports = function defineProperty(t, r, o) { + return i.defineProperty(t, r, o); + }; + }, + function (t, r, o) { + var i = o(405); + i(i.S + i.F * !o(427), "Object", {defineProperty: o(434).f}); + }, + function (t, r, o) { + var i = o(1456), + a = o(527).default; + (t.exports = function _toPrimitive(t, r) { + if ("object" !== a(t) || null === t) return t; + var o = t[i]; + if (void 0 !== o) { + var u = o.call(t, r || "default"); + if ("object" !== a(u)) return u; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); + }), + (t.exports.__esModule = !0), + (t.exports.default = t.exports); + }, + function (t, r, o) { + t.exports = o(1457); + }, + function (t, r, o) { + t.exports = o(1112).f("toPrimitive"); + }, + function (t, r, o) { + var i = o(323), + a = i.JSON || (i.JSON = {stringify: JSON.stringify}); + t.exports = function stringify(t) { + return a.stringify.apply(a, arguments); + }; + }, + function (t, r, o) { + o(1109), o(1460), (t.exports = o(323).Array.from); + }, + function (t, r, o) { + "use strict"; + var i = o(665), + a = o(405), + u = o(666), + c = o(1388), + l = o(1389), + d = o(1113), + p = o(1391), + v = o(1390); + a( + a.S + + a.F * + !o(1425)(function (t) { + Array.from(t); + }), + "Array", + { + from: function from(t) { + var r, + o, + a, + h, + y = u(t), + _ = "function" == typeof this ? this : Array, + g = arguments.length, + b = g > 1 ? arguments[1] : void 0, + E = void 0 !== b, + m = 0, + w = v(y); + if ( + (E && (b = i(b, g > 2 ? arguments[2] : void 0, 2)), + null == w || (_ == Array && l(w))) + ) + for (o = new _((r = d(y.length))); r > m; m++) + p(o, m, E ? b(y[m], m) : y[m]); + else + for (h = w.call(y), o = new _(); !(a = h.next()).done; m++) + p(o, m, E ? c(h, b, [a.value, m], !0) : a.value); + return (o.length = m), o; + }, + } + ); + }, + function (t, r, o) { + o(1114), + o(1109), + o(1115), + o(1462), + o(1463), + o(1465), + o(1466), + (t.exports = o(323).Map); + }, + function (t, r, o) { + "use strict"; + var i = o(1392), + a = o(668), + u = "Map"; + t.exports = o(1147)( + u, + function (t) { + return function Map() { + return t(this, arguments.length > 0 ? arguments[0] : void 0); + }; + }, + { + get: function get(t) { + var r = i.getEntry(a(this, u), t); + return r && r.v; + }, + set: function set(t, r) { + return i.def(a(this, u), 0 === t ? 0 : t, r); + }, + }, + i, + !0 + ); + }, + function (t, r, o) { + var i = o(405); + i(i.P + i.R, "Map", {toJSON: o(1393)("Map")}); + }, + function (t, r, o) { + var i = o(723); + t.exports = function (t, r) { + var o = []; + return i(t, !1, o.push, o, r), o; + }; + }, + function (t, r, o) { + o(1148)("Map"); + }, + function (t, r, o) { + o(1149)("Map"); + }, + function (t, r, o) { + t.exports = o(1468); + }, + function (t, r, o) { + o(1469), (t.exports = o(323).Object.entries); + }, + function (t, r, o) { + var i = o(405), + a = o(1470)(!0); + i(i.S, "Object", { + entries: function entries(t) { + return a(t); + }, + }); + }, + function (t, r, o) { + var i = o(427), + a = o(667), + u = o(497), + c = o(728).f; + t.exports = function (t) { + return function (r) { + for (var o, l = u(r), d = a(l), p = d.length, v = 0, h = []; p > v; ) + (o = d[v++]), (i && !c.call(l, o)) || h.push(t ? [o, l[o]] : l[o]); + return h; + }; + }; + }, + function (t, r, o) { + t.exports = o(1472); + }, + function (t, r, o) { + o(1114), + o(1109), + o(1115), + o(1473), + o(1474), + o(1475), + o(1476), + (t.exports = o(323).Set); + }, + function (t, r, o) { + "use strict"; + var i = o(1392), + a = o(668); + t.exports = o(1147)( + "Set", + function (t) { + return function Set() { + return t(this, arguments.length > 0 ? arguments[0] : void 0); + }; + }, + { + add: function add(t) { + return i.def(a(this, "Set"), (t = 0 === t ? 0 : t), t); + }, + }, + i + ); + }, + function (t, r, o) { + var i = o(405); + i(i.P + i.R, "Set", {toJSON: o(1393)("Set")}); + }, + function (t, r, o) { + o(1148)("Set"); + }, + function (t, r, o) { + o(1149)("Set"); + }, + , + , + , + , + , + , + , + , + , + , + , + , + function (t, r, o) { + t.exports = o(1490); + }, + function (t, r, o) { + "use strict"; + o(1); + var i = o(527), + a = o(1118), + u = o(590), + c = o(493); + Object.defineProperty(r, "__esModule", {value: !0}), + (r.default = r.Plaid = void 0), + o(1497); + var l = o(1396), + d = _interopRequireWildcard(o(1509)), + p = _interopRequireWildcard(o(1510)), + v = _interopRequireWildcard(o(1511)), + h = _interopRequireWildcard(o(1401)), + y = o(1180), + _ = o(100), + g = c(o(1512)), + b = o(1515); + function _getRequireWildcardCache(t) { + if ("function" != typeof a) return null; + var r = new a(), + o = new a(); + return (_getRequireWildcardCache = function _getRequireWildcardCache(t) { + return t ? o : r; + })(t); + } + function _interopRequireWildcard(t, r) { + if (!r && t && t.__esModule) return t; + if (null === t || ("object" !== i(t) && "function" != typeof t)) + return {default: t}; + var o = _getRequireWildcardCache(r); + if (o && o.has(t)) return o.get(t); + var a = {}, + c = Object.defineProperty && u; + for (var l in t) + if ("default" !== l && Object.prototype.hasOwnProperty.call(t, l)) { + var d = c ? u(t, l) : null; + d && (d.get || d.set) ? Object.defineProperty(a, l, d) : (a[l] = t[l]); + } + return (a.default = t), o && o.set(t, a), a; + } + (h.messageHandlerExtensions[y.PLAID_INTERNAL_NAMESPACE] = []), + h.messageHandlerExtensions[y.PLAID_INTERNAL_NAMESPACE].push(g.default), + h.messageHandlerExtensions[y.PLAID_INTERNAL_NAMESPACE].push( + d.extendMessageHandlers + ), + h.messageHandlerExtensions[y.PLAID_INTERNAL_NAMESPACE].push( + v.extendMessageHandlers + ), + (h.messageHandlerExtensions[_.PLAID_FLOW_INTERNAL_NAMESPACE] = []), + h.messageHandlerExtensions[_.PLAID_FLOW_INTERNAL_NAMESPACE].push( + p.extendMessageHandlers + ); + var E = {version: _.VERSION, create: l.create, createEmbedded: b.createEmbedded}; + (r.Plaid = E), + void 0 !== window.Plaid && + console.warn( + "Warning: The Plaid link-initialize.js script was embedded more than once. This is an unsupported configuration and may lead to unpredictable behavior. Please ensure Plaid Link is embedded only once per page." + ), + (window.Plaid = E); + var m = d.findScriptTag(); + d.setUp(E, m), (t.exports = E); + var w = E; + r.default = w; + }, + function (t, r, o) { + o(1114), o(1115), o(1492), o(1495), o(1496), (t.exports = o(323).WeakMap); + }, + function (t, r, o) { + "use strict"; + var i, + a = o(425), + u = o(1158)(0), + c = o(1143), + l = o(734), + d = o(1493), + p = o(1494), + v = o(483), + h = o(668), + y = o(668), + _ = !a.ActiveXObject && "ActiveXObject" in a, + g = "WeakMap", + b = l.getWeak, + E = Object.isExtensible, + m = p.ufstore, + wrapper = function (t) { + return function WeakMap() { + return t(this, arguments.length > 0 ? arguments[0] : void 0); + }; + }, + w = { + get: function get(t) { + if (v(t)) { + var r = b(t); + return !0 === r ? m(h(this, g)).get(t) : r ? r[this._i] : void 0; + } + }, + set: function set(t, r) { + return p.def(h(this, g), t, r); + }, + }, + S = (t.exports = o(1147)(g, wrapper, w, p, !0, !0)); + y && + _ && + (d((i = p.getConstructor(wrapper, g)).prototype, w), + (l.NEED = !0), + u(["delete", "has", "get", "set"], function (t) { + var r = S.prototype, + o = r[t]; + c(r, t, function (r, a) { + if (v(r) && !E(r)) { + this._f || (this._f = new i()); + var u = this._f[t](r, a); + return "set" == t ? this : u; + } + return o.call(this, r, a); + }); + })); + }, + function (t, r, o) { + "use strict"; + var i = o(427), + a = o(667), + u = o(1116), + c = o(728), + l = o(666), + d = o(1144), + p = Object.assign; + t.exports = + !p || + o(595)(function () { + var t = {}, + r = {}, + o = Symbol(), + i = "abcdefghijklmnopqrst"; + return ( + (t[o] = 7), + i.split("").forEach(function (t) { + r[t] = t; + }), + 7 != p({}, t)[o] || Object.keys(p({}, r)).join("") != i + ); + }) + ? function assign(t, r) { + for (var o = l(t), p = arguments.length, v = 1, h = u.f, y = c.f; p > v; ) + for ( + var _, + g = d(arguments[v++]), + b = h ? a(g).concat(h(g)) : a(g), + E = b.length, + m = 0; + E > m; + + ) + (_ = b[m++]), (i && !y.call(g, _)) || (o[_] = g[_]); + return o; + } + : p; + }, + function (t, r, o) { + "use strict"; + var i = o(1139), + a = o(734).getWeak, + u = o(523), + c = o(483), + l = o(1140), + d = o(723), + p = o(1158), + v = o(524), + h = o(668), + y = p(5), + _ = p(6), + g = 0, + uncaughtFrozenStore = function (t) { + return t._l || (t._l = new UncaughtFrozenStore()); + }, + UncaughtFrozenStore = function () { + this.a = []; + }, + findUncaughtFrozen = function (t, r) { + return y(t.a, function (t) { + return t[0] === r; + }); + }; + (UncaughtFrozenStore.prototype = { + get: function (t) { + var r = findUncaughtFrozen(this, t); + if (r) return r[1]; + }, + has: function (t) { + return !!findUncaughtFrozen(this, t); + }, + set: function (t, r) { + var o = findUncaughtFrozen(this, t); + o ? (o[1] = r) : this.a.push([t, r]); + }, + delete: function (t) { + var r = _(this.a, function (r) { + return r[0] === t; + }); + return ~r && this.a.splice(r, 1), !!~r; + }, + }), + (t.exports = { + getConstructor: function (t, r, o, u) { + var p = t(function (t, i) { + l(t, p, r, "_i"), + (t._t = r), + (t._i = g++), + (t._l = void 0), + null != i && d(i, o, t[u], t); + }); + return ( + i(p.prototype, { + delete: function (t) { + if (!c(t)) return !1; + var o = a(t); + return !0 === o + ? uncaughtFrozenStore(h(this, r)).delete(t) + : o && v(o, this._i) && delete o[this._i]; + }, + has: function has(t) { + if (!c(t)) return !1; + var o = a(t); + return !0 === o + ? uncaughtFrozenStore(h(this, r)).has(t) + : o && v(o, this._i); + }, + }), + p + ); + }, + def: function (t, r, o) { + var i = a(u(r), !0); + return !0 === i ? uncaughtFrozenStore(t).set(r, o) : (i[t._i] = o), t; + }, + ufstore: uncaughtFrozenStore, + }); + }, + function (t, r, o) { + o(1148)("WeakMap"); + }, + function (t, r, o) { + o(1149)("WeakMap"); + }, + function (t, r, o) { + "use strict"; + var i = o(100); + o.p = i.LINK_CLIENT_URL + "/"; + }, + function (t, r, o) { + "use strict"; + o(21), o(22), o(24), o(12), o(35), o(33), o(1), o(9), o(10), o(29), o(14); + var i = o(2), + a = o(11); + Object.defineProperty(r, "__esModule", {value: !0}), + (r.create = void 0), + o(86), + o(121), + o(3), + o(18); + var u = i(o(26)), + c = i(o(8)), + l = _interopRequireWildcard(o(1499)), + d = _interopRequireWildcard(o(1500)), + p = _interopRequireWildcard(o(1397)), + v = _interopRequireWildcard(o(1398)), + h = o(231), + y = i(o(400)), + _ = i(o(417)), + g = o(1399), + b = o(1400); + function _getRequireWildcardCache(t) { + if ("function" != typeof WeakMap) return null; + var r = new WeakMap(), + o = new WeakMap(); + return (_getRequireWildcardCache = function _getRequireWildcardCache(t) { + return t ? o : r; + })(t); + } + function _interopRequireWildcard(t, r) { + if (!r && t && t.__esModule) return t; + if (null === t || ("object" !== a(t) && "function" != typeof t)) + return {default: t}; + var o = _getRequireWildcardCache(r); + if (o && o.has(t)) return o.get(t); + var i = {}, + u = Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var c in t) + if ("default" !== c && Object.prototype.hasOwnProperty.call(t, c)) { + var l = u ? Object.getOwnPropertyDescriptor(t, c) : null; + l && (l.get || l.set) ? Object.defineProperty(i, c, l) : (i[c] = t[c]); + } + return (i.default = t), o && o.set(t, i), i; + } + function ownKeys(t, r) { + var o = Object.keys(t); + if (Object.getOwnPropertySymbols) { + var i = Object.getOwnPropertySymbols(t); + r && + (i = i.filter(function (r) { + return Object.getOwnPropertyDescriptor(t, r).enumerable; + })), + o.push.apply(o, i); + } + return o; + } + function _objectSpread(t) { + for (var r = 1; r < arguments.length; r++) { + var o = null != arguments[r] ? arguments[r] : {}; + r % 2 + ? ownKeys(Object(o), !0).forEach(function (r) { + (0, c.default)(t, r, o[r]); + }) + : Object.getOwnPropertyDescriptors + ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(o)) + : ownKeys(Object(o)).forEach(function (r) { + Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(o, r)); + }); + } + return t; + } + r.create = function create(t) { + var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; + null != v.hooks.validateCreateOptions + ? v.hooks.validateCreateOptions(t) + : (0, b.validateCreateOptions)(t); + var o = Date.now(), + i = !0 === r.forceDesktop, + a = !0 === r.forceMobile, + c = (!i && (0, y.default)().isMobile) || a, + E = p.getUniqueId(), + m = (c ? d : l).create(), + w = _objectSpread({}, t); + delete w.onEvent, delete w.onExit, delete w.onLoad, delete w.onSuccess; + var S = _objectSpread( + { + isMobile: c, + uniqueId: E, + linkOpenId: p.uuid(), + origin: p.getWindowOrigin(), + linkSdkVersion: h.LINK_WEB_SDK_VERSION, + isLinkWebSdk: !0, + }, + null == v.hooks.getConfig ? w : v.hooks.getConfig(t, r) + ), + O = + null == v.hooks.getQueryParameters + ? _objectSpread({}, S) + : v.hooks.getQueryParameters(S), + x = p.buildLinkUrl(O), + I = h.LINK_CLIENT_CORS_ORIGIN; + null != v.hooks.updateLinkURL && + ((x = v.hooks.updateLinkURL(x, S)), (I = v.hooks.updateLinkURL(I, S))); + var P = function performOpen(t) { + p.sendMessage(m, I)(_objectSpread({action: "open"}, t)); + }, + T = function hideViewport() { + (S.linkOpenId = p.uuid()), m.hide(); + }, + A = function sendHeartBeat() { + var t = S.linkOpenId, + r = S.env, + o = S.token; + if (null != t && (null != r || null != o)) + try { + var i = _objectSpread( + _objectSpread({linkOpenId: t}, null != r && {env: r}), + null != o && {token: o} + ), + a = p.buildLinkUrl(i, { + LINK_CLIENT_STABLE_URL: h.LINK_CLIENT_STABLE_URL, + LINK_CLIENT_URL: h.LINK_CLIENT_URL, + LINK_HTML_PATH: h.LINK_OPEN_HTML_PATH, + }); + null != v.hooks.updateLinkURL && (a = v.hooks.updateLinkURL(a, S)), + null != v.hooks.emitLinkOpen + ? v.hooks.emitLinkOpen(a) + : (0, g.emitLinkOpen)(a); + } catch (t) {} + try { + var u, + c = new XMLHttpRequest(), + l = (0, _.default)(null !== (u = S.env) && void 0 !== u ? u : ""); + (c.onerror = function () {}), + c.open("POST", l + "/link/heartbeat", !0), + c.setRequestHeader("Content-Type", "application/json"), + c.send(JSON.stringify({a: !0, b: !0, link_open_id: t})); + } catch (t) {} + }, + R = {}; + R[h.PLAID_INTERNAL_NAMESPACE] = { + exit: function exit(r) { + "function" == typeof t.onExit && t.onExit(r.error, r.metadata), + T(), + (o = null); + }, + event: function event(r) { + "function" == typeof t.onEvent && t.onEvent(r.eventName, r.metadata); + }, + connected: function connected(r) { + t.onSuccess(r.metadata.public_token, r.metadata), T(); + }, + "ready-for-configure": function readyForConfigure() { + p.sendMessage(m, I)({action: "configure", config: S}); + }, + ready: function ready() { + (q = !0), + (G = null != o ? Date.now() - o : null), + z(), + "function" == typeof t.onLoad && t.onLoad(); + }, + resize: function resize(t) { + null != t.height && null != m.resize && m.resize(t.height); + }, + }; + for ( + var N = function _loop() { + var o = (0, u.default)(C[L], 2), + i = o[0]; + o[1].forEach(function (o) { + R[i] = o(R[i] || {}, t, r, m); + }); + }, + L = 0, + C = Object.entries(v.messageHandlerExtensions); + L < C.length; + L++ + ) + N(); + for (var k = [], M = 0, j = Object.entries(R); M < j.length; M++) { + var U = (0, u.default)(j[M], 2), + W = U[0], + D = U[1], + V = p.createMessageEventListener(W, E, D); + window.addEventListener("message", V, !1), k.push(V); + } + var K, + B = function exit(r) { + if (m.isOpen()) { + var o = {config: r}; + (0, b.validateExitOptions)(t, r), + p.sendMessage(m, I)(_objectSpread({action: "exit"}, o)); + } + }, + H = !1, + q = !1, + z = function onReady() {}, + G = null; + m.initialize(x, E); + var Q = function open() { + var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null; + if (H) + throw new Error( + "Cannot call open() on Link handler that is already destroyed" + ); + var r = t || S.institution; + t && K !== r && ((S.institution = t || S.institution), (q = !1), m.refresh()), + (K = r), + m.show(), + A(); + var i = Date.now(), + a = null != o ? Date.now() - o : null; + q + ? P({ + institution: t, + openStartedAt: i, + createToOnLoadInterval: G, + createToOpenInterval: a, + linkOpenId: S.linkOpenId, + }) + : (z = function onReady() { + P({ + institution: t, + openStartedAt: i, + createToOnLoadInterval: G, + createToOpenInterval: a, + linkOpenId: S.linkOpenId, + }); + }); + }, + X = function submit(t) { + var r = t; + p.sendMessage(m, I)({action: "submit", data: r}); + }, + Y = function destroy() { + (H = !0), m.destroy(); + for (var t = 0, r = k; t < r.length; t++) { + var o = r[t]; + window.removeEventListener("message", o); + } + }; + return {exit: B, open: Q, submit: X, destroy: Y}; + }; + }, + function (t, r, o) { + "use strict"; + o(1), Object.defineProperty(r, "__esModule", {value: !0}), (r.create = void 0); + var i = o(231); + r.create = function create() { + var t = document.body.style.overflow, + r = null, + o = !1, + a = null, + u = function hide() { + (o = !1), + null != r && (r.style.display = "none"), + (document.body.style.overflow = t), + window.parent.focus(), + null != a && a.focus(); + }; + return { + initialize: function initialize(t, o) { + ((r = document.createElement("iframe")).id = "plaid-link-iframe-".concat(o)), + (r.title = "Plaid Link"), + (r.src = t), + (r.allow = "camera ".concat(i.LINK_IFRAME_FEATURE_POLICY_URLS, ";")), + r.setAttribute("sandbox", i.LINK_IFRAME_SANDBOX_PERMISSIONS), + (r.width = "100%"), + (r.height = "100%"), + (r.style.position = "fixed"), + (r.style.top = "0"), + (r.style.left = "0"), + (r.style.right = "0"), + (r.style.bottom = "0"), + (r.style.zIndex = "9999999999"), + (r.style.borderWidth = "0"), + (r.style.display = "none"), + (r.style.overflowX = "hidden"), + (r.style.overflowY = "auto"), + document.body.appendChild(r); + }, + refresh: function refresh() { + null != r && (r.src += ""); + }, + show: function show() { + (o = !0), + (t = document.body.style.overflow), + (document.body.style.overflow = "hidden"), + (a = document.activeElement), + null != r && + ((r.style.display = "block"), + null != r.contentWindow && r.contentWindow.focus()); + }, + hide: u, + postMessage: function postMessage(t, o) { + null != r && null != r.contentWindow && r.contentWindow.postMessage(t, o); + }, + isOpen: function isOpen() { + return !0 === o; + }, + resize: function resize() {}, + destroy: function destroy() { + var t; + (u(), null != r) && + (null === (t = r.parentElement) || void 0 === t || t.removeChild(r), + (r = null)); + }, + }; + }; + }, + function (t, r, o) { + "use strict"; + o(1); + var i = o(2); + Object.defineProperty(r, "__esModule", {value: !0}), + (r.create = void 0), + o(75), + o(37); + var a = o(231), + u = i(o(400)), + c = "plaid-link-temporary-id", + l = "plaid-link-iframe", + d = "plaid-link-stylesheet", + p = "html" + Array(9).join("#".concat(c)), + v = "\n " + .concat(p, ",\n ") + .concat( + p, + " > body {\n border: 0 !important;\n height: 100% !important;\n margin: 0 !important;\n max-height: auto !important;\n max-width: auto !important;\n min-height: 0 !important;\n min-width: 0 !important;\n padding: 0 !important;\n position: static !important;\n width: auto !important;\n }\n " + ) + .concat(p, " > body > * {\n display: none !important;\n }\n ") + .concat(p, " > body > .") + .concat( + l, + " {\n border: 0 !important;\n height: auto !important;\n min-height: 100% !important;\n width: 100% !important;\n }\n" + ); + r.create = function create() { + var t = null, + r = !1, + o = "", + i = "", + p = "", + h = {x: 0, y: 0}, + y = null, + _ = function hide() { + (r = !1), + t && t.style.setProperty("display", "none", "important"), + (function restoreAllElements() { + var t = document.getElementById(d); + t && t.parentNode && t.parentNode.removeChild(t), + (document.documentElement.id = o), + document.documentElement.style.setProperty(i, p); + })(), + (function restoreScroll() { + window.scrollTo(h.x, h.y); + })(), + window.parent.focus(), + null != y && y.focus(); + }; + return { + refresh: function refresh() { + null != t && (t.src += ""); + }, + hide: _, + initialize: function initialize(r, o) { + ((t = document.createElement("iframe")).className = l), + (t.title = "Plaid Link"), + (t.id = "plaid-link-iframe-".concat(o)), + (t.src = r), + (t.allow = "camera ".concat(a.LINK_IFRAME_FEATURE_POLICY_URLS, ";")), + t.setAttribute("sandbox", a.LINK_IFRAME_SANDBOX_PERMISSIONS), + t.style.setProperty("display", "none", "important"), + document.body.appendChild(t); + }, + isOpen: function isOpen() { + return !0 === r; + }, + postMessage: function postMessage(r, o) { + null != t && null != t.contentWindow && t.contentWindow.postMessage(r, o); + }, + resize: function resize(t) { + document.documentElement.style.setProperty("height", t, "important"); + }, + show: function show() { + r || + ((r = !0), + (y = document.activeElement), + (function saveScroll() { + h = { + x: document.documentElement.scrollLeft, + y: document.documentElement.scrollTop, + }; + })(), + (function hideAllElements() { + (o = document.documentElement.id), + (i = document.documentElement.style.getPropertyValue("height")), + (p = document.documentElement.style.getPropertyPriority("height")); + var t = document.createElement("style"); + (t.id = d), (t.textContent = v); + var r = document.querySelector("head"); + null != r && r.appendChild(t), (document.documentElement.id = c); + })(), + window.scrollTo(0, 0), + t && + ((0, u.default)().isIOSChrome && + setTimeout(function () { + document.body.style.setProperty( + "height", + window.innerHeight + "px", + "important" + ); + }, 100), + t.style.setProperty("display", "block", "important"), + t.contentWindow && t.contentWindow.focus())); + }, + destroy: function destroy() { + var r; + (_(), null != t) && + (null === (r = t.parentElement) || void 0 === r || r.removeChild(t), + (t = null)); + }, + }; + }; + }, + function (t, r, o) { + var i = o(1502), + a = o(1506), + u = o(1507), + c = o(1508); + (t.exports = function _toConsumableArray(t) { + return i(t) || a(t) || u(t) || c(); + }), + (t.exports.__esModule = !0), + (t.exports.default = t.exports); + }, + function (t, r, o) { + var i = o(1503), + a = o(1403); + (t.exports = function _arrayWithoutHoles(t) { + if (i(t)) return a(t); + }), + (t.exports.__esModule = !0), + (t.exports.default = t.exports); + }, + function (t, r, o) { + t.exports = o(1504); + }, + function (t, r, o) { + o(1505), (t.exports = o(323).Array.isArray); + }, + function (t, r, o) { + var i = o(405); + i(i.S, "Array", {isArray: o(1145)}); + }, + function (t, r, o) { + var i = o(1130), + a = o(1146), + u = o(1117); + (t.exports = function _iterableToArray(t) { + if ((void 0 !== i && null != t[a]) || null != t["@@iterator"]) return u(t); + }), + (t.exports.__esModule = !0), + (t.exports.default = t.exports); + }, + function (t, r, o) { + var i = o(1117), + a = o(1403); + (t.exports = function _unsupportedIterableToArray(t, r) { + if (t) { + if ("string" == typeof t) return a(t, r); + var o = Object.prototype.toString.call(t).slice(8, -1); + return ( + "Object" === o && t.constructor && (o = t.constructor.name), + "Map" === o || "Set" === o + ? i(t) + : "Arguments" === o || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o) + ? a(t, r) + : void 0 + ); + } + }), + (t.exports.__esModule = !0), + (t.exports.default = t.exports); + }, + function (t, r) { + (t.exports = function _nonIterableSpread() { + throw new TypeError( + "Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." + ); + }), + (t.exports.__esModule = !0), + (t.exports.default = t.exports); + }, + function (t, r, o) { + "use strict"; + o(24), o(3), o(18), o(33), o(1); + var i = o(495), + a = o(591), + u = o(590), + c = o(664), + l = o(493); + Object.defineProperty(r, "__esModule", {value: !0}), + (r.setUp = r.findScriptTag = r.extendMessageHandlers = void 0); + var d = l(o(527)), + p = l(o(588)); + o(25), o(58), o(152), o(153), o(154), o(55), o(44), o(37), o(75), o(27), o(52); + var v = o(100); + function ownKeys(t, r) { + var o = i(t); + if (a) { + var c = a(t); + r && + (c = c.filter(function (r) { + return u(t, r).enumerable; + })), + o.push.apply(o, c); + } + return o; + } + function _objectSpread(t) { + for (var r = 1; r < arguments.length; r++) { + var o = null != arguments[r] ? arguments[r] : {}; + r % 2 + ? ownKeys(Object(o), !0).forEach(function (r) { + (0, p.default)(t, r, o[r]); + }) + : c + ? Object.defineProperties(t, c(o)) + : ownKeys(Object(o)).forEach(function (r) { + Object.defineProperty(t, r, u(o, r)); + }); + } + return t; + } + + r.findScriptTag = function findScriptTag() { + for ( + var t = document.getElementsByTagName("script"), r = 0, o = t.length; + r < o; + r += 1 + ) { + return t[r]; + } + throw new Error("Failed to find script"); + }; + r.extendMessageHandlers = function extendMessageHandlers(t, r, o, i) { + return _objectSpread( + _objectSpread({}, t), + {}, + { + acknowledged: function acknowledged() { + var t = document.getElementById(v.PLAID_LINK_BUTTON_ID); + null != t && (t.disabled = !1); + }, + } + ); + }; + var h = new RegExp( + "public-([a-z]+)-".concat( + "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}" + ) + ), + y = function traverse(t, r) { + var o = function _loop(o) { + "object" === (0, d.default)(t[o]) + ? traverse(t[o], function (t, i) { + r([o].concat(t), i); + }) + : r([o], t[o]); + }; + for (var i in t) o(i); + }; + r.setUp = function setUp(t, r) { + var o = r.getAttribute("data-form-id"); + if (null != o) { + var i = document.getElementById(o); + if (null == i) throw new Error("Uncaught Error: Specify a valid data-form-id"); + var a = r.getAttribute("data-api-version"), + u = r.getAttribute("data-client-name"), + c = r.getAttribute("data-product"), + l = r.getAttribute("data-key"), + d = r.getAttribute("data-env"), + p = "true" === r.getAttribute("data-select-account"), + _ = r.getAttribute("data-token"), + g = r.getAttribute("data-webhook"), + b = + null != r.getAttribute("data-longtail") || + null != r.getAttribute("data-long-tail") || + null, + E = t.create({ + apiVersion: a, + clientName: u, + env: d, + isSimpleIntegration: !0, + key: l, + longtail: b, + onSuccess: function onSuccess(t, r) { + y(r, function (t, r) { + var o = + t[0] + + t + .slice(1) + .map(function (t) { + return "[".concat(t, "]"); + }) + .join(""); + i.appendChild( + (function createHiddenInput(t, r) { + var o = document.createElement("input"); + return (o.type = "hidden"), (o.name = t), (o.value = r), o; + })(o, r) + ); + }), + i.submit(); + }, + product: c, + selectAccount: p, + token: _, + webhook: g, + }), + m = document.createElement("button"); + (m.id = v.PLAID_LINK_BUTTON_ID), + (m.textContent = (function isPublicToken(t) { + return null != t && h.test(t); + })(_) + ? "Link your bank account" + : "Relink your bank account"), + (m.onclick = function (t) { + t.preventDefault(), E.open(); + }), + i.appendChild(m); + } + }; + }, + function (t, r, o) { + "use strict"; + o(24), o(3), o(18), o(33), o(1); + var i = o(495), + a = o(591), + u = o(590), + c = o(664), + l = o(493); + Object.defineProperty(r, "__esModule", {value: !0}), + (r.extendMessageHandlers = void 0); + var d = l(o(588)); + function ownKeys(t, r) { + var o = i(t); + if (a) { + var c = a(t); + r && + (c = c.filter(function (r) { + return u(t, r).enumerable; + })), + o.push.apply(o, c); + } + return o; + } + function _objectSpread(t) { + for (var r = 1; r < arguments.length; r++) { + var o = null != arguments[r] ? arguments[r] : {}; + r % 2 + ? ownKeys(Object(o), !0).forEach(function (r) { + (0, d.default)(t, r, o[r]); + }) + : c + ? Object.defineProperties(t, c(o)) + : ownKeys(Object(o)).forEach(function (r) { + Object.defineProperty(t, r, u(o, r)); + }); + } + return t; + } + r.extendMessageHandlers = function extendMessageHandlers(t, r, o, i) { + var a = !1; + return _objectSpread( + _objectSpread({}, t), + {}, + { + success: function success(t) { + (a = !0), "function" == typeof r.onSuccess && r.onSuccess("", t.metadata); + }, + exit: function exit(t) { + "function" != typeof r.onExit || a || r.onExit(t.error, t.metadata), + i.hide(); + }, + event: function event(t) { + "function" == typeof r.onEvent && r.onEvent(t.event_name, t.metadata); + }, + } + ); + }; + }, + function (t, r, o) { + "use strict"; + o(24), o(3), o(18), o(33), o(1); + var i = o(495), + a = o(591), + u = o(590), + c = o(664), + l = o(493); + Object.defineProperty(r, "__esModule", {value: !0}), + (r.extendMessageHandlers = void 0); + var d = l(o(588)); + function ownKeys(t, r) { + var o = i(t); + if (a) { + var c = a(t); + r && + (c = c.filter(function (r) { + return u(t, r).enumerable; + })), + o.push.apply(o, c); + } + return o; + } + function _objectSpread(t) { + for (var r = 1; r < arguments.length; r++) { + var o = null != arguments[r] ? arguments[r] : {}; + r % 2 + ? ownKeys(Object(o), !0).forEach(function (r) { + (0, d.default)(t, r, o[r]); + }) + : c + ? Object.defineProperties(t, c(o)) + : ownKeys(Object(o)).forEach(function (r) { + Object.defineProperty(t, r, u(o, r)); + }); + } + return t; + } + r.extendMessageHandlers = function extendMessageHandlers(t, r, o, i) { + return _objectSpread( + _objectSpread({}, t), + {}, + { + result: function result(t) { + "function" == typeof r.onResult && r.onResult(t.incremental_result); + }, + } + ); + }; + }, + function (t, r, o) { + "use strict"; + o(24), o(3), o(18), o(33), o(1); + var i = o(527), + a = o(495), + u = o(591), + c = o(590), + l = o(664), + d = o(1118), + p = o(493); + Object.defineProperty(r, "__esModule", {value: !0}), (r.default = void 0); + var v = p(o(588)), + h = (function _interopRequireWildcard(t, r) { + if (!r && t && t.__esModule) return t; + if (null === t || ("object" !== i(t) && "function" != typeof t)) + return {default: t}; + var o = _getRequireWildcardCache(r); + if (o && o.has(t)) return o.get(t); + var a = {}, + u = Object.defineProperty && c; + for (var l in t) + if ("default" !== l && Object.prototype.hasOwnProperty.call(t, l)) { + var d = u ? c(t, l) : null; + d && (d.get || d.set) ? Object.defineProperty(a, l, d) : (a[l] = t[l]); + } + (a.default = t), o && o.set(t, a); + return a; + })(o(1179)), + y = o(380), + _ = p(o(1513)), + g = p(o(1514)), + b = o(100); + function _getRequireWildcardCache(t) { + if ("function" != typeof d) return null; + var r = new d(), + o = new d(); + return (_getRequireWildcardCache = function _getRequireWildcardCache(t) { + return t ? o : r; + })(t); + } + function ownKeys(t, r) { + var o = a(t); + if (u) { + var i = u(t); + r && + (i = i.filter(function (r) { + return c(t, r).enumerable; + })), + o.push.apply(o, i); + } + return o; + } + function _objectSpread(t) { + for (var r = 1; r < arguments.length; r++) { + var o = null != arguments[r] ? arguments[r] : {}; + r % 2 + ? ownKeys(Object(o), !0).forEach(function (r) { + (0, v.default)(t, r, o[r]); + }) + : l + ? Object.defineProperties(t, l(o)) + : ownKeys(Object(o)).forEach(function (r) { + Object.defineProperty(t, r, c(o, r)); + }); + } + return t; + } + var E = function extendMessageHandlers(t, r, o, i) { + var a, + u = h.sendMessage(i), + c = {chainId: b.MAINNET_HEX_CHAIN_ID, rpcUrl: b.CLOUDFLARE_ETH_MAINNET_URL}; + return _objectSpread( + _objectSpread({}, t), + {}, + { + connected: function connected(r) { + var a = o.web3ConnectorCache; + if (a) { + var u = a.getConnector(); + if (!u) throw new Error("Unexpected state, missing connector"); + u.getProvider().then(function (t) { + if (!o.onProviderSuccess) + throw new Error("Unexpected state, missing onProviderSuccess"); + o.onProviderSuccess(t, r.metadata); + }), + i.hide(); + } else t.connected(r); + }, + "web3-message": function web3MessageHandler(t) { + a || + (a = (function getWeb3Bridge() { + if (o.web3Bridge) { + var t = o.web3Bridge; + return { + then: function then(r) { + return r(t); + }, + }; + } + return (0, _.default)().then(function (t) { + return (0, g.default)().then(function (r) { + return (0, r.validateChainOptionAndChainInformation)(c), new t(c); + }); + }); + })()), + a.then(function (r) { + r.setMessageSender(u), + (r.viewport = i), + t.message !== y.Web3MessageToTopWindow.START_BRIDGE && + r.handleWeb3Message(t); + }); + }, + } + ); + }; + r.default = E; + }, + function (t, r, o) { + "use strict"; + o.r(r), + (r.default = function () { + return Promise.all([o.e(0), o.e(2), o.e(10), o.e(11), o.e(48)]) + .then(o.t.bind(null, 1604, 7)) + .then(function (t) { + return t.Web3Bridge; + }); + }); + }, + function (t, r, o) { + "use strict"; + o.r(r), + (r.default = function () { + return Promise.all([o.e(0), o.e(26)]) + .then(o.t.bind(null, 1602, 7)) + .then(function (t) { + return { + validateChainOptionAndChainInformation: + t.validateChainOptionAndChainInformation, + }; + }); + }); + }, + function (t, r, o) { + "use strict"; + o(24), o(3), o(18), o(33), o(1); + var i = o(527), + a = o(495), + u = o(591), + c = o(590), + l = o(664), + d = o(1118), + p = o(493); + Object.defineProperty(r, "__esModule", {value: !0}), (r.createEmbedded = void 0); + var v = p(o(1380)), + h = p(o(588)), + y = p(o(1516)), + _ = _interopRequireWildcard(o(1179)), + g = o(100), + b = o(1400), + E = _interopRequireWildcard(o(1518)), + m = o(231), + w = p(o(400)), + S = o(1396), + O = o(1180), + x = o(1402), + I = ["embeddedComponentConfiguration"]; + function _getRequireWildcardCache(t) { + if ("function" != typeof d) return null; + var r = new d(), + o = new d(); + return (_getRequireWildcardCache = function _getRequireWildcardCache(t) { + return t ? o : r; + })(t); + } + function _interopRequireWildcard(t, r) { + if (!r && t && t.__esModule) return t; + if (null === t || ("object" !== i(t) && "function" != typeof t)) + return {default: t}; + var o = _getRequireWildcardCache(r); + if (o && o.has(t)) return o.get(t); + var a = {}, + u = Object.defineProperty && c; + for (var l in t) + if ("default" !== l && Object.prototype.hasOwnProperty.call(t, l)) { + var d = u ? c(t, l) : null; + d && (d.get || d.set) ? Object.defineProperty(a, l, d) : (a[l] = t[l]); + } + return (a.default = t), o && o.set(t, a), a; + } + function ownKeys(t, r) { + var o = a(t); + if (u) { + var i = u(t); + r && + (i = i.filter(function (r) { + return c(t, r).enumerable; + })), + o.push.apply(o, i); + } + return o; + } + function _objectSpread(t) { + for (var r = 1; r < arguments.length; r++) { + var o = null != arguments[r] ? arguments[r] : {}; + r % 2 + ? ownKeys(Object(o), !0).forEach(function (r) { + (0, h.default)(t, r, o[r]); + }) + : l + ? Object.defineProperties(t, l(o)) + : ownKeys(Object(o)).forEach(function (r) { + Object.defineProperty(t, r, c(o, r)); + }); + } + return t; + } + r.createEmbedded = function createEmbedded(t, r) { + var o = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}, + i = t.embeddedComponentConfiguration, + a = (0, y.default)(t, I); + (0, b.validateCreateOptions)(a); + var u = _.getUniqueId(), + c = "embedded_".concat(u), + l = E.create(r), + d = (0, x.validateEmbeddedComponentConfiguration)(i), + p = _objectSpread( + _objectSpread({}, a), + {}, + { + isEmbedded: !0, + isEmbeddedLink: !0, + isLinkInitialize: !0, + useMockFingerprint: o.useMockFingerprint, + }, + !0 === o.forceDarkMode && {forceDarkMode: o.forceDarkMode} + ), + h = _objectSpread({}, p); + delete h.onEvent, delete h.onExit, delete h.onLoad, delete h.onSuccess; + var P, + T = (0, w.default)().isMobile, + A = _objectSpread( + { + isMobile: T, + uniqueId: c, + origin: _.getWindowOrigin(), + linkSdkVersion: m.LINK_WEB_SDK_VERSION, + isLinkWebSdk: !0, + }, + h + ), + R = { + ready: function ready() { + _.sendMessage(l)({action: "open"}); + }, + "ready-for-configure": function readyForConfigure() { + _.sendMessage(l)({ + action: "configure", + config: + null != d ? _objectSpread({embeddedComponentConfiguration: d}, A) : A, + }); + }, + "internal-event": function internalEvent(t) { + var r = t.event.start_link.link_token_configuration, + i = r.institution_id, + u = r.embedded_workflow_session_id; + null != P && P.destroy(), + (o.embeddedWorkflowSessionId = u), + (o.embeddedOpenLinkConfiguration = r.embedded_open_link_configuration), + (P = (0, S.create)(a, o)).open(i); + }, + }, + N = [], + L = _.createMessageEventListener(O.PLAID_INTERNAL_NAMESPACE, c, R); + window.addEventListener("message", L, !1), N.push(L); + var C = function destroy() { + l.destroy(); + for (var t = 0, r = N; t < r.length; t++) { + var o = r[t]; + window.removeEventListener("message", o); + } + P && P.destroy(); + }, + k = _objectSpread( + _objectSpread({}, A), + {}, + {experimentVariants: (0, v.default)(a.experimentVariants), version: g.VERSION} + ), + M = _.buildLinkUrl(k); + return l.initialize(M, c), {destroy: C}; + }; + }, + function (t, r, o) { + var i = o(591), + a = o(1517); + (t.exports = function _objectWithoutProperties(t, r) { + if (null == t) return {}; + var o, + u, + c = a(t, r); + if (i) { + var l = i(t); + for (u = 0; u < l.length; u++) + (o = l[u]), + r.indexOf(o) >= 0 || + (Object.prototype.propertyIsEnumerable.call(t, o) && (c[o] = t[o])); + } + return c; + }), + (t.exports.__esModule = !0), + (t.exports.default = t.exports); + }, + function (t, r, o) { + var i = o(495); + (t.exports = function _objectWithoutPropertiesLoose(t, r) { + if (null == t) return {}; + var o, + a, + u = {}, + c = i(t); + for (a = 0; a < c.length; a++) (o = c[a]), r.indexOf(o) >= 0 || (u[o] = t[o]); + return u; + }), + (t.exports.__esModule = !0), + (t.exports.default = t.exports); + }, + function (t, r, o) { + "use strict"; + o(1), Object.defineProperty(r, "__esModule", {value: !0}), (r.create = void 0); + var i = o(231); + r.create = function create(t) { + var r = null; + return { + refresh: function refresh() { + null != r && (r.src += ""); + }, + initialize: function initialize(o, a) { + ((r = document.createElement("iframe")).id = + "plaid-embedded-link-iframe-".concat(a)), + (r.title = "Plaid Link"), + (r.src = o), + (r.allow = "".concat(i.LINK_IFRAME_FEATURE_POLICY_URLS, ";")), + (r.width = "100%"), + (r.height = "100%"), + (r.style.borderWidth = "0"), + t.replaceChildren.apply(t, [r]); + }, + show: function show() {}, + hide: function hide() {}, + postMessage: function postMessage(t, o) { + null != r && null != r.contentWindow && r.contentWindow.postMessage(t, o); + }, + isOpen: function isOpen() { + return !0; + }, + resize: function resize() {}, + destroy: function destroy() { + var t; + null != r && + (null === (t = r.parentElement) || void 0 === t || t.removeChild(r), + (r = null)); + }, + }; + }; + }, +]); diff --git a/account_payment_plaid/tests/__init__.py b/account_payment_plaid/tests/__init__.py new file mode 100644 index 000000000000..f7f6a110f804 --- /dev/null +++ b/account_payment_plaid/tests/__init__.py @@ -0,0 +1,5 @@ +from . import test_plaid_interface +from . import test_res_config_settings +from . import test_account_move +from . import test_plaid_transfer +from . import test_account_payment_plaid_wizard diff --git a/account_payment_plaid/tests/test_account_move.py b/account_payment_plaid/tests/test_account_move.py new file mode 100644 index 000000000000..bedde9a3de21 --- /dev/null +++ b/account_payment_plaid/tests/test_account_move.py @@ -0,0 +1,37 @@ +from odoo.tests import common, tagged + + +@tagged("post_install", "-at_install") +class TestAccountMove(common.SavepointCase): + @classmethod + def setUpClass(cls): + super(TestAccountMove, cls).setUpClass() + cls.account_move = cls.env["account.move"].create( + { + "name": "Test Account Move", + "partner_id": cls.env["res.partner"] + .create({"name": "Test Partner"}) + .id, + "amount_total": 100.0, + "currency_id": cls.env.ref("base.USD").id, + "company_id": cls.env.user.company_id.id, + } + ) + + def test_action_payment_with_plaid_wizard(self): + action = self.account_move.action_payment_with_plaid_wizard() + self.assertTrue(action) + self.assertEqual(action["type"], "ir.actions.act_window") + self.assertEqual(action["res_model"], "account.payment.plaid.wizard") + self.assertEqual( + action["context"], + { + "default_partner_id": self.account_move.partner_id.id, + "default_account_move_id": self.account_move.id, + "default_amount": self.account_move.amount_total, + "default_currency_id": self.account_move.currency_id.id, + "default_description": self.account_move.name, + "default_company_id": self.account_move.company_id.id, + }, + ) + self.assertEqual(action["target"], "new") diff --git a/account_payment_plaid/tests/test_account_payment_plaid_wizard.py b/account_payment_plaid/tests/test_account_payment_plaid_wizard.py new file mode 100644 index 000000000000..bb7c977dd224 --- /dev/null +++ b/account_payment_plaid/tests/test_account_payment_plaid_wizard.py @@ -0,0 +1,124 @@ +# Copyright 2024 Binhex - Adasat Torres de León. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from unittest.mock import MagicMock, patch + +from odoo.exceptions import ValidationError +from odoo.tests import common, tagged + + +@tagged("post_install", "-at_install") +class TestAccountPaymentPlaidWizard(common.SavepointCase): + @classmethod + def setUpClass(cls): + super(TestAccountPaymentPlaidWizard, cls).setUpClass() + + cls.plaid_account = cls.env["plaid.account"].create( + { + "name": "Test Plaid Account", + "account": "TestAccount", + } + ) + + cls.company_id = cls.env.user.company_id + cls.company_id.plaid_account_id = cls.plaid_account.id + cls.company_id.write( + { + "plaid_client_id": "TestClientId", + "plaid_secret": "TestSecret", + "plaid_access_token": "PlaidAccessToken", + } + ) + + cls.partner_id = cls.env["res.partner"].create( + {"name": "Test Partner", "plaid_client_id": "OriginatorClientID"} + ) + cls.account_move_id = cls.env["account.move"].create( + { + "name": "Test Account Move", + "partner_id": cls.partner_id.id, + "journal_id": cls.env.ref("account.data_account_type_receivable").id, + "amount_total": 100.0, + "company_id": cls.company_id.id, + } + ) + + cls.account_payment_plaid_wizard = cls.env[ + "account.payment.plaid.wizard" + ].create( + { + "account_move_id": cls.account_move_id.id, + "amount": 100.0, + "currency_id": cls.env.ref("base.USD").id, + "description": "Test Description", + "partner_id": cls.partner_id.id, + "company_id": cls.company_id.id, + } + ) + + def test_verify_plaid_auth(self): + decision = { + "decision": "approved", + "decision_rationale": { + "code": "TestError", + "description": "Test Description Error", + }, + "authorization_id": "TestSuccess", + } + + auth = self.account_payment_plaid_wizard._verify_plaid_auth(decision) + self.assertEqual(auth, "TestSuccess") + + def test_verify_plaid_auth_error(self): + decision = { + "decision": "rejected", + "decision_rationale": { + "code": "TestError", + "description": "Test Description Error", + }, + "authorization_id": "TestSuccess", + } + + with self.assertRaises(ValidationError): + self.account_payment_plaid_wizard._verify_plaid_auth(decision) + + @patch("plaid.api.plaid_api.PlaidApi.transfer_create") + @patch("plaid.api.plaid_api.PlaidApi.transfer_authorization_create") + def test_action_confirm(self, transfer_authorization_create, transfer_create): + transfer_authorization_create.return_value = MagicMock( + to_dict=lambda: { + "authorization": { + "id": "TestAuthSuccess", + "decision": "approved", + "decision_rationale": { + "code": "TestError", + "description": "Test Description Error", + }, + } + } + ) + transfer_create.return_value = MagicMock( + to_dict=lambda: { + "transfer": { + "id": "TestTransferSuccess", + "status": "pending", + "amount": "100.00", + "description": "Test Description", + } + } + ) + self.account_payment_plaid_wizard.action_confirm() + self.assertTrue( + self.env["plaid.transfer"].search( + [ + ("name", "=", "TestTransferSuccess"), + ] + ) + ) + + def test_create_transfer(self): + transfer = { + "id": "TestTransferSuccess", + "status": "pending", + } + res = self.account_payment_plaid_wizard._create_transfer(transfer) + self.assertTrue(res) diff --git a/account_payment_plaid/tests/test_plaid_interface.py b/account_payment_plaid/tests/test_plaid_interface.py new file mode 100644 index 000000000000..ecc4e274d0e6 --- /dev/null +++ b/account_payment_plaid/tests/test_plaid_interface.py @@ -0,0 +1,253 @@ +# Copyright 2024 Binhex - Adasat Torres de León. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from unittest.mock import MagicMock, patch + +import plaid + +from odoo.exceptions import ValidationError +from odoo.tests import common + + +class TestPlaidInterface(common.TransactionCase): + post_install = True + + def test_get_host(self): + """Test getting Plaid host.""" + interface_model = self.env["plaid.interface"] + self.assertEqual(interface_model._get_host("sand"), plaid.Environment.Sandbox) + self.assertEqual( + interface_model._get_host("prod"), plaid.Environment.Production + ) + self.assertFalse(interface_model._get_host("nonexistent")) + + @patch("plaid.api.plaid_api.PlaidApi") + def test_client(self, PlaidApi): + interface_model = self.env["plaid.interface"] + PlaidApi.return_value = MagicMock() + client = interface_model._client("client_id", "secret", "sand") + self.assertTrue(client) + + @patch( + "plaid.api.plaid_api.PlaidApi", + side_effect=plaid.ApiException("INVALID_SECRET", "This secret is invalid"), + ) + def test_client_error(self, PlaidApi): + interface_model = self.env["plaid.interface"] + self.assertRaises( + ValidationError, interface_model._client, "client_id", "secret2", "sandbox" + ) + + @patch("plaid.api.plaid_api.PlaidApi.link_token_create") + def test_link(self, link_token_create): + interface_model = self.env["plaid.interface"] + link_token_create.return_value = MagicMock( + to_dict=lambda: {"link_token": "isalinktoken", "expiration": "isadate"} + ) + client = interface_model._client("client_id", "secret", "sand") + link = interface_model._link( + client=client, + language="en", + country_code="US", + company_name="company", + products=["transactions"], + ) + self.assertTrue(link) + self.assertEqual(link, "isalinktoken") + + @patch( + "plaid.api.plaid_api.PlaidApi.link_token_create", + side_effect=plaid.ApiException( + "INVALID_CLIENT_ID", "This client id is invalid" + ), + ) + def test_link_error(self, link_token_create): + interface_model = self.env["plaid.interface"] + client = interface_model._client("client_id", "secret", "sand") + self.assertRaises( + ValidationError, + interface_model._link, + client, + "en", + "US", + "company", + ["transactions"], + ) + + @patch("plaid.api.plaid_api.PlaidApi.item_public_token_exchange") + def test_login(self, item_public_token_exchange): + interface_model = self.env["plaid.interface"] + item_public_token_exchange.return_value = MagicMock( + to_dict=lambda: {"access_token": "isaccesstoken"} + ) + client = interface_model._client("client_id", "secret", "sand") + public_token = "isapulbictoken" + access_token = interface_model._login(client, public_token) + self.assertTrue(access_token) + + @patch( + "plaid.api.plaid_api.PlaidApi.item_public_token_exchange", + side_effect=plaid.ApiException("INVALID_PUBLIC_TOKEN", "This token is invalid"), + ) + def test_login_error(self, item_public_token_exchange): + interface_model = self.env["plaid.interface"] + client = interface_model._client("client_id", "secret", "sand") + public_token = "isapulbictoken" + self.assertRaises(ValidationError, interface_model._login, client, public_token) + + @patch("plaid.api.plaid_api.PlaidApi.accounts_get") + def test_get_account(self, accounts_get): + interface_model = self.env["plaid.interface"] + accounts_get.return_value = MagicMock( + to_dict=lambda: { + "accounts": [ + { + "account_id": "1", + "balances": {"available": 100}, + "name": "account", + } + ] + } + ) + client = interface_model._client("client_id", "secret", "sand") + access_token = "isaccesstoken" + accounts = interface_model._get_accounts(client, access_token) + self.assertTrue(accounts) + self.assertEqual( + accounts, + [{"account_id": "1", "balances": {"available": 100}, "name": "account"}], + ) + + @patch( + "plaid.api.plaid_api.PlaidApi.accounts_get", + side_effect=plaid.ApiException("INVALID_ACCESS_TOKEN", "This token is invalid"), + ) + def test_get_account_error(self, accounts_get): + interface_model = self.env["plaid.interface"] + client = interface_model._client("client", "secret", "sand") + with self.assertRaises(ValidationError): + interface_model._get_accounts(client, "isnotaccesstoken") + + @patch("plaid.api.plaid_api.PlaidApi.transfer_authorization_create") + def test_transfer_auth(self, transfer_authorization_create): + interface_model = self.env["plaid.interface"] + transfer_authorization_create.return_value = MagicMock( + to_dict=lambda: { + "authorization": { + "id": "1", + "decision": "approved", + "decision_rationale": "isarationale", + } + } + ) + client = interface_model._client("client_id", "secret", "sand") + access_token = "isaccesstoken" + account_id = "1287689GHJGJjghj7876" + partner_id = self.env["res.partner"].create( + {"name": "partner", "plaid_client_id": "1897789HKJH98hjhgjh786"} + ) + amount = "100.00" + auth = interface_model._transfer_auth( + client, access_token, account_id, partner_id, amount + ) + self.assertTrue(auth) + self.assertEqual( + auth, + { + "authorization_id": "1", + "decision": "approved", + "decision_rationale": "isarationale", + }, + ) + + @patch( + "plaid.api.plaid_api.PlaidApi.transfer_authorization_create", + side_effect=plaid.ApiException("INVALID_ACCESS_TOKEN", "This token is invalid"), + ) + def test_transfer_auth_error(self, transfer_authorization_create): + interface_model = self.env["plaid.interface"] + client = interface_model._client("client_id", "secret", "sand") + access_token = "isaccesstoken" + account_id = "1287689GHJGJjghj7876" + partner_id = self.env["res.partner"].create( + {"name": "partner", "plaid_client_id": "1897789HKJH98hjhgjh786"} + ) + amount = "100.00" + with self.assertRaises(ValidationError): + interface_model._transfer_auth( + client, access_token, account_id, partner_id, amount + ) + + @patch("plaid.api.plaid_api.PlaidApi.transfer_create") + def test_transfer(self, transfer_create): + interface_model = self.env["plaid.interface"] + transfer_create.return_value = MagicMock( + to_dict=lambda: {"transfer": {"id": "1", "status": "pending"}} + ) + client = interface_model._client("client_id", "secret", "sand") + access_token = "isaccesstoken" + account_id = "1287689GHJGJjghj7876" + amount = "100.00" + transfer_id = interface_model._transfer( + client, access_token, account_id, "ahjk8979-38979-dhjhg", amount + ) + self.assertTrue(transfer_id) + self.assertEqual(transfer_id["id"], "1") + + @patch( + "plaid.api.plaid_api.PlaidApi.transfer_create", + side_effect=plaid.ApiException("INVALID_ACCESS_TOKEN", "This token is invalid"), + ) + def test_transfer_error(self, transfer_create): + interface_model = self.env["plaid.interface"] + client = interface_model._client("client_id", "secret", "sandbox") + with self.assertRaises(ValidationError): + interface_model._transfer( + client, + "isaccesstoken", + "account", + "ahjk8979-38979-dhjhg", + "100.00", + ) + + @patch("plaid.api.plaid_api.PlaidApi.transfer_event_sync") + def test_sync_transfer_events(self, transfer_event_sync): + interface_model = self.env["plaid.interface"] + transfer_event_sync.return_value = MagicMock( + to_dict=lambda: {"transfer_events": [{"id": "1", "type": "transfer"}]} + ) + client = interface_model._client("client_id", "secret", "sandbox") + events = interface_model._sync_transfer_events(client) + self.assertTrue(events) + self.assertEqual(events, [{"id": "1", "type": "transfer"}]) + + @patch( + "plaid.api.plaid_api.PlaidApi.transfer_event_sync", + side_effect=plaid.ApiException("INVALID_ACCESS_TOKEN", "This token is invalid"), + ) + def test_sync_transfer_events_error(self, transfer_event_sync): + interface_model = self.env["plaid.interface"] + client = interface_model._client("client", "secret", "sandbox") + with self.assertRaises(ValidationError): + interface_model._sync_transfer_events(client) + + @patch( + "plaid.api.plaid_api.PlaidApi.sandbox_transfer_simulate", + side_effect=plaid.ApiException("INVALID_ACCESS_TOKEN", "This token is invalid"), + ) + def test_sandbox_transfer_simulate(self, sandbox_simulate_transfer): + interface_model = self.env["plaid.interface"] + client = interface_model._client("client_id", "secret", "sandbox") + with self.assertRaises(ValidationError): + interface_model._sandbox_simulate_transfer(client, "1", "posted", 100) + + @patch( + "plaid.api.plaid_api.PlaidApi.sandbox_transfer_ledger_simulate_available", + side_effect=plaid.ApiException("INVALID_ACCESS_TOKEN", "This token is invalid"), + ) + def test_sandbox_transfer_ledger_simulate_available( + self, sandbox_transfer_ledger_simulate_available + ): + interface_model = self.env["plaid.interface"] + client = interface_model._client("client_id", "secret", "sandbox") + with self.assertRaises(ValidationError): + interface_model._sandbox_transfer_ledger_simulate_available(client) diff --git a/account_payment_plaid/tests/test_plaid_transfer.py b/account_payment_plaid/tests/test_plaid_transfer.py new file mode 100644 index 000000000000..6bbb586ac026 --- /dev/null +++ b/account_payment_plaid/tests/test_plaid_transfer.py @@ -0,0 +1,61 @@ +from unittest.mock import MagicMock, patch + +from odoo.tests import common, tagged + + +@tagged("post_install", "-at_install") +class TestPlaidTransfer(common.SavepointCase): + @classmethod + def setUpClass(cls): + super(TestPlaidTransfer, cls).setUpClass() + + cls.company_id = cls.env.user.company_id + cls.account_move_id = cls.env["account.move"].create( + { + "name": "Test Account Move", + "company_id": cls.company_id.id, + "amount_total": 100.0, + } + ) + cls.plaid_transfer = cls.env["plaid.transfer"].create( + { + "name": "TestPlaidTransfer", + "description": "Test Description", + "amount": 100.0, + "state": "pending", + "currency_id": cls.env.ref("base.USD").id, + "company_id": cls.company_id.id, + "account_move_id": cls.account_move_id.id, + } + ) + + def test_action_sandbox_simulation(self): + action = self.plaid_transfer.action_sandbox_simulation() + + self.assertTrue(action) + self.assertEqual(action["type"], "ir.actions.act_window") + self.assertEqual( + action["res_model"], "plaid.transfer.sandbox.simulation.wizard" + ) + self.assertEqual(action["view_mode"], "form") + self.assertEqual(action["target"], "new") + self.assertEqual( + action["context"], + { + "default_transfer_id": self.plaid_transfer.id, + "default_company_id": self.plaid_transfer.company_id.id, + }, + ) + + @patch("plaid.api.plaid_api.PlaidApi.transfer_event_sync") + def test_cron_sync_transfer_events(self, transfer_event_sync): + + transfer_event_sync.return_value = MagicMock( + to_dict=lambda: { + "transfer_events": [ + {"transfer_id": "TestPlaidTransfer", "event_type": "posted"} + ] + } + ) + self.env["plaid.transfer"].cron_sync_transfer_events() + self.assertEqual(self.plaid_transfer.state, "posted") diff --git a/account_payment_plaid/tests/test_res_config_settings.py b/account_payment_plaid/tests/test_res_config_settings.py new file mode 100644 index 000000000000..3d454eae4dd6 --- /dev/null +++ b/account_payment_plaid/tests/test_res_config_settings.py @@ -0,0 +1,33 @@ +# Copyright 2024 Binhex - Adasat Torres de León. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from unittest.mock import MagicMock, patch + +from odoo.tests import common + + +class TestResConfigSettings(common.SavepointCase): + @classmethod + def setUpClass(cls): + super(TestResConfigSettings, cls).setUpClass() + cls.company = cls.env["res.company"].create( + { + "name": "Test Company", + "plaid_client_id": "test_client_id", + "plaid_secret": "test_secret", + "plaid_host": "sand", + } + ) + cls.config_settings = cls.env["res.config.settings"].create( + {"company_id": cls.company.id} + ) + + @patch("plaid.api.plaid_api.PlaidApi.link_token_create") + def test_action_sync_with_plaid(self, link_token_create): + link_token_create.return_value = MagicMock( + to_dict=lambda: {"link_token": "isalinktoken", "expiration": "isadate"} + ) + action = self.config_settings.action_sync_with_plaid() + self.assertTrue(action) + self.assertEqual(action["type"], "ir.actions.client") + self.assertEqual(action["tag"], "plaid_login") + self.assertEqual(action["params"]["token"], "isalinktoken") diff --git a/account_payment_plaid/views/account_move_views.xml b/account_payment_plaid/views/account_move_views.xml new file mode 100644 index 000000000000..8b1ccb57f266 --- /dev/null +++ b/account_payment_plaid/views/account_move_views.xml @@ -0,0 +1,21 @@ + + + + + account.move.view.form.inherit + account.move + + + +