Ejemplo n.º 1
0
        public static ApiResponse <object> Send(CheckPartnerKycRequest request)
        {
            Dictionary <string, object> body = new Dictionary <string, object>();

            body.Add("header", new Header
            {
                Created   = EpochUtils.getEpoch(),
                AppHandle = AppHandle,
                Crypto    = "ETH",
                Reference = UuidUtils.GetUuid(),
                Version   = "0.2"
            });
            body.Add("query_app_handle", request.QueryAppHandle);
            body.Add("query_user_handle", request.QueryUserHandle);

            string serializedBody = SerializationUtil.Serialize(body);

            Dictionary <string, string> headers = new Dictionary <string, string>();

            headers = HeaderUtils.SetAuthSignature(headers, serializedBody);

            IRestResponse response = (IRestResponse)ApiClient.CallApi(endpoint, RestSharp.Method.POST, serializedBody, headers, "application/json");

            return(ResponseUtils.PrepareResponse <CheckPartnerKycResponse>(response));
        }
Ejemplo n.º 2
0
        public static ApiResponse <object> Send(GetTransactionsRequest request)
        {
            Dictionary <string, object> body = new Dictionary <string, object>();

            body.Add("header", new Header
            {
                Created    = EpochUtils.getEpoch(),
                AppHandle  = AppHandle,
                UserHandle = request.UserHandle,
                Crypto     = "ETH",
                Reference  = UuidUtils.GetUuid(),
                Version    = "0.2"
            });
            body.Add("message", "get_transactions_msg");
            body.Add("search_filters", request.SearchFilters);

            string serializedBody = SerializationUtil.Serialize(body);

            Dictionary <string, string> headers = new Dictionary <string, string>();

            headers = HeaderUtils.SetAuthSignature(headers, serializedBody);

            IRestResponse response = (IRestResponse)ApiClient.CallApi(endpoint, RestSharp.Method.POST, serializedBody, headers, "application/json");

            return(ResponseUtils.PrepareResponse <GetTransactionsResponse>(response));
        }
Ejemplo n.º 3
0
        public static ApiResponse <object> Send(GetInstitutionsRequest request)
        {
            Dictionary <string, object> body          = new Dictionary <string, object>();
            Dictionary <string, object> searchFilters = new Dictionary <string, object>();

            searchFilters.Add("institution_name", request.InstitutionName);
            searchFilters.Add("institution_name", request.RoutingNumber);
            searchFilters.Add("institution_name", request.Page);
            searchFilters.Add("institution_name", request.PerPage);
            body.Add("header", new Header
            {
                Created   = EpochUtils.getEpoch(),
                AppHandle = AppHandle
            });
            body.Add("search_filters", searchFilters);

            string serializedBody = SerializationUtil.Serialize(body);

            Dictionary <string, string> headers = new Dictionary <string, string>();

            headers = HeaderUtils.SetAuthSignature(headers, serializedBody);

            IRestResponse response = (IRestResponse)ApiClient.CallApi(endpoint, RestSharp.Method.POST, serializedBody, headers, "application/json");

            return(ResponseUtils.PrepareResponse <GetInstitutionsResponse>(response));
        }
Ejemplo n.º 4
0
        public static ApiResponse <object> Send(LinkAccountRequest request)
        {
            Dictionary <string, object> body = new Dictionary <string, object>();

            body.Add("header", new Header
            {
                Created    = EpochUtils.getEpoch(),
                AppHandle  = AppHandle,
                UserHandle = request.UserHandle,
                Crypto     = "ETH",
                Reference  = UuidUtils.GetUuid(),
                Version    = "0.2"
            });
            body.Add("account_name", request.AccountName);
            body.Add("account_number", request.AccountNumber);
            body.Add("routing_number", request.RoutingNumber);
            body.Add("account_type", request.AccountType);
            body.Add("plaid_token", request.PlaidToken);
            body.Add("selected_account_id", request.SelectedAccountId);
            body.Add("plaid_token_type", request.PlaidTokenType);

            string serializedBody = SerializationUtil.Serialize(body);

            Console.WriteLine(serializedBody);

            Dictionary <string, string> headers = new Dictionary <string, string>();

            headers = HeaderUtils.SetAuthSignature(headers, serializedBody);
            headers = HeaderUtils.SetUserSignature(headers, serializedBody, request.UserPrivateKey);

            IRestResponse response = (IRestResponse)ApiClient.CallApi(endpoint, RestSharp.Method.POST, serializedBody, headers, "application/json");

            return(ResponseUtils.PrepareResponse <LinkAccountResponse>(response));
        }
Ejemplo n.º 5
0
        public static ApiResponse <object> Send(RegisterRequest request)
        {
            Dictionary <string, object> body = new Dictionary <string, object>();

            body.Add("header", new Header
            {
                Created    = EpochUtils.getEpoch(),
                AppHandle  = AppHandle,
                Crypto     = "ETH",
                Reference  = UuidUtils.GetUuid(),
                UserHandle = request.UserHandle,
                Version    = "0.2"
            });
            body.Add("message", "entity_msg");
            body.Add("address", request.Address);
            body.Add("identity", request.Identity);
            body.Add("contact", request.Contact);
            body.Add("crypto_entry", request.CryptoEntry);
            body.Add("entity", request.Entity);
            body.Add("device", request.Device);

            string serializedBody = SerializationUtil.Serialize(body);

            Dictionary <string, string> headers = new Dictionary <string, string>();

            headers = HeaderUtils.SetAuthSignature(headers, serializedBody);

            IRestResponse response = (IRestResponse)ApiClient.CallApi(endpoint, RestSharp.Method.POST, serializedBody, headers, "application/json");

            return(ResponseUtils.PrepareResponse <RegisterResponse>(response));
        }
Ejemplo n.º 6
0
        public static ApiResponse <object> Send(UpdateAccountRequest request)
        {
            Dictionary <string, object> body = new Dictionary <string, object>();

            body.Add("header", new Header
            {
                Created    = EpochUtils.getEpoch(),
                AppHandle  = AppHandle,
                UserHandle = request.UserHandle,
                Crypto     = "ETH",
                Reference  = UuidUtils.GetUuid(),
                Version    = "0.2"
            });
            body.Add("account_name", request.AccountName);
            body.Add("new_account_name", request.NewAccountName);

            string serializedBody = SerializationUtil.Serialize(body);

            Dictionary <string, string> headers = new Dictionary <string, string>();

            headers = HeaderUtils.SetAuthSignature(headers, serializedBody);
            headers = HeaderUtils.SetUserSignature(headers, serializedBody, request.UserPrivateKey);

            IRestResponse response = (IRestResponse)ApiClient.CallApi(endpoint, RestSharp.Method.POST, serializedBody, headers, "application/json");

            return(ResponseUtils.PrepareResponse <UpdateAccountResponse>(response));
        }
Ejemplo n.º 7
0
        public TrackedMessage(UInt32 position, object message, PID sender, Types.Direction direction)
        {
            millisFromEpoch_ = DateTime.UtcNow.ToEpochMillis();
            Position         = position;
            Sender           = sender;
            Direction        = direction;
            Message.Add("sequence", Position.ToString());

            switch (message)
            {
            //case IChunk chunk:
            //{
            //    Message.Add("type",
            //        $"{chunk.Payload?.GetType()} @{chunk.Position}: {chunk.PartitionId} # {chunk.Index}");
            //    break;
            //}

            case Terminated terminated:
            {
                Message.Add("type", $"{message.GetType().FullName} => {terminated.Who.ToShortString()}");
                break;
            }

            default:
            {
                Message.Add("type", message.GetType().FullName);
                break;
            }
            }

            Message.Add("when", EpochUtils.FromMillis(MillisFromEpoch).ToString("O"));

            if (Sender != null)
            {
                Message.Add("sender", Sender.ToShortString());
            }

            try
            {
                Message.Add("message", JsonConvert.SerializeObject(message, JsonSerializerSettings));
            }
            catch (Exception ex)
            {
                Message.Add("message", $"Error serializing message : {ex.Message}");
            }
        }
        public static ApiResponse <object> Send(PlaidUpdateLinkTokenRequest request)
        {
            Dictionary <string, object> body = new Dictionary <string, object>();

            body.Add("header", new Header
            {
                Created    = EpochUtils.getEpoch(),
                AppHandle  = AppHandle,
                UserHandle = request.UserHandle
            });
            body.Add("account_name", request.AccountName);

            string serializedBody = SerializationUtil.Serialize(body);

            Console.WriteLine(serializedBody);

            Dictionary <string, string> headers = new Dictionary <string, string>();

            headers = HeaderUtils.SetAuthSignature(headers, serializedBody);

            IRestResponse response = (IRestResponse)ApiClient.CallApi(endpoint, RestSharp.Method.POST, serializedBody, headers, "application/json");

            return(ResponseUtils.PrepareResponse <PlaidUpdateLinkTokenResponse>(response));
        }