def call(cls, profile_id: int) -> List["Account"]: from wise.models import AccountType response: Response = http_requests.get(cls.endpoint.replace("{profile_id}", str(profile_id)).replace("{account_type}", AccountType.CashAccount.value), headers=constants.HEADERS) all_accounts_list: List[Account] = common.get_model_from_response(response, cls) # type: ignore response = http_requests.get(cls.endpoint.replace("{profile_id}", str(profile_id)).replace("{account_type}", AccountType.ReserveAccount.value), headers=constants.HEADERS) all_accounts_list.extend(common.get_model_from_response(response, cls)) # type: ignore return all_accounts_list
def call(cls, source_currency: str = None, target_currency: str = None) -> "ExchangeRate": if source_currency is not None and target_currency is not None: response: Response = http_requests.get(cls.endpoint + f"?source={source_currency}&target={target_currency}", headers=constants.HEADERS) else: response = http_requests.get(cls.endpoint, headers=constants.HEADERS) return common.get_model_from_response(response, cls)[0] # type: ignore
def call(cls, profile_id: int, source_currency: str, target_currency: str, target_amount: float) -> "Quote": parameters: Dict[str, Any] = { "profile": profile_id, "sourceCurrency": source_currency, "targetCurrency": target_currency, "targetAmount": target_amount, "payOut": "BALANCE" } response: Response = http_requests.post(cls.endpoint.replace("{profile_id}", str(profile_id)), parameters=parameters, headers=constants.HEADERS) return common.get_model_from_response(response, cls) # type: ignore
def call(cls, target_account_id: int, quote_uuid: str, reference: str) -> "Transfer": parameters: Dict[str, Any] = { "targetAccount": target_account_id, "quoteUuid": quote_uuid, "customerTransactionId": str(uuid.uuid4()), "details": {"reference": reference} } response: Response = http_requests.post(cls.endpoint, parameters=parameters, headers=constants.HEADERS) return common.get_model_from_response(response, cls) # type: ignore
def call(cls, profile_id: int, source_balance_id: int, target_balance_id: int, amount: float, quote_id: str, currency: str) -> "IntraAccountTransfer": parameters: Dict[str, Any] = { "profileId": profile_id, "sourceBalanceId": source_balance_id, "targetBalanceId": target_balance_id, } if quote_id is None: parameters["amount"] = {"value": amount, "currency": currency} else: parameters["quoteId"] = quote_id headers = constants.HEADERS.copy() headers["X-idempotence-uuid"] = str(uuid.uuid4()) response: Response = http_requests.post(cls.endpoint.replace("{profile_id}", str(profile_id)), parameters=parameters, headers=headers) return common.get_model_from_response(response, cls) # type: ignore
def call(cls) -> List["UserProfiles"]: response: Response = http_requests.get(cls.endpoint, headers=constants.HEADERS) return common.get_model_from_response(response, cls) # type: ignore
def call(cls, profile_id: int, transfer_id: int) -> "Fund": response: Response = http_requests.post(cls.endpoint.replace("{profile_id}", str(profile_id)).replace("{transfer_id}", str(transfer_id)), parameters={"type": "BALANCE"}, headers=constants.HEADERS) return common.get_model_from_response(response, cls) # type: ignore
def call(cls, profile_id: int) -> List["Recipient"]: response: Response = http_requests.get(cls.endpoint.replace("{profile_id}", str(profile_id)), headers=constants.HEADERS) return common.get_model_from_response(response, cls) # type: ignore