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.domestic_wire_request import DomesticWireRequest
[docs]
class Q2DomesticWireRequestHandler(Q2WireRequestHandler):
"""Adapter type for Domestic wires invoked by commercial users through UUX"""
@property
def wire_request_key(self) -> str:
return "WireDomestic_Req"
@property
def wire_type_name(self) -> str:
return "Domestic Wire"
def create_wire_request(self, wire_data: dict):
return DomesticWireRequest(wire_data)
[docs]
async def handle_wire(
self, wire_request, source_account: HostAccountRequest
) -> bool:
return await self.handle_domestic_wire(wire_request, source_account)
[docs]
async def handle_domestic_wire(
self, domestic_wire: DomesticWireRequest, source_account: HostAccountRequest
) -> bool:
"""
Perform your domestic 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 domestic_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