from q2_sdk.core.http_handlers.wire_handler import Q2WireRequestHandler
from q2_sdk.hq.models.host_account_request import HostAccountRequest
from q2_sdk.hq.models.international_wire_request import InternationalWireRequest
[docs]
class Q2InternationalWireRequestHandler(Q2WireRequestHandler):
"""Adapter type for International wires invoked by commercial users through UUX"""
@property
def wire_request_key(self) -> str:
return "WireInternational_Req"
@property
def wire_type_name(self) -> str:
return "International Wire"
def create_wire_request(self, wire_data: dict):
return InternationalWireRequest(wire_data)
[docs]
async def handle_wire(
self, wire_request, source_account: HostAccountRequest
) -> bool:
return await self.handle_international_wire(wire_request, source_account)
[docs]
async def handle_international_wire(
self,
international_wire: InternationalWireRequest,
source_account: HostAccountRequest,
) -> bool:
"""
Perform your international wire transfer here. If you return true, a transaction will be generated and visible
throughout the q2 platform-- only return 'true' on a success.
:param international_wire: Wire destination and details submitted by user
:param source_account: The account from which to source the transfer
:return: True if the transaction should be generated. False if not.
"""
raise NotImplementedError